* Align usage output, version output, as well as usage and version

option handling to use the same style throughout all Cygwin utils.
	Throughout use program_invocation_short_name to refer to current
	process name in Cygwin executables.
	* utils.sgml: Align documentation to above change.  Add missing
	sections for getconf, ldd, and setmetamode.
	* strace.cc (proc_child): Avoid compiler warning.
This commit is contained in:
Corinna Vinschen 2011-10-10 14:57:48 +00:00
parent 4fc8a5c90a
commit 92b499acff
21 changed files with 687 additions and 611 deletions

View File

@ -1,3 +1,13 @@
2011-10-10 Corinna Vinschen <corinna@vinschen.de>
* Align usage output, version output, as well as usage and version
option handling to use the same style throughout all Cygwin utils.
Throughout use program_invocation_short_name to refer to current
process name in Cygwin executables.
* utils.sgml: Align documentation to above change. Add missing
sections for getconf, ldd, and setmetamode.
* strace.cc (proc_child): Avoid compiler warning.
2011-10-10 Andy Koppe <andy.koppe@gmail.com> 2011-10-10 Andy Koppe <andy.koppe@gmail.com>
Corinna Vinschen <corinna@vinschen.de> Corinna Vinschen <corinna@vinschen.de>

View File

@ -22,9 +22,11 @@
#include "path.h" #include "path.h"
#include "wide_path.h" #include "wide_path.h"
#include <getopt.h> #include <getopt.h>
#include "cygwin/include/cygwin/version.h"
#include "cygwin/include/sys/cygwin.h" #include "cygwin/include/sys/cygwin.h"
#include "cygwin/include/mntent.h" #include "cygwin/include/mntent.h"
#include "cygwin/cygprops.h" #include "cygwin/cygprops.h"
#include "cygwin/version.h"
#undef cygwin_internal #undef cygwin_internal
#include "loadlib.h" #include "loadlib.h"
@ -64,8 +66,6 @@ void dump_dodgy_apps (int verbose);
/* Forward declaration */ /* Forward declaration */
static void usage (FILE *, int); static void usage (FILE *, int);
static const char version[] = "$Revision$";
static const char *known_env_vars[] = { static const char *known_env_vars[] = {
"c_include_path", "c_include_path",
"compiler_path", "compiler_path",
@ -2237,24 +2237,15 @@ static char opts[] = "cdsrvkflphV";
static void static void
print_version () print_version ()
{ {
const char *v = strchr (version, ':'); printf ("cygcheck (cygwin) %d.%d.%d\n"
int len; "System Checker for Cygwin\n"
if (!v) "Copyright (C) 1998 - %s Red Hat, Inc.\n"
{ "This is free software; see the source for copying conditions. There is NO\n"
v = "?"; "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n",
len = 1; CYGWIN_VERSION_DLL_MAJOR / 1000,
} CYGWIN_VERSION_DLL_MAJOR % 1000,
else CYGWIN_VERSION_DLL_MINOR,
{ strrchr (__DATE__, ' ') + 1);
v += 2;
len = strchr (v, ' ') - v;
}
printf ("\
cygcheck version %.*s\n\
System Checker for Cygwin\n\
Copyright (C) 1998 - 2008 Red Hat, Inc.\n\
Compiled on %s\n\
", len, v, __DATE__);
} }
void void
@ -2376,8 +2367,10 @@ main (int argc, char **argv)
print_version (); print_version ();
exit (0); exit (0);
default: default:
usage (stderr, 1); fprintf (stderr, "Try `cygcheck --help' for more information.\n");
/*NOTREACHED*/} exit (1);
/*NOTREACHED*/
}
argc -= optind; argc -= optind;
argv += optind; argv += optind;
if (posixly == NULL) if (posixly == NULL)

View File

@ -22,6 +22,7 @@ details. */
#include <io.h> #include <io.h>
#include <sys/fcntl.h> #include <sys/fcntl.h>
#include <sys/cygwin.h> #include <sys/cygwin.h>
#include <cygwin/version.h>
#include <ctype.h> #include <ctype.h>
#include <errno.h> #include <errno.h>
#include <ddk/ntddk.h> #include <ddk/ntddk.h>
@ -30,8 +31,6 @@ details. */
#include "wide_path.h" #include "wide_path.h"
#include "loadlib.h" #include "loadlib.h"
static const char version[] = "$Revision$";
static char *prog_name; static char *prog_name;
static char *file_arg, *output_arg; static char *file_arg, *output_arg;
static int path_flag, unix_flag, windows_flag, absolute_flag; static int path_flag, unix_flag, windows_flag, absolute_flag;
@ -57,7 +56,7 @@ static struct option long_options[] = {
{(char *) "short-name", no_argument, NULL, 's'}, {(char *) "short-name", no_argument, NULL, 's'},
{(char *) "type", required_argument, NULL, 't'}, {(char *) "type", required_argument, NULL, 't'},
{(char *) "unix", no_argument, NULL, 'u'}, {(char *) "unix", no_argument, NULL, 'u'},
{(char *) "version", no_argument, NULL, 'v'}, {(char *) "version", no_argument, NULL, 'V'},
{(char *) "windows", no_argument, NULL, 'w'}, {(char *) "windows", no_argument, NULL, 'w'},
{(char *) "allusers", no_argument, NULL, 'A'}, {(char *) "allusers", no_argument, NULL, 'A'},
{(char *) "desktop", no_argument, NULL, 'D'}, {(char *) "desktop", no_argument, NULL, 'D'},
@ -71,27 +70,31 @@ static struct option long_options[] = {
{0, no_argument, 0, 0} {0, no_argument, 0, 0}
}; };
static char options[] = "ac:df:hilmMopst:uvwAC:DHOPSWF:"; static char options[] = "ac:df:hilmMopst:uVwAC:DHOPSWF:";
static void static void
usage (FILE * stream, int status) usage (FILE * stream, int status)
{ {
if (!ignore_flag || !status) if (!ignore_flag || !status)
fprintf (stream, "\ fprintf (stream, "\
Usage: %s (-d|-m|-u|-w|-t TYPE) [-f FILE] [OPTION]... NAME...\n\ Usage: %1$s (-d|-m|-u|-w|-t TYPE) [-f FILE] [OPTION]... NAME...\n\
%s [-c HANDLE] \n\ %1$s [-c HANDLE] \n\
%s [-ADHOPSW] \n\ %1$s [-ADHOPSW] \n\
%s [-F ID] \n\ %1$s [-F ID] \n\
\n\
Convert Unix and Windows format paths, or output system path information\n\ Convert Unix and Windows format paths, or output system path information\n\
\n\ \n\
Output type options:\n\ Output type options:\n\
\n\
-d, --dos print DOS (short) form of NAMEs (C:\\PROGRA~1\\)\n\ -d, --dos print DOS (short) form of NAMEs (C:\\PROGRA~1\\)\n\
-m, --mixed like --windows, but with regular slashes (C:/WINNT)\n\ -m, --mixed like --windows, but with regular slashes (C:/WINNT)\n\
-M, --mode report on mode of file (binmode or textmode)\n\ -M, --mode report on mode of file (binmode or textmode)\n\
-u, --unix (default) print Unix form of NAMEs (/cygdrive/c/winnt)\n\ -u, --unix (default) print Unix form of NAMEs (/cygdrive/c/winnt)\n\
-w, --windows print Windows form of NAMEs (C:\\WINNT)\n\ -w, --windows print Windows form of NAMEs (C:\\WINNT)\n\
-t, --type TYPE print TYPE form: 'dos', 'mixed', 'unix', or 'windows'\n\ -t, --type TYPE print TYPE form: 'dos', 'mixed', 'unix', or 'windows'\n\
\n\
Path conversion options:\n\ Path conversion options:\n\
\n\
-a, --absolute output absolute path\n\ -a, --absolute output absolute path\n\
-l, --long-name print Windows long form of NAMEs (with -w, -m only)\n\ -l, --long-name print Windows long form of NAMEs (with -w, -m only)\n\
-p, --path NAME is a PATH list (i.e., '/bin:/usr/bin')\n\ -p, --path NAME is a PATH list (i.e., '/bin:/usr/bin')\n\
@ -99,9 +102,11 @@ Path conversion options:\n\
-C, --codepage CP print DOS, Windows, or mixed pathname in Windows\n\ -C, --codepage CP print DOS, Windows, or mixed pathname in Windows\n\
codepage CP. CP can be a numeric codepage identifier,\n\ codepage CP. CP can be a numeric codepage identifier,\n\
or one of the reserved words ANSI, OEM, or UTF8.\n\ or one of the reserved words ANSI, OEM, or UTF8.\n\
If this option is missing, %s defaults to the\n\ If this option is missing, %1$s defaults to the\n\
character set defined by the current locale.\n\ character set defined by the current locale.\n\
\n\
System information:\n\ System information:\n\
\n\
-A, --allusers use `All Users' instead of current user for -D, -O, -P\n\ -A, --allusers use `All Users' instead of current user for -D, -O, -P\n\
-D, --desktop output `Desktop' directory and exit\n\ -D, --desktop output `Desktop' directory and exit\n\
-H, --homeroot output `Profiles' directory (home root) and exit\n\ -H, --homeroot output `Profiles' directory (home root) and exit\n\
@ -110,7 +115,7 @@ System information:\n\
-S, --sysdir output system directory and exit\n\ -S, --sysdir output system directory and exit\n\
-W, --windir output `Windows' directory and exit\n\ -W, --windir output `Windows' directory and exit\n\
-F, --folder ID output special folder with numeric ID and exit\n\ -F, --folder ID output special folder with numeric ID and exit\n\
", prog_name, prog_name, prog_name, prog_name, prog_name); ", prog_name);
if (ignore_flag) if (ignore_flag)
/* nothing to do */; /* nothing to do */;
else if (stream != stdout) else if (stream != stdout)
@ -118,14 +123,16 @@ System information:\n\
else else
{ {
fprintf (stream, "\ fprintf (stream, "\
\n\
Other options:\n\ Other options:\n\
\n\
-f, --file FILE read FILE for input; use - to read from STDIN\n\ -f, --file FILE read FILE for input; use - to read from STDIN\n\
-o, --option read options from FILE as well (for use with --file)\n\ -o, --option read options from FILE as well (for use with --file)\n\
-c, --close HANDLE close HANDLE (for use in captured process)\n\ -c, --close HANDLE close HANDLE (for use in captured process)\n\
-i, --ignore ignore missing argument\n\ -i, --ignore ignore missing argument\n\
-h, --help output usage information and exit\n\ -h, --help output usage information and exit\n\
-v, --version output version information and exit\n\ -V, --version output version information and exit\n\
"); \n");
} }
exit (ignore_flag ? 0 : status); exit (ignore_flag ? 0 : status);
} }
@ -374,8 +381,8 @@ get_short_paths (char *path)
len = GetShortPathNameW (wpath, NULL, 0); len = GetShortPathNameW (wpath, NULL, 0);
if (!len) if (!len)
{ {
fprintf (stderr, "%s: cannot create short name of %s\n", prog_name, fprintf (stderr, "%s: cannot create short name of %s\n",
next); prog_name, next);
exit (2); exit (2);
} }
acc += len + 1; acc += len + 1;
@ -393,8 +400,8 @@ get_short_paths (char *path)
len = GetShortPathNameW (wpath, sptr, acc); len = GetShortPathNameW (wpath, sptr, acc);
if (!len) if (!len)
{ {
fprintf (stderr, "%s: cannot create short name of %s\n", prog_name, fprintf (stderr, "%s: cannot create short name of %s\n",
ptr); prog_name, ptr);
exit (2); exit (2);
} }
@ -426,8 +433,8 @@ get_short_name (const char *filename)
DWORD len = GetShortPathNameW (wpath, buf, 32768); DWORD len = GetShortPathNameW (wpath, buf, 32768);
if (!len) if (!len)
{ {
fprintf (stderr, "%s: cannot create short name of %s\n", prog_name, fprintf (stderr, "%s: cannot create short name of %s\n",
filename); prog_name, filename);
exit (2); exit (2);
} }
len = my_wcstombs (NULL, buf, 0) + 1; len = my_wcstombs (NULL, buf, 0) + 1;
@ -515,8 +522,8 @@ get_long_name (const char *filename, DWORD& len)
if (err == ERROR_INVALID_PARAMETER) if (err == ERROR_INVALID_PARAMETER)
{ {
fprintf (stderr, "%s: cannot create long name of %s\n", prog_name, fprintf (stderr, "%s: cannot create long name of %s\n",
filename); prog_name, filename);
exit (2); exit (2);
} }
else if (err == ERROR_FILE_NOT_FOUND) else if (err == ERROR_FILE_NOT_FOUND)
@ -698,7 +705,8 @@ do_sysfolders (char option)
if (!buf[0]) if (!buf[0])
{ {
fprintf (stderr, "%s: failed to retrieve special folder path\n", prog_name); fprintf (stderr, "%s: failed to retrieve special folder path\n",
prog_name);
} }
else if (!windows_flag) else if (!windows_flag)
{ {
@ -733,8 +741,8 @@ report_mode (char *filename)
printf ("%s: text\n", filename); printf ("%s: text\n", filename);
break; break;
default: default:
fprintf (stderr, "%s: file '%s' - %s\n", prog_name, filename, fprintf (stderr, "%s: file '%s' - %s\n", prog_name,
strerror (errno)); filename, strerror (errno));
break; break;
} }
} }
@ -762,7 +770,8 @@ do_pathconv (char *filename)
exit (0); exit (0);
else else
{ {
fprintf (stderr, "%s: can't convert empty path\n", prog_name); fprintf (stderr, "%s: can't convert empty path\n",
prog_name);
exit (1); exit (1);
} }
} }
@ -863,25 +872,15 @@ do_pathconv (char *filename)
static void static void
print_version () print_version ()
{ {
const char *v = strchr (version, ':'); printf ("cygpath (cygwin) %d.%d.%d\n"
int len; "Path Conversion Utility\n"
if (!v) "Copyright (C) 1998 - %s Red Hat, Inc.\n"
{ "This is free software; see the source for copying conditions. There is NO\n"
v = "?"; "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n",
len = 1; CYGWIN_VERSION_DLL_MAJOR / 1000,
} CYGWIN_VERSION_DLL_MAJOR % 1000,
else CYGWIN_VERSION_DLL_MINOR,
{ strrchr (__DATE__, ' ') + 1);
v += 2;
len = strchr (v, ' ') - v;
}
printf ("\
cygpath (cygwin) %.*s\n\
Path Conversion Utility\n\
Copyright 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, \n\
2007, 2008, 2009, 2010 Red Hat, Inc.\n\
Compiled on %s\n\
", len, v, __DATE__);
} }
static int static int
@ -1035,13 +1034,14 @@ do_options (int argc, char **argv, int from_file)
usage (stdout, 0); usage (stdout, 0);
break; break;
case 'v': case 'V':
print_version (); print_version ();
exit (0); exit (0);
default: default:
usage (stderr, 1); fprintf (stderr, "Try `%s --help' for more information.\n",
break; prog_name);
exit (1);
} }
} }
@ -1099,13 +1099,7 @@ main (int argc, char **argv)
int o; int o;
setlocale (LC_CTYPE, ""); setlocale (LC_CTYPE, "");
prog_name = strrchr (argv[0], '/'); prog_name = program_invocation_short_name;
if (!prog_name)
prog_name = strrchr (argv[0], '\\');
if (!prog_name)
prog_name = argv[0];
else
prog_name++;
o = do_options (argc, argv, 0); o = do_options (argc, argv, 0);

View File

