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>
|
||||
@ -39,7 +39,7 @@
|
||||
#ifndef lint
|
||||
__COPYRIGHT(
|
||||
"@(#) 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
|
||||
|
||||
#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_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_exchange __P((char *, int, char **));
|
||||
@ -111,7 +111,7 @@ const struct special_word specials[] = {
|
||||
};
|
||||
|
||||
static int changer_fd;
|
||||
static char *changer_name;
|
||||
static const char *changer_name;
|
||||
|
||||
int
|
||||
main(argc, argv)
|
||||
@ -718,28 +718,32 @@ is_special(cp)
|
||||
return (0);
|
||||
}
|
||||
|
||||
static char *
|
||||
static const char *
|
||||
bits_to_string(v, cp)
|
||||
int v;
|
||||
const char *cp;
|
||||
{
|
||||
const char *np;
|
||||
char f, sep, *bp;
|
||||
char f, *bp;
|
||||
int first;
|
||||
static char buf[128];
|
||||
|
||||
bp = buf;
|
||||
(void) memset(buf, 0, sizeof(buf));
|
||||
|
||||
for (sep = '<'; (f = *cp++) != 0; cp = np) {
|
||||
*bp++ = '<';
|
||||
for (first = 1; (f = *cp++) != 0; cp = np) {
|
||||
for (np = cp; *np >= ' ';)
|
||||
np++;
|
||||
if ((v & (1 << (f - 1))) == 0)
|
||||
continue;
|
||||
bp += sprintf(bp, "%c%.*s", sep, (int)(long)(np - cp), cp);
|
||||
sep = ',';
|
||||
if (first)
|
||||
first = 0;
|
||||
else
|
||||
*bp++ = ',';
|
||||
memcpy(bp, cp, np - cp);
|
||||
bp += np - cp;
|
||||
}
|
||||
if (sep != '<')
|
||||
*bp = '>';
|
||||
*bp++ = '>';
|
||||
*bp = '\0';
|
||||
|
||||
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
|
||||
@ -43,7 +43,7 @@ __COPYRIGHT("@(#) Copyright (c) 1980, 1991, 1993\n\
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)csh.c 8.2 (Berkeley) 10/12/93";
|
||||
#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 /* not lint */
|
||||
|
||||
@ -126,6 +126,7 @@ main(argc, argv)
|
||||
{
|
||||
Char *cp;
|
||||
char *tcp;
|
||||
const char *ecp;
|
||||
int f;
|
||||
char **tempv;
|
||||
struct sigaction oact;
|
||||
@ -238,8 +239,8 @@ main(argc, argv)
|
||||
*/
|
||||
set(STRstatus, Strsave(STR0));
|
||||
|
||||
if ((tcp = getenv("HOME")) != NULL)
|
||||
cp = quote(SAVE(tcp));
|
||||
if ((ecp = getenv("HOME")) != NULL)
|
||||
cp = quote(SAVE(ecp));
|
||||
else
|
||||
cp = NULL;
|
||||
|
||||
@ -253,23 +254,23 @@ main(argc, argv)
|
||||
* Grab other useful things from the environment. Should we grab
|
||||
* everything??
|
||||
*/
|
||||
if ((tcp = getenv("LOGNAME")) != NULL ||
|
||||
(tcp = getenv("USER")) != NULL)
|
||||
set(STRuser, quote(SAVE(tcp)));
|
||||
if ((tcp = getenv("TERM")) != NULL)
|
||||
set(STRterm, quote(SAVE(tcp)));
|
||||
if ((ecp = getenv("LOGNAME")) != NULL ||
|
||||
(ecp = getenv("USER")) != NULL)
|
||||
set(STRuser, quote(SAVE(ecp)));
|
||||
if ((ecp = getenv("TERM")) != NULL)
|
||||
set(STRterm, quote(SAVE(ecp)));
|
||||
|
||||
/*
|
||||
* Re-initialize path if set in environment
|
||||
*/
|
||||
if ((tcp = getenv("PATH")) == NULL) {
|
||||
if ((ecp = getenv("PATH")) == NULL) {
|
||||
#ifdef _PATH_DEFPATH
|
||||
importpath(SAVE(_PATH_DEFPATH));
|
||||
#else
|
||||
setq(STRpath, defaultpath(), &shvhed);
|
||||
#endif
|
||||
} else {
|
||||
importpath(SAVE(tcp));
|
||||
importpath(SAVE(ecp));
|
||||
}
|
||||
|
||||
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
|
||||
@ -38,7 +38,7 @@
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)dir.c 8.1 (Berkeley) 5/31/93";
|
||||
#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 /* not lint */
|
||||
|
||||
@ -81,19 +81,19 @@ void
|
||||
dinit(hp)
|
||||
Char *hp;
|
||||
{
|
||||
char *tcp;
|
||||
const char *ecp;
|
||||
Char *cp;
|
||||
struct directory *dp;
|
||||
char path[MAXPATHLEN];
|
||||
static char *emsg = "csh: Trying to start from \"%s\"\n";
|
||||
|
||||
/* Don't believe the login shell home, because it may be a symlink */
|
||||
tcp = getcwd(path, MAXPATHLEN);
|
||||
if (tcp == NULL || *tcp == '\0') {
|
||||
ecp = getcwd(path, MAXPATHLEN);
|
||||
if (ecp == NULL || *ecp == '\0') {
|
||||
(void) fprintf(csherr, "csh: %s\n", strerror(errno));
|
||||
if (hp && *hp) {
|
||||
tcp = short2str(hp);
|
||||
if (chdir(tcp) == -1)
|
||||
ecp = short2str(hp);
|
||||
if (chdir(ecp) == -1)
|
||||
cp = NULL;
|
||||
else
|
||||
cp = hp;
|
||||
@ -116,11 +116,11 @@ dinit(hp)
|
||||
* See if $HOME is the working directory we got and use that
|
||||
*/
|
||||
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)
|
||||
cp = hp;
|
||||
else {
|
||||
char *cwd;
|
||||
const char *cwd;
|
||||
|
||||
/*
|
||||
* use PWD if we have it (for subshells)
|
||||
@ -128,9 +128,9 @@ dinit(hp)
|
||||
if ((cwd = getenv("PWD")) != NULL) {
|
||||
if (stat(cwd, &shp) != -1 && swd.st_dev == shp.st_dev &&
|
||||
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
|
||||
@ -38,7 +38,7 @@
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)err.c 8.1 (Berkeley) 5/31/93";
|
||||
#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 /* not lint */
|
||||
|
||||
@ -312,7 +312,8 @@ seterror(id, va_alist)
|
||||
#endif
|
||||
if (id < 0 || id > sizeof(errorlist) / sizeof(errorlist[0]))
|
||||
id = ERR_INVALID;
|
||||
vsprintf(berr, errorlist[id], va);
|
||||
vsnprintf(berr, sizeof(berr) - 1, errorlist[id], va);
|
||||
berr[sizeof(berr) - 1] = '\0';
|
||||
va_end(va);
|
||||
|
||||
seterr = strsave(berr);
|
||||
|
Loading…
Reference in New Issue
Block a user