diff options
author | Igor Sobrado <sobrado@cvs.openbsd.org> | 2007-09-10 07:42:27 +0000 |
---|---|---|
committer | Igor Sobrado <sobrado@cvs.openbsd.org> | 2007-09-10 07:42:27 +0000 |
commit | 4f985f76e48025121fe39b9f1d3f2abb0002db64 (patch) | |
tree | 9d7ef47159285ffe22f5abccdfd3084153ff5834 /usr.bin/readlink | |
parent | 38a5b6874f579b78d863a8d5193616ca044e80a9 (diff) |
optional flags must be sorted and enclosed in single brackets,
as style(9) suggests; usage() should be a function; minor KNF fix
ok otto@
Diffstat (limited to 'usr.bin/readlink')
-rw-r--r-- | usr.bin/readlink/readlink.c | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/usr.bin/readlink/readlink.c b/usr.bin/readlink/readlink.c index 54c9b463116..db2e6d87a24 100644 --- a/usr.bin/readlink/readlink.c +++ b/usr.bin/readlink/readlink.c @@ -1,5 +1,5 @@ /* - * $OpenBSD: readlink.c,v 1.23 2007/02/12 19:10:08 otto Exp $ + * $OpenBSD: readlink.c,v 1.24 2007/09/10 07:42:26 sobrado Exp $ * * Copyright (c) 1997 * Kenneth Stailey (hereinafter referred to as the author) @@ -34,6 +34,8 @@ #include <string.h> #include <unistd.h> +static void usage(void); + int main(int argc, char *argv[]) { @@ -50,23 +52,19 @@ main(int argc, char *argv[]) nflag = 1; break; default: - (void)fprintf(stderr, - "usage: readlink [-n] [-f] symlink\n"); - exit(1); + usage(); } argc -= optind; argv += optind; - if (argc != 1) { - fprintf(stderr, "usage: readlink [-n] [-f] symlink\n"); - exit(1); - } + if (argc != 1) + usage(); n = strlen(argv[0]); if (n > PATH_MAX - 1) { fprintf(stderr, - "readlink: filename longer than PATH_MAX-1 (%d)\n", - PATH_MAX - 1); + "readlink: filename longer than PATH_MAX-1 (%d)\n", + PATH_MAX - 1); exit(1); } @@ -84,3 +82,10 @@ main(int argc, char *argv[]) putchar('\n'); exit(0); } + +static void +usage(void) +{ + (void)fprintf(stderr, "usage: readlink [-fn] file\n"); + exit(1); +} |