diff options
| author | Jilles Tjoelker <jilles@FreeBSD.org> | 2012-09-15 21:56:30 +0000 |
|---|---|---|
| committer | Jilles Tjoelker <jilles@FreeBSD.org> | 2012-09-15 21:56:30 +0000 |
| commit | 7cbda73825918d63360a7d815ff59341d1800d1a (patch) | |
| tree | 8f1502baabb3376aec513c46c8781c9f452a7b3d /usr.bin/printf/printf.c | |
| parent | c99c0499e099a4c8225bba85447a145b2b08a9a2 (diff) | |
Notes
Diffstat (limited to 'usr.bin/printf/printf.c')
| -rw-r--r-- | usr.bin/printf/printf.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/usr.bin/printf/printf.c b/usr.bin/printf/printf.c index 89149dcda019..4b0934290bcc 100644 --- a/usr.bin/printf/printf.c +++ b/usr.bin/printf/printf.c @@ -64,6 +64,7 @@ static const char rcsid[] = #define main printfcmd #include "bltin/bltin.h" #include "error.h" +#include "options.h" #endif #define PF(f, func) do { \ @@ -101,15 +102,19 @@ int main(int argc, char *argv[]) { size_t len; - int ch, chopped, end, rval; + int chopped, end, rval; char *format, *fmt, *start; - #ifndef SHELL + int ch; + (void) setlocale(LC_ALL, ""); #endif + #ifdef SHELL - optreset = 1; optind = 1; opterr = 0; /* initialize getopt */ -#endif + nextopt(""); + argc -= argptr - argv; + argv = argptr; +#else while ((ch = getopt(argc, argv, "")) != -1) switch (ch) { case '?': @@ -119,6 +124,7 @@ main(int argc, char *argv[]) } argc -= optind; argv += optind; +#endif if (argc < 1) { usage(); |
