[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
CVS shishi/gl
From: |
shishi-commit |
Subject: |
CVS shishi/gl |
Date: |
Fri, 19 Nov 2004 15:04:23 +0100 |
Update of /home/cvs/shishi/gl
In directory dopio:/tmp/cvs-serv6917/gl
Modified Files:
getdate.y getopt.c getopt1.c getopt_.h getopt_int.h realloc.c
strtok_r.c
Log Message:
Update.
--- /home/cvs/shishi/gl/getdate.y 2004/11/11 18:58:35 1.8
+++ /home/cvs/shishi/gl/getdate.y 2004/11/19 14:04:23 1.9
@@ -201,7 +201,8 @@
%token tAGO tDST
%token <intval> tDAY tDAY_UNIT tDAYZONE tHOUR_UNIT tLOCAL_ZONE tMERIDIAN
-%token <intval> tMINUTE_UNIT tMONTH tMONTH_UNIT tSEC_UNIT tYEAR_UNIT tZONE
+%token <intval> tMINUTE_UNIT tMONTH tMONTH_UNIT tORDINAL
+%token <intval> tSEC_UNIT tYEAR_UNIT tZONE
%token <textintval> tSNUMBER tUNUMBER
%token <timespec> tSDECIMAL_NUMBER tUDECIMAL_NUMBER
@@ -317,6 +318,11 @@
pc->day_ordinal = 1;
pc->day_number = $1;
}
+ | tORDINAL tDAY
+ {
+ pc->day_ordinal = $1;
+ pc->day_number = $2;
+ }
| tUNUMBER tDAY
{
pc->day_ordinal = $1.value;
@@ -412,36 +418,48 @@
;
relunit:
- tUNUMBER tYEAR_UNIT
+ tORDINAL tYEAR_UNIT
+ { pc->rel_year += $1 * $2; }
+ | tUNUMBER tYEAR_UNIT
{ pc->rel_year += $1.value * $2; }
| tSNUMBER tYEAR_UNIT
{ pc->rel_year += $1.value * $2; }
| tYEAR_UNIT
{ pc->rel_year += $1; }
+ | tORDINAL tMONTH_UNIT
+ { pc->rel_month += $1 * $2; }
| tUNUMBER tMONTH_UNIT
{ pc->rel_month += $1.value * $2; }
| tSNUMBER tMONTH_UNIT
{ pc->rel_month += $1.value * $2; }
| tMONTH_UNIT
{ pc->rel_month += $1; }
+ | tORDINAL tDAY_UNIT
+ { pc->rel_day += $1 * $2; }
| tUNUMBER tDAY_UNIT
{ pc->rel_day += $1.value * $2; }
| tSNUMBER tDAY_UNIT
{ pc->rel_day += $1.value * $2; }
| tDAY_UNIT
{ pc->rel_day += $1; }
+ | tORDINAL tHOUR_UNIT
+ { pc->rel_hour += $1 * $2; }
| tUNUMBER tHOUR_UNIT
{ pc->rel_hour += $1.value * $2; }
| tSNUMBER tHOUR_UNIT
{ pc->rel_hour += $1.value * $2; }
| tHOUR_UNIT
{ pc->rel_hour += $1; }
+ | tORDINAL tMINUTE_UNIT
+ { pc->rel_minutes += $1 * $2; }
| tUNUMBER tMINUTE_UNIT
{ pc->rel_minutes += $1.value * $2; }
| tSNUMBER tMINUTE_UNIT
{ pc->rel_minutes += $1.value * $2; }
| tMINUTE_UNIT
{ pc->rel_minutes += $1; }
+ | tORDINAL tSEC_UNIT
+ { pc->rel_seconds += $1 * $2; }
| tUNUMBER tSEC_UNIT
{ pc->rel_seconds += $1.value * $2; }
| tSNUMBER tSEC_UNIT
@@ -579,21 +597,21 @@
{ "YESTERDAY",tDAY_UNIT, -1 },
{ "TODAY", tDAY_UNIT, 0 },
{ "NOW", tDAY_UNIT, 0 },
- { "LAST", tUNUMBER, -1 },
- { "THIS", tUNUMBER, 0 },
- { "NEXT", tUNUMBER, 1 },
- { "FIRST", tUNUMBER, 1 },
-/*{ "SECOND", tUNUMBER, 2 }, */
- { "THIRD", tUNUMBER, 3 },
- { "FOURTH", tUNUMBER, 4 },
- { "FIFTH", tUNUMBER, 5 },
- { "SIXTH", tUNUMBER, 6 },
- { "SEVENTH", tUNUMBER, 7 },
- { "EIGHTH", tUNUMBER, 8 },
- { "NINTH", tUNUMBER, 9 },
- { "TENTH", tUNUMBER, 10 },
- { "ELEVENTH", tUNUMBER, 11 },
- { "TWELFTH", tUNUMBER, 12 },
+ { "LAST", tORDINAL, -1 },
+ { "THIS", tORDINAL, 0 },
+ { "NEXT", tORDINAL, 1 },
+ { "FIRST", tORDINAL, 1 },
+/*{ "SECOND", tORDINAL, 2 }, */
+ { "THIRD", tORDINAL, 3 },
+ { "FOURTH", tORDINAL, 4 },
+ { "FIFTH", tORDINAL, 5 },
+ { "SIXTH", tORDINAL, 6 },
+ { "SEVENTH", tORDINAL, 7 },
+ { "EIGHTH", tORDINAL, 8 },
+ { "NINTH", tORDINAL, 9 },
+ { "TENTH", tORDINAL, 10 },
+ { "ELEVENTH", tORDINAL, 11 },
+ { "TWELFTH", tORDINAL, 12 },
{ "AGO", tAGO, 1 },
{ NULL, 0, 0 }
};
--- /home/cvs/shishi/gl/getopt.c 2004/11/12 00:24:13 1.6
+++ /home/cvs/shishi/gl/getopt.c 2004/11/19 14:04:23 1.7
@@ -3,7 +3,7 @@
"Keep this file name-space clean" means, talk to address@hidden
before changing it!
Copyright (C) 1987,88,89,90,91,92,93,94,95,96,98,99,2000,2001,2002,2003,2004
- Free Software Foundation, Inc.
+ Free Software Foundation, Inc.
This file is part of the GNU C Library.
This program is free software; you can redistribute it and/or modify
@@ -62,16 +62,16 @@
# define attribute_hidden
#endif
-/* This version of `getopt' appears to the caller like standard Unix `getopt'
- but it behaves differently for the user, since it allows the user
- to intersperse the options with the other arguments.
+/* Unlike standard Unix `getopt', functions like `getopt_long'
+ let the user intersperse the options with the other arguments.
- As `getopt' works, it permutes the elements of ARGV so that,
+ As `getopt_long' works, it permutes the elements of ARGV so that,
when it is done, all the options precede everything else. Thus
all application programs are extended to handle flexible argument order.
- Setting the environment variable POSIXLY_CORRECT disables permutation.
- Then the behavior is completely standard.
+ Using `getopt' or setting the environment variable POSIXLY_CORRECT
+ disables permutation.
+ Then the application's behavior is completely standard.
GNU application programs can use a third alternative mode in which
they can distinguish the relative order of options and other arguments. */
@@ -250,8 +250,8 @@
/* Initialize the internal data when the first call is made. */
static const char *
-_getopt_initialize (int argc, char *__getopt_argv_const *argv,
- const char *optstring, struct _getopt_data *d)
+_getopt_initialize (int argc, char **argv, const char *optstring,
+ int posixly_correct, struct _getopt_data *d)
{
/* Start processing options with ARGV-element 1 (since ARGV-element 0
is the program name); the sequence of previously skipped
@@ -261,7 +261,7 @@
d->__nextchar = NULL;
- d->__posixly_correct = !!getenv ("POSIXLY_CORRECT");
+ d->__posixly_correct = posixly_correct || !!getenv ("POSIXLY_CORRECT");
/* Determine how to handle the ordering of options and nonoptions. */
@@ -355,11 +355,6 @@
`flag' field is nonzero, the value of the option's `val' field
if the `flag' field is zero.
- The elements of ARGV aren't really const, because we permute them.
- 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.
@@ -368,13 +363,15 @@
recent call.
If LONG_ONLY is nonzero, '-' as well as '--' can introduce
- long-named options. */
+ long-named options.
+
+ If POSIXLY_CORRECT is nonzero, behave as if the POSIXLY_CORRECT
+ environment variable were set. */
int
-_getopt_internal_r (int argc, char *__getopt_argv_const *argv,
- const char *optstring,
+_getopt_internal_r (int argc, char **argv, const char *optstring,
const struct option *longopts, int *longind,
- int long_only, struct _getopt_data *d)
+ int long_only, int posixly_correct, struct _getopt_data *d)
{
int print_errors = d->opterr;
if (optstring[0] == ':')
@@ -389,7 +386,8 @@
{
if (d->optind == 0)
d->optind = 1; /* Don't scan ARGV[0], the program name. */
- optstring = _getopt_initialize (argc, argv, optstring, d);
+ optstring = _getopt_initialize (argc, argv, optstring,
+ posixly_correct, d);
d->__initialized = 1;
}
@@ -1137,17 +1135,17 @@
}
int
-_getopt_internal (int argc, char *__getopt_argv_const *argv,
- const char *optstring,
- const struct option *longopts, int *longind, int long_only)
+_getopt_internal (int argc, char **argv, const char *optstring,
+ const struct option *longopts, int *longind,
+ int long_only, int posixly_correct)
{
int result;
getopt_data.optind = optind;
getopt_data.opterr = opterr;
- result = _getopt_internal_r (argc, argv, optstring, longopts,
- longind, long_only, &getopt_data);
+ result = _getopt_internal_r (argc, argv, optstring, longopts, longind,
+ long_only, posixly_correct, &getopt_data);
optind = getopt_data.optind;
optarg = getopt_data.optarg;
@@ -1156,13 +1154,19 @@
return result;
}
+/* glibc gets a LSB-compliant getopt.
+ Standalone applications get a POSIX-compliant getopt. */
+#if _LIBC
+enum { POSIXLY_CORRECT = 0 };
+#else
+enum { POSIXLY_CORRECT = 1 };
+#endif
+
int
-getopt (int argc, char *__getopt_argv_const *argv, const char *optstring)
+getopt (int argc, char *const *argv, const char *optstring)
{
- return _getopt_internal (argc, argv, optstring,
- (const struct option *) 0,
- (int *) 0,
- 0);
+ return _getopt_internal (argc, (char **) argv, optstring, NULL, NULL, 0,
+ POSIXLY_CORRECT);
}
--- /home/cvs/shishi/gl/getopt1.c 2004/11/12 00:24:13 1.6
+++ /home/cvs/shishi/gl/getopt1.c 2004/11/19 14:04:23 1.7
@@ -44,16 +44,17 @@
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);
+ return _getopt_internal (argc, (char **) argv, options, long_options,
+ opt_index, 0, 0);
}
int
-_getopt_long_r (int argc, char *__getopt_argv_const *argv, const char *options,
+_getopt_long_r (int argc, char **argv, const char *options,
const struct option *long_options, int *opt_index,
struct _getopt_data *d)
{
return _getopt_internal_r (argc, argv, options, long_options, opt_index,
- 0, d);
+ 0, 0, d);
}
/* Like getopt_long, but '-' as well as '--' can indicate a long option.
@@ -66,17 +67,17 @@
const char *options,
const struct option *long_options, int *opt_index)
{
- return _getopt_internal (argc, argv, options, long_options, opt_index, 1);
+ return _getopt_internal (argc, (char **) argv, options, long_options,
+ opt_index, 1, 0);
}
int
-_getopt_long_only_r (int argc, char *__getopt_argv_const *argv,
- const char *options,
+_getopt_long_only_r (int argc, char **argv, const char *options,
const struct option *long_options, int *opt_index,
struct _getopt_data *d)
{
return _getopt_internal_r (argc, argv, options, long_options, opt_index,
- 1, d);
+ 1, 0, d);
}
--- /home/cvs/shishi/gl/getopt_.h 2004/11/12 00:24:13 1.3
+++ /home/cvs/shishi/gl/getopt_.h 2004/11/19 14:04:23 1.4
@@ -53,13 +53,12 @@
# 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
+/* Standalone applications get correct prototypes for getopt_long and
+ getopt_long_only; they declare "char **argv". libc uses prototypes
+ with "char *const *argv" that are incorrect because getopt_long and
+ getopt_long_only can permute argv; this is required for backward
+ compatibility (e.g., for LSB 2.0.1). */
+#if defined __GETOPT_PREFIX && !defined __need_getopt
# define __getopt_argv_const /* empty */
#else
# define __getopt_argv_const const
@@ -131,7 +130,7 @@
The field `has_arg' is:
no_argument (or 0) if the option does not take an argument,
required_argument (or 1) if the option requires an argument,
- optional_argument (or 2) if the option takes an optional argument.
+ optional_argument (or 2) if the option takes an optional argument.
If the field `flag' is not NULL, it points to a variable that is set
to the value given in the field `val' when the option is found, but
@@ -186,8 +185,7 @@
arguments to the option '\0'. This behavior is specific to the GNU
`getopt'. */
-extern int getopt (int ___argc, char *__getopt_argv_const *___argv,
- const char *__shortopts)
+extern int getopt (int ___argc, char *const *___argv, const char *__shortopts)
__THROW;
#ifndef __need_getopt
--- /home/cvs/shishi/gl/getopt_int.h 2004/11/12 00:24:13 1.2
+++ /home/cvs/shishi/gl/getopt_int.h 2004/11/19 14:04:23 1.3
@@ -20,10 +20,10 @@
#ifndef _GETOPT_INT_H
#define _GETOPT_INT_H 1
-extern int _getopt_internal (int ___argc, char *__getopt_argv_const *___argv,
+extern int _getopt_internal (int ___argc, char **___argv,
const char *__shortopts,
const struct option *__longopts, int *__longind,
- int __long_only);
+ int __long_only, int __posixly_correct);
/* Reentrant versions which can handle parsing multiple argument
@@ -64,7 +64,7 @@
This is what Unix does.
This mode of operation is selected by either setting the environment
variable POSIXLY_CORRECT, or using `+' as the first character
- of the list of option characters.
+ of the list of option characters, or by calling getopt.
PERMUTE is the default. We permute the contents of ARGV as we
scan, so that eventually all the non-options are at the end.
@@ -87,7 +87,8 @@
REQUIRE_ORDER, PERMUTE, RETURN_IN_ORDER
} __ordering;
- /* If the POSIXLY_CORRECT environment variable is set. */
+ /* If the POSIXLY_CORRECT environment variable is set
+ or getopt was called. */
int __posixly_correct;
@@ -110,18 +111,18 @@
default values and to clear the initialization flag. */
#define _GETOPT_DATA_INITIALIZER { 1, 1 }
-extern int _getopt_internal_r (int ___argc, char *__getopt_argv_const *___argv,
+extern int _getopt_internal_r (int ___argc, char **___argv,
const char *__shortopts,
const struct option *__longopts, int *__longind,
- int __long_only, struct _getopt_data *__data);
+ int __long_only, int __posixly_correct,
+ struct _getopt_data *__data);
-extern int _getopt_long_r (int ___argc, char *__getopt_argv_const *___argv,
+extern int _getopt_long_r (int ___argc, char **___argv,
const char *__shortopts,
const struct option *__longopts, int *__longind,
struct _getopt_data *__data);
-extern int _getopt_long_only_r (int ___argc,
- char *__getopt_argv_const *___argv,
+extern int _getopt_long_only_r (int ___argc, char **___argv,
const char *__shortopts,
const struct option *__longopts,
int *__longind,
--- /home/cvs/shishi/gl/realloc.c 2003/09/14 21:10:11 1.3
+++ /home/cvs/shishi/gl/realloc.c 2004/11/19 14:04:23 1.4
@@ -1,5 +1,5 @@
-/* Work around bug on some systems where realloc (NULL, 0) fails.
- Copyright (C) 1997, 2003 Free Software Foundation, Inc.
+/* realloc() function that is glibc compatible.
+ Copyright (C) 1997, 2003, 2004 Free Software Foundation, Inc.
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
@@ -32,8 +32,15 @@
rpl_realloc (void *p, size_t n)
{
if (n == 0)
- n = 1;
- if (p == 0)
+ {
+ n = 1;
+
+ /* In theory realloc might fail, so don't rely on it to free. */
+ free (p);
+ p = NULL;
+ }
+
+ if (p == NULL)
return malloc (n);
return realloc (p, n);
}
--- /home/cvs/shishi/gl/strtok_r.c 2004/11/12 00:24:13 1.3
+++ /home/cvs/shishi/gl/strtok_r.c 2004/11/19 14:04:23 1.4
@@ -49,7 +49,7 @@
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.
+ characters are ASCII characters < 0x30.
See also strsep().
*/
- CVS shishi/gl, shishi-commit, 2004/11/08
- CVS shishi/gl, shishi-commit, 2004/11/09
- CVS shishi/gl, shishi-commit, 2004/11/10
- CVS shishi/gl, shishi-commit, 2004/11/11
- CVS shishi/gl, shishi-commit, 2004/11/11
- CVS shishi/gl, shishi-commit, 2004/11/11
- CVS shishi/gl, shishi-commit, 2004/11/11
- CVS shishi/gl, shishi-commit, 2004/11/11
- CVS shishi/gl, shishi-commit, 2004/11/12
- CVS shishi/gl,
shishi-commit <=
- CVS shishi/gl, shishi-commit, 2004/11/19
- CVS shishi/gl, shishi-commit, 2004/11/21
- CVS shishi/gl, shishi-commit, 2004/11/28