summaryrefslogtreecommitdiffstats
path: root/common/sysutils.c
diff options
context:
space:
mode:
authorWerner Koch <wk@gnupg.org>2022-06-02 16:10:37 +0200
committerWerner Koch <wk@gnupg.org>2022-06-03 10:08:21 +0200
commitd2d7a2b128e981740ee3a3c6e2859bec0202cb86 (patch)
treee4e8e62681ca9ae4cb678c0a9ac85d2b25ebd7a9 /common/sysutils.c
parenttools: Minor fix to gpg-connect-agent options. (diff)
downloadgnupg2-d2d7a2b128e981740ee3a3c6e2859bec0202cb86.tar.xz
gnupg2-d2d7a2b128e981740ee3a3c6e2859bec0202cb86.zip
Remove remaining support for WindowsCE
--
Diffstat (limited to 'common/sysutils.c')
-rw-r--r--common/sysutils.c110
1 files changed, 18 insertions, 92 deletions
diff --git a/common/sysutils.c b/common/sysutils.c
index 1342d1016..21b6eefb2 100644
--- a/common/sysutils.c
+++ b/common/sysutils.c
@@ -535,10 +535,7 @@ gnupg_usleep (unsigned int usecs)
int
translate_sys2libc_fd (gnupg_fd_t fd, int for_write)
{
-#if defined(HAVE_W32CE_SYSTEM)
- (void)for_write;
- return (int) fd;
-#elif defined(HAVE_W32_SYSTEM)
+#if defined(HAVE_W32_SYSTEM)
int x;
if (fd == GNUPG_INVALID_FD)
@@ -563,10 +560,7 @@ translate_sys2libc_fd (gnupg_fd_t fd, int for_write)
int
translate_sys2libc_fd_int (int fd, int for_write)
{
-#if HAVE_W32CE_SYSTEM
- fd = (int) _assuan_w32ce_finish_pipe (fd, for_write);
- return translate_sys2libc_fd ((void*)fd, for_write);
-#elif HAVE_W32_SYSTEM
+#ifdef HAVE_W32_SYSTEM
if (fd <= 2)
return fd; /* Do not do this for error, stdin, stdout, stderr. */
@@ -611,15 +605,8 @@ gnupg_tmpfile (void)
{
#ifdef HAVE_W32_SYSTEM
int attempts, n;
-#ifdef HAVE_W32CE_SYSTEM
- wchar_t buffer[MAX_PATH+7+12+1];
-# define mystrlen(a) wcslen (a)
- wchar_t *name, *p;
-#else
char buffer[MAX_PATH+7+12+1];
-# define mystrlen(a) strlen (a)
char *name, *p;
-#endif
HANDLE file;
int pid = GetCurrentProcessId ();
unsigned int value;
@@ -631,18 +618,13 @@ gnupg_tmpfile (void)
sec_attr.bInheritHandle = TRUE;
n = GetTempPath (MAX_PATH+1, buffer);
- if (!n || n > MAX_PATH || mystrlen (buffer) > MAX_PATH)
+ if (!n || n > MAX_PATH || strlen (buffer) > MAX_PATH)
{
gpg_err_set_errno (ENOENT);
return NULL;
}
- p = buffer + mystrlen (buffer);
-#ifdef HAVE_W32CE_SYSTEM
- wcscpy (p, L"_gnupg");
- p += 7;
-#else
+ p = buffer + strlen (buffer);
p = stpcpy (p, "_gnupg");
-#endif
/* We try to create the directory but don't care about an error as
it may already exist and the CreateFile would throw an error
anyway. */
@@ -658,11 +640,7 @@ gnupg_tmpfile (void)
*p++ = tohex (((value >> 28) & 0x0f));
value <<= 4;
}
-#ifdef HAVE_W32CE_SYSTEM
- wcscpy (p, L".tmp");
-#else
strcpy (p, ".tmp");
-#endif
file = CreateFile (buffer,
GENERIC_READ | GENERIC_WRITE,
0,
@@ -673,10 +651,6 @@ gnupg_tmpfile (void)
if (file != INVALID_HANDLE_VALUE)
{
FILE *fp;
-#ifdef HAVE_W32CE_SYSTEM
- int fd = (int)file;
- fp = _wfdopen (fd, L"w+b");
-#else
int fd = _open_osfhandle ((intptr_t)file, 0);
if (fd == -1)
{
@@ -684,7 +658,6 @@ gnupg_tmpfile (void)
return NULL;
}
fp = fdopen (fd, "w+b");
-#endif
if (!fp)
{
int save = errno;
@@ -698,9 +671,11 @@ gnupg_tmpfile (void)
}
gpg_err_set_errno (ENOENT);
return NULL;
-#undef mystrlen
+
#else /*!HAVE_W32_SYSTEM*/
+
return tmpfile ();
+
#endif /*!HAVE_W32_SYSTEM*/
}
@@ -799,7 +774,7 @@ gnupg_allow_set_foregound_window (pid_t pid)
if (!pid)
log_info ("%s called with invalid pid %lu\n",
"gnupg_allow_set_foregound_window", (unsigned long)pid);
-#if defined(HAVE_W32_SYSTEM) && !defined(HAVE_W32CE_SYSTEM)
+#if defined(HAVE_W32_SYSTEM)
else if (inhibit_set_foregound_window)
;
else if (!AllowSetForegroundWindow ((pid_t)pid == (pid_t)(-1)?ASFW_ANY:pid))
@@ -1148,13 +1123,7 @@ gnupg_mkdtemp (char *tmpl)
int
gnupg_setenv (const char *name, const char *value, int overwrite)
{
-#ifdef HAVE_W32CE_SYSTEM
- (void)name;
- (void)value;
- (void)overwrite;
- return 0;
-#else /*!W32CE*/
-# ifdef HAVE_W32_SYSTEM
+#ifdef HAVE_W32_SYSTEM
/* Windows maintains (at least) two sets of environment variables.
One set can be accessed by GetEnvironmentVariable and
SetEnvironmentVariable. This set is inherited by the children.
@@ -1172,11 +1141,11 @@ gnupg_setenv (const char *name, const char *value, int overwrite)
return -1;
}
}
-# endif /*W32*/
+#endif /*W32*/
-# ifdef HAVE_SETENV
+#ifdef HAVE_SETENV
return setenv (name, value, overwrite);
-# else /*!HAVE_SETENV*/
+#else /*!HAVE_SETENV*/
if (! getenv (name) || overwrite)
{
char *buf;
@@ -1196,19 +1165,14 @@ gnupg_setenv (const char *name, const char *value, int overwrite)
return putenv (buf);
}
return 0;
-# endif /*!HAVE_SETENV*/
-#endif /*!W32CE*/
+#endif /*!HAVE_SETENV*/
}
int
gnupg_unsetenv (const char *name)
{
-#ifdef HAVE_W32CE_SYSTEM
- (void)name;
- return 0;
-#else /*!W32CE*/
-# ifdef HAVE_W32_SYSTEM
+#ifdef HAVE_W32_SYSTEM
/* Windows maintains (at least) two sets of environment variables.
One set can be accessed by GetEnvironmentVariable and
SetEnvironmentVariable. This set is inherited by the children.
@@ -1220,11 +1184,11 @@ gnupg_unsetenv (const char *name)
gpg_err_set_errno (EINVAL); /* (Might also be ENOMEM.) */
return -1;
}
-# endif /*W32*/
+#endif /*W32*/
-# ifdef HAVE_UNSETENV
+#ifdef HAVE_UNSETENV
return unsetenv (name);
-# else /*!HAVE_UNSETENV*/
+#else /*!HAVE_UNSETENV*/
{
char *buf;
@@ -1241,8 +1205,7 @@ gnupg_unsetenv (const char *name)
# endif
return putenv (buf);
}
-# endif /*!HAVE_UNSETENV*/
-#endif /*!W32CE*/
+#endif /*!HAVE_UNSETENV*/
}
@@ -1571,43 +1534,6 @@ gnupg_chuid (const char *user, int silent)
-#ifdef HAVE_W32CE_SYSTEM
-/* There is a isatty function declaration in cegcc but it does not
- make sense, thus we redefine it. */
-int
-_gnupg_isatty (int fd)
-{
- (void)fd;
- return 0;
-}
-#endif
-
-
-#ifdef HAVE_W32CE_SYSTEM
-/* Replacement for getenv which takes care of the our use of getenv.
- The code is not thread safe but we expect it to work in all cases
- because it is called for the first time early enough. */
-char *
-_gnupg_getenv (const char *name)
-{
- static int initialized;
- static char *assuan_debug;
-
- if (!initialized)
- {
- assuan_debug = read_w32_registry_string (NULL,
- "\\Software\\GNU\\libassuan",
- "debug");
- initialized = 1;
- }
-
- if (!strcmp (name, "ASSUAN_DEBUG"))
- return assuan_debug;
- else
- return NULL;
-}
-
-#endif /*HAVE_W32CE_SYSTEM*/
#ifdef HAVE_W32_SYSTEM