change.c (schily-2021-08-14.tar.bz2) | : | change.c (schily-2021-09-18.tar.bz2) | ||
---|---|---|---|---|
/* @(#)change.c 1.45 18/09/27 Copyright 1985, 87-90, 95-99, 2000-2018 J. Schilling */ | /* @(#)change.c 1.47 21/08/20 Copyright 1985, 87-90, 95-99, 2000-2021 J. Schilling */ | |||
#include <schily/mconfig.h> | #include <schily/mconfig.h> | |||
#ifndef lint | #ifndef lint | |||
static UConst char sccsid[] = | static UConst char sccsid[] = | |||
"@(#)change.c 1.45 18/09/27 Copyright 1985, 87-90, 95-99, 2000-2018 J. Schilling"; | "@(#)change.c 1.47 21/08/20 Copyright 1985, 87-90, 95-99, 2000-2021 J. Schilling"; | |||
#endif | #endif | |||
/* | /* | |||
* find pattern and substitute in files | * find pattern and substitute in files | |||
* | * | |||
* Copyright (c) 1985, 87-90, 95-99, 2000-2018 J. Schilling | * Copyright (c) 1985, 87-90, 95-99, 2000-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 | |||
* http://www.opensource.org/licenses/cddl1.txt | * http://www.opensource.org/licenses/cddl1.txt | |||
skipping to change at line 40 | skipping to change at line 40 | |||
#include <schily/string.h> | #include <schily/string.h> | |||
#include <schily/errno.h> | #include <schily/errno.h> | |||
#include <schily/stat.h> | #include <schily/stat.h> | |||
# define STATBUF struct stat | # define STATBUF struct stat | |||
# define file_ino(sp) ((sp)->st_ino) | # define file_ino(sp) ((sp)->st_ino) | |||
# define file_dev(sp) ((sp)->st_dev) | # define file_dev(sp) ((sp)->st_dev) | |||
#include <schily/signal.h> | #include <schily/signal.h> | |||
#include <schily/standard.h> | #include <schily/standard.h> | |||
#include <schily/patmatch.h> | #include <schily/patmatch.h> | |||
#include <schily/utypes.h> | #include <schily/utypes.h> | |||
#define GT_COMERR /* #define comerr gtcomerr */ | ||||
#define GT_ERROR /* #define error gterror */ | ||||
#include <schily/schily.h> | #include <schily/schily.h> | |||
#include <schily/libport.h> | #include <schily/libport.h> | |||
#include <schily/nlsdefs.h> | ||||
/* | /* | |||
* check for same file descriptor | * check for same file descriptor | |||
*/ | */ | |||
#define samefile(sp, sp2) (file_dev(sp1) == file_dev(sp2) && file_i no(sp1) == file_ino(sp2)) | #define samefile(sp, sp2) (file_dev(sp1) == file_dev(sp2) && file_i no(sp1) == file_ino(sp2)) | |||
#ifndef MAXLINE | #ifndef MAXLINE | |||
#define MAXLINE 8196 | #define MAXLINE 8196 | |||
#endif | #endif | |||
#define LINEINCR 1024 | #define LINEINCR 1024 | |||
skipping to change at line 136 | skipping to change at line 139 | |||
int cnt; | int cnt; | |||
char *opt = "help,version,v,c,i,#,nobak,n"; | char *opt = "help,version,v,c,i,#,nobak,n"; | |||
BOOL help = FALSE; | BOOL help = FALSE; | |||
BOOL prversion = FALSE; | BOOL prversion = FALSE; | |||
BOOL closeok; | BOOL closeok; | |||
int cac; | int cac; | |||
char * const *cav; | char * const *cav; | |||
save_args(ac, av); | save_args(ac, av); | |||
(void) setlocale(LC_ALL, ""); | ||||
#ifdef USE_NLS | ||||
#if !defined(TEXT_DOMAIN) /* Should be defined by cc -D */ | ||||
#define TEXT_DOMAIN "change" /* 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 */ | ||||
#ifdef SIGHUP | #ifdef SIGHUP | |||
signal(SIGHUP, intr); | signal(SIGHUP, intr); | |||
#endif | #endif | |||
#ifdef SIGINT | #ifdef SIGINT | |||
signal(SIGINT, intr); | signal(SIGINT, intr); | |||
#endif | #endif | |||
#ifdef SIGTERM | #ifdef SIGTERM | |||
signal(SIGTERM, intr); | signal(SIGTERM, intr); | |||
#endif | #endif | |||
skipping to change at line 159 | skipping to change at line 183 | |||
if (getallargs(&cac, &cav, opt, | if (getallargs(&cac, &cav, opt, | |||
&help, &prversion, | &help, &prversion, | |||
&Vflag, &Cflag, &Iflag, | &Vflag, &Cflag, &Iflag, | |||
&CHcnt, | &CHcnt, | |||
&Nflag, &Nflag) < 0) { | &Nflag, &Nflag) < 0) { | |||
error("Bad flag: '%s'\n", cav[0]); | error("Bad flag: '%s'\n", cav[0]); | |||
usage(EX_BAD); | usage(EX_BAD); | |||
} | } | |||
if (help) usage(0); | if (help) usage(0); | |||
if (prversion) { | if (prversion) { | |||
printf("Change release %s %s (%s-%s-%s) Copyright (C) 1985, 87-90 | gtprintf("Change release %s %s (%s-%s-%s) Copyright (C) 1985, 87- | |||
, 95-99, 2000-2018 Jörg Schilling\n", | 90, 95-99, 2000-2021 %s\n", | |||
"1.45", "2018/09/27", | "1.47", "2021/08/20", | |||
HOST_CPU, HOST_VENDOR, HOST_OS); | HOST_CPU, HOST_VENDOR, HOST_OS, | |||
_("Jörg Schilling")); | ||||
exit(0); | exit(0); | |||
} | } | |||
if (Iflag) Cflag = 0; | if (Iflag) Cflag = 0; | |||
cac = ac; | cac = ac; | |||
cav = av; | cav = av; | |||
if (getfiles(&cac, &cav, opt) <= 0) { | if (getfiles(&cac, &cav, opt) <= 0) { | |||
error("No pattern or substitution given.\n"); | error("No pattern or substitution given.\n"); | |||
usage(EX_BAD); | usage(EX_BAD); | |||
End of changes. 7 change blocks. | ||||
7 lines changed or deleted | 32 lines changed or added |