summaryrefslogtreecommitdiff
path: root/usr.bin/printf/printf.c
diff options
context:
space:
mode:
authorTodd C. Miller <millert@cvs.openbsd.org>2008-06-19 16:24:01 +0000
committerTodd C. Miller <millert@cvs.openbsd.org>2008-06-19 16:24:01 +0000
commit4fb2746cc04b6a1c03640d23b283155822e98a58 (patch)
treea5d08dd8c5e97a5f20abde00a385e18136a5ca90 /usr.bin/printf/printf.c
parent8426d14a717a78f6d3c5d9eaf14058c39c9500c3 (diff)
printf(1) does not take any options but still needs to ignore the "--"
(end of options) flag. OK deraadt@ espie@
Diffstat (limited to 'usr.bin/printf/printf.c')
-rw-r--r--usr.bin/printf/printf.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/usr.bin/printf/printf.c b/usr.bin/printf/printf.c
index 64c6dadc0dc..0084a4a5e5a 100644
--- a/usr.bin/printf/printf.c
+++ b/usr.bin/printf/printf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: printf.c,v 1.12 2004/05/31 15:48:26 pedro Exp $ */
+/* $OpenBSD: printf.c,v 1.13 2008/06/19 16:24:00 millert Exp $ */
/*
* Copyright (c) 1989 The Regents of the University of California.
@@ -39,7 +39,7 @@ char copyright[] =
#ifndef lint
/*static char sccsid[] = "from: @(#)printf.c 5.9 (Berkeley) 6/1/90";*/
-static char rcsid[] = "$OpenBSD: printf.c,v 1.12 2004/05/31 15:48:26 pedro Exp $";
+static char rcsid[] = "$OpenBSD: printf.c,v 1.13 2008/06/19 16:24:00 millert Exp $";
#endif /* not lint */
#include <ctype.h>
@@ -119,6 +119,12 @@ main(int argc, char *argv[])
setlocale (LC_ALL, "");
#endif
+ /* Need to accept/ignore "--" option. */
+ if (argc > 1 && strcmp(argv[1], "--") == 0) {
+ argc--;
+ argv++;
+ }
+
if (argc < 2) {
usage();
return (1);