1
0
mirror of git://git.sv.gnu.org/coreutils.git synced 2026-04-21 03:12:48 +02:00

merge with 1.8.1b

This commit is contained in:
Jim Meyering
1993-10-12 01:52:24 +00:00
parent f12b53b2ce
commit 87fa23e641
21 changed files with 372 additions and 84 deletions

View File

@@ -21,7 +21,9 @@
#include <sys/types.h>
#include <signal.h>
#include <getopt.h>
#include "system.h"
#include "version.h"
char *xmalloc ();
void error ();
@@ -38,13 +40,31 @@ static int ignore_interrupts;
/* The name that this program was run with. */
char *program_name;
/* If non-zero, display usage information and exit. */
static int show_help;
/* If non-zero, print the version on standard output and exit. */
static int show_version;
static struct option const long_options[] =
{
{"append", no_argument, NULL, 'a'},
{"help", no_argument, &show_help, 1},
{"ignore-interrupts", no_argument, NULL, 'i'},
{"version", no_argument, &show_version, 1},
{NULL, 0, NULL, 0}
};
static void
usage ()
{
fprintf (stderr, "\
Usage: %s [{--help,--version}] [-ai] [--append]\n\
[--ignore-interrupts] [file...]\n",
program_name);
exit (1);
}
void
main (argc, argv)
int argc;
@@ -62,20 +82,31 @@ main (argc, argv)
{
switch (optc)
{
case 0:
break;
case 'a':
append = 1;
break;
case 'i':
ignore_interrupts = 1;
break;
default:
fprintf (stderr, "\
Usage: %s [-ai] [--append] [--ignore-interrupts] [file...]\n",
program_name);
exit (1);
usage ();
}
}
if (show_version)
{
printf ("%s\n", version_string);
exit (0);
}
if (show_help)
usage ();
if (ignore_interrupts)
{
#ifdef _POSIX_VERSION