From 4fb2746cc04b6a1c03640d23b283155822e98a58 Mon Sep 17 00:00:00 2001 From: "Todd C. Miller" Date: Thu, 19 Jun 2008 16:24:01 +0000 Subject: printf(1) does not take any options but still needs to ignore the "--" (end of options) flag. OK deraadt@ espie@ --- usr.bin/printf/printf.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'usr.bin/printf/printf.c') 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 @@ -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); -- cgit v1.2.3