diff options
Diffstat (limited to 'usr.bin')
-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 89149dcda..4b09342 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(); |