Source-Changes-HG archive

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

[src/trunk]: src/lib/libutil Rework the example a little.



details:   https://anonhg.NetBSD.org/src/rev/1fb6ad08e1f1
branches:  trunk
changeset: 754567:1fb6ad08e1f1
user:      jruoho <jruoho%NetBSD.org@localhost>
date:      Tue May 04 07:58:28 2010 +0000

description:
Rework the example a little.

diffstat:

 lib/libutil/getmntopts.3 |  19 +++++++++++++------
 1 files changed, 13 insertions(+), 6 deletions(-)

diffs (51 lines):

diff -r 20ecdcec043f -r 1fb6ad08e1f1 lib/libutil/getmntopts.3
--- a/lib/libutil/getmntopts.3  Tue May 04 07:43:12 2010 +0000
+++ b/lib/libutil/getmntopts.3  Tue May 04 07:58:28 2010 +0000
@@ -1,4 +1,4 @@
-.\"    $NetBSD: getmntopts.3,v 1.10 2009/07/14 18:56:14 joerg Exp $
+.\"    $NetBSD: getmntopts.3,v 1.11 2010/05/04 07:58:28 jruoho Exp $
 .\"
 .\" Copyright (c) 1994
 .\"    The Regents of the University of California.  All rights reserved.
@@ -29,7 +29,7 @@
 .\"
 .\"    @(#)getmntopts.3        8.3 (Berkeley) 3/30/95
 .\"
-.Dd August 26, 2007
+.Dd May 4, 2010
 .Dt GETMNTOPTS 3
 .Os
 .Sh NAME
@@ -183,7 +183,7 @@
 .Dv MOPT_UPDATE
 entry.
 This can be declared and used as follows:
-.Bd -literal
+.Bd -literal -offset indent
 #include \*[Lt]mntopts.h\*[Gt]
 
 static const struct mntopt mopts[] = {
@@ -193,13 +193,20 @@
 };
 
 \&...
+
 long val;
+mntoptparse_t mp;
 mntflags = mntaltflags = 0;
-mntoptparse_t mp;
+
 \&...
-if ((mp = getmntopts(options, mopts, \*[Am]mntflags, \*[Am]mntaltflags)) == NULL)
-       err(1, NULL);
+
+mp = getmntopts(options, mopts, \*[Am]mntflags, \*[Am]mntaltflags);
+
+if (mp == NULL)
+       err(EXIT_FAILURE, "getmntopts");
+
 \&...
+
 val = getmntoptnum(mp, "rsize");
 freemntopts(mp);
 .Ed



Home | Main Index | Thread Index | Old Index