From 733722108d28ac3711c8817ff213bddf429d0a8f Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Tue, 6 May 2008 02:50:26 +0000 Subject: [PATCH] move Windows stub functions to the global sysdep.h header rather than duplicating everywhere git-svn-id: https://urjtag.svn.sourceforge.net/svnroot/urjtag/trunk@1204 b68d4a1b-bc3d-0410-92ed-d4ac073336b7 --- jtag/ChangeLog | 3 +++ jtag/src/flash/amd.c | 5 ----- jtag/src/flash/amd_flash.c | 5 ----- jtag/src/jtag.c | 2 -- jtag/sysdep.h | 8 ++++++++ 5 files changed, 11 insertions(+), 12 deletions(-) diff --git a/jtag/ChangeLog b/jtag/ChangeLog index cfce87d9..2ca87677 100644 --- a/jtag/ChangeLog +++ b/jtag/ChangeLog @@ -7,6 +7,9 @@ non-POSIX ports (like mingw). * src/cmd/include.c (cmd_include_or_script_run): Add handling of absolute paths under Windows that take the form :\. + * sysdep.h, src/flash/amd.c, src/flash/amd_flash.c, src/jtag.c: Move some + Windows stub functions to sysdep.h so we don't have to redeclare them in + every single file and so we don't trigger future bitrot. 2008-05-04 Mike Frysinger diff --git a/jtag/src/flash/amd.c b/jtag/src/flash/amd.c index e6a63833..3de130cb 100644 --- a/jtag/src/flash/amd.c +++ b/jtag/src/flash/amd.c @@ -43,11 +43,6 @@ #include #include -#ifdef __MINGW32__ -#include -#define usleep(x) Sleep(x/1E3) -#endif - static int dbg = 0; static int amd_flash_erase_block( cfi_array_t *cfi_array, uint32_t adr ); diff --git a/jtag/src/flash/amd_flash.c b/jtag/src/flash/amd_flash.c index fb6265ea..c5599418 100644 --- a/jtag/src/flash/amd_flash.c +++ b/jtag/src/flash/amd_flash.c @@ -39,11 +39,6 @@ #include #include -#ifdef __MINGW32__ -#include -#define usleep(x) Sleep(x/1E3) -#endif - //write specific #define AMD_SECTOR_PROTECTED diff --git a/jtag/src/jtag.c b/jtag/src/jtag.c index 23f8e954..b5adbc73 100644 --- a/jtag/src/jtag.c +++ b/jtag/src/jtag.c @@ -290,13 +290,11 @@ main( int argc, char *const argv[] ) jtag_argv0 = argv[0]; -#ifndef __MINGW32__ if(geteuid()==0 && getuid()!=0) { printf (_("'%s' must not be run suid root!\n"), "jtag"); return(-1); } -#endif #ifdef ENABLE_NLS /* l10n support */ diff --git a/jtag/sysdep.h b/jtag/sysdep.h index 623fb22b..52feb74d 100644 --- a/jtag/sysdep.h +++ b/jtag/sysdep.h @@ -43,4 +43,12 @@ #define ngettext(s,p,n) s #endif +#ifdef __MINGW32__ +#define _NO_W32_PSEUDO_MODIFIERS +#include +#define geteuid() 0 +#define getuid() 0 +#define usleep(x) Sleep(x/1E3) +#endif + #endif /* SYSDEP_H */