@ -1,6 +1,6 @@
/* dumper.cc /* dumper.cc
Copyright 1999, 2001, 2002, 2004, 2006, 2007 Red Hat Inc. Copyright 1999, 2001, 2002, 2004, 2006, 2007, 2011 Red Hat Inc.
Written by Egor Duda <deo@logos-m.ru> Written by Egor Duda <deo@logos-m.ru>
@ -26,8 +26,10 @@
#include <elf/external.h> #include <elf/external.h>
#include <sys/procfs.h> #include <sys/procfs.h>
#include <sys/cygwin.h> #include <sys/cygwin.h>
#include <cygwin/version.h>
#include <getopt.h> #include <getopt.h>
#include <stdarg.h> #include <stdarg.h>
#include <errno.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <unistd.h> #include <unistd.h>
@ -47,8 +49,6 @@ __attribute__ ((packed))
#endif #endif
note_header; note_header;
static const char version[] = "$Revision$";
BOOL verbose = FALSE; BOOL verbose = FALSE;
int deb_printf (const char *format,...) int deb_printf (const char *format,...)
@ -842,14 +842,15 @@ static void
usage (FILE *stream, int status) usage (FILE *stream, int status)
{ {
fprintf (stream, "\ fprintf (stream, "\
Usage: dumper [OPTION] FILENAME WIN32PID\n\ Usage: %s [OPTION] FILENAME WIN32PID\n\
\n\
Dump core from WIN32PID to FILENAME.core\n\ Dump core from WIN32PID to FILENAME.core\n\
\n\ \n\
-d, --verbose be verbose while dumping\n\ -d, --verbose be verbose while dumping\n\
-h, --help output help information and exit\n\ -h, --help output help information and exit\n\
-q, --quiet be quiet while dumping (default)\n\ -q, --quiet be quiet while dumping (default)\n\
-v, --version output version information and exit\n\ -V, --version output version information and exit\n\
"); \n", program_invocation_short_name);
exit (status); exit (status);
} }
@ -857,29 +858,23 @@ struct option longopts[] = {
{"verbose", no_argument, NULL, 'd'}, {"verbose", no_argument, NULL, 'd'},
{"help", no_argument, NULL, 'h'}, {"help", no_argument, NULL, 'h'},
{"quiet", no_argument, NULL, 'q'}, {"quiet", no_argument, NULL, 'q'},
{"version", no_argument, 0, 'v'}, {"version", no_argument, 0, 'V'},
{0, no_argument, NULL, 0} {0, no_argument, NULL, 0}
}; };
const char *opts = "dhqV";
static void static void
print_version () print_version ()
{ {
const char *v = strchr (version, ':'); printf ("dumper (cygwin) %d.%d.%d\n"
int len; "Core Dumper for Cygwin\n"
if (!v) "Copyright (C) 1999 - %s Red Hat, Inc.\n"
{ "This is free software; see the source for copying conditions. There is NO\n"
v = "?"; "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n",
len = 1; CYGWIN_VERSION_DLL_MAJOR / 1000,
} CYGWIN_VERSION_DLL_MAJOR % 1000,
else CYGWIN_VERSION_DLL_MINOR,
{ strrchr (__DATE__, ' ') + 1);
v += 2;
len = strchr (v, ' ') - v;
}
printf ("\
dumper (cygwin) %.*s\n\
Core Dumper for Cygwin\n\
Copyright 1999, 2001, 2002 Red Hat, Inc.\n", len, v);
} }
int int
@ -889,7 +884,7 @@ main (int argc, char **argv)
const char *p = ""; const char *p = "";
DWORD pid; DWORD pid;
while ((opt = getopt_long (argc, argv, "dqhv", longopts, NULL) ) != EOF) while ((opt = getopt_long (argc, argv, opts, longopts, NULL) ) != EOF)
switch (opt) switch (opt)
{ {
case 'd': case 'd':
@ -900,12 +895,13 @@ main (int argc, char **argv)
break; break;
case 'h': case 'h':
usage (stdout, 0); usage (stdout, 0);
case 'v': case 'V':
print_version (); print_version ();
exit (0); exit (0);
default: default:
usage (stderr, 1); fprintf (stderr, "Try `%s --help' for more information.\n",
break; program_invocation_short_name);
exit (1);
} }
if (argv && *(argv + optind) && *(argv + optind +1)) if (argv && *(argv + optind) && *(argv + optind +1))

View File

@ -36,6 +36,8 @@
#include <stdlib.h> #include <stdlib.h>
#include <unistd.h> #include <unistd.h>
#include <string.h> #include <string.h>
#include <getopt.h>
#include <cygwin/version.h>
struct conf_variable struct conf_variable
{ {
@ -467,15 +469,48 @@ printvar (const struct conf_variable *cp, const char *pathname)
} }
static void static void
usage (void) usage (int ret)
{ {
fprintf (stderr, fprintf (ret ? stderr : stdout,
"Usage: %s [-v specification] variable_name [pathname]\n" "Usage: %1$s [-v specification] variable_name [pathname]\n"
" %s -a [pathname]\n", " %1$s -a [pathname]\n"
program_invocation_short_name, program_invocation_short_name); "\n"
exit (EXIT_FAILURE); "Get configuration values\n"
"\n"
" -v specification Indicate specific version for which configuration\n"
" values shall be fetched.\n"
" -a, --all Print all known configuration values\n"
"\n"
"Other options:\n"
"\n"
" -h, --help This text\n"
" -V, --version Print program version and exit\n"
"\n", program_invocation_short_name);
exit (ret);
} }
static void
print_version ()
{
printf ("getconf (cygwin) %d.%d.%d\n"
"Get configuration values\n"
"Copyright (C) 2011 - %s Red Hat, Inc.\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,
strrchr (__DATE__, ' ') + 1);
}
struct option longopts[] = {
{"all", no_argument, NULL, 'a'},
{"help", no_argument, NULL, 'h'},
{"version", no_argument, NULL, 'V'},
{0, no_argument, NULL, 0}
};
const char *opts = "ahvV";
int int
main (int argc, char **argv) main (int argc, char **argv)
{ {
@ -487,7 +522,7 @@ main (int argc, char **argv)
setlocale (LC_ALL, ""); setlocale (LC_ALL, "");
while ((ch = getopt (argc, argv, "av")) != -1) while ((ch = getopt_long (argc, argv, opts, longopts, NULL)) != -1)
{ {
switch (ch) switch (ch)
{ {
@ -497,9 +532,15 @@ main (int argc, char **argv)
case 'v': case 'v':
v_flag = 1; v_flag = 1;
break; break;
case '?': case 'h':
usage (0);
case 'V':
print_version ();
return 0;
default: default:
usage (); fprintf (stderr, "Try `%s --help' for more information.\n",
program_invocation_short_name);
return 1;
} }
} }
argc -= optind; argc -= optind;
@ -508,7 +549,7 @@ main (int argc, char **argv)
if (v_flag) if (v_flag)
{ {
if (a_flag || argc < 2) if (a_flag || argc < 2)
usage (); usage (1);
for (sp = spec_table; sp->name != NULL; sp++) for (sp = spec_table; sp->name != NULL; sp++)
{ {
if (strcmp (argv[0], sp->name) == 0) if (strcmp (argv[0], sp->name) == 0)
@ -527,7 +568,7 @@ main (int argc, char **argv)
if (!a_flag) if (!a_flag)
{ {
if (argc == 0) if (argc == 0)
usage (); usage (1);
varname = argv[0]; varname = argv[0];
argc--; argc--;
argv++; argv++;
@ -536,7 +577,7 @@ main (int argc, char **argv)
varname = NULL; varname = NULL;
if (argc > 1) if (argc > 1)
usage (); usage (1);
pathname = argv[0]; /* may be NULL */ pathname = argv[0]; /* may be NULL */
found = 0; found = 0;
@ -551,7 +592,7 @@ main (int argc, char **argv)
found = 1; found = 1;
} }
else if (!a_flag) else if (!a_flag)
usage (); usage (1);
} }
} }

View File

@ -1,6 +1,6 @@
/* getfacl.c /* getfacl.c
Copyright 2000, 2001, 2002, 2003, 2004, 2009 Red Hat Inc. Copyright 2000, 2001, 2002, 2003, 2004, 2009, 2011 Red Hat Inc.
Written by Corinna Vinschen <vinschen@redhat.com> Written by Corinna Vinschen <vinschen@redhat.com>
@ -18,10 +18,10 @@ details. */
#include <sys/types.h> #include <sys/types.h>
#include <sys/acl.h> #include <sys/acl.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <cygwin/version.h>
#include <string.h> #include <string.h>
#include <errno.h> #include <errno.h>
static const char version[] = "$Revision$";
static char *prog_name; static char *prog_name;
char * char *
@ -66,6 +66,7 @@ static void
usage (FILE * stream) usage (FILE * stream)
{ {
fprintf (stream, "Usage: %s [-adn] FILE [FILE2...]\n" fprintf (stream, "Usage: %s [-adn] FILE [FILE2...]\n"
"\n"
"Display file and directory access control lists (ACLs).\n" "Display file and directory access control lists (ACLs).\n"
"\n" "\n"
" -a, --all display the filename, the owner, the group, and\n" " -a, --all display the filename, the owner, the group, and\n"
@ -74,7 +75,7 @@ usage (FILE * stream)
" the default ACL of the directory, if it exists\n" " the default ACL of the directory, if it exists\n"
" -h, --help output usage information and exit\n" " -h, --help output usage information and exit\n"
" -n, --noname display user and group IDs instead of names\n" " -n, --noname display user and group IDs instead of names\n"
" -v, --version output version information and exit\n" " -V, --version output version information and exit\n"
"\n" "\n"
"When multiple files are specified on the command line, a blank\n" "When multiple files are specified on the command line, a blank\n"
"line separates the ACLs for each file.\n", prog_name); "line separates the ACLs for each file.\n", prog_name);
@ -114,31 +115,23 @@ struct option longopts[] = {
{"dir", no_argument, NULL, 'd'}, {"dir", no_argument, NULL, 'd'},
{"help", no_argument, NULL, 'h'}, {"help", no_argument, NULL, 'h'},
{"noname", no_argument, NULL, 'n'}, {"noname", no_argument, NULL, 'n'},
{"version", no_argument, NULL, 'v'}, {"version", no_argument, NULL, 'V'},
{0, no_argument, NULL, 0} {0, no_argument, NULL, 0}
}; };
const char *opts = "adhnV";
static void static void
print_version () print_version ()
{ {
const char *v = strchr (version, ':'); printf ("getfacl (cygwin) %d.%d.%d\n"
int len; "Get POSIX ACL information\n"
if (!v) "Copyright (C) 2000 - %s Red Hat, Inc.\n"
{ "This is free software; see the source for copying conditions. There is NO\n"
v = "?"; "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n",
len = 1; CYGWIN_VERSION_DLL_MAJOR / 1000,
} CYGWIN_VERSION_DLL_MAJOR % 1000,
else CYGWIN_VERSION_DLL_MINOR,
{ strrchr (__DATE__, ' ') + 1);
v += 2;
len = strchr (v, ' ') - v;
}
printf ("\
getfacl (cygwin) %.*s\n\
ACL Utility\n\
Copyright (c) 2000, 2001, 2002, 2003, 2004, 2009 Red Hat, Inc.\n\
Compiled on %s\n\
", len, v, __DATE__);
} }
int int
@ -152,15 +145,9 @@ main (int argc, char **argv)
struct stat st; struct stat st;
aclent_t acls[MAX_ACL_ENTRIES]; aclent_t acls[MAX_ACL_ENTRIES];
prog_name = strrchr (argv[0], '/'); prog_name = program_invocation_short_name;
if (prog_name == NULL)
prog_name = strrchr (argv[0], '\\');
if (prog_name == NULL)
prog_name = argv[0];
else
prog_name++;
while ((c = getopt_long (argc, argv, "adhnv", longopts, NULL)) != EOF) while ((c = getopt_long (argc, argv, opts, longopts, NULL)) != EOF)
switch (c) switch (c)
{ {
case 'a': case 'a':
@ -175,11 +162,11 @@ main (int argc, char **argv)
case 'n': case 'n':
nopt = 1; nopt = 1;
break; break;
case 'v': case 'V':
print_version (); print_version ();
return 0; return 0;
default: default:
usage (stderr); fprintf (stderr, "Try `%s --help' for more information.\n", prog_name);
return 1; return 1;
} }
if (optind > argc - 1) if (optind > argc - 1)

View File

@ -1,6 +1,6 @@
/* kill.cc /* kill.cc
Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2011 Red Hat, Inc.
This file is part of Cygwin. This file is part of Cygwin.
@ -16,10 +16,10 @@ details. */
#include <errno.h> #include <errno.h>
#include <windows.h> #include <windows.h>
#include <sys/cygwin.h> #include <sys/cygwin.h>
#include <cygwin/version.h>
#include <getopt.h> #include <getopt.h>
#include <limits.h> #include <limits.h>
static const char version[] = "$Revision$";
static char *prog_name; static char *prog_name;
static struct option longopts[] = static struct option longopts[] =
@ -28,50 +28,42 @@ static struct option longopts[] =
{"list", optional_argument, NULL, 'l'}, {"list", optional_argument, NULL, 'l'},
{"force", no_argument, NULL, 'f'}, {"force", no_argument, NULL, 'f'},
{"signal", required_argument, NULL, 's'}, {"signal", required_argument, NULL, 's'},
{"version", no_argument, NULL, 'v'}, {"version", no_argument, NULL, 'V'},
{NULL, 0, NULL, 0} {NULL, 0, NULL, 0}
}; };
static char opts[] = "hl::fs:v"; static char opts[] = "hl::fs:V";
static void static void
usage (FILE *where = stderr) usage (FILE *where = stderr)
{ {
fprintf (where , "" fprintf (where , ""
"Usage: %s [-f] [-signal] [-s signal] pid1 [pid2 ...]\n" "Usage: %1$s [-f] [-signal] [-s signal] pid1 [pid2 ...]\n"
" %s -l [signal]\n" " %1$s -l [signal]\n"
"\n"
"Send signals to processes\n" "Send signals to processes\n"
"\n" "\n"
" -f, --force force, using win32 interface if necessary\n" " -f, --force force, using win32 interface if necessary\n"
" -l, --list print a list of signal names\n" " -l, --list print a list of signal names\n"
" -s, --signal send signal (use %s --list for a list)\n" " -s, --signal send signal (use %1$s --list for a list)\n"
" -h, --help output usage information and exit\n" " -h, --help output usage information and exit\n"
" -v, --version output version information and exit\n" " -V, --version output version information and exit\n"
"", prog_name, prog_name, prog_name); "\n", prog_name);
exit (where == stderr ? 1 : 0); exit (where == stderr ? 1 : 0);
} }
static void static void
print_version () print_version ()
{ {
const char *v = strchr (version, ':'); printf ("kill (cygwin) %d.%d.%d\n"
int len; "Process Signaller\n"
if (!v) "Copyright (C) 1996 - %s Red Hat, Inc.\n"
{ "This is free software; see the source for copying conditions. There is NO\n"
v = "?"; "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n",
len = 1; CYGWIN_VERSION_DLL_MAJOR / 1000,
} CYGWIN_VERSION_DLL_MAJOR % 1000,
else CYGWIN_VERSION_DLL_MINOR,
{ strrchr (__DATE__, ' ') + 1);
v += 2;
len = strchr (v, ' ') - v;
}
printf ("\
%s (cygwin) %.*s\n\
Process Signaller\n\
Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.\n\
Compiled on %s\n\
", prog_name, len, v, __DATE__);
} }
static const char * static const char *
@ -110,8 +102,9 @@ test_for_unknown_sig (int sig, const char *sigstr)
{ {
if (sig < 0 || sig > NSIG) if (sig < 0 || sig > NSIG)
{ {
fprintf (stderr, "%s: unknown signal: %s\n", prog_name, sigstr); fprintf (stderr, "%1$s: unknown signal: %2$s\n"
usage (); "Try `%1$s --help' for more information.\n",
prog_name, sigstr);
exit (1); exit (1);
} }
} }
@ -195,13 +188,7 @@ main (int argc, char **argv)
int ret = 0; int ret = 0;
char *gotasig = NULL; char *gotasig = NULL;
prog_name = strrchr (argv[0], '/'); prog_name = program_invocation_short_name;
if (prog_name == NULL)
prog_name = strrchr (argv[0], '\\');
if (prog_name == NULL)
prog_name = argv[0];
else
prog_name++;
if (argc == 1) if (argc == 1)
usage (); usage ();
@ -243,7 +230,7 @@ main (int argc, char **argv)
case 'h': case 'h':
usage (stdout); usage (stdout);
break; break;
case 'v': case 'V':
print_version (); print_version ();
break; break;
case '?': case '?':

View File

