Source-Changes-HG archive

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

[src/trunk]: src - Migrate fparseln(3) from libutil to libc, where it should ...



details:   https://anonhg.NetBSD.org/src/rev/621395dcfe9c
branches:  trunk
changeset: 539967:621395dcfe9c
user:      lukem <lukem%NetBSD.org@localhost>
date:      Sat Nov 30 03:04:44 2002 +0000

description:
- Migrate fparseln(3) from libutil to libc, where it should have been in
  the first place...
- Bump libutil major (to 7.0) and libc minor (to 12.91).

diffstat:

 distrib/sets/lists/base/shl.elf |    6 +-
 distrib/sets/lists/base/shl.mi  |   10 +-
 include/stdio.h                 |   10 +-
 include/util.h                  |    9 +-
 lib/libc/include/namespace.h    |    3 +-
 lib/libc/shlib_version          |    4 +-
 lib/libc/stdio/Makefile.inc     |    6 +-
 lib/libc/stdio/fparseln.3       |  153 ++++++++++++++++++++++++++
 lib/libc/stdio/fparseln.c       |  229 ++++++++++++++++++++++++++++++++++++++++
 lib/libutil/Makefile            |    6 +-
 lib/libutil/fparseln.3          |  153 --------------------------
 lib/libutil/fparseln.c          |  228 ---------------------------------------
 lib/libutil/shlib_version       |    6 +-
 lib/libutil/util.3              |    3 +-
 tools/compat/Makefile           |    3 +-
 tools/compat/configure          |  200 +++++++++-------------------------
 tools/compat/configure.ac       |    5 +-
 17 files changed, 469 insertions(+), 565 deletions(-)

diffs (truncated from 1538 to 300 lines):

diff -r 6f19716557cd -r 621395dcfe9c distrib/sets/lists/base/shl.elf
--- a/distrib/sets/lists/base/shl.elf   Sat Nov 30 02:09:44 2002 +0000
+++ b/distrib/sets/lists/base/shl.elf   Sat Nov 30 03:04:44 2002 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: shl.elf,v 1.61 2002/10/07 22:46:24 lukem Exp $
+# $NetBSD: shl.elf,v 1.62 2002/11/30 03:04:44 lukem Exp $
 # Note: libtermcap and libtermlib are hardlinked and share the same version.
 ./lib/libc.so.12               base-sys-shlib
 ./lib/libcrypt.so.0            base-sys-shlib
@@ -10,7 +10,7 @@
 ./lib/libm.so.0                        base-sys-shlib
 ./lib/libtermcap.so.0          base-sys-shlib
 ./lib/libtermlib.so.0          base-sys-shlib
-./lib/libutil.so.6             base-sys-shlib
+./lib/libutil.so.7             base-sys-shlib
 ./lib/libz.so.0                        base-sys-shlib
 ./libexec/ld.elf_so            base-sys-shlib
 ./usr/lib/i18n/libBIG5.so.4    base-i18n-shlib
@@ -61,7 +61,7 @@
 ./usr/lib/libtermcap.so.0      base-sys-shlib
 ./usr/lib/libtermlib.so.0      base-sys-shlib
 ./usr/lib/libusbhid.so.1       base-sys-shlib
-./usr/lib/libutil.so.6         base-sys-shlib
+./usr/lib/libutil.so.7         base-sys-shlib
 ./usr/lib/libwrap.so.0         base-net-shlib
 ./usr/lib/libz.so.0            base-sys-shlib
 ./usr/libexec/ld.elf_so                base-sys-shlib
diff -r 6f19716557cd -r 621395dcfe9c distrib/sets/lists/base/shl.mi
--- a/distrib/sets/lists/base/shl.mi    Sat Nov 30 02:09:44 2002 +0000
+++ b/distrib/sets/lists/base/shl.mi    Sat Nov 30 03:04:44 2002 +0000
@@ -1,6 +1,6 @@
-# $NetBSD: shl.mi,v 1.185 2002/11/29 13:16:27 lukem Exp $
+# $NetBSD: shl.mi,v 1.186 2002/11/30 03:04:44 lukem Exp $
 # Note: libtermcap and libtermlib are hardlinked and share the same version.
