use always static for usage and keep usage definition above main
This commit is contained in:
parent
575b38391c
commit
459161481a
12
cksum.c
12
cksum.c
@ -7,7 +7,12 @@
|
||||
#include "util.h"
|
||||
|
||||
static void cksum(FILE *, const char *);
|
||||
static void usage(void);
|
||||
|
||||
static void
|
||||
usage(void)
|
||||
{
|
||||
eprintf("usage: %s [files...]\n", argv0);
|
||||
}
|
||||
|
||||
static const unsigned long crctab[] = { 0x00000000,
|
||||
0x04c11db7, 0x09823b6e, 0x0d4326d9, 0x130476dc, 0x17c56b6b,
|
||||
@ -113,8 +118,3 @@ cksum(FILE *fp, const char *s)
|
||||
putchar('\n');
|
||||
}
|
||||
|
||||
void
|
||||
usage(void)
|
||||
{
|
||||
eprintf("usage: %s [files...]\n", argv0);
|
||||
}
|
||||
|
2
du.c
2
du.c
@ -20,7 +20,7 @@ static bool kflag = false;
|
||||
static long du(const char *);
|
||||
static void print(long n, char *path);
|
||||
|
||||
void
|
||||
static void
|
||||
usage(void)
|
||||
{
|
||||
eprintf("usage: %s [-a | -s] [-k] [file...]\n", argv0);
|
||||
|
11
env.c
11
env.c
@ -8,7 +8,11 @@
|
||||
|
||||
extern char **environ;
|
||||
|
||||
static void usage(void);
|
||||
static void
|
||||
usage(void)
|
||||
{
|
||||
eprintf("usage: env [-i] [-u name]... [name=value]... [cmd [arg...]]\n");
|
||||
}
|
||||
|
||||
int
|
||||
main(int argc, char *argv[])
|
||||
@ -39,8 +43,3 @@ main(int argc, char *argv[])
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
void
|
||||
usage(void)
|
||||
{
|
||||
eprintf("usage: env [-i] [-u name]... [name=value]... [cmd [arg...]]\n");
|
||||
}
|
||||
|
12
grep.c
12
grep.c
@ -12,7 +12,6 @@ enum { Match = 0, NoMatch = 1, Error = 2 };
|
||||
|
||||
static void addpattern(const char *);
|
||||
static bool grep(FILE *, const char *);
|
||||
static void usage(void);
|
||||
|
||||
static bool eflag = false;
|
||||
static bool vflag = false;
|
||||
@ -25,6 +24,12 @@ static struct plist {
|
||||
struct plist *next;
|
||||
} *phead;
|
||||
|
||||
static void
|
||||
usage(void)
|
||||
{
|
||||
enprintf(Error, "usage: %s [-Ecilnqv] [-e pattern] pattern [files...]\n", argv0);
|
||||
}
|
||||
|
||||
int
|
||||
main(int argc, char *argv[])
|
||||
{
|
||||
@ -158,8 +163,3 @@ end:
|
||||
return match;
|
||||
}
|
||||
|
||||
void
|
||||
usage(void)
|
||||
{
|
||||
enprintf(Error, "usage: %s [-Ecilnqv] [-e pattern] pattern [files...]\n", argv0);
|
||||
}
|
||||
|
18
test.c
18
test.c
@ -9,7 +9,15 @@
|
||||
|
||||
static bool unary(const char *, const char *);
|
||||
static bool binary(const char *, const char *, const char *);
|
||||
static void usage(void);
|
||||
|
||||
static void
|
||||
usage(void)
|
||||
{
|
||||
const char *ket = (*argv0 == '[') ? " ]" : "";
|
||||
|
||||
eprintf("usage: %s string%s\n"
|
||||
" %s [!] [-bcdefgkhLnprSstuwxz] string%s\n", argv0, ket, argv0, ket);
|
||||
}
|
||||
|
||||
int
|
||||
main(int argc, char *argv[])
|
||||
@ -149,11 +157,3 @@ binary(const char *arg1, const char *op, const char *arg2)
|
||||
return false;
|
||||
}
|
||||
|
||||
void
|
||||
usage(void)
|
||||
{
|
||||
const char *ket = (*argv0 == '[') ? " ]" : "";
|
||||
|
||||
eprintf("usage: %s string%s\n"
|
||||
" %s [!] [-bcdefgkhLnprSstuwxz] string%s\n", argv0, ket, argv0, ket);
|
||||
}
|
||||
|
11
yes.c
11
yes.c
@ -3,7 +3,11 @@
|
||||
#include <stdlib.h>
|
||||
#include "util.h"
|
||||
|
||||
static void usage(void);
|
||||
static void
|
||||
usage(void)
|
||||
{
|
||||
eprintf("usage: %s [string]\n", argv0);
|
||||
}
|
||||
|
||||
int
|
||||
main(int argc, char *argv[])
|
||||
@ -18,8 +22,3 @@ main(int argc, char *argv[])
|
||||
return EXIT_FAILURE; /* should not reach */
|
||||
}
|
||||
|
||||
void
|
||||
usage(void)
|
||||
{
|
||||
eprintf("usage: %s [string]\n", argv0);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user