@ -33,6 +33,7 @@
#include <wchar.h> #include <wchar.h>
#include <locale.h> #include <locale.h>
#include <sys/cygwin.h> #include <sys/cygwin.h>
#include <cygwin/version.h>
#include <unistd.h> #include <unistd.h>
#include <libgen.h> #include <libgen.h>
@ -49,18 +50,20 @@
struct option longopts[] = struct option longopts[] =
{ {
{"help", no_argument, NULL, 0}, {"help", no_argument, NULL, 'h'},
{"version", no_argument, NULL, 0}, {"verbose", no_argument, NULL, 'v'},
{"version", no_argument, NULL, 'V'},
{"data-relocs", no_argument, NULL, 'd'}, {"data-relocs", no_argument, NULL, 'd'},
{"function-relocs", no_argument, NULL, 'r'}, {"function-relocs", no_argument, NULL, 'r'},
{"unused", no_argument, NULL, 'u'}, {"unused", no_argument, NULL, 'u'},
{0, no_argument, NULL, 0} {0, no_argument, NULL, 0}
}; };
const char *opts = "dhruvV";
static int process_file (const wchar_t *); static int process_file (const wchar_t *);
static int static int
usage (const char *fmt, ...) error (const char *fmt, ...)
{ {
va_list ap; va_list ap;
va_start (ap, fmt); va_start (ap, fmt);
@ -70,6 +73,38 @@ usage (const char *fmt, ...)
exit (1); exit (1);
} }
static void
usage ()
{
printf ("Usage: %s [OPTION]... FILE...\n\
\n\
Print shared library dependencies\n\
\n\
-h, --help print this help and exit\n\
-V, --version print version information and exit\n\
-r, --function-relocs process data and function relocations\n\
(currently unimplemented)\n\
-u, --unused print unused direct dependencies\n\
(currently unimplemented)\n\
-v, --verbose print all information\n\
(currently unimplemented)\n",
program_invocation_short_name);
}
static void
print_version ()
{
printf ("ldd (cygwin) %d.%d.%d\n"
"Print shared library dependencies\n"
"Copyright (C) 2009 - %s Chris Faylor\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,
strrchr (__DATE__, ' ') + 1);
}
#define print_errno_error_and_return(__fn) \ #define print_errno_error_and_return(__fn) \
do {\ do {\
fprintf (stderr, "ldd: %s: %s\n", (__fn), strerror (errno));\ fprintf (stderr, "ldd: %s: %s\n", (__fn), strerror (errno));\
@ -338,51 +373,37 @@ report (const char *in_fn, bool multiple)
return 0; return 0;
} }
int int
main (int argc, char **argv) main (int argc, char **argv)
{ {
int optch; int optch;
int index;
/* Use locale from environment. If not set or set to "C", use UTF-8. */ /* Use locale from environment. If not set or set to "C", use UTF-8. */
setlocale (LC_CTYPE, ""); setlocale (LC_CTYPE, "");
if (!strcmp (setlocale (LC_CTYPE, NULL), "C")) if (!strcmp (setlocale (LC_CTYPE, NULL), "C"))
setlocale (LC_CTYPE, "en_US.UTF-8"); setlocale (LC_CTYPE, "en_US.UTF-8");
while ((optch = getopt_long (argc, argv, "dru", longopts, &index)) != -1) while ((optch = getopt_long (argc, argv, opts, longopts, NULL)) != -1)
switch (optch) switch (optch)
{ {
case 'd': case 'd':
case 'r': case 'r':
case 'u': case 'u':
usage ("option not implemented `-%c'", optch); error ("option not implemented `-%c'", optch);
exit (1); exit (1);
case 0: case 'h':
if (index == 1) usage ();
{
printf ("ldd (Cygwin) %s\nCopyright (C) 2009 Chris Faylor\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",
VERSION);
exit (0); exit (0);
} case 'V':
else print_version ();
{ return 0;
puts ("Usage: ldd [OPTION]... FILE...\n\ default:
--help print this help and exit\n\ fprintf (stderr, "Try `%s --help' for more information.\n",
--version print version information and exit\n\ program_invocation_short_name);
-r, --function-relocs process data and function relocations\n\ return 1;
(currently unimplemented)\n\
-u, --unused print unused direct dependencies\n\
(currently unimplemented)\n\
-v, --verbose print all information\n\
(currently unimplemented)");
exit (0);
}
} }
argv += optind; argv += optind;
if (!*argv) if (!*argv)
usage("missing file arguments"); error ("missing file arguments");
int ret = 0; int ret = 0;
bool multiple = !!argv[1]; bool multiple = !!argv[1];

View File

@ -23,6 +23,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE. * SUCH DAMAGE.
*/ */
#include <errno.h>
#include <stdio.h> #include <stdio.h>
#include <ctype.h> #include <ctype.h>
#include <getopt.h> #include <getopt.h>
@ -39,8 +40,6 @@
#define LOCALE_ALIAS "/usr/share/locale/locale.alias" #define LOCALE_ALIAS "/usr/share/locale/locale.alias"
#define LOCALE_ALIAS_LINE_LEN 255 #define LOCALE_ALIAS_LINE_LEN 255
extern char *__progname;
void void
usage () usage ()
{ {
@ -48,6 +47,7 @@ usage ()
"Usage: %1$s [-amvhV]\n" "Usage: %1$s [-amvhV]\n"
" or: %1$s [-ck] NAME\n" " or: %1$s [-ck] NAME\n"
" or: %1$s [-usfnU]\n" " or: %1$s [-usfnU]\n"
"\n"
"Get locale-specific information.\n" "Get locale-specific information.\n"
"\n" "\n"
"System information:\n" "System information:\n"
@ -74,21 +74,21 @@ usage ()
"\n" "\n"
" -h, --help This text\n" " -h, --help This text\n"
" -V, --version Print program version and exit\n\n", " -V, --version Print program version and exit\n\n",
__progname); program_invocation_short_name);
} }
void void
print_version () print_version ()
{ {
printf ("%s (cygwin) %d.%d.%d\n" printf ("locale (cygwin) %d.%d.%d\n"
"Get locale-specific information.\n" "Get locale-specific information\n"
"Copyright 2011 Red Hat, Inc.\n" "Copyright (C) 2010 - %s Red Hat, Inc.\n"
"Compiled on %s\n", "This is free software; see the source for copying conditions. There is NO\n"
__progname, "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_MAJOR % 1000, CYGWIN_VERSION_DLL_MAJOR % 1000,
CYGWIN_VERSION_DLL_MINOR, CYGWIN_VERSION_DLL_MINOR,
__DATE__); strrchr (__DATE__, ' ') + 1);
} }
struct option longopts[] = { struct option longopts[] = {
@ -785,7 +785,7 @@ main (int argc, char **argv)
char name[32]; char name[32];
setlocale (LC_ALL, ""); setlocale (LC_ALL, "");
while ((opt = getopt_long (argc, argv, opts, longopts, NULL)) != EOF) while ((opt = getopt_long (argc, argv, opts, longopts, NULL)) != -1)
switch (opt) switch (opt)
{ {
case 'a': case 'a':
@ -825,9 +825,8 @@ main (int argc, char **argv)
print_version (); print_version ();
return 0; return 0;
default: default:
fprintf (stderr, fprintf (stderr, "Try `%s --help' for more information.\n",
"Try `%1$s --help' or `%1$s -h' for more information.\n", program_invocation_short_name);
__progname);
return 1; return 1;
} }
if (all) if (all)

View File

@ -1,7 +1,7 @@
/* mkgroup.c: /* mkgroup.c:
Copyright 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, Copyright 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
2007, 2008, 2009, 2010 Red Hat, Inc. 2007, 2008, 2009, 2010, 2011 Red Hat, Inc.
This file is part of Cygwin. This file is part of Cygwin.
@ -10,6 +10,7 @@
details. */ details. */
#define _WIN32_WINNT 0x0600 #define _WIN32_WINNT 0x0600
#include <errno.h>
#include <ctype.h> #include <ctype.h>
#include <stdlib.h> #include <stdlib.h>
#include <wchar.h> #include <wchar.h>
@ -21,6 +22,7 @@
#include <io.h> #include <io.h>
#include <sys/fcntl.h> #include <sys/fcntl.h>
#include <sys/cygwin.h> #include <sys/cygwin.h>
#include <cygwin/version.h>
#include <windows.h> #include <windows.h>
#include <lm.h> #include <lm.h>
#include <wininet.h> #include <wininet.h>
@ -34,10 +36,6 @@
#define MAX_SID_LEN 40 #define MAX_SID_LEN 40
static const char version[] = "$Revision$";
extern char *__progname __declspec(dllimport);
SID_IDENTIFIER_AUTHORITY sid_world_auth = {SECURITY_WORLD_SID_AUTHORITY}; SID_IDENTIFIER_AUTHORITY sid_world_auth = {SECURITY_WORLD_SID_AUTHORITY};
SID_IDENTIFIER_AUTHORITY sid_nt_auth = {SECURITY_NT_AUTHORITY}; SID_IDENTIFIER_AUTHORITY sid_nt_auth = {SECURITY_NT_AUTHORITY};
@ -230,7 +228,7 @@ enum_unix_groups (domlist_t *dom_or_machine, const char *sep, DWORD id_offset,
if (ret < 1 || ret >= INTERNET_MAX_HOST_NAME_LENGTH + 1) if (ret < 1 || ret >= INTERNET_MAX_HOST_NAME_LENGTH + 1)
{ {
fprintf (stderr, "%s: Invalid machine name '%s'. Skipping...\n", fprintf (stderr, "%s: Invalid machine name '%s'. Skipping...\n",
__progname, d_or_m); program_invocation_short_name, d_or_m);
return; return;
} }
servername = machine; servername = machine;
@ -252,7 +250,7 @@ enum_unix_groups (domlist_t *dom_or_machine, const char *sep, DWORD id_offset,
ret = mbstowcs (p, gstr, GNLEN + 1); ret = mbstowcs (p, gstr, GNLEN + 1);
if (ret < 1 || ret >= GNLEN + 1) if (ret < 1 || ret >= GNLEN + 1)
fprintf (stderr, "%s: Invalid group name '%s'. Skipping...\n", fprintf (stderr, "%s: Invalid group name '%s'. Skipping...\n",
__progname, gstr); program_invocation_short_name, gstr);
else if (LookupAccountNameW (servername, grp, else if (LookupAccountNameW (servername, grp,
psid = (PSID) psid_buffer, psid = (PSID) psid_buffer,
(sidlen = MAX_SID_LEN, &sidlen), (sidlen = MAX_SID_LEN, &sidlen),
@ -282,7 +280,8 @@ enum_unix_groups (domlist_t *dom_or_machine, const char *sep, DWORD id_offset,
|| (stop = strtol (p, &p, 10)) < start || *p) || (stop = strtol (p, &p, 10)) < start || *p)
{ {
fprintf (stderr, "%s: Malformed unix group list entry '%s'. " fprintf (stderr, "%s: Malformed unix group list entry '%s'. "
"Skipping...\n", __progname, gstr); "Skipping...\n",
program_invocation_short_name, gstr);
continue; continue;
} }
for (; start <= stop; ++ start) for (; start <= stop; ++ start)
@ -337,7 +336,7 @@ enum_local_groups (BOOL domain, domlist_t *dom_or_machine, const char *sep,
if (ret < 1 || ret >= INTERNET_MAX_HOST_NAME_LENGTH + 1) if (ret < 1 || ret >= INTERNET_MAX_HOST_NAME_LENGTH + 1)
{ {
fprintf (stderr, "%s: Invalid machine name '%s'. Skipping...\n", fprintf (stderr, "%s: Invalid machine name '%s'. Skipping...\n",
__progname, d_or_m); program_invocation_short_name, d_or_m);
return 1; return 1;
} }
servername = machine; servername = machine;
@ -492,7 +491,7 @@ enum_groups (BOOL domain, domlist_t *dom_or_machine, const char *sep,
if (ret < 1 || ret >= INTERNET_MAX_HOST_NAME_LENGTH + 1) if (ret < 1 || ret >= INTERNET_MAX_HOST_NAME_LENGTH + 1)
{ {
fprintf (stderr, "%s: Invalid machine name '%s'. Skipping...\n", fprintf (stderr, "%s: Invalid machine name '%s'. Skipping...\n",
__progname, d_or_m); program_invocation_short_name, d_or_m);
return; return;
} }
servername = machine; servername = machine;
@ -634,10 +633,12 @@ static int
usage (FILE * stream) usage (FILE * stream)
{ {
fprintf (stream, fprintf (stream,
"Usage: mkgroup [OPTION]...\n" "Usage: %s [OPTION]...\n"
"\n"
"Print /etc/group file to stdout\n" "Print /etc/group file to stdout\n"
"\n" "\n"
"Options:\n" "Options:\n"
"\n"
" -l,--local [machine[,offset]]\n" " -l,--local [machine[,offset]]\n"
" print local groups with gid offset offset\n" " print local groups with gid offset offset\n"
" (from local machine if no machine specified)\n" " (from local machine if no machine specified)\n"
@ -669,7 +670,8 @@ usage (FILE * stream)
" -v,--version print version information and exit\n" " -v,--version print version information and exit\n"
"\n" "\n"
"Default is to print local groups on stand-alone machines, plus domain\n" "Default is to print local groups on stand-alone machines, plus domain\n"
"groups on domain controllers and domain member machines.\n"); "groups on domain controllers and domain member machines.\n"
"\n", program_invocation_short_name);
return 1; return 1;
} }
@ -688,33 +690,24 @@ struct option longopts[] = {
{"separator", required_argument, NULL, 'S'}, {"separator", required_argument, NULL, 'S'},
{"users", no_argument, NULL, 'u'}, {"users", no_argument, NULL, 'u'},
{"unix", required_argument, NULL, 'U'}, {"unix", required_argument, NULL, 'U'},
{"version", no_argument, NULL, 'v'}, {"version", no_argument, NULL, 'V'},
{0, no_argument, NULL, 0} {0, no_argument, NULL, 0}
}; };
static char opts[] = "bcCd::D::g:hl::L::o:sS:uU:v"; static char opts[] = "bcCd::D::g:hl::L::o:sS:uU:V";
static void static void
print_version () print_version ()
{ {
const char *v = strchr (version, ':'); printf ("mkgroup (cygwin) %d.%d.%d\n"
int len; "Group File Generator\n"
if (!v) "Copyright (C) 1997 - %s Red Hat, Inc.\n"
{ "This is free software; see the source for copying conditions. There is NO\n"
v = "?"; "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n",
len = 1; CYGWIN_VERSION_DLL_MAJOR / 1000,
} CYGWIN_VERSION_DLL_MAJOR % 1000,
else CYGWIN_VERSION_DLL_MINOR,
{ strrchr (__DATE__, ' ') + 1);
v += 2;
len = strchr (v, ' ') - v;
}
printf ("\
mkgroup (cygwin) %.*s\n\
group File Generator\n\
Copyright 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 Red Hat, Inc.\n\
Compiled on %s\n\
", len, v, __DATE__);
} }
static PPOLICY_PRIMARY_DOMAIN_INFO p_dom; static PPOLICY_PRIMARY_DOMAIN_INFO p_dom;
@ -795,7 +788,8 @@ main (int argc, char **argv)
if (print_domlist >= 32) if (print_domlist >= 32)
{ {
fprintf (stderr, "%s: Can not enumerate from more than 32 " fprintf (stderr, "%s: Can not enumerate from more than 32 "
"domains and machines.\n", __progname); "domains and machines.\n",
program_invocation_short_name);
return 1; return 1;
} }
domlist[print_domlist].domain = (c == 'd' || c == 'D'); domlist[print_domlist].domain = (c == 'd' || c == 'D');
@ -812,7 +806,8 @@ main (int argc, char **argv)
&& (!opt[off] || opt[off] == ',')))) && (!opt[off] || opt[off] == ','))))
{ {
fprintf (stderr, "%s: Duplicate %s '%s'. Skipping...\n", fprintf (stderr, "%s: Duplicate %s '%s'. Skipping...\n",
__progname, domlist[i].domain ? "domain" : "machine", program_invocation_short_name,
domlist[i].domain ? "domain" : "machine",
domlist[i].str); domlist[i].str);
goto skip; goto skip;
} }
@ -827,7 +822,7 @@ main (int argc, char **argv)
, *ep)) , *ep))
{ {
fprintf (stderr, "%s: Malformed machine,offset string '%s'. " fprintf (stderr, "%s: Malformed machine,offset string '%s'. "
"Skipping...\n", __progname, opt); "Skipping...\n", program_invocation_short_name, opt);
break; break;
} }
*p = '\0'; *p = '\0';
@ -840,13 +835,14 @@ skip:
if (strlen (sep_char) > 1) if (strlen (sep_char) > 1)
{ {
fprintf (stderr, "%s: Only one character allowed as domain\\user " fprintf (stderr, "%s: Only one character allowed as domain\\user "
"separator character.\n", __progname); "separator character.\n",
program_invocation_short_name);
return 1; return 1;
} }
if (*sep_char == ':') if (*sep_char == ':')
{ {
fprintf (stderr, "%s: Colon not allowed as domain\\user separator " fprintf (stderr, "%s: Colon not allowed as domain\\user separator "
"character.\n", __progname); "character.\n", program_invocation_short_name);
return 1; return 1;
} }
break; break;
@ -875,11 +871,11 @@ skip:
case 'h': case 'h':
usage (stdout); usage (stdout);
return 0; return 0;
case 'v': case 'V':
print_version (); print_version ();
return 0; return 0;
default: default:
fprintf (stderr, "Try '%s --help' for more information.\n", argv[0]); fprintf (stderr, "Try `%s --help' for more information.\n", argv[0]);
return 1; return 1;
} }

