const propagation.
This commit is contained in:
parent
2e9ada3aff
commit
4d669802e4
@ -1,4 +1,4 @@
|
|||||||
/* $NetBSD: chio.c,v 1.7 1998/07/13 12:06:18 hpeyerl Exp $ */
|
/* $NetBSD: chio.c,v 1.8 1998/07/27 15:25:06 mycroft Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1996, 1998 Jason R. Thorpe <thorpej@and.com>
|
* Copyright (c) 1996, 1998 Jason R. Thorpe <thorpej@and.com>
|
||||||
@ -39,7 +39,7 @@
|
|||||||
#ifndef lint
|
#ifndef lint
|
||||||
__COPYRIGHT(
|
__COPYRIGHT(
|
||||||
"@(#) Copyright (c) 1996, 1998 Jason R. Thorpe. All rights reserved.");
|
"@(#) Copyright (c) 1996, 1998 Jason R. Thorpe. All rights reserved.");
|
||||||
__RCSID("$NetBSD: chio.c,v 1.7 1998/07/13 12:06:18 hpeyerl Exp $");
|
__RCSID("$NetBSD: chio.c,v 1.8 1998/07/27 15:25:06 mycroft Exp $");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <sys/param.h>
|
#include <sys/param.h>
|
||||||
@ -67,7 +67,7 @@ static int parse_element_type __P((char *));
|
|||||||
static int parse_element_unit __P((char *));
|
static int parse_element_unit __P((char *));
|
||||||
static int parse_special __P((char *));
|
static int parse_special __P((char *));
|
||||||
static int is_special __P((char *));
|
static int is_special __P((char *));
|
||||||
static char *bits_to_string __P((int, const char *));
|
static const char *bits_to_string __P((int, const char *));
|
||||||
|
|
||||||
static int do_move __P((char *, int, char **));
|
static int do_move __P((char *, int, char **));
|
||||||
static int do_exchange __P((char *, int, char **));
|
static int do_exchange __P((char *, int, char **));
|
||||||
@ -111,7 +111,7 @@ const struct special_word specials[] = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
static int changer_fd;
|
static int changer_fd;
|
||||||
static char *changer_name;
|
static const char *changer_name;
|
||||||
|
|
||||||
int
|
int
|
||||||
main(argc, argv)
|
main(argc, argv)
|
||||||
@ -718,28 +718,32 @@ is_special(cp)
|
|||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static char *
|
static const char *
|
||||||
bits_to_string(v, cp)
|
bits_to_string(v, cp)
|
||||||
int v;
|
int v;
|
||||||
const char *cp;
|
const char *cp;
|
||||||
{
|
{
|
||||||
const char *np;
|
const char *np;
|
||||||
char f, sep, *bp;
|
char f, *bp;
|
||||||
|
int first;
|
||||||
static char buf[128];
|
static char buf[128];
|
||||||
|
|
||||||
bp = buf;
|
bp = buf;
|
||||||
(void) memset(buf, 0, sizeof(buf));
|
*bp++ = '<';
|
||||||
|
for (first = 1; (f = *cp++) != 0; cp = np) {
|
||||||
for (sep = '<'; (f = *cp++) != 0; cp = np) {
|
|
||||||
for (np = cp; *np >= ' ';)
|
for (np = cp; *np >= ' ';)
|
||||||
np++;
|
np++;
|
||||||
if ((v & (1 << (f - 1))) == 0)
|
if ((v & (1 << (f - 1))) == 0)
|
||||||
continue;
|
continue;
|
||||||
bp += sprintf(bp, "%c%.*s", sep, (int)(long)(np - cp), cp);
|
if (first)
|
||||||
sep = ',';
|
first = 0;
|
||||||
|
else
|
||||||
|
*bp++ = ',';
|
||||||
|
memcpy(bp, cp, np - cp);
|
||||||
|
bp += np - cp;
|
||||||
}
|
}
|
||||||
if (sep != '<')
|
*bp++ = '>';
|
||||||
*bp = '>';
|
*bp = '\0';
|
||||||
|
|
||||||
return (buf);
|
return (buf);
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* $NetBSD: csh.c,v 1.19 1998/04/08 22:35:54 fair Exp $ */
|
/* $NetBSD: csh.c,v 1.20 1998/07/27 15:32:04 mycroft Exp $ */
|
||||||
|
|
||||||
/*-
|
/*-
|
||||||
* Copyright (c) 1980, 1991, 1993
|
* Copyright (c) 1980, 1991, 1993
|
||||||
@ -43,7 +43,7 @@ __COPYRIGHT("@(#) Copyright (c) 1980, 1991, 1993\n\
|
|||||||
#if 0
|
#if 0
|
||||||
static char sccsid[] = "@(#)csh.c 8.2 (Berkeley) 10/12/93";
|
static char sccsid[] = "@(#)csh.c 8.2 (Berkeley) 10/12/93";
|
||||||
#else
|
#else
|
||||||
__RCSID("$NetBSD: csh.c,v 1.19 1998/04/08 22:35:54 fair Exp $");
|
__RCSID("$NetBSD: csh.c,v 1.20 1998/07/27 15:32:04 mycroft Exp $");
|
||||||
#endif
|
#endif
|
||||||
#endif /* not lint */
|
#endif /* not lint */
|
||||||
|
|
||||||
@ -126,6 +126,7 @@ main(argc, argv)
|
|||||||
{
|
{
|
||||||
Char *cp;
|
Char *cp;
|
||||||
char *tcp;
|
char *tcp;
|
||||||
|
const char *ecp;
|
||||||
int f;
|
int f;
|
||||||
char **tempv;
|
char **tempv;
|
||||||
struct sigaction oact;
|
struct sigaction oact;
|
||||||
@ -238,8 +239,8 @@ main(argc, argv)
|
|||||||
*/
|
*/
|
||||||
set(STRstatus, Strsave(STR0));
|
set(STRstatus, Strsave(STR0));
|
||||||
|
|
||||||
if ((tcp = getenv("HOME")) != NULL)
|
if ((ecp = getenv("HOME")) != NULL)
|
||||||
cp = quote(SAVE(tcp));
|
cp = quote(SAVE(ecp));
|
||||||
else
|
else
|
||||||
cp = NULL;
|
cp = NULL;
|
||||||
|
|
||||||
@ -253,23 +254,23 @@ main(argc, argv)
|
|||||||
* Grab other useful things from the environment. Should we grab
|
* Grab other useful things from the environment. Should we grab
|
||||||
* everything??
|
* everything??
|
||||||
*/
|
*/
|
||||||
if ((tcp = getenv("LOGNAME")) != NULL ||
|
if ((ecp = getenv("LOGNAME")) != NULL ||
|
||||||
(tcp = getenv("USER")) != NULL)
|
(ecp = getenv("USER")) != NULL)
|
||||||
set(STRuser, quote(SAVE(tcp)));
|
set(STRuser, quote(SAVE(ecp)));
|
||||||
if ((tcp = getenv("TERM")) != NULL)
|
if ((ecp = getenv("TERM")) != NULL)
|
||||||
set(STRterm, quote(SAVE(tcp)));
|
set(STRterm, quote(SAVE(ecp)));
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Re-initialize path if set in environment
|
* Re-initialize path if set in environment
|
||||||
*/
|
*/
|
||||||
if ((tcp = getenv("PATH")) == NULL) {
|
if ((ecp = getenv("PATH")) == NULL) {
|
||||||
#ifdef _PATH_DEFPATH
|
#ifdef _PATH_DEFPATH
|
||||||
importpath(SAVE(_PATH_DEFPATH));
|
importpath(SAVE(_PATH_DEFPATH));
|
||||||
#else
|
#else
|
||||||
setq(STRpath, defaultpath(), &shvhed);
|
setq(STRpath, defaultpath(), &shvhed);
|
||||||
#endif
|
#endif
|
||||||
} else {
|
} else {
|
||||||
importpath(SAVE(tcp));
|
importpath(SAVE(ecp));
|
||||||
}
|
}
|
||||||
|
|
||||||
set(STRshell, Strsave(STR_SHELLPATH));
|
set(STRshell, Strsave(STR_SHELLPATH));
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* $NetBSD: dir.c,v 1.11 1997/07/04 21:23:55 christos Exp $ */
|
/* $NetBSD: dir.c,v 1.12 1998/07/27 15:32:04 mycroft Exp $ */
|
||||||
|
|
||||||
/*-
|
/*-
|
||||||
* Copyright (c) 1980, 1991, 1993
|
* Copyright (c) 1980, 1991, 1993
|
||||||
@ -38,7 +38,7 @@
|
|||||||
#if 0
|
#if 0
|
||||||
static char sccsid[] = "@(#)dir.c 8.1 (Berkeley) 5/31/93";
|
static char sccsid[] = "@(#)dir.c 8.1 (Berkeley) 5/31/93";
|
||||||
#else
|
#else
|
||||||
__RCSID("$NetBSD: dir.c,v 1.11 1997/07/04 21:23:55 christos Exp $");
|
__RCSID("$NetBSD: dir.c,v 1.12 1998/07/27 15:32:04 mycroft Exp $");
|
||||||
#endif
|
#endif
|
||||||
#endif /* not lint */
|
#endif /* not lint */
|
||||||
|
|
||||||
@ -81,19 +81,19 @@ void
|
|||||||
dinit(hp)
|
dinit(hp)
|
||||||
Char *hp;
|
Char *hp;
|
||||||
{
|
{
|
||||||
char *tcp;
|
const char *ecp;
|
||||||
Char *cp;
|
Char *cp;
|
||||||
struct directory *dp;
|
struct directory *dp;
|
||||||
char path[MAXPATHLEN];
|
char path[MAXPATHLEN];
|
||||||
static char *emsg = "csh: Trying to start from \"%s\"\n";
|
static char *emsg = "csh: Trying to start from \"%s\"\n";
|
||||||
|
|
||||||
/* Don't believe the login shell home, because it may be a symlink */
|
/* Don't believe the login shell home, because it may be a symlink */
|
||||||
tcp = getcwd(path, MAXPATHLEN);
|
ecp = getcwd(path, MAXPATHLEN);
|
||||||
if (tcp == NULL || *tcp == '\0') {
|
if (ecp == NULL || *ecp == '\0') {
|
||||||
(void) fprintf(csherr, "csh: %s\n", strerror(errno));
|
(void) fprintf(csherr, "csh: %s\n", strerror(errno));
|
||||||
if (hp && *hp) {
|
if (hp && *hp) {
|
||||||
tcp = short2str(hp);
|
ecp = short2str(hp);
|
||||||
if (chdir(tcp) == -1)
|
if (chdir(ecp) == -1)
|
||||||
cp = NULL;
|
cp = NULL;
|
||||||
else
|
else
|
||||||
cp = hp;
|
cp = hp;
|
||||||
@ -116,11 +116,11 @@ dinit(hp)
|
|||||||
* See if $HOME is the working directory we got and use that
|
* See if $HOME is the working directory we got and use that
|
||||||
*/
|
*/
|
||||||
if (hp && *hp &&
|
if (hp && *hp &&
|
||||||
stat(tcp, &swd) != -1 && stat(short2str(hp), &shp) != -1 &&
|
stat(ecp, &swd) != -1 && stat(short2str(hp), &shp) != -1 &&
|
||||||
swd.st_dev == shp.st_dev && swd.st_ino == shp.st_ino)
|
swd.st_dev == shp.st_dev && swd.st_ino == shp.st_ino)
|
||||||
cp = hp;
|
cp = hp;
|
||||||
else {
|
else {
|
||||||
char *cwd;
|
const char *cwd;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* use PWD if we have it (for subshells)
|
* use PWD if we have it (for subshells)
|
||||||
@ -128,9 +128,9 @@ dinit(hp)
|
|||||||
if ((cwd = getenv("PWD")) != NULL) {
|
if ((cwd = getenv("PWD")) != NULL) {
|
||||||
if (stat(cwd, &shp) != -1 && swd.st_dev == shp.st_dev &&
|
if (stat(cwd, &shp) != -1 && swd.st_dev == shp.st_dev &&
|
||||||
swd.st_ino == shp.st_ino)
|
swd.st_ino == shp.st_ino)
|
||||||
tcp = cwd;
|
ecp = cwd;
|
||||||
}
|
}
|
||||||
cp = dcanon(SAVE(tcp), STRNULL);
|
cp = dcanon(SAVE(ecp), STRNULL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* $NetBSD: err.c,v 1.8 1997/07/04 21:23:57 christos Exp $ */
|
/* $NetBSD: err.c,v 1.9 1998/07/27 15:32:04 mycroft Exp $ */
|
||||||
|
|
||||||
/*-
|
/*-
|
||||||
* Copyright (c) 1980, 1991, 1993
|
* Copyright (c) 1980, 1991, 1993
|
||||||
@ -38,7 +38,7 @@
|
|||||||
#if 0
|
#if 0
|
||||||
static char sccsid[] = "@(#)err.c 8.1 (Berkeley) 5/31/93";
|
static char sccsid[] = "@(#)err.c 8.1 (Berkeley) 5/31/93";
|
||||||
#else
|
#else
|
||||||
__RCSID("$NetBSD: err.c,v 1.8 1997/07/04 21:23:57 christos Exp $");
|
__RCSID("$NetBSD: err.c,v 1.9 1998/07/27 15:32:04 mycroft Exp $");
|
||||||
#endif
|
#endif
|
||||||
#endif /* not lint */
|
#endif /* not lint */
|
||||||
|
|
||||||
@ -312,7 +312,8 @@ seterror(id, va_alist)
|
|||||||
#endif
|
#endif
|
||||||
if (id < 0 || id > sizeof(errorlist) / sizeof(errorlist[0]))
|
if (id < 0 || id > sizeof(errorlist) / sizeof(errorlist[0]))
|
||||||
id = ERR_INVALID;
|
id = ERR_INVALID;
|
||||||
vsprintf(berr, errorlist[id], va);
|
vsnprintf(berr, sizeof(berr) - 1, errorlist[id], va);
|
||||||
|
berr[sizeof(berr) - 1] = '\0';
|
||||||
va_end(va);
|
va_end(va);
|
||||||
|
|
||||||
seterr = strsave(berr);
|
seterr = strsave(berr);
|
||||||
|
Loading…
Reference in New Issue
Block a user