fifo_main.c (schily-2021-08-14.tar.bz2) | : | fifo_main.c (schily-2021-09-18.tar.bz2) | ||
---|---|---|---|---|
/* @(#)fifo_main.c 1.3 20/07/08 Copyright 1989, 2019-2020 J. Schilling */ | /* @(#)fifo_main.c 1.5 21/08/20 Copyright 1989, 2019-2021 J. Schilling */ | |||
#include <schily/mconfig.h> | #include <schily/mconfig.h> | |||
#ifndef lint | #ifndef lint | |||
static UConst char sccsid[] = | static UConst char sccsid[] = | |||
"@(#)fifo_main.c 1.3 20/07/08 Copyright 1989, 2019-2020 J. Schilli ng"; | "@(#)fifo_main.c 1.5 21/08/20 Copyright 1989, 2019-2021 J. Schilli ng"; | |||
#endif | #endif | |||
/* | /* | |||
* Copyright (c) 1989, 2019-2020 J. Schilling | * Copyright (c) 1989, 2019-2021 J. Schilling | |||
* | * | |||
*/ | */ | |||
/* | /* | |||
* The contents of this file are subject to the terms of the | * The contents of this file are subject to the terms of the | |||
* Common Development and Distribution License, Version 1.0 only | * Common Development and Distribution License, Version 1.0 only | |||
* (the "License"). You may not use this file except in compliance | * (the "License"). You may not use this file except in compliance | |||
* with the License. | * with the License. | |||
* | * | |||
* See the file CDDL.Schily.txt in this distribution for details. | * See the file CDDL.Schily.txt in this distribution for details. | |||
* A copy of the CDDL is also available via the Internet at | * A copy of the CDDL is also available via the Internet at | |||
skipping to change at line 33 | skipping to change at line 33 | |||
*/ | */ | |||
#include <schily/stdlib.h> | #include <schily/stdlib.h> | |||
#include <schily/unistd.h> | #include <schily/unistd.h> | |||
#include <schily/limits.h> | #include <schily/limits.h> | |||
#include <schily/stat.h> | #include <schily/stat.h> | |||
#include <schily/signal.h> | #include <schily/signal.h> | |||
#include <schily/wait.h> | #include <schily/wait.h> | |||
#include <schily/errno.h> | #include <schily/errno.h> | |||
#include <schily/nlsdefs.h> | #include <schily/nlsdefs.h> | |||
#define GT_COMERR /* #define comerr gtcomerr */ | ||||
#define GT_ERROR /* #define error gterror */ | ||||
#include <schily/schily.h> | #include <schily/schily.h> | |||
#include <schily/nlsdefs.h> | ||||
#include "star.h" | #include "star.h" | |||
#include "starsubs.h" | #include "starsubs.h" | |||
#include "fifo.h" | #include "fifo.h" | |||
#ifndef PIPE_BUF | #ifndef PIPE_BUF | |||
#define PIPE_BUF 4096 | #define PIPE_BUF 4096 | |||
#endif | #endif | |||
/* BEGIN CSTYLED */ | /* BEGIN CSTYLED */ | |||
char options[] = | char options[] = | |||
skipping to change at line 90 | skipping to change at line 93 | |||
GINFO *grip = &_grinfo; /* Global read info pointer */ | GINFO *grip = &_grinfo; /* Global read info pointer */ | |||
long bufsize = 0; /* Available buffer size */ | long bufsize = 0; /* Available buffer size */ | |||
char *bigbuf = NULL; | char *bigbuf = NULL; | |||
char *bigptr = NULL; | char *bigptr = NULL; | |||
LOCAL void | LOCAL void | |||
usage(exitcode) | usage(exitcode) | |||
int exitcode; | int exitcode; | |||
{ | { | |||
gterror("Usage: fifo [options]\n"); | error("Usage: fifo [options]\n"); | |||
gterror("Options:\n"); | error("Options:\n"); | |||
gterror(" fs=# set fifo size to #\n"); | error(" fs=# set fifo size to #\n"); | |||
gterror(" bs=# set buffer size to #\n"); | error(" bs=# set buffer size to #\n"); | |||
gterror(" ibs=# set input buffer size to #\n"); | error(" ibs=# set input buffer size to #\n"); | |||
gterror(" obs=# set output buffer size to #\n"); | error(" obs=# set output buffer size to #\n"); | |||
gterror(" -no-statistics do not print fifo statistics\n"); | error(" -no-statistics do not print fifo statistics\n"); | |||
gterror(" -help print this help\n"); | error(" -help print this help\n"); | |||
gterror(" -debug print additional debug messages\n"); | error(" -debug print additional debug messages\n"); | |||
gterror(" -version print version information and exit\n"); | error(" -version print version information and exit\n"); | |||
exit(exitcode); | exit(exitcode); | |||
} | } | |||
EXPORT void | EXPORT void | |||
set_signal(sig, handler) | set_signal(sig, handler) | |||
int sig; | int sig; | |||
RETSIGTYPE (*handler) __PR((int)); | RETSIGTYPE (*handler) __PR((int)); | |||
{ | { | |||
#if defined(HAVE_SIGPROCMASK) && defined(SA_RESTART) | #if defined(HAVE_SIGPROCMASK) && defined(SA_RESTART) | |||
skipping to change at line 144 | skipping to change at line 147 | |||
{ | { | |||
int cac; | int cac; | |||
char *const *cav; | char *const *cav; | |||
BOOL help = FALSE; | BOOL help = FALSE; | |||
BOOL prvers = FALSE; | BOOL prvers = FALSE; | |||
save_args(ac, av); | save_args(ac, av); | |||
(void) setlocale(LC_ALL, ""); | (void) setlocale(LC_ALL, ""); | |||
#ifdef USE_NLS | ||||
#if !defined(TEXT_DOMAIN) /* Should be defined by cc -D */ | ||||
#define TEXT_DOMAIN "fifo" /* Use this only if it weren't */ | ||||
#endif | ||||
{ char *dir; | ||||
dir = searchfileinpath("share/locale", F_OK, | ||||
SIP_ANY_FILE|SIP_NO_PATH, NULL); | ||||
if (dir) | ||||
(void) bindtextdomain(TEXT_DOMAIN, dir); | ||||
else | ||||
#if defined(PROTOTYPES) && defined(INS_BASE) | ||||
(void) bindtextdomain(TEXT_DOMAIN, INS_BASE "/share/locale"); | ||||
#else | ||||
(void) bindtextdomain(TEXT_DOMAIN, "/usr/share/locale"); | ||||
#endif | ||||
(void) textdomain(TEXT_DOMAIN); | ||||
} | ||||
#endif /* USE_NLS */ | ||||
cac = --ac; | cac = --ac; | |||
cav = ++av; | cav = ++av; | |||
if (getallargs(&cac, &cav, options, &help, &prvers, | if (getallargs(&cac, &cav, options, &help, &prvers, | |||
&debug, &no_stats, | &debug, &no_stats, | |||
getenum, &bs, | getenum, &bs, | |||
getenum, &ibs, | getenum, &ibs, | |||
getenum, &obs, | getenum, &obs, | |||
getenum, &fs) < 0) { | getenum, &fs) < 0) { | |||
errmsgno(EX_BAD, "Bad flag: %s.\n", cav[0]); | errmsgno(EX_BAD, "Bad flag: %s.\n", cav[0]); | |||
skipping to change at line 165 | skipping to change at line 187 | |||
} | } | |||
cac = ac; | cac = ac; | |||
cav = av; | cav = av; | |||
if (getfiles(&cac, &cav, options) > 0) | if (getfiles(&cac, &cav, options) > 0) | |||
comerrno(EX_BAD, "Too many args.\n"); | comerrno(EX_BAD, "Too many args.\n"); | |||
if (help) | if (help) | |||
usage(0); | usage(0); | |||
if (prvers) { | if (prvers) { | |||
/* BEGIN CSTYLED */ | /* BEGIN CSTYLED */ | |||
printf("fifo %s %s (%s-%s-%s)\n\n", "2.0", "2020/07/08", HOST_CPU | gtprintf("fifo %s %s (%s-%s-%s)\n\n", "2.0", "2021/08/20", HOST_C | |||
, HOST_VENDOR, HOST_OS); | PU, HOST_VENDOR, HOST_OS); | |||
printf("Copyright (C) 1989, 2019-2020 Jörg Schilling\n"); | gtprintf("Copyright (C) 1989, 2019-2021 %s\n", _("Jörg Schilling" | |||
printf("This is free software; see the source for copying conditi | )); | |||
ons. There is NO\n"); | gtprintf("This is free software; see the source for copying condi | |||
printf("warranty; not even for MERCHANTABILITY or FITNESS FOR A P | tions. There is NO\n"); | |||
ARTICULAR PURPOSE.\n"); | gtprintf("warranty; not even for MERCHANTABILITY or FITNESS FOR A | |||
PARTICULAR PURPOSE.\n"); | ||||
/* END CSTYLED */ | /* END CSTYLED */ | |||
exit(0); | exit(0); | |||
} | } | |||
if (bs == 0) | if (bs == 0) | |||
bs = 512; | bs = 512; | |||
if (ibs == 0) { | if (ibs == 0) { | |||
if (ispipe(STDIN_FILENO)) | if (ispipe(STDIN_FILENO)) | |||
ibs = PIPE_BUF; | ibs = PIPE_BUF; | |||
else | else | |||
ibs = bs; | ibs = bs; | |||
End of changes. 8 change blocks. | ||||
20 lines changed or deleted | 43 lines changed or added |