View File

@ -1,7 +1,7 @@
/* mkpasswd.c: /* mkpasswd.c:
Copyright 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2005, 2006, Copyright 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2005, 2006,
2008, 2009, 2010 Red Hat, Inc. 2008, 2009, 2010, 2011 Red Hat, Inc.
This file is part of Cygwin. This file is part of Cygwin.
@ -10,6 +10,7 @@
details. */ details. */
#define _WIN32_WINNT 0x0600 #define _WIN32_WINNT 0x0600
#include <errno.h>
#include <ctype.h> #include <ctype.h>
#include <stdlib.h> #include <stdlib.h>
#include <wchar.h> #include <wchar.h>
@ -21,6 +22,7 @@
#include <io.h> #include <io.h>
#include <sys/fcntl.h> #include <sys/fcntl.h>
#include <sys/cygwin.h> #include <sys/cygwin.h>
#include <cygwin/version.h>
#include <windows.h> #include <windows.h>
#include <lm.h> #include <lm.h>
#include <iptypes.h> #include <iptypes.h>
@ -34,10 +36,6 @@
#define MAX_SID_LEN 40 #define MAX_SID_LEN 40
static const char version[] = "$Revision$";
extern char *__progname __declspec(dllimport);
SID_IDENTIFIER_AUTHORITY sid_world_auth = {SECURITY_WORLD_SID_AUTHORITY}; SID_IDENTIFIER_AUTHORITY sid_world_auth = {SECURITY_WORLD_SID_AUTHORITY};
SID_IDENTIFIER_AUTHORITY sid_nt_auth = {SECURITY_NT_AUTHORITY}; SID_IDENTIFIER_AUTHORITY sid_nt_auth = {SECURITY_NT_AUTHORITY};
@ -290,7 +288,7 @@ enum_unix_users (domlist_t *dom_or_machine, const char *sep, DWORD id_offset,
if (ret < 1 || ret >= INTERNET_MAX_HOST_NAME_LENGTH + 1) if (ret < 1 || ret >= INTERNET_MAX_HOST_NAME_LENGTH + 1)
{ {
fprintf (stderr, "%s: Invalid machine name '%s'. Skipping...\n", fprintf (stderr, "%s: Invalid machine name '%s'. Skipping...\n",
__progname, d_or_m); program_invocation_short_name, d_or_m);
return; return;
} }
servername = machine; servername = machine;
@ -312,7 +310,7 @@ enum_unix_users (domlist_t *dom_or_machine, const char *sep, DWORD id_offset,
ret = mbstowcs (p, ustr, UNLEN + 1); ret = mbstowcs (p, ustr, UNLEN + 1);
if (ret < 1 || ret >= UNLEN + 1) if (ret < 1 || ret >= UNLEN + 1)
fprintf (stderr, "%s: Invalid user name '%s'. Skipping...\n", fprintf (stderr, "%s: Invalid user name '%s'. Skipping...\n",
__progname, ustr); program_invocation_short_name, ustr);
else if (LookupAccountNameW (servername, user, else if (LookupAccountNameW (servername, user,
psid = (PSID) psid_buffer, psid = (PSID) psid_buffer,
(sidlen = MAX_SID_LEN, &sidlen), (sidlen = MAX_SID_LEN, &sidlen),
@ -342,7 +340,8 @@ enum_unix_users (domlist_t *dom_or_machine, const char *sep, DWORD id_offset,
|| (stop = strtol (p, &p, 10)) < start || *p) || (stop = strtol (p, &p, 10)) < start || *p)
{ {
fprintf (stderr, "%s: Malformed unix user list entry '%s'. " fprintf (stderr, "%s: Malformed unix user list entry '%s'. "
"Skipping...\n", __progname, ustr); "Skipping...\n",
program_invocation_short_name, ustr);
continue; continue;
} }
for (; start <= stop; ++ start) for (; start <= stop; ++ start)
@ -396,7 +395,7 @@ enum_users (BOOL domain, domlist_t *dom_or_machine, const char *sep,
if (ret < 1 || ret >= INTERNET_MAX_HOST_NAME_LENGTH + 1) if (ret < 1 || ret >= INTERNET_MAX_HOST_NAME_LENGTH + 1)
{ {
fprintf (stderr, "%s: Invalid machine name '%s'. Skipping...\n", fprintf (stderr, "%s: Invalid machine name '%s'. Skipping...\n",
__progname, d_or_m); program_invocation_short_name, d_or_m);
return 1; return 1;
} }
servername = machine; servername = machine;
@ -572,10 +571,12 @@ static int
usage (FILE * stream) usage (FILE * stream)
{ {
fprintf (stream, fprintf (stream,
"Usage: mkpasswd [OPTIONS]...\n" "Usage: %s [OPTIONS]...\n"
"\n"
"Print /etc/passwd file to stdout\n" "Print /etc/passwd file to stdout\n"
"\n" "\n"
"Options:\n" "Options:\n"
"\n"
" -l,--local [machine[,offset]]\n" " -l,--local [machine[,offset]]\n"
" print local user accounts with uid offset offset\n" " print local user accounts with uid offset offset\n"
" (from local machine if no machine specified)\n" " (from local machine if no machine specified)\n"
@ -606,10 +607,11 @@ usage (FILE * stream)
" -s,--no-sids (ignored)\n" " -s,--no-sids (ignored)\n"
" -g,--local-groups (ignored)\n" " -g,--local-groups (ignored)\n"
" -h,--help displays this message\n" " -h,--help displays this message\n"
" -v,--version version information and exit\n" " -V,--version version information and exit\n"
"\n" "\n"
"Default is to print local accounts on stand-alone machines, domain accounts\n" "Default is to print local accounts on stand-alone machines, domain accounts\n"
"on domain controllers and domain member machines.\n"); "on domain controllers and domain member machines.\n"
"\n", program_invocation_short_name);
return 1; return 1;
} }
@ -629,33 +631,24 @@ static struct option longopts[] = {
{"separator", required_argument, NULL, 'S'}, {"separator", required_argument, NULL, 'S'},
{"username", required_argument, NULL, 'u'}, {"username", required_argument, NULL, 'u'},
{"unix", required_argument, NULL, 'U'}, {"unix", required_argument, NULL, 'U'},
{"version", no_argument, NULL, 'v'}, {"version", no_argument, NULL, 'V'},
{0, no_argument, NULL, 0} {0, no_argument, NULL, 0}
}; };
static char opts[] = "cCd::D::ghl::L::mo:sS:p:u:U:v"; static char opts[] = "cCd::D::ghl::L::mo:sS:p:u:U:V";
static void static void
print_version () print_version ()
{ {
const char *v = strchr (version, ':'); printf ("mkpasswd (cygwin) %d.%d.%d\n"
int len; "Passwd File Generator\n"
if (!v) "Copyright (C) 1997 - %s Red Hat, Inc.\n"
{ "This is free software; see the source for copying conditions. There is NO\n"
v = "?"; "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n",
len = 1; CYGWIN_VERSION_DLL_MAJOR / 1000,
} CYGWIN_VERSION_DLL_MAJOR % 1000,
else CYGWIN_VERSION_DLL_MINOR,
{ strrchr (__DATE__, ' ') + 1);
v += 2;
len = strchr (v, ' ') - v;
}
printf ("\
mkpasswd (cygwin) %.*s\n\
passwd File Generator\n\
Copyright 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2005, 2006, 2008 Red Hat, Inc.\n\
Compiled on %s\n\
", len, v, __DATE__);
} }
static void static void
@ -745,7 +738,8 @@ main (int argc, char **argv)
if (print_domlist >= 32) if (print_domlist >= 32)
{ {
fprintf (stderr, "%s: Can not enumerate from more than 32 " fprintf (stderr, "%s: Can not enumerate from more than 32 "
"domains and machines.\n", __progname); "domains and machines.\n",
program_invocation_short_name);
return 1; return 1;
} }
domlist[print_domlist].domain = (c == 'd' || c == 'D'); domlist[print_domlist].domain = (c == 'd' || c == 'D');
@ -762,7 +756,8 @@ main (int argc, char **argv)
&& (!opt[off] || opt[off] == ',')))) && (!opt[off] || opt[off] == ','))))
{ {
fprintf (stderr, "%s: Duplicate %s '%s'. Skipping...\n", fprintf (stderr, "%s: Duplicate %s '%s'. Skipping...\n",
__progname, domlist[i].domain ? "domain" : "machine", program_invocation_short_name,
domlist[i].domain ? "domain" : "machine",
domlist[i].str); domlist[i].str);
goto skip; goto skip;
} }
@ -776,7 +771,7 @@ main (int argc, char **argv)
, *ep)) , *ep))
{ {
fprintf (stderr, "%s: Malformed domain,offset string '%s'. " fprintf (stderr, "%s: Malformed domain,offset string '%s'. "
"Skipping...\n", __progname, opt); "Skipping...\n", program_invocation_short_name, opt);
break; break;
} }
*p = '\0'; *p = '\0';
@ -789,13 +784,14 @@ skip:
if (strlen (sep_char) > 1) if (strlen (sep_char) > 1)
{ {
fprintf (stderr, "%s: Only one character allowed as domain\\user " fprintf (stderr, "%s: Only one character allowed as domain\\user "
"separator character.\n", __progname); "separator character.\n",
program_invocation_short_name);
return 1; return 1;
} }
if (*sep_char == ':') if (*sep_char == ':')
{ {
fprintf (stderr, "%s: Colon not allowed as domain\\user separator " fprintf (stderr, "%s: Colon not allowed as domain\\user separator "
"character.\n", __progname); "character.\n", program_invocation_short_name);
return 1; return 1;
} }
break; break;
@ -813,7 +809,7 @@ skip:
if (*ep) if (*ep)
{ {
fprintf (stderr, "%s: Malformed offset '%s'. " fprintf (stderr, "%s: Malformed offset '%s'. "
"Skipping...\n", __progname, optarg); "Skipping...\n", program_invocation_short_name, optarg);
return 1; return 1;
} }
break; break;
@ -828,7 +824,7 @@ skip:
if (optarg[0] != '/') if (optarg[0] != '/')
{ {
fprintf (stderr, "%s: '%s' is not a fully qualified path.\n", fprintf (stderr, "%s: '%s' is not a fully qualified path.\n",
__progname, optarg); program_invocation_short_name, optarg);
return 1; return 1;
} }
strcpy (passed_home_path, optarg); strcpy (passed_home_path, optarg);
@ -841,11 +837,12 @@ skip:
case 'h': case 'h':
usage (stdout); usage (stdout);
return 0; return 0;
case 'v': case 'V':
print_version (); print_version ();
return 0; return 0;
default: default:
fprintf (stderr, "Try '%s --help' for more information.\n", __progname); fprintf (stderr, "Try `%s --help' for more information.\n",
program_invocation_short_name);
return 1; return 1;
} }

View File

@ -1,7 +1,7 @@
/* mount.cc /* mount.cc
Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2005, Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2005,
2008, 2009, 2010 Red Hat, Inc. 2008, 2009, 2010, 2011 Red Hat, Inc.
This file is part of Cygwin. This file is part of Cygwin.
@ -15,6 +15,7 @@ details. */
#include <mntent.h> #include <mntent.h>
#include <windows.h> #include <windows.h>
#include <sys/cygwin.h> #include <sys/cygwin.h>
#include <cygwin/version.h>
#include <stdlib.h> #include <stdlib.h>
#include <unistd.h> #include <unistd.h>
#include <getopt.h> #include <getopt.h>
@ -39,7 +40,6 @@ static int mount_already_exists (const char *posix_path, int flags);
// static short create_missing_dirs = FALSE; // static short create_missing_dirs = FALSE;
static bool force = false; static bool force = false;
static const char version[] = "$Revision$";
static const char *progname; static const char *progname;
static void static void
@ -83,7 +83,8 @@ do_mount (const char *dev, const char *where, int flags)
else if (!(statbuf.st_mode & S_IFDIR)) else if (!(statbuf.st_mode & S_IFDIR))
{ {
if (!force) if (!force)
fprintf (stderr, "%s: warning: %s is not a directory.\n", progname, where); fprintf (stderr, "%s: warning: %s is not a directory.\n",
progname, where);
} }
if (!force && !(flags & (EXEC_FLAGS | MOUNT_BIND)) && strlen (dev)) if (!force && !(flags & (EXEC_FLAGS | MOUNT_BIND)) && strlen (dev))
@ -100,9 +101,10 @@ do_mount (const char *dev, const char *where, int flags)
strcat (devtmp, "\\"); strcat (devtmp, "\\");
if (GetDriveType (devtmp) == DRIVE_REMOTE) if (GetDriveType (devtmp) == DRIVE_REMOTE)
{ {
fprintf (stderr, "%s: defaulting to 'notexec' mount option for speed since native path\n" fprintf (stderr,
"%*creferences a remote share. Use '-f' option to override.\n", progname, "%s: defaulting to 'notexec' mount option for speed since native path\n"
strlen(progname) + 2, ' '); "%*creferences a remote share. Use '-f' option to override.\n",
progname, strlen(progname) + 2, ' ');
flags |= MOUNT_NOTEXEC; flags |= MOUNT_NOTEXEC;
} }
} }
@ -201,20 +203,21 @@ static struct option longopts[] =
{"mount-entries", no_argument, NULL, 'm'}, {"mount-entries", no_argument, NULL, 'm'},
{"options", required_argument, NULL, 'o'}, {"options", required_argument, NULL, 'o'},
{"show-cygdrive-prefix", no_argument, NULL, 'p'}, {"show-cygdrive-prefix", no_argument, NULL, 'p'},
{"version", no_argument, NULL, 'v'}, {"version", no_argument, NULL, 'V'},
{NULL, 0, NULL, 0} {NULL, 0, NULL, 0}
}; };
static char opts[] = "acfhmpvo:"; static char opts[] = "acfhmpVo:";
static void static void
usage (FILE *where = stderr) usage (FILE *where = stderr)
{ {
char *options; char *options;
fprintf (where, "Usage: %s [OPTION] [<win32path> <posixpath>]\n\ fprintf (where, "Usage: %1$s [OPTION] [<win32path> <posixpath>]\n\
%s -a\n\ %1$s -a\n\
%s <posixpath>\n\ %1$s <posixpath>\n\
\n\
Display information about mounted filesystems, or mount a filesystem\n\ Display information about mounted filesystems, or mount a filesystem\n\
\n\ \n\
-a, --all mount all filesystems mentioned in fstab\n\ -a, --all mount all filesystems mentioned in fstab\n\
@ -226,8 +229,8 @@ Display information about mounted filesystems, or mount a filesystem\n\
and cygdrive prefixes\n\ and cygdrive prefixes\n\
-o, --options X[,X...] specify mount options\n\ -o, --options X[,X...] specify mount options\n\
-p, --show-cygdrive-prefix show user and/or system cygdrive path prefix\n\ -p, --show-cygdrive-prefix show user and/or system cygdrive path prefix\n\
-v, --version output version information and exit\n\n", -V, --version output version information and exit\n\n",
progname, progname, progname); progname);
if (!cygwin_internal (CW_LST_MNT_OPTS, &options)) if (!cygwin_internal (CW_LST_MNT_OPTS, &options))
fprintf (where, "Valid options are: %s\n\n", options); fprintf (where, "Valid options are: %s\n\n", options);
exit (where == stderr ? 1 : 0); exit (where == stderr ? 1 : 0);
@ -236,24 +239,15 @@ Display information about mounted filesystems, or mount a filesystem\n\
static void static void
print_version () print_version ()
{ {
const char *v = strchr (version, ':'); printf ("mount (cygwin) %d.%d.%d\n"
int len; "Mount filesystem utility\n"
if (!v) "Copyright (C) 1996 - %s Red Hat, Inc.\n"
{ "This is free software; see the source for copying conditions. There is NO\n"
v = "?"; "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n",
len = 1; CYGWIN_VERSION_DLL_MAJOR / 1000,
} CYGWIN_VERSION_DLL_MAJOR % 1000,
else CYGWIN_VERSION_DLL_MINOR,
{ strrchr (__DATE__, ' ') + 1);
v += 2;
len = strchr (v, ' ') - v;
}
printf ("\
%s (cygwin) %.*s\n\
Filesystem Utility\n\
Copyright 1996-2010 Red Hat, Inc.\n\
Compiled on %s\n\
", progname, len, v, __DATE__);
} }
static char * static char *
@ -279,13 +273,7 @@ main (int argc, char **argv)
saw_mount_all, saw_mount_all,
} do_what = nada; } do_what = nada;
progname = strrchr (argv[0], '/'); progname = program_invocation_short_name;
if (progname == NULL)
progname = strrchr (argv[0], '\\');
if (progname == NULL)
progname = argv[0];
else
progname++;
if (argc == 1) if (argc == 1)
{ {
@ -334,12 +322,13 @@ main (int argc, char **argv)
else else
usage (); usage ();
break; break;
case 'v': case 'V':
print_version (); print_version ();
return 0; return 0;
break; break;
default: default:
usage (); fprintf (stderr, "Try `%s --help' for more information.\n", progname);
return 1;
} }
if (cygwin_internal (CW_CVT_MNT_OPTS, &options, &flags)) if (cygwin_internal (CW_CVT_MNT_OPTS, &options, &flags))
@ -350,7 +339,8 @@ main (int argc, char **argv)
if (flags & MOUNT_NOTEXEC && flags & (MOUNT_EXEC | MOUNT_CYGWIN_EXEC)) if (flags & MOUNT_NOTEXEC && flags & (MOUNT_EXEC | MOUNT_CYGWIN_EXEC))
{ {
fprintf (stderr, "%s: invalid combination of executable options\n", progname); fprintf (stderr, "%s: invalid combination of executable options\n",
progname);
exit (1); exit (1);
} }
@ -516,13 +506,13 @@ mount_already_exists (const char *posix_path, int flags)
else else
fprintf (stderr, fprintf (stderr,
"%s: warning: user mount point of '%s' " "%s: warning: user mount point of '%s' "
"masks system mount.\n", "masks system mount.\n", progname, posix_path);
progname, posix_path);
break; break;
} }
else else
{ {
fprintf (stderr, "%s: warning: couldn't determine mount type.\n", progname); fprintf (stderr, "%s: warning: couldn't determine mount type.\n",
progname);
break; break;
} }
} }

