* cygcheck.cc (load_cygwin): Make half-hearted attempt to work with older DLLs.

* strace.cc (load_cygwin): Ditto.
This commit is contained in:
Christopher Faylor 2005-05-27 15:45:53 +00:00
parent 720c77ee72
commit cba3b11fc5
3 changed files with 39 additions and 34 deletions

View File

@ -1,3 +1,9 @@
2005-05-27 Christopher Faylor <cgf@timesys.com>
* cygcheck.cc (load_cygwin): Make half-hearted attempt to work with
older DLLs.
* strace.cc (load_cygwin): Ditto.
2005-05-22 Brian Dessent <brian@dessent.net> 2005-05-22 Brian Dessent <brian@dessent.net>
* cygcheck.cc (dump_sysinfo_services): Add new function that uses * cygcheck.cc (dump_sysinfo_services): Add new function that uses

View File

@ -881,7 +881,7 @@ dump_sysinfo_services ()
if (givehelp) if (givehelp)
printf ("\nChecking for any Cygwin services... %s\n\n", printf ("\nChecking for any Cygwin services... %s\n\n",
verbose ? "" : "(use -v for more detail)"); verbose ? "" : "(use -v for more detail)");
else else
fputc ('\n', stdout); fputc ('\n', stdout);
@ -929,32 +929,31 @@ dump_sysinfo_services ()
return; return;
} }
/* In verbose mode, just run 'cygrunsrv --list --verbose' and copy the /* In verbose mode, just run 'cygrunsrv --list --verbose' and copy the
entire output. Otherwise run 'cygrunsrv --query' for each service. */ entire output. Otherwise run 'cygrunsrv --query' for each service. */
for (char *srv = strtok (buf, "\n"); srv; srv = strtok (NULL, "\n")) for (char *srv = strtok (buf, "\n"); srv; srv = strtok (NULL, "\n"))
{ {
if (verbose) if (verbose)
snprintf (buf2, sizeof (buf2), "%s --list --verbose", cygrunsrv); snprintf (buf2, sizeof (buf2), "%s --list --verbose", cygrunsrv);
else else
snprintf (buf2, sizeof (buf2), "%s --query %s", cygrunsrv, srv); snprintf (buf2, sizeof (buf2), "%s --query %s", cygrunsrv, srv);
if ((f = popen (buf2, "rt")) == NULL) if ((f = popen (buf2, "rt")) == NULL)
{ {
printf ("Failed to execute '%s', skipping services check.\n", buf2); printf ("Failed to execute '%s', skipping services check.\n", buf2);
return; return;
} }
/* copy output to stdout */ /* copy output to stdout */
do do
{ {
nchars = fread ((void *)buf2, 1, sizeof (buf2), f); nchars = fread ((void *)buf2, 1, sizeof (buf2), f);
fwrite ((void *)buf2, 1, nchars, stdout); fwrite ((void *)buf2, 1, nchars, stdout);
} }
while (!feof (f) && !ferror (f)); while (!feof (f) && !ferror (f));
pclose (f); pclose (f);
if (verbose) if (verbose)
break; break;
} }
} }
@ -1552,15 +1551,15 @@ load_cygwin (int& argc, char **&argv)
return; return;
char **av = (char **) cygwin_internal (CW_ARGV); char **av = (char **) cygwin_internal (CW_ARGV);
if (av) if (av && ((DWORD) av != (DWORD) -1))
for (argc = 0, argv = av; *av; av++) for (argc = 0, argv = av; *av; av++)
argc++; argc++;
char **envp = (char **) cygwin_internal (CW_ENVP); char **envp = (char **) cygwin_internal (CW_ENVP);
if (envp) if (envp && ((DWORD) envp != (DWORD) -1))
{ {
/* Store path and revert to this value, otherwise path gets overwritten /* Store path and revert to this value, otherwise path gets overwritten
by the POSIXy Cygwin variation, which breaks cygcheck. by the POSIXy Cygwin variation, which breaks cygcheck.
Another approach would be to use the Cygwin PATH and convert it to Another approach would be to use the Cygwin PATH and convert it to
Win32 again. */ Win32 again. */
char *path = NULL; char *path = NULL;
@ -1570,7 +1569,7 @@ load_cygwin (int& argc, char **&argv)
if (strncmp (*env, "PATH=", 5) == 0) if (strncmp (*env, "PATH=", 5) == 0)
path = strdup (*env); path = strdup (*env);
nuke (*env); nuke (*env);
} }
for (char **ev = envp; *ev; ev++) for (char **ev = envp; *ev; ev++)
if (strncmp (*ev, "PATH=", 5) != 0) if (strncmp (*ev, "PATH=", 5) != 0)
putenv (*ev); putenv (*ev);

View File

@ -909,7 +909,7 @@ main (int argc, char **argv)
if (load_cygwin ()) if (load_cygwin ())
{ {
char **av = (char **) cygwin_internal (CW_ARGV); char **av = (char **) cygwin_internal (CW_ARGV);
if (av) if (av && (DWORD) av != (DWORD) -1)
for (argc = 0, argv = av; *av; av++) for (argc = 0, argv = av; *av; av++)
argc++; argc++;
} }