* cygcheck.cc (track_down, cygcheck): Return true on success.

(main): Reflect cygcheck failures in exit status.
This commit is contained in:
Christopher Faylor 2005-07-05 21:41:37 +00:00
parent d3b593aa44
commit 27eb5dbc70
2 changed files with 25 additions and 16 deletions

View File

@ -1,3 +1,8 @@
2005-07-05 Eric Blake <ebb9@byu.net>
* cygcheck.cc (track_down, cygcheck): Return true on success.
(main): Reflect cygcheck failures in exit status.
2005-06-14 Corinna Vinschen <corinna@vinschen.de>
* parse_pe.c (exclusion::sort_and_check): Remove crude cast.
@ -153,9 +158,9 @@
2004-11-13 Pierre Humblet <pierre.humblet@ieee.org>
* kill.cc (forcekill): Do not pass negative pids to
* kill.cc (forcekill): Do not pass negative pids to
cygwin_internal. Check if sig == 0. Improve error messages.
(main): Make pid a long long and distinguish between pids, gpids
(main): Make pid a long long and distinguish between pids, gpids
(i.e. negative pids) and Win9x pids.
2004-11-11 Bas van Gompel <cygwin-patch.buzz@bavag.tmfweb.nl>

View File

@ -364,7 +364,7 @@ struct ImpDirectory
};
static void track_down (char *file, char *suffix, int lvl);
static bool track_down (char *file, char *suffix, int lvl);
#define CYGPREFIX (sizeof ("%%% Cygwin ") - 1)
static void
@ -554,26 +554,27 @@ dll_info (const char *path, HANDLE fh, int lvl, int recurse)
cygwin_info (fh);
}
static void
// Return true on success, false if error printed
static bool
track_down (char *file, char *suffix, int lvl)
{
if (file == NULL)
{
display_error ("track_down: NULL passed for file", true, false);
return;
return false;
}
if (suffix == NULL)
{
display_error ("track_down: NULL passed for suffix", false, false);
return;
return false;
}
char *path = find_on_path (file, suffix, 0, 1);
if (!path)
{
printf ("Error: could not find %s\n", file);
return;
return false;
}
Did *d = already_did (file);
@ -589,7 +590,7 @@ track_down (char *file, char *suffix, int lvl)
printf ("%s", path);
printf (" (recursive)\n");
}
return;
return true;
case DID_INACTIVE:
if (verbose)
{
@ -598,7 +599,7 @@ track_down (char *file, char *suffix, int lvl)
printf ("%s", path);
printf (" (already done)\n");
}
return;
return true;
default:
break;
}
@ -609,7 +610,7 @@ track_down (char *file, char *suffix, int lvl)
if (!path)
{
printf ("%s not found\n", file);
return;
return false;
}
printf ("%s", path);
@ -620,7 +621,7 @@ track_down (char *file, char *suffix, int lvl)
if (fh == INVALID_HANDLE_VALUE)
{
printf (" - Cannot open\n");
return;
return false;
}
d->state = DID_ACTIVE;
@ -629,6 +630,7 @@ track_down (char *file, char *suffix, int lvl)
d->state = DID_INACTIVE;
if (!CloseHandle (fh))
display_error ("track_down: CloseHandle()");
return true;
}
static void
@ -653,14 +655,15 @@ ls (char *f)
display_error ("ls: CloseHandle()");
}
static void
// Return true on success, false if error printed
static bool
cygcheck (char *app)
{
char *papp = find_on_path (app, (char *) ".exe", 1, 0);
if (!papp)
{
printf ("Error: could not find %s\n", app);
return;
return false;
}
char *s = strdup (papp);
char *sl = 0, *t;
@ -675,7 +678,7 @@ cygcheck (char *app)
paths[0] = s;
}
did = 0;
track_down (papp, (char *) ".exe", 0);
return track_down (papp, (char *) ".exe", 0);
}
@ -1590,6 +1593,7 @@ int
main (int argc, char **argv)
{
int i;
bool ok = true;
load_cygwin (argc, argv);
(void) putenv("POSIXLY_CORRECT=1");
@ -1677,7 +1681,7 @@ main (int argc, char **argv)
{
if (i)
puts ("");
cygcheck (argv[i]);
ok &= cygcheck (argv[i]);
}
if (sysinfo)
@ -1693,5 +1697,5 @@ main (int argc, char **argv)
puts ("Use -h to see help about each section");
}
return 0;
return ok ? EXIT_SUCCESS : EXIT_FAILURE;
}