Source-Changes-HG archive

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

[src/trunk]: src/lib/libc/string - correct how to check empty field.



details:   https://anonhg.NetBSD.org/src/rev/f1760d3a9161
branches:  trunk
changeset: 535148:f1760d3a9161
user:      yamt <yamt%NetBSD.org@localhost>
date:      Sun Aug 11 09:36:15 2002 +0000

description:
- correct how to check empty field.
- improve examples.
from OpenBSD.

diffstat:

 lib/libc/string/strsep.3 |  14 ++++++++------
 1 files changed, 8 insertions(+), 6 deletions(-)

diffs (40 lines):

diff -r f30ac7e917a8 -r f1760d3a9161 lib/libc/string/strsep.3
--- a/lib/libc/string/strsep.3  Sun Aug 11 08:22:30 2002 +0000
+++ b/lib/libc/string/strsep.3  Sun Aug 11 09:36:15 2002 +0000
@@ -33,9 +33,9 @@
 .\" SUCH DAMAGE.
 .\"
 .\"     from: @(#)strsep.3     8.1 (Berkeley) 6/9/93
-.\"    $NetBSD: strsep.3,v 1.10 2002/02/07 09:24:07 ross Exp $
+.\"    $NetBSD: strsep.3,v 1.11 2002/08/11 09:36:15 yamt Exp $
 .\"
-.Dd June 9, 1993
+.Dd August 11, 2002
 .Dt STRSEP 3
 .Os
 .Sh NAME
@@ -67,8 +67,8 @@
 .Pp
 An ``empty'' field, i.e. one caused by two adjacent delimiter characters,
 can be detected by comparing the location referenced by the pointer returned
-in
-.Fa *stringp
+by
+.Fn strsep
 to
 .Ql \e0 .
 .Pp
@@ -87,9 +87,11 @@
 .Bd -literal -offset indent
 char **ap, *argv[10], *inputstring;
 
-for (ap = argv; (*ap = strsep(\*[Am]inputstring, " \et")) != NULL;)
+for (ap = argv; ap < \*[Am]argv[9] \*[Am]\*[Am]
+    (*ap = strsep(\*[Am]inputstring, " \et")) != NULL;) {
        if (**ap != '\e0')
-               ++ap;
+               ap++;
+}
 .Ed
 .Sh HISTORY
 The



Home | Main Index | Thread Index | Old Index