mirror of
https://git.savannah.gnu.org/git/coreutils.git
synced 2025-09-10 07:59:52 +02:00
Compare commits
30 Commits
FILEUTILS-
...
FILEUTILS-
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
39d1a08208 | ||
|
|
9ca6f19a2d | ||
|
|
0acd885d83 | ||
|
|
9110853f39 | ||
|
|
4ffe108e39 | ||
|
|
7290a43da9 | ||
|
|
9cfc701536 | ||
|
|
b0a020d50b | ||
|
|
36942690e1 | ||
|
|
afda328772 | ||
|
|
8a752e8696 | ||
|
|
8bd5d9e607 | ||
|
|
6885aee87b | ||
|
|
e4c57a939b | ||
|
|
b802aa3f55 | ||
|
|
8f915aadf8 | ||
|
|
662e8b4a03 | ||
|
|
3dd86270c6 | ||
|
|
ce7c0d5468 | ||
|
|
9ae64058d2 | ||
|
|
92de89ed2c | ||
|
|
5f0b9f1d99 | ||
|
|
8ebfd37293 | ||
|
|
cb6351aa82 | ||
|
|
a518e28429 | ||
|
|
7de0d8e233 | ||
|
|
839c312d49 | ||
|
|
783bace690 | ||
|
|
31d836282b | ||
|
|
bc73cf3351 |
2
THANKS
2
THANKS
@@ -11,7 +11,9 @@ Marcus Daniels: marcus@sysc.pdx.edu
|
||||
Mark A. Thomas: thommark@access.digex.net
|
||||
Miles Bader: miles@gnu.ai.mit.edu
|
||||
Peter Eriksson: peter@ifm.liu.se
|
||||
Ross Ridge: rridge@calum.csclub.uwaterloo.ca
|
||||
Santiago Vila Doncel: sanvila@ctv.es
|
||||
Thomas Bushnell, n/BSG: thomas@gnu.ai.mit.edu
|
||||
Tony Leneis: tony@plaza.ds.adp.com
|
||||
Wayne Stewart: wstewa@atl.com
|
||||
|
||||
|
||||
@@ -876,7 +876,7 @@ results in a new page. Page counting with and without
|
||||
@samp{+@var{first_page}} is identical. By default, it starts with the
|
||||
first page of input file (not first page printed). Page numbering may be
|
||||
altered by @samp{-N} option.
|
||||
|
||||
|
||||
@item -@var{column}
|
||||
@opindex -@var{column}
|
||||
@cindex down columns
|
||||
@@ -918,7 +918,7 @@ is 8).
|
||||
Use a form feed instead of newlines to separate output pages. Default
|
||||
page length of 66 lines is not altered. But the number of lines of text
|
||||
per page changes from 56 to 63 lines.
|
||||
|
||||
|
||||
|
||||
@item -h @var{HEADER}
|
||||
@opindex -h
|
||||
@@ -941,7 +941,7 @@ is 8).
|
||||
@opindex -j
|
||||
Merge lines of full length. Used together with the column options
|
||||
@samp{-@var{column}}, @samp{-a -@var{column}} or @samp{-m}. Turns off
|
||||
@samp{-w} line truncation; no column alignment used; may be used with
|
||||
@samp{-w} line truncation; no column alignment used; may be used with
|
||||
@samp{-s[@var{separator}]}.
|
||||
|
||||
|
||||
@@ -1322,7 +1322,7 @@ less than @var{bytes} bytes of the line are left, then continue
|
||||
normally. @var{bytes} has the same format as for the @samp{--bytes}
|
||||
option.
|
||||
|
||||
@itemx --verbose=@var{bytes}
|
||||
@itemx --verbose
|
||||
@opindex --verbose
|
||||
Write a diagnostic to standard error just before each output file is opened.
|
||||
|
||||
|
||||
264
lib/getopt.c
264
lib/getopt.c
@@ -3,22 +3,26 @@
|
||||
"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, 1996
|
||||
Copyright (C) 1987, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97
|
||||
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 the
|
||||
Free Software Foundation; either version 2, or (at your option) any
|
||||
later version.
|
||||
This file is part of the GNU C Library. Its master source is NOT part of
|
||||
the C library, however. The master source lives in /gd/gnu/lib.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
The GNU C Library 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 General Public License for more details.
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with the GNU C Library; see the file COPYING.LIB. If not,
|
||||
write to the Free Software Foundation, Inc., 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>. */
|
||||
@@ -48,18 +52,24 @@
|
||||
program understand `configure --with-gnu-libc' and omit the object files,
|
||||
it is simpler to just do this in the source for each such file. */
|
||||
|
||||
#if defined (_LIBC) || !defined (__GNU_LIBRARY__)
|
||||
#define GETOPT_INTERFACE_VERSION 1
|
||||
#if !defined (_LIBC) && defined (__GLIBC__) && __GLIBC__ >= 2
|
||||
#include <gnu-versions.h>
|
||||
#if _GNU_GETOPT_INTERFACE_VERSION == GETOPT_INTERFACE_VERSION
|
||||
#define ELIDE_CODE
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef ELIDE_CODE
|
||||
|
||||
|
||||
/* 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
|
||||
@@ -69,7 +79,7 @@
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef WIN32
|
||||
#if defined (WIN32) && !defined (__CYGWIN32__)
|
||||
/* It's not Unix, really. See? Capital letters. */
|
||||
#include <windows.h>
|
||||
#define getpid() GetCurrentProcessId()
|
||||
@@ -78,7 +88,7 @@
|
||||
#ifndef _
|
||||
/* This is for other GNU distributions with internationalized messages.
|
||||
When compiling libc, the _ macro is predefined. */
|
||||
#ifdef HAVE_LIBINTL_H
|
||||
#if defined (HAVE_LIBINTL_H) || defined (ENABLE_NLS)
|
||||
# include <libintl.h>
|
||||
# define _(msgid) gettext (msgid)
|
||||
#else
|
||||
@@ -122,8 +132,14 @@ char *optarg = NULL;
|
||||
Otherwise, `optind' communicates from one call to the next
|
||||
how much of ARGV has been scanned so far. */
|
||||
|
||||
/* XXX 1003.2 says this must be 1 before any call. */
|
||||
int optind = 0;
|
||||
/* 1003.2 says this must be 1 before any call. */
|
||||
int optind = 1;
|
||||
|
||||
/* Formerly, initialization of getopt depended on optind==0, which
|
||||
causes problems with re-calling getopt as programs generally don't
|
||||
know that. */
|
||||
|
||||
int __getopt_initialized = 0;
|
||||
|
||||
/* The next char to be scanned in the option-element
|
||||
in which the last option character we returned was found.
|
||||
@@ -182,7 +198,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
|
||||
@@ -233,12 +249,31 @@ extern int strlen (const char *);
|
||||
static int first_nonopt;
|
||||
static int last_nonopt;
|
||||
|
||||
#ifdef _LIBC
|
||||
/* 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;
|
||||
|
||||
static int original_argc;
|
||||
static char *const *original_argv;
|
||||
|
||||
/* Make sure the environment variable bash 2.0 puts in the environment
|
||||
is valid for the getopt call we must make sure that the ARGV passed
|
||||
to getopt is that one passed to the process. */
|
||||
static void store_args (int argc, char *const *argv) __attribute__ ((unused));
|
||||
static void
|
||||
store_args (int argc, char *const *argv)
|
||||
{
|
||||
/* XXX This is no good solution. We should rather copy the args so
|
||||
that we can compare them later. But we must not use malloc(3). */
|
||||
original_argc = argc;
|
||||
original_argv = argv;
|
||||
}
|
||||
text_set_element (__libc_subinit, store_args);
|
||||
#endif
|
||||
|
||||
/* 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.
|
||||
@@ -311,10 +346,12 @@ exchange (argv)
|
||||
/* Initialize the internal data when the first call is made. */
|
||||
|
||||
#if defined (__STDC__) && __STDC__
|
||||
static const char *_getopt_initialize (const char *);
|
||||
static const char *_getopt_initialize (int, char *const *, const char *);
|
||||
#endif
|
||||
static const char *
|
||||
_getopt_initialize (optstring)
|
||||
_getopt_initialize (argc, argv, optstring)
|
||||
int argc;
|
||||
char *const *argv;
|
||||
const char *optstring;
|
||||
{
|
||||
/* Start processing options with ARGV-element 1 (since ARGV-element 0
|
||||
@@ -344,7 +381,9 @@ _getopt_initialize (optstring)
|
||||
else
|
||||
ordering = PERMUTE;
|
||||
|
||||
if (posixly_correct == NULL)
|
||||
#ifdef _LIBC
|
||||
if (posixly_correct == NULL
|
||||
&& argc == original_argc && argv == original_argv)
|
||||
{
|
||||
/* Bash 2.0 puts a special variable in the environment for each
|
||||
command it runs, specifying which ARGV elements are the results of
|
||||
@@ -358,6 +397,9 @@ _getopt_initialize (optstring)
|
||||
else
|
||||
nonoption_flags_len = strlen (nonoption_flags);
|
||||
}
|
||||
else
|
||||
nonoption_flags_len = 0;
|
||||
#endif
|
||||
|
||||
return optstring;
|
||||
}
|
||||
@@ -429,18 +471,24 @@ _getopt_internal (argc, argv, optstring, longopts, longind, long_only)
|
||||
{
|
||||
optarg = NULL;
|
||||
|
||||
if (optind == 0)
|
||||
if (!__getopt_initialized || optind == 0)
|
||||
{
|
||||
optstring = _getopt_initialize (optstring);
|
||||
optstring = _getopt_initialize (argc, argv, optstring);
|
||||
optind = 1; /* Don't scan ARGV[0], the program name. */
|
||||
__getopt_initialized = 1;
|
||||
}
|
||||
|
||||
/* 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. */
|
||||
from the shell indicating it is not an option. The later information
|
||||
is only used when the used in the GNU libc. */
|
||||
#ifdef _LIBC
|
||||
#define NONOPTION_P (argv[optind][0] != '-' || argv[optind][1] == '\0' \
|
||||
|| (optind < nonoption_flags_len \
|
||||
&& nonoption_flags[optind] == '1'))
|
||||
#else
|
||||
#define NONOPTION_P (argv[optind][0] != '-' || argv[optind][1] == '\0')
|
||||
#endif
|
||||
|
||||
if (nextchar == NULL || *nextchar == '\0')
|
||||
{
|
||||
@@ -543,22 +591,19 @@ _getopt_internal (argc, argv, optstring, longopts, longind, long_only)
|
||||
const struct option *pfound = NULL;
|
||||
int exact = 0;
|
||||
int ambig = 0;
|
||||
int indfound;
|
||||
int indfound = -1;
|
||||
int option_index;
|
||||
|
||||
for (nameend = nextchar; *nameend && *nameend != '='; nameend++)
|
||||
/* Do nothing. */ ;
|
||||
|
||||
#ifdef lint /* Suppress `used before initialized' warning. */
|
||||
indfound = 0;
|
||||
#endif
|
||||
|
||||
/* Test all long options for either exact match
|
||||
or abbreviated matches. */
|
||||
for (p = longopts, option_index = 0; p->name; p++, option_index++)
|
||||
if (!strncmp (p->name, nextchar, nameend - nextchar))
|
||||
{
|
||||
if (nameend - nextchar == strlen (p->name))
|
||||
if ((unsigned int) (nameend - nextchar)
|
||||
== (unsigned int) strlen (p->name))
|
||||
{
|
||||
/* Exact match found. */
|
||||
pfound = p;
|
||||
@@ -601,16 +646,16 @@ _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);
|
||||
|
||||
@@ -626,8 +671,8 @@ _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] == ':' ? ':' : '?';
|
||||
@@ -694,6 +739,131 @@ _getopt_internal (argc, argv, optstring, longopts, longind, long_only)
|
||||
optopt = c;
|
||||
return '?';
|
||||
}
|
||||
/* Convenience. Treat POSIX -W foo same as long option --foo */
|
||||
if (temp[0] == 'W' && temp[1] == ';')
|
||||
{
|
||||
char *nameend;
|
||||
const struct option *p;
|
||||
const struct option *pfound = NULL;
|
||||
int exact = 0;
|
||||
int ambig = 0;
|
||||
int indfound = 0;
|
||||
int option_index;
|
||||
|
||||
/* This is an option that requires an argument. */
|
||||
if (*nextchar != '\0')
|
||||
{
|
||||
optarg = nextchar;
|
||||
/* If we end this ARGV-element by taking the rest as an arg,
|
||||
we must advance to the next element now. */
|
||||
optind++;
|
||||
}
|
||||
else if (optind == argc)
|
||||
{
|
||||
if (opterr)
|
||||
{
|
||||
/* 1003.2 specifies the format of this message. */
|
||||
fprintf (stderr,
|
||||
_ ("%s: option requires an argument -- %c\n"),
|
||||
argv[0], c);
|
||||
}
|
||||
optopt = c;
|
||||
if (optstring[0] == ':')
|
||||
c = ':';
|
||||
else
|
||||
c = '?';
|
||||
return c;
|
||||
}
|
||||
else
|
||||
/* We already incremented `optind' once;
|
||||
increment it again when taking next ARGV-elt as argument. */
|
||||
optarg = argv[optind++];
|
||||
|
||||
/* optarg is now the argument, see if it's in the
|
||||
table of longopts. */
|
||||
|
||||
for (nextchar = nameend = optarg; *nameend && *nameend != '='; nameend++)
|
||||
/* Do nothing. */ ;
|
||||
|
||||
/* Test all long options for either exact match
|
||||
or abbreviated matches. */
|
||||
for (p = longopts, option_index = 0; p->name; p++, option_index++)
|
||||
if (!strncmp (p->name, nextchar, nameend - nextchar))
|
||||
{
|
||||
if ((unsigned int) (nameend - nextchar) == strlen (p->name))
|
||||
{
|
||||
/* Exact match found. */
|
||||
pfound = p;
|
||||
indfound = option_index;
|
||||
exact = 1;
|
||||
break;
|
||||
}
|
||||
else if (pfound == NULL)
|
||||
{
|
||||
/* First nonexact match found. */
|
||||
pfound = p;
|
||||
indfound = option_index;
|
||||
}
|
||||
else
|
||||
/* Second or later nonexact match found. */
|
||||
ambig = 1;
|
||||
}
|
||||
if (ambig && !exact)
|
||||
{
|
||||
if (opterr)
|
||||
fprintf (stderr, _ ("%s: option `-W %s' is ambiguous\n"),
|
||||
argv[0], argv[optind]);
|
||||
nextchar += strlen (nextchar);
|
||||
optind++;
|
||||
return '?';
|
||||
}
|
||||
if (pfound != NULL)
|
||||
{
|
||||
option_index = indfound;
|
||||
if (*nameend)
|
||||
{
|
||||
/* Don't test has_arg with >, because some C compilers don't
|
||||
allow it to be used on enums. */
|
||||
if (pfound->has_arg)
|
||||
optarg = nameend + 1;
|
||||
else
|
||||
{
|
||||
if (opterr)
|
||||
fprintf (stderr,
|
||||
_ ("%s: option `-W %s' doesn't allow an argument\n"),
|
||||
argv[0], pfound->name);
|
||||
|
||||
nextchar += strlen (nextchar);
|
||||
return '?';
|
||||
}
|
||||
}
|
||||
else if (pfound->has_arg == 1)
|
||||
{
|
||||
if (optind < argc)
|
||||
optarg = argv[optind++];
|
||||
else
|
||||
{
|
||||
if (opterr)
|
||||
fprintf (stderr,
|
||||
_ ("%s: option `%s' requires an argument\n"),
|
||||
argv[0], argv[optind - 1]);
|
||||
nextchar += strlen (nextchar);
|
||||
return optstring[0] == ':' ? ':' : '?';
|
||||
}
|
||||
}
|
||||
nextchar += strlen (nextchar);
|
||||
if (longind != NULL)
|
||||
*longind = option_index;
|
||||
if (pfound->flag)
|
||||
{
|
||||
*(pfound->flag) = pfound->val;
|
||||
return 0;
|
||||
}
|
||||
return pfound->val;
|
||||
}
|
||||
nextchar = NULL;
|
||||
return 'W'; /* Let the application handle it. */
|
||||
}
|
||||
if (temp[1] == ':')
|
||||
{
|
||||
if (temp[2] == ':')
|
||||
@@ -724,8 +894,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] == ':')
|
||||
@@ -756,7 +926,7 @@ getopt (argc, argv, optstring)
|
||||
0);
|
||||
}
|
||||
|
||||
#endif /* _LIBC or not __GNU_LIBRARY__. */
|
||||
#endif /* Not ELIDE_CODE. */
|
||||
|
||||
#ifdef TEST
|
||||
|
||||
|
||||
@@ -41,15 +41,11 @@ INSTALL_PROGRAM = @INSTALL_PROGRAM@
|
||||
INSTALL_DATA = @INSTALL_DATA@
|
||||
INSTALL_SCRIPT = @INSTALL_SCRIPT@
|
||||
transform = @program_transform_name@
|
||||
YACC = @YACC@
|
||||
RANLIB = @RANLIB@
|
||||
GENCAT = @GENCAT@
|
||||
PERL = @PERL@
|
||||
MV = @MV@
|
||||
GMSGFMT = @GMSGFMT@
|
||||
CC = @CC@
|
||||
RANLIB = @RANLIB@
|
||||
LN = @LN@
|
||||
RM = @RM@
|
||||
|
||||
EXTRA_DIST = README \
|
||||
ccstdc.m4 dmalloc.m4 error.m4 getgroups.m4 getline.m4 getloadavg.m4 \
|
||||
|
||||
@@ -1,3 +1,44 @@
|
||||
Wed Jan 8 16:38:24 1997 Jim Meyering <meyering@na-net.ornl.gov>
|
||||
|
||||
* Version 3.15.
|
||||
|
||||
* src/ls.c (print_long_format): Cast alloca return value to char*.
|
||||
|
||||
* lib/getopt.c (_getopt_internal): Use `_', rather than the
|
||||
(sometimes-)expansion `gettext'.
|
||||
|
||||
Tue Jan 7 22:49:55 1997 Jim Meyering <meyering@na-net.ornl.gov>
|
||||
|
||||
* lib/getopt.c: New (more POSIX compliant) version from GNU libc.
|
||||
[_]: Define to gettext also if ENABLE_NLS is defined.
|
||||
This is temporary.
|
||||
|
||||
Sun Jan 5 09:33:07 1997 Jim Meyering <meyering@na-net.ornl.gov>
|
||||
|
||||
* src/ls.c (print_long_format): Avoid making unnecessary copy of
|
||||
date/time string. Patch from Paul Eggert.
|
||||
(print_long_format): NUL-terminate line of output.
|
||||
(print_long_format): Detect and handle strftime failure
|
||||
due to pathologically long strings in locale tables.
|
||||
Patch from Paul Eggert.
|
||||
(print_long_format): Change references to BIGBUF in use of
|
||||
FPUTS macro to references to BUF.
|
||||
Use 11 (not 20) bytes for mode string buffer.
|
||||
|
||||
Sat Jan 4 21:14:36 1997 Jim Meyering <meyering@na-net.ornl.gov>
|
||||
|
||||
* src/ls.c (print_long_format): Clean up vestiges of legacy
|
||||
ctime-oriented code. With internationalization and strftime,
|
||||
you can't presume that %a expands to a 3-byte string.
|
||||
Reported by Ross Ridge.
|
||||
(print_long_format): Use POSIX-mandated %e (blank-padded numeric
|
||||
day of month), not %d (the same number, but *zero*-filled).
|
||||
|
||||
Fri Jan 3 21:08:29 1997 Jim Meyering <meyering@na-net.ornl.gov>
|
||||
|
||||
* acconfig.h (getgroups): Add #undef.
|
||||
From Marcus Daniels.
|
||||
|
||||
Thu Jan 2 21:16:16 1997 Jim Meyering <meyering@na-net.ornl.gov>
|
||||
|
||||
* lib/Makefile.am (EXTRA_DIST): Add getgroups.c.
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
Changes in release 3.15:
|
||||
[3.14b]:
|
||||
* touch --date=DATE bug (due to broken getdate.y) has been fixed
|
||||
* ls -l no longer misformats the date when run in a locale for which the
|
||||
locale's abbreviated week-day name (strftime's %a format) is shorter or
|
||||
longer than the `normal' three bytes (with LANG=de it's a two-byte string).
|
||||
* Using --program-prefix no longer applies the prefix twice
|
||||
* ls --color properly restores color attributes upon completion when the
|
||||
normal (`no') color attribute is not the default color.
|
||||
|
||||
@@ -1,3 +1,23 @@
|
||||
Wed Jan 8 16:38:24 1997 Jim Meyering <meyering@na-net.ornl.gov>
|
||||
|
||||
* lib/getopt.c (_getopt_internal): Use `_', rather than the
|
||||
(sometimes-)expansion `gettext'.
|
||||
|
||||
Tue Jan 7 22:10:51 1997 Jim Meyering <meyering@na-net.ornl.gov>
|
||||
|
||||
* src/nice.c (main): Work around failures induced by new version of
|
||||
getopt.c by not modifying optind before the first getopt_long call
|
||||
in main. With suggestions from Ulrich Drepper.
|
||||
|
||||
* lib/getopt.c: New (more POSIX compliant) version from GNU libc.
|
||||
[_]: Define to gettext also if ENABLE_NLS is defined.
|
||||
This is temporary.
|
||||
|
||||
Fri Jan 3 21:08:29 1997 Jim Meyering <meyering@na-net.ornl.gov>
|
||||
|
||||
* acconfig.h (getgroups): Add #undef.
|
||||
From Marcus Daniels.
|
||||
|
||||
Fri Dec 27 17:25:18 1996 Jim Meyering <meyering@na-net.ornl.gov>
|
||||
|
||||
* src/who-users.c [!WTMP_FILE]: Provide default path.
|
||||
|
||||
@@ -1,8 +1,15 @@
|
||||
Changes in release 1.15
|
||||
[1.14b]
|
||||
* nice works with very recently-changed GNU libc getopt
|
||||
* fix several bugs in m4 macros used to create `configure' script
|
||||
* id works on systems with disfunctional getgroups function
|
||||
* uptime configure test detects /proc/uptime on Linux
|
||||
|
||||
Changes in release 1.14
|
||||
* fix bug in getdate.y that broke date's --date=DATE option on systems
|
||||
like SunOS4.
|
||||
* expr treats unadorned ? and + as literals. To make expr treat them as
|
||||
operators you have to use \? and \+.
|
||||
|
||||
Changes in release 1.13
|
||||
* two patches for ISC
|
||||
* Regenerate all Makefile.in using a patched version of automake-1.1l.
|
||||
|
||||
@@ -1,3 +1,14 @@
|
||||
Wed Jan 8 16:38:24 1997 Jim Meyering <meyering@na-net.ornl.gov>
|
||||
|
||||
* lib/getopt.c (_getopt_internal): Use `_', rather than the
|
||||
(sometimes-)expansion `gettext'.
|
||||
|
||||
Tue Jan 7 22:50:13 1997 Jim Meyering <meyering@na-net.ornl.gov>
|
||||
|
||||
* lib/getopt.c: New (more POSIX compliant) version from GNU libc.
|
||||
[_]: Define to gettext also if ENABLE_NLS is defined.
|
||||
This is temporary.
|
||||
|
||||
Thu Jan 2 21:17:50 1997 Jim Meyering <meyering@na-net.ornl.gov>
|
||||
|
||||
* src/pr.c (init_fps): Initialize lines_stored field in three places.
|
||||
|
||||
@@ -1,10 +1,7 @@
|
||||
Changes in release 1.21
|
||||
[1.20b]
|
||||
* Using --program-prefix no longer applies the prefix twice
|
||||
|
||||
Changes in release 1.20
|
||||
Changes in test release 1.19r
|
||||
* see ChangeLog
|
||||
Changes in test release 1.19q
|
||||
* fix pr: -l now uses total number of lines per page also with -f
|
||||
* fix pr: use left-hand-side truncation of header string to avoid line
|
||||
overflow
|
||||
|
||||
56
src/ls.c
56
src/ls.c
@@ -131,7 +131,6 @@ struct bin_str
|
||||
};
|
||||
|
||||
#ifndef STDC_HEADERS
|
||||
char *ctime ();
|
||||
time_t time ();
|
||||
void free ();
|
||||
#endif
|
||||
@@ -2035,18 +2034,20 @@ print_current_files (void)
|
||||
static void
|
||||
print_long_format (const struct fileinfo *f)
|
||||
{
|
||||
char modebuf[20];
|
||||
#define TIMEBUF_SIZE 40
|
||||
char timebuf[TIMEBUF_SIZE];
|
||||
char modebuf[11];
|
||||
|
||||
/* 7 fields that may (worst case: 64-bit integral values) require 20 bytes,
|
||||
1 10-character mode string,
|
||||
1 24-character time string,
|
||||
9 spaces, one following each of these fields,
|
||||
and 1 trailing NUL byte. */
|
||||
char bigbuf[7 * 20 + 10 + 24 + 9 + 1];
|
||||
1 10-byte mode string,
|
||||
1 24-byte time string (may be longer in some locales -- see below),
|
||||
9 spaces, one following each of these fields, and
|
||||
1 trailing NUL byte. */
|
||||
char init_bigbuf[7 * 20 + 10 + 24 + 9 + 1];
|
||||
char *buf = init_bigbuf;
|
||||
size_t bufsize = sizeof (init_bigbuf);
|
||||
size_t s;
|
||||
char *p;
|
||||
time_t when;
|
||||
const char *fmt;
|
||||
|
||||
#ifdef HAVE_ST_DM_MODE
|
||||
mode_string (f->stat.st_dm_mode, modebuf);
|
||||
@@ -2069,12 +2070,10 @@ print_long_format (const struct fileinfo *f)
|
||||
break;
|
||||
}
|
||||
|
||||
/* Use strftime rather than ctime, because the former can produce
|
||||
locale-dependent names for the weekday (%a) and month (%b). */
|
||||
strftime (timebuf, TIMEBUF_SIZE, "%a %b %d %H:%M:%S %Y", localtime (&when));
|
||||
|
||||
if (full_time)
|
||||
timebuf[24] = '\0';
|
||||
{
|
||||
fmt = "%a %b %d %H:%M:%S %Y";
|
||||
}
|
||||
else
|
||||
{
|
||||
if (current_time > when + 6L * 30L * 24L * 60L * 60L /* Old. */
|
||||
@@ -2086,12 +2085,15 @@ print_long_format (const struct fileinfo *f)
|
||||
Allow a 1 hour slop factor for what is considered "the future",
|
||||
to allow for NFS server/client clock disagreement.
|
||||
Show the year instead of the time of day. */
|
||||
strcpy (timebuf + 11, timebuf + 19);
|
||||
fmt = "%b %e %Y";
|
||||
}
|
||||
else
|
||||
{
|
||||
fmt = "%b %e %H:%M";
|
||||
}
|
||||
timebuf[16] = 0;
|
||||
}
|
||||
|
||||
p = bigbuf;
|
||||
p = buf;
|
||||
|
||||
if (print_inode)
|
||||
{
|
||||
@@ -2134,11 +2136,25 @@ print_long_format (const struct fileinfo *f)
|
||||
sprintf (p, "%8lu ", (unsigned long) f->stat.st_size);
|
||||
p += strlen (p);
|
||||
|
||||
sprintf (p, "%s ", full_time ? timebuf : timebuf + 4);
|
||||
p += strlen (p);
|
||||
/* Use strftime rather than ctime, because the former can produce
|
||||
locale-dependent names for the weekday (%a) and month (%b). */
|
||||
|
||||
while (! (s = strftime (p, buf + bufsize - p, fmt, localtime (&when))))
|
||||
{
|
||||
char *newbuf = (char *) alloca (bufsize *= 2);
|
||||
memcpy (newbuf, buf, p - buf);
|
||||
p = newbuf + (p - buf);
|
||||
buf = newbuf;
|
||||
}
|
||||
|
||||
p += s;
|
||||
*p++ = ' ';
|
||||
|
||||
/* NUL-terminate the string -- fputs (via FPUTS) requires it. */
|
||||
*p = '\0';
|
||||
|
||||
DIRED_INDENT ();
|
||||
FPUTS (bigbuf, stdout, p - bigbuf);
|
||||
FPUTS (buf, stdout, p - buf);
|
||||
PUSH_CURRENT_DIRED_POS (&dired_obstack);
|
||||
print_name_with_quoting (f->name, f->stat.st_mode, f->linkok);
|
||||
PUSH_CURRENT_DIRED_POS (&dired_obstack);
|
||||
|
||||
26
src/nice.c
26
src/nice.c
@@ -59,6 +59,7 @@ main (int argc, char **argv)
|
||||
int adjustment = 0;
|
||||
int minusflag = 0;
|
||||
int adjustment_given = 0;
|
||||
int i;
|
||||
|
||||
program_name = argv[0];
|
||||
setlocale (LC_ALL, "");
|
||||
@@ -67,11 +68,9 @@ main (int argc, char **argv)
|
||||
|
||||
parse_long_options (argc, argv, "nice", GNU_PACKAGE, VERSION, usage);
|
||||
|
||||
for (optind = 1; optind < argc; /* empty */)
|
||||
for (i = 1; i < argc; /* empty */)
|
||||
{
|
||||
char *s;
|
||||
|
||||
s = argv[optind];
|
||||
char *s = argv[i];
|
||||
|
||||
if (s[0] == '-' && s[1] == '-' && ISDIGIT (s[2]))
|
||||
{
|
||||
@@ -82,7 +81,7 @@ main (int argc, char **argv)
|
||||
/* FIXME: use xstrtol */
|
||||
adjustment = atoi (&s[2]);
|
||||
adjustment_given = 1;
|
||||
++optind;
|
||||
++i;
|
||||
}
|
||||
else if (s[0] == '-' && (ISDIGIT (s[1])
|
||||
|| (s[1] == '+' && ISDIGIT (s[2]))))
|
||||
@@ -96,12 +95,17 @@ main (int argc, char **argv)
|
||||
/* FIXME: use xstrtol */
|
||||
adjustment = atoi (&s[1]);
|
||||
adjustment_given = 1;
|
||||
++optind;
|
||||
++i;
|
||||
}
|
||||
else
|
||||
{
|
||||
int optc;
|
||||
if ((optc = getopt_long (argc, argv, "+n:",
|
||||
char **fake_argv = argv + i - 1;
|
||||
|
||||
/* Initialize getopt_long's internal state. */
|
||||
optind = 0;
|
||||
|
||||
if ((optc = getopt_long (argc - (i - 1), fake_argv, "+n:",
|
||||
longopts, (int *) 0)) != EOF)
|
||||
{
|
||||
switch (optc)
|
||||
@@ -121,6 +125,8 @@ main (int argc, char **argv)
|
||||
}
|
||||
}
|
||||
|
||||
i += optind - 1;
|
||||
|
||||
if (optc == EOF)
|
||||
break;
|
||||
}
|
||||
@@ -131,7 +137,7 @@ main (int argc, char **argv)
|
||||
if (!adjustment_given)
|
||||
adjustment = 10;
|
||||
|
||||
if (optind == argc)
|
||||
if (i == argc)
|
||||
{
|
||||
if (adjustment_given)
|
||||
{
|
||||
@@ -158,8 +164,8 @@ main (int argc, char **argv)
|
||||
#endif
|
||||
error (1, errno, _("cannot set priority"));
|
||||
|
||||
execvp (argv[optind], &argv[optind]);
|
||||
error (errno == ENOENT ? 127 : 126, errno, "%s", argv[optind]);
|
||||
execvp (argv[i], &argv[i]);
|
||||
error (errno == ENOENT ? 127 : 126, errno, "%s", argv[i]);
|
||||
}
|
||||
|
||||
/* Return nonzero if S represents a (possibly signed) decimal integer,
|
||||
|
||||
Reference in New Issue
Block a user