View File

@ -24,6 +24,7 @@ details. */
#include <getopt.h> #include <getopt.h>
#include <pwd.h> #include <pwd.h>
#include <sys/cygwin.h> #include <sys/cygwin.h>
#include <cygwin/version.h>
#include <sys/types.h> #include <sys/types.h>
#include <time.h> #include <time.h>
#include <errno.h> #include <errno.h>
@ -32,7 +33,6 @@ details. */
#define USER_PRIV_ADMIN 2 #define USER_PRIV_ADMIN 2
static const char version[] = "$Revision$";
static char *prog_name; static char *prog_name;
static struct option longopts[] = static struct option longopts[] =
@ -49,7 +49,7 @@ static struct option longopts[] =
{"pwd-not-required", no_argument, NULL, 'p'}, {"pwd-not-required", no_argument, NULL, 'p'},
{"pwd-required", no_argument, NULL, 'P'}, {"pwd-required", no_argument, NULL, 'P'},
{"unlock", no_argument, NULL, 'u'}, {"unlock", no_argument, NULL, 'u'},
{"version", no_argument, NULL, 'v'}, {"version", no_argument, NULL, 'V'},
{"maxage", required_argument, NULL, 'x'}, {"maxage", required_argument, NULL, 'x'},
{"length", required_argument, NULL, 'L'}, {"length", required_argument, NULL, 'L'},
{"status", no_argument, NULL, 'S'}, {"status", no_argument, NULL, 'S'},
@ -57,7 +57,7 @@ static struct option longopts[] =
{NULL, 0, NULL, 0} {NULL, 0, NULL, 0}
}; };
static char opts[] = "cCd:eEhi:ln:pPuvx:L:SR"; static char opts[] = "cCd:eEhi:ln:pPuVx:L:SR";
int int
eprint (int with_name, const char *fmt, ...) eprint (int with_name, const char *fmt, ...)
@ -255,6 +255,7 @@ usage (FILE * stream, int status)
{ {
fprintf (stream, "" fprintf (stream, ""
"Usage: %s [OPTION] [USER]\n" "Usage: %s [OPTION] [USER]\n"
"\n"
"Change USER's password or password attributes.\n" "Change USER's password or password attributes.\n"
"\n" "\n"
"User operations:\n" "User operations:\n"
@ -286,7 +287,7 @@ usage (FILE * stream, int status)
" -S, --status display password status for USER (locked, expired,\n" " -S, --status display password status for USER (locked, expired,\n"
" etc.) plus global system password settings.\n" " etc.) plus global system password settings.\n"
" -h, --help output usage information and exit.\n" " -h, --help output usage information and exit.\n"
" -v, --version output version information and exit.\n" " -V, --version output version information and exit.\n"
"\n" "\n"
"If no option is given, change USER's password. If no user name is given,\n" "If no option is given, change USER's password. If no user name is given,\n"
"operate on current user. System operations must not be mixed with user\n" "operate on current user. System operations must not be mixed with user\n"
@ -299,9 +300,7 @@ usage (FILE * stream, int status)
"secure. Use this feature only if the machine is adequately locked down.\n" "secure. Use this feature only if the machine is adequately locked down.\n"
"Don't use this feature if you don't need network access within a remote\n" "Don't use this feature if you don't need network access within a remote\n"
"session. You can delete your stored password by using `passwd -R' and\n" "session. You can delete your stored password by using `passwd -R' and\n"
"specifying an empty password.\n" "specifying an empty password.\n\n", prog_name);
"\n"
"Report bugs to <cygwin@cygwin.com>\n", prog_name);
exit (status); exit (status);
} }
@ -351,30 +350,21 @@ caller_is_admin ()
static void static void
print_version () print_version ()
{ {
const char *v = strchr (version, ':'); printf ("passwd (cygwin) %d.%d.%d\n"
int len; "Password Utility\n"
if (!v) "Copyright (C) 1999 - %s Red Hat, Inc.\n"
{ "This is free software; see the source for copying conditions. There is NO\n"
v = "?"; "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n",
len = 1; CYGWIN_VERSION_DLL_MAJOR / 1000,
} CYGWIN_VERSION_DLL_MAJOR % 1000,
else CYGWIN_VERSION_DLL_MINOR,
{ strrchr (__DATE__, ' ') + 1);
v += 2;
len = strchr (v, ' ') - v;
}
printf ("\
%s (cygwin) %.*s\n\
Password Utility\n\
Copyright 1999, 2000, 2001, 2002, 2003 Red Hat, Inc.\n\
Compiled on %s\n\
", prog_name, len, v, __DATE__);
} }
int int
main (int argc, char **argv) main (int argc, char **argv)
{ {
char *c, *logonserver; char *logonserver;
char user[UNLEN + 1], oldpwd[_PASSWORD_LEN + 1], newpwd[_PASSWORD_LEN + 1]; char user[UNLEN + 1], oldpwd[_PASSWORD_LEN + 1], newpwd[_PASSWORD_LEN + 1];
int ret = 0; int ret = 0;
int cnt = 0; int cnt = 0;
@ -397,16 +387,7 @@ main (int argc, char **argv)
int myself = 0; int myself = 0;
LPWSTR server = NULL; LPWSTR server = NULL;
prog_name = strrchr (argv[0], '/'); prog_name = program_invocation_short_name;
if (prog_name == NULL)
prog_name = strrchr (argv[0], '\\');
if (prog_name == NULL)
prog_name = argv[0];
else
prog_name++;
c = strrchr (prog_name, '.');
if (c)
*c = '\0';
/* Use locale from environment. If not set or set to "C", use UTF-8. */ /* Use locale from environment. If not set or set to "C", use UTF-8. */
setlocale (LC_CTYPE, ""); setlocale (LC_CTYPE, "");
@ -500,7 +481,7 @@ main (int argc, char **argv)
Popt = 1; Popt = 1;
break; break;
case 'v': case 'V':
print_version (); print_version ();
exit (0); exit (0);
break; break;
@ -539,7 +520,8 @@ main (int argc, char **argv)
break; break;
default: default:
usage (stderr, 1); fprintf (stderr, "Try `%s --help' for more information.\n", prog_name);
return 1;
} }
if (Ropt) if (Ropt)

View File

@ -9,6 +9,7 @@ This software is a copyrighted work licensed under the terms of the
Cygwin license. Please consult the file "CYGWIN_LICENSE" for Cygwin license. Please consult the file "CYGWIN_LICENSE" for
details. */ details. */
#include <errno.h>
#include <stdio.h> #include <stdio.h>
#include <wchar.h> #include <wchar.h>
#include <windows.h> #include <windows.h>
@ -19,6 +20,7 @@ details. */
#include <pwd.h> #include <pwd.h>
#include <limits.h> #include <limits.h>
#include <sys/cygwin.h> #include <sys/cygwin.h>
#include <cygwin/version.h>
#include <tlhelp32.h> #include <tlhelp32.h>
#include <psapi.h> #include <psapi.h>
#include <ddk/ntapi.h> #include <ddk/ntapi.h>
@ -29,7 +31,6 @@ details. */
for that value. Note that PATH_MAX is only 4K. */ for that value. Note that PATH_MAX is only 4K. */
#define NT_MAX_PATH 32768 #define NT_MAX_PATH 32768
static const char version[] = "$Revision$";
static char *prog_name; static char *prog_name;
static struct option longopts[] = static struct option longopts[] =
@ -42,12 +43,12 @@ static struct option longopts[] =
{"process", required_argument, NULL, 'p'}, {"process", required_argument, NULL, 'p'},
{"summary", no_argument, NULL, 's' }, {"summary", no_argument, NULL, 's' },
{"user", required_argument, NULL, 'u'}, {"user", required_argument, NULL, 'u'},
{"version", no_argument, NULL, 'v'}, {"version", no_argument, NULL, 'V'},
{"windows", no_argument, NULL, 'W'}, {"windows", no_argument, NULL, 'W'},
{NULL, 0, NULL, 0} {NULL, 0, NULL, 0}
}; };
static char opts[] = "aefhlp:su:vW"; static char opts[] = "aefhlp:su:VW";
typedef BOOL (WINAPI *ENUMPROCESSMODULES)( typedef BOOL (WINAPI *ENUMPROCESSMODULES)(
HANDLE hProcess, // handle to the process HANDLE hProcess, // handle to the process
@ -214,7 +215,8 @@ static void
usage (FILE * stream, int status) usage (FILE * stream, int status)
{ {
fprintf (stream, "\ fprintf (stream, "\
Usage: %s [-aefls] [-u UID] [-p PID]\n\ Usage: %1$s [-aefls] [-u UID] [-p PID]\n\
\n\
Report process status\n\ Report process status\n\
\n\ \n\
-a, --all show processes of all users\n\ -a, --all show processes of all users\n\
@ -225,34 +227,26 @@ Report process status\n\
-p, --process show information for specified PID\n\ -p, --process show information for specified PID\n\
-s, --summary show process summary\n\ -s, --summary show process summary\n\
-u, --user list processes owned by UID\n\ -u, --user list processes owned by UID\n\
-v, --version output version information and exit\n\ -V, --version output version information and exit\n\
-W, --windows show windows as well as cygwin processes\n\ -W, --windows show windows as well as cygwin processes\n\
With no options, %s outputs the long format by default\n", \n\
prog_name, prog_name); With no options, %1$s outputs the long format by default\n\n",
prog_name);
exit (status); exit (status);
} }
static void static void
print_version () print_version ()
{ {
const char *v = strchr (version, ':'); printf ("ps (cygwin) %d.%d.%d\n"
int len; "Show process statistics\n"
if (!v) "Copyright (C) 1996 - %s Red Hat, Inc.\n"
{ "This is free software; see the source for copying conditions. There is NO\n"
v = "?"; "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n",
len = 1; CYGWIN_VERSION_DLL_MAJOR / 1000,
} CYGWIN_VERSION_DLL_MAJOR % 1000,
else CYGWIN_VERSION_DLL_MINOR,
{ strrchr (__DATE__, ' ') + 1);
v += 2;
len = strchr (v, ' ') - v;
}
printf ("\
%s (cygwin) %.*s\n\
Process Statistics\n\
Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.\n\
Compiled on %s\n\
", prog_name, len, v, __DATE__);
} }
char dosdevs[32000]; char dosdevs[32000];
@ -278,13 +272,7 @@ main (int argc, char *argv[])
proc_id = -1; proc_id = -1;
lflag = 1; lflag = 1;
prog_name = strrchr (argv[0], '/'); prog_name = program_invocation_short_name;
if (prog_name == NULL)
prog_name = strrchr (argv[0], '\\');
if (prog_name == NULL)
prog_name = argv[0];
else
prog_name++;
while ((ch = getopt_long (argc, argv, opts, longopts, NULL)) != EOF) while ((ch = getopt_long (argc, argv, opts, longopts, NULL)) != EOF)
switch (ch) switch (ch)
@ -324,7 +312,7 @@ main (int argc, char *argv[])
} }
} }
break; break;
case 'v': case 'V':
print_version (); print_version ();
exit (0); exit (0);
break; break;
@ -334,7 +322,8 @@ main (int argc, char *argv[])
break; break;
default: default:
usage (stderr, 1); fprintf (stderr, "Try `%s --help' for more information.\n", prog_name);
exit (1);
} }
if (sflag) if (sflag)

View File

