From 63188cdda6e8ad542edb509aaa96883eccaa3e56 Mon Sep 17 00:00:00 2001 From: Joerg Sonnenberger Date: Thu, 30 Sep 2004 10:08:46 +0000 Subject: [PATCH] Fix the setup for initial processing. Always use argv[0] and correctly decrement argc for the argc!=1 case first. Reported-by: Andreas Hauser --- usr.bin/soelim/soelim.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/usr.bin/soelim/soelim.c b/usr.bin/soelim/soelim.c index 5733040a34..e90c7ed4ed 100644 --- a/usr.bin/soelim/soelim.c +++ b/usr.bin/soelim/soelim.c @@ -33,7 +33,7 @@ * @(#) Copyright (c) 1980, 1993 The Regents of the University of California. All rights reserved. * @(#)soelim.c 8.1 (Berkeley) 6/6/93 * $FreeBSD: src/usr.bin/soelim/soelim.c,v 1.3.2.2 2001/07/30 10:16:46 dd Exp $ - * $DragonFly: src/usr.bin/soelim/soelim.c,v 1.4 2004/09/26 15:56:13 joerg Exp $ + * $DragonFly: src/usr.bin/soelim/soelim.c,v 1.5 2004/09/30 10:08:46 joerg Exp $ */ #include @@ -66,14 +66,17 @@ main(int argc, const char **argv) { int errs = 0; - if (argc == 1) - argv[1] = STDIN_NAME; - - while (argc > 0) { - errs += process(argv[1]); + if (argc == 1) { + argv[0] = STDIN_NAME; + } else { argv++; argc--; } + + while (--argc >= 0) { + errs += process(argv[0]); + argv++; + } exit(errs != 0); } -- 2.41.0