Compare commits

...

10 Commits

Author SHA1 Message Date
Jim Meyering
c98ea50c21 . 1996-07-12 03:25:19 +00:00
Jim Meyering
78697777d7 . 1996-07-12 03:05:04 +00:00
Jim Meyering
83696460f0 . 1996-07-12 02:56:51 +00:00
Jim Meyering
bb8acb3640 . 1996-07-12 02:55:08 +00:00
Jim Meyering
4f29f1aeb2 . 1996-07-11 05:01:47 +00:00
Jim Meyering
36a4ba8ba3 . 1996-07-11 04:27:54 +00:00
Jim Meyering
aaafa60129 . 1996-07-11 04:27:27 +00:00
Jim Meyering
866e778210 . 1996-07-11 03:58:31 +00:00
Jim Meyering
805484b693 use latest from gettext-0.10.23 1996-07-11 03:57:04 +00:00
Jim Meyering
a10e992cbc . 1996-07-10 05:00:21 +00:00
7 changed files with 147 additions and 30 deletions

View File

@@ -3,7 +3,7 @@
"Keep this file name-space clean" means, talk to roland@gnu.ai.mit.edu
before changing it!
Copyright (C) 1987, 88, 89, 90, 91, 92, 93, 94, 95
Copyright (C) 1987, 88, 89, 90, 91, 92, 93, 94, 95, 1996
Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify it
@@ -18,7 +18,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
/* This tells Alpha OSF/1 not to define a getopt prototype in <stdio.h>.
Ditto for AIX 3.2 and <stdlib.h>. */
@@ -53,12 +53,28 @@
/* This needs to come after some library #include
to get __GNU_LIBRARY__ defined. */
#ifdef __GNU_LIBRARY__
#ifdef __GNU_LIBRARY__
/* Don't include stdlib.h for non-GNU C libraries because some of them
contain conflicting prototypes for getopt. */
#include <stdlib.h>
#if defined (_LIBC) || defined (HAVE_UNISTD_H)
#include <unistd.h>
#endif
#endif /* GNU C library. */
#ifdef VMS
#include <unixlib.h>
#if HAVE_STRING_H - 0
#include <string.h>
#endif
#endif
#ifdef WIN32
/* It's not Unix, really. See? Capital letters. */
#include <windows.h>
#define getpid() GetCurrentProcessId()
#endif
#ifndef _
/* This is for other GNU distributions with internationalized messages.
When compiling libc, the _ macro is predefined. */
@@ -166,7 +182,7 @@ static enum
/* Value of POSIXLY_CORRECT environment variable. */
static char *posixly_correct;
#ifdef __GNU_LIBRARY__
#ifdef __GNU_LIBRARY__
/* We want to avoid inclusion of string.h with non-GNU libraries
because there are many ways it can cause trouble.
On some systems, it contains special magic macros that don't work
@@ -217,6 +233,12 @@ extern int strlen (const char *);
static int first_nonopt;
static int last_nonopt;
/* Bash 2.0 gives us an environment variable containing flags
indicating ARGV elements that should not be considered arguments. */
static const char *nonoption_flags;
static int nonoption_flags_len;
/* Exchange two adjacent subsequences of ARGV.
One subsequence is elements [first_nonopt,last_nonopt)
which contains all the non-options that have been skipped so far.
@@ -226,6 +248,10 @@ static int last_nonopt;
`first_nonopt' and `last_nonopt' are relocated so that they describe
the new indices of the non-options in ARGV after they are moved. */
#if defined (__STDC__) && __STDC__
static void exchange (char **);
#endif
static void
exchange (argv)
char **argv;
@@ -284,6 +310,9 @@ exchange (argv)
/* Initialize the internal data when the first call is made. */
#if defined (__STDC__) && __STDC__
static const char *_getopt_initialize (const char *);
#endif
static const char *
_getopt_initialize (optstring)
const char *optstring;
@@ -315,6 +344,21 @@ _getopt_initialize (optstring)
else
ordering = PERMUTE;
if (posixly_correct == NULL)
{
/* Bash 2.0 puts a special variable in the environment for each
command it runs, specifying which ARGV elements are the results of
file name wildcard expansion and therefore should not be
considered as options. */
char var[100];
sprintf (var, "_%d_GNU_nonoption_argv_flags_", getpid ());
nonoption_flags = getenv (var);
if (nonoption_flags == NULL)
nonoption_flags_len = 0;
else
nonoption_flags_len = strlen (nonoption_flags);
}
return optstring;
}
@@ -391,10 +435,24 @@ _getopt_internal (argc, argv, optstring, longopts, longind, long_only)
optind = 1; /* Don't scan ARGV[0], the program name. */
}
/* Test whether ARGV[optind] points to a non-option argument.
Either it does not have option syntax, or there is an environment flag
from the shell indicating it is not an option. */
#define NONOPTION_P (argv[optind][0] != '-' || argv[optind][1] == '\0' \
|| (optind < nonoption_flags_len \
&& nonoption_flags[optind] == '1'))
if (nextchar == NULL || *nextchar == '\0')
{
/* Advance to the next ARGV-element. */
/* Give FIRST_NONOPT & LAST_NONOPT rational values if OPTIND has been
moved back by the user (who may also have changed the arguments). */
if (last_nonopt > optind)
last_nonopt = optind;
if (first_nonopt > optind)
first_nonopt = optind;
if (ordering == PERMUTE)
{
/* If we have just processed some options following some non-options,
@@ -408,8 +466,7 @@ _getopt_internal (argc, argv, optstring, longopts, longind, long_only)
/* Skip any additional non-options
and extend the range of non-options previously skipped. */
while (optind < argc
&& (argv[optind][0] != '-' || argv[optind][1] == '\0'))
while (optind < argc && NONOPTION_P)
optind++;
last_nonopt = optind;
}
@@ -447,7 +504,7 @@ _getopt_internal (argc, argv, optstring, longopts, longind, long_only)
/* If we have come to a non-option and did not permute it,
either stop the scan or describe it to the caller and pass it by. */
if ((argv[optind][0] != '-' || argv[optind][1] == '\0'))
if (NONOPTION_P)
{
if (ordering == REQUIRE_ORDER)
return EOF;
@@ -479,8 +536,7 @@ _getopt_internal (argc, argv, optstring, longopts, longind, long_only)
if (longopts != NULL
&& (argv[optind][1] == '-'
|| (long_only && (argv[optind][2]
|| !my_index (optstring, argv[optind][1])))))
|| (long_only && (argv[optind][2] || !my_index (optstring, argv[optind][1])))))
{
char *nameend;
const struct option *p;
@@ -493,8 +549,8 @@ _getopt_internal (argc, argv, optstring, longopts, longind, long_only)
for (nameend = nextchar; *nameend && *nameend != '='; nameend++)
/* Do nothing. */ ;
#ifdef lint
indfound = 0; /* Avoid spurious compiler warning. */
#ifdef lint /* Suppress `used before initialized' warning. */
indfound = 0;
#endif
/* Test all long options for either exact match
@@ -528,6 +584,7 @@ _getopt_internal (argc, argv, optstring, longopts, longind, long_only)
argv[0], argv[optind]);
nextchar += strlen (nextchar);
optind++;
optopt = 0;
return '?';
}
@@ -544,18 +601,20 @@ _getopt_internal (argc, argv, optstring, longopts, longind, long_only)
else
{
if (opterr)
if (argv[optind - 1][1] == '-')
/* --option */
fprintf (stderr,
_("%s: option `--%s' doesn't allow an argument\n"),
argv[0], pfound->name);
else
/* +option or -option */
fprintf (stderr,
_("%s: option `%c%s' doesn't allow an argument\n"),
argv[0], argv[optind - 1][0], pfound->name);
if (argv[optind - 1][1] == '-')
/* --option */
fprintf (stderr,
_("%s: option `--%s' doesn't allow an argument\n"),
argv[0], pfound->name);
else
/* +option or -option */
fprintf (stderr,
_("%s: option `%c%s' doesn't allow an argument\n"),
argv[0], argv[optind - 1][0], pfound->name);
nextchar += strlen (nextchar);
optopt = pfound->val;
return '?';
}
}
@@ -567,9 +626,10 @@ _getopt_internal (argc, argv, optstring, longopts, longind, long_only)
{
if (opterr)
fprintf (stderr,
_("%s: option `%s' requires an argument\n"),
argv[0], argv[optind - 1]);
_("%s: option `%s' requires an argument\n"),
argv[0], argv[optind - 1]);
nextchar += strlen (nextchar);
optopt = pfound->val;
return optstring[0] == ':' ? ':' : '?';
}
}
@@ -604,6 +664,7 @@ _getopt_internal (argc, argv, optstring, longopts, longind, long_only)
}
nextchar = (char *) "";
optind++;
optopt = 0;
return '?';
}
}
@@ -663,8 +724,8 @@ _getopt_internal (argc, argv, optstring, longopts, longind, long_only)
{
/* 1003.2 specifies the format of this message. */
fprintf (stderr,
_("%s: option requires an argument -- %c\n"),
argv[0], c);
_("%s: option requires an argument -- %c\n"),
argv[0], c);
}
optopt = c;
if (optstring[0] == ':')