-./lib/libc.so.12.90                    base-sys-shlib
+./lib/libc.so.12.91                    base-sys-shlib
 ./lib/libcrypt.so.0.1                  base-sys-shlib
 ./lib/libcrypto.so.1.1                 base-crypto-shlib
 ./lib/libdes.so.6.0                    base-crypto-shlib
@@ -10,7 +10,7 @@
 ./lib/libm.so.0.1                      base-sys-shlib
 ./lib/libtermcap.so.0.5                        base-sys-shlib
 ./lib/libtermlib.so.0.5                        base-sys-shlib
-./lib/libutil.so.6.4                   base-sys-shlib
+./lib/libutil.so.7.0                   base-sys-shlib
 ./lib/libz.so.0.3                      base-sys-shlib
 ./usr/lib/i18n/libBIG5.so.4.0          base-i18n-shlib
 ./usr/lib/i18n/libEUC.so.4.0           base-i18n-shlib
@@ -21,7 +21,7 @@
 ./usr/lib/libamu.so.2.1                        base-amd-shlib
 ./usr/lib/libasn1.so.6.1               base-krb5-shlib
 ./usr/lib/libbz2.so.1.0                        base-sys-shlib
-./usr/lib/libc.so.12.90                        base-sys-shlib
+./usr/lib/libc.so.12.91                        base-sys-shlib
 ./usr/lib/libcdk.so.1.0                        base-sys-shlib
 ./usr/lib/libcom_err.so.4.1            base-krb5-shlib
 ./usr/lib/libcrypt.so.0.1              base-sys-shlib
@@ -60,6 +60,6 @@
 ./usr/lib/libtermcap.so.0.5            base-sys-shlib
 ./usr/lib/libtermlib.so.0.5            base-sys-shlib
 ./usr/lib/libusbhid.so.1.0             base-sys-shlib
-./usr/lib/libutil.so.6.4               base-sys-shlib
+./usr/lib/libutil.so.7.0               base-sys-shlib
 ./usr/lib/libwrap.so.0.2               base-net-shlib
 ./usr/lib/libz.so.0.3                  base-sys-shlib
diff -r 6f19716557cd -r 621395dcfe9c include/stdio.h
--- a/include/stdio.h   Sat Nov 30 02:09:44 2002 +0000
+++ b/include/stdio.h   Sat Nov 30 03:04:44 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: stdio.h,v 1.45 2002/05/24 22:17:20 thorpej Exp $       */
+/*     $NetBSD: stdio.h,v 1.46 2002/11/30 03:04:44 lukem Exp $ */
 
 /*-
  * Copyright (c) 1990, 1993
@@ -359,10 +359,18 @@
  */
 #if !defined(_ANSI_SOURCE) && !defined(_POSIX_C_SOURCE) && \
     !defined(_XOPEN_SOURCE)
+
+#define        FPARSELN_UNESCESC       0x01
+#define        FPARSELN_UNESCCONT      0x02
+#define        FPARSELN_UNESCCOMM      0x04
+#define        FPARSELN_UNESCREST      0x08
+#define        FPARSELN_UNESCALL       0x0f
+
 __BEGIN_DECLS
 int     asprintf __P((char ** __restrict, const char * __restrict, ...))
            __attribute__((__format__(__printf__, 2, 3)));
 char   *fgetln __P((FILE * __restrict, size_t * __restrict));
+char   *fparseln(FILE *, size_t *, size_t *, const char[3], int);
 int     fpurge __P((FILE *));
 void    setbuffer __P((FILE *, char *, int));
 int     setlinebuf __P((FILE *));
