Cygwin: utils: convert usage() to proper noreturn function throughout
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
This commit is contained in:
parent
9beb7b9771
commit
e7fca6f867
|
@ -224,7 +224,7 @@ print_version ()
|
||||||
strrchr (__DATE__, ' ') + 1);
|
strrchr (__DATE__, ' ') + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void __attribute__ ((__noreturn__))
|
||||||
usage (FILE *stream)
|
usage (FILE *stream)
|
||||||
{
|
{
|
||||||
fprintf (stream, "Usage: %s [-RVfhv] [+-=mode]... [file]...\n",
|
fprintf (stream, "Usage: %s [-RVfhv] [+-=mode]... [file]...\n",
|
||||||
|
@ -264,6 +264,7 @@ usage (FILE *stream)
|
||||||
" 'C', 'Casesensitive': directory is handled case sensitive\n"
|
" 'C', 'Casesensitive': directory is handled case sensitive\n"
|
||||||
" (Windows 10 1803 or later, local NTFS only,\n"
|
" (Windows 10 1803 or later, local NTFS only,\n"
|
||||||
" WSL must be installed)\n");
|
" WSL must be installed)\n");
|
||||||
|
exit (stream == stdout ? 0 : 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
|
@ -303,7 +304,6 @@ main (int argc, char **argv)
|
||||||
/*FALLTHRU*/
|
/*FALLTHRU*/
|
||||||
case 'h':
|
case 'h':
|
||||||
usage (c == 'h' ? stdout : stderr);
|
usage (c == 'h' ? stdout : stderr);
|
||||||
return 1;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
next:
|
next:
|
||||||
|
@ -318,10 +318,7 @@ next:
|
||||||
if (!opt)
|
if (!opt)
|
||||||
break;
|
break;
|
||||||
if (argv[optind][1] == '\0' || get_flags (argv[optind]))
|
if (argv[optind][1] == '\0' || get_flags (argv[optind]))
|
||||||
{
|
usage (stderr);
|
||||||
usage (stderr);
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
++optind;
|
++optind;
|
||||||
}
|
}
|
||||||
if (sanity_check ())
|
if (sanity_check ())
|
||||||
|
|
|
@ -62,8 +62,6 @@ void package_find (int, char **);
|
||||||
void package_list (int, char **);
|
void package_list (int, char **);
|
||||||
/* In bloda.cc */
|
/* In bloda.cc */
|
||||||
void dump_dodgy_apps (int verbose);
|
void dump_dodgy_apps (int verbose);
|
||||||
/* Forward declaration */
|
|
||||||
static void usage (FILE *, int);
|
|
||||||
|
|
||||||
static const char *known_env_vars[] = {
|
static const char *known_env_vars[] = {
|
||||||
"c_include_path",
|
"c_include_path",
|
||||||
|
@ -2110,7 +2108,7 @@ package_grep (char *search)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void __attribute__ ((__noreturn__))
|
||||||
usage (FILE * stream, int status)
|
usage (FILE * stream, int status)
|
||||||
{
|
{
|
||||||
fprintf (stream, "\
|
fprintf (stream, "\
|
||||||
|
|
|
@ -76,7 +76,7 @@ static struct option long_options[] = {
|
||||||
|
|
||||||
static char options[] = "ac:df:hilmMopst:uUVwAC:DHOPSWF:";
|
static char options[] = "ac:df:hilmMopst:uUVwAC:DHOPSWF:";
|
||||||
|
|
||||||
static void
|
static void __attribute__ ((__noreturn__))
|
||||||
usage (FILE * stream, int status)
|
usage (FILE * stream, int status)
|
||||||
{
|
{
|
||||||
if (!ignore_flag || !status)
|
if (!ignore_flag || !status)
|
||||||
|
@ -971,7 +971,6 @@ do_options (int argc, char **argv, int from_file)
|
||||||
|
|
||||||
case 'h':
|
case 'h':
|
||||||
usage (stdout, 0);
|
usage (stdout, 0);
|
||||||
break;
|
|
||||||
|
|
||||||
case 'V':
|
case 'V':
|
||||||
print_version ();
|
print_version ();
|
||||||
|
|
|
@ -948,7 +948,7 @@ dumper::write_core_dump ()
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void __attribute__ ((__noreturn__))
|
||||||
usage (FILE *stream, int status)
|
usage (FILE *stream, int status)
|
||||||
{
|
{
|
||||||
fprintf (stream, "\
|
fprintf (stream, "\
|
||||||
|
|
|
@ -501,7 +501,7 @@ printvar (const struct conf_variable *cp, const char *pathname)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void __attribute__ ((__noreturn__))
|
||||||
usage (int ret)
|
usage (int ret)
|
||||||
{
|
{
|
||||||
fprintf (ret ? stderr : stdout,
|
fprintf (ret ? stderr : stdout,
|
||||||
|
|
|
@ -11,6 +11,7 @@ details. */
|
||||||
#include <pwd.h>
|
#include <pwd.h>
|
||||||
#include <grp.h>
|
#include <grp.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <getopt.h>
|
#include <getopt.h>
|
||||||
#include <sys/acl.h>
|
#include <sys/acl.h>
|
||||||
|
@ -48,7 +49,7 @@ groupname (gid_t gid)
|
||||||
return gbuf;
|
return gbuf;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void __attribute__ ((__noreturn__))
|
||||||
usage (FILE * stream)
|
usage (FILE * stream)
|
||||||
{
|
{
|
||||||
fprintf (stream, "Usage: %s [-adn] FILE [FILE2...]\n"
|
fprintf (stream, "Usage: %s [-adn] FILE [FILE2...]\n"
|
||||||
|
@ -97,6 +98,7 @@ usage (FILE * stream)
|
||||||
" default:other::perm\n"
|
" default:other::perm\n"
|
||||||
"\n");
|
"\n");
|
||||||
}
|
}
|
||||||
|
exit (stream == stdout ? 0 : 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct option longopts[] = {
|
struct option longopts[] = {
|
||||||
|
@ -165,7 +167,6 @@ main (int argc, char **argv)
|
||||||
break;
|
break;
|
||||||
case 'h':
|
case 'h':
|
||||||
usage (stdout);
|
usage (stdout);
|
||||||
return 0;
|
|
||||||
case 'n':
|
case 'n':
|
||||||
nopt = 1;
|
nopt = 1;
|
||||||
break;
|
break;
|
||||||
|
@ -177,10 +178,7 @@ main (int argc, char **argv)
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
if (optind > argc - 1)
|
if (optind > argc - 1)
|
||||||
{
|
usage (stderr);
|
||||||
usage (stderr);
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
if (nopt)
|
if (nopt)
|
||||||
options |= TEXT_NUMERIC_IDS;
|
options |= TEXT_NUMERIC_IDS;
|
||||||
if (eopt > 0)
|
if (eopt > 0)
|
||||||
|
|
|
@ -33,7 +33,7 @@ static struct option longopts[] =
|
||||||
|
|
||||||
static char opts[] = "hl::fs:WV";
|
static char opts[] = "hl::fs:WV";
|
||||||
|
|
||||||
static void
|
static void __attribute__ ((__noreturn__))
|
||||||
usage (FILE *where = stderr)
|
usage (FILE *where = stderr)
|
||||||
{
|
{
|
||||||
fprintf (where , ""
|
fprintf (where , ""
|
||||||
|
|
|
@ -69,7 +69,7 @@ error (const char *fmt, ...)
|
||||||
exit (1);
|
exit (1);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void __attribute__ ((__noreturn__))
|
||||||
usage ()
|
usage ()
|
||||||
{
|
{
|
||||||
printf ("Usage: %s [OPTION]... FILE...\n\
|
printf ("Usage: %s [OPTION]... FILE...\n\
|
||||||
|
@ -85,6 +85,7 @@ Print shared library dependencies\n\
|
||||||
-v, --verbose print all information\n\
|
-v, --verbose print all information\n\
|
||||||
(currently unimplemented)\n",
|
(currently unimplemented)\n",
|
||||||
program_invocation_short_name);
|
program_invocation_short_name);
|
||||||
|
exit (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -444,7 +445,6 @@ main (int argc, char **argv)
|
||||||
exit (1);
|
exit (1);
|
||||||
case 'h':
|
case 'h':
|
||||||
usage ();
|
usage ();
|
||||||
exit (0);
|
|
||||||
case 'V':
|
case 'V':
|
||||||
print_version ();
|
print_version ();
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -42,7 +42,7 @@
|
||||||
#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
|
||||||
|
|
||||||
void
|
static void __attribute__ ((__noreturn__))
|
||||||
usage ()
|
usage ()
|
||||||
{
|
{
|
||||||
printf (
|
printf (
|
||||||
|
@ -78,6 +78,7 @@ usage ()
|
||||||
" -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",
|
||||||
program_invocation_short_name);
|
program_invocation_short_name);
|
||||||
|
exit (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -811,7 +812,6 @@ main (int argc, char **argv)
|
||||||
break;
|
break;
|
||||||
case 'h':
|
case 'h':
|
||||||
usage ();
|
usage ();
|
||||||
return 0;
|
|
||||||
case 'V':
|
case 'V':
|
||||||
print_version ();
|
print_version ();
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -180,7 +180,7 @@ print_version ()
|
||||||
strrchr (__DATE__, ' ') + 1);
|
strrchr (__DATE__, ' ') + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void __attribute__ ((__noreturn__))
|
||||||
usage (FILE *stream)
|
usage (FILE *stream)
|
||||||
{
|
{
|
||||||
fprintf (stream, "Usage: %s [-RVadhln] [file]...\n",
|
fprintf (stream, "Usage: %s [-RVadhln] [file]...\n",
|
||||||
|
@ -221,6 +221,7 @@ usage (FILE *stream)
|
||||||
" 'C', 'Casesensitive': directory is handled case sensitive\n"
|
" 'C', 'Casesensitive': directory is handled case sensitive\n"
|
||||||
" (Windows 10 1803 or later, local NTFS only,\n"
|
" (Windows 10 1803 or later, local NTFS only,\n"
|
||||||
" WSL must be installed)\n");
|
" WSL must be installed)\n");
|
||||||
|
exit (stream == stdout ? 0 : 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
|
@ -254,7 +255,7 @@ main (int argc, char **argv)
|
||||||
case 'h':
|
case 'h':
|
||||||
default:
|
default:
|
||||||
usage (c == 'h' ? stdout : stderr);
|
usage (c == 'h' ? stdout : stderr);
|
||||||
return 1;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (optind > argc - 1)
|
if (optind > argc - 1)
|
||||||
|
|
|
@ -134,7 +134,7 @@ minidump(DWORD pid, MINIDUMP_TYPE dump_type, const char *minidump_file)
|
||||||
CloseHandle(dump_file);
|
CloseHandle(dump_file);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void __attribute__ ((__noreturn__))
|
||||||
usage (FILE *stream, int status)
|
usage (FILE *stream, int status)
|
||||||
{
|
{
|
||||||
fprintf (stream, "\
|
fprintf (stream, "\
|
||||||
|
|
|
@ -471,7 +471,7 @@ enum_groups (domlist_t *mach, const char *sep, DWORD id_offset,
|
||||||
while (rc == ERROR_MORE_DATA);
|
while (rc == ERROR_MORE_DATA);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int __attribute__ ((__noreturn__))
|
||||||
usage (FILE * stream)
|
usage (FILE * stream)
|
||||||
{
|
{
|
||||||
fprintf (stream,
|
fprintf (stream,
|
||||||
|
@ -510,7 +510,7 @@ usage (FILE * stream)
|
||||||
"groups on domain controllers and domain member machines.\n"
|
"groups on domain controllers and domain member machines.\n"
|
||||||
"\n", program_invocation_short_name,
|
"\n", program_invocation_short_name,
|
||||||
(const char *) cygwin_internal (CW_GETNSSSEP));
|
(const char *) cygwin_internal (CW_GETNSSSEP));
|
||||||
return 1;
|
exit (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct option longopts[] = {
|
struct option longopts[] = {
|
||||||
|
@ -703,7 +703,6 @@ main (int argc, char **argv)
|
||||||
break;
|
break;
|
||||||
case 'h':
|
case 'h':
|
||||||
usage (stdout);
|
usage (stdout);
|
||||||
return 0;
|
|
||||||
case 'V':
|
case 'V':
|
||||||
print_version ();
|
print_version ();
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -358,7 +358,7 @@ enum_users (domlist_t *mach, const char *sep, const char *passed_home_path,
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int __attribute__ ((__noreturn__))
|
||||||
usage (FILE * stream)
|
usage (FILE * stream)
|
||||||
{
|
{
|
||||||
fprintf (stream,
|
fprintf (stream,
|
||||||
|
@ -399,7 +399,7 @@ usage (FILE * stream)
|
||||||
"on domain controllers and domain member machines.\n"
|
"on domain controllers and domain member machines.\n"
|
||||||
"\n", program_invocation_short_name,
|
"\n", program_invocation_short_name,
|
||||||
(const char *) cygwin_internal (CW_GETNSSSEP));
|
(const char *) cygwin_internal (CW_GETNSSSEP));
|
||||||
return 1;
|
exit (stream == stdout ? 0 : 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct option longopts[] = {
|
static struct option longopts[] = {
|
||||||
|
@ -606,7 +606,6 @@ main (int argc, char **argv)
|
||||||
break;
|
break;
|
||||||
case 'h':
|
case 'h':
|
||||||
usage (stdout);
|
usage (stdout);
|
||||||
return 0;
|
|
||||||
case 'V':
|
case 'V':
|
||||||
print_version ();
|
print_version ();
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -203,7 +203,7 @@ static struct option longopts[] =
|
||||||
|
|
||||||
static char opts[] = "acfhmpVo:";
|
static char opts[] = "acfhmpVo:";
|
||||||
|
|
||||||
static void
|
static void __attribute__ ((__noreturn__))
|
||||||
usage (FILE *where = stderr)
|
usage (FILE *where = stderr)
|
||||||
{
|
{
|
||||||
char *options;
|
char *options;
|
||||||
|
|
|
@ -266,8 +266,7 @@ SetModals (int xarg, int narg, int iarg, int Larg, PCWSTR server)
|
||||||
return EvalRet (ret, NULL);
|
return EvalRet (ret, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void usage (FILE * stream, int status) __attribute__ ((noreturn));
|
static void __attribute__ ((__noreturn__))
|
||||||
static void
|
|
||||||
usage (FILE * stream, int status)
|
usage (FILE * stream, int status)
|
||||||
{
|
{
|
||||||
fprintf (stream, ""
|
fprintf (stream, ""
|
||||||
|
|
|
@ -103,7 +103,7 @@ ttynam (int ntty, char buf[9])
|
||||||
return buf;
|
return buf;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void __attribute__ ((__noreturn__))
|
||||||
usage (FILE * stream, int status)
|
usage (FILE * stream, int status)
|
||||||
{
|
{
|
||||||
fprintf (stream, "\
|
fprintf (stream, "\
|
||||||
|
|
|
@ -89,7 +89,7 @@ char **argv;
|
||||||
HKEY key;
|
HKEY key;
|
||||||
wchar_t *value;
|
wchar_t *value;
|
||||||
|
|
||||||
static void
|
static void __attribute__ ((__noreturn__))
|
||||||
usage (FILE *where = stderr)
|
usage (FILE *where = stderr)
|
||||||
{
|
{
|
||||||
fprintf (where, ""
|
fprintf (where, ""
|
||||||
|
@ -835,10 +835,7 @@ int
|
||||||
cmd_load ()
|
cmd_load ()
|
||||||
{
|
{
|
||||||
if (!argv[1])
|
if (!argv[1])
|
||||||
{
|
usage ();
|
||||||
usage ();
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
find_key (1, 0);
|
find_key (1, 0);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -847,10 +844,7 @@ int
|
||||||
cmd_unload ()
|
cmd_unload ()
|
||||||
{
|
{
|
||||||
if (argv[1])
|
if (argv[1])
|
||||||
{
|
usage ();
|
||||||
usage ();
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
find_key (1, 0);
|
find_key (1, 0);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -859,10 +853,7 @@ int
|
||||||
cmd_save ()
|
cmd_save ()
|
||||||
{
|
{
|
||||||
if (!argv[1])
|
if (!argv[1])
|
||||||
{
|
usage ();
|
||||||
usage ();
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
/* REG_OPTION_BACKUP_RESTORE is necessary to save /HKLM/SECURITY */
|
/* REG_OPTION_BACKUP_RESTORE is necessary to save /HKLM/SECURITY */
|
||||||
find_key (1, KEY_QUERY_VALUE, REG_OPTION_BACKUP_RESTORE);
|
find_key (1, KEY_QUERY_VALUE, REG_OPTION_BACKUP_RESTORE);
|
||||||
ssize_t len = cygwin_conv_path (CCP_POSIX_TO_WIN_W, argv[1], NULL, 0);
|
ssize_t len = cygwin_conv_path (CCP_POSIX_TO_WIN_W, argv[1], NULL, 0);
|
||||||
|
@ -880,10 +871,7 @@ int
|
||||||
cmd_restore ()
|
cmd_restore ()
|
||||||
{
|
{
|
||||||
if (!argv[1])
|
if (!argv[1])
|
||||||
{
|
usage ();
|
||||||
usage ();
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
/* REG_OPTION_BACKUP_RESTORE is necessary to restore /HKLM/SECURITY */
|
/* REG_OPTION_BACKUP_RESTORE is necessary to restore /HKLM/SECURITY */
|
||||||
find_key (1, KEY_ALL_ACCESS, REG_OPTION_BACKUP_RESTORE);
|
find_key (1, KEY_ALL_ACCESS, REG_OPTION_BACKUP_RESTORE);
|
||||||
ssize_t len = cygwin_conv_path (CCP_POSIX_TO_WIN_W, argv[1], NULL, 0);
|
ssize_t len = cygwin_conv_path (CCP_POSIX_TO_WIN_W, argv[1], NULL, 0);
|
||||||
|
@ -1009,6 +997,4 @@ main (int argc, char **_argv)
|
||||||
return commands[i].func ();
|
return commands[i].func ();
|
||||||
}
|
}
|
||||||
usage ();
|
usage ();
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -525,7 +525,7 @@ setfacl (action_t action, const char *path, aclent_t *acls, int cnt)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void __attribute__ ((__noreturn__))
|
||||||
usage (FILE *stream)
|
usage (FILE *stream)
|
||||||
{
|
{
|
||||||
fprintf (stream, ""
|
fprintf (stream, ""
|
||||||
|
@ -647,6 +647,7 @@ usage (FILE *stream)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
fprintf(stream, "Try '%s --help' for more information.\n", prog_name);
|
fprintf(stream, "Try '%s --help' for more information.\n", prog_name);
|
||||||
|
exit (stream == stdout ? 0 : 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct option longopts[] = {
|
struct option longopts[] = {
|
||||||
|
@ -702,10 +703,7 @@ main (int argc, char **argv)
|
||||||
else if (action == DeleteDef)
|
else if (action == DeleteDef)
|
||||||
action = DeleteAll;
|
action = DeleteAll;
|
||||||
else
|
else
|
||||||
{
|
usage (stderr);
|
||||||
usage (stderr);
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case 'd': /* Backward compat */
|
case 'd': /* Backward compat */
|
||||||
case 'x':
|
case 'x':
|
||||||
|
@ -714,10 +712,7 @@ main (int argc, char **argv)
|
||||||
else if (action == Modify)
|
else if (action == Modify)
|
||||||
action = ModNDel;
|
action = ModNDel;
|
||||||
else
|
else
|
||||||
{
|
usage (stderr);
|
||||||
usage (stderr);
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
if (! getaclentries (Delete, optarg, acls, &aclidx))
|
if (! getaclentries (Delete, optarg, acls, &aclidx))
|
||||||
{
|
{
|
||||||
fprintf (stderr, "%s: illegal acl entries\n", prog_name);
|
fprintf (stderr, "%s: illegal acl entries\n", prog_name);
|
||||||
|
@ -728,10 +723,7 @@ main (int argc, char **argv)
|
||||||
if (action == NoAction)
|
if (action == NoAction)
|
||||||
action = Set;
|
action = Set;
|
||||||
else
|
else
|
||||||
{
|
usage (stderr);
|
||||||
usage (stderr);
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
if (! getaclentries (SetFromFile, optarg, acls, &aclidx))
|
if (! getaclentries (SetFromFile, optarg, acls, &aclidx))
|
||||||
{
|
{
|
||||||
fprintf (stderr, "%s: illegal acl entries\n", prog_name);
|
fprintf (stderr, "%s: illegal acl entries\n", prog_name);
|
||||||
|
@ -740,17 +732,13 @@ main (int argc, char **argv)
|
||||||
break;
|
break;
|
||||||
case 'h':
|
case 'h':
|
||||||
usage (stdout);
|
usage (stdout);
|
||||||
return 0;
|
|
||||||
case 'k':
|
case 'k':
|
||||||
if (action == NoAction)
|
if (action == NoAction)
|
||||||
action = DeleteDef;
|
action = DeleteDef;
|
||||||
else if (action == DeleteExt)
|
else if (action == DeleteExt)
|
||||||
action = DeleteAll;
|
action = DeleteAll;
|
||||||
else
|
else
|
||||||
{
|
usage (stderr);
|
||||||
usage (stderr);
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case 'm':
|
case 'm':
|
||||||
if (action == NoAction)
|
if (action == NoAction)
|
||||||
|
@ -758,10 +746,7 @@ main (int argc, char **argv)
|
||||||
else if (action == Delete)
|
else if (action == Delete)
|
||||||
action = ModNDel;
|
action = ModNDel;
|
||||||
else
|
else
|
||||||
{
|
usage (stderr);
|
||||||
usage (stderr);
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
if (! getaclentries (Modify, optarg, acls, &aclidx))
|
if (! getaclentries (Modify, optarg, acls, &aclidx))
|
||||||
{
|
{
|
||||||
fprintf (stderr, "%s: illegal acl entries\n", prog_name);
|
fprintf (stderr, "%s: illegal acl entries\n", prog_name);
|
||||||
|
@ -780,10 +765,7 @@ main (int argc, char **argv)
|
||||||
if (action == NoAction)
|
if (action == NoAction)
|
||||||
action = Set;
|
action = Set;
|
||||||
else
|
else
|
||||||
{
|
usage (stderr);
|
||||||
usage (stderr);
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
if (! getaclentries (Set, optarg, acls, &aclidx))
|
if (! getaclentries (Set, optarg, acls, &aclidx))
|
||||||
{
|
{
|
||||||
fprintf (stderr, "%s: illegal acl entries\n", prog_name);
|
fprintf (stderr, "%s: illegal acl entries\n", prog_name);
|
||||||
|
@ -798,15 +780,9 @@ main (int argc, char **argv)
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
if (action == NoAction)
|
if (action == NoAction)
|
||||||
{
|
usage (stderr);
|
||||||
usage (stderr);
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
if (optind > argc - 1)
|
if (optind > argc - 1)
|
||||||
{
|
usage (stderr);
|
||||||
usage (stderr);
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
if (action == Set)
|
if (action == Set)
|
||||||
switch (aclcheck (acls, aclidx, NULL))
|
switch (aclcheck (acls, aclidx, NULL))
|
||||||
{
|
{
|
||||||
|
|
|
@ -10,16 +10,17 @@ details. */
|
||||||
|
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <getopt.h>
|
#include <getopt.h>
|
||||||
#include <sys/ioctl.h>
|
#include <sys/ioctl.h>
|
||||||
#include <cygwin/kd.h>
|
#include <cygwin/kd.h>
|
||||||
#include <cygwin/version.h>
|
#include <cygwin/version.h>
|
||||||
|
|
||||||
static void
|
static void __attribute__ ((__noreturn__))
|
||||||
usage (void)
|
usage (FILE *stream)
|
||||||
{
|
{
|
||||||
fprintf (stderr, "Usage: %s [metabit|escprefix]\n"
|
fprintf (stream, "Usage: %s [metabit|escprefix]\n"
|
||||||
"\n"
|
"\n"
|
||||||
"Get or set keyboard meta mode\n"
|
"Get or set keyboard meta mode\n"
|
||||||
"\n"
|
"\n"
|
||||||
|
@ -32,6 +33,7 @@ usage (void)
|
||||||
" -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",
|
||||||
program_invocation_short_name);
|
program_invocation_short_name);
|
||||||
|
exit (stream == stdout ? 0 : 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -87,8 +89,7 @@ main (int ac, char *av[])
|
||||||
switch (opt)
|
switch (opt)
|
||||||
{
|
{
|
||||||
case 'h':
|
case 'h':
|
||||||
usage ();
|
usage (stdout);
|
||||||
return 0;
|
|
||||||
case 'V':
|
case 'V':
|
||||||
print_version ();
|
print_version ();
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -105,10 +106,7 @@ main (int ac, char *av[])
|
||||||
|| !strcmp ("escprefix", av[1]))
|
|| !strcmp ("escprefix", av[1]))
|
||||||
param = 0x04;
|
param = 0x04;
|
||||||
else
|
else
|
||||||
{
|
usage (stderr);
|
||||||
usage ();
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
if (ioctl (0, KDSKBMETA, param) < 0)
|
if (ioctl (0, KDSKBMETA, param) < 0)
|
||||||
{
|
{
|
||||||
error ();
|
error ();
|
||||||
|
|
|
@ -674,7 +674,7 @@ run_program (char *cmdline)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void __attribute__ ((__noreturn__))
|
||||||
usage (FILE * stream)
|
usage (FILE * stream)
|
||||||
{
|
{
|
||||||
fprintf (stream , ""
|
fprintf (stream , ""
|
||||||
|
@ -880,7 +880,6 @@ main (int argc, char **argv)
|
||||||
break;
|
break;
|
||||||
case 'h':
|
case 'h':
|
||||||
usage (stdout);
|
usage (stdout);
|
||||||
break;
|
|
||||||
case 'l':
|
case 'l':
|
||||||
printf ("profiling dll usage\n");
|
printf ("profiling dll usage\n");
|
||||||
dll_counts = 1;
|
dll_counts = 1;
|
||||||
|
|
|
@ -957,7 +957,7 @@ parse_mask (const char *ms, char **endptr)
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void __attribute__ ((__noreturn__))
|
||||||
usage (FILE *where = stderr)
|
usage (FILE *where = stderr)
|
||||||
{
|
{
|
||||||
fprintf (where, "\
|
fprintf (where, "\
|
||||||
|
@ -1102,9 +1102,7 @@ main2 (int argc, char **argv)
|
||||||
forkdebug ^= 1;
|
forkdebug ^= 1;
|
||||||
break;
|
break;
|
||||||
case 'h':
|
case 'h':
|
||||||
// Print help and exit
|
|
||||||
usage (stdout);
|
usage (stdout);
|
||||||
break;
|
|
||||||
case 'H':
|
case 'H':
|
||||||
include_hex ^= 1;
|
include_hex ^= 1;
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -78,7 +78,7 @@ reg_enum (HKEY hkey, int idx, PWCHAR name, DWORD size)
|
||||||
== ERROR_SUCCESS;
|
== ERROR_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void __attribute__ ((__noreturn__))
|
||||||
usage (FILE *stream)
|
usage (FILE *stream)
|
||||||
{
|
{
|
||||||
fprintf (stream, ""
|
fprintf (stream, ""
|
||||||
|
@ -99,6 +99,7 @@ usage (FILE *stream)
|
||||||
"\n"
|
"\n"
|
||||||
" setenv TZ `%1$s`\n"
|
" setenv TZ `%1$s`\n"
|
||||||
"\n", program_invocation_short_name);
|
"\n", program_invocation_short_name);
|
||||||
|
exit (stream == stdout ? 0 : 1);
|
||||||
};
|
};
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -130,7 +131,6 @@ main (int argc, char **argv)
|
||||||
{
|
{
|
||||||
case 'h':
|
case 'h':
|
||||||
usage (stdout);
|
usage (stdout);
|
||||||
return 0;
|
|
||||||
case 'V':
|
case 'V':
|
||||||
print_version ();
|
print_version ();
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -140,10 +140,7 @@ main (int argc, char **argv)
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
if (optind < argc)
|
if (optind < argc)
|
||||||
{
|
usage (stderr);
|
||||||
usage (stderr);
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* First fetch current timezone information from registry. */
|
/* First fetch current timezone information from registry. */
|
||||||
hkey = reg_open (HKEY_LOCAL_MACHINE, REG_TZINFO, "timezone information");
|
hkey = reg_open (HKEY_LOCAL_MACHINE, REG_TZINFO, "timezone information");
|
||||||
|
|
|
@ -29,7 +29,7 @@ struct option longopts[] =
|
||||||
|
|
||||||
char opts[] = "hUV";
|
char opts[] = "hUV";
|
||||||
|
|
||||||
static void
|
static void __attribute__ ((__noreturn__))
|
||||||
usage (FILE *where = stderr)
|
usage (FILE *where = stderr)
|
||||||
{
|
{
|
||||||
fprintf (where, "\
|
fprintf (where, "\
|
||||||
|
|
Loading…
Reference in New Issue