View File

@@ -13,7 +13,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#ifndef _GETOPT_H
#define _GETOPT_H 1

View File

@@ -14,7 +14,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#ifdef HAVE_CONFIG_H
#include <config.h>

View File

@@ -1,10 +1,31 @@
Thu Jul 11 21:50:48 1996 Jim Meyering <meyering@na-net.ornl.gov>
* Version 3.13.
* dircolors.1: New file -- but just a pointer to texinfo docs.
* man/Makefile.am (man_MANS): Add dircolors.1.
* configure.in (VERSION): Bump to 3.13.
Wed Jul 10 22:57:29 1996 Jim Meyering <meyering@na-net.ornl.gov>
* aclocal.m4 (fp_PROG_CC_STDC): Include sys/stat.h in test program
so that DYNIX/ptx V4.1.3 doesn't use `-Xc -D__EXTENSIONS__' -- with
those options on that system, sys/stat.h gets compile errors.
With help from Marcus Daniels.
* getopt.c: Update from gettext-0.10.23.
* getopt1.c: Likewise.
* getopt.h: Likewise.
Tue Jul 9 20:19:44 1996 Jim Meyering <meyering@na-net.ornl.gov>
* src/dircolors.c (usage): Improve --help message. From Karl Berry.
(long_options): Add print-data-base and print-database.
* src/dircolors.c (dc_parse_stream): Don't give `unrecognized keyword'
message unless we've processed a matching TERM directive.
message unless we've processed a matching TERM directive. Reported
by Karl Berry and François Pinard.
* src/install.c (UID_T_MAX): Use `(unsigned long)1' rather than
`(uid_t)1' to avoid problems on systems where uid_t is signed.