diff -r 6f19716557cd -r 621395dcfe9c include/util.h
--- a/include/util.h    Sat Nov 30 02:09:44 2002 +0000
+++ b/include/util.h    Sat Nov 30 03:04:44 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: util.h,v 1.27 2002/10/12 20:46:57 elric Exp $  */
+/*     $NetBSD: util.h,v 1.28 2002/11/30 03:04:45 lukem Exp $  */
 
 /*-
  * Copyright (c) 1995
@@ -48,12 +48,6 @@
 #define        PIDLOCK_NONBLOCK        1
 #define        PIDLOCK_USEHOSTNAME     2
 
-#define        FPARSELN_UNESCESC       0x01
-#define        FPARSELN_UNESCCONT      0x02
-#define        FPARSELN_UNESCCOMM      0x04
-#define        FPARSELN_UNESCREST      0x08
-#define        FPARSELN_UNESCALL       0x0f
-
 #define        HN_DECIMAL              0x01
 #define        HN_NOSPACE              0x02
 #define        HN_B                    0x04
@@ -71,7 +65,6 @@
 struct winsize;
 
 pid_t          forkpty(int *, char *, struct termios *, struct winsize *);
-char          *fparseln(FILE *, size_t *, size_t *, const char[3], int);
 const char     *getbootfile(void);
 int            getmaxpartitions(void);
 int            getrawpartition(void);
diff -r 6f19716557cd -r 621395dcfe9c lib/libc/include/namespace.h
--- a/lib/libc/include/namespace.h      Sat Nov 30 02:09:44 2002 +0000
+++ b/lib/libc/include/namespace.h      Sat Nov 30 03:04:44 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: namespace.h,v 1.73 2002/11/29 12:58:16 lukem Exp $     */
+/*     $NetBSD: namespace.h,v 1.74 2002/11/30 03:04:45 lukem Exp $     */
 
 /*-
  * Copyright (c) 1997-2002 The NetBSD Foundation, Inc.
@@ -193,6 +193,7 @@
 #define fdopen                 _fdopen
 #define fgetln                 _fgetln
 #define fnmatch                        _fnmatch
+#define fparseln               _fparseln
 #define fpgetmask              _fpgetmask
 #define fpgetround             _fpgetround
 #define fpgetsticky            _fpgetsticky
diff -r 6f19716557cd -r 621395dcfe9c lib/libc/shlib_version
--- a/lib/libc/shlib_version    Sat Nov 30 02:09:44 2002 +0000
+++ b/lib/libc/shlib_version    Sat Nov 30 03:04:44 2002 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: shlib_version,v 1.123 2002/11/29 12:58:16 lukem Exp $
+#      $NetBSD: shlib_version,v 1.124 2002/11/30 03:04:45 lukem Exp $
 #      Remember to update distrib/sets/lists/base/shl.* when changing
 #
 # things we wish to do on next major version bump:
@@ -11,4 +11,4 @@
 # - libc/net/getaddrinfo.c, netdb.h: remove __ai_pad0
 #
 major=12
-minor=90
+minor=91
diff -r 6f19716557cd -r 621395dcfe9c lib/libc/stdio/Makefile.inc
--- a/lib/libc/stdio/Makefile.inc       Sat Nov 30 02:09:44 2002 +0000
+++ b/lib/libc/stdio/Makefile.inc       Sat Nov 30 03:04:44 2002 +0000
@@ -1,5 +1,5 @@
 #      from: @(#)Makefile.inc  5.7 (Berkeley) 6/27/91
-#      $NetBSD: Makefile.inc,v 1.21 2001/12/07 11:47:41 yamt Exp $
+#      $NetBSD: Makefile.inc,v 1.22 2002/11/30 03:04:45 lukem Exp $
 
 # stdio sources
 .PATH: ${.CURDIR}/stdio
@@ -17,7 +17,7 @@
        ungetc.c vasprintf.c vfprintf.c vfscanf.c vprintf.c vscanf.c \
        vsnprintf.c vsscanf.c wbuf.c wsetup.c fputwc.c \
        fgetwc.c ungetwc.c putwc.c putwchar.c getwc.c getwchar.c \
-       fwide.c
+       fwide.c fparseln.c
 
 .if !defined(AUDIT)
 SRCS+= gets.c sprintf.c vsprintf.c tempnam.c tmpnam.c mktemp.c
@@ -29,7 +29,7 @@
 MAN+=  fclose.3 ferror.3 fflush.3 fgetln.3 fgets.3 fopen.3 fputs.3 \
        fread.3 fseek.3 funopen.3 getc.3 mktemp.3 perror.3 printf.3 putc.3 \
        remove.3 scanf.3 setbuf.3 stdio.3 tmpnam.3 ungetc.3 putwc.3 getwc.3 \
-       ungetwc.3 fwide.3
+       ungetwc.3 fwide.3 fparseln.3
 
 MLINKS+=ferror.3 clearerr.3 ferror.3 feof.3 ferror.3 fileno.3
 MLINKS+=fflush.3 fpurge.3
diff -r 6f19716557cd -r 621395dcfe9c lib/libc/stdio/fparseln.3
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/lib/libc/stdio/fparseln.3 Sat Nov 30 03:04:44 2002 +0000
@@ -0,0 +1,153 @@
+.\"    $NetBSD: fparseln.3,v 1.1 2002/11/30 03:04:45 lukem Exp $
+.\"
+.\" Copyright (c) 1997 Christos Zoulas.  All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\"    notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\"    notice, this list of conditions and the following disclaimer in the
+.\"    documentation and/or other materials provided with the distribution.
+.\" 3. All advertising materials mentioning features or use of this software
+.\"    must display the following acknowledgement:
+.\"    This product includes software developed by Christos Zoulas.
+.\" 4. The name of the author may not be used to endorse or promote products
+.\"    derived from this software without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.Dd November 30, 2002
+.Dt FPARSELN 3
+.Os
+.Sh NAME
+.Nm fparseln
+.Nd return the next logical line from a stream
+.Sh LIBRARY
+.Lb libc
+.Sh SYNOPSIS
+.Fd #include \*[Lt]stdio.h\*[Gt]
+.Ft "char *"
+.Fo "fparseln"
+.Fa "FILE *stream" "size_t *len" "size_t *lineno"
+.Fa "const char delim[3]" "int flags"
+.Fc
+.Sh DESCRIPTION
+The
+.Fn fparseln
+function
+returns a pointer to the next logical line from the stream referenced by
+.Fa stream .
+This string is
+.Dv NUL
+terminated and it is dynamically allocated on each invocation.
+It is the responsibility of the caller to free the pointer.
+.Pp
+By default, if a character is escaped, both it and the preceding escape
+character will be present in the returned string.
+Various
+.Fa flags
+alter this behaviour.
+.Pp
+The meaning of the arguments is as follows:
+.Bl -tag -width "lineno"
+.It Fa stream
+The stream to read from.
+.It Fa len
+If not
+.Dv NULL ,
+the length of the string is stored in the memory location to which it
+points.
+.It Fa lineno
+If not
+.Dv NULL ,
+the value of the memory location to which is pointed to, is incremented
+by the number of lines actually read from the file.
+.It Fa delim
+Contains the escape, continuation, and comment characters.
+If a character is
+.Dv NUL
+then processing for that character is disabled.
+If
+.Dv NULL ,
+all characters default to values specified below.
+The contents of
+.Fa delim
+is as follows:
+.Bl -tag -width "delim[0]"
+.It Fa delim[0]
+The escape character, which defaults to
+.Cm \e ,
+is used to remove any special meaning from the next character.
+.It Fa delim[1]
+The continuation character, which defaults to
+.Cm \e ,
+is used to indicate that the next line should be concatenated with the
+current one if this character is the last character on the current line
+and is not escaped.
+.It Fa delim[2]
+The comment character, which defaults to
+.Cm # ,
+if not escaped indicates the beginning of a comment that extends until the
+end of the current line.
+.El
+.It Fa flags
+If non-zero, alter the operation of
+.Fn fparseln .
+The various flags, which may be
+.Em or Ns -ed
+together, are:
+.Bl -tag -width "FPARSELN_UNESCCOMM"
+.It Dv FPARSELN_UNESCCOMM
+Remove escape preceding an escaped comment.
+.It Dv FPARSELN_UNESCCONT



Home | Main Index | Thread Index | Old Index