@ -1,7 +1,7 @@
/* regtool.cc /* regtool.cc
Copyright 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, Copyright 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008,
2009, 2010 Red Hat Inc. 2009, 2010, 2011 Red Hat Inc.
This file is part of Cygwin. This file is part of Cygwin.
@ -19,6 +19,7 @@ details. */
#define WINVER 0x0502 #define WINVER 0x0502
#include <windows.h> #include <windows.h>
#include <sys/cygwin.h> #include <sys/cygwin.h>
#include <cygwin/version.h>
#include "loadlib.h" #include "loadlib.h"
#define DEFAULT_KEY_SEPARATOR '\\' #define DEFAULT_KEY_SEPARATOR '\\'
@ -33,7 +34,6 @@ char key_sep = DEFAULT_KEY_SEPARATOR;
#define LIST_VALS 0x02 #define LIST_VALS 0x02
#define LIST_ALL (LIST_KEYS | LIST_VALS) #define LIST_ALL (LIST_KEYS | LIST_VALS)
static const char version[] = "$Revision$";
static char *prog_name; static char *prog_name;
static struct option longopts[] = static struct option longopts[] =
@ -95,12 +95,14 @@ usage (FILE *where = stderr)
{ {
fprintf (where, "" fprintf (where, ""
"Usage: %s [OPTION] ACTION KEY [data...]\n" "Usage: %s [OPTION] ACTION KEY [data...]\n"
"\n"
"View or edit the Win32 registry\n" "View or edit the Win32 registry\n"
"\n", prog_name); "\n", prog_name);
if (where == stdout) if (where == stdout)
{ {
fprintf (where, "" fprintf (where, ""
"Actions:\n" "Actions:\n"
"\n"
" add KEY\\SUBKEY add new SUBKEY\n" " add KEY\\SUBKEY add new SUBKEY\n"
" check KEY exit 0 if KEY exists, 1 if not\n" " check KEY exit 0 if KEY exists, 1 if not\n"
" get KEY\\VALUE prints VALUE to stdout\n" " get KEY\\VALUE prints VALUE to stdout\n"
@ -114,16 +116,19 @@ usage (FILE *where = stderr)
"\n"); "\n");
fprintf (where, "" fprintf (where, ""
"Options for 'list' Action:\n" "Options for 'list' Action:\n"
"\n"
" -k, --keys print only KEYs\n" " -k, --keys print only KEYs\n"
" -l, --list print only VALUEs\n" " -l, --list print only VALUEs\n"
" -p, --postfix like ls -p, appends '\\' postfix to KEY names\n" " -p, --postfix like ls -p, appends '\\' postfix to KEY names\n"
"\n" "\n"
"Options for 'get' Action:\n" "Options for 'get' Action:\n"
"\n"
" -b, --binary print data as printable hex bytes\n" " -b, --binary print data as printable hex bytes\n"
" -n, --none print data as stream of bytes as stored in registry\n" " -n, --none print data as stream of bytes as stored in registry\n"
" -x, --hex print numerical data as hex numbers\n" " -x, --hex print numerical data as hex numbers\n"
"\n" "\n"
"Options for 'set' Action:\n" "Options for 'set' Action:\n"
"\n"
" -b, --binary set type to REG_BINARY (hex args or '-')\n" " -b, --binary set type to REG_BINARY (hex args or '-')\n"
" -d, --dword set type to REG_DWORD\n" " -d, --dword set type to REG_DWORD\n"
" -D, --dword-be set type to REG_DWORD_BIG_ENDIAN\n" " -D, --dword-be set type to REG_DWORD_BIG_ENDIAN\n"
@ -135,9 +140,11 @@ usage (FILE *where = stderr)
" -s, --string set type to REG_SZ\n" " -s, --string set type to REG_SZ\n"
"\n" "\n"
"Options for 'set' and 'unset' Actions:\n" "Options for 'set' and 'unset' Actions:\n"
"\n"
" -K<c>, --key-separator[=]<c> set key-value separator to <c> instead of '\\'\n" " -K<c>, --key-separator[=]<c> set key-value separator to <c> instead of '\\'\n"
"\n" "\n"
"Other Options:\n" "Other Options:\n"
"\n"
" -h, --help output usage information and exit\n" " -h, --help output usage information and exit\n"
" -q, --quiet no error output, just nonzero return if KEY/VALUE missing\n" " -q, --quiet no error output, just nonzero return if KEY/VALUE missing\n"
" -v, --verbose verbose output, including VALUE contents when applicable\n" " -v, --verbose verbose output, including VALUE contents when applicable\n"
@ -158,37 +165,28 @@ usage (FILE *where = stderr)
"as separator and the backslash can be used as escape character.\n"); "as separator and the backslash can be used as escape character.\n");
fprintf (where, "" fprintf (where, ""
"Example:\n" "Example:\n"
"%s list '/machine/SOFTWARE/Classes/MIME/Database/Content Type/audio\\/wav'\n", prog_name); "%s list '/machine/SOFTWARE/Classes/MIME/Database/Content Type/audio\\/wav'\n\n", prog_name);
} }
if (where == stderr) if (where == stderr)
fprintf (where, fprintf (where,
"ACTION is one of add, check, get, list, remove, set, unset, load, unload, save\n" "ACTION is one of add, check, get, list, remove, set, unset, load, unload, save\n"
"\n" "\n"
"Try '%s --help' for more information.\n", prog_name); "Try `%s --help' for more information.\n", prog_name);
exit (where == stderr ? 1 : 0); exit (where == stderr ? 1 : 0);
} }
static void static void
print_version () print_version ()
{ {
const char *v = strchr (version, ':'); printf ("regtool (cygwin) %d.%d.%d\n"
int len; "Registry tool\n"
if (!v) "Copyright (C) 2000 - %s Red Hat, Inc.\n"
{ "This is free software; see the source for copying conditions. There is NO\n"
v = "?"; "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n",
len = 1; CYGWIN_VERSION_DLL_MAJOR / 1000,
} CYGWIN_VERSION_DLL_MAJOR % 1000,
else CYGWIN_VERSION_DLL_MINOR,
{ strrchr (__DATE__, ' ') + 1);
v += 2;
len = strchr (v, ' ') - v;
}
printf ("\
%s (cygwin) %.*s\n\
Registry Tool\n\
Copyright 2000-2009 Red Hat, Inc.\n\
Compiled on %s\n\
", prog_name, len, v, __DATE__);
} }
void void
@ -907,13 +905,8 @@ main (int argc, char **_argv)
int g; int g;
setlocale (LC_ALL, ""); setlocale (LC_ALL, "");
prog_name = strrchr (_argv[0], '/');
if (prog_name == NULL) prog_name = program_invocation_short_name;
prog_name = strrchr (_argv[0], '\\');
if (prog_name == NULL)
prog_name = _argv[0];
else
prog_name++;
while ((g = getopt_long (argc, _argv, opts, longopts, NULL)) != EOF) while ((g = getopt_long (argc, _argv, opts, longopts, NULL)) != EOF)
switch (g) switch (g)
@ -978,7 +971,9 @@ main (int argc, char **_argv)
key_sep = *optarg; key_sep = *optarg;
break; break;
default : default :
usage (); fprintf (stderr, "Try `%s --help' for more information.\n",
prog_name);
return 1;
} }
if ((_argv[optind] == NULL) || (_argv[optind+1] == NULL)) if ((_argv[optind] == NULL) || (_argv[optind+1] == NULL))

View File

@ -10,6 +10,7 @@ This software is a copyrighted work licensed under the terms of the
Cygwin license. Please consult the file "CYGWIN_LICENSE" for Cygwin license. Please consult the file "CYGWIN_LICENSE" for
details. */ details. */
#include <errno.h>
#include <stdio.h> #include <stdio.h>
#include <ctype.h> #include <ctype.h>
#include <string.h> #include <string.h>
@ -20,6 +21,7 @@ details. */
#include <grp.h> #include <grp.h>
#include <sys/types.h> #include <sys/types.h>
#include <sys/acl.h> #include <sys/acl.h>
#include <cygwin/version.h>
#ifndef BOOL #ifndef BOOL
#define BOOL int #define BOOL int
@ -37,7 +39,6 @@ details. */
#define ILLEGAL_MODE ((mode_t)0xffffffff) #define ILLEGAL_MODE ((mode_t)0xffffffff)
#endif #endif
static const char version[] = "$Revision$";
static char *prog_name; static char *prog_name;
typedef enum { typedef enum {
@ -291,6 +292,7 @@ usage (FILE * stream)
fprintf (stream, "" fprintf (stream, ""
"Usage: %s [-r] (-f ACL_FILE | -s acl_entries) FILE...\n" "Usage: %s [-r] (-f ACL_FILE | -s acl_entries) FILE...\n"
" %s [-r] ([-d acl_entries] [-m acl_entries]) FILE...\n" " %s [-r] ([-d acl_entries] [-m acl_entries]) FILE...\n"
"\n"
"Modify file and directory access control lists (ACLs)\n" "Modify file and directory access control lists (ACLs)\n"
"\n" "\n"
" -d, --delete delete one or more specified ACL entries\n" " -d, --delete delete one or more specified ACL entries\n"
@ -302,11 +304,10 @@ usage (FILE * stream)
" -s, --substitute substitute specified ACL entries for the\n" " -s, --substitute substitute specified ACL entries for the\n"
" ACL of FILE\n" " ACL of FILE\n"
" -h, --help output usage information and exit\n" " -h, --help output usage information and exit\n"
" -v, --version output version information and exit\n" " -V, --version output version information and exit\n"
"\n" "\n"
"At least one of (-d, -f, -m, -s) must be specified\n" "At least one of (-d, -f, -m, -s) must be specified\n"
"\n" "\n", prog_name, prog_name);
"", prog_name, prog_name);
if (stream == stdout) if (stream == stdout)
{ {
printf("" printf(""
@ -387,7 +388,7 @@ usage (FILE * stream)
"permissions according to the combination of the current umask,\n" "permissions according to the combination of the current umask,\n"
"the explicit permissions requested and the default ACL entries\n" "the explicit permissions requested and the default ACL entries\n"
"Note: Under Cygwin, the default ACL entries are not taken into\n" "Note: Under Cygwin, the default ACL entries are not taken into\n"
"account currently.\n", prog_name); "account currently.\n\n", prog_name);
} }
else else
fprintf(stream, "Try '%s --help' for more information.\n", prog_name); fprintf(stream, "Try '%s --help' for more information.\n", prog_name);
@ -400,31 +401,23 @@ struct option longopts[] = {
{"replace", no_argument, NULL, 'r'}, {"replace", no_argument, NULL, 'r'},
{"substitute", required_argument, NULL, 's'}, {"substitute", required_argument, NULL, 's'},
{"help", no_argument, NULL, 'h'}, {"help", no_argument, NULL, 'h'},
{"version", no_argument, NULL, 'v'}, {"version", no_argument, NULL, 'V'},
{0, no_argument, NULL, 0} {0, no_argument, NULL, 0}
}; };
const char *opts = "d:f:hm:rs:V";
static void static void
print_version () print_version ()
{ {
const char *v = strchr (version, ':'); printf ("setfacl (cygwin) %d.%d.%d\n"
int len; "POSIX ACL modification utility\n"
if (!v) "Copyright (C) 2000 - %s Red Hat, Inc.\n"
{ "This is free software; see the source for copying conditions. There is NO\n"
v = "?"; "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n",
len = 1; CYGWIN_VERSION_DLL_MAJOR / 1000,
} CYGWIN_VERSION_DLL_MAJOR % 1000,
else CYGWIN_VERSION_DLL_MINOR,
{ strrchr (__DATE__, ' ') + 1);
v += 2;
len = strchr (v, ' ') - v;
}
printf ("\
setfacl (cygwin) %.*s\n\
ACL Modification Utility\n\
Copyright 2000, 2001, 2002 Red Hat, Inc.\n\
Compiled on %s\n\
", len, v, __DATE__);
} }
int int
@ -437,16 +430,10 @@ main (int argc, char **argv)
int aclidx = 0; int aclidx = 0;
int ret = 0; int ret = 0;
prog_name = strrchr (argv[0], '/'); prog_name = program_invocation_short_name;
if (prog_name == NULL)
prog_name = strrchr (argv[0], '\\');
if (prog_name == NULL)
prog_name = argv[0];
else
prog_name++;
memset (acls, 0, sizeof acls); memset (acls, 0, sizeof acls);
while ((c = getopt_long (argc, argv, "d:f:hm:rs:v", longopts, NULL)) != EOF) while ((c = getopt_long (argc, argv, opts, longopts, NULL)) != EOF)
switch (c) switch (c)
{ {
case 'd': case 'd':
@ -521,11 +508,11 @@ main (int argc, char **argv)
return 2; return 2;
} }
break; break;
case 'v': case 'V':
print_version (); print_version ();
return 0; return 0;
default: default:
usage (stderr); fprintf (stderr, "Try `%s --help' for more information.\n", prog_name);
return 1; return 1;
} }
if (action == NoAction) if (action == NoAction)

View File

