shishi-commit
[Top][All Lists]
Advanced

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

CVS shishi/gl


From: shishi-commit
Subject: CVS shishi/gl
Date: Fri, 12 Nov 2004 01:24:13 +0100

Update of /home/cvs/shishi/gl
In directory dopio:/tmp/cvs-serv3624/gl

Modified Files:
        getopt.c getopt1.c getopt_.h getopt_int.h strtok_r.c 
Log Message:
Update.

--- /home/cvs/shishi/gl/getopt.c        2004/08/01 14:31:05     1.5
+++ /home/cvs/shishi/gl/getopt.c        2004/11/12 00:24:13     1.6
@@ -250,8 +250,8 @@
 /* Initialize the internal data when the first call is made.  */
 
 static const char *
-_getopt_initialize (int argc, char *const *argv, const char *optstring,
-                   struct _getopt_data *d)
+_getopt_initialize (int argc, char *__getopt_argv_const *argv,
+                   const char *optstring, struct _getopt_data *d)
 {
   /* Start processing options with ARGV-element 1 (since ARGV-element 0
      is the program name); the sequence of previously skipped
@@ -356,8 +356,9 @@
    if the `flag' field is zero.
 
    The elements of ARGV aren't really const, because we permute them.
-   But we pretend they're const in the prototype to be compatible
-   with other systems.
+   If __getopt_argv_const is defined to const, pretend they're
+   const in the prototype to be compatible with Posix.
+   But tell the truth if __getopt_argv_const is defined to empty.
 
    LONGOPTS is a vector of `struct option' terminated by an
    element containing a name which is zero.
@@ -370,7 +371,8 @@
    long-named options.  */
 
 int
-_getopt_internal_r (int argc, char *const *argv, const char *optstring,
+_getopt_internal_r (int argc, char *__getopt_argv_const *argv,
+                   const char *optstring,
                    const struct option *longopts, int *longind,
                    int long_only, struct _getopt_data *d)
 {
@@ -1135,7 +1137,8 @@
 }
 
 int
-_getopt_internal (int argc, char *const *argv, const char *optstring,
+_getopt_internal (int argc, char *__getopt_argv_const *argv,
+                 const char *optstring,
                  const struct option *longopts, int *longind, int long_only)
 {
   int result;
@@ -1154,7 +1157,7 @@
 }
 
 int
-getopt (int argc, char *const *argv, const char *optstring)
+getopt (int argc, char *__getopt_argv_const *argv, const char *optstring)
 {
   return _getopt_internal (argc, argv, optstring,
                           (const struct option *) 0,
--- /home/cvs/shishi/gl/getopt1.c       2004/08/01 14:31:05     1.5
+++ /home/cvs/shishi/gl/getopt1.c       2004/11/12 00:24:13     1.6
@@ -41,14 +41,14 @@
 #endif
 
 int
-getopt_long (int argc, char *const *argv, const char *options,
+getopt_long (int argc, char *__getopt_argv_const *argv, const char *options,
             const struct option *long_options, int *opt_index)
 {
   return _getopt_internal (argc, argv, options, long_options, opt_index, 0);
 }
 
 int
-_getopt_long_r (int argc, char *const *argv, const char *options,
+_getopt_long_r (int argc, char *__getopt_argv_const *argv, const char *options,
                const struct option *long_options, int *opt_index,
                struct _getopt_data *d)
 {
@@ -62,14 +62,16 @@
    instead.  */
 
 int
-getopt_long_only (int argc, char *const *argv, const char *options,
+getopt_long_only (int argc, char *__getopt_argv_const *argv,
+                 const char *options,
                  const struct option *long_options, int *opt_index)
 {
   return _getopt_internal (argc, argv, options, long_options, opt_index, 1);
 }
 
 int
-_getopt_long_only_r (int argc, char *const *argv, const char *options,
+_getopt_long_only_r (int argc, char *__getopt_argv_const *argv,
+                    const char *options,
                     const struct option *long_options, int *opt_index,
                     struct _getopt_data *d)
 {
--- /home/cvs/shishi/gl/getopt_.h       2004/11/11 21:05:56     1.2
+++ /home/cvs/shishi/gl/getopt_.h       2004/11/12 00:24:13     1.3
@@ -25,13 +25,15 @@
 
 /* Standalone applications should #define __GETOPT_PREFIX to an
    identifier that prefixes the external functions and variables
-   defined in this header.  When this happens, include <unistd.h> (the
-   standard header declaring getopt), so that it will not cause
-   confusion if it is included later.  Then systematically rename
+   defined in this header.  When this happens, include the
+   headers that might declare getopt so that they will not cause
+   confusion if included after this file.  Then systematically rename
    identifiers so that they do not collide with the system functions
    and variables.  Renaming avoids problems with some compilers and
    linkers.  */
 #if defined __GETOPT_PREFIX && !defined __need_getopt
+# include <stdlib.h>
+# include <stdio.h>
 # if HAVE_UNISTD_H
 #  include <unistd.h>
 # endif
@@ -51,6 +53,18 @@
 # define optopt __GETOPT_PREFIX##optopt
 #endif
 
+/* The elements of the ARGV arguments to getopt aren't really const,
+   because we permute them.  For glibc, __getopt_argv_const is const
+   so that prototypes pretend the elements are const, to be compatible
+   with Posix.  However, drop this pretense for standalone
+   applications, since it's not needed there and it's safer not to lie
+   to compilers.  */
+#ifdef __GETOPT_PREFIX
+# define __getopt_argv_const /* empty */
+#else
+# define __getopt_argv_const const
+#endif
+
 /* If __GNU_LIBRARY__ is not already defined, either we are being used
    standalone, or this is the first header included in the source file.
    If we are being used with glibc, we need to include <features.h>, but
@@ -172,15 +186,16 @@
    arguments to the option '\0'.  This behavior is specific to the GNU
    `getopt'.  */
 
-extern int getopt (int ___argc, char *const *___argv, const char *__shortopts)
+extern int getopt (int ___argc, char *__getopt_argv_const *___argv,
+                  const char *__shortopts)
        __THROW;
 
 #ifndef __need_getopt
-extern int getopt_long (int ___argc, char *const *___argv,
+extern int getopt_long (int ___argc, char *__getopt_argv_const *___argv,
                        const char *__shortopts,
                        const struct option *__longopts, int *__longind)
        __THROW;
-extern int getopt_long_only (int ___argc, char *const *___argv,
+extern int getopt_long_only (int ___argc, char *__getopt_argv_const *___argv,
                             const char *__shortopts,
                             const struct option *__longopts, int *__longind)
        __THROW;
--- /home/cvs/shishi/gl/getopt_int.h    2004/04/18 12:10:19     1.1
+++ /home/cvs/shishi/gl/getopt_int.h    2004/11/12 00:24:13     1.2
@@ -20,7 +20,7 @@
 #ifndef _GETOPT_INT_H
 #define _GETOPT_INT_H  1
 
-extern int _getopt_internal (int ___argc, char *const *___argv,
+extern int _getopt_internal (int ___argc, char *__getopt_argv_const *___argv,
                             const char *__shortopts,
                             const struct option *__longopts, int *__longind,
                             int __long_only);
@@ -110,17 +110,18 @@
    default values and to clear the initialization flag.  */
 #define _GETOPT_DATA_INITIALIZER       { 1, 1 }
 
-extern int _getopt_internal_r (int ___argc, char *const *___argv,
+extern int _getopt_internal_r (int ___argc, char *__getopt_argv_const *___argv,
                               const char *__shortopts,
                               const struct option *__longopts, int *__longind,
                               int __long_only, struct _getopt_data *__data);
 
-extern int _getopt_long_r (int ___argc, char *const *___argv,
+extern int _getopt_long_r (int ___argc, char *__getopt_argv_const *___argv,
                           const char *__shortopts,
                           const struct option *__longopts, int *__longind,
                           struct _getopt_data *__data);
 
-extern int _getopt_long_only_r (int ___argc, char *const *___argv,
+extern int _getopt_long_only_r (int ___argc,
+                               char *__getopt_argv_const *___argv,
                                const char *__shortopts,
                                const struct option *__longopts,
                                int *__longind,
--- /home/cvs/shishi/gl/strtok_r.c      2004/11/11 19:13:40     1.2
+++ /home/cvs/shishi/gl/strtok_r.c      2004/11/12 00:24:13     1.3
@@ -2,20 +2,19 @@
    Copyright (C) 1991,1996-1999,2001,2004 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2, or (at your option)
+   any later version.
 
-   The GNU C Library is distributed in the hope that it will be useful,
+   This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
 
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
+   You should have received a copy of the GNU General Public License along
+   with this program; if not, write to the Free Software Foundation,
+   Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
 
 #ifdef HAVE_CONFIG_H
 # include <config.h>
@@ -42,6 +41,17 @@
        x = strtok_r(NULL, "-=", &sp);  // x = "def", sp = NULL
        x = strtok_r(NULL, "=", &sp);   // x = NULL
                // s = "abc\0-def\0"
+
+   For the POSIX documentation for this function, see:
+   http://www.opengroup.org/onlinepubs/009695399/functions/strtok.html
+
+   Caveat: It modifies the original string.
+   Caveat: These functions cannot be used on constant strings.
+   Caveat: The identity of the delimiting character is lost.
+   Caveat: It doesn't work with multibyte strings unless all of the delimiter
+           characters are ASCII characters < 0x80.
+
+   See also strsep().
 */
 char *
 __strtok_r (char *s, const char *delim, char **save_ptr)





reply via email to

[Prev in Thread] Current Thread [Next in Thread]