diff options
author | Jim Meyering <jim@meyering.net> | 1993-10-12 01:52:24 +0000 |
---|---|---|
committer | Jim Meyering <jim@meyering.net> | 1993-10-12 01:52:24 +0000 |
commit | 87fa23e6417d7d1938b72e872d779ae7225a5aa4 (patch) | |
tree | 0fcc68f9cdf7315d09d5836df0f261e3d6b8c13a /src/printf.c | |
parent | f12b53b2ce8f0bb0dd28a290f9b27490ef4599a9 (diff) | |
download | coreutils-87fa23e6417d7d1938b72e872d779ae7225a5aa4.tar.xz |
merge with 1.8.1b
Diffstat (limited to 'src/printf.c')
-rw-r--r-- | src/printf.c | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/src/printf.c b/src/printf.c index 0c0da37fe..e1bd4d3ab 100644 --- a/src/printf.c +++ b/src/printf.c @@ -46,7 +46,10 @@ #include <stdio.h> #include <ctype.h> #include <sys/types.h> +#include <getopt.h> + #include "system.h" +#include "version.h" #if !defined (isascii) || defined (STDC_HEADERS) #undef isascii @@ -68,6 +71,7 @@ unsigned long strtoul (); char *xmalloc (); void error (); +void parse_long_options (); static double xstrtod (); static int print_esc (); @@ -79,11 +83,19 @@ static void print_esc_char (); static void print_esc_string (); static void verify (); +/* The value to return to the calling program. */ +static int exit_status; + /* The name this program was run with. */ char *program_name; -/* The value to return to the calling program. */ -static int exit_status; +static void +usage () +{ + fprintf (stderr, "Usage: %s [{--help,--version}] format [argument...]\n", + program_name); + exit (1); +} void main (argc, argv) @@ -96,6 +108,8 @@ main (argc, argv) program_name = argv[0]; exit_status = 0; + parse_long_options (argc, argv, usage); + if (argc == 1) { fprintf (stderr, "Usage: %s format [argument...]\n", program_name); |