cygcheck: Eenable output of Vista++ FS flags

Also, code cleanup

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
This commit is contained in:
Corinna Vinschen 2016-10-23 15:57:40 +02:00
parent 015f6894a0
commit f16f20ff95
1 changed files with 32 additions and 19 deletions

View File

@ -350,7 +350,8 @@ find_on_path (const char *in_file, const char *ext, bool showall = false,
{
static char rv[4000];
/* Sort of a kludge but we've already tested this once, so don't try it again */
/* Sort of a kludge but we've already tested this once, so don't try it
again */
if (in_file == rv)
return in_file;
@ -363,13 +364,15 @@ find_on_path (const char *in_file, const char *ext, bool showall = false,
*rv = '\0';
if (!in_file)
{
display_error ("internal error find_on_path: NULL pointer for file", false, false);
display_error ("internal error find_on_path: NULL pointer for file",
false, false);
return 0;
}
if (!ext)
{
display_error ("internal error find_on_path: NULL pointer for default_extension", false, false);
display_error ("internal error find_on_path: "
"NULL pointer for default_extension", false, false);
return 0;
}
@ -389,7 +392,8 @@ find_on_path (const char *in_file, const char *ext, bool showall = false,
if (!file)
{
display_error ("internal error find_on_path: cygpath conversion failed for %s\n", in_file);
display_error ("internal error find_on_path: "
"cygpath conversion failed for %s\n", in_file);
return 0;
}
@ -403,7 +407,8 @@ find_on_path (const char *in_file, const char *ext, bool showall = false,
pth->check_existence (file, showall, verbose, rv, ext);
if (checklinks)
pth->check_existence (file, showall, verbose, rv, ext, LINK_EXTENSION);
pth->check_existence (file, showall, verbose, rv, ext,
LINK_EXTENSION);
if (!*ext)
continue;
@ -1183,7 +1188,8 @@ dump_sysinfo_services ()
int ret = fscanf (f, "cygrunsrv V%u.%u", &maj, &min);
if (ferror (f) || feof (f) || ret == EOF || maj < 1 || min < 10)
{
puts ("The version of cygrunsrv installed is too old to dump service info.\n");
puts ("The version of cygrunsrv installed is too old to dump "
"service info.\n");
return;
}
pclose (f);
@ -1191,7 +1197,8 @@ dump_sysinfo_services ()
/* For verbose mode, just run cygrunsrv --list --verbose and copy output
verbatim; otherwise run cygrunsrv --list and then cygrunsrv --query for
each service. */
snprintf (buf, sizeof (buf), (verbose ? "\"%s\" --list --verbose" : "\"%s\" --list"),
snprintf (buf, sizeof (buf),
(verbose ? "\"%s\" --list --verbose" : "\"%s\" --list"),
cygrunsrv);
if ((f = popen (buf, "rt")) == NULL)
{
@ -1225,7 +1232,8 @@ dump_sysinfo_services ()
snprintf (buf2, sizeof (buf2), "\"%s\" --query %s", cygrunsrv, srv);
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;
}
@ -1796,13 +1804,11 @@ dump_sysinfo ()
flags & FS_PERSISTENT_ACLS ? "PA" : " ",
flags & FS_FILE_COMPRESSION ? "FC" : " ",
flags & FS_VOL_IS_COMPRESSED ? "VC" : " ",
#if 0
flags & FILE_SUPPORTS_ENCRYPTION ? "EN" : " ",
flags & FILE_SUPPORTS_OBJECT_IDS ? "OI" : " ",
flags & FILE_SUPPORTS_REPARSE_POINTS ? "RP" : " ",
flags & FILE_SUPPORTS_SPARSE_FILES ? "SP" : " ",
flags & FILE_VOLUME_QUOTAS ? "QU" : " ",
#endif
name);
}
@ -2013,6 +2019,13 @@ static const char safe_chars[] = "$-_.+!*'(),";
static const char base_url[] =
"http://cygwin.com/cgi-bin2/package-grep.cgi?text=1&grep=";
#ifdef __x86_64__
#define ARCH_STR "&arch=x86_64"
#else
#define ARCH_STR "&arch=x86"
#endif
static const char *ARCH_str = ARCH_STR;
/* Queries Cygwin web site for packages containing files matching a regexp.
Return value is 1 if there was a problem, otherwise 0. */
static int
@ -2021,7 +2034,8 @@ package_grep (char *search)
char buf[1024];
/* construct the actual URL by escaping */
char *url = (char *) alloca (sizeof (base_url) + strlen ("&arch=x86_64") + strlen (search) * 3);
char *url = (char *) alloca (sizeof (base_url) + strlen (ARCH_str)
+ strlen (search) * 3);
strcpy (url, base_url);
char *dest;
@ -2039,11 +2053,7 @@ package_grep (char *search)
dest += 2;
}
}
#ifdef __x86_64__
strcpy (dest, "&arch=x86_64");
#else
strcpy (dest, "&arch=x86");
#endif
strcpy (dest, ARCH_str);
/* Connect to the net and open the URL. */
if (InternetAttemptConnect (0) != ERROR_SUCCESS)
@ -2054,7 +2064,8 @@ package_grep (char *search)
/* Initialize WinInet and attempt to fetch our URL. */
HINTERNET hi = NULL, hurl = NULL;
if (!(hi = InternetOpenA ("cygcheck", INTERNET_OPEN_TYPE_PRECONFIG, NULL, NULL, 0)))
if (!(hi = InternetOpenA ("cygcheck", INTERNET_OPEN_TYPE_PRECONFIG,
NULL, NULL, 0)))
return display_internet_error ("InternetOpen() failed", NULL);
if (!(hurl = InternetOpenUrlA (hi, url, NULL, 0, 0, 0)))
@ -2159,8 +2170,10 @@ print_version ()
printf ("cygcheck (cygwin) %d.%d.%d\n"
"System Checker for Cygwin\n"
"Copyright (C) 1998 - %s Cygwin Authors\n"
"This is free software; see the source for copying conditions. There is NO\n"
"warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n",
"This is free software; see the source for copying conditions. "
"There is NO\n"
"warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR "
"PURPOSE.\n",
CYGWIN_VERSION_DLL_MAJOR / 1000,
CYGWIN_VERSION_DLL_MAJOR % 1000,
CYGWIN_VERSION_DLL_MINOR,