@ -1,6 +1,6 @@
/* setmetamode.c /* setmetamode.c
Copyright 2006 Red Hat Inc. Copyright 2006, 2011 Red Hat Inc.
Written by Kazuhiro Fujieda <fujieda@jaist.ac.jp> Written by Kazuhiro Fujieda <fujieda@jaist.ac.jp>
@ -10,22 +10,30 @@ This software is a copyrighted work licensed under the terms of the
Cygwin license. Please consult the file "CYGWIN_LICENSE" for Cygwin license. Please consult the file "CYGWIN_LICENSE" for
details. */ details. */
#include <errno.h>
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
#include <getopt.h>
#include <sys/ioctl.h> #include <sys/ioctl.h>
#include <cygwin/kd.h> #include <cygwin/kd.h>
#include <cygwin/version.h>
static const char version[] = "$Revision$";
static char *prog_name;
static void static void
usage (void) usage (void)
{ {
fprintf (stderr, "Usage: %s [metabit|escprefix]\n" fprintf (stderr, "Usage: %s [metabit|escprefix]\n"
"\n"
"Get or set keyboard meta mode\n"
"\n"
" Without argument, it shows the current meta key mode.\n" " Without argument, it shows the current meta key mode.\n"
" metabit|meta|bit The meta key sets the top bit of the character.\n" " metabit|meta|bit The meta key sets the top bit of the character.\n"
" escprefix|esc|prefix The meta key sends an escape prefix.\n", " escprefix|esc|prefix The meta key sends an escape prefix.\n"
prog_name); "\n"
"Other options:\n"
"\n"
" -h, --help This text\n"
" -V, --version Print program version and exit\n\n",
program_invocation_short_name);
} }
static void static void
@ -33,21 +41,35 @@ error (void)
{ {
fprintf (stderr, fprintf (stderr,
"%s: The standard input isn't a console device.\n", "%s: The standard input isn't a console device.\n",
prog_name); program_invocation_short_name);
} }
void
print_version ()
{
printf ("setmetamode (cygwin) %d.%d.%d\n"
"Get or set keyboard meta mode\n"
"Copyright (C) 2006 - %s Red Hat, Inc.\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,
strrchr (__DATE__, ' ') + 1);
}
struct option longopts[] = {
{"help", no_argument, NULL, 'h'},
{"version", no_argument, NULL, 'V'},
{0, no_argument, NULL, 0}
};
const char *opts = "hV";
int int
main (int ac, char *av[]) main (int ac, char *av[])
{ {
int param; int param;
int opt;
prog_name = strrchr (av[0], '/');
if (!prog_name)
prog_name = strrchr (av[0], '\\');
if (!prog_name)
prog_name = av[0];
else
prog_name++;
if (ac < 2) if (ac < 2)
{ {
@ -62,6 +84,22 @@ main (int ac, char *av[])
puts ("escprefix"); puts ("escprefix");
return 0; return 0;
} }
while ((opt = getopt_long (ac, av, opts, longopts, NULL)) != -1)
switch (opt)
{
case 'h':
usage ();
return 0;
case 'V':
print_version ();
return 0;
default:
fprintf (stderr, "Try `%s --help' for more information.\n",
program_invocation_short_name);
return 1;
}
if (!strcmp ("meta", av[1]) || !strcmp ("bit", av[1]) if (!strcmp ("meta", av[1]) || !strcmp ("bit", av[1])
|| !strcmp ("metabit", av[1])) || !strcmp ("metabit", av[1]))
param = 0x03; param = 0x03;

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2000, 2001, 2002, 2009 Red Hat, Inc. * Copyright (c) 2000, 2001, 2002, 2009, 2011 Red Hat, Inc.
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -13,6 +13,7 @@
* *
*/ */
#include <errno.h>
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
#include <stdlib.h> #include <stdlib.h>
@ -21,8 +22,8 @@
#include <ctype.h> #include <ctype.h>
#include <windows.h> #include <windows.h>
#include <getopt.h> #include <getopt.h>
#include <cygwin/version.h>
static const char version[] = "$Revision$";
static char *prog_name; static char *prog_name;
static struct option longopts[] = static struct option longopts[] =
@ -650,6 +651,7 @@ usage (FILE * stream)
{ {
fprintf (stream , "" fprintf (stream , ""
"Usage: %s [options] low_pc high_pc command...\n" "Usage: %s [options] low_pc high_pc command...\n"
"\n"
"Single-step profile COMMAND\n" "Single-step profile COMMAND\n"
"\n" "\n"
" -c, --console-trace trace every EIP value to the console. *Lots* slower.\n" " -c, --console-trace trace every EIP value to the console. *Lots* slower.\n"
@ -798,7 +800,7 @@ usage (FILE * stream)
"spent in each dll the program used. No sense optimizing a function in\n" "spent in each dll the program used. No sense optimizing a function in\n"
"your program if most of the time is spent in the DLL.\n" "your program if most of the time is spent in the DLL.\n"
"\n" "\n"
"I usually use the -v, -s, and -l options:\n" "Typically use the -v, -s, and -l options:\n"
"\n" "\n"
" ssp -v -s -l -d 0x61001000 0x61080000 hello.exe\n" " ssp -v -s -l -d 0x61001000 0x61080000 hello.exe\n"
"\n"); "\n");
@ -810,24 +812,15 @@ usage (FILE * stream)
static void static void
print_version () print_version ()
{ {
const char *v = strchr (version, ':'); printf ("ssp (cygwin) %d.%d.%d\n"
int len; "Single-Step Profiler\n"
if (!v) "Copyright (C) 2000 - %s Red Hat, Inc.\n"
{ "This is free software; see the source for copying conditions. There is NO\n"
v = "?"; "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n",
len = 1; CYGWIN_VERSION_DLL_MAJOR / 1000,
} CYGWIN_VERSION_DLL_MAJOR % 1000,
else CYGWIN_VERSION_DLL_MINOR,
{ strrchr (__DATE__, ' ') + 1);
v += 2;
len = strchr (v, ' ') - v;
}
printf ("\
%s (cygwin) %.*s\n\
Single-Step Profiler\n\
Copyright 2000, 2001, 2002 Red Hat, Inc.\n\
Compiled on %s\n\
", prog_name, len, v, __DATE__);
} }
int int
@ -839,13 +832,7 @@ main (int argc, char **argv)
setbuf (stdout, 0); setbuf (stdout, 0);
prog_name = strrchr (argv[0], '/'); prog_name = program_invocation_short_name;
if (prog_name == NULL)
prog_name = strrchr (argv[0], '\\');
if (prog_name == NULL)
prog_name = argv[0];
else
prog_name++;
while ((c = getopt_long (argc, argv, opts, longopts, NULL)) != EOF) while ((c = getopt_long (argc, argv, opts, longopts, NULL)) != EOF)
switch (c) switch (c)
@ -885,7 +872,8 @@ main (int argc, char **argv)
print_version (); print_version ();
exit (0); exit (0);
default: default:
usage (stderr); fprintf (stderr, "Try `%s --help' for more information.\n", prog_name);
exit (1);
} }
if ( (argc - optind) < 3 ) if ( (argc - optind) < 3 )

View File

@ -1,7 +1,7 @@
/* strace.cc /* strace.cc
Copyright 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, Copyright 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008,
2009, 2010 Red Hat Inc. 2009, 2010, 2011 Red Hat Inc.
Written by Chris Faylor <cgf@redhat.com> Written by Chris Faylor <cgf@redhat.com>
@ -24,6 +24,7 @@ details. */
#include <errno.h> #include <errno.h>
#include "cygwin/include/sys/strace.h" #include "cygwin/include/sys/strace.h"
#include "cygwin/include/sys/cygwin.h" #include "cygwin/include/sys/cygwin.h"
#include "cygwin/include/cygwin/version.h"
#include "path.h" #include "path.h"
#undef cygwin_internal #undef cygwin_internal
#include "loadlib.h" #include "loadlib.h"
@ -32,9 +33,6 @@ details. */
/* we *know* we're being built with GCC */ /* we *know* we're being built with GCC */
#define alloca __builtin_alloca #define alloca __builtin_alloca
// Version string.
static const char version[] = "$Revision$";
static const char *pgm; static const char *pgm;
static int forkdebug = 1; static int forkdebug = 1;
static int numerror = 1; static int numerror = 1;
@ -678,7 +676,8 @@ proc_child (unsigned mask, FILE *ofile, pid_t pid)
remove_child (ev.dwProcessId); remove_child (ev.dwProcessId);
break; break;
case EXCEPTION_DEBUG_EVENT: case EXCEPTION_DEBUG_EVENT:
if (ev.u.Exception.ExceptionRecord.ExceptionCode != STATUS_BREAKPOINT) if (ev.u.Exception.ExceptionRecord.ExceptionCode
!= (DWORD) STATUS_BREAKPOINT)
{ {
status = DBG_EXCEPTION_NOT_HANDLED; status = DBG_EXCEPTION_NOT_HANDLED;
if (ev.u.Exception.dwFirstChance) if (ev.u.Exception.dwFirstChance)
@ -850,6 +849,7 @@ usage (FILE *where = stderr)
fprintf (where, "\ fprintf (where, "\
Usage: %s [OPTIONS] <command-line>\n\ Usage: %s [OPTIONS] <command-line>\n\
Usage: %s [OPTIONS] -p <pid>\n\ Usage: %s [OPTIONS] -p <pid>\n\
\n\
Trace system calls and signals\n\ Trace system calls and signals\n\
\n\ \n\
-b, --buffer-size=SIZE set size of output file buffer\n\ -b, --buffer-size=SIZE set size of output file buffer\n\
@ -868,7 +868,7 @@ Trace system calls and signals\n\
-T, --toggle toggle tracing in a process already being\n\ -T, --toggle toggle tracing in a process already being\n\
traced. Requires -p <pid>\n\ traced. Requires -p <pid>\n\
-u, --usecs toggle printing of microseconds timestamp\n\ -u, --usecs toggle printing of microseconds timestamp\n\
-v, --version output version information and exit\n\ -V, --version output version information and exit\n\
-w, --new-window spawn program under test in a new window\n\ -w, --new-window spawn program under test in a new window\n\
\n", pgm, pgm); \n", pgm, pgm);
if ( where == stdout) if ( where == stdout)
@ -903,7 +903,7 @@ Trace system calls and signals\n\
non-checked-in code\n\ non-checked-in code\n\
"); ");
if (where == stderr) if (where == stderr)
fprintf (stderr, "Try '%s --help' for more information.\n", pgm); fprintf (stderr, "Try `%s --help' for more information.\n", pgm);
exit (where == stderr ? 1 : 0 ); exit (where == stderr ? 1 : 0 );
} }
@ -923,33 +923,24 @@ struct option longopts[] = {
{"trace-children", no_argument, NULL, 'f'}, {"trace-children", no_argument, NULL, 'f'},
{"translate-error-numbers", no_argument, NULL, 'n'}, {"translate-error-numbers", no_argument, NULL, 'n'},
{"usecs", no_argument, NULL, 'u'}, {"usecs", no_argument, NULL, 'u'},
{"version", no_argument, NULL, 'v'}, {"version", no_argument, NULL, 'V'},
{NULL, 0, NULL, 0} {NULL, 0, NULL, 0}
}; };
static const char *const opts = "+b:dhHfm:no:p:qS:tTuvw"; static const char *const opts = "+b:dhHfm:no:p:qS:tTuVw";
static void static void
print_version () print_version ()
{ {
const char *v = strchr (version, ':'); printf ("strace (cygwin) %d.%d.%d\n"
int len; "System Trace\n"
if (!v) "Copyright (C) 2000 - %s Red Hat, Inc.\n"
{ "This is free software; see the source for copying conditions. There is NO\n"
v = "?"; "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n",
len = 1; CYGWIN_VERSION_DLL_MAJOR / 1000,
} CYGWIN_VERSION_DLL_MAJOR % 1000,
else CYGWIN_VERSION_DLL_MINOR,
{ strrchr (__DATE__, ' ') + 1);
v += 2;
len = strchr (v, ' ') - v;
}
printf ("\
%s (cygwin) %.*s\n\
System Trace\n\
Copyright 2000, 2001, 2002, 2003, 2004, 2005 Red Hat, Inc.\n\
Compiled on %s\n\
", pgm, len, v, __DATE__);
} }
int int
@ -1040,15 +1031,15 @@ character #%d.\n", optarg, (int) (endptr - optarg), endptr);
show_usecs ^= 1; show_usecs ^= 1;
delta ^= 1; delta ^= 1;
break; break;
case 'v': case 'V':
// Print version info and exit // Print version info and exit
print_version (); print_version ();
return 0; return 0;
case 'w': case 'w':
new_window ^= 1; new_window ^= 1;
break; break;
case '?': default:
fprintf (stderr, "Try '%s --help' for more information.\n", pgm); fprintf (stderr, "Try `%s --help' for more information.\n", pgm);
exit (1); exit (1);
} }

View File

@ -1,6 +1,6 @@
/* umount.cc /* umount.cc
Copyright 1996, 1998, 1999, 2000, 2001, 2002, 2008 Red Hat, Inc. Copyright 1996, 1998, 1999, 2000, 2001, 2002, 2008, 2011 Red Hat, Inc.
This file is part of Cygwin. This file is part of Cygwin.
@ -15,33 +15,34 @@ details. */
#include <stdlib.h> #include <stdlib.h>
#include <errno.h> #include <errno.h>
#include <getopt.h> #include <getopt.h>
#include <cygwin/version.h>
static void remove_all_user_mounts (); static void remove_all_user_mounts ();
static const char version[] = "$Revision$";
static const char *progname; static const char *progname;
struct option longopts[] = struct option longopts[] =
{ {
{"help", no_argument, NULL, 'h' }, {"help", no_argument, NULL, 'h' },
{"remove-user-mounts", no_argument, NULL, 'U'}, {"remove-user-mounts", no_argument, NULL, 'U'},
{"version", no_argument, NULL, 'v'}, {"version", no_argument, NULL, 'V'},
{NULL, 0, NULL, 0} {NULL, 0, NULL, 0}
}; };
char opts[] = "hUv"; char opts[] = "hUV";
static void static void
usage (FILE *where = stderr) usage (FILE *where = stderr)
{ {
fprintf (where, "\ fprintf (where, "\
Usage: %s [OPTION] [<posixpath>]\n\ Usage: %s [OPTION] [<posixpath>]\n\
\n\
Unmount filesystems\n\ Unmount filesystems\n\
\n\ \n\
-h, --help output usage information and exit\n\ -h, --help output usage information and exit\n\
-U, --remove-user-mounts remove all user mounts\n\ -U, --remove-user-mounts remove all user mounts\n\
-v, --version output version information and exit\n\ -V, --version output version information and exit\n\
", progname); \n", progname);
exit (where == stderr ? 1 : 0); exit (where == stderr ? 1 : 0);
} }
@ -55,24 +56,15 @@ error (const char *path)
static void static void
print_version () print_version ()
{ {
const char *v = strchr (version, ':'); printf ("umount (cygwin) %d.%d.%d\n"
int len; "Unmount filesystem utility\n"
if (!v) "Copyright (C) 1996 - %s Red Hat, Inc.\n"
{ "This is free software; see the source for copying conditions. There is NO\n"
v = "?"; "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n",
len = 1; CYGWIN_VERSION_DLL_MAJOR / 1000,
} CYGWIN_VERSION_DLL_MAJOR % 1000,
else CYGWIN_VERSION_DLL_MINOR,
{ strrchr (__DATE__, ' ') + 1);
v += 2;
len = strchr (v, ' ') - v;
}
printf ("\
%s (cygwin) %.*s\n\
Filesystem Utility\n\
Copyright 1996, 1998, 1999, 2000, 2001, 2002\n\
Compiled on %s\n\
", progname, len, v, __DATE__);
} }
int int
@ -87,13 +79,7 @@ main (int argc, char **argv)
saw_remove_all_user_mounts saw_remove_all_user_mounts
} do_what = nada; } do_what = nada;
progname = strrchr (argv[0], '/'); progname = program_invocation_short_name;
if (progname == NULL)
progname = strrchr (argv[0], '\\');
if (progname == NULL)
progname = argv[0];
else
progname++;
if (argc == 1) if (argc == 1)
usage (); usage ();
@ -108,11 +94,12 @@ main (int argc, char **argv)
usage (); usage ();
do_what = saw_remove_all_user_mounts; do_what = saw_remove_all_user_mounts;
break; break;
case 'v': case 'V':
print_version (); print_version ();
exit (0); exit (0);
default: default:
usage (); fprintf (stderr, "Try `%s --help' for more information.\n", progname);
exit (1);
} }
switch (do_what) switch (do_what)

View File

