Remove trailing whitespace.
Reviewed by: phk
This commit is contained in:
parent
236bb30377
commit
2162b2d226
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=8855
34
bin/cp/cp.c
34
bin/cp/cp.c
@ -33,7 +33,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id: cp.c,v 1.4 1995/01/25 07:31:01 davidg Exp $
|
||||
* $Id: cp.c,v 1.5 1995/04/02 00:49:16 bde Exp $
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
@ -48,11 +48,11 @@ static char sccsid[] = "@(#)cp.c 8.2 (Berkeley) 4/1/94";
|
||||
|
||||
/*
|
||||
* Cp copies source files to target files.
|
||||
*
|
||||
*
|
||||
* The global PATH_T structure "to" always contains the path to the
|
||||
* current target file. Since fts(3) does not change directories,
|
||||
* this path can be either absolute or dot-realative.
|
||||
*
|
||||
*
|
||||
* The basic algorithm is to initialize "to" and use fts(3) to traverse
|
||||
* the file hierarchy rooted in the argument list. A trivial case is the
|
||||
* case of 'cp file1 file2'. The more interesting case is the case of
|
||||
@ -105,7 +105,7 @@ main(argc, argv)
|
||||
char *target;
|
||||
|
||||
Hflag = Lflag = Pflag = Rflag = 0;
|
||||
while ((ch = getopt(argc, argv, "HLPRfipr")) != EOF)
|
||||
while ((ch = getopt(argc, argv, "HLPRfipr")) != EOF)
|
||||
switch (ch) {
|
||||
case 'H':
|
||||
Hflag = 1;
|
||||
@ -188,8 +188,8 @@ main(argc, argv)
|
||||
to.target_end = to.p_end;
|
||||
|
||||
/* Set end of argument list for fts(3). */
|
||||
argv[argc] = NULL;
|
||||
|
||||
argv[argc] = NULL;
|
||||
|
||||
/*
|
||||
* Cp has two distinct cases:
|
||||
*
|
||||
@ -210,7 +210,7 @@ main(argc, argv)
|
||||
if (r == -1 || !S_ISDIR(to_stat.st_mode)) {
|
||||
/*
|
||||
* Case (1). Target is not a directory.
|
||||
*/
|
||||
*/
|
||||
if (argc > 1) {
|
||||
usage();
|
||||
exit(1);
|
||||
@ -227,7 +227,7 @@ main(argc, argv)
|
||||
stat(*argv, &tmp_stat);
|
||||
else
|
||||
lstat(*argv, &tmp_stat);
|
||||
|
||||
|
||||
if (S_ISDIR(tmp_stat.st_mode) && (Rflag || rflag))
|
||||
type = DIR_TO_DNE;
|
||||
else
|
||||
@ -274,8 +274,8 @@ copy(argv, type, fts_options)
|
||||
}
|
||||
|
||||
/*
|
||||
* If we are in case (2) or (3) above, we need to append the
|
||||
* source name to the target name.
|
||||
* If we are in case (2) or (3) above, we need to append the
|
||||
* source name to the target name.
|
||||
*/
|
||||
if (type != FILE_TO_FILE) {
|
||||
/*
|
||||
@ -300,10 +300,10 @@ copy(argv, type, fts_options)
|
||||
if (curr->fts_level == FTS_ROOTLEVEL)
|
||||
if (type != DIR_TO_DNE) {
|
||||
p = strrchr(curr->fts_path, '/');
|
||||
base = (p == NULL) ? 0 :
|
||||
base = (p == NULL) ? 0 :
|
||||
(int)(p - curr->fts_path + 1);
|
||||
|
||||
if (!strcmp(&curr->fts_path[base],
|
||||
if (!strcmp(&curr->fts_path[base],
|
||||
".."))
|
||||
base += 1;
|
||||
} else
|
||||
@ -316,7 +316,7 @@ copy(argv, type, fts_options)
|
||||
*target_mid++ = '/';
|
||||
*target_mid = 0;
|
||||
if (target_mid - to.p_path + nlen > MAXPATHLEN) {
|
||||
warnx("%s%s: name too long (not copied)",
|
||||
warnx("%s%s: name too long (not copied)",
|
||||
to.p_path, p);
|
||||
rval = 1;
|
||||
continue;
|
||||
@ -365,7 +365,7 @@ copy(argv, type, fts_options)
|
||||
* umask blocks owner writes, we fail..
|
||||
*/
|
||||
if (dne) {
|
||||
if (mkdir(to.p_path,
|
||||
if (mkdir(to.p_path,
|
||||
curr->fts_statp->st_mode | S_IRWXU) < 0)
|
||||
err(1, "%s", to.p_path);
|
||||
} else if (!S_ISDIR(to_stat.st_mode)) {
|
||||
@ -374,14 +374,14 @@ copy(argv, type, fts_options)
|
||||
}
|
||||
/*
|
||||
* If not -p and directory didn't exist, set it to be
|
||||
* the same as the from directory, umodified by the
|
||||
* umask; arguably wrong, but it's been that way
|
||||
* the same as the from directory, umodified by the
|
||||
* umask; arguably wrong, but it's been that way
|
||||
* forever.
|
||||
*/
|
||||
if (pflag && setfile(curr->fts_statp, 0))
|
||||
rval = 1;
|
||||
else if (dne)
|
||||
(void)chmod(to.p_path,
|
||||
(void)chmod(to.p_path,
|
||||
curr->fts_statp->st_mode);
|
||||
break;
|
||||
case S_IFBLK:
|
||||
|
@ -30,7 +30,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id$
|
||||
* $Id: utils.c,v 1.2 1994/09/24 02:53:42 davidg Exp $
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
@ -64,7 +64,7 @@ copy_file(entp, dne)
|
||||
#ifdef VM_AND_BUFFER_CACHE_SYNCHRONIZED
|
||||
char *p;
|
||||
#endif
|
||||
|
||||
|
||||
if ((from_fd = open(entp->fts_path, O_RDONLY, 0)) == -1) {
|
||||
warn("%s", entp->fts_path);
|
||||
return (1);
|
||||
|
@ -30,7 +30,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id: alloc.c,v 1.2 1994/09/24 02:53:45 davidg Exp $
|
||||
* $Id: alloc.c,v 1.3 1995/03/19 13:28:10 joerg Exp $
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
@ -122,6 +122,6 @@ showall(v, t)
|
||||
{
|
||||
memtop = (char *) sbrk(0);
|
||||
(void) fprintf(cshout, "Allocated memory from 0x%lx to 0x%lx (%ld).\n",
|
||||
(unsigned long) membot, (unsigned long) memtop,
|
||||
(unsigned long) membot, (unsigned long) memtop,
|
||||
(unsigned long) (memtop - membot));
|
||||
}
|
||||
|
@ -30,7 +30,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id$
|
||||
* $Id: const.c,v 1.2 1994/09/24 02:53:48 davidg Exp $
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
@ -72,7 +72,7 @@ Char STRcent2[] = { '%', '%', '\0' };
|
||||
Char STRcenthash[] = { '%', '#', '\0' };
|
||||
Char STRcentplus[] = { '%', '+', '\0' };
|
||||
Char STRcentminus[] = { '%', '-', '\0' };
|
||||
Char STRchase_symlinks[] = { 'c', 'h', 'a', 's', 'e', '_', 's', 'y', 'm', 'l',
|
||||
Char STRchase_symlinks[] = { 'c', 'h', 'a', 's', 'e', '_', 's', 'y', 'm', 'l',
|
||||
'i', 'n', 'k', 's', '\0' };
|
||||
Char STRchild[] = { 'c', 'h', 'i', 'l', 'd', '\0' };
|
||||
Char STRcolon[] = { ':', '\0' };
|
||||
@ -90,7 +90,7 @@ Char STRfignore[] = { 'f', 'i', 'g', 'n', 'o', 'r', 'e', '\0' };
|
||||
Char STRfilec[] = { 'f', 'i', 'l', 'e', 'c', '\0' };
|
||||
#endif /* FILEC */
|
||||
Char STRhistchars[] = { 'h', 'i', 's', 't', 'c', 'h', 'a', 'r', 's', '\0' };
|
||||
Char STRtildothist[] = { '~', '/', '.', 'h', 'i', 's', 't', 'o', 'r',
|
||||
Char STRtildothist[] = { '~', '/', '.', 'h', 'i', 's', 't', 'o', 'r',
|
||||
'y', '\0' };
|
||||
Char STRhistfile[] = { 'h', 'i', 's', 't', 'f', 'i', 'l', 'e', '\0' };
|
||||
Char STRhistory[] = { 'h', 'i', 's', 't', 'o', 'r', 'y', '\0' };
|
||||
@ -109,7 +109,7 @@ Char STRml[] = { '-', 'l', '\0' };
|
||||
Char STRmn[] = { '-', 'n', '\0' };
|
||||
Char STRmquestion[] = { '?' | QUOTE, ' ', '\0' };
|
||||
Char STRnice[] = { 'n', 'i', 'c', 'e', '\0' };
|
||||
Char STRnoambiguous[] = { 'n', 'o', 'a', 'm', 'b', 'i', 'g', 'u', 'o', 'u',
|
||||
Char STRnoambiguous[] = { 'n', 'o', 'a', 'm', 'b', 'i', 'g', 'u', 'o', 'u',
|
||||
's', '\0' };
|
||||
Char STRnobeep[] = { 'n', 'o', 'b', 'e', 'e', 'p', '\0' };
|
||||
Char STRnoclobber[] = { 'n', 'o', 'c', 'l', 'o', 'b', 'b', 'e', 'r', '\0' };
|
||||
@ -121,7 +121,7 @@ Char STRnotify[] = { 'n', 'o', 't', 'i', 'f', 'y', '\0' };
|
||||
Char STRor[] = { '|', '\0' };
|
||||
Char STRor2[] = { '|', '|', '\0' };
|
||||
Char STRpath[] = { 'p', 'a', 't', 'h', '\0' };
|
||||
Char STRprintexitvalue[] = { 'p', 'r', 'i', 'n', 't', 'e', 'x', 'i', 't', 'v',
|
||||
Char STRprintexitvalue[] = { 'p', 'r', 'i', 'n', 't', 'e', 'x', 'i', 't', 'v',
|
||||
'a', 'l', 'u', 'e', '\0' };
|
||||
Char STRprompt[] = { 'p', 'r', 'o', 'm', 'p', 't', '\0' };
|
||||
Char STRprompt2[] = { 'p', 'r', 'o', 'm', 'p', 't', '2', '\0' };
|
||||
|
@ -30,7 +30,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id$
|
||||
* $Id: csh.c,v 1.2 1994/09/24 02:53:51 davidg Exp $
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
@ -618,7 +618,7 @@ importpath(cp)
|
||||
for (;;) {
|
||||
if ((c = *dp) == ':' || c == 0) {
|
||||
*dp = 0;
|
||||
if ((*cp != '/' || *cp == '\0') && (euid == 0 || uid == 0))
|
||||
if ((*cp != '/' || *cp == '\0') && (euid == 0 || uid == 0))
|
||||
(void) fprintf(csherr,
|
||||
"Warning: imported path contains relative components\n");
|
||||
pv[i++] = Strsave(*cp ? cp : STRdot);
|
||||
@ -809,7 +809,7 @@ rechist()
|
||||
(void) Strcat(buf, STRsldthist);
|
||||
}
|
||||
|
||||
if ((fp = creat(short2str(hfile), 0600)) == -1)
|
||||
if ((fp = creat(short2str(hfile), 0600)) == -1)
|
||||
return;
|
||||
|
||||
oldidfds = didfds;
|
||||
@ -873,14 +873,14 @@ int sig;
|
||||
|
||||
/*
|
||||
* We kill the last foreground process group. It then becomes
|
||||
* responsible to propagate the SIGHUP to its progeny.
|
||||
* responsible to propagate the SIGHUP to its progeny.
|
||||
*/
|
||||
{
|
||||
struct process *pp, *np;
|
||||
|
||||
for (pp = proclist.p_next; pp; pp = pp->p_next) {
|
||||
np = pp;
|
||||
/*
|
||||
/*
|
||||
* Find if this job is in the foreground. It could be that
|
||||
* the process leader has exited and the foreground flag
|
||||
* is cleared for it.
|
||||
@ -888,7 +888,7 @@ int sig;
|
||||
do
|
||||
/*
|
||||
* If a process is in the foreground; we try to kill
|
||||
* it's process group. If we succeed, then the
|
||||
* it's process group. If we succeed, then the
|
||||
* whole job is gone. Otherwise we keep going...
|
||||
* But avoid sending HUP to the shell again.
|
||||
*/
|
||||
@ -1267,9 +1267,9 @@ vis_fputc(ch, fp)
|
||||
{
|
||||
char uenc[5]; /* 4 + NULL */
|
||||
|
||||
if (ch & QUOTE)
|
||||
if (ch & QUOTE)
|
||||
return fputc(ch & TRIM, fp);
|
||||
/*
|
||||
/*
|
||||
* XXX: When we are in AsciiOnly we want all characters >= 0200 to
|
||||
* be encoded, but currently there is no way in vis to do that.
|
||||
*/
|
||||
|
@ -30,7 +30,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id$
|
||||
* $Id: dir.c,v 1.2 1994/09/24 02:53:54 davidg Exp $
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
@ -221,7 +221,7 @@ printdirs()
|
||||
}
|
||||
if (!(dirflag & DIR_LONG) && hp != NULL && !eq(hp, STRslash) &&
|
||||
(len = Strlen(hp), Strncmp(hp, dp->di_name, len) == 0) &&
|
||||
(dp->di_name[len] == '\0' || dp->di_name[len] == '/'))
|
||||
(dp->di_name[len] == '\0' || dp->di_name[len] == '/'))
|
||||
len = Strlen(s = (dp->di_name + len)) + 2;
|
||||
else
|
||||
len = Strlen(s = dp->di_name) + 1;
|
||||
|
@ -30,7 +30,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id$
|
||||
* $Id: dol.c,v 1.2 1994/09/24 02:53:56 davidg Exp $
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
@ -425,7 +425,7 @@ Dgetdol()
|
||||
if (dimen || bitset)
|
||||
stderror(ERR_SYNTAX);
|
||||
if (backpid != 0) {
|
||||
if (dolbang)
|
||||
if (dolbang)
|
||||
xfree((ptr_t) dolbang);
|
||||
setDolp(dolbang = putn(backpid));
|
||||
}
|
||||
@ -645,13 +645,13 @@ fixDolMod()
|
||||
dolwcnt = 10000;
|
||||
c = DgetC(0);
|
||||
}
|
||||
if ((c == 'g' && dolmcnt != 10000) ||
|
||||
if ((c == 'g' && dolmcnt != 10000) ||
|
||||
(c == 'a' && dolwcnt != 10000)) {
|
||||
if (c == 'g')
|
||||
dolmcnt = 10000;
|
||||
else
|
||||
dolwcnt = 10000;
|
||||
c = DgetC(0);
|
||||
c = DgetC(0);
|
||||
}
|
||||
|
||||
if (c == 's') { /* [eichin:19910926.0755EST] */
|
||||
@ -659,12 +659,12 @@ fixDolMod()
|
||||
int delim = DgetC(0);
|
||||
dolmod[dolnmod++] = c;
|
||||
dolmod[dolnmod++] = delim;
|
||||
|
||||
|
||||
if (!delim || letter(delim)
|
||||
|| Isdigit(delim) || any(" \t\n", delim)) {
|
||||
seterror(ERR_BADSUBST);
|
||||
break;
|
||||
}
|
||||
}
|
||||
while ((c = DgetC(0)) != (-1)) {
|
||||
dolmod[dolnmod++] = c;
|
||||
if(c == delim) delimcnt--;
|
||||
@ -708,7 +708,7 @@ setDolp(cp)
|
||||
Char *lhsub, *rhsub, *np;
|
||||
size_t lhlen = 0, rhlen = 0;
|
||||
int didmod = 0;
|
||||
|
||||
|
||||
delim = dolmod[++i];
|
||||
if (!delim || letter(delim)
|
||||
|| Isdigit(delim) || any(" \t\n", delim)) {
|
||||
|
@ -30,7 +30,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id$
|
||||
* $Id: exec.c,v 1.2 1994/09/24 02:53:59 davidg Exp $
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
@ -50,7 +50,7 @@ static char sccsid[] = "@(#)exec.c 8.1 (Berkeley) 5/31/93";
|
||||
# include <stdarg.h>
|
||||
#else
|
||||
# include <varargs.h>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include "csh.h"
|
||||
#include "extern.h"
|
||||
@ -696,7 +696,7 @@ tellmewhat(lex)
|
||||
if (eq(sp->word, str2short(bptr->bname))) {
|
||||
if (aliased)
|
||||
prlex(cshout, lex);
|
||||
(void) fprintf(cshout, "%s: shell built-in command.\n",
|
||||
(void) fprintf(cshout, "%s: shell built-in command.\n",
|
||||
vis_str(sp->word));
|
||||
sp->word = s0; /* we save and then restore this */
|
||||
return;
|
||||
|
@ -30,7 +30,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id$
|
||||
* $Id: file.c,v 1.2 1994/09/24 02:54:03 davidg Exp $
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
@ -521,7 +521,7 @@ tsearch(word, command, max_word_length)
|
||||
return (numitems);
|
||||
}
|
||||
else { /* LIST */
|
||||
qsort((ptr_t) items, numitems, sizeof(items[0]),
|
||||
qsort((ptr_t) items, numitems, sizeof(items[0]),
|
||||
(int (*) __P((const void *, const void *))) sortscmp);
|
||||
print_by_column(looking_for_lognames ? NULL : tilded_dir,
|
||||
items, numitems);
|
||||
|
@ -30,7 +30,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id$
|
||||
* $Id: func.c,v 1.2 1994/09/24 02:54:04 davidg Exp $
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
@ -860,12 +860,12 @@ wfree()
|
||||
if (wp->w_end.type != I_SEEK && wp->w_start.type == wp->w_end.type &&
|
||||
wp->w_start.type == o.type) {
|
||||
if (wp->w_end.type == F_SEEK) {
|
||||
if (o.f_seek >= wp->w_start.f_seek &&
|
||||
if (o.f_seek >= wp->w_start.f_seek &&
|
||||
(wp->w_end.f_seek == 0 || o.f_seek < wp->w_end.f_seek))
|
||||
break;
|
||||
}
|
||||
else {
|
||||
if (o.a_seek >= wp->w_start.a_seek &&
|
||||
if (o.a_seek >= wp->w_start.a_seek &&
|
||||
(wp->w_end.a_seek == 0 || o.a_seek < wp->w_end.a_seek))
|
||||
break;
|
||||
}
|
||||
|
@ -30,7 +30,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id$
|
||||
* $Id: glob.c,v 1.2 1994/09/24 02:54:05 davidg Exp $
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
@ -574,7 +574,7 @@ tglob(t)
|
||||
*/
|
||||
if (c == '`') {
|
||||
gflag |= G_CSH;
|
||||
while (*p && *p != '`')
|
||||
while (*p && *p != '`')
|
||||
if (*p++ == '\\') {
|
||||
if (*p) /* Quoted chars */
|
||||
p++;
|
||||
@ -806,7 +806,7 @@ pword()
|
||||
pnleft = MAXPATHLEN - 4;
|
||||
}
|
||||
|
||||
int
|
||||
int
|
||||
Gmatch(string, pattern)
|
||||
Char *string, *pattern;
|
||||
{
|
||||
@ -829,7 +829,7 @@ Gmatch(string, pattern)
|
||||
|
||||
blkfree(blk);
|
||||
return(gres == gpol);
|
||||
}
|
||||
}
|
||||
|
||||
static int
|
||||
pmatch(string, pattern)
|
||||
@ -870,7 +870,7 @@ pmatch(string, pattern)
|
||||
(*(pattern-2) & TRIM) <= stringc);
|
||||
pattern++;
|
||||
}
|
||||
else
|
||||
else
|
||||
match = (stringc == (rangec & TRIM));
|
||||
}
|
||||
if (rangec == 0)
|
||||
|
@ -30,7 +30,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id$
|
||||
* $Id: lex.c,v 1.2 1994/09/24 02:54:09 davidg Exp $
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
@ -575,12 +575,12 @@ getdol()
|
||||
int delimcnt = 2;
|
||||
int delim = getC(0);
|
||||
*np++ = delim;
|
||||
|
||||
|
||||
if (!delim || letter(delim)
|
||||
|| Isdigit(delim) || any(" \t\n", delim)) {
|
||||
seterror(ERR_BADSUBST);
|
||||
break;
|
||||
}
|
||||
}
|
||||
while ((c = getC(0)) != (-1)) {
|
||||
*np++ = c;
|
||||
if(c == delim) delimcnt--;
|
||||
@ -877,7 +877,7 @@ dosub(sc, en, global)
|
||||
|
||||
wdp = hp;
|
||||
while (--i >= 0) {
|
||||
register struct wordent *new =
|
||||
register struct wordent *new =
|
||||
(struct wordent *) xcalloc(1, sizeof *wdp);
|
||||
|
||||
new->word = 0;
|
||||
|
@ -30,7 +30,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id$
|
||||
* $Id: parse.c,v 1.2 1994/09/24 02:54:11 davidg Exp $
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
@ -52,19 +52,19 @@ static char sccsid[] = "@(#)parse.c 8.1 (Berkeley) 5/31/93";
|
||||
static void asyntax __P((struct wordent *, struct wordent *));
|
||||
static void asyn0 __P((struct wordent *, struct wordent *));
|
||||
static void asyn3 __P((struct wordent *, struct wordent *));
|
||||
static struct wordent
|
||||
static struct wordent
|
||||
*freenod __P((struct wordent *, struct wordent *));
|
||||
static struct command
|
||||
static struct command
|
||||
*syn0 __P((struct wordent *, struct wordent *, int));
|
||||
static struct command
|
||||
static struct command
|
||||
*syn1 __P((struct wordent *, struct wordent *, int));
|
||||
static struct command
|
||||
static struct command
|
||||
*syn1a __P((struct wordent *, struct wordent *, int));
|
||||
static struct command
|
||||
static struct command
|
||||
*syn1b __P((struct wordent *, struct wordent *, int));
|
||||
static struct command
|
||||
static struct command
|
||||
*syn2 __P((struct wordent *, struct wordent *, int));
|
||||
static struct command
|
||||
static struct command
|
||||
*syn3 __P((struct wordent *, struct wordent *, int));
|
||||
|
||||
#define ALEFT 21 /* max of 20 alias expansions */
|
||||
|
@ -30,7 +30,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id$
|
||||
* $Id: sem.c,v 1.2 1994/09/24 02:54:15 davidg Exp $
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
@ -438,7 +438,7 @@ execute(t, wanttty, pipein, pipeout)
|
||||
}
|
||||
/*
|
||||
* Fall through for all breaks from switch
|
||||
*
|
||||
*
|
||||
* If there will be no more executions of this command, flush all file
|
||||
* descriptors. Places that turn on the F_REPEAT bit are responsible for
|
||||
* doing donefds after the last re-execution
|
||||
@ -476,7 +476,7 @@ int i;
|
||||
*
|
||||
* I don't know what is best to do. I think that Ambiguous is better
|
||||
* than restructuring the command vector, because the user can get
|
||||
* unexpected results. In any case, the command vector restructuring
|
||||
* unexpected results. In any case, the command vector restructuring
|
||||
* code is present and the user can choose it by setting noambiguous
|
||||
*/
|
||||
static Char *
|
||||
|
@ -30,7 +30,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id$
|
||||
* $Id: set.c,v 1.2 1994/09/24 02:54:16 davidg Exp $
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
@ -664,7 +664,7 @@ exportpath(val)
|
||||
"Warning: ridiculously long PATH truncated\n");
|
||||
break;
|
||||
}
|
||||
if ((**val != '/' || **val == '\0') && (euid == 0 || uid == 0))
|
||||
if ((**val != '/' || **val == '\0') && (euid == 0 || uid == 0))
|
||||
(void) fprintf(csherr,
|
||||
"Warning: exported path contains relative components.\n");
|
||||
(void) Strcat(exppath, *val++);
|
||||
|
@ -30,7 +30,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id$
|
||||
* $Id: str.c,v 1.2 1994/09/24 02:54:18 davidg Exp $
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
@ -449,21 +449,21 @@ vis_str(cp)
|
||||
|
||||
if (cp == NULL)
|
||||
return (NULL);
|
||||
|
||||
|
||||
for (dp = cp; *dp++;)
|
||||
continue;
|
||||
n = ((dp - cp) << 2) + 1; /* 4 times + NULL */
|
||||
if (dstsize < n) {
|
||||
sdst = (char *) (dstsize ?
|
||||
sdst = (char *) (dstsize ?
|
||||
xrealloc(sdst, (size_t) n * sizeof(char)) :
|
||||
xmalloc((size_t) n * sizeof(char)));
|
||||
dstsize = n;
|
||||
}
|
||||
/*
|
||||
/*
|
||||
* XXX: When we are in AsciiOnly we want all characters >= 0200 to
|
||||
* be encoded, but currently there is no way in vis to do that.
|
||||
*/
|
||||
(void) strvis(sdst, short2str(cp), VIS_NOSLASH);
|
||||
return (sdst);
|
||||
}
|
||||
|
||||
|
||||
|
@ -30,7 +30,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id: time.c,v 1.3 1995/02/16 09:17:27 jkh Exp $
|
||||
* $Id: time.c,v 1.4 1995/03/19 13:28:12 joerg Exp $
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
@ -180,7 +180,7 @@ prusage(r0, r1, e, b)
|
||||
break;
|
||||
|
||||
case 'X': /* (average) shared text size */
|
||||
(void) fprintf(cshout, "%ld", t == 0 ? 0L :
|
||||
(void) fprintf(cshout, "%ld", t == 0 ? 0L :
|
||||
(r1->ru_ixrss - r0->ru_ixrss) / t);
|
||||
break;
|
||||
|
||||
|
@ -30,7 +30,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id$
|
||||
* $Id: netdate.c,v 1.2 1994/09/24 02:54:38 davidg Exp $
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
@ -169,7 +169,7 @@ netsettime(tval)
|
||||
(void)close(s);
|
||||
return (0);
|
||||
default:
|
||||
warnx("wrong ack received from timed: %s",
|
||||
warnx("wrong ack received from timed: %s",
|
||||
tsptype[msg.tsp_type]);
|
||||
timed_ack = -1;
|
||||
break;
|
||||
|
@ -35,7 +35,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id: df.c,v 1.5 1994/09/24 02:55:11 davidg Exp $
|
||||
* $Id: df.c,v 1.6 1995/03/19 13:28:15 joerg Exp $
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
@ -99,7 +99,7 @@ struct typetab {
|
||||
{"misc", MT(MOUNT_LOFS)|MT(MOUNT_FDESC)|MT(MOUNT_PORTAL)|
|
||||
MT(MOUNT_KERNFS)|MT(MOUNT_PROCFS)},
|
||||
{NULL, 0}
|
||||
|
||||
|
||||
};
|
||||
|
||||
long addtype __P((long, char *));
|
||||
@ -336,7 +336,7 @@ prtstat(sfsp, maxwidth)
|
||||
used = inodes - sfsp->f_ffree;
|
||||
(void)printf(" %7ld %7ld %5.0f%% ", used, sfsp->f_ffree,
|
||||
inodes == 0 ? 100.0 : (double)used / (double)inodes * 100.0);
|
||||
} else
|
||||
} else
|
||||
(void)printf(" ");
|
||||
(void)printf(" %s\n", sfsp->f_mntonname);
|
||||
}
|
||||
@ -424,7 +424,7 @@ bread(off, buf, cnt)
|
||||
void
|
||||
usage()
|
||||
{
|
||||
fprintf(stderr,
|
||||
fprintf(stderr,
|
||||
"usage: df [-ikn] [-t fstype] [file | file_system ...]\n");
|
||||
exit(1);
|
||||
}
|
||||
|
@ -25,7 +25,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id$
|
||||
* $Id: buf.c,v 1.6 1994/09/24 02:55:22 davidg Exp $
|
||||
*/
|
||||
#ifndef lint
|
||||
static char *rcsid = "@(#)buf.c,v 1.4 1994/02/01 00:34:35 alm Exp";
|
||||
@ -253,7 +253,7 @@ init_buffers()
|
||||
{
|
||||
int i = 0;
|
||||
|
||||
/* Read stdin one character at a time to avoid i/o contention
|
||||
/* Read stdin one character at a time to avoid i/o contention
|
||||
with shell escapes invoked by nonterminal input, e.g.,
|
||||
ed - <<EOF
|
||||
!cat
|
||||
|
@ -25,7 +25,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id: glbl.c,v 1.2 1994/09/24 02:55:26 davidg Exp $
|
||||
* $Id: glbl.c,v 1.3 1995/03/19 13:28:27 joerg Exp $
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
@ -158,7 +158,7 @@ set_active_node(lp)
|
||||
#if defined(sun) || defined(NO_REALLOC_NULL)
|
||||
if (active_list != NULL) {
|
||||
#endif
|
||||
if ((ts = (line_t **) realloc(active_list,
|
||||
if ((ts = (line_t **) realloc(active_list,
|
||||
(ti += MINBUFSZ) * sizeof(line_t **))) == NULL) {
|
||||
fprintf(stderr, "%s\n", strerror(errno));
|
||||
sprintf(errmsg, "out of memory");
|
||||
@ -167,7 +167,7 @@ set_active_node(lp)
|
||||
}
|
||||
#if defined(sun) || defined(NO_REALLOC_NULL)
|
||||
} else {
|
||||
if ((ts = (line_t **) malloc((ti += MINBUFSZ) *
|
||||
if ((ts = (line_t **) malloc((ti += MINBUFSZ) *
|
||||
sizeof(line_t **))) == NULL) {
|
||||
fprintf(stderr, "%s\n", strerror(errno));
|
||||
sprintf(errmsg, "out of memory");
|
||||
|
@ -25,7 +25,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id: main.c,v 1.3 1994/09/24 02:55:28 davidg Exp $
|
||||
* $Id: main.c,v 1.4 1995/03/19 13:28:34 joerg Exp $
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
@ -42,7 +42,7 @@ static char *rcsid = "@(#)main.c,v 1.1 1994/02/01 00:34:42 alm Exp";
|
||||
* CREDITS
|
||||
*
|
||||
* This program is based on the editor algorithm described in
|
||||
* Brian W. Kernighan and P. J. Plauger's book "Software Tools
|
||||
* Brian W. Kernighan and P. J. Plauger's book "Software Tools
|
||||
* in Pascal," Addison-Wesley, 1981.
|
||||
*
|
||||
* The buffering algorithm is attributed to Rodney Ruddock of
|
||||
@ -192,7 +192,7 @@ main(argc, argv)
|
||||
fputs("?\n", stderr);
|
||||
sprintf(errmsg, "warning: file modified");
|
||||
if (!isatty(0)) {
|
||||
fprintf(stderr, garrulous ?
|
||||
fprintf(stderr, garrulous ?
|
||||
"script, line %d: %s\n" :
|
||||
"", lineno, errmsg);
|
||||
quit(2);
|
||||
@ -213,7 +213,7 @@ main(argc, argv)
|
||||
isglobal = 0;
|
||||
if ((status = extract_addr_range()) >= 0 &&
|
||||
(status = exec_command()) >= 0)
|
||||
if (!status ||
|
||||
if (!status ||
|
||||
(status = display_lines(current_addr, current_addr,
|
||||
status)) >= 0)
|
||||
continue;
|
||||
@ -225,16 +225,16 @@ main(argc, argv)
|
||||
fputs("?\n", stderr); /* give warning */
|
||||
sprintf(errmsg, "warning: file modified");
|
||||
if (!isatty(0)) {
|
||||
fprintf(stderr, garrulous ?
|
||||
"script, line %d: %s\n" :
|
||||
fprintf(stderr, garrulous ?
|
||||
"script, line %d: %s\n" :
|
||||
"", lineno, errmsg);
|
||||
quit(2);
|
||||
}
|
||||
break;
|
||||
case FATAL:
|
||||
if (!isatty(0))
|
||||
fprintf(stderr, garrulous ?
|
||||
"script, line %d: %s\n" : "",
|
||||
fprintf(stderr, garrulous ?
|
||||
"script, line %d: %s\n" : "",
|
||||
lineno, errmsg);
|
||||
else
|
||||
fprintf(stderr, garrulous ? "%s\n" : "",
|
||||
@ -243,7 +243,7 @@ main(argc, argv)
|
||||
default:
|
||||
fputs("?\n", stderr);
|
||||
if (!isatty(0)) {
|
||||
fprintf(stderr, garrulous ?
|
||||
fprintf(stderr, garrulous ?
|
||||
"script, line %d: %s\n" : "",
|
||||
lineno, errmsg);
|
||||
quit(2);
|
||||
@ -256,7 +256,7 @@ main(argc, argv)
|
||||
|
||||
long first_addr, second_addr, addr_cnt;
|
||||
|
||||
/* extract_addr_range: get line addresses from the command buffer until an
|
||||
/* extract_addr_range: get line addresses from the command buffer until an
|
||||
illegal address is seen; return status */
|
||||
int
|
||||
extract_addr_range()
|
||||
@ -548,7 +548,7 @@ exec_command()
|
||||
GET_COMMAND_SUFFIX();
|
||||
isglobal++;
|
||||
if (exec_global(n, gflag) < 0)
|
||||
return ERR;
|
||||
return ERR;
|
||||
break;
|
||||
case 'h':
|
||||
if (addr_cnt > 0) {
|
||||
@ -691,7 +691,7 @@ exec_command()
|
||||
sflags |= SGR;
|
||||
ibufp++;
|
||||
break;
|
||||
case '0': case '1': case '2': case '3': case '4':
|
||||
case '0': case '1': case '2': case '3': case '4':
|
||||
case '5': case '6': case '7': case '8': case '9':
|
||||
STRTOL(sgnum, ibufp);
|
||||
sflags |= SGF;
|
||||
@ -802,7 +802,7 @@ exec_command()
|
||||
return ERR;
|
||||
}
|
||||
#endif
|
||||
if ((addr = write_file(*fnp ? fnp : old_filename,
|
||||
if ((addr = write_file(*fnp ? fnp : old_filename,
|
||||
(c == 'W') ? "a" : "w", first_addr, second_addr)) < 0)
|
||||
return ERR;
|
||||
else if (addr == addr_last)
|
||||
@ -888,7 +888,7 @@ check_addr_range(n, m)
|
||||
}
|
||||
|
||||
|
||||
/* get_matching_node_addr: return the address of the next line matching a
|
||||
/* get_matching_node_addr: return the address of the next line matching a
|
||||
pattern in a given direction. wrap around begin/end of editor buffer if
|
||||
necessary */
|
||||
long
|
||||
@ -1148,7 +1148,7 @@ move_lines(addr)
|
||||
REQUE(b2, b1->q_forw);
|
||||
REQUE(a1->q_back, a2);
|
||||
REQUE(b1, a1);
|
||||
current_addr = addr + ((addr < first_addr) ?
|
||||
current_addr = addr + ((addr < first_addr) ?
|
||||
second_addr - first_addr + 1 : 0);
|
||||
}
|
||||
if (isglobal)
|
||||
|
@ -25,7 +25,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id: re.c,v 1.8 1994/09/24 02:55:29 davidg Exp $
|
||||
* $Id: re.c,v 1.9 1995/03/19 13:28:36 joerg Exp $
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
@ -39,7 +39,7 @@ extern int patlock;
|
||||
|
||||
char errmsg[MAXPATHLEN + 40] = "";
|
||||
|
||||
/* get_compiled_pattern: return pointer to compiled pattern from command
|
||||
/* get_compiled_pattern: return pointer to compiled pattern from command
|
||||
buffer */
|
||||
pattern_t *
|
||||
get_compiled_pattern()
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* sub.c: This file contains the substitution routines for the ed
|
||||
/* sub.c: This file contains the substitution routines for the ed
|
||||
line editor */
|
||||
/*-
|
||||
* Copyright (c) 1993 Andrew Moore, Talke Studio.
|
||||
@ -25,7 +25,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id: sub.c,v 1.4 1995/01/14 11:47:16 alm Exp $
|
||||
* $Id: sub.c,v 1.5 1995/03/19 13:28:38 joerg Exp $
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
@ -188,7 +188,7 @@ substitute_matching_text(pat, lp, gflag, kth)
|
||||
|
||||
if ((txt = get_sbuf_line(lp)) == NULL)
|
||||
return ERR;
|
||||
if (isbinary)
|
||||
if (isbinary)
|
||||
NUL_TO_NEWLINE(txt, lp->len);
|
||||
eot = txt + lp->len;
|
||||
if (!regexec(pat, txt, SE_MAX, rm, 0)) {
|
||||
@ -213,7 +213,7 @@ substitute_matching_text(pat, lp, gflag, kth)
|
||||
off += i;
|
||||
}
|
||||
txt += rm[0].rm_eo;
|
||||
} while (*txt &&
|
||||
} while (*txt &&
|
||||
(!changed || ((gflag & GSG) && rm[0].rm_eo)) &&
|
||||
!regexec(pat, txt, SE_MAX, rm, REG_NOTBOL));
|
||||
i = eot - txt;
|
||||
|
@ -1,8 +1,8 @@
|
||||
# /b/source/CVS/src/bin/expr/Makefile,v 1.5 1993/06/14 19:56:06 jtc Exp
|
||||
# $Id$
|
||||
# $Id: Makefile,v 1.6 1994/09/24 02:55:36 davidg Exp $
|
||||
|
||||
PROG= expr
|
||||
SRCS= expr.c
|
||||
SRCS= expr.c
|
||||
CLEANFILES+= expr.c y.tab.h
|
||||
|
||||
expr.c:
|
||||
|
@ -33,7 +33,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id: print.c,v 1.2 1994/09/24 02:55:56 davidg Exp $
|
||||
* $Id: print.c,v 1.3 1995/03/19 13:28:46 joerg Exp $
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
@ -283,7 +283,7 @@ printlink(p)
|
||||
|
||||
if (p->fts_level == FTS_ROOTLEVEL)
|
||||
(void)snprintf(name, sizeof(name), "%s", p->fts_name);
|
||||
else
|
||||
else
|
||||
(void)snprintf(name, sizeof(name),
|
||||
"%s/%s", p->fts_parent->fts_accpath, p->fts_name);
|
||||
if ((lnklen = readlink(name, path, sizeof(path) - 1)) == -1) {
|
||||
|
@ -34,7 +34,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id$
|
||||
* $Id: ar_io.c,v 1.2 1994/09/24 02:56:11 davidg Exp $
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
@ -278,7 +278,7 @@ ar_open(name)
|
||||
break;
|
||||
default:
|
||||
/*
|
||||
* should never happen, worse case, slow...
|
||||
* should never happen, worse case, slow...
|
||||
*/
|
||||
blksz = rdblksz = BLKMULT;
|
||||
break;
|
||||
@ -458,8 +458,8 @@ ar_set_wr()
|
||||
* will stop us if the archive containing the trailer was not written
|
||||
*/
|
||||
wr_trail = 0;
|
||||
|
||||
/*
|
||||
|
||||
/*
|
||||
* Add any device dependent code as required here
|
||||
*/
|
||||
if (artyp != ISREG)
|
||||
@ -480,7 +480,7 @@ ar_set_wr()
|
||||
/*
|
||||
* ar_app_ok()
|
||||
* check if the last volume in the archive allows appends. We cannot check
|
||||
* this until we are ready to write since there is no spec that says all
|
||||
* this until we are ready to write since there is no spec that says all
|
||||
* volumes in a single archive have to be of the same type...
|
||||
* Return:
|
||||
* 0 if we can append, -1 otherwise.
|
||||
@ -592,7 +592,7 @@ ar_read(buf, cnt)
|
||||
else
|
||||
warn(0, "End of archive volume %d reached", arvol);
|
||||
return(res);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* ar_write()
|
||||
@ -710,8 +710,8 @@ ar_write(buf, bsz)
|
||||
warn(1,"Unable to append, trailer re-write failed. Quitting.");
|
||||
return(res);
|
||||
}
|
||||
|
||||
if (res == 0)
|
||||
|
||||
if (res == 0)
|
||||
warn(0, "End of archive volume %d reached", arvol);
|
||||
else if (res < 0)
|
||||
syswarn(1, errno, "Failed write to archive volume: %d", arvol);
|
||||
@ -791,7 +791,7 @@ ar_rdsync()
|
||||
if ((cpos = lseek(arfd, (off_t)0L, SEEK_CUR)) < 0)
|
||||
break;
|
||||
mpos = fsbz - (cpos % (off_t)fsbz);
|
||||
if (lseek(arfd, mpos, SEEK_CUR) < 0)
|
||||
if (lseek(arfd, mpos, SEEK_CUR) < 0)
|
||||
break;
|
||||
lstrval = 1;
|
||||
break;
|
||||
@ -850,14 +850,14 @@ ar_fow(sksz, skipped)
|
||||
* number of physical blocks to skip (we do not know physical block
|
||||
* size at this point), so we must only read foward on tapes!
|
||||
*/
|
||||
if (artyp != ISREG)
|
||||
if (artyp != ISREG)
|
||||
return(0);
|
||||
|
||||
/*
|
||||
* figure out where we are in the archive
|
||||
*/
|
||||
if ((cpos = lseek(arfd, (off_t)0L, SEEK_CUR)) >= 0) {
|
||||
/*
|
||||
/*
|
||||
* we can be asked to move farther than there are bytes in this
|
||||
* volume, if so, just go to file end and let normal buf_fill()
|
||||
* deal with the end of file (it will go to next volume by
|
||||
@ -898,7 +898,7 @@ ar_rev(sksz)
|
||||
{
|
||||
off_t cpos;
|
||||
struct mtop mb;
|
||||
register int phyblk;
|
||||
register int phyblk;
|
||||
|
||||
/*
|
||||
* make sure we do not have try to reverse on a flawed archive
|
||||
@ -908,7 +908,7 @@ ar_rev(sksz)
|
||||
|
||||
switch(artyp) {
|
||||
case ISPIPE:
|
||||
if (sksz <= 0)
|
||||
if (sksz <= 0)
|
||||
break;
|
||||
/*
|
||||
* cannot go backwards on these critters
|
||||
@ -1017,7 +1017,7 @@ ar_rev(sksz)
|
||||
/*
|
||||
* get_phys()
|
||||
* Determine the physical block size on a tape drive. We need the physical
|
||||
* block size so we know how many bytes we skip over when we move with
|
||||
* block size so we know how many bytes we skip over when we move with
|
||||
* mtio commands. We also make sure we are BEFORE THE TAPE FILEMARK when
|
||||
* return.
|
||||
* This is one really SLOW routine...
|
||||
@ -1218,7 +1218,7 @@ ar_next()
|
||||
/*
|
||||
* we are to continue with the same device
|
||||
*/
|
||||
if (ar_open(arcname) >= 0)
|
||||
if (ar_open(arcname) >= 0)
|
||||
return(0);
|
||||
tty_prnt("Cannot re-open %s, try again\n",
|
||||
arcname);
|
||||
|
@ -34,7 +34,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id$
|
||||
* $Id: ar_subs.c,v 1.2 1994/09/24 02:56:12 davidg Exp $
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
@ -449,7 +449,7 @@ wr_archive(arcn, is_app)
|
||||
if ((res > 0) || (docrc && (set_crc(arcn, fd) < 0))) {
|
||||
/*
|
||||
* unable to obtain the crc we need, close the file,
|
||||
* purge link table entry
|
||||
* purge link table entry
|
||||
*/
|
||||
rdfile_close(arcn, &fd);
|
||||
purg_lnk(arcn);
|
||||
@ -472,7 +472,7 @@ wr_archive(arcn, is_app)
|
||||
}
|
||||
wr_one = 1;
|
||||
if (res > 0) {
|
||||
/*
|
||||
/*
|
||||
* format write says no file data needs to be stored
|
||||
* so we are done messing with this file
|
||||
*/
|
||||
@ -535,7 +535,7 @@ wr_archive(arcn, is_app)
|
||||
* is called to add the new members.
|
||||
* PAX IMPLEMENTATION DETAIL NOTE:
|
||||
* -u is implemented by adding the new members to the end of the archive.
|
||||
* Care is taken so that these do not end up as links to the older
|
||||
* Care is taken so that these do not end up as links to the older
|
||||
* version of the same file already stored in the archive. It is expected
|
||||
* when extraction occurs these newer versions will over-write the older
|
||||
* ones stored "earlier" in the archive (this may be a bad assumption as
|
||||
@ -677,7 +677,7 @@ append()
|
||||
(void)fputs("done.\n", stderr);
|
||||
vfpart = 0;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* go to the writing phase to add the new members
|
||||
*/
|
||||
@ -765,7 +765,7 @@ copy()
|
||||
|
||||
/*
|
||||
* start up the hard link table; file traversal routines and the
|
||||
* modification time and access mode database
|
||||
* modification time and access mode database
|
||||
*/
|
||||
if ((lnk_start() < 0) || (ftree_start() < 0) || (dir_start() < 0))
|
||||
return;
|
||||
@ -881,7 +881,7 @@ copy()
|
||||
* try to create a hard link to the src file if requested
|
||||
* but make sure we are not trying to overwrite ourselves.
|
||||
*/
|
||||
if (lflag)
|
||||
if (lflag)
|
||||
res = cross_lnk(arcn);
|
||||
else
|
||||
res = chk_same(arcn);
|
||||
@ -988,7 +988,7 @@ next_head(arcn)
|
||||
register int hsz;
|
||||
register int in_resync = 0; /* set when we are in resync mode */
|
||||
int cnt = 0; /* counter for trailer function */
|
||||
|
||||
|
||||
/*
|
||||
* set up initial conditions, we want a whole frmt->hsz block as we
|
||||
* have no data yet.
|
||||
@ -1132,7 +1132,7 @@ get_arc()
|
||||
register int minhd = BLKMULT;
|
||||
char *hdend;
|
||||
int notice = 0;
|
||||
|
||||
|
||||
/*
|
||||
* find the smallest header size in all archive formats and then set up
|
||||
* to read the archive.
|
||||
@ -1192,7 +1192,7 @@ get_arc()
|
||||
if ((*fsub[ford[i]].id)(hdbuf, hdsz) < 0)
|
||||
continue;
|
||||
frmt = &(fsub[ford[i]]);
|
||||
/*
|
||||
/*
|
||||
* yuck, to avoid slow special case code in the extract
|
||||
* routines, just push this header back as if it was
|
||||
* not seen. We have left extra space at start of the
|
||||
|
@ -34,7 +34,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id$
|
||||
* $Id: buf_subs.c,v 1.2 1994/09/24 02:56:13 davidg Exp $
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
@ -101,7 +101,7 @@ wr_start()
|
||||
* archive that might be hard to read elsewhere. If all ok, we then
|
||||
* open the first archive volume
|
||||
*/
|
||||
if (!wrblksz)
|
||||
if (!wrblksz)
|
||||
wrblksz = frmt->bsz;
|
||||
if (wrblksz > MAXBLK) {
|
||||
warn(1, "Write block size of %d too large, maximium is: %d",
|
||||
@ -115,7 +115,7 @@ wr_start()
|
||||
}
|
||||
|
||||
/*
|
||||
* we only allow wrblksz to be used with all archive operations
|
||||
* we only allow wrblksz to be used with all archive operations
|
||||
*/
|
||||
blksz = rdblksz = wrblksz;
|
||||
if ((ar_open(arcname) < 0) && (ar_next() < 0))
|
||||
@ -215,7 +215,7 @@ cp_start()
|
||||
* about the conditions under which they will allow a write to occur.
|
||||
* Often devices restrict the conditions where writes can be made writes,
|
||||
* so it may not be feasable to append archives stored on all types of
|
||||
* devices.
|
||||
* devices.
|
||||
* Return:
|
||||
* 0 for success, -1 for failure
|
||||
*/
|
||||
@ -313,7 +313,7 @@ appnd_start(skcnt)
|
||||
warn(1, "Unable to rewrite archive trailer, cannot append.");
|
||||
return(-1);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* rd_sync()
|
||||
* A read error occurred on this archive volume. Resync the buffer and
|
||||
@ -488,7 +488,7 @@ rd_skip(skcnt)
|
||||
return(0);
|
||||
}
|
||||
|
||||
/*
|
||||
/*
|
||||
* wr_fin()
|
||||
* flush out any data (and pad if required) the last block. We always pad
|
||||
* with zero (even though we do not have to). Padding with 0 makes it a
|
||||
@ -517,7 +517,7 @@ wr_fin()
|
||||
* by format specific write routines to pass a file header). On failure we
|
||||
* punt. We do not allow the user to continue to write flawed archives.
|
||||
* We assume these headers are not very large (the memory copy we use is
|
||||
* a bit expensive).
|
||||
* a bit expensive).
|
||||
* Return:
|
||||
* 0 if buffer was filled ok, -1 o.w. (buffer flush failure)
|
||||
*/
|
||||
@ -810,7 +810,7 @@ rd_wrfile(arcn, ofd, left)
|
||||
/*
|
||||
* if we failed from archive read, we do not want to skip
|
||||
*/
|
||||
if ((size > 0L) && (*left == 0L))
|
||||
if ((size > 0L) && (*left == 0L))
|
||||
return(-1);
|
||||
|
||||
/*
|
||||
@ -1019,7 +1019,7 @@ buf_flush(bufcnt)
|
||||
/*
|
||||
* write a block and check if it all went out ok
|
||||
*/
|
||||
cnt = ar_write(buf, blksz);
|
||||
cnt = ar_write(buf, blksz);
|
||||
if (cnt == blksz) {
|
||||
/*
|
||||
* the write went ok
|
||||
|
@ -34,7 +34,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id$
|
||||
* $Id: cpio.c,v 1.2 1994/09/24 02:56:16 davidg Exp $
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
@ -93,7 +93,7 @@ cpio_strd()
|
||||
* mode; looking for a valid header), and cnt (which starts at zero)
|
||||
* which is used to count the number of empty blocks we have seen so far.
|
||||
* Return:
|
||||
* 0 if a valid trailer, -1 if not a valid trailer,
|
||||
* 0 if a valid trailer, -1 if not a valid trailer,
|
||||
*/
|
||||
|
||||
#if __STDC__
|
||||
@ -572,7 +572,7 @@ cpio_wr(arcn)
|
||||
/*
|
||||
* vcpio_id()
|
||||
* determine if a block given to us is a valid system VR4 cpio header
|
||||
* WITHOUT crc. WATCH it the magic cookies are in OCTAL, the header
|
||||
* WITHOUT crc. WATCH it the magic cookies are in OCTAL, the header
|
||||
* uses HEX
|
||||
* Return:
|
||||
* 0 if a valid header, -1 otherwise
|
||||
|
@ -35,7 +35,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)cpio.h 8.1 (Berkeley) 5/31/93
|
||||
* $Id$
|
||||
* $Id: cpio.h,v 1.2 1994/09/24 02:56:17 davidg Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -71,7 +71,7 @@ typedef struct {
|
||||
char c_mtime[11]; /* modification time */
|
||||
char c_namesize[6]; /* length of pathname */
|
||||
char c_filesize[11]; /* length of file in bytes */
|
||||
} HD_CPIO;
|
||||
} HD_CPIO;
|
||||
|
||||
#define MAGIC 070707 /* transportable archive id */
|
||||
|
||||
@ -82,7 +82,7 @@ typedef struct {
|
||||
#endif /* _PAX_ */
|
||||
|
||||
/*
|
||||
* Binary cpio header structure
|
||||
* Binary cpio header structure
|
||||
*
|
||||
* CAUTION! CAUTION! CAUTION!
|
||||
* Each field really represents a 16 bit short (NOT ASCII). Described as
|
||||
@ -102,7 +102,7 @@ typedef struct {
|
||||
u_char h_namesize[2];
|
||||
u_char h_filesize_1[2];
|
||||
u_char h_filesize_2[2];
|
||||
} HD_BCPIO;
|
||||
} HD_BCPIO;
|
||||
|
||||
#ifdef _PAX_
|
||||
/*
|
||||
@ -140,7 +140,7 @@ typedef struct {
|
||||
char c_rmin[8]; /* special file minor # */
|
||||
char c_namesize[8]; /* length of pathname */
|
||||
char c_chksum[8]; /* 0 OR CRC of bytes of FILE data */
|
||||
} HD_VCPIO;
|
||||
} HD_VCPIO;
|
||||
|
||||
#define VMAGIC 070701 /* sVr4 new portable archive id */
|
||||
#define VCMAGIC 070702 /* sVr4 new portable archive id CRC */
|
||||
|
@ -34,7 +34,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id$
|
||||
* $Id: file_subs.c,v 1.2 1994/09/24 02:56:19 davidg Exp $
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
@ -159,7 +159,7 @@ file_close(arcn, fd)
|
||||
/*
|
||||
* set owner/groups first as this may strip off mode bits we want
|
||||
* then set file permission modes. Then set file access and
|
||||
* modification times.
|
||||
* modification times.
|
||||
*/
|
||||
if (pids)
|
||||
res = set_ids(arcn->name, arcn->sb.st_uid, arcn->sb.st_gid);
|
||||
@ -180,7 +180,7 @@ file_close(arcn, fd)
|
||||
/*
|
||||
* lnk_creat()
|
||||
* Create a hard link to arcn->ln_name from arcn->name. arcn->ln_name
|
||||
* must exist;
|
||||
* must exist;
|
||||
* Return:
|
||||
* 0 if ok, -1 otherwise
|
||||
*/
|
||||
@ -266,7 +266,7 @@ chk_same(arcn)
|
||||
{
|
||||
struct stat sb;
|
||||
|
||||
/*
|
||||
/*
|
||||
* if file does not exist, return. if file exists and -k, skip it
|
||||
* quietly
|
||||
*/
|
||||
@ -570,7 +570,7 @@ unlnk_exist(name, type)
|
||||
*/
|
||||
if (rmdir(name) < 0) {
|
||||
if (type == PAX_DIR)
|
||||
return(1);
|
||||
return(1);
|
||||
syswarn(1,errno,"Unable to remove directory %s", name);
|
||||
return(-1);
|
||||
}
|
||||
@ -847,7 +847,7 @@ file_write(fd, str, cnt, rem, isempt, sz, name)
|
||||
register char *end;
|
||||
register int wcnt;
|
||||
register char *st = str;
|
||||
|
||||
|
||||
/*
|
||||
* while we have data to process
|
||||
*/
|
||||
|
@ -34,7 +34,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id$
|
||||
* $Id: ftree.c,v 1.2 1994/09/24 02:56:20 davidg Exp $
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
@ -214,7 +214,7 @@ ftree_sel(arcn)
|
||||
* when file trees are supplied pax as args. The list is not used when
|
||||
* the trees are read from stdin.
|
||||
*/
|
||||
if (ftcur != NULL)
|
||||
if (ftcur != NULL)
|
||||
ftcur->refcnt = 1;
|
||||
|
||||
/*
|
||||
@ -307,7 +307,7 @@ ftree_arg()
|
||||
if (fthead == NULL) {
|
||||
/*
|
||||
* the user didn't supply any args, get the file trees
|
||||
* to process from stdin;
|
||||
* to process from stdin;
|
||||
*/
|
||||
if (fgets(farray[0], PAXPATHLEN+1, stdin) == NULL)
|
||||
return(-1);
|
||||
@ -362,7 +362,7 @@ next_file(arcn)
|
||||
/*
|
||||
* ftree_sel() might have set the ftree_skip flag if the user has the
|
||||
* -n option and a file was selected from this file arg tree. (-n says
|
||||
* only one member is matched for each pattern) ftree_skip being 1
|
||||
* only one member is matched for each pattern) ftree_skip being 1
|
||||
* forces us to go to the next arg now.
|
||||
*/
|
||||
if (ftree_skip) {
|
||||
|
@ -34,7 +34,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id: gen_subs.c,v 1.2 1994/09/24 02:56:22 davidg Exp $
|
||||
* $Id: gen_subs.c,v 1.3 1995/03/19 13:28:49 joerg Exp $
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
@ -203,7 +203,7 @@ ls_tty(arcn)
|
||||
/*
|
||||
* zf_strncpy()
|
||||
* copy src to dest up to len chars (stopping at first '\0'), when src is
|
||||
* shorter than len, pads to len with '\0'. big performance win (and
|
||||
* shorter than len, pads to len with '\0'. big performance win (and
|
||||
* a lot easier to code) over strncpy(), then a strlen() then a
|
||||
* bzero(). (or doing the bzero() first).
|
||||
*/
|
||||
@ -335,7 +335,7 @@ ul_asc(val, str, len, base)
|
||||
{
|
||||
register char *pt;
|
||||
u_long digit;
|
||||
|
||||
|
||||
/*
|
||||
* WARNING str is not '\0' terminated by this routine
|
||||
*/
|
||||
@ -350,7 +350,7 @@ ul_asc(val, str, len, base)
|
||||
while (pt >= str) {
|
||||
if ((digit = (val & 0xf)) < 10)
|
||||
*pt-- = '0' + (char)digit;
|
||||
else
|
||||
else
|
||||
*pt-- = 'a' + (char)(digit - 10);
|
||||
if ((val = (val >> 4)) == (u_long)0)
|
||||
break;
|
||||
@ -449,7 +449,7 @@ uqd_asc(val, str, len, base)
|
||||
{
|
||||
register char *pt;
|
||||
u_quad_t digit;
|
||||
|
||||
|
||||
/*
|
||||
* WARNING str is not '\0' terminated by this routine
|
||||
*/
|
||||
@ -464,7 +464,7 @@ uqd_asc(val, str, len, base)
|
||||
while (pt >= str) {
|
||||
if ((digit = (val & 0xf)) < 10)
|
||||
*pt-- = '0' + (char)digit;
|
||||
else
|
||||
else
|
||||
*pt-- = 'a' + (char)(digit - 10);
|
||||
if ((val = (val >> 4)) == (u_quad_t)0)
|
||||
break;
|
||||
|
@ -34,7 +34,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id: pat_rep.c,v 1.2 1994/09/24 02:56:24 davidg Exp $
|
||||
* $Id: pat_rep.c,v 1.3 1995/03/19 13:28:56 joerg Exp $
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
@ -88,7 +88,7 @@ static int resub __P((regex_t *, regmatch_t *, char *, char *, char *));
|
||||
* parses the -s replacement string; compiles the regular expression
|
||||
* and stores the compiled value and it's replacement string together in
|
||||
* replacement string list. Input to this function is of the form:
|
||||
* /old/new/pg
|
||||
* /old/new/pg
|
||||
* The first char in the string specifies the delimiter used by this
|
||||
* replacement string. "Old" is a regular expression in "ed" format which
|
||||
* is compiled by regcomp() and is applied to filenames. "new" is the
|
||||
@ -348,7 +348,7 @@ pat_sel(arcn)
|
||||
|
||||
/*
|
||||
* we reach this point only when we allow a single selected match per
|
||||
* pattern, if the pattern matches a directory and we do not have -d
|
||||
* pattern, if the pattern matches a directory and we do not have -d
|
||||
* (dflag) we are done with this pattern. We may also be handed a file
|
||||
* in the subtree of a directory. in that case when we are operating
|
||||
* with -d, this pattern was already selected and we are done
|
||||
@ -372,7 +372,7 @@ pat_sel(arcn)
|
||||
*/
|
||||
if (pt->pend != NULL)
|
||||
*pt->pend = '\0';
|
||||
|
||||
|
||||
if ((pt->pstr = strdup(arcn->name)) == NULL) {
|
||||
warn(1, "Pattern select out of memory");
|
||||
if (pt->pend != NULL)
|
||||
@ -397,7 +397,7 @@ pat_sel(arcn)
|
||||
if (*(pt->pstr + len) == '/') {
|
||||
*(pt->pstr + len) = '\0';
|
||||
pt->plen = len;
|
||||
}
|
||||
}
|
||||
pt->flgs = DIR_MTCH | MTCH;
|
||||
arcn->pat = pt;
|
||||
return(0);
|
||||
@ -438,7 +438,7 @@ pat_sel(arcn)
|
||||
* this archive member is "selected" we process and mark the pattern as
|
||||
* one which matched a selected archive member (see pat_sel())
|
||||
* Return:
|
||||
* 0 if this archive member should be processed, 1 if it should be
|
||||
* 0 if this archive member should be processed, 1 if it should be
|
||||
* skipped and -1 if we are done with all patterns (and pax should quit
|
||||
* looking for more members)
|
||||
*/
|
||||
@ -515,7 +515,7 @@ pat_match(arcn)
|
||||
/*
|
||||
* fn_match()
|
||||
* Return:
|
||||
* 0 if this archive member should be processed, 1 if it should be
|
||||
* 0 if this archive member should be processed, 1 if it should be
|
||||
* skipped and -1 if we are done with all patterns (and pax should quit
|
||||
* looking for more members)
|
||||
* Note: *pend may be changed to show where the prefix ends.
|
||||
@ -564,7 +564,7 @@ fn_match(pattern, string, pend)
|
||||
case '*':
|
||||
c = *pattern;
|
||||
/*
|
||||
* Collapse multiple *'s.
|
||||
* Collapse multiple *'s.
|
||||
*/
|
||||
while (c == '*')
|
||||
c = *++pattern;
|
||||
@ -649,7 +649,7 @@ range_match(pattern, test)
|
||||
* if we spot any file links to the old file name in the future, we will
|
||||
* know exactly how to fix the file link.
|
||||
* Return:
|
||||
* 0 continue to process file, 1 skip this file, -1 pax is finished
|
||||
* 0 continue to process file, 1 skip this file, -1 pax is finished
|
||||
*/
|
||||
|
||||
#if __STDC__
|
||||
@ -862,7 +862,7 @@ fix_path(or_name, or_len, dir_name, dir_len)
|
||||
*or_len = len;
|
||||
|
||||
/*
|
||||
* enough space, shift
|
||||
* enough space, shift
|
||||
*/
|
||||
while (src >= start)
|
||||
*dest-- = *src--;
|
||||
@ -1014,7 +1014,7 @@ rep_name(name, nlen, prnt)
|
||||
*/
|
||||
} while (pt->flgs & GLOB);
|
||||
|
||||
if (found)
|
||||
if (found)
|
||||
break;
|
||||
|
||||
/*
|
||||
@ -1037,7 +1037,7 @@ rep_name(name, nlen, prnt)
|
||||
warn(1,"Replacement name too long %s >> %s",
|
||||
name, nname);
|
||||
return(1);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* inform the user of the result if wanted
|
||||
@ -1046,7 +1046,7 @@ rep_name(name, nlen, prnt)
|
||||
if (*nname == '\0')
|
||||
(void)fprintf(stderr,"%s >> <empty string>\n",
|
||||
name);
|
||||
else
|
||||
else
|
||||
(void)fprintf(stderr,"%s >> %s\n", name, nname);
|
||||
}
|
||||
|
||||
@ -1054,7 +1054,7 @@ rep_name(name, nlen, prnt)
|
||||
* if empty inform the caller this file is to be skipped
|
||||
* otherwise copy the new name over the orig name and return
|
||||
*/
|
||||
if (*nname == '\0')
|
||||
if (*nname == '\0')
|
||||
return(1);
|
||||
*nlen = l_strncpy(name, nname, PAXPATHLEN + 1);
|
||||
}
|
||||
|
@ -34,7 +34,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id$
|
||||
* $Id: pax.c,v 1.2 1994/09/24 02:56:27 davidg Exp $
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
@ -116,7 +116,7 @@ sigset_t s_mask; /* signal mask for cleanup critical sect */
|
||||
*
|
||||
* 1 READ ENHANCEMENTS
|
||||
* 1.1 Operations which read archives will continue to operate even when
|
||||
* processing archives which may be damaged, truncated, or fail to meet
|
||||
* processing archives which may be damaged, truncated, or fail to meet
|
||||
* format specs in several different ways. Damaged sections of archives
|
||||
* are detected and avoided if possible. Attempts will be made to resync
|
||||
* archive read operations even with badly damaged media.
|
||||
@ -131,7 +131,7 @@ sigset_t s_mask; /* signal mask for cleanup critical sect */
|
||||
* 1.5 The user is notified whenever something is found during archive
|
||||
* read operations which violates spec (but the read will continue).
|
||||
* 1.6 Multiple archive volumes can be read and may span over different
|
||||
* archive devices
|
||||
* archive devices
|
||||
* 1.7 Rigidly restores all file attributes exactly as they are stored on the
|
||||
* archive.
|
||||
* 1.8 Modification change time ranges can be specified via multiple -T
|
||||
@ -157,7 +157,7 @@ sigset_t s_mask; /* signal mask for cleanup critical sect */
|
||||
* these fields. This removes any restrictions on using these archive
|
||||
* formats on large file systems.
|
||||
* 2.5 Multiple archive volumes can be written and may span over different
|
||||
* archive devices
|
||||
* archive devices
|
||||
* 2.6 A archive volume record limit allows the user to specify the number
|
||||
* of bytes stored on an archive volume. When reached the user is
|
||||
* prompted for the next archive volume. This is specified with the
|
||||
@ -204,7 +204,7 @@ sigset_t s_mask; /* signal mask for cleanup critical sect */
|
||||
* name modification (-Z)
|
||||
*
|
||||
* 4 GENERAL ENHANCEMENTS
|
||||
* 4.1 Internal structure is designed to isolate format dependent and
|
||||
* 4.1 Internal structure is designed to isolate format dependent and
|
||||
* independent functions. Formats are selected via a format driver table.
|
||||
* This encourages the addition of new archive formats by only having to
|
||||
* write those routines which id, read and write the archive header.
|
||||
@ -235,7 +235,7 @@ main(argc, argv)
|
||||
return(exit_val);
|
||||
|
||||
/*
|
||||
* select a primary operation mode
|
||||
* select a primary operation mode
|
||||
*/
|
||||
switch(act) {
|
||||
case EXTRACT:
|
||||
@ -349,7 +349,7 @@ gen_init()
|
||||
/*
|
||||
* Handle posix locale
|
||||
*
|
||||
* set user defines time printing format for -v option
|
||||
* set user defines time printing format for -v option
|
||||
*/
|
||||
ltmfrmt = getenv("LC_TIME");
|
||||
|
||||
@ -371,27 +371,27 @@ gen_init()
|
||||
n_hand.sa_handler = sig_cleanup;
|
||||
|
||||
if ((sigaction(SIGHUP, &n_hand, &o_hand) < 0) &&
|
||||
(o_hand.sa_handler == SIG_IGN) &&
|
||||
(o_hand.sa_handler == SIG_IGN) &&
|
||||
(sigaction(SIGHUP, &o_hand, &o_hand) < 0))
|
||||
goto out;
|
||||
|
||||
if ((sigaction(SIGTERM, &n_hand, &o_hand) < 0) &&
|
||||
(o_hand.sa_handler == SIG_IGN) &&
|
||||
(o_hand.sa_handler == SIG_IGN) &&
|
||||
(sigaction(SIGTERM, &o_hand, &o_hand) < 0))
|
||||
goto out;
|
||||
|
||||
if ((sigaction(SIGINT, &n_hand, &o_hand) < 0) &&
|
||||
(o_hand.sa_handler == SIG_IGN) &&
|
||||
(o_hand.sa_handler == SIG_IGN) &&
|
||||
(sigaction(SIGINT, &o_hand, &o_hand) < 0))
|
||||
goto out;
|
||||
|
||||
if ((sigaction(SIGQUIT, &n_hand, &o_hand) < 0) &&
|
||||
(o_hand.sa_handler == SIG_IGN) &&
|
||||
(o_hand.sa_handler == SIG_IGN) &&
|
||||
(sigaction(SIGQUIT, &o_hand, &o_hand) < 0))
|
||||
goto out;
|
||||
|
||||
if ((sigaction(SIGXCPU, &n_hand, &o_hand) < 0) &&
|
||||
(o_hand.sa_handler == SIG_IGN) &&
|
||||
(o_hand.sa_handler == SIG_IGN) &&
|
||||
(sigaction(SIGXCPU, &o_hand, &o_hand) < 0))
|
||||
goto out;
|
||||
|
||||
|
@ -35,7 +35,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)pax.h 8.2 (Berkeley) 4/18/94
|
||||
* $Id$
|
||||
* $Id: pax.h,v 1.2 1994/09/24 02:56:28 davidg Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -63,7 +63,7 @@
|
||||
#define DEFOP LIST /* if no flags default is to LIST */
|
||||
|
||||
/*
|
||||
* Device type of the current archive volume
|
||||
* Device type of the current archive volume
|
||||
*/
|
||||
#define ISREG 0 /* regular file */
|
||||
#define ISCHR 1 /* character device */
|
||||
@ -76,7 +76,7 @@
|
||||
*
|
||||
* The format specific routine table allows new archive formats to be quickly
|
||||
* added. Overall pax operation is independent of the actual format used to
|
||||
* form the archive. Only those routines which deal directly with the archive
|
||||
* form the archive. Only those routines which deal directly with the archive
|
||||
* are tailored to the oddities of the specifc format. All other routines are
|
||||
* independent of the archive format. Data flow in and out of the format
|
||||
* dependent routines pass pointers to ARCHD structure (described below).
|
||||
@ -207,7 +207,7 @@ typedef struct {
|
||||
#define PAX_FIF 7 /* fifo */
|
||||
#define PAX_HLK 8 /* hard link */
|
||||
#define PAX_HRG 9 /* hard link to a regular file */
|
||||
#define PAX_CTG 10 /* high performance file */
|
||||
#define PAX_CTG 10 /* high performance file */
|
||||
} ARCHD;
|
||||
|
||||
/*
|
||||
|
@ -34,7 +34,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id$
|
||||
* $Id: tables.c,v 1.2 1994/09/24 02:56:34 davidg Exp $
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
@ -85,7 +85,7 @@ static DEVT *chk_dev __P((dev_t, int));
|
||||
/*
|
||||
* hard link table routines
|
||||
*
|
||||
* The hard link table tries to detect hard links to files using the device and
|
||||
* The hard link table tries to detect hard links to files using the device and
|
||||
* inode values. We do this when writing an archive, so we can tell the format
|
||||
* write routine that this file is a hard link to another file. The format
|
||||
* write routine then can store this file in whatever way it wants (as a hard
|
||||
@ -333,10 +333,10 @@ lnk_end()
|
||||
* that this is one HUGE database. To save memory space, the actual file names
|
||||
* are stored in a scatch file and indexed by an in memory hash table. The
|
||||
* hash table is indexed by hashing the file path. The nodes in the table store
|
||||
* the length of the filename and the lseek offset within the scratch file
|
||||
* the length of the filename and the lseek offset within the scratch file
|
||||
* where the actual name is stored. Since there are never any deletions to this
|
||||
* table, fragmentation of the scratch file is never a issue. Lookups seem to
|
||||
* not exhibit any locality at all (files in the database are rarely
|
||||
* not exhibit any locality at all (files in the database are rarely
|
||||
* looked up more than once...). So caching is just a waste of memory. The
|
||||
* only limitation is the amount of scatch file space available to store the
|
||||
* path names.
|
||||
@ -468,7 +468,7 @@ chk_ftime(arcn)
|
||||
*/
|
||||
pt->mtime = arcn->sb.st_mtime;
|
||||
return(0);
|
||||
}
|
||||
}
|
||||
/*
|
||||
* file is older
|
||||
*/
|
||||
@ -493,7 +493,7 @@ chk_ftime(arcn)
|
||||
return(0);
|
||||
}
|
||||
syswarn(1, errno, "Failed write to file time table");
|
||||
} else
|
||||
} else
|
||||
syswarn(1, errno, "Failed seek on file time table");
|
||||
} else
|
||||
warn(1, "File time table ran out of memory");
|
||||
@ -567,7 +567,7 @@ add_name(oname, onamelen, nname)
|
||||
* should never happen
|
||||
*/
|
||||
warn(0, "No interactive rename table, links may fail\n");
|
||||
return(0);
|
||||
return(0);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -666,7 +666,7 @@ sub_name(oname, onamelen)
|
||||
*/
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* device/inode mapping table routines
|
||||
* (used with formats that store device and inodes fields)
|
||||
@ -856,7 +856,7 @@ map_dev(arcn, dev_mask, ino_mask)
|
||||
return(0);
|
||||
/*
|
||||
* check for device and inode truncation, and extract the truncated
|
||||
* bit pattern.
|
||||
* bit pattern.
|
||||
*/
|
||||
if ((arcn->sb.st_dev & (dev_t)dev_mask) != arcn->sb.st_dev)
|
||||
++trc_dev;
|
||||
@ -1064,7 +1064,7 @@ add_atdir(fname, dev, ino, mtime, atime)
|
||||
return;
|
||||
|
||||
/*
|
||||
* make sure this directory is not already in the table, if so just
|
||||
* make sure this directory is not already in the table, if so just
|
||||
* return (the older entry always has the correct time). The only
|
||||
* way this will happen is when the same subtree can be traversed by
|
||||
* different args to pax and the -n option is aborting fts out of a
|
||||
@ -1233,7 +1233,7 @@ dir_start()
|
||||
* name is name of the directory, psb the stat buffer with the data in it,
|
||||
* frc_mode is a flag that says whether to force the setting of the mode
|
||||
* (ignoring the user set values for preserving file mode). Frc_mode is
|
||||
* for the case where we created a file and found that the resulting
|
||||
* for the case where we created a file and found that the resulting
|
||||
* directory was not writeable and the user asked for file modes to NOT
|
||||
* be preserved. (we have to preserve what was created by default, so we
|
||||
* have to force the setting at the end. this is stated explicitly in the
|
||||
@ -1312,15 +1312,15 @@ proc_dir()
|
||||
* read the trailer, then the file name, if this fails
|
||||
* just give up.
|
||||
*/
|
||||
if (lseek(dirfd, -((off_t)sizeof(dblk)), SEEK_CUR) < 0)
|
||||
if (lseek(dirfd, -((off_t)sizeof(dblk)), SEEK_CUR) < 0)
|
||||
break;
|
||||
if (read(dirfd,(char *)&dblk, sizeof(dblk)) != sizeof(dblk))
|
||||
break;
|
||||
if (lseek(dirfd, dblk.npos, SEEK_SET) < 0)
|
||||
if (lseek(dirfd, dblk.npos, SEEK_SET) < 0)
|
||||
break;
|
||||
if (read(dirfd, name, dblk.nlen) != dblk.nlen)
|
||||
break;
|
||||
if (lseek(dirfd, dblk.npos, SEEK_SET) < 0)
|
||||
if (lseek(dirfd, dblk.npos, SEEK_SET) < 0)
|
||||
break;
|
||||
|
||||
/*
|
||||
|
@ -35,7 +35,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)tables.h 8.1 (Berkeley) 5/31/93
|
||||
* $Id$
|
||||
* $Id: tables.h,v 1.2 1994/09/24 02:56:35 davidg Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -106,7 +106,7 @@ typedef struct namt {
|
||||
* this table. (When the inode field in the archive header are too small, we
|
||||
* remap the dev on writes to remove accidental collisions).
|
||||
*
|
||||
* The list is hashed by device number using chain collision resolution. Off of
|
||||
* The list is hashed by device number using chain collision resolution. Off of
|
||||
* each DEVT are linked the various remaps for this device based on those bits
|
||||
* in the inode which were truncated. For example if we are just remapping to
|
||||
* avoid a device number during an update append, off the DEVT we would have
|
||||
|
@ -34,7 +34,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id$
|
||||
* $Id: tar.c,v 1.2 1994/09/24 02:56:37 davidg Exp $
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
@ -182,7 +182,7 @@ ul_oct(val, str, len, term)
|
||||
#endif
|
||||
{
|
||||
register char *pt;
|
||||
|
||||
|
||||
/*
|
||||
* term selects the appropriate character(s) for the end of the string
|
||||
*/
|
||||
@ -246,7 +246,7 @@ uqd_oct(val, str, len, term)
|
||||
#endif
|
||||
{
|
||||
register char *pt;
|
||||
|
||||
|
||||
/*
|
||||
* term selects the appropriate character(s) for the end of the string
|
||||
*/
|
||||
@ -315,8 +315,8 @@ tar_chksm(blk, len)
|
||||
*/
|
||||
pt = blk;
|
||||
stop = blk + CHK_OFFSET;
|
||||
while (pt < stop)
|
||||
chksm += (u_long)(*pt++ & 0xff);
|
||||
while (pt < stop)
|
||||
chksm += (u_long)(*pt++ & 0xff);
|
||||
/*
|
||||
* move past the checksum field and keep going, spec counts the
|
||||
* checksum field as the sum of 8 blanks (which is pre-computed as
|
||||
@ -327,7 +327,7 @@ tar_chksm(blk, len)
|
||||
pt += CHK_LEN;
|
||||
stop = blk + len;
|
||||
while (pt < stop)
|
||||
chksm += (u_long)(*pt++ & 0xff);
|
||||
chksm += (u_long)(*pt++ & 0xff);
|
||||
return(chksm);
|
||||
}
|
||||
|
||||
@ -532,7 +532,7 @@ tar_rd(arcn, buf)
|
||||
* strip off any trailing slash.
|
||||
*/
|
||||
if (*pt == '/') {
|
||||
*pt = '\0';
|
||||
*pt = '\0';
|
||||
--arcn->nlen;
|
||||
}
|
||||
return(0);
|
||||
@ -1013,7 +1013,7 @@ ustar_wr(arcn)
|
||||
*/
|
||||
zf_strncpy(hd->name, pt, sizeof(hd->name));
|
||||
|
||||
/*
|
||||
/*
|
||||
* set the fields in the header that are type dependent
|
||||
*/
|
||||
switch(arcn->type) {
|
||||
|
@ -30,7 +30,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id: print.c,v 1.5 1994/10/02 14:11:32 ache Exp $
|
||||
* $Id: print.c,v 1.6 1995/03/19 13:29:01 joerg Exp $
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
@ -410,7 +410,7 @@ wchan(k, ve)
|
||||
v = ve->var;
|
||||
if (KI_PROC(k)->p_wchan) {
|
||||
if (KI_PROC(k)->p_wmesg)
|
||||
(void)printf("%-*.*s", v->width, v->width,
|
||||
(void)printf("%-*.*s", v->width, v->width,
|
||||
KI_EPROC(k)->e_wmesg);
|
||||
else
|
||||
(void)printf("%-*x", v->width,
|
||||
@ -599,7 +599,7 @@ pagein(k, ve)
|
||||
VAR *v;
|
||||
|
||||
v = ve->var;
|
||||
(void)printf("%*ld", v->width,
|
||||
(void)printf("%*ld", v->width,
|
||||
k->ki_u.u_valid ? k->ki_u.u_ru.ru_majflt : 0);
|
||||
}
|
||||
|
||||
|
@ -30,7 +30,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id: ps.c,v 1.5 1994/10/18 04:27:46 davidg Exp $
|
||||
* $Id: ps.c,v 1.6 1995/03/19 13:29:06 joerg Exp $
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
@ -486,7 +486,7 @@ kludge_oldps_options(s)
|
||||
* if there's a trailing number, and not a preceding 'p' (pid) or
|
||||
* 't' (tty) flag, then assume it's a pid and insert a 'p' flag.
|
||||
*/
|
||||
if (isdigit(*cp) &&
|
||||
if (isdigit(*cp) &&
|
||||
(cp == s || (cp[-1] != 't' && cp[-1] != 'p')) &&
|
||||
(cp - 1 == s || cp[-2] != 't'))
|
||||
*ns++ = 'p';
|
||||
|
@ -30,7 +30,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id: rcp.c,v 1.2 1994/09/24 02:56:56 davidg Exp $
|
||||
* $Id: rcp.c,v 1.3 1995/03/19 13:29:14 joerg Exp $
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
@ -366,10 +366,10 @@ tolocal(argc, argv)
|
||||
if ((bp = malloc(len)) == NULL)
|
||||
err(1, NULL);
|
||||
(void)snprintf(bp, len, "%s -f %s", cmd, src);
|
||||
rem =
|
||||
rem =
|
||||
#ifdef KERBEROS
|
||||
use_kerberos ?
|
||||
kerberos(&host, bp, pwd->pw_name, suser) :
|
||||
use_kerberos ?
|
||||
kerberos(&host, bp, pwd->pw_name, suser) :
|
||||
#endif
|
||||
rcmd(&host, port, pwd->pw_name, suser, bp, 0);
|
||||
(void)free(bp);
|
||||
@ -714,7 +714,7 @@ bad: run_err("%s: %s", np, strerror(errno));
|
||||
j = write(ofd, bp->buf, count);
|
||||
if (j != count) {
|
||||
wrerr = YES;
|
||||
wrerrno = j >= 0 ? EIO : errno;
|
||||
wrerrno = j >= 0 ? EIO : errno;
|
||||
}
|
||||
}
|
||||
count = 0;
|
||||
@ -724,7 +724,7 @@ bad: run_err("%s: %s", np, strerror(errno));
|
||||
if (count != 0 && wrerr == NO &&
|
||||
(j = write(ofd, bp->buf, count)) != count) {
|
||||
wrerr = YES;
|
||||
wrerrno = j >= 0 ? EIO : errno;
|
||||
wrerrno = j >= 0 ? EIO : errno;
|
||||
}
|
||||
if (ftruncate(ofd, size)) {
|
||||
run_err("%s: truncate: %s", np, strerror(errno));
|
||||
@ -780,9 +780,9 @@ kerberos(host, bp, locuser, user)
|
||||
errno = 0;
|
||||
if (dest_realm == NULL)
|
||||
dest_realm = krb_realmofhost(*host);
|
||||
rem =
|
||||
rem =
|
||||
#ifdef CRYPT
|
||||
doencrypt ?
|
||||
doencrypt ?
|
||||
krcmd_mutual(host,
|
||||
port, user, bp, 0, dest_realm, &cred, schedule) :
|
||||
#endif
|
||||
|
@ -30,7 +30,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id: util.c,v 1.2 1994/09/24 02:56:57 davidg Exp $
|
||||
* $Id: util.c,v 1.3 1995/03/19 13:29:16 joerg Exp $
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
@ -118,7 +118,7 @@ susystem(s, userid)
|
||||
switch (pid) {
|
||||
case -1:
|
||||
return (127);
|
||||
|
||||
|
||||
case 0:
|
||||
(void)setuid(userid);
|
||||
execl(_PATH_BSHELL, "sh", "-c", s, NULL);
|
||||
|
@ -30,7 +30,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id: rmail.c,v 1.3 1995/03/05 08:27:14 joerg Exp $
|
||||
* $Id: rmail.c,v 1.4 1995/03/19 13:29:18 joerg Exp $
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
@ -48,7 +48,7 @@ static char sccsid[] = "@(#)rmail.c 8.1 (Berkeley) 5/31/93";
|
||||
*
|
||||
* This program reads the >From ... remote from ... lines that UUCP is so
|
||||
* fond of and turns them into something reasonable. It then execs sendmail
|
||||
* with various options built from these lines.
|
||||
* with various options built from these lines.
|
||||
*
|
||||
* The expected syntax is:
|
||||
*
|
||||
|
@ -33,7 +33,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id$
|
||||
* $Id: alias.c,v 1.2 1994/09/24 02:57:20 davidg Exp $
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
@ -227,7 +227,7 @@ unaliascmd(argc, argv)
|
||||
char **argv;
|
||||
{
|
||||
int i;
|
||||
|
||||
|
||||
while ((i = nextopt("a")) != '\0') {
|
||||
if (i == 'a') {
|
||||
rmaliases();
|
||||
|
@ -33,7 +33,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id$
|
||||
* $Id: error.c,v 1.2 1994/09/24 02:57:27 davidg Exp $
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
@ -53,7 +53,7 @@ static char sccsid[] = "@(#)error.c 8.1 (Berkeley) 5/31/93";
|
||||
#ifdef __STDC__
|
||||
#include "stdarg.h"
|
||||
#else
|
||||
#include <varargs.h>
|
||||
#include <varargs.h>
|
||||
#endif
|
||||
#include <errno.h>
|
||||
|
||||
|
@ -33,7 +33,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id$
|
||||
* $Id: eval.c,v 1.2 1994/09/24 02:57:29 davidg Exp $
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
@ -134,8 +134,8 @@ SHELLPROC {
|
||||
* The eval commmand.
|
||||
*/
|
||||
|
||||
evalcmd(argc, argv)
|
||||
char **argv;
|
||||
evalcmd(argc, argv)
|
||||
char **argv;
|
||||
{
|
||||
char *p;
|
||||
char *concat;
|
||||
@ -233,7 +233,7 @@ evaltree(n, flags)
|
||||
evalsubshell(n, flags);
|
||||
break;
|
||||
case NIF: {
|
||||
int status = 0;
|
||||
int status = 0;
|
||||
|
||||
evaltree(n->nif.test, EV_TESTED);
|
||||
if (evalskip)
|
||||
|
@ -33,7 +33,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id$
|
||||
* $Id: exec.c,v 1.3 1994/09/24 02:57:32 davidg Exp $
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
@ -744,7 +744,7 @@ delete_cmd_entry() {
|
||||
void
|
||||
getcmdentry(name, entry)
|
||||
char *name;
|
||||
struct cmdentry *entry;
|
||||
struct cmdentry *entry;
|
||||
{
|
||||
struct tblentry *cmdp = cmdlookup(name, 0);
|
||||
|
||||
|
@ -33,7 +33,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id: expand.c,v 1.2 1994/09/24 02:57:34 davidg Exp $
|
||||
* $Id: expand.c,v 1.3 1995/03/01 13:04:15 guido Exp $
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
@ -322,10 +322,10 @@ expari(flag)
|
||||
* scan backwards looking for the start of arithmetic. If the
|
||||
* next previous character is a CTLESC character, then we
|
||||
* have to rescan starting from the beginning since CTLESC
|
||||
* characters have to be processed left to right.
|
||||
* characters have to be processed left to right.
|
||||
*/
|
||||
CHECKSTRSPACE(8, expdest);
|
||||
USTPUTC('\0', expdest);
|
||||
USTPUTC('\0', expdest);
|
||||
start = stackblock();
|
||||
p = expdest;
|
||||
while (*p != CTLARI && p >= start)
|
||||
@ -372,7 +372,7 @@ expbackq(cmd, quoted, flag)
|
||||
saveifs = ifsfirst;
|
||||
savelastp = ifslastp;
|
||||
saveargbackq = argbackq;
|
||||
saveherefd = herefd;
|
||||
saveherefd = herefd;
|
||||
herefd = -1;
|
||||
p = grabstackstr(dest);
|
||||
evalbackcmd(cmd, &in);
|
||||
@ -625,7 +625,7 @@ varvalue(name, quoted, allow_split)
|
||||
sep = '\0';
|
||||
goto allargs;
|
||||
}
|
||||
/* fall through */
|
||||
/* fall through */
|
||||
case '*':
|
||||
sep = ' ';
|
||||
allargs:
|
||||
@ -783,8 +783,8 @@ expandmeta(str, flag)
|
||||
expdir = NULL;
|
||||
INTON;
|
||||
if (exparg.lastp == savelastp) {
|
||||
/*
|
||||
* no matches
|
||||
/*
|
||||
* no matches
|
||||
*/
|
||||
nometa:
|
||||
*exparg.lastp = str;
|
||||
@ -969,7 +969,7 @@ msort(list, len)
|
||||
|
||||
if (len <= 1)
|
||||
return list;
|
||||
half = len >> 1;
|
||||
half = len >> 1;
|
||||
p = list;
|
||||
for (n = half ; --n >= 0 ; ) {
|
||||
q = p;
|
||||
|
@ -33,7 +33,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id: histedit.c,v 1.2 1994/09/24 02:57:36 davidg Exp $
|
||||
* $Id: histedit.c,v 1.3 1995/05/05 06:34:13 davidg Exp $
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
@ -140,7 +140,7 @@ sethistsize() {
|
||||
|
||||
if (hist != NULL) {
|
||||
cp = lookupvar("HISTSIZE");
|
||||
if (cp == NULL || *cp == '\0' ||
|
||||
if (cp == NULL || *cp == '\0' ||
|
||||
(histsize = atoi(cp)) < 0)
|
||||
histsize = 100;
|
||||
history(hist, H_EVENT, histsize);
|
||||
@ -172,7 +172,7 @@ histcmd(argc, argv)
|
||||
|
||||
if (hist == NULL)
|
||||
error("history not active");
|
||||
|
||||
|
||||
if (argc == 1)
|
||||
error("missing history argument");
|
||||
|
||||
@ -245,7 +245,7 @@ histcmd(argc, argv)
|
||||
/*
|
||||
* If executing, parse [old=new] now
|
||||
*/
|
||||
if (lflg == 0 && argc > 0 &&
|
||||
if (lflg == 0 && argc > 0 &&
|
||||
((repl = strchr(argv[0], '=')) != NULL)) {
|
||||
pat = argv[0];
|
||||
*repl++ = '\0';
|
||||
@ -283,7 +283,7 @@ histcmd(argc, argv)
|
||||
}
|
||||
/*
|
||||
* XXX - this should not depend on the event numbers
|
||||
* always increasing. Add sequence numbers or offset
|
||||
* always increasing. Add sequence numbers or offset
|
||||
* to the history element in next (diskbased) release.
|
||||
*/
|
||||
direction = first < last ? H_PREV : H_NEXT;
|
||||
@ -319,7 +319,7 @@ histcmd(argc, argv)
|
||||
out1fmt("%5d ", he->num);
|
||||
out1str(he->str);
|
||||
} else {
|
||||
char *s = pat ?
|
||||
char *s = pat ?
|
||||
fc_replace(he->str, pat, repl) : (char *)he->str;
|
||||
|
||||
if (sflg) {
|
||||
@ -329,7 +329,7 @@ histcmd(argc, argv)
|
||||
evalstring(s);
|
||||
if (displayhist && hist) {
|
||||
/*
|
||||
* XXX what about recursive and
|
||||
* XXX what about recursive and
|
||||
* relative histnums.
|
||||
*/
|
||||
history(hist, H_ENTER, s);
|
||||
@ -355,7 +355,7 @@ histcmd(argc, argv)
|
||||
readcmdfile(editfile); /* XXX - should read back - quick tst */
|
||||
unlink(editfile);
|
||||
}
|
||||
|
||||
|
||||
if (lflg == 0 && active > 0)
|
||||
--active;
|
||||
if (displayhist)
|
||||
@ -438,7 +438,7 @@ str_to_event(str, last)
|
||||
str);
|
||||
} else {
|
||||
/*
|
||||
* pattern
|
||||
* pattern
|
||||
*/
|
||||
he = history(hist, H_PREV_STR, str);
|
||||
if (he == NULL)
|
||||
|
@ -33,7 +33,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id$
|
||||
* $Id: input.c,v 1.2 1994/09/24 02:57:39 davidg Exp $
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
@ -264,7 +264,7 @@ preadbuffer() {
|
||||
done:
|
||||
if (parsefile->fd == 0 && hist && something) {
|
||||
INTOFF;
|
||||
history(hist, whichprompt == 1 ? H_ENTER : H_ADD,
|
||||
history(hist, whichprompt == 1 ? H_ENTER : H_ADD,
|
||||
parsefile->buf);
|
||||
INTON;
|
||||
}
|
||||
@ -276,7 +276,7 @@ preadbuffer() {
|
||||
*/
|
||||
i = parsenleft + 1;
|
||||
p = parsefile->buf;
|
||||
for (; i--; p++)
|
||||
for (; i--; p++)
|
||||
out2c(*p)
|
||||
flushout(out2);
|
||||
}
|
||||
|
@ -33,7 +33,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id$
|
||||
* $Id: jobs.c,v 1.2 1994/09/24 02:57:41 davidg Exp $
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
@ -488,7 +488,7 @@ makejob(node, nprocs)
|
||||
INTON;
|
||||
TRACE(("makejob(0x%x, %d) returns %%%d\n", (int)node, nprocs, jp - jobtab + 1));
|
||||
return jp;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
|
@ -33,7 +33,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id$
|
||||
* $Id: main.c,v 1.2 1994/09/24 02:57:48 davidg Exp $
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
@ -153,7 +153,7 @@ main(argc, argv) char **argv; {
|
||||
state1:
|
||||
state = 2;
|
||||
read_profile(".profile");
|
||||
}
|
||||
}
|
||||
state2:
|
||||
state = 3;
|
||||
if ((shinit = lookupvar("ENV")) != NULL &&
|
||||
|
@ -33,7 +33,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id: mkinit.c,v 1.2 1994/09/24 02:57:54 davidg Exp $
|
||||
* $Id: mkinit.c,v 1.3 1994/11/06 06:27:04 pst Exp $
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
@ -91,7 +91,7 @@ struct text {
|
||||
int nleft;
|
||||
struct block *start;
|
||||
struct block *last;
|
||||
};
|
||||
};
|
||||
|
||||
struct block {
|
||||
struct block *next;
|
||||
|
@ -33,7 +33,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id$
|
||||
* $Id: mksignames.c,v 1.2 1994/09/24 02:57:56 davidg Exp $
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
@ -158,7 +158,7 @@ char writer[] = "\
|
||||
|
||||
|
||||
main(argc, argv) char **argv; {
|
||||
FILE *cfile, *hfile;
|
||||
FILE *cfile, *hfile;
|
||||
struct sig *sigp;
|
||||
int maxsig;
|
||||
int i;
|
||||
|
@ -33,7 +33,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id$
|
||||
* $Id: options.c,v 1.2 1994/09/24 02:58:04 davidg Exp $
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
@ -201,7 +201,7 @@ minus_o(name, val)
|
||||
error("Illegal option -o %s", name);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
STATIC void
|
||||
setoption(flag, val)
|
||||
|
@ -33,7 +33,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id: parser.c,v 1.4 1995/01/09 20:00:54 paul Exp $
|
||||
* $Id: parser.c,v 1.5 1995/01/11 07:07:00 paul Exp $
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
@ -472,7 +472,7 @@ TRACE(("expecting DO got %s %s\n", tokname[got], got == TWORD ? wordtext : ""));
|
||||
|
||||
|
||||
STATIC union node *
|
||||
simplecmd(rpp, redir)
|
||||
simplecmd(rpp, redir)
|
||||
union node **rpp, *redir;
|
||||
{
|
||||
union node *args, **app;
|
||||
@ -486,10 +486,10 @@ simplecmd(rpp, redir)
|
||||
|
||||
args = NULL;
|
||||
app = &args;
|
||||
/*
|
||||
/*
|
||||
* We save the incoming value, because we need this for shell
|
||||
* functions. There can not be a redirect or an argument between
|
||||
* the function name and the open parenthesis.
|
||||
* the function name and the open parenthesis.
|
||||
*/
|
||||
orig_rpp = rpp;
|
||||
|
||||
@ -630,7 +630,7 @@ readtoken() {
|
||||
#ifdef DEBUG
|
||||
int alreadyseen = tokpushback;
|
||||
#endif
|
||||
|
||||
|
||||
top:
|
||||
t = xxreadtoken();
|
||||
|
||||
@ -926,7 +926,7 @@ readtoken1(firstc, syntax, eofmark, striptabs)
|
||||
} else
|
||||
USTPUTC(')', out);
|
||||
} else {
|
||||
/*
|
||||
/*
|
||||
* unbalanced parens
|
||||
* (don't 2nd guess - no error)
|
||||
*/
|
||||
@ -1176,7 +1176,7 @@ parsebackq: {
|
||||
register c;
|
||||
int savelen;
|
||||
char *str;
|
||||
|
||||
|
||||
STARTSTACKSTR(out);
|
||||
while ((c = pgetc ()) != '`') {
|
||||
if (c == '\\') {
|
||||
|
@ -33,7 +33,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id$
|
||||
* $Id: redir.c,v 1.2 1994/09/24 02:58:10 davidg Exp $
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
@ -72,10 +72,10 @@ struct redirtab {
|
||||
|
||||
MKINIT struct redirtab *redirlist;
|
||||
|
||||
/*
|
||||
/*
|
||||
* We keep track of whether or not fd0 has been redirected. This is for
|
||||
* background commands, where we want to redirect fd0 to /dev/null only
|
||||
* if it hasn't already been redirected.
|
||||
* if it hasn't already been redirected.
|
||||
*/
|
||||
int fd0_redirected = 0;
|
||||
|
||||
|
@ -33,7 +33,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id$
|
||||
* $Id: trap.c,v 1.2 1994/09/24 02:58:18 davidg Exp $
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
@ -187,13 +187,13 @@ setsignal(signo) {
|
||||
}
|
||||
}
|
||||
t = &sigmode[signo - 1];
|
||||
if (*t == 0) {
|
||||
/*
|
||||
* current setting unknown
|
||||
if (*t == 0) {
|
||||
/*
|
||||
* current setting unknown
|
||||
*/
|
||||
sigact = getsigaction(signo);
|
||||
if (sigact == SIG_IGN) {
|
||||
if (mflag && (signo == SIGTSTP ||
|
||||
if (mflag && (signo == SIGTSTP ||
|
||||
signo == SIGTTIN || signo == SIGTTOU)) {
|
||||
*t = S_IGN; /* don't hard ignore these */
|
||||
} else
|
||||
|
@ -33,7 +33,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id$
|
||||
* $Id: var.c,v 1.2 1994/09/24 02:58:22 davidg Exp $
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
@ -93,7 +93,7 @@ const struct varinit varinit[] = {
|
||||
{&vmail, VSTRFIXED|VTEXTFIXED|VUNSET, "MAIL="},
|
||||
{&vmpath, VSTRFIXED|VTEXTFIXED|VUNSET, "MAILPATH="},
|
||||
{&vpath, VSTRFIXED|VTEXTFIXED, "PATH=:/bin:/usr/bin"},
|
||||
/*
|
||||
/*
|
||||
* vps1 depends on uid
|
||||
*/
|
||||
{&vps2, VSTRFIXED|VTEXTFIXED, "PS2=> "},
|
||||
@ -586,7 +586,7 @@ unsetcmd(argc, argv) char **argv; {
|
||||
}
|
||||
if (flg_func == 0 && flg_var == 0)
|
||||
flg_var = 1;
|
||||
|
||||
|
||||
for (ap = argptr; *ap ; ap++) {
|
||||
if (flg_func)
|
||||
ret |= unsetfunc(*ap);
|
||||
|
@ -30,7 +30,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id: cchar.c,v 1.2 1994/09/24 02:58:55 davidg Exp $
|
||||
* $Id: cchar.c,v 1.3 1995/04/28 19:29:28 ache Exp $
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
@ -100,7 +100,7 @@ csearch(argvp, ip)
|
||||
struct cchar *cp, tmp;
|
||||
long val;
|
||||
char *arg, *ep, *name;
|
||||
|
||||
|
||||
name = **argvp;
|
||||
|
||||
tmp.name = name;
|
||||
|
@ -30,7 +30,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id: gfmt.c,v 1.2 1994/09/24 02:58:57 davidg Exp $
|
||||
* $Id: gfmt.c,v 1.3 1995/03/19 13:29:23 joerg Exp $
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
@ -72,7 +72,7 @@ gprint(tp, wp, ldisc)
|
||||
}
|
||||
|
||||
void
|
||||
gread(tp, s)
|
||||
gread(tp, s)
|
||||
struct termios *tp;
|
||||
char *s;
|
||||
{
|
||||
|
@ -30,7 +30,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id: print.c,v 1.3 1995/04/28 19:29:30 ache Exp $
|
||||
* $Id: print.c,v 1.4 1995/04/29 15:17:16 bde Exp $
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
@ -70,19 +70,19 @@ print(tp, wp, ldisc, fmt)
|
||||
/* Line discipline. */
|
||||
if (ldisc != TTYDISC) {
|
||||
switch(ldisc) {
|
||||
case TABLDISC:
|
||||
case TABLDISC:
|
||||
cnt += printf("tablet disc; ");
|
||||
break;
|
||||
case NTTYDISC:
|
||||
cnt += printf("new tty disc; ");
|
||||
break;
|
||||
case SLIPDISC:
|
||||
case SLIPDISC:
|
||||
cnt += printf("slip disc; ");
|
||||
break;
|
||||
case PPPDISC:
|
||||
cnt += printf("ppp disc; ");
|
||||
break;
|
||||
default:
|
||||
default:
|
||||
cnt += printf("#%d disc; ", ldisc);
|
||||
break;
|
||||
}
|
||||
|
@ -30,7 +30,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id: stty.c,v 1.2 1994/09/24 02:59:02 davidg Exp $
|
||||
* $Id: stty.c,v 1.3 1995/04/29 15:00:34 bde Exp $
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
@ -58,7 +58,7 @@ static char sccsid[] = "@(#)stty.c 8.3 (Berkeley) 4/2/94";
|
||||
#include "extern.h"
|
||||
|
||||
int
|
||||
main(argc, argv)
|
||||
main(argc, argv)
|
||||
int argc;
|
||||
char *argv[];
|
||||
{
|
||||
@ -117,7 +117,7 @@ args: argc -= optind;
|
||||
gprint(&i.t, &i.win, i.ldisc);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
for (i.set = i.wset = 0; *argv; ++argv) {
|
||||
if (ksearch(&argv, &i))
|
||||
continue;
|
||||
|
@ -33,7 +33,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id: test.c,v 1.9 1994/11/05 20:48:06 ache Exp $
|
||||
* $Id: test.c,v 1.10 1995/03/19 13:29:28 joerg Exp $
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
@ -238,13 +238,13 @@ main(argc, argv)
|
||||
get_int(valsp->u.string,
|
||||
&valsp->u.num);
|
||||
valsp->type = INTEGER;
|
||||
} else if (c >= OP_STRING) {
|
||||
} else if (c >= OP_STRING) {
|
||||
/* OP_STRING or OP_FILE */
|
||||
if (valsp->type == INTEGER) {
|
||||
if ((p = malloc(32)) == NULL)
|
||||
err(2, NULL);
|
||||
#ifdef SHELL
|
||||
fmtstr(p, 32, "%d",
|
||||
fmtstr(p, 32, "%d",
|
||||
valsp->u.num);
|
||||
#else
|
||||
(void)sprintf(p,
|
||||
@ -253,7 +253,7 @@ main(argc, argv)
|
||||
valsp->u.string = p;
|
||||
} else if (valsp->type == BOOLEAN) {
|
||||
if (valsp->u.num)
|
||||
valsp->u.string =
|
||||
valsp->u.string =
|
||||
"true";
|
||||
else
|
||||
valsp->u.string = "";
|
||||
@ -262,8 +262,8 @@ main(argc, argv)
|
||||
if (c == OP_FILE && (fs.name == NULL ||
|
||||
strcmp(fs.name, valsp->u.string))) {
|
||||
fs.name = valsp->u.string;
|
||||
fs.rcode =
|
||||
stat(valsp->u.string,
|
||||
fs.rcode =
|
||||
stat(valsp->u.string,
|
||||
&fs.stat);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user