Source-Changes-HG archive

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

[src/trunk]: src/sbin/disklabel Make it possible to distinguish between exit ...



details:   https://anonhg.NetBSD.org/src/rev/b624aa75959a
branches:  trunk
changeset: 567028:b624aa75959a
user:      erh <erh%NetBSD.org@localhost>
date:      Fri May 28 17:46:49 2004 +0000

description:
Make it possible to distinguish between exit values that indicate errors,
and those that are warnings.  Document the exit statuses in the man page.

diffstat:

 sbin/disklabel/disklabel.8 |  20 +++++++++++++++++++-
 sbin/disklabel/disklabel.c |   8 ++++++--
 2 files changed, 25 insertions(+), 3 deletions(-)

diffs (70 lines):

diff -r 8f6efaff2a31 -r b624aa75959a sbin/disklabel/disklabel.8
--- a/sbin/disklabel/disklabel.8        Fri May 28 15:35:41 2004 +0000
+++ b/sbin/disklabel/disklabel.8        Fri May 28 17:46:49 2004 +0000
@@ -1,4 +1,4 @@
-.\"    $NetBSD: disklabel.8,v 1.52 2004/03/20 18:51:06 wiz Exp $
+.\"    $NetBSD: disklabel.8,v 1.53 2004/05/28 17:46:49 erh Exp $
 .\"
 .\" Copyright (c) 1987, 1988, 1991, 1993
 .\"    The Regents of the University of California.  All rights reserved.
@@ -394,6 +394,24 @@
 if you create the
 prototype file by dumping some other disk's label to a file and editing
 it appropriately (total size, partition offsets, types, etc.)
+.Sh EXIT STATUS
+The exit status of
+.Nm
+is set to indicate any errors or warnings.  The values used are:
+.Bl -tag -width indent
+.It 0
+The
+.Nm
+utility has completed successfully.
+.It 1
+A fatal error has occured, such as unknown options passed on the command line,
+or writing the dislabel failed.
+.It 4
+An I/O error of some sort occurred.
+.It 101..n
+One or more warnings occured while reading the disklabel.  Subtract 100 to
+get the number of warnings detected.
+.El
 .Sh DIAGNOSTICS
 The kernel device drivers will not allow the size of a disk partition
 to be decreased or the offset of a partition to be changed while it is open.
diff -r 8f6efaff2a31 -r b624aa75959a sbin/disklabel/disklabel.c
--- a/sbin/disklabel/disklabel.c        Fri May 28 15:35:41 2004 +0000
+++ b/sbin/disklabel/disklabel.c        Fri May 28 17:46:49 2004 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: disklabel.c,v 1.130 2004/03/19 18:22:31 dyoung Exp $   */
+/*     $NetBSD: disklabel.c,v 1.131 2004/05/28 17:46:49 erh Exp $      */
 
 /*
  * Copyright (c) 1987, 1993
@@ -43,7 +43,7 @@
 static char sccsid[] = "@(#)disklabel.c        8.4 (Berkeley) 5/4/95";
 /* from static char sccsid[] = "@(#)disklabel.c        1.2 (Symmetric) 11/28/85"; */
 #else
-__RCSID("$NetBSD: disklabel.c,v 1.130 2004/03/19 18:22:31 dyoung Exp $");
+__RCSID("$NetBSD: disklabel.c,v 1.131 2004/05/28 17:46:49 erh Exp $");
 #endif
 #endif /* not lint */
 
@@ -343,6 +343,8 @@
                        showpartitions(stdout, lp, Cflag);
                }
                error = checklabel(lp);
+               if (error)
+                       error += 100;
                break;
 
        case RESTORE:
@@ -357,6 +359,8 @@
                        err(4, "%s", argv[1]);
                if (getasciilabel(t, lp))
                        error = writelabel(f, bootarea, lp);
+               else
+                       error = 1;
                break;
 
        case SETWRITABLE:



Home | Main Index | Thread Index | Old Index