View File

@@ -1,8 +1,9 @@
Changes in release 3.13:
* ls properly determines window size on SunOS and Solaris systems
* ls accepts new option --color[=WHEN] where WHEN is `always', `never',
or `auto'. --color=never is the default. --color is equivalent
to --color=always (documented only in --help message FIXME)
* new program: dircolors (not yet documented FIXME)
to --color=always.
* new program: dircolors
* ls allows 0 as argument to --tabsize (-T) option. Using --tabsize=0
inhibits the use of TAB characters for separating columns.
* you can create a backup of FILE with cp --force --backup FILE FILE. Before,

View File

@@ -1,3 +1,20 @@
Wed Jul 10 22:57:29 1996 Jim Meyering <meyering@na-net.ornl.gov>
* aclocal.m4 (fp_PROG_CC_STDC): Include sys/stat.h in test program
so that DYNIX/ptx V4.1.3 doesn't use `-Xc -D__EXTENSIONS__' -- with
those options on that system, sys/stat.h gets compile errors.
With help from Marcus Daniels.
* getopt.c: Update from gettext-0.10.23.
* getopt1.c: Likewise.
* getopt.h: Likewise.
Sun Jul 7 22:40:08 1996 Jim Meyering <meyering@na-net.ornl.gov>
* aclocal.m4 (AM_SYS_POSIX_TERMIOS): New macro, derived from test
in configure.in.
(AM_HEADER_TIOCGWINSZ_NEEDS_SYS_IOCTL): Likewise.
Sat Jul 6 12:47:48 1996 Jim Meyering <meyering@na-net.ornl.gov>
* configure.in (AC_REPLACE_FUNCS): Add group_member.

View File

@@ -1,3 +1,20 @@
Thu Jul 11 22:04:36 1996 Jim Meyering <meyering@na-net.ornl.gov>
* Version 1.19.
* configure.in (VERSION): Bump to 1.19.
Wed Jul 10 22:57:29 1996 Jim Meyering <meyering@na-net.ornl.gov>
* aclocal.m4 (fp_PROG_CC_STDC): Include sys/stat.h in test program
so that DYNIX/ptx V4.1.3 doesn't use `-Xc -D__EXTENSIONS__' -- with
those options on that system, sys/stat.h gets compile errors.
With help from Marcus Daniels.
* getopt.c: Update from gettext-0.10.23.
* getopt1.c: Likewise.
* getopt.h: Likewise.
Tue Jul 9 18:07:23 1996 Jim Meyering <meyering@na-net.ornl.gov>
* src/fmt.c (MAXCOST): Use `(unsigned long)1' rather than `(COST)1'