Cygwin: utils: convert usage() to proper noreturn function throughout

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
This commit is contained in:
Corinna Vinschen
2020-08-07 13:29:43 +02:00
parent 9beb7b9771
commit e7fca6f867
23 changed files with 55 additions and 111 deletions

View File

@@ -11,6 +11,7 @@ details. */
#include <pwd.h>
#include <grp.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <getopt.h>
#include <sys/acl.h>
@@ -48,7 +49,7 @@ groupname (gid_t gid)
return gbuf;
}
static void
static void __attribute__ ((__noreturn__))
usage (FILE * stream)
{
fprintf (stream, "Usage: %s [-adn] FILE [FILE2...]\n"
@@ -97,6 +98,7 @@ usage (FILE * stream)
" default:other::perm\n"
"\n");
}
exit (stream == stdout ? 0 : 1);
}
struct option longopts[] = {
@@ -165,7 +167,6 @@ main (int argc, char **argv)
break;
case 'h':
usage (stdout);
return 0;
case 'n':
nopt = 1;
break;
@@ -177,10 +178,7 @@ main (int argc, char **argv)
return 1;
}
if (optind > argc - 1)
{
usage (stderr);
return 1;
}
usage (stderr);
if (nopt)
options |= TEXT_NUMERIC_IDS;
if (eopt > 0)