@ -25,6 +25,7 @@ Usage: cygcheck [-v] [-h] PROGRAM
cygcheck --disable-unique-object-names Cygwin-DLL cygcheck --disable-unique-object-names Cygwin-DLL
cygcheck --show-unique-object-names Cygwin-DLL cygcheck --show-unique-object-names Cygwin-DLL
cygcheck -h cygcheck -h
List system information, check installed packages, or query package database. List system information, check installed packages, or query package database.
At least one command option or a PROGRAM is required, as shown above. At least one command option or a PROGRAM is required, as shown above.
@ -270,16 +271,20 @@ Usage: cygpath (-d|-m|-u|-w|-t TYPE) [-f FILE] [OPTION]... NAME...
cygpath [-c HANDLE] cygpath [-c HANDLE]
cygpath [-ADHOPSW] cygpath [-ADHOPSW]
cygpath [-F ID] cygpath [-F ID]
Convert Unix and Windows format paths, or output system path information Convert Unix and Windows format paths, or output system path information
Output type options: Output type options:
-d, --dos print DOS (short) form of NAMEs (C:\PROGRA~1\) -d, --dos print DOS (short) form of NAMEs (C:\PROGRA~1\)
-m, --mixed like --windows, but with regular slashes (C:/WINNT) -m, --mixed like --windows, but with regular slashes (C:/WINNT)
-M, --mode report on mode of file (currently binmode or textmode) -M, --mode report on mode of file (currently binmode or textmode)
-u, --unix (default) print Unix form of NAMEs (/cygdrive/c/winnt) -u, --unix (default) print Unix form of NAMEs (/cygdrive/c/winnt)
-w, --windows print Windows form of NAMEs (C:\WINNT) -w, --windows print Windows form of NAMEs (C:\WINNT)
-t, --type TYPE print TYPE form: 'dos', 'mixed', 'unix', or 'windows' -t, --type TYPE print TYPE form: 'dos', 'mixed', 'unix', or 'windows'
Path conversion options: Path conversion options:
-a, --absolute output absolute path -a, --absolute output absolute path
-l, --long-name print Windows long form of NAMEs (with -w, -m only) -l, --long-name print Windows long form of NAMEs (with -w, -m only)
-p, --path NAME is a PATH list (i.e., '/bin:/usr/bin') -p, --path NAME is a PATH list (i.e., '/bin:/usr/bin')
@ -289,7 +294,9 @@ Path conversion options:
or one of the reserved words ANSI, OEM, or UTF8. or one of the reserved words ANSI, OEM, or UTF8.
If this option is missing, cygpath defaults to the If this option is missing, cygpath defaults to the
character set defined by the current locale. character set defined by the current locale.
System information: System information:
-A, --allusers use `All Users' instead of current user for -D, -P -A, --allusers use `All Users' instead of current user for -D, -P
-D, --desktop output `Desktop' directory and exit -D, --desktop output `Desktop' directory and exit
-H, --homeroot output `Profiles' directory (home root) and exit -H, --homeroot output `Profiles' directory (home root) and exit
@ -298,13 +305,15 @@ System information:
-S, --sysdir output system directory and exit -S, --sysdir output system directory and exit
-W, --windir output `Windows' directory and exit -W, --windir output `Windows' directory and exit
-F, --folder ID output special folder with numeric ID and exit -F, --folder ID output special folder with numeric ID and exit
Other options: Other options:
-f, --file FILE read FILE for input; use - to read from STDIN -f, --file FILE read FILE for input; use - to read from STDIN
-o, --option read options from FILE as well (for use with --file) -o, --option read options from FILE as well (for use with --file)
-c, --close HANDLE close HANDLE (for use in captured process) -c, --close HANDLE close HANDLE (for use in captured process)
-i, --ignore ignore missing argument -i, --ignore ignore missing argument
-h, --help output usage information and exit -h, --help output usage information and exit
-v, --version output version information and exit -V, --version output version information and exit
</screen> </screen>
<para>The <command>cygpath</command> program is a utility that <para>The <command>cygpath</command> program is a utility that
@ -410,12 +419,13 @@ other formats.</para>
<screen> <screen>
Usage: dumper [OPTION] FILENAME WIN32PID Usage: dumper [OPTION] FILENAME WIN32PID
Dump core from WIN32PID to FILENAME.core Dump core from WIN32PID to FILENAME.core
-d, --verbose be verbose while dumping -d, --verbose be verbose while dumping
-h, --help output help information and exit -h, --help output help information and exit
-q, --quiet be quiet while dumping (default) -q, --quiet be quiet while dumping (default)
-v, --version output version information and exit -V, --version output version information and exit
</screen> </screen>
<para>The <command>dumper</command> utility can be used to create a <para>The <command>dumper</command> utility can be used to create a
@ -454,10 +464,43 @@ the same directories as on the machine where the core dump was created.
</sect2> </sect2>
<sect2 id="getconf"><title>getconf</title>
<screen>
Usage: getconf [-v specification] variable_name [pathname]
getconf -a [pathname]
Get configuration values
-v specification Indicate specific version for which configuration
values shall be fetched.
-a, --all Print all known configuration values
Other options:
-h, --help This text
-V, --version Print program version and exit
</screen>
<para>The <command>getconf</command> utility prints the value of the
configuration variable specified by <literal>variable_name</literal>.
If <literal>pathname</literal> is given, <command>getconf</command> prints
the value of the configuration variable for the specified pathname.</para>
<para>If you specify the <literal>-v</literal> option, the parameter
denotes a specification for which the value of the configuration variable
should be printed.</para>
<para>Use the <literal>-a</literal> option to print a list of all available
configuration variables.</para>
</sect2>
<sect2 id="getfacl"><title>getfacl</title> <sect2 id="getfacl"><title>getfacl</title>
<screen> <screen>
Usage: getfacl [-adn] FILE [FILE2...] Usage: getfacl [-adn] FILE [FILE2...]
Display file and directory access control lists (ACLs). Display file and directory access control lists (ACLs).
-a, --all display the filename, the owner, the group, and -a, --all display the filename, the owner, the group, and
@ -466,7 +509,7 @@ Display file and directory access control lists (ACLs).
the default ACL of the directory, if it exists the default ACL of the directory, if it exists
-h, --help output usage information and exit -h, --help output usage information and exit
-n, --noname display user and group IDs instead of names -n, --noname display user and group IDs instead of names
-v, --version output version information and exit -V, --version output version information and exit
When multiple files are specified on the command line, a blank When multiple files are specified on the command line, a blank
line separates the ACLs for each file. line separates the ACLs for each file.
@ -506,13 +549,14 @@ The format for ACL output is as follows:
<screen> <screen>
Usage: kill [-f] [-signal] [-s signal] pid1 [pid2 ...] Usage: kill [-f] [-signal] [-s signal] pid1 [pid2 ...]
kill -l [signal] kill -l [signal]
Send signals to processes Send signals to processes
-f, --force force, using win32 interface if necessary -f, --force force, using win32 interface if necessary
-l, --list print a list of signal names -l, --list print a list of signal names
-s, --signal send signal (use kill --list for a list) -s, --signal send signal (use kill --list for a list)
-h, --help output usage information and exit -h, --help output usage information and exit
-v, --version output version information and exit -V, --version output version information and exit
</screen> </screen>
<para>The <command>kill</command> program allows you to send arbitrary <para>The <command>kill</command> program allows you to send arbitrary
@ -603,12 +647,35 @@ SIGUSR2 31 user defined signal 2
</sect2> </sect2>
<sect2 id="ldd"><title>ldd</title>
<screen>
Usage: ldd [OPTION]... FILE...
Print shared library dependencies
-h, --help print this help and exit
-V, --version print version information and exit
-r, --function-relocs process data and function relocations
(currently unimplemented)
-u, --unused print unused direct dependencies
(currently unimplemented)
-v, --verbose print all information
(currently unimplemented)
</screen>
<para><command>ldd</command> prints the shared libraries (DLLs) an executable
or DLL is linked against. No modifying option is implemented yet.</para>
</sect2>
<sect2 id="locale"><title>locale</title> <sect2 id="locale"><title>locale</title>
<screen> <screen>
Usage: locale [-amvhV] Usage: locale [-amvhV]
or: locale [-ck] NAME or: locale [-ck] NAME
or: locale [-usfnU] or: locale [-usfnU]
Get locale-specific information. Get locale-specific information.
System information: System information:
@ -754,9 +821,11 @@ bash$ locale noexpr
<screen> <screen>
Usage: mkgroup [OPTION]... Usage: mkgroup [OPTION]...
Print /etc/group file to stdout Print /etc/group file to stdout
Options: Options:
-l,--local [machine[,offset]] -l,--local [machine[,offset]]
print local groups with gid offset offset print local groups with gid offset offset
(from local machine if no machine specified) (from local machine if no machine specified)
@ -785,7 +854,7 @@ Options:
-s,--no-sids (ignored) -s,--no-sids (ignored)
-u,--users (ignored) -u,--users (ignored)
-h,--help print this message -h,--help print this message
-v,--version print version information and exit -V,--version print version information and exit
Default is to print local groups on stand-alone machines, plus domain Default is to print local groups on stand-alone machines, plus domain
groups on domain controllers and domain member machines. groups on domain controllers and domain member machines.
@ -849,9 +918,11 @@ up as a group in <command>ls -l</command> output.
<screen> <screen>
Usage: mkpasswd [OPTIONS]... Usage: mkpasswd [OPTIONS]...
Print /etc/passwd file to stdout Print /etc/passwd file to stdout
Options: Options:
-l,--local [machine[,offset]] -l,--local [machine[,offset]]
print local user accounts with uid offset offset print local user accounts with uid offset offset
(from local machine if no machine specified) (from local machine if no machine specified)
@ -882,7 +953,7 @@ Options:
-s,--no-sids (ignored) -s,--no-sids (ignored)
-g,--local-groups (ignored) -g,--local-groups (ignored)
-h,--help displays this message -h,--help displays this message
-v,--version version information and exit -V,--version version information and exit
Default is to print local accounts on stand-alone machines, domain accounts Default is to print local accounts on stand-alone machines, domain accounts
on domain controllers and domain member machines. on domain controllers and domain member machines.
@ -958,6 +1029,7 @@ up as file owners in <command>ls -l</command> output.
Usage: mount [OPTION] [&lt;win32path&gt; &lt;posixpath&gt;] Usage: mount [OPTION] [&lt;win32path&gt; &lt;posixpath&gt;]
mount -a mount -a
mount &lt;posixpath&gt; mount &lt;posixpath&gt;
Display information about mounted filesystems, or mount a filesystem Display information about mounted filesystems, or mount a filesystem
-a, --all mount all filesystems mentioned in fstab -a, --all mount all filesystems mentioned in fstab
@ -969,7 +1041,7 @@ Display information about mounted filesystems, or mount a filesystem
and cygdrive prefixes and cygdrive prefixes
-o, --options X[,X...] specify mount options -o, --options X[,X...] specify mount options
-p, --show-cygdrive-prefix show user and/or system cygdrive path prefix -p, --show-cygdrive-prefix show user and/or system cygdrive path prefix
-v, --version output version information and exit -V, --version output version information and exit
</screen> </screen>
<para>The <command>mount</command> program is used to map your drives <para>The <command>mount</command> program is used to map your drives
@ -1166,9 +1238,10 @@ automounted filesystems default to this set of options. For instance
<sect3 id="utils-limitations"><title>Limitations</title> <sect3 id="utils-limitations"><title>Limitations</title>
<para>Limitations: there is a hard-coded limit of 30 mount <para>Limitations: there is a hard-coded limit of 64 mount points
points. Also, although you can mount to pathnames that do not start (up to Cygwin 1.7.9: 30 mount points). Also, although you can mount
with "/", there is no way to make use of such mount points.</para> to pathnames that do not start with "/", there is no way to make use
of such mount points.</para>
<para>Normally the POSIX mount point in Cygwin is an existing empty <para>Normally the POSIX mount point in Cygwin is an existing empty
directory, as in standard UNIX. If this is the case, or if there is a directory, as in standard UNIX. If this is the case, or if there is a
@ -1204,6 +1277,7 @@ find <filename>mtpt</filename>.
<screen> <screen>
Usage: passwd [OPTION] [USER] Usage: passwd [OPTION] [USER]
Change USER's password or password attributes. Change USER's password or password attributes.
User operations: User operations:
@ -1235,7 +1309,7 @@ Other options:
-S, --status display password status for USER (locked, expired, -S, --status display password status for USER (locked, expired,
etc.) plus global system password settings. etc.) plus global system password settings.
-h, --help output usage information and exit. -h, --help output usage information and exit.
-v, --version output version information and exit. -V, --version output version information and exit.
If no option is given, change USER's password. If no user name is given, If no option is given, change USER's password. If no user name is given,
operate on current user. System operations must not be mixed with user operate on current user. System operations must not be mixed with user
@ -1352,6 +1426,7 @@ some systems.</para>
<screen> <screen>
Usage: ps [-aefls] [-u UID] Usage: ps [-aefls] [-u UID]
Report process status Report process status
-a, --all show processes of all users -a, --all show processes of all users
@ -1362,7 +1437,7 @@ Report process status
-p, --process show information for specified PID -p, --process show information for specified PID
-s, --summary show process summary -s, --summary show process summary
-u, --user list processes owned by UID -u, --user list processes owned by UID
-v, --version output version information and exit -V, --version output version information and exit
-W, --windows show windows as well as cygwin processes -W, --windows show windows as well as cygwin processes
With no options, ps outputs the long format by default With no options, ps outputs the long format by default
</screen> </screen>
@ -1413,9 +1488,11 @@ option.
<screen> <screen>
Usage: regtool [OPTION] (add|check|get|list|remove|unset|load|unload|save) KEY Usage: regtool [OPTION] (add|check|get|list|remove|unset|load|unload|save) KEY
View or edit the Win32 registry View or edit the Win32 registry
Actions: Actions:
add KEY\SUBKEY add new SUBKEY add KEY\SUBKEY add new SUBKEY
check KEY exit 0 if KEY exists, 1 if not check KEY exit 0 if KEY exists, 1 if not
get KEY\VALUE prints VALUE to stdout get KEY\VALUE prints VALUE to stdout
@ -1428,16 +1505,19 @@ Actions:
save KEY\SUBKEY PATH save SUBKEY into new hive PATH save KEY\SUBKEY PATH save SUBKEY into new hive PATH
Options for 'list' Action: Options for 'list' Action:
-k, --keys print only KEYs -k, --keys print only KEYs
-l, --list print only VALUEs -l, --list print only VALUEs
-p, --postfix like ls -p, appends '\' postfix to KEY names -p, --postfix like ls -p, appends '\' postfix to KEY names
Options for 'get' Action: Options for 'get' Action:
-b, --binary print REG_BINARY data as hex bytes -b, --binary print REG_BINARY data as hex bytes
-n, --none print data as stream of bytes as stored in registry -n, --none print data as stream of bytes as stored in registry
-x, --hex print numerical data as hex numbers -x, --hex print numerical data as hex numbers
Options for 'set' Action: Options for 'set' Action:
-b, --binary set type to REG_BINARY (hex args or '-') -b, --binary set type to REG_BINARY (hex args or '-')
-D, --dword-be set type to REG_DWORD_BIG_ENDIAN -D, --dword-be set type to REG_DWORD_BIG_ENDIAN
-e, --expand-string set type to REG_EXPAND_SZ -e, --expand-string set type to REG_EXPAND_SZ
@ -1448,9 +1528,11 @@ Options for 'set' Action:
-s, --string set type to REG_SZ -s, --string set type to REG_SZ
Options for 'set' and 'unset' Actions: Options for 'set' and 'unset' Actions:
-K&lt;c&gt;, --key-separator[=]&lt;c&gt; set key separator to &lt;c&gt; instead of '\' -K&lt;c&gt;, --key-separator[=]&lt;c&gt; set key separator to &lt;c&gt; instead of '\'
Other Options: Other Options:
-h, --help output usage information and exit -h, --help output usage information and exit
-q, --quiet no error output, just nonzero return if KEY/VALUE missing -q, --quiet no error output, just nonzero return if KEY/VALUE missing
-v, --verbose verbose output, including VALUE contents when applicable -v, --verbose verbose output, including VALUE contents when applicable
@ -1579,6 +1661,7 @@ an alternate key/value separator character.
<screen> <screen>
Usage: setfacl [-r] (-f ACL_FILE | -s acl_entries) FILE... Usage: setfacl [-r] (-f ACL_FILE | -s acl_entries) FILE...
setfacl [-r] ([-d acl_entries] [-m acl_entries]) FILE... setfacl [-r] ([-d acl_entries] [-m acl_entries]) FILE...
Modify file and directory access control lists (ACLs) Modify file and directory access control lists (ACLs)
-d, --delete delete one or more specified ACL entries -d, --delete delete one or more specified ACL entries
@ -1590,7 +1673,7 @@ Modify file and directory access control lists (ACLs)
-s, --substitute substitute specified ACL entries for the -s, --substitute substitute specified ACL entries for the
ACL of FILE ACL of FILE
-h, --help output usage information and exit -h, --help output usage information and exit
-v, --version output version information and exit -V, --version output version information and exit
At least one of (-d, -f, -m, -s) must be specified At least one of (-d, -f, -m, -s) must be specified
</screen> </screen>
@ -1724,10 +1807,33 @@ account currently.
</sect2> </sect2>
<sect2 id="setmetamode"><title>setmetamode</title>
<screen>
Usage: setmetamode [metabit|escprefix]
Get or set keyboard meta mode
Without argument, it shows the current meta key mode.
metabit|meta|bit The meta key sets the top bit of the character.
escprefix|esc|prefix The meta key sends an escape prefix.
Other options:
-h, --help This text
-V, --version Print program version and exit
</screen>
<para><command>setmetamode</command> can be used to determine and set the
key code sent by the meta (aka <literal>Alt</literal>) key.</para>
</sect2>
<sect2 id="ssp"><title>ssp</title> <sect2 id="ssp"><title>ssp</title>
<screen> <screen>
Usage: ssp [options] low_pc high_pc command... Usage: ssp [options] low_pc high_pc command...
Single-step profile COMMAND Single-step profile COMMAND
-c, --console-trace trace every EIP value to the console. *Lots* slower. -c, --console-trace trace every EIP value to the console. *Lots* slower.
@ -1925,6 +2031,7 @@ $ ssp <literal>-v</literal> <literal>-s</literal> <literal>-l</literal> <literal
<screen> <screen>
Usage: strace.exe [OPTIONS] &lt;command-line&gt; Usage: strace.exe [OPTIONS] &lt;command-line&gt;
Usage: strace.exe [OPTIONS] -p &lt;pid&gt; Usage: strace.exe [OPTIONS] -p &lt;pid&gt;
Trace system calls and signals Trace system calls and signals
-b, --buffer-size=SIZE set size of output file buffer -b, --buffer-size=SIZE set size of output file buffer
@ -1944,7 +2051,7 @@ Trace system calls and signals
-T, --toggle toggle tracing in a process already being -T, --toggle toggle tracing in a process already being
traced. Requires -p &lt;pid&gt; traced. Requires -p &lt;pid&gt;
-u, --usecs toggle printing of microseconds timestamp -u, --usecs toggle printing of microseconds timestamp
-v, --version output version information and exit -V, --version output version information and exit
-w, --new-window spawn program under test in a new window -w, --new-window spawn program under test in a new window
MASK can be any combination of the following mnemonics and/or hex values MASK can be any combination of the following mnemonics and/or hex values
@ -2002,11 +2109,12 @@ This program is mainly useful for debugging the Cygwin DLL itself.</para>
<screen> <screen>
Usage: umount.exe [OPTION] [&lt;posixpath&gt;] Usage: umount.exe [OPTION] [&lt;posixpath&gt;]
Unmount filesystems Unmount filesystems
-h, --help output usage information and exit -h, --help output usage information and exit
-U, --remove-user-mounts remove all user mounts -U, --remove-user-mounts remove all user mounts
-v, --version output version information and exit -V, --version output version information and exit
</screen> </screen>
<para>The <command>umount</command> program removes mounts from the <para>The <command>umount</command> program removes mounts from the