Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.sbin/dumpfs fix two bugs with argument parsing:



details:   https://anonhg.NetBSD.org/src/rev/76291a44b1f6
branches:  trunk
changeset: 556810:76291a44b1f6
user:      dbj <dbj%NetBSD.org@localhost>
date:      Sun Dec 28 06:06:55 2003 +0000

description:
fix two bugs with argument parsing:
  missing break statement caused -F to give usage
  -v argument caused default options to be dropped

diffstat:

 usr.sbin/dumpfs/dumpfs.c |  9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)

diffs (44 lines):

diff -r 881630068181 -r 76291a44b1f6 usr.sbin/dumpfs/dumpfs.c
--- a/usr.sbin/dumpfs/dumpfs.c  Sun Dec 28 06:04:23 2003 +0000
+++ b/usr.sbin/dumpfs/dumpfs.c  Sun Dec 28 06:06:55 2003 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: dumpfs.c,v 1.39 2003/09/26 07:02:43 dsl Exp $  */
+/*     $NetBSD: dumpfs.c,v 1.40 2003/12/28 06:06:55 dbj Exp $  */
 
 /*
  * Copyright (c) 1983, 1992, 1993
@@ -39,7 +39,7 @@
 #if 0
 static char sccsid[] = "@(#)dumpfs.c   8.5 (Berkeley) 4/29/95";
 #else
-__RCSID("$NetBSD: dumpfs.c,v 1.39 2003/09/26 07:02:43 dsl Exp $");
+__RCSID("$NetBSD: dumpfs.c,v 1.40 2003/12/28 06:06:55 dbj Exp $");
 #endif
 #endif /* not lint */
 
@@ -81,6 +81,8 @@
 #define opt_cg_info    OPT_FLAG('c')
 #define opt_inodes     OPT_FLAG('i')
 #define opt_verbose    OPT_FLAG('v')
+#define DFLT_CHECK (opt_alt_super | opt_cg_info | opt_inodes | \
+       opt_cg_summary | opt_superblock)
 #define DFLT_OPTS      (opt_superblock | opt_cg_summary | opt_cg_info)
 
 long   dev_bsize = 512;
@@ -122,6 +124,7 @@
                        break;
                case 'F':       /* File (not device) */
                        Fflag = 1;
+                       break;
                case '?':
                default:
                        usage();
@@ -129,7 +132,7 @@
        argc -= optind;
        argv += optind;
 
-       if (opt_flags == 0)
+       if ((opt_flags & DFLT_CHECK) == 0)
                opt_flags = DFLT_OPTS;
 
        if (argc < 1)



Home | Main Index | Thread Index | Old Index