tcsh: update to version 6.22.04.
Merge commit '174d8b60324d7e8754709f7155e13ca95220b48c' into main. MFC After: 2 weeks
This commit is contained in:
commit
6560ac57ce
@ -1,3 +1,4 @@
|
||||
15. V6.22.04 - 20210426
|
||||
14. Don't crash with 'bindkey "^0" clear-screen' (Karl Jeacle)
|
||||
13. Fix $x:q:h and $x:q:t return the whole string for strings not containing /
|
||||
12. V6.22.03 - 20201118
|
||||
|
@ -51,7 +51,7 @@
|
||||
hello world
|
||||
# echo "h<press key bound to dabbrev-expande>
|
||||
# echo "hello<cursor>
|
||||
|
||||
|
||||
The former problem could be solved with minor modifications of c_preword()
|
||||
and c_endword(). The latter, however, required a significant rewrite of
|
||||
c_preword(), since quoted strings must be parsed from start to end to
|
||||
@ -207,9 +207,9 @@ c_delafter(int num)
|
||||
}
|
||||
#ifdef notdef
|
||||
else {
|
||||
/*
|
||||
/*
|
||||
* XXX: We don't want to do that. In emacs mode overwrite should be
|
||||
* sticky. I am not sure how that affects vi mode
|
||||
* sticky. I am not sure how that affects vi mode
|
||||
*/
|
||||
inputmode = MODE_INSERT;
|
||||
}
|
||||
@ -269,7 +269,7 @@ c_preword(Char *p, Char *low, int n, Char *delim)
|
||||
new = c_endword(prev-1, p, 1, delim); /* Skip to next non-word char */
|
||||
new++; /* Step away from end of word */
|
||||
while (new <= p) { /* Skip trailing non-word chars */
|
||||
if (!Strchr(delim, *new) || new > prev && new[-1] == (Char)'\\')
|
||||
if (!Strchr(delim, *new) || (new > prev && new[-1] == (Char)'\\'))
|
||||
break;
|
||||
new++;
|
||||
}
|
||||
@ -314,12 +314,12 @@ c_prev_word(Char *p, Char *low, int n)
|
||||
|
||||
if (!VImode) {
|
||||
while (n--) {
|
||||
while ((p >= low) && !isword(*p))
|
||||
while ((p >= low) && !isword(*p))
|
||||
p--;
|
||||
while ((p >= low) && isword(*p))
|
||||
while ((p >= low) && isword(*p))
|
||||
p--;
|
||||
}
|
||||
|
||||
|
||||
/* cp now points to one character before the word */
|
||||
p++;
|
||||
if (p < low)
|
||||
@ -327,7 +327,7 @@ c_prev_word(Char *p, Char *low, int n)
|
||||
/* cp now points where we want it */
|
||||
return(p);
|
||||
}
|
||||
|
||||
|
||||
while (n--) {
|
||||
int c_class;
|
||||
|
||||
@ -359,9 +359,9 @@ c_next_word(Char *p, Char *high, int n)
|
||||
{
|
||||
if (!VImode) {
|
||||
while (n--) {
|
||||
while ((p < high) && !isword(*p))
|
||||
while ((p < high) && !isword(*p))
|
||||
p++;
|
||||
while ((p < high) && isword(*p))
|
||||
while ((p < high) && isword(*p))
|
||||
p++;
|
||||
}
|
||||
if (p > high)
|
||||
@ -399,9 +399,9 @@ static Char *
|
||||
c_nexword(Char *p, Char *high, int n)
|
||||
{
|
||||
while (n--) {
|
||||
while ((p < high) && !Isspace(*p))
|
||||
while ((p < high) && !Isspace(*p))
|
||||
p++;
|
||||
while ((p < high) && Isspace(*p))
|
||||
while ((p < high) && Isspace(*p))
|
||||
p++;
|
||||
}
|
||||
|
||||
@ -507,7 +507,7 @@ c_expand(Char *p)
|
||||
* Search for a space, tab, or colon. See if we have a number (as
|
||||
* in !1234:xyz). Remember the number.
|
||||
*/
|
||||
for (i = 0, all_dig = 1;
|
||||
for (i = 0, all_dig = 1;
|
||||
*q != ' ' && *q != '\t' && *q != ':' && q < Cursor; q++) {
|
||||
/*
|
||||
* PWP: !-4 is a valid history argument too, therefore the test
|
||||
@ -739,7 +739,7 @@ c_substitute(void)
|
||||
* Start p out one character before the cursor. Move it backwards looking
|
||||
* for white space, the beginning of the line, or a history character.
|
||||
*/
|
||||
for (p = Cursor - 1;
|
||||
for (p = Cursor - 1;
|
||||
p > InputBuf && *p != ' ' && *p != '\t' && *p && *p != HIST; --p)
|
||||
continue;
|
||||
|
||||
@ -765,14 +765,14 @@ c_delfini(void) /* Finish up delete action */
|
||||
|
||||
ActionFlag = TCSHOP_NOP;
|
||||
|
||||
if (ActionPos == 0)
|
||||
if (ActionPos == 0)
|
||||
return;
|
||||
|
||||
UndoAction = TCSHOP_INSERT;
|
||||
|
||||
if (Cursor > ActionPos) {
|
||||
Size = (int) (Cursor-ActionPos);
|
||||
c_delbefore(Size);
|
||||
c_delbefore(Size);
|
||||
RefCursor();
|
||||
}
|
||||
else if (Cursor < ActionPos) {
|
||||
@ -1016,7 +1016,7 @@ GetHistLine(void)
|
||||
if (LastChar < InputBuf)
|
||||
LastChar = InputBuf;
|
||||
}
|
||||
|
||||
|
||||
#ifdef KSHVI
|
||||
if (VImode)
|
||||
Cursor = InputBuf;
|
||||
@ -1082,7 +1082,7 @@ e_inc_search(int dir)
|
||||
}
|
||||
done = redo = 0;
|
||||
*LastChar++ = '\n';
|
||||
for (cp = newdir == F_UP_SEARCH_HIST ? STRbck : STRfwd;
|
||||
for (cp = newdir == F_UP_SEARCH_HIST ? STRbck : STRfwd;
|
||||
*cp; *LastChar++ = *cp++)
|
||||
continue;
|
||||
*LastChar++ = pchar;
|
||||
@ -1128,7 +1128,7 @@ e_inc_search(int dir)
|
||||
case F_DELPREV:
|
||||
if (patbuf.len > 1)
|
||||
done++;
|
||||
else
|
||||
else
|
||||
SoundBeep();
|
||||
break;
|
||||
|
||||
@ -1162,7 +1162,7 @@ e_inc_search(int dir)
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
default: /* Terminate and execute cmd */
|
||||
endcmd[0] = ch;
|
||||
PushMacro(endcmd);
|
||||
@ -1253,7 +1253,7 @@ e_inc_search(int dir)
|
||||
}
|
||||
if (done || ret != CC_NORM)
|
||||
return(ret);
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@ -1359,7 +1359,7 @@ v_search(int dir)
|
||||
cleanup_until(&tmpbuf);
|
||||
LastCmd = (KEYCMD) dir; /* avoid c_hsetpat */
|
||||
Cursor = LastChar = InputBuf;
|
||||
if ((dir == F_UP_SEARCH_HIST ? e_up_search_hist(0) :
|
||||
if ((dir == F_UP_SEARCH_HIST ? e_up_search_hist(0) :
|
||||
e_down_search_hist(0)) == CC_ERROR) {
|
||||
Refresh();
|
||||
return(CC_ERROR);
|
||||
@ -1472,7 +1472,7 @@ e_insert(Char c)
|
||||
else {
|
||||
if (inputmode != MODE_INSERT) {
|
||||
int i;
|
||||
for (i = 0; i < Argument; i++)
|
||||
for (i = 0; i < Argument; i++)
|
||||
UndoBuf[UndoSize++] = Cursor[i];
|
||||
|
||||
UndoBuf[UndoSize] = '\0';
|
||||
@ -1948,7 +1948,7 @@ e_down_search_hist(Char c)
|
||||
#ifdef SDEBUG
|
||||
xprintf("Comparing with \"%S\"\n", hl);
|
||||
#endif
|
||||
if ((Strncmp(hl, InputBuf, (size_t) (LastChar - InputBuf)) ||
|
||||
if ((Strncmp(hl, InputBuf, (size_t) (LastChar - InputBuf)) ||
|
||||
hl[LastChar-InputBuf]) && c_hmatch(hl))
|
||||
found = h;
|
||||
if (!HistLit)
|
||||
@ -2392,14 +2392,14 @@ e_delwordprev(Char c)
|
||||
* Changed the names of some of the ^D family of editor functions to
|
||||
* correspond to what they actually do and created new e_delnext_list
|
||||
* for completeness.
|
||||
*
|
||||
*
|
||||
* Old names: New names:
|
||||
*
|
||||
*
|
||||
* delete-char delete-char-or-eof
|
||||
* F_DELNEXT F_DELNEXT_EOF
|
||||
* e_delnext e_delnext_eof
|
||||
* edelnxt edelnxteof
|
||||
* delete-char-or-eof delete-char
|
||||
* delete-char-or-eof delete-char
|
||||
* F_DELNEXT_EOF F_DELNEXT
|
||||
* e_delnext_eof e_delnext
|
||||
* edelnxteof edelnxt
|
||||
@ -2445,13 +2445,13 @@ e_delnext_eof(Char c)
|
||||
USE(c);
|
||||
if (Cursor == LastChar) {/* if I'm at the end */
|
||||
if (!VImode) {
|
||||
if (Cursor == InputBuf) {
|
||||
if (Cursor == InputBuf) {
|
||||
/* if I'm also at the beginning */
|
||||
so_write(STReof, 4);/* then do a EOF */
|
||||
flush();
|
||||
return(CC_EOF);
|
||||
}
|
||||
else
|
||||
else
|
||||
return(CC_ERROR);
|
||||
}
|
||||
else {
|
||||
@ -2574,8 +2574,8 @@ e_tobeg(Char c)
|
||||
Cursor = InputBuf;
|
||||
|
||||
if (VImode) {
|
||||
while (Isspace(*Cursor)) /* We want FIRST non space character */
|
||||
Cursor++;
|
||||
while (Isspace(*Cursor)) /* We want FIRST non space character */
|
||||
Cursor++;
|
||||
if (ActionFlag & TCSHOP_DELETE) {
|
||||
c_delfini();
|
||||
return(CC_REFRESH);
|
||||
@ -2761,7 +2761,7 @@ e_wordback(Char c)
|
||||
|
||||
Cursor = c_prev_word(Cursor, InputBuf, Argument); /* bounds check */
|
||||
|
||||
if (VImode)
|
||||
if (VImode)
|
||||
if (ActionFlag & TCSHOP_DELETE) {
|
||||
c_delfini();
|
||||
return(CC_REFRESH);
|
||||
@ -2892,9 +2892,9 @@ v_csearch_back(Char ch, int count, int tflag)
|
||||
|
||||
cp = Cursor;
|
||||
while (count--) {
|
||||
if (*cp == ch)
|
||||
if (*cp == ch)
|
||||
cp--;
|
||||
while (cp > InputBuf && *cp != ch)
|
||||
while (cp > InputBuf && *cp != ch)
|
||||
cp--;
|
||||
}
|
||||
|
||||
@ -2923,9 +2923,9 @@ v_csearch_fwd(Char ch, int count, int tflag)
|
||||
|
||||
cp = Cursor;
|
||||
while (count--) {
|
||||
if (*cp == ch)
|
||||
if (*cp == ch)
|
||||
cp++;
|
||||
while (cp < LastChar && *cp != ch)
|
||||
while (cp < LastChar && *cp != ch)
|
||||
cp++;
|
||||
}
|
||||
|
||||
@ -2955,21 +2955,21 @@ v_action(int c)
|
||||
if (ActionFlag == TCSHOP_DELETE) {
|
||||
ActionFlag = TCSHOP_NOP;
|
||||
ActionPos = 0;
|
||||
|
||||
|
||||
UndoSize = 0;
|
||||
kp = UndoBuf;
|
||||
for (cp = InputBuf; cp < LastChar; cp++) {
|
||||
*kp++ = *cp;
|
||||
UndoSize++;
|
||||
}
|
||||
|
||||
|
||||
UndoAction = TCSHOP_INSERT;
|
||||
UndoPtr = InputBuf;
|
||||
LastChar = InputBuf;
|
||||
Cursor = InputBuf;
|
||||
if (c & TCSHOP_INSERT)
|
||||
c_alternativ_key_map(0);
|
||||
|
||||
|
||||
return(CC_REFRESH);
|
||||
}
|
||||
#ifdef notdef
|
||||
@ -3359,7 +3359,7 @@ e_cleardisp(Char c)
|
||||
/*ARGSUSED*/
|
||||
CCRETVAL
|
||||
e_tty_int(Char c)
|
||||
{
|
||||
{
|
||||
USE(c);
|
||||
#if defined(_MINIX) || defined(WINNT_NATIVE)
|
||||
/* SAK PATCH: erase all of current line, start again */
|
||||
@ -3398,9 +3398,9 @@ e_stuff_char(Char c)
|
||||
if (was_raw)
|
||||
(void) Rawmode();
|
||||
return(e_redisp(c));
|
||||
#else /* !TIOCSTI */
|
||||
#else /* !TIOCSTI */
|
||||
return(CC_ERROR);
|
||||
#endif /* !TIOCSTI */
|
||||
#endif /* !TIOCSTI */
|
||||
}
|
||||
|
||||
/*ARGSUSED*/
|
||||
@ -3538,7 +3538,7 @@ e_copyprev(Char c)
|
||||
|
||||
oldc = Cursor;
|
||||
/* does a bounds check */
|
||||
cp = c_prev_word(Cursor, InputBuf, Argument);
|
||||
cp = c_prev_word(Cursor, InputBuf, Argument);
|
||||
|
||||
c_insert((int)(oldc - cp));
|
||||
for (dp = oldc; cp < oldc && dp < LastChar; cp++)
|
||||
@ -3569,7 +3569,7 @@ e_load_average(Char c)
|
||||
* Here we pass &c to the ioctl because some os's (NetBSD) expect it
|
||||
* there even if they don't use it. (lukem@netbsd.org)
|
||||
*/
|
||||
if (ioctl(SHIN, TIOCSTAT, (ioctl_t) &c) < 0)
|
||||
if (ioctl(SHIN, TIOCSTAT, (ioctl_t) &c) < 0)
|
||||
#endif
|
||||
xprintf("%s", CGETS(5, 1, "Load average unavailable\n"));
|
||||
return(CC_REFRESH);
|
||||
@ -3707,7 +3707,7 @@ v_rchar_fwd(Char c)
|
||||
if (srch_char == 0)
|
||||
return CC_ERROR;
|
||||
|
||||
return srch_dir == CHAR_FWD ? v_csearch_fwd(srch_char, Argument, 0) :
|
||||
return srch_dir == CHAR_FWD ? v_csearch_fwd(srch_char, Argument, 0) :
|
||||
v_csearch_back(srch_char, Argument, 0);
|
||||
}
|
||||
|
||||
@ -3719,7 +3719,7 @@ v_rchar_back(Char c)
|
||||
if (srch_char == 0)
|
||||
return CC_ERROR;
|
||||
|
||||
return srch_dir == CHAR_BACK ? v_csearch_fwd(srch_char, Argument, 0) :
|
||||
return srch_dir == CHAR_BACK ? v_csearch_fwd(srch_char, Argument, 0) :
|
||||
v_csearch_back(srch_char, Argument, 0);
|
||||
}
|
||||
|
||||
@ -3747,7 +3747,7 @@ v_undo(Char c)
|
||||
|
||||
LastChar -= UndoSize;
|
||||
Cursor = UndoPtr;
|
||||
|
||||
|
||||
UndoAction = TCSHOP_INSERT;
|
||||
break;
|
||||
|
||||
@ -3816,12 +3816,12 @@ v_rsrch_back(Char c)
|
||||
{
|
||||
USE(c);
|
||||
if (patbuf.len == 0) return(CC_ERROR);
|
||||
return(v_repeat_srch(searchdir == F_UP_SEARCH_HIST ?
|
||||
return(v_repeat_srch(searchdir == F_UP_SEARCH_HIST ?
|
||||
F_DOWN_SEARCH_HIST : F_UP_SEARCH_HIST));
|
||||
}
|
||||
|
||||
#ifndef WINNT_NATIVE
|
||||
/* Since ed.defns.h is generated from ed.defns.c, these empty
|
||||
/* Since ed.defns.h is generated from ed.defns.c, these empty
|
||||
functions will keep the F_NUM_FNS consistent
|
||||
*/
|
||||
CCRETVAL
|
||||
|
@ -245,7 +245,7 @@ PFCmd CcFuncTbl[] = { /* table of available commands */
|
||||
#define F_PATH_NORM 103
|
||||
e_delnext_eof, /* added by mtk@ari.ncl.omron.co.jp (920818) */
|
||||
#define F_DELNEXT_EOF 104
|
||||
e_stuff_char,
|
||||
e_stuff_char,
|
||||
#define F_STUFF_CHAR 105
|
||||
e_complete_all,
|
||||
#define F_COMPLETE_ALL 106
|
||||
@ -899,8 +899,8 @@ KEYCMD CcViCmdMap[] = {
|
||||
F_UNASSIGNED, /* ) */
|
||||
F_EXPAND_GLOB, /* * */
|
||||
F_DOWN_HIST, /* + */
|
||||
V_RCHAR_BACK, /* , */
|
||||
F_UP_HIST, /* - */
|
||||
V_RCHAR_BACK, /* , */
|
||||
F_UP_HIST, /* - */
|
||||
F_UNASSIGNED, /* . */
|
||||
V_DSH_META, /* / */
|
||||
V_ZERO, /* 0 */
|
||||
@ -1416,13 +1416,13 @@ editinit(void)
|
||||
f++;
|
||||
f->name = "normalize-path";
|
||||
f->func = F_PATH_NORM;
|
||||
f->desc = CSAVS(3, 53,
|
||||
f->desc = CSAVS(3, 53,
|
||||
"Expand pathnames, eliminating leading .'s and ..'s");
|
||||
|
||||
f++;
|
||||
f->name = "normalize-command";
|
||||
f->func = F_COMMAND_NORM;
|
||||
f->desc = CSAVS(3, 54,
|
||||
f->desc = CSAVS(3, 54,
|
||||
"Expand commands to the resulting pathname or alias");
|
||||
|
||||
f++;
|
||||
|
@ -219,7 +219,7 @@ EXTERN char T_HasMeta; /* true if we have a meta key */
|
||||
# define M_CHAR 2
|
||||
# define M_NN 3
|
||||
#endif /* TERMIO */
|
||||
typedef struct {
|
||||
typedef struct {
|
||||
const char *t_name;
|
||||
unsigned int t_setmask;
|
||||
unsigned int t_clrmask;
|
||||
@ -247,8 +247,12 @@ extern int tgetflag (const char *);
|
||||
extern int tgetnum (const char *);
|
||||
extern char *tgoto (const char *, int, int);
|
||||
extern void tputs (const char *, int, void (*)(int));
|
||||
# define PUTPURE ((void (*)(int)) putpure)
|
||||
# define PUTRAW ((void (*)(int)) putraw)
|
||||
static __inline void PUTPURE(int c) {
|
||||
(void)putpure(c);
|
||||
}
|
||||
static __inline void PUTRAW(int c) {
|
||||
(void)putraw(c);
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _h_ed */
|
||||
|
@ -41,7 +41,7 @@ int Tty_raw_mode = 0; /* Last tty change was to raw mode */
|
||||
int MacroLvl = -1; /* pointer to current macro nesting level; */
|
||||
/* (-1 == none) */
|
||||
static int Tty_quote_mode = 0; /* Last tty change was to quote mode */
|
||||
static unsigned char vdisable; /* The value of _POSIX_VDISABLE from
|
||||
static unsigned char vdisable; /* The value of _POSIX_VDISABLE from
|
||||
* pathconf(2) */
|
||||
|
||||
int Tty_eight_bit = -1; /* does the tty handle eight bits */
|
||||
@ -56,8 +56,8 @@ static ttydata_t extty, edtty, tstty;
|
||||
#define uc unsigned char
|
||||
static unsigned char ttychars[NN_IO][C_NCC] = {
|
||||
{
|
||||
(uc)CINTR, (uc)CQUIT, (uc)CERASE, (uc)CKILL,
|
||||
(uc)CEOF, (uc)CEOL, (uc)CEOL2, (uc)CSWTCH,
|
||||
(uc)CINTR, (uc)CQUIT, (uc)CERASE, (uc)CKILL,
|
||||
(uc)CEOF, (uc)CEOL, (uc)CEOL2, (uc)CSWTCH,
|
||||
(uc)CDSWTCH, (uc)CERASE2, (uc)CSTART, (uc)CSTOP,
|
||||
(uc)CWERASE, (uc)CSUSP, (uc)CDSUSP, (uc)CREPRINT,
|
||||
(uc)CDISCARD, (uc)CLNEXT, (uc)CSTATUS, (uc)CPAGE,
|
||||
@ -65,15 +65,15 @@ static unsigned char ttychars[NN_IO][C_NCC] = {
|
||||
(uc)CTIME
|
||||
},
|
||||
{
|
||||
CINTR, CQUIT, CERASE, CKILL,
|
||||
_POSIX_VDISABLE, _POSIX_VDISABLE, _POSIX_VDISABLE, _POSIX_VDISABLE,
|
||||
_POSIX_VDISABLE, CERASE2, CSTART, CSTOP,
|
||||
_POSIX_VDISABLE, _POSIX_VDISABLE, _POSIX_VDISABLE, _POSIX_VDISABLE,
|
||||
CDISCARD, _POSIX_VDISABLE, _POSIX_VDISABLE, _POSIX_VDISABLE,
|
||||
CINTR, CQUIT, CERASE, CKILL,
|
||||
_POSIX_VDISABLE, _POSIX_VDISABLE, _POSIX_VDISABLE, _POSIX_VDISABLE,
|
||||
_POSIX_VDISABLE, CERASE2, CSTART, CSTOP,
|
||||
_POSIX_VDISABLE, _POSIX_VDISABLE, _POSIX_VDISABLE, _POSIX_VDISABLE,
|
||||
CDISCARD, _POSIX_VDISABLE, _POSIX_VDISABLE, _POSIX_VDISABLE,
|
||||
_POSIX_VDISABLE, _POSIX_VDISABLE, _POSIX_VDISABLE, 1,
|
||||
0
|
||||
},
|
||||
{
|
||||
{
|
||||
0, 0, 0, 0,
|
||||
0, 0, 0, 0,
|
||||
0, 0, 0, 0,
|
||||
@ -136,7 +136,7 @@ ed_set_tty_eight_bit(void)
|
||||
Tty_eight_bit = tty_geteightbit(&extty);
|
||||
}
|
||||
|
||||
|
||||
|
||||
int
|
||||
ed_Setup(int rst)
|
||||
{
|
||||
@ -148,12 +148,12 @@ ed_Setup(int rst)
|
||||
|
||||
#if defined(POSIX) && defined(_PC_VDISABLE) && !defined(BSD4_4) && \
|
||||
!defined(WINNT_NATIVE)
|
||||
{
|
||||
{
|
||||
long pcret;
|
||||
|
||||
if ((pcret = fpathconf(SHTTY, _PC_VDISABLE)) == -1L)
|
||||
vdisable = (unsigned char) _POSIX_VDISABLE;
|
||||
else
|
||||
else
|
||||
vdisable = (unsigned char) pcret;
|
||||
if (vdisable != (unsigned char) _POSIX_VDISABLE && rst != 0)
|
||||
for (rst = 0; rst < C_NCC; rst++) {
|
||||
@ -166,7 +166,7 @@ ed_Setup(int rst)
|
||||
#else /* ! POSIX || !_PC_VDISABLE || BSD4_4 || WINNT_NATIVE */
|
||||
vdisable = (unsigned char) _POSIX_VDISABLE;
|
||||
#endif /* POSIX && _PC_VDISABLE && !BSD4_4 && !WINNT_NATIVE */
|
||||
|
||||
|
||||
if ((imode = adrof(STRinputmode)) != NULL && imode->vec != NULL) {
|
||||
if (!Strcmp(*(imode->vec), STRinsert))
|
||||
inputmode = MODE_INSERT;
|
||||
@ -236,11 +236,11 @@ ed_Setup(int rst)
|
||||
/*
|
||||
* Don't affect CMIN and CTIME for the editor mode
|
||||
*/
|
||||
for (rst = 0; rst < C_NCC - 2; rst++)
|
||||
for (rst = 0; rst < C_NCC - 2; rst++)
|
||||
if (ttychars[TS_IO][rst] != vdisable &&
|
||||
ttychars[ED_IO][rst] != vdisable)
|
||||
ttychars[ED_IO][rst] = ttychars[TS_IO][rst];
|
||||
for (rst = 0; rst < C_NCC; rst++)
|
||||
for (rst = 0; rst < C_NCC; rst++)
|
||||
if (ttychars[TS_IO][rst] != vdisable &&
|
||||
ttychars[EX_IO][rst] != vdisable)
|
||||
ttychars[EX_IO][rst] = ttychars[TS_IO][rst];
|
||||
@ -303,7 +303,7 @@ ed_Init(void)
|
||||
|
||||
#ifdef DEBUG_EDIT
|
||||
CheckMaps(); /* do a little error checking on key maps */
|
||||
#endif
|
||||
#endif
|
||||
|
||||
if (ed_Setup(0) == -1)
|
||||
return;
|
||||
@ -355,7 +355,7 @@ ed_Init(void)
|
||||
#endif /* WINNT_NATIVE */
|
||||
}
|
||||
|
||||
/*
|
||||
/*
|
||||
* Check and re-init the line. set the terminal into 1 char at a time mode.
|
||||
*/
|
||||
int
|
||||
@ -416,12 +416,12 @@ Rawmode(void)
|
||||
|
||||
if (tty_cooked_mode(&tstty)) {
|
||||
/*
|
||||
* re-test for some things here (like maybe the user typed
|
||||
* re-test for some things here (like maybe the user typed
|
||||
* "stty -tabs"
|
||||
*/
|
||||
if (tty_gettabs(&tstty) == 0)
|
||||
T_Tabs = 0;
|
||||
else
|
||||
else
|
||||
T_Tabs = CanWeTab();
|
||||
|
||||
# if defined(POSIX) || defined(TERMIO)
|
||||
@ -466,7 +466,7 @@ Rawmode(void)
|
||||
|
||||
if (T_Tabs) /* order of &= and |= is important to XTABS */
|
||||
extty.d_t.sg_flags &= ~XTABS;
|
||||
else
|
||||
else
|
||||
extty.d_t.sg_flags |= XTABS;
|
||||
|
||||
extty.d_lb = tstty.d_lb;
|
||||
@ -475,13 +475,13 @@ Rawmode(void)
|
||||
|
||||
edtty.d_t.sg_flags = extty.d_t.sg_flags;
|
||||
if (T_Tabs) { /* order of &= and |= is important to XTABS */
|
||||
edtty.d_t.sg_flags &=
|
||||
edtty.d_t.sg_flags &=
|
||||
~(ttylist[ED_IO][M_CONTROL].t_clrmask|XTABS);
|
||||
edtty.d_t.sg_flags |= ttylist[ED_IO][M_CONTROL].t_setmask;
|
||||
}
|
||||
else {
|
||||
edtty.d_t.sg_flags &= ~ttylist[ED_IO][M_CONTROL].t_clrmask;
|
||||
edtty.d_t.sg_flags |=
|
||||
edtty.d_t.sg_flags |=
|
||||
(ttylist[ED_IO][M_CONTROL].t_setmask|XTABS);
|
||||
}
|
||||
|
||||
@ -503,7 +503,7 @@ Rawmode(void)
|
||||
for (i = 0; i < C_NCC; i++)
|
||||
if (ttychars[TS_IO][i] != ttychars[EX_IO][i])
|
||||
break;
|
||||
|
||||
|
||||
if (i != C_NCC || didsetty) {
|
||||
didsetty = 0;
|
||||
/*
|
||||
@ -605,7 +605,7 @@ Load_input_line(void)
|
||||
#ifdef SUNOS4
|
||||
long chrs = 0;
|
||||
#else /* !SUNOS4 */
|
||||
/*
|
||||
/*
|
||||
* *Everyone* else has an int, but SunOS wants long!
|
||||
* This breaks where int != long (alpha)
|
||||
*/
|
||||
|
@ -114,7 +114,7 @@ Inputl(void)
|
||||
# ifdef SUNOS4
|
||||
long chrs = 0;
|
||||
# else /* !SUNOS4 */
|
||||
/*
|
||||
/*
|
||||
* *Everyone* else has an int, but SunOS wants long!
|
||||
* This breaks where int != long (alpha)
|
||||
*/
|
||||
@ -384,7 +384,7 @@ Inputl(void)
|
||||
}
|
||||
if (InputBuf[curlen] && rotate) {
|
||||
newlen = (int) (LastChar - InputBuf);
|
||||
for (idx = (int) (Cursor - InputBuf);
|
||||
for (idx = (int) (Cursor - InputBuf);
|
||||
idx <= newlen; idx++)
|
||||
InputBuf[idx - newlen + curlen] =
|
||||
InputBuf[idx];
|
||||
@ -439,13 +439,13 @@ Inputl(void)
|
||||
else
|
||||
SoundBeep();
|
||||
/*
|
||||
* Addition by David C Lawrence <tale@pawl.rpi.edu>: If an
|
||||
* attempted completion is ambiguous, list the choices.
|
||||
* (PWP: this is the best feature addition to tcsh I have
|
||||
* Addition by David C Lawrence <tale@pawl.rpi.edu>: If an
|
||||
* attempted completion is ambiguous, list the choices.
|
||||
* (PWP: this is the best feature addition to tcsh I have
|
||||
* seen in many months.)
|
||||
*/
|
||||
if (autol && autol->vec != NULL &&
|
||||
(Strcmp(*(autol->vec), STRambiguous) != 0 ||
|
||||
if (autol && autol->vec != NULL &&
|
||||
(Strcmp(*(autol->vec), STRambiguous) != 0 ||
|
||||
expnum == Cursor - InputBuf)) {
|
||||
if (adrof(STRhighlight) && MarkIsSet) {
|
||||
/* clear highlighting before showing completions */
|
||||
@ -477,7 +477,7 @@ Inputl(void)
|
||||
case CC_LIST_ALL:
|
||||
if (InputBuf[curlen] && rotate) {
|
||||
newlen = (int) (LastChar - InputBuf);
|
||||
for (idx = (int) (Cursor - InputBuf);
|
||||
for (idx = (int) (Cursor - InputBuf);
|
||||
idx <= newlen; idx++)
|
||||
InputBuf[idx - newlen + curlen] =
|
||||
InputBuf[idx];
|
||||
@ -667,7 +667,7 @@ RunCommand(Char *str)
|
||||
int
|
||||
GetCmdChar(Char ch)
|
||||
{
|
||||
#ifndef WINNT_NATIVE // We use more than 256 for various extended keys
|
||||
#ifndef WINNT_NATIVE // We use more than 256 for various extended keys
|
||||
wint_t c = ch & CHAR;
|
||||
#else
|
||||
wint_t c = ch;
|
||||
@ -725,7 +725,7 @@ GetNextCommand(KEYCMD *cmdnum, Char *ch)
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!AltKeyMap)
|
||||
if (!AltKeyMap)
|
||||
CurrentKeyMap = CcKeyMap;
|
||||
}
|
||||
*cmdnum = cmd;
|
||||
|
@ -76,7 +76,7 @@ dprintstr(char *str, const Char *f, const Char *t)
|
||||
#endif /* DEBUG_UPDATE */
|
||||
|
||||
/* reprintf():
|
||||
* Print to $DEBUGTTY, so that we can test editing on one pty, and
|
||||
* Print to $DEBUGTTY, so that we can test editing on one pty, and
|
||||
* print debugging stuff on another. Don't interrupt the shell while
|
||||
* debugging cause you'll mangle up the file descriptors!
|
||||
*/
|
||||
@ -461,7 +461,7 @@ GotoBottom(void)
|
||||
MoveToLine(OldvcV);
|
||||
}
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
void
|
||||
PastBottom(void)
|
||||
@ -602,7 +602,7 @@ update_line(Char *old, Char *new, int cur_line)
|
||||
*/
|
||||
o = Strend(o);
|
||||
|
||||
/*
|
||||
/*
|
||||
* Remove any trailing blanks off of the end, being careful not to
|
||||
* back up past the beginning.
|
||||
*/
|
||||
@ -628,7 +628,7 @@ update_line(Char *old, Char *new, int cur_line)
|
||||
}
|
||||
ne = n;
|
||||
*ne = (Char) 0;
|
||||
|
||||
|
||||
/*
|
||||
* if no diff, continue to next line of redraw
|
||||
*/
|
||||
@ -824,14 +824,14 @@ update_line(Char *old, Char *new, int cur_line)
|
||||
|
||||
/*
|
||||
* at this point we have something like this:
|
||||
*
|
||||
*
|
||||
* /old /ofd /osb /ose /ols /oe
|
||||
* v.....................v v..................v v........v
|
||||
* eddie> Oh, my fredded gruntle-buggy is to me, as foo var lurgid as
|
||||
* eddie> Oh, my fredded quiux buggy is to me, as gruntle-lurgid as
|
||||
* ^.....................^ ^..................^ ^........^
|
||||
* ^.....................^ ^..................^ ^........^
|
||||
* \new \nfd \nsb \nse \nls \ne
|
||||
*
|
||||
*
|
||||
* fx is the difference in length between the the chars between nfd and
|
||||
* nsb, and the chars between ofd and osb, and is thus the number of
|
||||
* characters to delete if < 0 (new is shorter than old, as above),
|
||||
@ -1040,7 +1040,7 @@ update_line(Char *old, Char *new, int cur_line)
|
||||
#ifdef DEBUG_UPDATE
|
||||
reprintf("with stuff to keep at end\r\n");
|
||||
#endif /* DEBUG_UPDATE */
|
||||
/*
|
||||
/*
|
||||
* We have to recalculate fx here because we set it
|
||||
* to zero above as a flag saying that we hadn't done
|
||||
* an early first insert.
|
||||
|
@ -135,7 +135,7 @@ static const struct {
|
||||
#define T_fs 12
|
||||
#define T_ho 13
|
||||
#define T_ic 14
|
||||
#define T_im 15
|
||||
#define T_im 15
|
||||
#define T_ip 16
|
||||
#define T_kd 17
|
||||
#define T_kh 18
|
||||
@ -477,7 +477,7 @@ SetTC(char *what, char *how)
|
||||
break;
|
||||
|
||||
if (tv->name != NULL) {
|
||||
if (tv == &tval[T_pt] || tv == &tval[T_km] ||
|
||||
if (tv == &tval[T_pt] || tv == &tval[T_km] ||
|
||||
tv == &tval[T_am] || tv == &tval[T_xn]) {
|
||||
if (strcmp(how, "yes") == 0)
|
||||
tv->val = 1;
|
||||
@ -491,7 +491,7 @@ SetTC(char *what, char *how)
|
||||
T_HasMeta = Val(T_km);
|
||||
T_Margin = Val(T_am) ? MARGIN_AUTO : 0;
|
||||
T_Margin |= Val(T_xn) ? MARGIN_MAGIC : 0;
|
||||
if (tv == &tval[T_am] || tv == &tval[T_xn])
|
||||
if (tv == &tval[T_am] || tv == &tval[T_xn])
|
||||
ChangeSize(Val(T_li), Val(T_co));
|
||||
return;
|
||||
}
|
||||
@ -593,7 +593,7 @@ EchoTC(Char **v)
|
||||
goto end_flush;
|
||||
}
|
||||
|
||||
/*
|
||||
/*
|
||||
* Try to use our local definition first
|
||||
*/
|
||||
scap = NULL;
|
||||
@ -894,8 +894,8 @@ BindArrowKeys(void)
|
||||
/*
|
||||
* Assign the arrow keys only if:
|
||||
*
|
||||
* 1. They are multi-character arrow keys and the user
|
||||
* has not re-assigned the leading character, or
|
||||
* 1. They are multi-character arrow keys and the user
|
||||
* has not re-assigned the leading character, or
|
||||
* has re-assigned the leading character to be F_XKEY
|
||||
* 2. They are single arrow keys pointing to an unassigned key.
|
||||
*/
|
||||
@ -1012,7 +1012,7 @@ CanWeTab(void)
|
||||
|
||||
/* move to line <where> (first line == 0) as efficiently as possible; */
|
||||
void
|
||||
MoveToLine(int where)
|
||||
MoveToLine(int where)
|
||||
{
|
||||
int del;
|
||||
|
||||
@ -1048,7 +1048,7 @@ MoveToLine(int where)
|
||||
del = 0;
|
||||
}
|
||||
else {
|
||||
for ( ; del > 0; del--)
|
||||
for ( ; del > 0; del--)
|
||||
(void) putraw('\n');
|
||||
CursorH = 0; /* because the \n will become \r\n */
|
||||
}
|
||||
@ -1415,7 +1415,7 @@ GetTermCaps(void)
|
||||
ptr = getenv("TERM");
|
||||
|
||||
#ifdef apollo
|
||||
/*
|
||||
/*
|
||||
* If we are on a pad, we pretend that we are dumb. Otherwise the termcap
|
||||
* library will put us in a weird screen mode, thinking that we are going
|
||||
* to use curses
|
||||
|
@ -35,7 +35,7 @@
|
||||
#include "ed.h"
|
||||
|
||||
int didsetty = 0;
|
||||
ttyperm_t ttylist = {
|
||||
ttyperm_t ttylist = {
|
||||
{
|
||||
#if defined(POSIX) || defined(TERMIO)
|
||||
{ "iflag:", ICRNL, (INLCR|IGNCR) },
|
||||
@ -64,7 +64,7 @@ ttyperm_t ttylist = {
|
||||
{ "chars:", (C_SH(C_MIN)|C_SH(C_TIME)|C_SH(C_SWTCH)|C_SH(C_DSWTCH)|
|
||||
C_SH(C_WERASE)|C_SH(C_REPRINT)|C_SH(C_SUSP)|C_SH(C_DSUSP)|
|
||||
C_SH(C_EOF)|C_SH(C_EOL)|C_SH(C_DISCARD)|C_SH(C_PGOFF)|
|
||||
C_SH(C_KILL2)|C_SH(C_PAGE)|C_SH(C_STATUS)|C_SH(C_LNEXT)),
|
||||
C_SH(C_KILL2)|C_SH(C_PAGE)|C_SH(C_STATUS)|C_SH(C_LNEXT)),
|
||||
0 }
|
||||
},
|
||||
{
|
||||
@ -317,7 +317,7 @@ static const struct tcshmodes {
|
||||
# endif /* LCASE */
|
||||
# ifdef ECHO
|
||||
{ "echo", ECHO, M_CONTROL },
|
||||
# endif /* ECHO */
|
||||
# endif /* ECHO */
|
||||
# ifdef CRMOD
|
||||
{ "crmod", CRMOD, M_CONTROL },
|
||||
# endif /* CRMOD */
|
||||
@ -432,7 +432,7 @@ static const struct tcshmodes {
|
||||
# endif /* LCRTKIL */
|
||||
# ifdef LPASS8
|
||||
{ "lpass8", LPASS8, M_LOCAL },
|
||||
# endif /* LPASS8 */
|
||||
# endif /* LPASS8 */
|
||||
# ifdef LCTLECH
|
||||
{ "lctlech",LCTLECH,M_LOCAL },
|
||||
# endif /* LCTLECH */
|
||||
@ -510,7 +510,7 @@ static const struct tcshmodes {
|
||||
# if defined(VPGOFF) || defined(TIOCGPAGE)
|
||||
{ "pgoff", C_SH(C_PGOFF), M_CHAR },
|
||||
# endif /* VPGOFF */
|
||||
# if defined(VKILL2)
|
||||
# if defined(VKILL2)
|
||||
{ "kill2", C_SH(C_KILL2), M_CHAR },
|
||||
# endif /* VKILL2 */
|
||||
# if defined(VBRK) || defined(TIOCGETC)
|
||||
@ -528,7 +528,7 @@ static const struct tcshmodes {
|
||||
/*
|
||||
* If EAGAIN and/or EWOULDBLOCK are defined, we can't just return -1 in all
|
||||
* situations where ioctl() does.
|
||||
*
|
||||
*
|
||||
* On AIX 4.1.5 (and presumably some other versions and OSes), as you
|
||||
* perform the manual test suite in the README, if you 'bg' vi immediately
|
||||
* after suspending it, all is well, but if you wait a few seconds,
|
||||
@ -537,7 +537,7 @@ static const struct tcshmodes {
|
||||
* 0, causing bgetc() to return -1, causing readc() to set doneinp to 1,
|
||||
* causing process() to break out of the main loop, causing tcsh to exit
|
||||
* prematurely.
|
||||
*
|
||||
*
|
||||
* If ioctl()'s errno is EAGAIN/EWOULDBLOCK ("Resource temporarily
|
||||
* unavailable"), apparently the tty is being messed with by the OS and we
|
||||
* need to try again. In my testing, ioctl() was never called more than
|
||||
@ -595,7 +595,7 @@ dosetty(Char **v, struct command *t)
|
||||
cleanup_push(cmdname, xfree);
|
||||
setname(cmdname);
|
||||
|
||||
while (v && *v && v[0][0] == '-' && v[0][2] == '\0')
|
||||
while (v && *v && v[0][0] == '-' && v[0][2] == '\0')
|
||||
switch (v[0][1]) {
|
||||
case 'a':
|
||||
aflag++;
|
||||
@ -641,7 +641,7 @@ dosetty(Char **v, struct command *t)
|
||||
xprintf("\n%*s", st, "");
|
||||
len = st + cu;
|
||||
}
|
||||
else
|
||||
else
|
||||
len += cu;
|
||||
if (x != '\0')
|
||||
xprintf("%c%s ", x, m->m_name);
|
||||
@ -667,7 +667,7 @@ dosetty(Char **v, struct command *t)
|
||||
for (m = modelist; m->m_name; m++)
|
||||
if (strcmp(m->m_name, d) == 0)
|
||||
break;
|
||||
if (!m->m_name)
|
||||
if (!m->m_name)
|
||||
stderror(ERR_NAME | ERR_SYSTEM, d, CGETS(8, 2, "Invalid argument"));
|
||||
|
||||
switch (x) {
|
||||
@ -723,7 +723,7 @@ int
|
||||
tty_setty(int fd, ttydata_t *td)
|
||||
{
|
||||
#ifdef POSIX
|
||||
RETRY(xtcsetattr(fd, TCSADRAIN, &td->d_t));
|
||||
RETRY(xtcsetattr(fd, TCSADRAIN, &td->d_t));
|
||||
#else
|
||||
# ifdef TERMIO
|
||||
RETRY(ioctl(fd, TCSETAW, (ioctl_t) &td->d_t));
|
||||
@ -752,7 +752,7 @@ tty_setty(int fd, ttydata_t *td)
|
||||
|
||||
void
|
||||
tty_getchar(ttydata_t *td, unsigned char *s)
|
||||
{
|
||||
{
|
||||
#ifdef TIOCGLTC
|
||||
{
|
||||
struct ltchars *n = &td->d_ltc;
|
||||
@ -888,10 +888,10 @@ tty_getchar(ttydata_t *td, unsigned char *s)
|
||||
|
||||
void
|
||||
tty_setchar(ttydata_t *td, unsigned char *s)
|
||||
{
|
||||
{
|
||||
#ifdef TIOCGLTC
|
||||
{
|
||||
struct ltchars *n = &td->d_ltc;
|
||||
struct ltchars *n = &td->d_ltc;
|
||||
|
||||
n->t_suspc = s[C_SUSP];
|
||||
n->t_dsuspc = s[C_DSUSP];
|
||||
@ -1035,9 +1035,9 @@ tty_getspeed(ttydata_t *td)
|
||||
# ifdef TERMIO
|
||||
# ifdef CBAUD
|
||||
spd = td->d_t.c_cflag & CBAUD;
|
||||
# else
|
||||
# else
|
||||
spd = 0;
|
||||
# endif
|
||||
# endif
|
||||
# else /* SGTTY */
|
||||
spd = td->d_t.sg_ispeed;
|
||||
# endif /* TERMIO */
|
||||
@ -1118,7 +1118,7 @@ tty_printchar(unsigned char *s)
|
||||
int i;
|
||||
|
||||
for (i = 0; i < C_NCC; i++) {
|
||||
for (m = modelist; m->m_name; m++)
|
||||
for (m = modelist; m->m_name; m++)
|
||||
if (m->m_type == M_CHAR && C_SH(i) == m->m_value)
|
||||
break;
|
||||
if (m->m_name)
|
||||
|
@ -181,10 +181,10 @@
|
||||
# undef CKILL
|
||||
# undef CEOF
|
||||
# undef CEOL
|
||||
# undef CEOL2
|
||||
# undef CSWTCH
|
||||
# undef CEOL2
|
||||
# undef CSWTCH
|
||||
# define CSWTCH TO_CONTROL('z')
|
||||
# undef CDSWTCH
|
||||
# undef CDSWTCH
|
||||
# undef CERASE2
|
||||
# undef CSTART
|
||||
# undef CSTOP
|
||||
|
@ -17,7 +17,7 @@
|
||||
* Looks up *ch in map and then reads characters until a
|
||||
* complete match is found or a mismatch occurs. Returns the
|
||||
* type of the match found (XK_STR, XK_CMD, or XK_EXE).
|
||||
* Returns NULL in val.str and XK_STR for no match.
|
||||
* Returns NULL in val.str and XK_STR for no match.
|
||||
* The last character read is returned in *ch.
|
||||
*
|
||||
* void AddXkey(Xkey, val, ntype);
|
||||
@ -227,7 +227,7 @@ AddXkey(const CStr *Xkey, XmapVal *val, int ntype)
|
||||
Xmap = GetFreeNode(&cs); /* it is properly initialized */
|
||||
|
||||
/* Now recurse through Xmap */
|
||||
(void) TryNode(Xmap, &cs, val, ntype);
|
||||
(void) TryNode(Xmap, &cs, val, ntype);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -421,7 +421,7 @@ GetFreeNode(CStr *ch)
|
||||
ptr->sibling = NULL;
|
||||
return (ptr);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* PrintXKey():
|
||||
* Print the binding associated with Xkey key.
|
||||
@ -560,7 +560,7 @@ printOne(const Char *key, const XmapVal *val, int ntype)
|
||||
for (fp = FuncNames; fp->name; fp++)
|
||||
if (val->cmd == fp->func)
|
||||
xprintf(fmt, fp->name);
|
||||
break;
|
||||
break;
|
||||
default:
|
||||
abort();
|
||||
break;
|
||||
@ -685,7 +685,7 @@ parseescape(const Char **ptr)
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if ((*p & CHAR) == '^' && (Isalpha(p[1] & CHAR) ||
|
||||
else if ((*p & CHAR) == '^' && (Isalpha(p[1] & CHAR) ||
|
||||
strchr("@^_?\\|[{]}", p[1] & CHAR))) {
|
||||
p++;
|
||||
#ifdef IS_ASCII
|
||||
|
@ -49,10 +49,10 @@
|
||||
|
||||
#define ISSPACE(p) (isspace((unsigned char) (p)) && (p) != '\n')
|
||||
|
||||
/*
|
||||
/*
|
||||
* We cannot do that, because some compilers like #line and others
|
||||
* like # <lineno>
|
||||
* #define LINEDIRECTIVE
|
||||
* #define LINEDIRECTIVE
|
||||
*/
|
||||
|
||||
static const char *keyword[] =
|
||||
@ -217,7 +217,7 @@ explode(const char *defs)
|
||||
buf = cat(buf, eptr + 1, 0);
|
||||
return buf;
|
||||
}
|
||||
|
||||
|
||||
|
||||
int
|
||||
main(int argc, char *argv[])
|
||||
@ -357,7 +357,7 @@ main(int argc, char *argv[])
|
||||
(void) fprintf(stdout, "# if (%s) && !defined(_%s_)\n",
|
||||
explode(defs), keyword[token]);
|
||||
else
|
||||
(void) fprintf(stdout, "# if !defined(_%s_)\n",
|
||||
(void) fprintf(stdout, "# if !defined(_%s_)\n",
|
||||
keyword[token]);
|
||||
|
||||
if (gettoken(&ptr, stmt) == NULL) {
|
||||
|
@ -259,7 +259,7 @@ static void
|
||||
qprintf(const char *pre, const Char *s)
|
||||
{
|
||||
const Char *p;
|
||||
|
||||
|
||||
xprintf("%s", pre);
|
||||
for (p = s; *p; p++)
|
||||
xprintf("%c", *p & 0xff);
|
||||
@ -334,7 +334,7 @@ glob(const char *pattern, int flags, int (*errfunc) (const char *, int),
|
||||
while ((c = *patnext++) != EOS) {
|
||||
#ifdef WIDE_STRINGS
|
||||
int len;
|
||||
|
||||
|
||||
len = mblen((const char *)(patnext - 1), MB_LEN_MAX);
|
||||
if (len == -1)
|
||||
TCSH_IGNORE(mblen(NULL, 0));
|
||||
@ -401,7 +401,7 @@ glob(const char *pattern, int flags, int (*errfunc) (const char *, int),
|
||||
* to avoid exponential behavior
|
||||
*/
|
||||
if (bufnext == patbuf || bufnext[-1] != M_ALL ||
|
||||
((flags & GLOB_STAR) != 0 &&
|
||||
((flags & GLOB_STAR) != 0 &&
|
||||
(bufnext - 1 == patbuf || bufnext[-2] != M_ALL ||
|
||||
bufnext - 2 == patbuf || bufnext[-3] != M_ALL)))
|
||||
*bufnext++ = M_ALL;
|
||||
@ -422,13 +422,13 @@ glob(const char *pattern, int flags, int (*errfunc) (const char *, int),
|
||||
}
|
||||
|
||||
/*
|
||||
* If there was no match we are going to append the pattern
|
||||
* If there was no match we are going to append the pattern
|
||||
* if GLOB_NOCHECK was specified or if GLOB_NOMAGIC was specified
|
||||
* and the pattern did not contain any magic characters
|
||||
* GLOB_NOMAGIC is there just for compatibility with csh.
|
||||
*/
|
||||
if (pglob->gl_pathc == oldpathc &&
|
||||
((flags & GLOB_NOCHECK) ||
|
||||
if (pglob->gl_pathc == oldpathc &&
|
||||
((flags & GLOB_NOCHECK) ||
|
||||
((flags & GLOB_NOMAGIC) && !(pglob->gl_flags & GLOB_MAGCHAR)))) {
|
||||
if (!(flags & GLOB_QUOTE))
|
||||
globextend(pattern, pglob);
|
||||
@ -559,7 +559,7 @@ One_Char_mbtowc(__Char *pwc, const Char *s, size_t n)
|
||||
return 1;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
glob3(struct strbuf *pathbuf, const Char *pattern, const Char *restpattern,
|
||||
const Char *pglobstar, glob_t *pglob, int no_match)
|
||||
@ -589,7 +589,7 @@ glob3(struct strbuf *pathbuf, const Char *pattern, const Char *restpattern,
|
||||
break;
|
||||
}
|
||||
pglobstar += width;
|
||||
}
|
||||
}
|
||||
|
||||
if (globstar) {
|
||||
err = pglobstar==pattern && termstar==restpattern ?
|
||||
@ -637,7 +637,7 @@ glob3(struct strbuf *pathbuf, const Char *pattern, const Char *restpattern,
|
||||
continue;
|
||||
#endif
|
||||
if (match(pathbuf->s + orig_len, pattern, termstar,
|
||||
(int)m_not) == no_match)
|
||||
(int)m_not) == no_match)
|
||||
continue;
|
||||
strbuf_append1(pathbuf, SEP);
|
||||
strbuf_terminate(pathbuf);
|
||||
|
@ -78,7 +78,7 @@ typedef struct {
|
||||
#define GLOB_NOMAGIC 0x0200 /* GLOB_NOCHECK without magic chars (csh). */
|
||||
#define GLOB_LIMIT 0x0400 /* Limit memory used by matches to ARG_MAX */
|
||||
#define GLOB_TILDE 0x0800 /* Expand tilde names from the passwd file. */
|
||||
#define GLOB_ALTNOT 0x1000 /* use alternate glob character [^ not !] */
|
||||
#define GLOB_ALTNOT 0x1000 /* use alternate glob character [^ not !] */
|
||||
#define GLOB_QUOTE 0x2000 /* XXX: source compatibility */
|
||||
#define GLOB_STAR 0x4000 /* use glob ** to recurse directories */
|
||||
#define GLOB_DOT 0x8000 /* don't skip dotfiles (except . and ..) */
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* Copyright (c) 1990 Carnegie Mellon University
|
||||
* All Rights Reserved.
|
||||
*
|
||||
*
|
||||
* Permission to use, copy, modify and distribute this software and its
|
||||
* documentation is hereby granted, provided that both the copyright
|
||||
* notice and this permission notice appear in all copies of the
|
||||
@ -69,7 +69,7 @@
|
||||
*
|
||||
* Revision 1.4 90/12/11 17:58:44 mja
|
||||
* Add copyright/disclaimer for distribution.
|
||||
*
|
||||
*
|
||||
* 05-Jun-88 Glenn Marcy (gm0w) at Carnegie-Mellon University
|
||||
* Make all non-entry points static.
|
||||
*
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* termios.c - fake termios interface using sgtty interface
|
||||
/* termios.c - fake termios interface using sgtty interface
|
||||
* by Magnus Doell and Bruce Evans.
|
||||
*
|
||||
*/
|
||||
|
@ -1,5 +1,5 @@
|
||||
/* The <sys/wait.h> header contains macros related to wait(). The value
|
||||
* returned by wait() and waitpid() depends on whether the process
|
||||
* returned by wait() and waitpid() depends on whether the process
|
||||
* terminated by an exit() call, was killed by a signal, or was stopped
|
||||
* due to job control, as follows:
|
||||
*
|
||||
|
@ -7,7 +7,7 @@
|
||||
#define ORIGIN "Astron"
|
||||
#define REV 6
|
||||
#define VERS 22
|
||||
#define PATCHLEVEL 03
|
||||
#define DATE "2020-11-18"
|
||||
#define PATCHLEVEL 04
|
||||
#define DATE "2021-04-26"
|
||||
|
||||
#endif /* _h_patchlevel */
|
||||
|
@ -276,7 +276,7 @@ main(int argc, char **argv)
|
||||
initlex(¶ml);
|
||||
|
||||
#ifdef MALLOC_TRACE
|
||||
mal_setstatsfile(fdopen(dmove(xopen("/tmp/tcsh.trace",
|
||||
mal_setstatsfile(fdopen(dmove(xopen("/tmp/tcsh.trace",
|
||||
O_WRONLY|O_CREAT|O_LARGEFILE, 0666), 25), "w"));
|
||||
mal_trace(1);
|
||||
#endif /* MALLOC_TRACE */
|
||||
@ -303,9 +303,9 @@ main(int argc, char **argv)
|
||||
* Otherwise `` jobs will not work... (From knaff@poly.polytechnique.fr)
|
||||
*/
|
||||
{
|
||||
do
|
||||
do
|
||||
if ((f = xopen(_PATH_DEVNULL, O_RDONLY|O_LARGEFILE)) == -1 &&
|
||||
(f = xopen("/", O_RDONLY|O_LARGEFILE)) == -1)
|
||||
(f = xopen("/", O_RDONLY|O_LARGEFILE)) == -1)
|
||||
exit(1);
|
||||
while (f < 3);
|
||||
xclose(f);
|
||||
@ -313,7 +313,7 @@ main(int argc, char **argv)
|
||||
|
||||
osinit(); /* Os dependent initialization */
|
||||
|
||||
|
||||
|
||||
{
|
||||
char *t;
|
||||
|
||||
@ -512,24 +512,24 @@ main(int argc, char **argv)
|
||||
* on shells running as root. Out of these, autologout should NOT be set
|
||||
* for any psudo-terminals (this catches most window systems) and not for
|
||||
* any terminal running X windows.
|
||||
*
|
||||
* At Ohio State, we have had problems with a user having his X session
|
||||
* drop out from under him (on a Sun) because the shell in his master
|
||||
*
|
||||
* At Ohio State, we have had problems with a user having his X session
|
||||
* drop out from under him (on a Sun) because the shell in his master
|
||||
* xterm timed out and exited.
|
||||
*
|
||||
*
|
||||
* Really, this should be done with a program external to the shell, that
|
||||
* watches for no activity (and NO running programs, such as dump) on a
|
||||
* terminal for a long peroid of time, and then SIGHUPS the shell on that
|
||||
* terminal.
|
||||
*
|
||||
* bugfix by Rich Salz <rsalz@PINEAPPLE.BBN.COM>: For root rsh things
|
||||
* allways first check to see if loginsh or really root, then do things
|
||||
*
|
||||
* bugfix by Rich Salz <rsalz@PINEAPPLE.BBN.COM>: For root rsh things
|
||||
* allways first check to see if loginsh or really root, then do things
|
||||
* with ttyname()
|
||||
*
|
||||
*
|
||||
* Also by Jean-Francois Lamy <lamy%ai.toronto.edu@RELAY.CS.NET>: check the
|
||||
* value of cp before using it! ("root can rsh too")
|
||||
*
|
||||
* PWP: keep the nested ifs; the order of the tests matters and a good
|
||||
*
|
||||
* PWP: keep the nested ifs; the order of the tests matters and a good
|
||||
* (smart) C compiler might re-arange things wrong.
|
||||
*/
|
||||
#ifdef AUTOLOGOUT
|
||||
@ -662,7 +662,7 @@ main(int argc, char **argv)
|
||||
tsetenv(STRLOGNAME, varval(STRuser));
|
||||
if (cus == NULL)
|
||||
tsetenv(STRKUSER, varval(STRuser));
|
||||
|
||||
|
||||
cgr = getenv("GROUP");
|
||||
if (cgr != NULL)
|
||||
setv(STRgroup, quote(SAVE(cgr)), VAR_READWRITE);
|
||||
@ -696,7 +696,7 @@ main(int argc, char **argv)
|
||||
*/
|
||||
remotehost();
|
||||
#endif /* REMOTEHOST */
|
||||
|
||||
|
||||
#ifdef apollo
|
||||
if ((tcp = getenv("SYSTYPE")) == NULL)
|
||||
tcp = "bsd4.3";
|
||||
@ -710,14 +710,14 @@ main(int argc, char **argv)
|
||||
* should determine if we should edit or not. $TERM is preserved
|
||||
* across rlogin sessions, so we will not get confused if we rlogin
|
||||
* under an emacs shell. Another advantage is that if we run an
|
||||
* xterm under an emacs shell, then the $TERM will be set to
|
||||
* xterm under an emacs shell, then the $TERM will be set to
|
||||
* xterm, so we are going to want to edit. Unfortunately emacs
|
||||
* does not restore all the tty modes, so xterm is not very well
|
||||
* set up. But this is not the shell's fault.
|
||||
* Also don't edit if $TERM == wm, for when we're running under an ATK app.
|
||||
* Finally, emacs compiled under terminfo, sets the terminal to dumb,
|
||||
* so disable editing for that too.
|
||||
*
|
||||
*
|
||||
* Unfortunately, in some cases the initial $TERM setting is "unknown",
|
||||
* "dumb", or "network" which is then changed in the user's startup files.
|
||||
* We fix this by setting noediting here if $TERM is unknown/dumb and
|
||||
@ -735,9 +735,9 @@ main(int argc, char **argv)
|
||||
editing = ((tcp = getenv("EMACS")) == NULL || strcmp(tcp, "t") != 0);
|
||||
}
|
||||
|
||||
/*
|
||||
* The 'edit' variable is either set or unset. It doesn't
|
||||
* need a value. Making it 'emacs' might be confusing.
|
||||
/*
|
||||
* The 'edit' variable is either set or unset. It doesn't
|
||||
* need a value. Making it 'emacs' might be confusing.
|
||||
*/
|
||||
if (editing)
|
||||
setNS(STRedit);
|
||||
@ -753,7 +753,7 @@ main(int argc, char **argv)
|
||||
* Compatibility with tcsh >= 6.12 by default
|
||||
*/
|
||||
setNS(STRcsubstnonl);
|
||||
|
||||
|
||||
/*
|
||||
* Random default kill ring size
|
||||
*/
|
||||
@ -789,7 +789,7 @@ main(int argc, char **argv)
|
||||
|
||||
if ((tcp = getenv("SHELL")) != NULL) {
|
||||
sh_len = strlen(tcp);
|
||||
if ((sh_len >= 5 && strcmp(tcp + (sh_len - 5), "/tcsh") == 0) ||
|
||||
if ((sh_len >= 5 && strcmp(tcp + (sh_len - 5), "/tcsh") == 0) ||
|
||||
(!tcsh && sh_len >= 4 && strcmp(tcp + (sh_len - 4), "/csh") == 0))
|
||||
setv(STRshell, quote(SAVE(tcp)), VAR_READWRITE);
|
||||
else
|
||||
@ -824,7 +824,7 @@ main(int argc, char **argv)
|
||||
xfree(tmp);
|
||||
}
|
||||
else {
|
||||
tmp2 = SAVE("");
|
||||
tmp2 = SAVE("");
|
||||
}
|
||||
shtemp = Strspl(tmp2, doldol); /* For << */
|
||||
xfree(tmp2);
|
||||
@ -875,7 +875,7 @@ main(int argc, char **argv)
|
||||
nt_autoset_dspmbyte();
|
||||
#endif /* WINNT_NATIVE */
|
||||
#endif
|
||||
#if defined(AUTOSET_KANJI)
|
||||
#if defined(AUTOSET_KANJI)
|
||||
# if defined(NLS) && defined(LC_CTYPE)
|
||||
if (setlocale(LC_CTYPE, NULL) != NULL || getenv("LANG") != NULL)
|
||||
# else
|
||||
@ -896,12 +896,12 @@ main(int argc, char **argv)
|
||||
}
|
||||
/*
|
||||
* Process the arguments.
|
||||
*
|
||||
*
|
||||
* Note that processing of -v/-x is actually delayed till after script
|
||||
* processing.
|
||||
*
|
||||
* We set the first character of our name to be '-' if we are a shell
|
||||
* running interruptible commands. Many programs which examine ps'es
|
||||
*
|
||||
* We set the first character of our name to be '-' if we are a shell
|
||||
* running interruptible commands. Many programs which examine ps'es
|
||||
* use this to filter such shells out.
|
||||
*/
|
||||
argc--, tempv++;
|
||||
@ -1024,8 +1024,8 @@ main(int argc, char **argv)
|
||||
case '\t':
|
||||
case '\r':
|
||||
case '\n':
|
||||
/*
|
||||
* for O/S's that don't do the argument parsing right in
|
||||
/*
|
||||
* for O/S's that don't do the argument parsing right in
|
||||
* "#!/foo -f " scripts
|
||||
*/
|
||||
break;
|
||||
@ -1057,12 +1057,12 @@ main(int argc, char **argv)
|
||||
xfree(ffile);
|
||||
dolzero = 1;
|
||||
ffile = SAVE(tempv[0]);
|
||||
/*
|
||||
/*
|
||||
* Replace FSHIN. Handle /dev/std{in,out,err} specially
|
||||
* since once they are closed we cannot open them again.
|
||||
* In that case we use our own saved descriptors
|
||||
*/
|
||||
if ((SHIN = dmove(nofile, FSHIN)) < 0)
|
||||
if ((SHIN = dmove(nofile, FSHIN)) < 0)
|
||||
switch(nofile) {
|
||||
case 0:
|
||||
SHIN = FSHIN;
|
||||
@ -1082,7 +1082,7 @@ main(int argc, char **argv)
|
||||
/* argc not used any more */ tempv++;
|
||||
}
|
||||
|
||||
/*
|
||||
/*
|
||||
* Call to closem() used to be part of initdesc(). Now called below where
|
||||
* the script name argument has become stdin. Kernel may have used a file
|
||||
* descriptor to hold the name of the script (setuid case) and this name
|
||||
@ -1153,13 +1153,13 @@ main(int argc, char **argv)
|
||||
sigset_interrupting(SIGINT, queue_pintr);
|
||||
(void) signal(SIGTERM, SIG_IGN);
|
||||
|
||||
/*
|
||||
/*
|
||||
* No reason I can see not to save history on all these events..
|
||||
* Most usual occurrence is in a window system, where we're not a login
|
||||
* shell, but might as well be... (sg)
|
||||
* But there might be races when lots of shells exit together...
|
||||
* [this is also incompatible].
|
||||
* We have to be mre careful here. If the parent wants to
|
||||
* We have to be mre careful here. If the parent wants to
|
||||
* ignore the signals then we leave them untouched...
|
||||
* We also only setup the handlers for shells that are trully
|
||||
* interactive.
|
||||
@ -1299,10 +1299,10 @@ main(int argc, char **argv)
|
||||
*/
|
||||
sigset_interrupting(SIGCHLD, queue_pchild);
|
||||
|
||||
if (intty && !targinp)
|
||||
if (intty && !targinp)
|
||||
(void) ed_Setup(editing);/* Get the tty state, and set defaults */
|
||||
/* Only alter the tty state if editing */
|
||||
|
||||
|
||||
/*
|
||||
* Set an exit here in case of an interrupt or error reading the shell
|
||||
* start-up scripts.
|
||||
@ -1388,7 +1388,7 @@ main(int argc, char **argv)
|
||||
setNS(STRverbose);
|
||||
if (nexececho)
|
||||
setNS(STRecho);
|
||||
|
||||
|
||||
|
||||
if (targinp) {
|
||||
/* If this -c command caused an error before, skip processing */
|
||||
@ -1515,7 +1515,7 @@ importpath(Char *cp)
|
||||
static int
|
||||
srccat(Char *cp, Char *dp)
|
||||
{
|
||||
if (cp[0] == '/' && cp[1] == '\0')
|
||||
if (cp[0] == '/' && cp[1] == '\0')
|
||||
return srcfile(short2str(dp), (mflag ? 0 : 1), 0, NULL);
|
||||
else {
|
||||
Char *ep;
|
||||
@ -1550,7 +1550,7 @@ srcfile(const char *f, int onlyown, int flag, Char **av)
|
||||
{
|
||||
int unit;
|
||||
|
||||
if ((unit = xopen(f, O_RDONLY|O_LARGEFILE)) == -1)
|
||||
if ((unit = xopen(f, O_RDONLY|O_LARGEFILE)) == -1)
|
||||
return 0;
|
||||
cleanup_push(&unit, open_cleanup);
|
||||
unit = dmove(unit, -1);
|
||||
@ -1625,7 +1625,7 @@ st_save(struct saved_state *st, int unit, int hflg, Char **al, Char **av)
|
||||
cpybin(st->B, B);
|
||||
|
||||
/*
|
||||
* we can now pass arguments to source.
|
||||
* we can now pass arguments to source.
|
||||
* For compatibility we do that only if arguments were really
|
||||
* passed, otherwise we keep the old, global $argv like before.
|
||||
*/
|
||||
@ -1854,25 +1854,25 @@ phup(void)
|
||||
|
||||
record();
|
||||
|
||||
#ifdef POSIXJOBS
|
||||
#ifdef POSIXJOBS
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
do
|
||||
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.
|
||||
*/
|
||||
@ -1951,7 +1951,7 @@ pintr1(int wantnl)
|
||||
}
|
||||
else if (intty && wantnl) {
|
||||
if (editing) {
|
||||
/*
|
||||
/*
|
||||
* If we are editing a multi-line input command, and move to
|
||||
* the beginning of the line, we don't want to trash it when
|
||||
* we hit ^C
|
||||
@ -2095,7 +2095,7 @@ process(int catch)
|
||||
/*
|
||||
* Save input text on the history list if reading in old history, or it
|
||||
* is from the terminal at the top level and not in a loop.
|
||||
*
|
||||
*
|
||||
* PWP: entry of items in the history list while in a while loop is done
|
||||
* elsewhere...
|
||||
*/
|
||||
@ -2320,7 +2320,7 @@ mailchk(void)
|
||||
}
|
||||
else {
|
||||
char *type;
|
||||
|
||||
|
||||
if (stb.st_size == 0 || stb.st_atime >= stb.st_mtime ||
|
||||
(stb.st_atime <= chktim && stb.st_mtime <= chktim) ||
|
||||
(loginsh && !new))
|
||||
|
@ -841,7 +841,6 @@ unsigned short _mbmap_big5[256] = {
|
||||
_MB1|_MB2, _MB1|_MB2, _MB1|_MB2, _MB1|_MB2,
|
||||
_MB1|_MB2, _MB1|_MB2, _MB1|_MB2, _MB1|_MB2,
|
||||
_MB1|_MB2, _MB1|_MB2, _MB1|_MB2, _MB1|_MB2,
|
||||
_MB1|_MB2, _MB1|_MB2, _MB1|_MB2, _MB1|_MB2,
|
||||
_MB1|_MB2, _MB1|_MB2, _MB1|_MB2, _MB1|_MB2,
|
||||
_MB1|_MB2, _MB1|_MB2, _MB1|_MB2, _MB1|_MB2,
|
||||
_MB1|_MB2, _MB1|_MB2, _MB1|_MB2, _MB1|_MB2,
|
||||
@ -849,7 +848,8 @@ unsigned short _mbmap_big5[256] = {
|
||||
_MB1|_MB2, _MB1|_MB2, _MB1|_MB2, _MB1|_MB2,
|
||||
_MB1|_MB2, _MB1|_MB2, _MB1|_MB2, _MB1|_MB2,
|
||||
_MB1|_MB2, _MB1|_MB2, _MB1|_MB2, _MB1|_MB2,
|
||||
_MB1|_MB2, _MB1|_MB2, _MB1|_MB2, _MB1|_MB2,
|
||||
_MB1|_MB2, _MB1|_MB2, _MB1|_MB2, _MB1|_MB2,
|
||||
_MB1|_MB2, _MB1|_MB2, _MB1|_MB2, _MB1|_MB2,
|
||||
_MB1|_MB2, _MB1|_MB2, _MB1|_MB2, _MB1|_MB2,
|
||||
_MB1|_MB2, _MB1|_MB2, _MB1|_MB2, _MB1|_MB2,
|
||||
_MB1|_MB2, _MB1|_MB2, _MB1|_MB2, _MB1|_MB2,
|
||||
@ -1092,76 +1092,76 @@ unsigned short _toebcdic[256] = {
|
||||
#endif /*_OSD_POSIX*/
|
||||
|
||||
#ifdef __MVS__
|
||||
/*
|
||||
The IBM 1047 coded char set to/from ISO 8859-1 mapping differs from
|
||||
/*
|
||||
The IBM 1047 coded char set to/from ISO 8859-1 mapping differs from
|
||||
the POSIX-BC mapping in several places
|
||||
*/
|
||||
unsigned short _toascii[256] = {
|
||||
0x00, 0x01, 0x02, 0x03, 0x9c, 0x09, 0x86, 0x7f,
|
||||
0x97, 0x8d, 0x8e, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
|
||||
0x10, 0x11, 0x12, 0x13, 0x9d, 0x0a, 0x08, 0x87,
|
||||
0x18, 0x19, 0x92, 0x8f, 0x1c, 0x1d, 0x1e, 0x1f,
|
||||
0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x17, 0x1b,
|
||||
0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x05, 0x06, 0x07,
|
||||
0x90, 0x91, 0x16, 0x93, 0x94, 0x95, 0x96, 0x04,
|
||||
0x98, 0x99, 0x9a, 0x9b, 0x14, 0x15, 0x9e, 0x1a,
|
||||
0x20, 0xa0, 0xe2, 0xe4, 0xe0, 0xe1, 0xe3, 0xe5,
|
||||
0xe7, 0xf1, 0xa2, 0x2e, 0x3c, 0x28, 0x2b, 0x7c,
|
||||
0x26, 0xe9, 0xea, 0xeb, 0xe8, 0xed, 0xee, 0xef,
|
||||
0xec, 0xdf, 0x21, 0x24, 0x2a, 0x29, 0x3b, 0x5e,
|
||||
0x2d, 0x2f, 0xc2, 0xc4, 0xc0, 0xc1, 0xc3, 0xc5,
|
||||
0xc7, 0xd1, 0xa6, 0x2c, 0x25, 0x5f, 0x3e, 0x3f,
|
||||
0xf8, 0xc9, 0xca, 0xcb, 0xc8, 0xcd, 0xce, 0xcf,
|
||||
0xcc, 0x60, 0x3a, 0x23, 0x40, 0x27, 0x3d, 0x22,
|
||||
0xd8, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67,
|
||||
0x68, 0x69, 0xab, 0xbb, 0xf0, 0xfd, 0xfe, 0xb1,
|
||||
0xb0, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, 0x70,
|
||||
0x71, 0x72, 0xaa, 0xba, 0xe6, 0xb8, 0xc6, 0xa4,
|
||||
0xb5, 0x7e, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78,
|
||||
0x79, 0x7a, 0xa1, 0xbf, 0xd0, 0x5b, 0xde, 0xae,
|
||||
0xac, 0xa3, 0xa5, 0xb7, 0xa9, 0xa7, 0xb6, 0xbc,
|
||||
0xbd, 0xbe, 0xdd, 0xa8, 0xaf, 0x5d, 0xb4, 0xd7,
|
||||
0x7b, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47,
|
||||
0x48, 0x49, 0xad, 0xf4, 0xf6, 0xf2, 0xf3, 0xf5,
|
||||
0x7d, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, 0x50,
|
||||
0x51, 0x52, 0xb9, 0xfb, 0xfc, 0xf9, 0xfa, 0xff,
|
||||
0x5c, 0xf7, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58,
|
||||
0x59, 0x5a, 0xb2, 0xd4, 0xd6, 0xd2, 0xd3, 0xd5,
|
||||
0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37,
|
||||
0x38, 0x39, 0xb3, 0xdb, 0xdc, 0xd9, 0xda, 0x9f,
|
||||
0x00, 0x01, 0x02, 0x03, 0x9c, 0x09, 0x86, 0x7f,
|
||||
0x97, 0x8d, 0x8e, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
|
||||
0x10, 0x11, 0x12, 0x13, 0x9d, 0x0a, 0x08, 0x87,
|
||||
0x18, 0x19, 0x92, 0x8f, 0x1c, 0x1d, 0x1e, 0x1f,
|
||||
0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x17, 0x1b,
|
||||
0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x05, 0x06, 0x07,
|
||||
0x90, 0x91, 0x16, 0x93, 0x94, 0x95, 0x96, 0x04,
|
||||
0x98, 0x99, 0x9a, 0x9b, 0x14, 0x15, 0x9e, 0x1a,
|
||||
0x20, 0xa0, 0xe2, 0xe4, 0xe0, 0xe1, 0xe3, 0xe5,
|
||||
0xe7, 0xf1, 0xa2, 0x2e, 0x3c, 0x28, 0x2b, 0x7c,
|
||||
0x26, 0xe9, 0xea, 0xeb, 0xe8, 0xed, 0xee, 0xef,
|
||||
0xec, 0xdf, 0x21, 0x24, 0x2a, 0x29, 0x3b, 0x5e,
|
||||
0x2d, 0x2f, 0xc2, 0xc4, 0xc0, 0xc1, 0xc3, 0xc5,
|
||||
0xc7, 0xd1, 0xa6, 0x2c, 0x25, 0x5f, 0x3e, 0x3f,
|
||||
0xf8, 0xc9, 0xca, 0xcb, 0xc8, 0xcd, 0xce, 0xcf,
|
||||
0xcc, 0x60, 0x3a, 0x23, 0x40, 0x27, 0x3d, 0x22,
|
||||
0xd8, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67,
|
||||
0x68, 0x69, 0xab, 0xbb, 0xf0, 0xfd, 0xfe, 0xb1,
|
||||
0xb0, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, 0x70,
|
||||
0x71, 0x72, 0xaa, 0xba, 0xe6, 0xb8, 0xc6, 0xa4,
|
||||
0xb5, 0x7e, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78,
|
||||
0x79, 0x7a, 0xa1, 0xbf, 0xd0, 0x5b, 0xde, 0xae,
|
||||
0xac, 0xa3, 0xa5, 0xb7, 0xa9, 0xa7, 0xb6, 0xbc,
|
||||
0xbd, 0xbe, 0xdd, 0xa8, 0xaf, 0x5d, 0xb4, 0xd7,
|
||||
0x7b, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47,
|
||||
0x48, 0x49, 0xad, 0xf4, 0xf6, 0xf2, 0xf3, 0xf5,
|
||||
0x7d, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, 0x50,
|
||||
0x51, 0x52, 0xb9, 0xfb, 0xfc, 0xf9, 0xfa, 0xff,
|
||||
0x5c, 0xf7, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58,
|
||||
0x59, 0x5a, 0xb2, 0xd4, 0xd6, 0xd2, 0xd3, 0xd5,
|
||||
0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37,
|
||||
0x38, 0x39, 0xb3, 0xdb, 0xdc, 0xd9, 0xda, 0x9f,
|
||||
};
|
||||
unsigned short _toebcdic[256] = {
|
||||
0x00, 0x01, 0x02, 0x03, 0x37, 0x2d, 0x2e, 0x2f,
|
||||
0x16, 0x05, 0x15, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
|
||||
0x10, 0x11, 0x12, 0x13, 0x3c, 0x3d, 0x32, 0x26,
|
||||
0x18, 0x19, 0x3f, 0x27, 0x1c, 0x1d, 0x1e, 0x1f,
|
||||
0x40, 0x5a, 0x7f, 0x7b, 0x5b, 0x6c, 0x50, 0x7d,
|
||||
0x4d, 0x5d, 0x5c, 0x4e, 0x6b, 0x60, 0x4b, 0x61,
|
||||
0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7,
|
||||
0xf8, 0xf9, 0x7a, 0x5e, 0x4c, 0x7e, 0x6e, 0x6f,
|
||||
0x7c, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7,
|
||||
0xc8, 0xc9, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6,
|
||||
0xd7, 0xd8, 0xd9, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6,
|
||||
0xe7, 0xe8, 0xe9, 0xad, 0xe0, 0xbd, 0x5f, 0x6d,
|
||||
0x79, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87,
|
||||
0x88, 0x89, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96,
|
||||
0x97, 0x98, 0x99, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6,
|
||||
0xa7, 0xa8, 0xa9, 0xc0, 0x4f, 0xd0, 0xa1, 0x07,
|
||||
0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x06, 0x17,
|
||||
0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x09, 0x0a, 0x1b,
|
||||
0x30, 0x31, 0x1a, 0x33, 0x34, 0x35, 0x36, 0x08,
|
||||
0x38, 0x39, 0x3a, 0x3b, 0x04, 0x14, 0x3e, 0xff,
|
||||
0x41, 0xaa, 0x4a, 0xb1, 0x9f, 0xb2, 0x6a, 0xb5,
|
||||
0xbb, 0xb4, 0x9a, 0x8a, 0xb0, 0xca, 0xaf, 0xbc,
|
||||
0x90, 0x8f, 0xea, 0xfa, 0xbe, 0xa0, 0xb6, 0xb3,
|
||||
0x9d, 0xda, 0x9b, 0x8b, 0xb7, 0xb8, 0xb9, 0xab,
|
||||
0x64, 0x65, 0x62, 0x66, 0x63, 0x67, 0x9e, 0x68,
|
||||
0x74, 0x71, 0x72, 0x73, 0x78, 0x75, 0x76, 0x77,
|
||||
0xac, 0x69, 0xed, 0xee, 0xeb, 0xef, 0xec, 0xbf,
|
||||
0x80, 0xfd, 0xfe, 0xfb, 0xfc, 0xba, 0xae, 0x59,
|
||||
0x44, 0x45, 0x42, 0x46, 0x43, 0x47, 0x9c, 0x48,
|
||||
0x54, 0x51, 0x52, 0x53, 0x58, 0x55, 0x56, 0x57,
|
||||
0x8c, 0x49, 0xcd, 0xce, 0xcb, 0xcf, 0xcc, 0xe1,
|
||||
0x70, 0xdd, 0xde, 0xdb, 0xdc, 0x8d, 0x8e, 0xdf
|
||||
0x00, 0x01, 0x02, 0x03, 0x37, 0x2d, 0x2e, 0x2f,
|
||||
0x16, 0x05, 0x15, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
|
||||
0x10, 0x11, 0x12, 0x13, 0x3c, 0x3d, 0x32, 0x26,
|
||||
0x18, 0x19, 0x3f, 0x27, 0x1c, 0x1d, 0x1e, 0x1f,
|
||||
0x40, 0x5a, 0x7f, 0x7b, 0x5b, 0x6c, 0x50, 0x7d,
|
||||
0x4d, 0x5d, 0x5c, 0x4e, 0x6b, 0x60, 0x4b, 0x61,
|
||||
0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7,
|
||||
0xf8, 0xf9, 0x7a, 0x5e, 0x4c, 0x7e, 0x6e, 0x6f,
|
||||
0x7c, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7,
|
||||
0xc8, 0xc9, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6,
|
||||
0xd7, 0xd8, 0xd9, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6,
|
||||
0xe7, 0xe8, 0xe9, 0xad, 0xe0, 0xbd, 0x5f, 0x6d,
|
||||
0x79, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87,
|
||||
0x88, 0x89, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96,
|
||||
0x97, 0x98, 0x99, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6,
|
||||
0xa7, 0xa8, 0xa9, 0xc0, 0x4f, 0xd0, 0xa1, 0x07,
|
||||
0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x06, 0x17,
|
||||
0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x09, 0x0a, 0x1b,
|
||||
0x30, 0x31, 0x1a, 0x33, 0x34, 0x35, 0x36, 0x08,
|
||||
0x38, 0x39, 0x3a, 0x3b, 0x04, 0x14, 0x3e, 0xff,
|
||||
0x41, 0xaa, 0x4a, 0xb1, 0x9f, 0xb2, 0x6a, 0xb5,
|
||||
0xbb, 0xb4, 0x9a, 0x8a, 0xb0, 0xca, 0xaf, 0xbc,
|
||||
0x90, 0x8f, 0xea, 0xfa, 0xbe, 0xa0, 0xb6, 0xb3,
|
||||
0x9d, 0xda, 0x9b, 0x8b, 0xb7, 0xb8, 0xb9, 0xab,
|
||||
0x64, 0x65, 0x62, 0x66, 0x63, 0x67, 0x9e, 0x68,
|
||||
0x74, 0x71, 0x72, 0x73, 0x78, 0x75, 0x76, 0x77,
|
||||
0xac, 0x69, 0xed, 0xee, 0xeb, 0xef, 0xec, 0xbf,
|
||||
0x80, 0xfd, 0xfe, 0xfb, 0xfc, 0xba, 0xae, 0x59,
|
||||
0x44, 0x45, 0x42, 0x46, 0x43, 0x47, 0x9c, 0x48,
|
||||
0x54, 0x51, 0x52, 0x53, 0x58, 0x55, 0x56, 0x57,
|
||||
0x8c, 0x49, 0xcd, 0xce, 0xcb, 0xcf, 0xcc, 0xe1,
|
||||
0x70, 0xdd, 0xde, 0xdb, 0xdc, 0x8d, 0x8e, 0xdf
|
||||
};
|
||||
#endif /*__MVS__*/
|
||||
|
@ -235,7 +235,7 @@ extern tcshuc _cmap_lower[], _cmap_upper[];
|
||||
# define Iscntrl(c) (((Char)(c) & QUOTE) ? 0 : iscntrl((tcshuc) (c)))
|
||||
#endif /* !defined(DSPMBYTE) */
|
||||
# if SOLARIS2 == 24
|
||||
/*
|
||||
/*
|
||||
* From <casper@fwi.uva.nl> Casper Dik:
|
||||
* In Solaris 2.4, isprint('\t') returns true after setlocal(LC_ALL,"").
|
||||
* This breaks commandline editing when you include tabs.
|
||||
|
@ -37,7 +37,7 @@
|
||||
*/
|
||||
extern Char *gethdir (const Char *);
|
||||
extern void dosource (Char **, struct command *);
|
||||
extern void exitstat (void);
|
||||
extern void exitstat (void) __attribute__((__noreturn__));
|
||||
extern void goodbye (Char **, struct command *);
|
||||
extern void importpath (Char *);
|
||||
extern void initdesc (void);
|
||||
@ -410,31 +410,31 @@ extern void donice (Char **, struct command *);
|
||||
extern void dotime (Char **, struct command *);
|
||||
#ifdef BSDTIMES
|
||||
extern void prusage (struct sysrusage *,
|
||||
struct sysrusage *,
|
||||
struct sysrusage *,
|
||||
timeval_t *, timeval_t *);
|
||||
extern void ruadd (struct sysrusage *,
|
||||
struct sysrusage *);
|
||||
#else /* BSDTIMES */
|
||||
# ifdef _SEQUENT_
|
||||
extern void prusage (struct process_stats *,
|
||||
struct process_stats *,
|
||||
struct process_stats *,
|
||||
timeval_t *, timeval_t *);
|
||||
extern void ruadd (struct process_stats *,
|
||||
struct process_stats *);
|
||||
# else /* !_SEQUENT_ */
|
||||
# ifdef POSIX
|
||||
extern void prusage (struct tms *, struct tms *,
|
||||
extern void prusage (struct tms *, struct tms *,
|
||||
clock_t, clock_t);
|
||||
# else /* !POSIX */
|
||||
extern void prusage (struct tms *, struct tms *,
|
||||
extern void prusage (struct tms *, struct tms *,
|
||||
time_t, time_t);
|
||||
# endif /* !POSIX */
|
||||
# endif /* !_SEQUENT_ */
|
||||
#endif /* BSDTIMES */
|
||||
extern void settimes (void);
|
||||
#if defined(BSDTIMES) || defined(_SEQUENT_)
|
||||
extern void tvsub (struct timeval *,
|
||||
struct timeval *,
|
||||
extern void tvsub (struct timeval *,
|
||||
struct timeval *,
|
||||
struct timeval *);
|
||||
#endif /* BSDTIMES || _SEQUENT_ */
|
||||
|
||||
|
@ -171,7 +171,7 @@ dset(Char *dp)
|
||||
{
|
||||
/*
|
||||
* Don't call set() directly cause if the directory contains ` or
|
||||
* other junk characters glob will fail.
|
||||
* other junk characters glob will fail.
|
||||
*/
|
||||
setcopy(STRowd, varval(STRcwd), VAR_READWRITE|VAR_NOGLOB);
|
||||
setcopy(STRcwd, dp, VAR_READWRITE|VAR_NOGLOB);
|
||||
@ -193,7 +193,7 @@ skipargs(Char ***v, const char *dstr, const char *str)
|
||||
Char **n = *v, *s;
|
||||
|
||||
int dflag = 0, loop = 1;
|
||||
for (n++; loop && *n != NULL && (*n)[0] == '-'; n++)
|
||||
for (n++; loop && *n != NULL && (*n)[0] == '-'; n++)
|
||||
if (*(s = &((*n)[1])) == '\0') /* test for bare "-" argument */
|
||||
dflag |= DIR_OLD;
|
||||
else if ((*n)[1] == '-' && (*n)[2] == '\0') { /* test for -- */
|
||||
@ -239,7 +239,7 @@ dodirs(Char **v, struct command *c)
|
||||
dhead.di_next = dhead.di_prev = dp;
|
||||
dp->di_next = dp->di_prev = &dhead;
|
||||
}
|
||||
if ((dflag & DIR_LOAD) != 0)
|
||||
if ((dflag & DIR_LOAD) != 0)
|
||||
loaddirs(*v);
|
||||
else if ((dflag & DIR_SAVE) != 0)
|
||||
recdirs(*v, 1);
|
||||
@ -270,7 +270,7 @@ printdirs(int dflag)
|
||||
xprintf("%d\t", idx++);
|
||||
cur = 0;
|
||||
}
|
||||
s = dp->di_name;
|
||||
s = dp->di_name;
|
||||
user = NULL;
|
||||
if (!(dflag & DIR_LONG) && (user = getusername(&s)) != NULL)
|
||||
len = (int) (Strlen(user) + Strlen(s) + 2);
|
||||
@ -282,7 +282,7 @@ printdirs(int dflag)
|
||||
xputchar('\n');
|
||||
cur = len;
|
||||
}
|
||||
if (user)
|
||||
if (user)
|
||||
xprintf("~%S", user);
|
||||
xprintf("%-S%c", s, (dflag & DIR_VERT) ? '\n' : ' ');
|
||||
} while ((dp = dp->di_prev) != dcwd);
|
||||
@ -321,7 +321,7 @@ dtilde(void)
|
||||
* 2) or starts with "../",
|
||||
* 3) or ends with "/..",
|
||||
* 4) or contains the string "/../",
|
||||
* then it will be normalized, unless those strings are quoted.
|
||||
* then it will be normalized, unless those strings are quoted.
|
||||
* Otherwise, a copy is made and sent back.
|
||||
*/
|
||||
Char *
|
||||
@ -354,7 +354,7 @@ dnormalize(const Char *cp, int expnd)
|
||||
*/
|
||||
if (dotdot == 0)
|
||||
return (Strsave(start));
|
||||
|
||||
|
||||
# ifdef notdef
|
||||
struct stat sb;
|
||||
/*
|
||||
@ -391,7 +391,7 @@ dnormalize(const Char *cp, int expnd)
|
||||
do {
|
||||
dotdot = 0;
|
||||
buf.len = 0;
|
||||
while (*cp)
|
||||
while (*cp)
|
||||
if (IS_DOT(start, cp)) {
|
||||
if (*++cp)
|
||||
cp++;
|
||||
@ -404,14 +404,14 @@ dnormalize(const Char *cp, int expnd)
|
||||
if (*cp)
|
||||
cp++;
|
||||
}
|
||||
else
|
||||
else
|
||||
Strbuf_append1(&buf, *cp++);
|
||||
|
||||
Strbuf_terminate(&buf);
|
||||
while (dotdot > 0)
|
||||
while (dotdot > 0)
|
||||
if ((dp = Strrchr(cwd, '/')) != NULL) {
|
||||
# ifdef HAVE_SLASHSLASH
|
||||
if (dp == &cwd[1])
|
||||
if (dp == &cwd[1])
|
||||
slashslash = 1;
|
||||
# endif /* HAVE_SLASHSLASH */
|
||||
*dp = '\0';
|
||||
@ -589,7 +589,7 @@ dfollow(Char *cp, int old)
|
||||
#ifdef apollo
|
||||
if (Strchr(cp, '`')) {
|
||||
char *dptr;
|
||||
if (chdir(dptr = short2str(cp)) < 0)
|
||||
if (chdir(dptr = short2str(cp)) < 0)
|
||||
stderror(ERR_SYSTEM, dptr, strerror(errno));
|
||||
dp = agetcwd();
|
||||
cleanup_push(dp, xfree);
|
||||
@ -605,7 +605,7 @@ dfollow(Char *cp, int old)
|
||||
/*
|
||||
* if we are ignoring symlinks, try to fix relatives now.
|
||||
* if we are expading symlinks, it should be done by now.
|
||||
*/
|
||||
*/
|
||||
dp = dnormalize(cp, symlinks == SYM_IGNORE);
|
||||
if (chdir(short2str(dp)) >= 0) {
|
||||
cleanup_until(cp);
|
||||
@ -646,7 +646,7 @@ dfollow(Char *cp, int old)
|
||||
* We always want to fix the directory here
|
||||
* If we are normalizing symlinks
|
||||
*/
|
||||
dp = dnormalize(buf.s, symlinks == SYM_IGNORE ||
|
||||
dp = dnormalize(buf.s, symlinks == SYM_IGNORE ||
|
||||
symlinks == SYM_EXPAND);
|
||||
if (chdir(short2str(dp)) >= 0) {
|
||||
printd = 1;
|
||||
@ -696,7 +696,7 @@ dopushd(Char **v, struct command *c)
|
||||
struct directory *dp;
|
||||
Char *cp;
|
||||
int dflag = skipargs(&v, "plvn", " [-|<dir>|+<n>]");
|
||||
|
||||
|
||||
USE(c);
|
||||
printd = 1;
|
||||
cp = (dflag & DIR_OLD) ? varval(STRowd) : *v;
|
||||
@ -937,7 +937,7 @@ dcanon_internal(Char *cp, Char *p)
|
||||
continue;
|
||||
p = sp; /* save start of component */
|
||||
slash = 0;
|
||||
if (*p)
|
||||
if (*p)
|
||||
while (*++p) /* find next slash or end of path */
|
||||
if (*p == '/') {
|
||||
slash = 1;
|
||||
@ -950,7 +950,7 @@ dcanon_internal(Char *cp, Char *p)
|
||||
slashslash = 1;
|
||||
#endif /* HAVE_SLASHSLASH */
|
||||
if (*sp == '\0') { /* if component is null */
|
||||
if (--sp == cp) /* if path is one char (i.e. /) */
|
||||
if (--sp == cp) /* if path is one char (i.e. /) */
|
||||
break;
|
||||
else
|
||||
*sp = '\0';
|
||||
@ -1197,7 +1197,7 @@ dnewcwd(struct directory *dp, int dflag)
|
||||
if (adrof(STRdunique)) {
|
||||
struct directory *dn;
|
||||
|
||||
for (dn = dhead.di_prev; dn != &dhead; dn = dn->di_prev)
|
||||
for (dn = dhead.di_prev; dn != &dhead; dn = dn->di_prev)
|
||||
if (dn != dp && Strcmp(dn->di_name, dp->di_name) == 0) {
|
||||
dn->di_next->di_prev = dn->di_prev;
|
||||
dn->di_prev->di_next = dn->di_next;
|
||||
@ -1262,7 +1262,7 @@ dgetstack(void)
|
||||
Char **dblk, **dbp;
|
||||
struct directory *dn;
|
||||
|
||||
if (adrof(STRdirstack) == NULL)
|
||||
if (adrof(STRdirstack) == NULL)
|
||||
return;
|
||||
|
||||
for (dn = dhead.di_prev; dn != &dhead; dn = dn->di_prev, i++)
|
||||
@ -1366,7 +1366,7 @@ recdirs(Char *fname, int def)
|
||||
Char *snum;
|
||||
struct Strbuf qname = Strbuf_INIT;
|
||||
|
||||
if (fname == NULL && !def)
|
||||
if (fname == NULL && !def)
|
||||
return;
|
||||
|
||||
ophup_disabled = phup_disabled;
|
||||
@ -1377,7 +1377,7 @@ recdirs(Char *fname, int def)
|
||||
else
|
||||
fname = Strsave(fname);
|
||||
}
|
||||
else
|
||||
else
|
||||
fname = globone(fname, G_ERROR);
|
||||
cleanup_push(fname, xfree);
|
||||
|
||||
@ -1387,7 +1387,7 @@ recdirs(Char *fname, int def)
|
||||
return;
|
||||
}
|
||||
|
||||
if ((snum = varval(STRsavedirs)) == STRNULL || snum[0] == '\0')
|
||||
if ((snum = varval(STRsavedirs)) == STRNULL || snum[0] == '\0')
|
||||
num = (unsigned int) ~0;
|
||||
else
|
||||
num = (unsigned int) atoi(short2str(snum));
|
||||
|
@ -354,7 +354,7 @@ DgetC(int flag)
|
||||
}
|
||||
|
||||
static Char *nulvec[] = { NULL };
|
||||
static struct varent nulargv = {nulvec, STRargv, VAR_READWRITE,
|
||||
static struct varent nulargv = {nulvec, STRargv, VAR_READWRITE,
|
||||
{ NULL, NULL, NULL }, 0 };
|
||||
|
||||
static void
|
||||
@ -734,7 +734,7 @@ fixDolMod(void)
|
||||
}
|
||||
c = DgetC(0);
|
||||
}
|
||||
if ((c == 'g' && dolmcnts[ndolflags - 1] != INT_MAX) ||
|
||||
if ((c == 'g' && dolmcnts[ndolflags - 1] != INT_MAX) ||
|
||||
(c == 'a' && dolaflags[ndolflags - 1] == 0)) {
|
||||
if (c == 'g') {
|
||||
dolmcnts[ndolflags - 1] = INT_MAX;
|
||||
@ -754,7 +754,7 @@ fixDolMod(void)
|
||||
|| Isdigit(delim) || any(" \t\n", delim)) {
|
||||
seterror(ERR_BADSUBST);
|
||||
break;
|
||||
}
|
||||
}
|
||||
while ((c = DgetC(0)) != DEOF) {
|
||||
Strbuf_append1(&dolmod, (Char) c);
|
||||
if (c == delim) delimcnt--;
|
||||
@ -781,7 +781,7 @@ fixDolMod(void)
|
||||
}
|
||||
|
||||
static int
|
||||
all_dolmcnts_are_0()
|
||||
all_dolmcnts_are_0(void)
|
||||
{
|
||||
int i = 0;
|
||||
for (; i < ndolflags; ++i) {
|
||||
@ -949,7 +949,7 @@ randsuf(void) {
|
||||
#ifndef WINNT_NATIVE
|
||||
struct timeval tv;
|
||||
(void) gettimeofday(&tv, NULL);
|
||||
return putn((((tcsh_number_t)tv.tv_sec) ^
|
||||
return putn((((tcsh_number_t)tv.tv_sec) ^
|
||||
((tcsh_number_t)tv.tv_usec) ^
|
||||
((tcsh_number_t)getpid())) & 0x00ffffff);
|
||||
#else
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* sh.err.c: Error printing routines.
|
||||
* sh.err.c: Error printing routines.
|
||||
*/
|
||||
/*-
|
||||
* Copyright (c) 1980, 1991 The Regents of the University of California.
|
||||
|
@ -451,7 +451,7 @@ texec(Char *sf, Char **st)
|
||||
vp[0] = adrof(STRshell) ? varval(STRshell) : STR_SHELLPATH;
|
||||
vp[1] = NULL;
|
||||
#ifdef _PATH_BSHELL
|
||||
if (fd != -1
|
||||
if (fd != -1
|
||||
# ifndef ISC /* Compatible with ISC's /bin/csh */
|
||||
&& pref[0] != '#'
|
||||
# endif /* ISC */
|
||||
@ -653,8 +653,8 @@ dohash(Char **vv, struct command *c)
|
||||
uhashlength = atoi(short2str(vv[1]));
|
||||
if (vv[2]) {
|
||||
uhashwidth = atoi(short2str(vv[2]));
|
||||
if ((uhashwidth != sizeof(unsigned char)) &&
|
||||
(uhashwidth != sizeof(unsigned short)) &&
|
||||
if ((uhashwidth != sizeof(unsigned char)) &&
|
||||
(uhashwidth != sizeof(unsigned short)) &&
|
||||
(uhashwidth != sizeof(unsigned long)))
|
||||
uhashwidth = 0;
|
||||
if (vv[3])
|
||||
@ -779,7 +779,7 @@ hashstat(Char **v, struct command *c)
|
||||
{
|
||||
USE(c);
|
||||
USE(v);
|
||||
#ifdef FASTHASH
|
||||
#ifdef FASTHASH
|
||||
if (havhash && hashlength && hashwidth)
|
||||
xprintf(CGETS(13, 2, "%d hash buckets of %d bits each\n"),
|
||||
hashlength, hashwidth*8);
|
||||
@ -1167,7 +1167,7 @@ find_cmd(Char *cmd, int prt)
|
||||
}
|
||||
}
|
||||
/*
|
||||
* If we are printing, we are being called from dowhere() which it
|
||||
* If we are printing, we are being called from dowhere() which it
|
||||
* has rehashed already
|
||||
*/
|
||||
if (!prt && adrof(STRautorehash) && !rehashed && havhash) {
|
||||
|
@ -96,21 +96,21 @@ sh_access(const Char *fname, int mode)
|
||||
#else /* POSIX */
|
||||
|
||||
/*
|
||||
* POSIX 1003.2-d11.2
|
||||
* -r file True if file exists and is readable.
|
||||
* -w file True if file exists and is writable.
|
||||
* True shall indicate only that the write flag is on.
|
||||
* POSIX 1003.2-d11.2
|
||||
* -r file True if file exists and is readable.
|
||||
* -w file True if file exists and is writable.
|
||||
* True shall indicate only that the write flag is on.
|
||||
* The file shall not be writable on a read-only file
|
||||
* system even if this test indicates true.
|
||||
* -x file True if file exists and is executable.
|
||||
* True shall indicate only that the execute flag is on.
|
||||
* If file is a directory, true indicates that the file
|
||||
* -x file True if file exists and is executable.
|
||||
* True shall indicate only that the execute flag is on.
|
||||
* If file is a directory, true indicates that the file
|
||||
* can be searched.
|
||||
*/
|
||||
if (mode != W_OK && mode != X_OK)
|
||||
return access(name, mode);
|
||||
|
||||
if (stat(name, &statb) == -1)
|
||||
if (stat(name, &statb) == -1)
|
||||
return 1;
|
||||
|
||||
if (access(name, mode) == 0) {
|
||||
@ -132,7 +132,7 @@ sh_access(const Char *fname, int mode)
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
else if (euid == statb.st_uid)
|
||||
mode <<= 6;
|
||||
@ -197,7 +197,7 @@ exp0(Char ***vp, int ignore)
|
||||
|
||||
(*vp)++;
|
||||
|
||||
p2 = compat_expr ?
|
||||
p2 = compat_expr ?
|
||||
exp0(vp, (ignore & TEXP_IGNORE) || p1) :
|
||||
exp1(vp, (ignore & TEXP_IGNORE) || p1);
|
||||
if (compat_expr || !(ignore & TEXP_IGNORE))
|
||||
@ -478,7 +478,7 @@ exp5(Char ***vp, int ignore)
|
||||
}
|
||||
|
||||
cleanup_push(p1, xfree);
|
||||
p2 = compat_expr ?
|
||||
p2 = compat_expr ?
|
||||
exp5(vp, ignore) :
|
||||
exp6(vp, ignore);
|
||||
cleanup_push(p2, xfree);
|
||||
@ -598,7 +598,7 @@ exp6(Char ***vp, int ignore)
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
/*
|
||||
* Extended file tests
|
||||
* From: John Rowe <rowe@excc.exeter.ac.uk>
|
||||
*/
|
||||
@ -680,7 +680,7 @@ filetest(Char *cp, Char ***vp, int ignore)
|
||||
ep = globone(dp, G_APPEND);
|
||||
cleanup_push(ep, xfree);
|
||||
ft = &cp[1];
|
||||
do
|
||||
do
|
||||
switch (*ft) {
|
||||
|
||||
case 'r':
|
||||
@ -696,7 +696,7 @@ filetest(Char *cp, Char ***vp, int ignore)
|
||||
break;
|
||||
|
||||
case 'X': /* tcsh extension, name is an executable in the path
|
||||
* or a tcsh builtin command
|
||||
* or a tcsh builtin command
|
||||
*/
|
||||
i = find_cmd(ep, 0);
|
||||
break;
|
||||
@ -709,7 +709,7 @@ filetest(Char *cp, Char ***vp, int ignore)
|
||||
|
||||
#ifdef S_IFLNK
|
||||
if (tolower(*ft) == 'l') {
|
||||
/*
|
||||
/*
|
||||
* avoid convex compiler bug.
|
||||
*/
|
||||
if (!lst) {
|
||||
@ -722,9 +722,9 @@ filetest(Char *cp, Char ***vp, int ignore)
|
||||
if (*ft == 'L')
|
||||
st = lst;
|
||||
}
|
||||
else
|
||||
else
|
||||
#endif /* S_IFLNK */
|
||||
/*
|
||||
/*
|
||||
* avoid convex compiler bug.
|
||||
*/
|
||||
if (!st) {
|
||||
@ -776,7 +776,7 @@ filetest(Char *cp, Char ***vp, int ignore)
|
||||
i = 0;
|
||||
#endif /* S_ISOFL */
|
||||
break ;
|
||||
|
||||
|
||||
|
||||
case 'l':
|
||||
#ifdef S_ISLNK
|
||||
@ -855,7 +855,7 @@ filetest(Char *cp, Char ***vp, int ignore)
|
||||
case 'I':
|
||||
i = (tcsh_number_t) st->st_ino;
|
||||
break;
|
||||
|
||||
|
||||
case 'F':
|
||||
strdev = putn( (int) st->st_dev);
|
||||
strino = putn( (int) st->st_ino);
|
||||
@ -866,7 +866,7 @@ filetest(Char *cp, Char ***vp, int ignore)
|
||||
xfree(strino);
|
||||
cleanup_until(ep);
|
||||
return(strF);
|
||||
|
||||
|
||||
case 'L':
|
||||
if ( *(ft + 1) ) {
|
||||
i = 1;
|
||||
@ -884,7 +884,7 @@ filetest(Char *cp, Char ***vp, int ignore)
|
||||
i = 0;
|
||||
break;
|
||||
#endif /* S_ISLNK */
|
||||
|
||||
|
||||
|
||||
case 'N':
|
||||
i = (tcsh_number_t) st->st_nlink;
|
||||
@ -893,7 +893,7 @@ filetest(Char *cp, Char ***vp, int ignore)
|
||||
case 'P':
|
||||
string = string0 + 1;
|
||||
(void) xsnprintf(string, sizeof(string0) - 1, "%o",
|
||||
pmask & (unsigned int)
|
||||
pmask & (unsigned int)
|
||||
((S_IRWXU|S_IRWXG|S_IRWXO|S_ISUID|S_ISGID) & st->st_mode));
|
||||
if (altout && *string != '0')
|
||||
*--string = '0';
|
||||
|
@ -112,7 +112,7 @@ setup_tty(int on)
|
||||
on = TCSETAF;
|
||||
# endif /* POSIX */
|
||||
tchars.c_lflag |= ICANON;
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
@ -74,7 +74,7 @@ isbfunc(struct command *t)
|
||||
|
||||
/*
|
||||
* We never match a builtin that has quoted the first
|
||||
* character; this has been the traditional way to escape
|
||||
* character; this has been the traditional way to escape
|
||||
* builtin commands.
|
||||
*/
|
||||
if (*cp & QUOTE)
|
||||
@ -559,7 +559,7 @@ void
|
||||
dowhile(Char **v, struct command *c)
|
||||
{
|
||||
int status;
|
||||
int again = whyles != 0 &&
|
||||
int again = whyles != 0 &&
|
||||
SEEKEQ(&whyles->w_start, &lineloc) &&
|
||||
whyles->w_fename == 0;
|
||||
|
||||
@ -765,7 +765,7 @@ search(int type, int level, Char *goal)
|
||||
}
|
||||
cleanup_push(&word, Strbuf_cleanup);
|
||||
do {
|
||||
|
||||
|
||||
if (intty) {
|
||||
histent = xmalloc(sizeof(*histent));
|
||||
ohistent = xmalloc(sizeof(*histent));
|
||||
@ -804,7 +804,7 @@ search(int type, int level, Char *goal)
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
if ((type == TC_IF || type == TC_ELSE) &&
|
||||
eq(word.s, STRthen))
|
||||
level++;
|
||||
@ -887,7 +887,7 @@ search(int type, int level, Char *goal)
|
||||
savehist(ohistent, 0);
|
||||
freelex(ohistent);
|
||||
xfree(ohistent);
|
||||
} else
|
||||
} else
|
||||
(void) getword(NULL);
|
||||
} while (level >= 0);
|
||||
end:
|
||||
@ -895,7 +895,7 @@ search(int type, int level, Char *goal)
|
||||
}
|
||||
|
||||
static struct wordent *
|
||||
histgetword(struct wordent *histent)
|
||||
histgetword(struct wordent *histent)
|
||||
{
|
||||
int first;
|
||||
eChar c, d;
|
||||
@ -918,7 +918,7 @@ histgetword(struct wordent *histent)
|
||||
while (c != CHAR_ERR && c != '\n');
|
||||
if (c == CHAR_ERR)
|
||||
goto past;
|
||||
if (c == '\n')
|
||||
if (c == '\n')
|
||||
goto nl;
|
||||
unreadc(c);
|
||||
first = 1;
|
||||
@ -942,9 +942,9 @@ histgetword(struct wordent *histent)
|
||||
}
|
||||
if (c == CHAR_ERR)
|
||||
goto past;
|
||||
|
||||
|
||||
Strbuf_append1(tmp, (Char) c);
|
||||
|
||||
|
||||
if (!first && !d && c == '(' && !e) {
|
||||
break;
|
||||
}
|
||||
@ -967,7 +967,7 @@ histgetword(struct wordent *histent)
|
||||
return histent;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
past:
|
||||
switch (Stype) {
|
||||
|
||||
@ -1055,7 +1055,7 @@ getword(struct Strbuf *wp)
|
||||
if (!first && !d && c == '(') {
|
||||
if (wp)
|
||||
goto past_word_end;
|
||||
else
|
||||
else
|
||||
break;
|
||||
}
|
||||
first = 0;
|
||||
@ -1152,7 +1152,7 @@ wfree(void)
|
||||
|
||||
#ifdef FDEBUG
|
||||
xprintf("start->type %c start->a_seek %d start->f_seek %d\n",
|
||||
foo[wp->w_start.type+1],
|
||||
foo[wp->w_start.type+1],
|
||||
wp->w_start.a_seek, wp->w_start.f_seek);
|
||||
xprintf("end->type %c end->a_seek %d end->f_seek %d\n",
|
||||
foo[wp->w_end.type + 1], wp->w_end.a_seek, wp->w_end.f_seek);
|
||||
@ -1164,12 +1164,12 @@ wfree(void)
|
||||
if (wp->w_end.type != TCSH_I_SEEK && wp->w_start.type == wp->w_end.type &&
|
||||
wp->w_start.type == o.type) {
|
||||
if (wp->w_end.type == TCSH_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;
|
||||
}
|
||||
@ -1338,7 +1338,7 @@ xlate_cr_cleanup(void *dummy)
|
||||
|
||||
/*ARGSUSED*/
|
||||
void
|
||||
doprintenv(Char **v, struct command *c)
|
||||
doprintenv(Char **v, struct command *c)
|
||||
{
|
||||
Char *e;
|
||||
|
||||
@ -1610,7 +1610,7 @@ dounsetenv(Char **v, struct command *c)
|
||||
name = xmalloc((maxi + 1) * sizeof(Char));
|
||||
cleanup_push(name, xfree);
|
||||
|
||||
while (++v && *v)
|
||||
while (++v && *v)
|
||||
for (maxi = 1; maxi;)
|
||||
for (maxi = 0, ep = STR_environ; *ep; ep++) {
|
||||
for (n = name, p = *ep; *p && *p != '='; *n++ = *p++)
|
||||
@ -1897,7 +1897,7 @@ doumask(Char **v, struct command *c)
|
||||
# endif
|
||||
# endif
|
||||
|
||||
struct limits limits[] =
|
||||
struct limits limits[] =
|
||||
{
|
||||
# ifdef RLIMIT_CPU
|
||||
{ RLIMIT_CPU, "cputime", 1, "seconds" },
|
||||
@ -1979,37 +1979,37 @@ struct limits limits[] =
|
||||
{ RLIMIT_SBSIZE, "sbsize", 1, "" },
|
||||
# endif /* RLIMIT_SBSIZE */
|
||||
|
||||
# ifdef RLIMIT_SWAP
|
||||
{ RLIMIT_SWAP, "swapsize", 1024, "kbytes" },
|
||||
# endif /* RLIMIT_SWAP */
|
||||
# ifdef RLIMIT_SWAP
|
||||
{ RLIMIT_SWAP, "swapsize", 1024, "kbytes" },
|
||||
# endif /* RLIMIT_SWAP */
|
||||
|
||||
# ifdef RLIMIT_LOCKS
|
||||
{ RLIMIT_LOCKS, "maxlocks", 1, "" },
|
||||
# endif /* RLIMIT_LOCKS */
|
||||
# ifdef RLIMIT_LOCKS
|
||||
{ RLIMIT_LOCKS, "maxlocks", 1, "" },
|
||||
# endif /* RLIMIT_LOCKS */
|
||||
|
||||
# ifdef RLIMIT_POSIXLOCKS
|
||||
{ RLIMIT_POSIXLOCKS,"posixlocks", 1, "" },
|
||||
# endif /* RLIMIT_POSIXLOCKS */
|
||||
|
||||
# ifdef RLIMIT_SIGPENDING
|
||||
{ RLIMIT_SIGPENDING,"maxsignal", 1, "" },
|
||||
# endif /* RLIMIT_SIGPENDING */
|
||||
# ifdef RLIMIT_SIGPENDING
|
||||
{ RLIMIT_SIGPENDING,"maxsignal", 1, "" },
|
||||
# endif /* RLIMIT_SIGPENDING */
|
||||
|
||||
# ifdef RLIMIT_MSGQUEUE
|
||||
{ RLIMIT_MSGQUEUE, "maxmessage", 1, "" },
|
||||
# endif /* RLIMIT_MSGQUEUE */
|
||||
# ifdef RLIMIT_MSGQUEUE
|
||||
{ RLIMIT_MSGQUEUE, "maxmessage", 1, "" },
|
||||
# endif /* RLIMIT_MSGQUEUE */
|
||||
|
||||
# ifdef RLIMIT_NICE
|
||||
{ RLIMIT_NICE, "maxnice", 1, "" },
|
||||
# endif /* RLIMIT_NICE */
|
||||
# ifdef RLIMIT_NICE
|
||||
{ RLIMIT_NICE, "maxnice", 1, "" },
|
||||
# endif /* RLIMIT_NICE */
|
||||
|
||||
# ifdef RLIMIT_RTPRIO
|
||||
{ RLIMIT_RTPRIO, "maxrtprio", 1, "" },
|
||||
# endif /* RLIMIT_RTPRIO */
|
||||
# ifdef RLIMIT_RTPRIO
|
||||
{ RLIMIT_RTPRIO, "maxrtprio", 1, "" },
|
||||
# endif /* RLIMIT_RTPRIO */
|
||||
|
||||
# ifdef RLIMIT_RTTIME
|
||||
{ RLIMIT_RTTIME, "maxrttime", 1, "usec" },
|
||||
# endif /* RLIMIT_RTTIME */
|
||||
# ifdef RLIMIT_RTTIME
|
||||
{ RLIMIT_RTTIME, "maxrttime", 1, "usec" },
|
||||
# endif /* RLIMIT_RTTIME */
|
||||
|
||||
{ -1, NULL, 0, NULL }
|
||||
};
|
||||
@ -2625,11 +2625,11 @@ iconv_catgets(nl_catd ctd, int set_id, int msg_id, const char *s)
|
||||
{
|
||||
static char *buf = NULL;
|
||||
static size_t buf_size = 0;
|
||||
|
||||
|
||||
char *orig, *dest, *p;
|
||||
ICONV_CONST char *src;
|
||||
size_t src_size, dest_size;
|
||||
|
||||
|
||||
orig = xcatgets(ctd, set_id, msg_id, s);
|
||||
if (catgets_iconv == (iconv_t)-1 || orig == s)
|
||||
return orig;
|
||||
@ -2650,7 +2650,7 @@ iconv_catgets(nl_catd ctd, int set_id, int msg_id, const char *s)
|
||||
dest = p + (dest - buf);
|
||||
buf = p;
|
||||
break;
|
||||
|
||||
|
||||
case EILSEQ: case EINVAL: default:
|
||||
return orig;
|
||||
}
|
||||
@ -2735,7 +2735,7 @@ getYN(const char *prompt)
|
||||
xprintf("%s", prompt);
|
||||
flush();
|
||||
(void) force_read(SHIN, &c, sizeof(c));
|
||||
/*
|
||||
/*
|
||||
* Perhaps we should use the yesexpr from the
|
||||
* actual locale
|
||||
*/
|
||||
|
@ -470,7 +470,7 @@ libglob(Char **vl)
|
||||
gflgs |= GLOB_APPEND;
|
||||
}
|
||||
while (*++vl);
|
||||
vl = (globv.gl_pathc == 0 || (magic && !match && !nonomatch)) ?
|
||||
vl = (globv.gl_pathc == 0 || (magic && !match && !nonomatch)) ?
|
||||
NULL : blk2short(globv.gl_pathv);
|
||||
globfree(&globv);
|
||||
return (vl);
|
||||
@ -522,7 +522,7 @@ globone(Char *str, int action)
|
||||
xfree(vl);
|
||||
return (Strsave(STRNULL));
|
||||
}
|
||||
if (vl && vl[1])
|
||||
if (vl && vl[1])
|
||||
return (handleone(str, vl, action));
|
||||
else {
|
||||
str = strip(*vl);
|
||||
@ -628,7 +628,7 @@ tglob(Char **t)
|
||||
* use this piece of code anymore.
|
||||
*/
|
||||
p++;
|
||||
while (*p && *p != '`')
|
||||
while (*p && *p != '`')
|
||||
if (*p++ == '\\') {
|
||||
if (*p) /* Quoted chars */
|
||||
p++;
|
||||
@ -643,7 +643,7 @@ tglob(Char **t)
|
||||
gflag |= G_CSH;
|
||||
else if (isglob(*p))
|
||||
gflag |= G_GLOB;
|
||||
else if (symlinks == SYM_EXPAND &&
|
||||
else if (symlinks == SYM_EXPAND &&
|
||||
p[1] && ISDOTDOT(p) && (p == *(t-1) || *(p-1) == '/') )
|
||||
gflag |= G_CSH;
|
||||
p++;
|
||||
@ -777,7 +777,7 @@ backeval(struct blk_buf *bb, struct Strbuf *word, Char *cp, int literal)
|
||||
|
||||
(void) setexit();
|
||||
justpr = 0;
|
||||
|
||||
|
||||
if (haderr) {
|
||||
/* unwind */
|
||||
doneinp = 0;
|
||||
@ -911,7 +911,7 @@ Gnmatch(const Char *string, const Char *pattern, const Char **endstr)
|
||||
|
||||
if (endstr == NULL)
|
||||
/* Exact matches only */
|
||||
for (p = *fblk; *p; p++)
|
||||
for (p = *fblk; *p; p++)
|
||||
gres |= t_pmatch(string, *p, &tstring, 1) == 2 ? 1 : 0;
|
||||
else {
|
||||
const Char *end;
|
||||
@ -929,10 +929,10 @@ Gnmatch(const Char *string, const Char *pattern, const Char **endstr)
|
||||
|
||||
cleanup_until(fblk);
|
||||
return(gres == gpol);
|
||||
}
|
||||
}
|
||||
|
||||
/* t_pmatch():
|
||||
* Return 2 on exact match,
|
||||
* Return 2 on exact match,
|
||||
* Return 1 on substring match.
|
||||
* Return 0 on no match.
|
||||
* *estr will point to the end of the longest exact or substring match.
|
||||
@ -1002,7 +1002,7 @@ t_pmatch(const Char *string, const Char *pattern, const Char **estr, int cs)
|
||||
match = (globcharcoll(stringc, rangec2, 0) <= 0 &&
|
||||
globcharcoll(rangec, stringc, 0) <= 0);
|
||||
}
|
||||
else
|
||||
else
|
||||
match = (stringc == rangec);
|
||||
}
|
||||
if (rangec == '\0')
|
||||
|
@ -83,11 +83,11 @@ typedef unsigned long intptr_t;
|
||||
*/
|
||||
#if defined(_POSIX_SOURCE) && !defined(POSIX)
|
||||
# define POSIX
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(POSIXJOBS) && !defined(BSDJOBS)
|
||||
# define BSDJOBS
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#define TMP_TEMPLATE ".XXXXXX"
|
||||
|
||||
@ -211,7 +211,7 @@ static __inline void tcsh_ignore(intptr_t a)
|
||||
|
||||
#ifdef PROF
|
||||
#define xexit(n) done(n)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef cray
|
||||
# define word word_t /* sys/types.h defines word.. bad move! */
|
||||
@ -221,9 +221,9 @@ static __inline void tcsh_ignore(intptr_t a)
|
||||
|
||||
#ifdef cray
|
||||
# undef word
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/*
|
||||
/*
|
||||
* Path separator in environment variables
|
||||
*/
|
||||
#ifndef PATHSEP
|
||||
@ -248,7 +248,7 @@ typedef long tcsh_number_t;
|
||||
#endif
|
||||
/*
|
||||
* This macro compares the st_dev field of struct stat. On aix on ibmESA
|
||||
* st_dev is a structure, so comparison does not work.
|
||||
* st_dev is a structure, so comparison does not work.
|
||||
*/
|
||||
#ifndef DEV_DEV_COMPARE
|
||||
# define DEV_DEV_COMPARE(x,y) ((x) == (y))
|
||||
@ -359,7 +359,7 @@ typedef long tcsh_number_t;
|
||||
# define CSWTCH _POSIX_VDISABLE /* So job control works */
|
||||
# endif /* SYSVREL > 3 */
|
||||
# endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if (defined(__DGUX__) && defined(POSIX)) || defined(DGUX)
|
||||
#undef CSWTCH
|
||||
@ -376,7 +376,7 @@ typedef long tcsh_number_t;
|
||||
|
||||
#if !defined(O_RDONLY) || !defined(O_NDELAY)
|
||||
# include <fcntl.h>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include <errno.h>
|
||||
|
||||
@ -484,7 +484,7 @@ typedef union {
|
||||
# define free lint_free
|
||||
# define realloc lint_realloc
|
||||
# define calloc lint_calloc
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef SYSMALLOC
|
||||
# define xmalloc(i) smalloc(i)
|
||||
@ -637,7 +637,7 @@ EXTERN pid_t backpid; /* pid of the last background job */
|
||||
|
||||
/*
|
||||
* Ideally these should be uid_t, gid_t, pid_t. I cannot do that right now
|
||||
* cause pid's could be unsigned and that would break our -1 flag, and
|
||||
* cause pid's could be unsigned and that would break our -1 flag, and
|
||||
* uid_t and gid_t are not defined in all the systems so I would have to
|
||||
* make special cases for them. In the future...
|
||||
*/
|
||||
@ -666,7 +666,7 @@ EXTERN int OLDSTD IZERO; /* Old standard input (def for cmds) */
|
||||
|
||||
|
||||
#if (SYSVREL == 4 && defined(_UTS)) || defined(__linux__)
|
||||
/*
|
||||
/*
|
||||
* From: fadden@uts.amdahl.com (Andy McFadden)
|
||||
* we need sigsetjmp for UTS4, but not UTS2.1
|
||||
*/
|
||||
@ -887,14 +887,14 @@ struct command {
|
||||
unsigned char t_nice; /* Nice value */
|
||||
#ifdef apollo
|
||||
unsigned char t_systype; /* System environment */
|
||||
#endif
|
||||
#endif
|
||||
unsigned long t_dflg; /* Flags, e.g. F_AMPERSAND|... */
|
||||
/* save these when re-doing */
|
||||
#ifndef apollo
|
||||
#define F_SAVE (F_NICE|F_TIME|F_NOHUP|F_HUP)
|
||||
#define F_SAVE (F_NICE|F_TIME|F_NOHUP|F_HUP)
|
||||
#else
|
||||
#define F_SAVE (F_NICE|F_TIME|F_NOHUP||F_HUP|F_VER)
|
||||
#endif
|
||||
#endif
|
||||
#define F_AMPERSAND (1<<0) /* executes in background */
|
||||
#define F_APPEND (1<<1) /* output is redirected >> */
|
||||
#define F_PIPEIN (1<<2) /* input is a pipe */
|
||||
@ -913,7 +913,7 @@ struct command {
|
||||
#define F_HUP (1<<15) /* hup this command */
|
||||
#ifdef apollo
|
||||
#define F_VER (1<<16) /* execute command under SYSTYPE */
|
||||
#endif
|
||||
#endif
|
||||
union {
|
||||
Char *T_dlef; /* Input redirect word */
|
||||
struct command *T_dcar; /* Left part of list/pipe */
|
||||
@ -1154,7 +1154,7 @@ EXTERN Char PRCHROOT; /* Prompt symbol for root */
|
||||
#define Strsave(a) s_strsave(a)
|
||||
#define Strend(a) s_strend(a)
|
||||
#define Strstr(a, b) s_strstr(a, b)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#define TCSH_MODIFIERS "ehlqrstuxQ"
|
||||
|
||||
@ -1193,7 +1193,7 @@ EXTERN Char *STR_SHELLPATH;
|
||||
|
||||
#ifdef _PATH_BSHELL
|
||||
EXTERN Char *STR_BSHELL;
|
||||
#endif
|
||||
#endif
|
||||
EXTERN Char *STR_WORD_CHARS;
|
||||
EXTERN Char *STR_WORD_CHARS_VI;
|
||||
EXTERN Char **STR_environ IZERO;
|
||||
@ -1250,7 +1250,7 @@ EXTERN nl_catd catd;
|
||||
# else
|
||||
# define CGETS(b, c, d) d
|
||||
# define CSAVS(b, c, d) d
|
||||
# endif
|
||||
# endif
|
||||
#else /* WINNT_NATIVE */
|
||||
# define CGETS(b, c, d) nt_cgets( b, c, d)
|
||||
# define CSAVS(b, c, d) strsave(CGETS(b, c, d))
|
||||
|
@ -205,25 +205,35 @@ addWordToHash(struct hashValue *h, const Char *word)
|
||||
{
|
||||
uint32_t a = h->a, b = h->b, c = h->c;
|
||||
#ifdef SHORT_STRINGS
|
||||
#define GETK if ((k = (uChar)*word++) == 0) break
|
||||
#ifdef WIDE_STRINGS
|
||||
assert(sizeof(Char) >= 4);
|
||||
while (1) {
|
||||
unsigned k;
|
||||
if ((k = (uChar)*word++) == 0) break; a += k;
|
||||
if ((k = (uChar)*word++) == 0) break; b += k;
|
||||
if ((k = (uChar)*word++) == 0) break; c += k;
|
||||
GETK;
|
||||
a += k;
|
||||
GETK;
|
||||
b += k;
|
||||
GETK;
|
||||
c += k;
|
||||
mix(a, b, c);
|
||||
}
|
||||
#else
|
||||
assert(sizeof(Char) == 2);
|
||||
while (1) {
|
||||
unsigned k;
|
||||
if ((k = (uChar)*word++) == 0) break; a += k;
|
||||
if ((k = (uChar)*word++) == 0) break; a += k << 16;
|
||||
if ((k = (uChar)*word++) == 0) break; b += k;
|
||||
if ((k = (uChar)*word++) == 0) break; b += k << 16;
|
||||
if ((k = (uChar)*word++) == 0) break; c += k;
|
||||
if ((k = (uChar)*word++) == 0) break; c += k << 16;
|
||||
GETK;
|
||||
a += k;
|
||||
GETK;
|
||||
a += k << 16;
|
||||
GETK;
|
||||
b += k;
|
||||
GETK;
|
||||
b += k << 16;
|
||||
GETK;
|
||||
c += k;
|
||||
GETK;
|
||||
c += k << 16;
|
||||
mix(a, b, c);
|
||||
}
|
||||
#endif
|
||||
@ -1054,9 +1064,9 @@ phist(struct Hist *hp, int hflg)
|
||||
output_raw = 1;
|
||||
cleanup_push(&old_output_raw, output_raw_restore);
|
||||
if (hflg & HIST_TIME)
|
||||
/*
|
||||
/*
|
||||
* Make file entry with history time in format:
|
||||
* "+NNNNNNNNNN" (10 digits, left padded with ascii '0')
|
||||
* "+NNNNNNNNNN" (10 digits, left padded with ascii '0')
|
||||
*/
|
||||
|
||||
xprintf("#+%010lu\n", (unsigned long)hp->Htime);
|
||||
@ -1216,18 +1226,20 @@ dotlock_cleanup(void* lockpath)
|
||||
|
||||
/* Save history before exiting the shell. */
|
||||
void
|
||||
rechist(Char *fname, int ref)
|
||||
rechist(Char *xfname, int ref)
|
||||
{
|
||||
Char *snum, *rs;
|
||||
int fp, ftmp, oldidfds, ophup_disabled;
|
||||
struct varent *shist;
|
||||
char path[MAXPATHLEN];
|
||||
struct stat st;
|
||||
static Char *fname;
|
||||
static Char *dumphist[] = {STRhistory, STRmhT, 0, 0};
|
||||
|
||||
if (fname == NULL && !ref)
|
||||
if (fname == NULL && !ref)
|
||||
return;
|
||||
|
||||
fname = xfname;
|
||||
ophup_disabled = phup_disabled;
|
||||
phup_disabled = 1;
|
||||
|
||||
@ -1253,8 +1265,8 @@ rechist(Char *fname, int ref)
|
||||
/*
|
||||
* The 'savehist merge' feature is intended for an environment
|
||||
* with numerous shells being in simultaneous use. Imagine
|
||||
* any kind of window system. All these shells 'share' the same
|
||||
* ~/.history file for recording their command line history.
|
||||
* any kind of window system. All these shells 'share' the same
|
||||
* ~/.history file for recording their command line history.
|
||||
* We try to handle the case of multiple shells trying to merge
|
||||
* histories at the same time, by creating semi-unique filenames
|
||||
* and saving the history there first and then trying to rename
|
||||
@ -1265,7 +1277,7 @@ rechist(Char *fname, int ref)
|
||||
* by optional lock parameter to savehist.
|
||||
*
|
||||
* jw.
|
||||
*/
|
||||
*/
|
||||
/*
|
||||
* We need the didfds stuff before loadhist otherwise
|
||||
* exec in a script will fail to print if merge is set.
|
||||
@ -1331,7 +1343,7 @@ rechist(Char *fname, int ref)
|
||||
#ifndef WINNT_NATIVE
|
||||
(void)rename(path, short2str(fname));
|
||||
#else
|
||||
(void)ReplaceFile( short2str(fname),path,NULL,0,NULL,NULL);
|
||||
(void)ReplaceFile(short2str(fname), path, NULL, 0, NULL, NULL);
|
||||
#endif
|
||||
cleanup_until(fname);
|
||||
phup_disabled = ophup_disabled;
|
||||
|
@ -205,7 +205,7 @@ int nsrchn = sizeof srchn / sizeof *srchn;
|
||||
/*
|
||||
* Note: For some machines, (hpux eg.)
|
||||
* NSIG = number of signals + 1...
|
||||
* so we define 33 or 65 (POSIX) signals for
|
||||
* so we define 33 or 65 (POSIX) signals for
|
||||
* everybody
|
||||
*/
|
||||
|
||||
@ -246,7 +246,7 @@ mesginit(void)
|
||||
|
||||
#ifdef SIGHUP
|
||||
if (mesg[SIGHUP].pname == NULL) {
|
||||
mesg[SIGHUP].iname = "HUP";
|
||||
mesg[SIGHUP].iname = "HUP";
|
||||
mesg[SIGHUP].pname = CSAVS(2, 2, "Hangup");
|
||||
}
|
||||
#endif /* SIGHUP */
|
||||
@ -550,7 +550,7 @@ mesginit(void)
|
||||
/* _CRAYCOM */
|
||||
if (mesg[SIGTHERR].pname == NULL) {
|
||||
mesg[SIGTHERR].iname = "THERR";
|
||||
mesg[SIGTHERR].pname = CSAVS(2, 43,
|
||||
mesg[SIGTHERR].pname = CSAVS(2, 43,
|
||||
"Thread error - (use cord -T for detailed info)");
|
||||
}
|
||||
#endif /* SIGTHERR */
|
||||
@ -730,7 +730,7 @@ mesginit(void)
|
||||
/* solaris */
|
||||
if (mesg[SIGCANCEL].pname == NULL) {
|
||||
mesg[SIGCANCEL].iname = "CANCEL";
|
||||
mesg[SIGCANCEL].pname = CSAVS(2, 109,
|
||||
mesg[SIGCANCEL].pname = CSAVS(2, 109,
|
||||
"Thread cancellation signal used by libthread");
|
||||
}
|
||||
#endif /* SIGCANCEL */
|
||||
@ -738,11 +738,11 @@ mesginit(void)
|
||||
/*
|
||||
* Careful, some OS's (HP/UX 10.0) define these as -1
|
||||
*/
|
||||
#ifdef SIGRTMIN
|
||||
#ifdef SIGRTMIN
|
||||
/*
|
||||
* Cannot do this at compile time; Solaris2 uses _sysconf for these
|
||||
*/
|
||||
if (SIGRTMIN > 0 && SIGRTMIN < NUMSIG) {
|
||||
if (SIGRTMIN > 0 && SIGRTMIN < NUMSIG) {
|
||||
if (mesg[SIGRTMIN].pname == NULL) {
|
||||
mesg[SIGRTMIN].iname = "RTMIN";
|
||||
mesg[SIGRTMIN].pname = CSAVS(2, 68, "First Realtime Signal");
|
||||
|
@ -333,7 +333,7 @@ word(int parsehtime)
|
||||
} while (c != '\n');
|
||||
if (parsehtime) {
|
||||
hbuf[11] = '\0';
|
||||
Htime = a2time_t(hbuf);
|
||||
Htime = a2time_t(hbuf);
|
||||
}
|
||||
if (c1 == '\\')
|
||||
goto loop;
|
||||
@ -885,7 +885,7 @@ getsub(struct wordent *en)
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*
|
||||
* From Beto Appleton (beto@aixwiz.austin.ibm.com)
|
||||
*
|
||||
* when using history substitution, and the variable
|
||||
@ -946,7 +946,7 @@ dosub(Char sc, struct wordent *en, int global)
|
||||
if (didsub == 0)
|
||||
seterror(ERR_MODFAIL);
|
||||
hp->prev = wdp;
|
||||
/*
|
||||
/*
|
||||
* ANSI mode HP/UX compiler chokes on
|
||||
* return &enthist(HIST_PURGE, &lexi, 0)->Hlex;
|
||||
*/
|
||||
@ -994,7 +994,7 @@ subword(Char *cp, Char type, int *adid, size_t *start_pos)
|
||||
case '\\':
|
||||
if (np[1] == '&')
|
||||
np++;
|
||||
/* fall into ... */
|
||||
/* FALLTHROUGH */
|
||||
|
||||
default:
|
||||
Strbuf_append1(&wbuf, *np);
|
||||
@ -1205,7 +1205,7 @@ gethent(Char sc)
|
||||
case '-':
|
||||
back = 1;
|
||||
c = getC(0);
|
||||
/* FALLSTHROUGH */
|
||||
/* FALLTHROUGH */
|
||||
|
||||
default:
|
||||
if (any("(=~", c)) {
|
||||
@ -1579,9 +1579,9 @@ wide_read(int fildes, Char *buf, size_t nchars, int use_fclens)
|
||||
|
||||
if (partial + len >= sizeof(cbuf) / sizeof(*cbuf))
|
||||
break;
|
||||
|
||||
|
||||
r = xread(fildes, cbuf + partial, len);
|
||||
|
||||
|
||||
if (partial == 0 && r <= 0)
|
||||
break;
|
||||
partial += r;
|
||||
@ -1755,7 +1755,7 @@ bseek(struct Ain *l)
|
||||
xprintf(CGETS(16, 5, "seek to alias %x %x\n"), alvec, alvecp);
|
||||
#endif
|
||||
return;
|
||||
case TCSH_F_SEEK:
|
||||
case TCSH_F_SEEK:
|
||||
#ifdef DEBUG_SEEK
|
||||
xprintf(CGETS(16, 6, "seek to file %x\n"), fseekp);
|
||||
#endif
|
||||
|
@ -270,7 +270,7 @@ closem(void)
|
||||
num_files = NOFILE;
|
||||
for (f = 0; f < num_files; f++)
|
||||
if (f != SHIN && f != SHOUT && f != SHDIAG && f != OLDSTD &&
|
||||
f != FSHTTY
|
||||
f != FSHTTY
|
||||
#ifdef MALLOC_TRACE
|
||||
&& f != 25
|
||||
#endif /* MALLOC_TRACE */
|
||||
@ -282,7 +282,7 @@ closem(void)
|
||||
* Not closing sockets does not make the cleanup use of closem()
|
||||
* less reliable because tcsh never creates sockets.
|
||||
*/
|
||||
&& fstat(f, &st) == 0 && !S_ISSOCK(st.st_mode)
|
||||
&& fstat(f, &st) == 0 && !S_ISSOCK(st.st_mode)
|
||||
#endif
|
||||
)
|
||||
{
|
||||
@ -342,7 +342,7 @@ donefds(void)
|
||||
(void)dcopy(fd, 2);
|
||||
(void)dmove(fd, 0);
|
||||
}
|
||||
#endif /*NISPLUS*/
|
||||
#endif /*NISPLUS*/
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -620,6 +620,7 @@ syn3(const struct wordent *p1, const struct wordent *p2, int flags)
|
||||
savep:
|
||||
if (!specp)
|
||||
continue;
|
||||
/* FALLTHROUGH */
|
||||
default:
|
||||
if (l != 0 && !specp)
|
||||
continue;
|
||||
|
@ -95,7 +95,7 @@ pcsecs(clock_t l)
|
||||
p2dig((int) (l % 100));
|
||||
}
|
||||
|
||||
static void
|
||||
static void
|
||||
p2dig(unsigned i)
|
||||
{
|
||||
|
||||
@ -123,7 +123,7 @@ putwraw(Char c)
|
||||
{
|
||||
char buf[MB_LEN_MAX];
|
||||
size_t i, len;
|
||||
|
||||
|
||||
len = one_wctomb(buf, c & CHAR);
|
||||
for (i = 0; i < len; i++)
|
||||
putraw((unsigned char)buf[i] | (c & ~CHAR));
|
||||
@ -134,7 +134,7 @@ xputwchar(Char c)
|
||||
{
|
||||
char buf[MB_LEN_MAX];
|
||||
size_t i, len;
|
||||
|
||||
|
||||
len = one_wctomb(buf, c & CHAR);
|
||||
for (i = 0; i < len; i++)
|
||||
xputchar((unsigned char)buf[i] | (c & ~CHAR));
|
||||
|
@ -233,10 +233,10 @@ pchild(void)
|
||||
# define HAVEwait3
|
||||
pid = waitpid(-1, &w,
|
||||
(setintr && (intty || insource) ? WNOHANG | WUNTRACED : WNOHANG));
|
||||
# endif /* ODT */
|
||||
# endif /* ODT */
|
||||
# if defined(aiws) || defined(uts)
|
||||
# define HAVEwait3
|
||||
pid = wait3(&w.w_status,
|
||||
pid = wait3(&w.w_status,
|
||||
(setintr && (intty || insource) ? WNOHANG | WUNTRACED : WNOHANG), 0);
|
||||
# endif /* aiws || uts */
|
||||
# ifndef HAVEwait3
|
||||
@ -245,8 +245,8 @@ pchild(void)
|
||||
/* on Sys V, this may hang. I hope it's not going to be a problem */
|
||||
pid = wait(&w);
|
||||
# else /* BSDWAIT */
|
||||
/*
|
||||
* XXX: for greater than 3 we should use waitpid().
|
||||
/*
|
||||
* XXX: for greater than 3 we should use waitpid().
|
||||
* but then again, SVR4 falls into the POSIX/BSDJOBS category.
|
||||
*/
|
||||
pid = wait(&w.w_status);
|
||||
@ -443,7 +443,7 @@ pnote(void)
|
||||
|
||||
static void
|
||||
pfree(struct process *pp)
|
||||
{
|
||||
{
|
||||
xfree(pp->p_command);
|
||||
if (pp->p_cwd && --pp->p_cwd->di_count == 0)
|
||||
if (pp->p_cwd->di_next == 0)
|
||||
@ -568,10 +568,10 @@ pjwait(struct process *pp)
|
||||
fp->p_reason | META : fp->p_reason;
|
||||
} while ((fp = fp->p_friends) != pp);
|
||||
/*
|
||||
* Don't report on backquoted jobs, cause it will mess up
|
||||
* Don't report on backquoted jobs, cause it will mess up
|
||||
* their output.
|
||||
*/
|
||||
if ((reason != 0) && (adrof(STRprintexitvalue)) &&
|
||||
if ((reason != 0) && (adrof(STRprintexitvalue)) &&
|
||||
(pp->p_flags & PBACKQ) == 0)
|
||||
xprintf(CGETS(17, 2, "Exit %d\n"), reason);
|
||||
reason_str = putn((tcsh_number_t)reason);
|
||||
@ -734,7 +734,7 @@ morecommand(size_t s)
|
||||
}
|
||||
|
||||
/* GrP
|
||||
* unparse - Export padd() functionality
|
||||
* unparse - Export padd() functionality
|
||||
*/
|
||||
Char *
|
||||
unparse(struct command *t)
|
||||
@ -1015,7 +1015,7 @@ pprint(struct process *pp, int flag)
|
||||
if ((pp->p_friends->p_flags & PPOU) && !inpipe && (flag & NAME)) {
|
||||
inpipe = 1;
|
||||
pipetail = pp;
|
||||
do
|
||||
do
|
||||
pp = pp->p_friends;
|
||||
while (pp->p_friends->p_flags & PPOU);
|
||||
pipehead = pp;
|
||||
@ -1028,7 +1028,7 @@ pprint(struct process *pp, int flag)
|
||||
pcond = (tp != pp || (inpipe && tp == pp));
|
||||
#else /* !BACKPIPE */
|
||||
pcond = (tp != pp);
|
||||
#endif /* BACKPIPE */
|
||||
#endif /* BACKPIPE */
|
||||
|
||||
jobflags |= pp->p_flags;
|
||||
pstatus = (int) (pp->p_flags & PALLSTATES);
|
||||
@ -1822,7 +1822,7 @@ pfork(struct command *t, int wanttty)
|
||||
pgrp = pcurrjob ? pcurrjob->p_jobid : getpid();
|
||||
pflushall();
|
||||
pcurrjob = NULL;
|
||||
#if !defined(BSDTIMES) && !defined(_SEQUENT_)
|
||||
#if !defined(BSDTIMES) && !defined(_SEQUENT_)
|
||||
timesdone = 0;
|
||||
#endif /* !defined(BSDTIMES) && !defined(_SEQUENT_) */
|
||||
child++;
|
||||
@ -1896,7 +1896,7 @@ pfork(struct command *t, int wanttty)
|
||||
pgrp = pcurrjob ? pcurrjob->p_jobid : pid;
|
||||
if (setpgid(pid, pgrp) == -1 && errno == EPERM) {
|
||||
pcurrjob = NULL;
|
||||
/*
|
||||
/*
|
||||
* We don't care if this causes an error here;
|
||||
* then we are already in the right process group
|
||||
*/
|
||||
@ -1965,7 +1965,7 @@ setttypgrp(int pgrp)
|
||||
struct sigaction old;
|
||||
|
||||
/*
|
||||
* tcsetpgrp will set SIGTTOU to all the the processes in
|
||||
* tcsetpgrp will set SIGTTOU to all the the processes in
|
||||
* the background according to POSIX... We ignore this here.
|
||||
*/
|
||||
sigaction(SIGTTOU, NULL, &old);
|
||||
@ -1984,7 +1984,7 @@ setttypgrp(int pgrp)
|
||||
* if we don't have vfork(), things can still go in the wrong order
|
||||
* resulting in the famous 'Stopped (tty output)'. But some systems
|
||||
* don't permit the setpgid() call, (these are more recent secure
|
||||
* systems such as ibm's aix), when they do. Then we'd rather print
|
||||
* systems such as ibm's aix), when they do. Then we'd rather print
|
||||
* an error message than hang the shell!
|
||||
* I am open to suggestions how to fix that.
|
||||
*/
|
||||
|
@ -53,7 +53,7 @@
|
||||
|
||||
#ifdef VFORK
|
||||
static void vffree (int);
|
||||
#endif
|
||||
#endif
|
||||
static Char *splicepipe (struct command *, Char *);
|
||||
static void doio (struct command *, int *, int *);
|
||||
static void chkclob (const char *);
|
||||
@ -72,7 +72,7 @@ static void chkclob (const char *);
|
||||
* mean processes connected by '|'.) I don't know yet if this causes other
|
||||
* problems.
|
||||
*
|
||||
* All the changes for this are in execute(), and are enclosed in
|
||||
* All the changes for this are in execute(), and are enclosed in
|
||||
* '#ifdef BACKPIPE'
|
||||
*
|
||||
* David Dawes (dawes@physics.su.oz.au) Oct 1991
|
||||
@ -98,7 +98,7 @@ execute(struct command *t, volatile int wanttty, int *pipein, int *pipeout,
|
||||
(void) &forked;
|
||||
(void) &bifunc;
|
||||
|
||||
if (t == 0)
|
||||
if (t == 0)
|
||||
return;
|
||||
|
||||
#ifdef WINNT_NATIVE
|
||||
@ -119,7 +119,7 @@ execute(struct command *t, volatile int wanttty, int *pipein, int *pipeout,
|
||||
/*
|
||||
* Ed hutchins@sgi.com & Dominic dbg@sgi.com
|
||||
* Sat Feb 25 03:13:11 PST 1995
|
||||
* try implicit cd if we have a 1 word command
|
||||
* try implicit cd if we have a 1 word command
|
||||
*/
|
||||
if (implicit_cd && (intty || intact) && t->t_dcom && t->t_dcom[0] &&
|
||||
t->t_dcom[0][0] && (blklen(t->t_dcom) == 1) && !noexec) {
|
||||
@ -164,7 +164,7 @@ execute(struct command *t, volatile int wanttty, int *pipein, int *pipeout,
|
||||
)) {
|
||||
Char *vCD[2];
|
||||
Char **ot_dcom = t->t_dcom;
|
||||
|
||||
|
||||
vCD[0] = Strsave(STRcd);
|
||||
vCD[1] = NULL;
|
||||
t->t_dcom = blkspl(vCD, ot_dcom);
|
||||
@ -321,11 +321,11 @@ execute(struct command *t, volatile int wanttty, int *pipein, int *pipeout,
|
||||
break;
|
||||
}
|
||||
|
||||
/*
|
||||
/*
|
||||
* GrP Executing a command - run jobcmd hook
|
||||
* Don't run for builtins
|
||||
* Don't run if we're not in a tty
|
||||
* Don't run if we're not really executing
|
||||
* Don't run if we're not really executing
|
||||
*/
|
||||
/*
|
||||
* CR - Charles Ross Aug 2005
|
||||
@ -341,7 +341,7 @@ execute(struct command *t, volatile int wanttty, int *pipein, int *pipeout,
|
||||
job_cmd(cmd);
|
||||
cleanup_until(cmd);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* We fork only if we are timed, or are not the end of a parenthesized
|
||||
* list and not a simple builtin function. Simple meaning one that is
|
||||
@ -752,7 +752,7 @@ execute(struct command *t, volatile int wanttty, int *pipein, int *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
|
||||
@ -784,7 +784,7 @@ vffree(int snum)
|
||||
*
|
||||
* 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 *
|
||||
@ -827,7 +827,7 @@ splicepipe(struct command *t, Char *cp)
|
||||
}
|
||||
return(blk[0]);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Perform io redirection.
|
||||
* We may or maynot be forked here.
|
||||
|
@ -61,7 +61,7 @@ static void
|
||||
update_vars(Char *vp)
|
||||
{
|
||||
if (eq(vp, STRpath)) {
|
||||
struct varent *p = adrof(STRpath);
|
||||
struct varent *p = adrof(STRpath);
|
||||
if (p == NULL)
|
||||
stderror(ERR_NAME | ERR_UNDVAR);
|
||||
else {
|
||||
@ -183,7 +183,7 @@ update_vars(Char *vp)
|
||||
numeof = numeof * 10 + *cp - '0';
|
||||
}
|
||||
if (numeof <= 0) numeof = 26; /* Sanity check */
|
||||
}
|
||||
}
|
||||
else if (eq(vp, STRbackslash_quote)) {
|
||||
bslash_quote = 1;
|
||||
}
|
||||
@ -611,7 +611,7 @@ adrof1(const Char *name, struct varent *v)
|
||||
int cmp;
|
||||
|
||||
v = v->v_left;
|
||||
while (v && ((cmp = *name - *v->v_name) != 0 ||
|
||||
while (v && ((cmp = *name - *v->v_name) != 0 ||
|
||||
(cmp = Strcmp(name, v->v_name)) != 0))
|
||||
if (cmp < 0)
|
||||
v = v->v_left;
|
||||
@ -702,7 +702,7 @@ set1(const Char *var, Char **vec, struct varent *head, int flags)
|
||||
}
|
||||
/* Compress items - remove empty items */
|
||||
for (j = i = 0; i < num_items; i++)
|
||||
if (vec[i])
|
||||
if (vec[i])
|
||||
vec[j++] = vec[i];
|
||||
|
||||
/* NULL-fy remaining items */
|
||||
@ -711,7 +711,7 @@ set1(const Char *var, Char **vec, struct varent *head, int flags)
|
||||
}
|
||||
/* don't let the attribute propagate */
|
||||
flags &= ~(VAR_FIRST|VAR_LAST);
|
||||
}
|
||||
}
|
||||
setq(var, vec, head, flags);
|
||||
}
|
||||
|
||||
@ -1153,7 +1153,7 @@ update_dspmbyte_vars(void)
|
||||
int lp, iskcode;
|
||||
Char *dstr1;
|
||||
struct varent *vp;
|
||||
|
||||
|
||||
/* if variable "nokanji" is set, multi-byte display is disabled */
|
||||
if ((vp = adrof(CHECK_MBYTEVAR)) && !adrof(STRnokanji)) {
|
||||
_enable_mbdisp = 1;
|
||||
@ -1306,7 +1306,7 @@ autoset_dspmbyte(const Char *pcp)
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
if (*pcp == '\0')
|
||||
return;
|
||||
|
||||
@ -1324,7 +1324,7 @@ void
|
||||
autoset_kanji(void)
|
||||
{
|
||||
char *codeset = nl_langinfo(CODESET);
|
||||
|
||||
|
||||
if (*codeset == '\0') {
|
||||
if (adrof(STRnokanji) == NULL)
|
||||
setNS(STRnokanji);
|
||||
|
@ -353,9 +353,9 @@ prusage(struct tms *bs, struct tms *es, clock_t e, clock_t b)
|
||||
|
||||
/*
|
||||
* the tms stuff is not very precise, so we fudge it.
|
||||
* granularity fix: can't be more than 100%
|
||||
* granularity fix: can't be more than 100%
|
||||
* this breaks in multi-processor systems...
|
||||
* maybe I should take it out and let people see more then 100%
|
||||
* maybe I should take it out and let people see more then 100%
|
||||
* utilizations.
|
||||
*/
|
||||
# if 0
|
||||
@ -447,7 +447,7 @@ prusage(struct tms *bs, struct tms *es, clock_t e, clock_t b)
|
||||
#endif
|
||||
xprintf("%ld", i);
|
||||
break;
|
||||
|
||||
|
||||
#ifdef convex
|
||||
case 'X': /* (average) shared text size */
|
||||
memtmp = (t == 0 ? 0LL : IADJUST((long long)r1->ru_ixrss -
|
||||
|
@ -5,8 +5,8 @@
|
||||
* dependent, even between different revisions of OS's...
|
||||
* Ideally there should be a way in c, to find out if something
|
||||
* was typedef'ed, but unfortunately we rely in cpp kludges.
|
||||
* Someday, this file will be removed...
|
||||
*
|
||||
* Someday, this file will be removed...
|
||||
*
|
||||
* christos
|
||||
*/
|
||||
/*-
|
||||
@ -51,7 +51,7 @@
|
||||
#endif
|
||||
|
||||
/***
|
||||
*** MachTen
|
||||
*** MachTen
|
||||
***/
|
||||
#ifdef __MACHTEN__
|
||||
# ifndef _PID_T
|
||||
@ -65,7 +65,7 @@
|
||||
***/
|
||||
#if (defined(sun) || defined(__sun__)) && SYSVREL == 0
|
||||
# ifndef _PTR_T
|
||||
# define _PTR_T
|
||||
# define _PTR_T
|
||||
# ifdef __GNUC__
|
||||
typedef void * ptr_t;
|
||||
# else
|
||||
@ -94,7 +94,7 @@
|
||||
#ifdef __hpux
|
||||
|
||||
# ifndef _PTR_T
|
||||
# define _PTR_T
|
||||
# define _PTR_T
|
||||
typedef void * ptr_t;
|
||||
# endif /* _PTR_T */
|
||||
|
||||
@ -152,23 +152,23 @@ typedef char * caddr_t;
|
||||
|
||||
/***
|
||||
*** BSD RENO advertises itself as POSIX, but
|
||||
*** it is missing speed_t
|
||||
*** it is missing speed_t
|
||||
***/
|
||||
#ifdef RENO
|
||||
# ifndef _SPEED_T
|
||||
# define _SPEED_T
|
||||
typedef unsigned int speed_t;
|
||||
typedef unsigned int speed_t;
|
||||
# endif /* _SPEED_T */
|
||||
#endif /* RENO */
|
||||
|
||||
|
||||
/***
|
||||
*** NeXT OS 3.x
|
||||
***/
|
||||
***/
|
||||
#ifdef NeXT
|
||||
# ifndef _SPEED_T
|
||||
# define _SPEED_T
|
||||
typedef unsigned int speed_t;
|
||||
typedef unsigned int speed_t;
|
||||
# endif /* _SPEED_T */
|
||||
#endif /* NeXT */
|
||||
|
||||
@ -205,7 +205,7 @@ typedef char * caddr_t;
|
||||
# endif /* _PID_T */
|
||||
# endif /* !aiws */
|
||||
# ifdef _IBMR2
|
||||
# ifndef _SPEED_T
|
||||
# ifndef _SPEED_T
|
||||
# define _SPEED_T
|
||||
# endif /* _SPEED_T */
|
||||
# endif /* _IBMR2 */
|
||||
@ -246,7 +246,7 @@ typedef char * caddr_t;
|
||||
#endif /* OREO */
|
||||
|
||||
/***
|
||||
*** Concurrent (Masscomp) running RTU 4.1A & RTU 5.0.
|
||||
*** Concurrent (Masscomp) running RTU 4.1A & RTU 5.0.
|
||||
**** [RTU 6.0 from mike connor]
|
||||
*** Added, DAS DEC-90.
|
||||
***/
|
||||
@ -261,7 +261,7 @@ typedef char * caddr_t;
|
||||
#endif /* RTU6 */
|
||||
#endif /* masscomp */
|
||||
|
||||
/*
|
||||
/*
|
||||
* Motorola MPC running R32V2 (sysV88)
|
||||
*/
|
||||
#ifdef sysV88
|
||||
@ -269,8 +269,8 @@ typedef char * caddr_t;
|
||||
# define _PID_T
|
||||
# endif /* _PID_T */
|
||||
#endif /* sysV88 */
|
||||
|
||||
/*
|
||||
|
||||
/*
|
||||
* Amdahl running UTS (Sys V3)
|
||||
*/
|
||||
#ifdef uts
|
||||
@ -279,7 +279,7 @@ typedef char * caddr_t;
|
||||
# endif /* _PID_T */
|
||||
#endif /* uts */
|
||||
|
||||
/*
|
||||
/*
|
||||
* Tektronix XD88/10 running UTekV (Sys V3)
|
||||
*/
|
||||
#ifdef UTekV
|
||||
@ -308,7 +308,7 @@ typedef char * caddr_t;
|
||||
typedef int pid_t; /* FX-80 */
|
||||
# else
|
||||
typedef short pid_t; /* FX-2800 */
|
||||
# endif
|
||||
# endif
|
||||
#endif /* alliant */
|
||||
|
||||
/*
|
||||
@ -367,7 +367,7 @@ typedef char * caddr_t;
|
||||
# endif /* _SPEED_T */
|
||||
|
||||
# ifndef _PTR_T
|
||||
# define _PTR_T
|
||||
# define _PTR_T
|
||||
typedef char * ptr_t;
|
||||
#endif /* _PTR_T */
|
||||
|
||||
@ -384,7 +384,7 @@ typedef char * caddr_t;
|
||||
*** This is our own junk types.
|
||||
***/
|
||||
#ifndef _PTR_T
|
||||
# define _PTR_T
|
||||
# define _PTR_T
|
||||
typedef void * ptr_t;
|
||||
#endif /* _PTR_T */
|
||||
|
||||
|
@ -77,8 +77,8 @@ out_of_memory (void)
|
||||
extern void* sbrk();
|
||||
#endif
|
||||
/*
|
||||
* Lots of os routines are busted and try to free invalid pointers.
|
||||
* Although our free routine is smart enough and it will pick bad
|
||||
* Lots of os routines are busted and try to free invalid pointers.
|
||||
* Although our free routine is smart enough and it will pick bad
|
||||
* pointers most of the time, in cases where we know we are going to get
|
||||
* a bad pointer, we'd rather leak.
|
||||
*/
|
||||
@ -190,7 +190,7 @@ malloc(size_t nbytes)
|
||||
/*
|
||||
* SunOS localtime() overwrites the 9th byte on an 8 byte malloc()....
|
||||
* so we get one more...
|
||||
* From Michael Schroeder: This is not true. It depends on the
|
||||
* From Michael Schroeder: This is not true. It depends on the
|
||||
* timezone string. In Europe it can overwrite the 13th byte on a
|
||||
* 12 byte malloc.
|
||||
* So we punt and we always allocate an extra byte.
|
||||
@ -379,7 +379,7 @@ calloc(size_t i, size_t j)
|
||||
*/
|
||||
#ifndef lint
|
||||
/* 4 should be plenty, -1 =>'s whole list */
|
||||
static int realloc_srchlen = 4;
|
||||
static int realloc_srchlen = 4;
|
||||
#endif /* lint */
|
||||
|
||||
memalign_t
|
||||
@ -402,7 +402,7 @@ realloc(ptr_t cp, size_t nbytes)
|
||||
else
|
||||
/*
|
||||
* Already free, doing "compaction".
|
||||
*
|
||||
*
|
||||
* Search for the old block of memory on the free list. First, check the
|
||||
* most common case (last element free'd), then (this failing) the last
|
||||
* ``realloc_srchlen'' items free'd. If all lookups fail, then assume
|
||||
@ -416,7 +416,7 @@ realloc(ptr_t cp, size_t nbytes)
|
||||
onb = MEMALIGN(nbytes + MEMALIGN(sizeof(union overhead)) + RSLOP);
|
||||
|
||||
/* avoid the copy if same size block */
|
||||
if (was_alloced && (onb <= (U_int) (1 << (i + 3))) &&
|
||||
if (was_alloced && (onb <= (U_int) (1 << (i + 3))) &&
|
||||
(onb > (U_int) (1 << (i + 2)))) {
|
||||
#ifdef RCHECK
|
||||
/* JMR: formerly this wasn't updated ! */
|
||||
@ -430,8 +430,8 @@ realloc(ptr_t cp, size_t nbytes)
|
||||
if ((res = malloc(nbytes)) == NULL)
|
||||
return ((memalign_t) NULL);
|
||||
if (cp != res) { /* common optimization */
|
||||
/*
|
||||
* christos: this used to copy nbytes! It should copy the
|
||||
/*
|
||||
* christos: this used to copy nbytes! It should copy the
|
||||
* smaller of the old and new size
|
||||
*/
|
||||
onb = (1 << (i + 3)) - MEMALIGN(sizeof(union overhead)) - RSLOP;
|
||||
@ -636,7 +636,7 @@ showall(Char **v, struct command *c)
|
||||
memtop = sbrk(0);
|
||||
#endif /* USE_SBRK */
|
||||
xprintf(CGETS(19, 12, "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));
|
||||
#else /* HAVE_MALLINFO */
|
||||
struct mallinfo mi;
|
||||
|
@ -68,13 +68,13 @@ dobindkey(Char **v, struct command *c)
|
||||
map = CcKeyMap;
|
||||
ntype = XK_CMD;
|
||||
key = removeb = bindk = 0;
|
||||
for (no = 1, par = v[no];
|
||||
for (no = 1, par = v[no];
|
||||
par != NULL && (*par++ & CHAR) == '-'; no++, par = v[no]) {
|
||||
if ((p = (*par & CHAR)) == '-') {
|
||||
no++;
|
||||
break;
|
||||
}
|
||||
else
|
||||
else
|
||||
switch (p) {
|
||||
case 'b':
|
||||
bindk = 1;
|
||||
|
@ -32,7 +32,7 @@
|
||||
#include "sh.h"
|
||||
|
||||
Char STRlogout[] = { 'l', 'o', 'g', 'o', 'u', 't', '\0' };
|
||||
Char STRautologout[] = { 'a', 'u', 't', 'o', 'l', 'o', 'g', 'o', 'u', 't',
|
||||
Char STRautologout[] = { 'a', 'u', 't', 'o', 'l', 'o', 'g', 'o', 'u', 't',
|
||||
'\0' };
|
||||
Char STRdefautologout[] = { '6', '0', '\0' };
|
||||
#ifdef convex
|
||||
@ -74,7 +74,7 @@ Char STRnetwork[] = { 'n', 'e', 't', 'w', 'o', 'r', 'k', '\0' };
|
||||
Char STRdumb[] = { 'd', 'u', 'm', 'b', '\0' };
|
||||
Char STRHOST[] = { 'H', 'O', 'S', 'T', '\0' };
|
||||
#ifdef REMOTEHOST
|
||||
Char STRREMOTEHOST[] = { 'R', 'E', 'M', 'O', 'T', 'E', 'H',
|
||||
Char STRREMOTEHOST[] = { 'R', 'E', 'M', 'O', 'T', 'E', 'H',
|
||||
'O', 'S', 'T', '\0' };
|
||||
#endif /* REMOTEHOST */
|
||||
Char STRHOSTTYPE[] = { 'H', 'O', 'S', 'T', 'T', 'Y', 'P', 'E', '\0' };
|
||||
@ -113,7 +113,7 @@ Char STRmm[] = { '-', 'm', '\0' };
|
||||
Char STRmr[] = { '-', 'r', '\0' };
|
||||
Char STRmerge[] = { 'm', 'e', 'r', 'g', 'e', '\0' };
|
||||
Char STRlock[] = { 'l', 'o', 'c', 'k', '\0' };
|
||||
Char STRtildothist[] = { '~', '/', '.', 'h', 'i', 's', 't', 'o', 'r',
|
||||
Char STRtildothist[] = { '~', '/', '.', 'h', 'i', 's', 't', 'o', 'r',
|
||||
'y', '\0' };
|
||||
|
||||
#ifdef NLS_CATALOGS
|
||||
@ -254,8 +254,8 @@ Char STRsldtlogout[] = { '/', '.', 'l', 'o', 'g', 'o', 'u', 't', '\0' };
|
||||
Char STRjobs[] = { 'j', 'o', 'b', 's', '\0' };
|
||||
Char STRdefprompt[] = { '%', '#', ' ', '\0' };
|
||||
Char STRmquestion[] = { '%', 'R', (Char)('?' | QUOTE), ' ', '\0' };
|
||||
Char STRKCORRECT[] = { 'C', 'O', 'R', 'R', 'E', 'C', 'T', '>', '%', 'R',
|
||||
' ', '(', 'y', '|', 'n', '|', 'e', '|', 'a', ')',
|
||||
Char STRKCORRECT[] = { 'C', 'O', 'R', 'R', 'E', 'C', 'T', '>', '%', 'R',
|
||||
' ', '(', 'y', '|', 'n', '|', 'e', '|', 'a', ')',
|
||||
(Char)('?' | QUOTE), ' ', '\0' };
|
||||
Char STRunalias[] = { 'u', 'n', 'a', 'l', 'i', 'a', 's', '\0' };
|
||||
Char STRalias[] = { 'a', 'l', 'i', 'a', 's', '\0' };
|
||||
@ -282,7 +282,7 @@ Char STRsymlinks[] = { 's', 'y', 'm', 'l', 'i', 'n', 'k', 's', '\0' };
|
||||
Char STRignore[] = { 'i', 'g', 'n', 'o', 'r', 'e', '\0' };
|
||||
Char STRchase[] = { 'c', 'h', 'a', 's', 'e', '\0' };
|
||||
Char STRexpand[] = { 'e', 'x', 'p', 'a', 'n', 'd', '\0' };
|
||||
Char STRecho_style[] = { 'e', 'c', 'h', 'o', '_', 's', 't', 'y', 'l', 'e',
|
||||
Char STRecho_style[] = { 'e', 'c', 'h', 'o', '_', 's', 't', 'y', 'l', 'e',
|
||||
'\0' };
|
||||
Char STRbsd[] = { 'b', 's', 'd', '\0' };
|
||||
Char STRsysv[] = { 's', 'y', 's', 'v', '\0' };
|
||||
@ -313,7 +313,7 @@ Char STRfakecom1[] = { '`', ' ', '.', '.', '.', ' ', '`', '\0' };
|
||||
Char STRampm[] = { 'a', 'm', 'p', 'm', '\0' };
|
||||
Char STRtime[] = { 't', 'i', 'm', 'e', '\0' };
|
||||
Char STRnotify[] = { 'n', 'o', 't', 'i', 'f', 'y', '\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 STRLparensp[] = { '(', ' ', '\0' };
|
||||
Char STRspRparen[] = { ' ', ')', '\0' };
|
||||
@ -371,7 +371,7 @@ Char STRignoreeof[] = { 'i', 'g', 'n', 'o', 'r', 'e', 'e', 'o', 'f', '\0' };
|
||||
Char STRnoclobber[] = { 'n', 'o', 'c', 'l', 'o', 'b', 'b', 'e', 'r', '\0' };
|
||||
Char STRnotempty[] = { 'n', 'o', 't', 'e', 'm', 'p', 't', 'y', '\0' };
|
||||
Char STRask[] = { 'a', 's', 'k', '\0' };
|
||||
Char STRhelpcommand[] = { 'h', 'e', 'l', 'p', 'c', 'o', 'm', 'm', 'a', 'n',
|
||||
Char STRhelpcommand[] = { 'h', 'e', 'l', 'p', 'c', 'o', 'm', 'm', 'a', 'n',
|
||||
'd', '\0' };
|
||||
Char STRfignore[] = { 'f', 'i', 'g', 'n', 'o', 'r', 'e', '\0' };
|
||||
Char STRrecexact[] = { 'r', 'e', 'c', 'e', 'x', 'a', 'c', 't', '\0' };
|
||||
@ -406,9 +406,9 @@ Char STRret[] = { '\n', '\0' };
|
||||
Char STRnobeep[] = { 'n', 'o', 'b', 'e', 'e', 'p', '\0' };
|
||||
Char STRnoding[] = { 'n', 'o', 'd', 'i', 'n', 'g', '\0' };
|
||||
Char STRpadhour[] = { 'p', 'a', 'd', 'h', 'o', 'u', 'r', '\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 STRvisiblebell[] = { 'v', 'i', 's', 'i', 'b', 'l', 'e', 'b', 'e', 'l',
|
||||
Char STRvisiblebell[] = { 'v', 'i', 's', 'i', 'b', 'l', 'e', 'b', 'e', 'l',
|
||||
'l', '\0' };
|
||||
Char STRrecognize_only_executables[] = { 'r', 'e', 'c', 'o', 'g', 'n', 'i',
|
||||
'z', 'e', '_', 'o', 'n', 'l', 'y',
|
||||
|
@ -153,8 +153,8 @@ extern void doucb (Char **, struct command *);
|
||||
#endif /* hcx */
|
||||
|
||||
#ifdef _SEQUENT_
|
||||
extern void pr_stat_sub (struct process_stats *,
|
||||
struct process_stats *,
|
||||
extern void pr_stat_sub (struct process_stats *,
|
||||
struct process_stats *,
|
||||
struct process_stats *);
|
||||
#endif /* _SEQUENT_ */
|
||||
|
||||
|
@ -364,7 +364,7 @@ dolist(Char **v, struct command *c)
|
||||
(*dp != (Char) ('/' | QUOTE))) {
|
||||
Strbuf_append1(&buf, '/');
|
||||
Strbuf_terminate(&buf);
|
||||
} else
|
||||
} else
|
||||
*dp &= TRIM;
|
||||
(void) t_search(&buf, LIST, TW_ZERO, 0, STRNULL, 0);
|
||||
i = k + 1;
|
||||
@ -481,7 +481,7 @@ dowhich(Char **v, struct command *c)
|
||||
* we glob here.
|
||||
*/
|
||||
|
||||
while (*++v)
|
||||
while (*++v)
|
||||
rv &= cmd_expand(*v, NULL);
|
||||
|
||||
if (!rv)
|
||||
@ -563,7 +563,7 @@ find_stop_ed(void)
|
||||
for (cp = p; *cp && !isspace((unsigned char) *cp); cp++)
|
||||
continue;
|
||||
*cp = '\0';
|
||||
|
||||
|
||||
if ((cp = strrchr(p, '/')) != NULL) /* and it has a path */
|
||||
cp = cp + 1; /* then we want only the last part */
|
||||
else
|
||||
@ -658,7 +658,7 @@ xgetpass(const char *prm)
|
||||
for (;;) {
|
||||
char c;
|
||||
|
||||
if (xread(fd, &c, 1) < 1 || c == '\n')
|
||||
if (xread(fd, &c, 1) < 1 || c == '\n')
|
||||
break;
|
||||
strbuf_append1(&pass, c);
|
||||
}
|
||||
@ -680,7 +680,7 @@ xgetpass(const char *prm)
|
||||
|
||||
/*
|
||||
* Ask the user for his login password to continue working
|
||||
* On systems that have a shadow password, this will only
|
||||
* On systems that have a shadow password, this will only
|
||||
* work for root, but what can we do?
|
||||
*
|
||||
* If we fail to get the password, then we log the user out
|
||||
@ -889,7 +889,7 @@ cwd_cmd(void)
|
||||
}
|
||||
|
||||
/*
|
||||
* Joachim Hoenig 07/16/91 Added beep_cmd, run every time tcsh wishes
|
||||
* Joachim Hoenig 07/16/91 Added beep_cmd, run every time tcsh wishes
|
||||
* to beep the terminal bell. Useful for playing nice sounds instead.
|
||||
*/
|
||||
void
|
||||
@ -951,11 +951,11 @@ period_cmd(void)
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
/*
|
||||
* GrP Greg Parker May 2001
|
||||
* Added job_cmd(), which is run every time a job is started or
|
||||
* foregrounded. The command is passed a single argument, the string
|
||||
* used to start the job originally. With precmd, useful for setting
|
||||
* Added job_cmd(), which is run every time a job is started or
|
||||
* foregrounded. The command is passed a single argument, the string
|
||||
* used to start the job originally. With precmd, useful for setting
|
||||
* xterm titles.
|
||||
* Cloned from cwd_cmd().
|
||||
*/
|
||||
@ -1467,7 +1467,7 @@ gethomedir(const Char *us)
|
||||
char **res, **res1, *cp;
|
||||
Char *rp;
|
||||
#endif /* HESIOD */
|
||||
|
||||
|
||||
pp = xgetpwnam(short2str(us));
|
||||
#ifdef YPBUGS
|
||||
fix_yp_bugs();
|
||||
@ -1719,7 +1719,7 @@ fixio(int fd, int e)
|
||||
FNDELAY|_FNDELAY|FNDLEAY); /* whew! */
|
||||
if (fcntl(fd, F_SETFL, e) == -1)
|
||||
return -1;
|
||||
else
|
||||
else
|
||||
e = 0;
|
||||
# endif /* F_SETFL */
|
||||
|
||||
@ -1763,7 +1763,7 @@ collate(const Char *a, const Char *b)
|
||||
|
||||
/*
|
||||
* We should be checking for errno != 0, but some systems
|
||||
* forget to reset errno to 0. So we only check for the
|
||||
* forget to reset errno to 0. So we only check for the
|
||||
* only documented valid errno value for strcoll [EINVAL]
|
||||
*/
|
||||
if (errno == EINVAL) {
|
||||
@ -1858,7 +1858,7 @@ hashbang(int fd, Char ***vp)
|
||||
|
||||
default:
|
||||
if (!ws) /* Start a new word? */
|
||||
ws = p;
|
||||
ws = p;
|
||||
p++;
|
||||
break;
|
||||
}
|
||||
@ -2102,7 +2102,7 @@ dotermname(Char **v, struct command *c)
|
||||
/* try to find which entry we should be looking for */
|
||||
termtype = (v[1] == NULL ? getenv("TERM") : short2str(v[1]));
|
||||
if (termtype == NULL) {
|
||||
/* no luck - the user didn't provide one and none is
|
||||
/* no luck - the user didn't provide one and none is
|
||||
* specified in the environment
|
||||
*/
|
||||
setcopy(STRstatus, STR1, VAR_READWRITE);
|
||||
@ -2110,7 +2110,7 @@ dotermname(Char **v, struct command *c)
|
||||
}
|
||||
|
||||
/*
|
||||
* we use the termcap function - if we are using terminfo we
|
||||
* we use the termcap function - if we are using terminfo we
|
||||
* will end up with it's compatibility function
|
||||
* terminfo/termcap will be initialized with the new
|
||||
* type but we don't care because tcsh has cached all the things
|
||||
|
@ -64,7 +64,7 @@ static Char STRMPATH[] = {'M', 'P', 'A', 'T', 'H', '\0'};
|
||||
static Char STREPATH[] = {'E', 'P', 'A', 'T', 'H', '\0'};
|
||||
# endif
|
||||
#endif /* MACH */
|
||||
static Char *syspaths[] = {STRKPATH, STRCPATH, STRLPATH, STRMPATH,
|
||||
static Char *syspaths[] = {STRKPATH, STRCPATH, STRLPATH, STRMPATH,
|
||||
|
||||
#if EPATH
|
||||
STREPATH,
|
||||
@ -302,11 +302,11 @@ dogetspath(Char **v, struct command *c)
|
||||
xprintf("%s ", xc);
|
||||
else
|
||||
xprintf("*cpu %d* ", (int) (p[i] & SPATH_MASK));
|
||||
/*
|
||||
/*
|
||||
* BUG in the aix code... needs that cause if
|
||||
* sfxcode fails once it fails for ever
|
||||
* sfxcode fails once it fails for ever
|
||||
*/
|
||||
endsf();
|
||||
endsf();
|
||||
}
|
||||
}
|
||||
else {
|
||||
@ -552,7 +552,7 @@ catch_sigsys(void)
|
||||
|
||||
/*ARGSUSED*/
|
||||
void
|
||||
dowarp(Char **v, struct command *c)
|
||||
dowarp(Char **v, struct command *c)
|
||||
{
|
||||
int warp, oldwarp;
|
||||
struct warpent *we;
|
||||
@ -619,7 +619,7 @@ setuniverse_cleanup(void *xbuf)
|
||||
|
||||
/*ARGSUSED*/
|
||||
void
|
||||
douniverse(Char **v, struct command *c)
|
||||
douniverse(Char **v, struct command *c)
|
||||
{
|
||||
Char *cp = v[1];
|
||||
Char *cp2; /* dunno how many elements v comes in with */
|
||||
@ -713,7 +713,7 @@ bs2cmdlist(char *str)
|
||||
break;
|
||||
|
||||
str_beg = str;
|
||||
|
||||
|
||||
for (; *str != '\0'; ++str)
|
||||
{
|
||||
if (string == outside && *str == ';') /* End of command */
|
||||
@ -973,7 +973,7 @@ void *xmemset(void *loc, int value, size_t len)
|
||||
#ifndef HAVE_MEMMOVE
|
||||
/* memmove():
|
||||
* This is the ANSI form of bcopy() with the arguments backwards...
|
||||
* Unlike memcpy(), it handles overlaps between source and
|
||||
* Unlike memcpy(), it handles overlaps between source and
|
||||
* destination memory
|
||||
*/
|
||||
void *
|
||||
@ -986,13 +986,13 @@ xmemmove(void *vdst, const void *vsrc, size_t len)
|
||||
return vdst;
|
||||
|
||||
if (src > dst) {
|
||||
while (len--)
|
||||
while (len--)
|
||||
*dst++ = *src++;
|
||||
}
|
||||
else {
|
||||
src += len;
|
||||
dst += len;
|
||||
while (len--)
|
||||
while (len--)
|
||||
*--dst = *--src;
|
||||
}
|
||||
return vdst;
|
||||
@ -1062,7 +1062,7 @@ fix_strcoll_bug(void)
|
||||
* We have to call this routine every time the locale changes...
|
||||
*
|
||||
* Of course it also tries to free the constant locale "C" it initially
|
||||
* had allocated, with the sequence
|
||||
* had allocated, with the sequence
|
||||
* > setenv LANG "fr"
|
||||
* > ls^D
|
||||
* > unsetenv LANG
|
||||
@ -1110,7 +1110,7 @@ osinit(void)
|
||||
#endif
|
||||
|
||||
#ifdef _SX
|
||||
/*
|
||||
/*
|
||||
* kill(SIGCONT) problems, don't know what this syscall does
|
||||
* [schott@rzg.mpg.de]
|
||||
*/
|
||||
@ -1135,7 +1135,7 @@ xstrerror(int i)
|
||||
}
|
||||
}
|
||||
#endif /* !HAVE_STRERROR */
|
||||
|
||||
|
||||
#ifndef HAVE_GETHOSTNAME
|
||||
# if !defined(_MINIX) && !defined(__EMX__) && !defined(WINNT_NATIVE)
|
||||
# include <sys/utsname.h>
|
||||
@ -1182,7 +1182,7 @@ xgethostname(char *name, int namlen)
|
||||
# undef HZ /* redefined in <minix/const.h> */
|
||||
# include <lib.h>
|
||||
# endif /* _MINIX && NICE */
|
||||
int
|
||||
int
|
||||
xnice(int incr)
|
||||
{
|
||||
#if defined(_MINIX) && defined(NICE)
|
||||
@ -1250,7 +1250,7 @@ xgetcwd(char *pathname, size_t pathlen)
|
||||
}
|
||||
do {
|
||||
if ((dir = readdir(dirp)) == NULL) {
|
||||
(void) xsnprintf(pathname, pathlen,
|
||||
(void) xsnprintf(pathname, pathlen,
|
||||
CGETS(23, 21, "getcwd: Read error in \"..\" (%s)"),
|
||||
strerror(errno));
|
||||
goto fail;
|
||||
@ -1307,7 +1307,7 @@ xgetcwd(char *pathname, size_t pathlen)
|
||||
|
||||
/* find the inode of root */
|
||||
if (stat("/", &st_root) == -1) {
|
||||
(void) xsnprintf(pathname, pathlen, CGETS(23, 23,
|
||||
(void) xsnprintf(pathname, pathlen, CGETS(23, 23,
|
||||
"getcwd: Cannot stat \"/\" (%s)"),
|
||||
strerror(errno));
|
||||
return NULL;
|
||||
@ -1365,9 +1365,9 @@ xgetcwd(char *pathname, size_t pathlen)
|
||||
}
|
||||
}
|
||||
else {
|
||||
/*
|
||||
* Parent has a different device. This is a mount point so we
|
||||
* need to stat every member
|
||||
/*
|
||||
* Parent has a different device. This is a mount point so we
|
||||
* need to stat every member
|
||||
*/
|
||||
for (d = readdir(dp); d != NULL; d = readdir(dp)) {
|
||||
if (ISDOT(d->d_name) || ISDOTDOT(d->d_name))
|
||||
@ -1387,7 +1387,7 @@ xgetcwd(char *pathname, size_t pathlen)
|
||||
}
|
||||
/* check if we found it yet */
|
||||
if (st_next.st_ino == st_cur.st_ino &&
|
||||
DEV_DEV_COMPARE(st_next.st_dev, st_cur.st_dev))
|
||||
DEV_DEV_COMPARE(st_next.st_dev, st_cur.st_dev))
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -1461,7 +1461,7 @@ llib(Char *s)
|
||||
char *t;
|
||||
|
||||
loader_$inlib(t = short2str(s), len, &st);
|
||||
if (st.all != status_$ok)
|
||||
if (st.all != status_$ok)
|
||||
stderror(ERR_SYSTEM, t, apperr(&st));
|
||||
}
|
||||
|
||||
@ -1476,7 +1476,7 @@ doinlib(Char **v, struct command *c)
|
||||
globbed = v;
|
||||
cleanup_push(globbed, blk_cleanup);
|
||||
|
||||
while (v && *v)
|
||||
while (v && *v)
|
||||
llib(*v++);
|
||||
cleanup_until(globbed);
|
||||
}
|
||||
@ -1488,7 +1488,7 @@ getv(Char *v)
|
||||
return(1);
|
||||
else if (eq(v, STRsys53))
|
||||
return(0);
|
||||
else
|
||||
else
|
||||
stderror(ERR_NAME | ERR_SYSTEM, short2str(v),
|
||||
CGETS(23, 28, "Invalid system type"));
|
||||
/*NOTREACHED*/
|
||||
@ -1542,11 +1542,11 @@ dorootnode(Char **v, struct command *c)
|
||||
namelen = strlen(name);
|
||||
|
||||
name_$resolve(name, &namelen, &uid, &st);
|
||||
if (st.all != status_$ok)
|
||||
if (st.all != status_$ok)
|
||||
stderror(ERR_SYSTEM, name, apperr(&st));
|
||||
namelen = 0;
|
||||
name_$set_diru(&uid, "", &namelen, &dirtype, &st);
|
||||
if (st.all != status_$ok)
|
||||
if (st.all != status_$ok)
|
||||
stderror(ERR_SYSTEM, name, apperr(&st));
|
||||
dohash(NULL, NULL);
|
||||
}
|
||||
@ -1574,7 +1574,7 @@ isapad(void)
|
||||
res = res ? 1 : 0;
|
||||
}
|
||||
else {
|
||||
if (st.all != status_$ok)
|
||||
if (st.all != status_$ok)
|
||||
stderror(ERR_SYSTEM, "stream_$isavt", apperr(&st));
|
||||
}
|
||||
return(res);
|
||||
|
@ -32,9 +32,9 @@
|
||||
#ifndef _h_tc_os
|
||||
#define _h_tc_os
|
||||
|
||||
#ifdef notdef
|
||||
#ifdef notdef
|
||||
/*
|
||||
* for SVR4 and linux we used to fork pipelines backwards.
|
||||
* for SVR4 and linux we used to fork pipelines backwards.
|
||||
* This should not be needed any more.
|
||||
* more info in sh.sem.c
|
||||
*/
|
||||
@ -47,7 +47,7 @@
|
||||
#endif
|
||||
|
||||
#ifdef _VMS_POSIX
|
||||
# ifndef NOFILE
|
||||
# ifndef NOFILE
|
||||
# define NOFILE 64
|
||||
# endif /* NOFILE */
|
||||
# define nice(a) setprio((getpid()),a)
|
||||
@ -79,7 +79,7 @@
|
||||
# include <sys/time.h>
|
||||
# ifdef notdef
|
||||
/* Don't include it, because it defines things we don't really have */
|
||||
# include <sys/resource.h>
|
||||
# include <sys/resource.h>
|
||||
# endif /* notdef */
|
||||
# ifdef POSIX
|
||||
# include <sys/tty.h>
|
||||
@ -156,7 +156,7 @@ struct ucred {
|
||||
#endif /* ISC202 */
|
||||
|
||||
/*
|
||||
* XXX: This will be changed soon to
|
||||
* XXX: This will be changed soon to
|
||||
* #if (SYSVREL > 0) && defined(TIOCGWINSZ)
|
||||
* If that breaks on your machine, let me know.
|
||||
*
|
||||
@ -181,7 +181,7 @@ struct ucred {
|
||||
#endif /* IRIS4D */
|
||||
|
||||
/*
|
||||
* For some versions of system V software, specially ones that use the
|
||||
* For some versions of system V software, specially ones that use the
|
||||
* Wollongong Software TCP/IP, the FIOCLEX, FIONCLEX, FIONBIO calls
|
||||
* might not work correctly for file descriptors [they work only for
|
||||
* sockets]. So we try to use first the fcntl() and we only use the
|
||||
@ -311,7 +311,7 @@ struct ucred {
|
||||
#ifndef S_ISUID
|
||||
# define S_ISUID 0004000 /* setuid */
|
||||
#endif /* S_ISUID */
|
||||
#ifndef S_ISGID
|
||||
#ifndef S_ISGID
|
||||
# define S_ISGID 0002000 /* setgid */
|
||||
#endif /* S_ISGID */
|
||||
#ifndef S_ISVTX
|
||||
@ -406,7 +406,7 @@ struct ucred {
|
||||
# define NEEDtcgetpgrp
|
||||
#endif /* BSDJOBS && !(POSIX && POSIXJOBS) */
|
||||
|
||||
#ifdef RENO
|
||||
#ifdef RENO
|
||||
/*
|
||||
* RENO has this broken. It is fixed on 4.4BSD
|
||||
*/
|
||||
@ -540,11 +540,11 @@ extern char *getvwd();
|
||||
# endif /* (SUNOS4 && ! __GNUC__) || _IBMR2 || _IBMESA */
|
||||
|
||||
# ifdef SCO
|
||||
extern char *ttyname();
|
||||
extern char *ttyname();
|
||||
# endif /* SCO */
|
||||
|
||||
# ifdef __clipper__
|
||||
extern char *ttyname();
|
||||
extern char *ttyname();
|
||||
# endif /* __clipper__ */
|
||||
|
||||
#endif /* !POSIX || SUNOS4 || UTekV || sysV88 */
|
||||
@ -565,7 +565,7 @@ extern int getpeername (int, struct sockaddr *, int *);
|
||||
# endif /* REMOTEHOST */
|
||||
#endif /* SUNOS4 && __GNUC__ == 2 */
|
||||
|
||||
#if (defined(BSD) && !defined(BSD4_4)) || defined(SUNOS4)
|
||||
#if (defined(BSD) && !defined(BSD4_4)) || defined(SUNOS4)
|
||||
# if defined(__alpha) && defined(__osf__) && DECOSF1 < 200
|
||||
extern void bcopy (const void *, void *, size_t);
|
||||
# define memmove(a, b, c) (bcopy((char *) (b), (char *) (a), (int) (c)), a)
|
||||
|
@ -457,7 +457,7 @@ xasprintf(const char *fmt, ...)
|
||||
#ifndef FILE
|
||||
#define FILE int
|
||||
#endif
|
||||
int
|
||||
int
|
||||
fprintf(FILE *fp, const char* fmt, ...)
|
||||
{
|
||||
int count;
|
||||
@ -468,7 +468,7 @@ fprintf(FILE *fp, const char* fmt, ...)
|
||||
return count;
|
||||
}
|
||||
|
||||
int
|
||||
int
|
||||
vfprintf(FILE *fp, const char *fmt, va_list va)
|
||||
{
|
||||
return doprnt(xputchar, fmt, va);
|
||||
|
@ -127,7 +127,7 @@ printprompt(int promptno, const char *str)
|
||||
cp = ocp;
|
||||
str = ostr;
|
||||
}
|
||||
else
|
||||
else
|
||||
cp = varval(STRprompt);
|
||||
break;
|
||||
}
|
||||
@ -266,7 +266,7 @@ tprintf(int what, const Char *fmt, const char *str, time_t tim, ptr_t info)
|
||||
} /* else do a 24 hour clock */
|
||||
|
||||
/* "DING!" stuff by Hans also */
|
||||
if (t->tm_min || print_prompt_did_ding ||
|
||||
if (t->tm_min || print_prompt_did_ding ||
|
||||
what != FMT_PROMPT || adrof(STRnoding)) {
|
||||
if (t->tm_min)
|
||||
print_prompt_did_ding = 0;
|
||||
@ -306,7 +306,7 @@ tprintf(int what, const Char *fmt, const char *str, time_t tim, ptr_t info)
|
||||
#ifndef HAVENOUTMP
|
||||
if (what == FMT_WHO)
|
||||
cz = who_info(info, 'M');
|
||||
else
|
||||
else
|
||||
#endif /* HAVENOUTMP */
|
||||
cz = getenv("HOST");
|
||||
/*
|
||||
@ -462,7 +462,7 @@ tprintf(int what, const Char *fmt, const char *str, time_t tim, ptr_t info)
|
||||
tprintf_append_mbs(&buf, cz, attributes);
|
||||
xfree(cz);
|
||||
}
|
||||
else
|
||||
else
|
||||
#endif /* HAVENOUTMP */
|
||||
{
|
||||
if ((z = varval(STRuser)) != STRNULL)
|
||||
@ -482,7 +482,7 @@ tprintf(int what, const Char *fmt, const char *str, time_t tim, ptr_t info)
|
||||
tprintf_append_mbs(&buf, cz, attributes);
|
||||
xfree(cz);
|
||||
}
|
||||
else
|
||||
else
|
||||
#endif /* HAVENOUTMP */
|
||||
{
|
||||
if ((z = varval(STRtty)) != STRNULL)
|
||||
|
@ -276,7 +276,7 @@ s_strncpy(Char *dst, const Char *src, size_t n)
|
||||
return(dst);
|
||||
|
||||
sdst = dst;
|
||||
do
|
||||
do
|
||||
if ((*dst++ = *src++) == '\0') {
|
||||
while (--n != 0)
|
||||
*dst++ = '\0';
|
||||
@ -299,7 +299,7 @@ s_strncat(Char *dst, const Char *src, size_t n)
|
||||
{
|
||||
Char *sdst;
|
||||
|
||||
if (n == 0)
|
||||
if (n == 0)
|
||||
return (dst);
|
||||
|
||||
sdst = dst;
|
||||
@ -307,7 +307,7 @@ s_strncat(Char *dst, const Char *src, size_t n)
|
||||
while (*dst)
|
||||
dst++;
|
||||
|
||||
do
|
||||
do
|
||||
if ((*dst++ = *src++) == '\0')
|
||||
return(sdst);
|
||||
while (--n != 0)
|
||||
@ -380,7 +380,7 @@ s_strncmp(const Char *str1, const Char *str2, size_t n)
|
||||
do {
|
||||
if (*str1 != *str2) {
|
||||
/*
|
||||
* The following case analysis is necessary so that characters
|
||||
* The following case analysis is necessary so that characters
|
||||
* which look negative collate low against normal characters
|
||||
* but high against the end-of-string NUL.
|
||||
*/
|
||||
|
@ -47,57 +47,57 @@ fix_version(void)
|
||||
# define SSSTR "8b"
|
||||
#else
|
||||
# define SSSTR "7b"
|
||||
#endif
|
||||
#endif
|
||||
#ifdef NLS
|
||||
# define NLSSTR ",nls"
|
||||
#else
|
||||
# define NLSSTR ""
|
||||
#endif
|
||||
#endif
|
||||
#ifdef LOGINFIRST
|
||||
# define LFSTR ",lf"
|
||||
#else
|
||||
# define LFSTR ""
|
||||
#endif
|
||||
#endif
|
||||
#ifdef DOTLAST
|
||||
# define DLSTR ",dl"
|
||||
#else
|
||||
# define DLSTR ""
|
||||
#endif
|
||||
#endif
|
||||
#ifdef VIDEFAULT
|
||||
# define VISTR ",vi"
|
||||
#else
|
||||
# define VISTR ""
|
||||
#endif
|
||||
#endif
|
||||
#ifdef TESLA
|
||||
# define DTRSTR ",dtr"
|
||||
#else
|
||||
# define DTRSTR ""
|
||||
#endif
|
||||
#endif
|
||||
#ifdef KAI
|
||||
# define BYESTR ",bye"
|
||||
#else
|
||||
# define BYESTR ""
|
||||
#endif
|
||||
#endif
|
||||
#ifdef AUTOLOGOUT
|
||||
# define ALSTR ",al"
|
||||
#else
|
||||
# define ALSTR ""
|
||||
#endif
|
||||
#endif
|
||||
#ifdef KANJI
|
||||
# define KANSTR ",kan"
|
||||
#else
|
||||
# define KANSTR ""
|
||||
#endif
|
||||
#endif
|
||||
#ifdef SYSMALLOC
|
||||
# define SMSTR ",sm"
|
||||
#else
|
||||
# define SMSTR ""
|
||||
#endif
|
||||
#endif
|
||||
#ifdef HASHBANG
|
||||
# define HBSTR ",hb"
|
||||
#else
|
||||
# define HBSTR ""
|
||||
#endif
|
||||
#endif
|
||||
#ifdef NEWGRP
|
||||
# define NGSTR ",ng"
|
||||
#else
|
||||
|
@ -210,7 +210,7 @@ watch_login(int force)
|
||||
#if defined(HAVE_STRUCT_UTMP_UT_HOST) && defined(_SEQUENT_)
|
||||
char *host, *ut_find_host();
|
||||
#endif
|
||||
#ifdef WINNT_NATIVE
|
||||
#ifdef WINNT_NATIVE
|
||||
USE(utmp);
|
||||
USE(utmpfd);
|
||||
USE(sta);
|
||||
@ -233,7 +233,7 @@ watch_login(int force)
|
||||
}
|
||||
else
|
||||
interval = 0;
|
||||
|
||||
|
||||
(void) time(&t);
|
||||
if (t - watch_period < interval) {
|
||||
cleanup_until(&pintr_disabled);
|
||||
@ -326,7 +326,7 @@ watch_login(int force)
|
||||
wp->who_status = OFFLINE;
|
||||
}
|
||||
else if (strncmp(utmp.ut_name, wp->who_name, UTNAMLEN) == 0) {
|
||||
/* someone is logged in */
|
||||
/* someone is logged in */
|
||||
wp->who_time = utmp.ut_time;
|
||||
wp->who_status = ONLINE | ANNOUNCE; /* same guy */
|
||||
}
|
||||
@ -631,7 +631,7 @@ utmphost(void)
|
||||
char *host = NULL;
|
||||
|
||||
watch_login(1);
|
||||
|
||||
|
||||
for (wp = whohead.who_next; wp->who_next != NULL; wp = wp->who_next) {
|
||||
if (strcmp(tty, wp->who_tty) == 0)
|
||||
host = wp->who_host;
|
||||
|
@ -77,7 +77,7 @@
|
||||
.\" used here if you can. In particular, please don't use nroff commands
|
||||
.\" which aren't already used herein.
|
||||
.\"
|
||||
.TH TCSH 1 "11 Nov 2020" "Astron 6.22.03"
|
||||
.TH TCSH 1 "26 Apr 2021" "Astron 6.22.04"
|
||||
.SH NAME
|
||||
tcsh \- C shell with file name completion and command line editing
|
||||
.SH SYNOPSIS
|
||||
@ -5355,7 +5355,7 @@ pipe(2), setrlimit(2), sigvec(2), stat(2), umask(2), vfork(2), wait(2),
|
||||
malloc(3), setlocale(3), tty(4), a.out(5), termcap(5), environ(7),
|
||||
termio(7), Introduction to the C Shell
|
||||
.SH VERSION
|
||||
This manual documents tcsh 6.22.03 (Astron) 2020-11-18.
|
||||
This manual documents tcsh 6.22.04 (Astron) 2021-04-26.
|
||||
.SH AUTHORS
|
||||
.PD 0
|
||||
.TP 2
|
||||
|
@ -146,7 +146,7 @@ enum ansi {
|
||||
ANSI_BG_DEFAULT = 49, /* bg default (black) */
|
||||
};
|
||||
#define TCSH_BOLD 0x80
|
||||
|
||||
|
||||
typedef struct {
|
||||
Str extension; /* file extension */
|
||||
Str color; /* color string */
|
||||
@ -252,11 +252,13 @@ static void
|
||||
makecolor(char **c, int fg, int bg, Str *v)
|
||||
{
|
||||
int l;
|
||||
if (fg & 0x80)
|
||||
if (fg & 0x80) {
|
||||
l = xsnprintf(*c, 12, "%.2d;%.2d;%.2d;%.2d", ANSI_BOLD_ON,
|
||||
fg & ~TCSH_BOLD, (10 + bg) & ~TCSH_BOLD, ANSI_BOLD_OFF);
|
||||
} else {
|
||||
l = xsnprintf(*c, 6, "%.2d;%.2d",
|
||||
fg & ~TCSH_BOLD, (10 + bg) & ~TCSH_BOLD);
|
||||
}
|
||||
|
||||
v->s = *c;
|
||||
v->len = l;
|
||||
|
@ -132,7 +132,7 @@ tw_prlist(struct varent *p)
|
||||
|
||||
|
||||
/* tw_pr():
|
||||
* Pretty print a completion, adding single quotes around
|
||||
* Pretty print a completion, adding single quotes around
|
||||
* a completion argument and collapsing multiple spaces to one.
|
||||
*/
|
||||
static void
|
||||
@ -158,7 +158,7 @@ tw_pr(Char **cmp)
|
||||
|
||||
|
||||
/* tw_find():
|
||||
* Find the first matching completion.
|
||||
* Find the first matching completion.
|
||||
* For commands we only look at names that start with -
|
||||
*/
|
||||
static Char **
|
||||
@ -199,7 +199,7 @@ tw_pos(Char *ran, int wno)
|
||||
|
||||
if (*p == '\0') /* range == <number> */
|
||||
return wno == getn(ran);
|
||||
|
||||
|
||||
if (ran == p) /* range = - <number> */
|
||||
return wno <= getn(&ran[1]);
|
||||
*p++ = '\0';
|
||||
@ -221,7 +221,7 @@ tw_tok(Char *str)
|
||||
|
||||
if (str != NULL)
|
||||
bf = str;
|
||||
|
||||
|
||||
/* skip leading spaces */
|
||||
for (; *bf && Isspace(*bf); bf++)
|
||||
continue;
|
||||
@ -356,7 +356,7 @@ tw_result(const Char *act, Char **pat)
|
||||
res = Strsave(act);
|
||||
if ((p = Strchr(&res[1], '`')) != NULL)
|
||||
*++p = '\0';
|
||||
|
||||
|
||||
if (didfds == 0) {
|
||||
/*
|
||||
* Make sure that we have some file descriptors to
|
||||
@ -504,7 +504,7 @@ tw_complete(const Char *line, Char **word, Char **pat, int looking, eChar *suf)
|
||||
wordno++;
|
||||
}
|
||||
wl[wordno] = NULL;
|
||||
|
||||
|
||||
|
||||
#ifdef TDEBUG
|
||||
xprintf("\r\n");
|
||||
@ -515,7 +515,7 @@ tw_complete(const Char *line, Char **word, Char **pat, int looking, eChar *suf)
|
||||
xprintf("last: %s\n", wordno >= 2 ? short2str(wl[wordno-2]) : "n/a");
|
||||
xprintf("this: %s\n", wordno >= 1 ? short2str(wl[wordno-1]) : "n/a");
|
||||
#endif /* TDEBUG */
|
||||
|
||||
|
||||
for (;vec != NULL && (ptr = vec[0]) != NULL; vec++) {
|
||||
Char *ran, /* The pattern or range X/<range>/XXXX/ */
|
||||
*com, /* The completion X/XXXXX/<completion>/ */
|
||||
|
@ -81,7 +81,7 @@
|
||||
#define DEFAULTLIST ":/usr/man/cat1:/usr/man/cat8:/usr/man/cat6:/usr/local/man/cat1:/usr/local/man/cat8:/usr/local/man/cat6" /* if no HPATH */
|
||||
|
||||
typedef enum {
|
||||
LIST, LIST_ALL, RECOGNIZE, RECOGNIZE_ALL, RECOGNIZE_SCROLL,
|
||||
LIST, LIST_ALL, RECOGNIZE, RECOGNIZE_ALL, RECOGNIZE_SCROLL,
|
||||
PRINT_HELP, SPELL, GLOB, GLOB_EXPAND, VARS_EXPAND, PATH_NORMALIZE,
|
||||
COMMAND_NORMALIZE
|
||||
} COMMAND;
|
||||
|
@ -323,7 +323,7 @@ tw_cmd_sort(void)
|
||||
for (i = 0, fwd = 0; i + 1 < tw_cmd.nlist; i++) {
|
||||
if (Strcmp(tw_cmd.list[i], tw_cmd.list[i + 1]) == 0) /* garbage */
|
||||
fwd++; /* increase the forward ref. count */
|
||||
else if (fwd)
|
||||
else if (fwd)
|
||||
tw_cmd.list[i - fwd] = tw_cmd.list[i];
|
||||
}
|
||||
/* Fix fencepost error -- Theodore Ts'o <tytso@athena.mit.edu> */
|
||||
@ -374,7 +374,7 @@ tw_cmd_start(DIR *dfd, const Char *pat)
|
||||
else
|
||||
tw_cmd_state.pathv = defpath;
|
||||
}
|
||||
else
|
||||
else
|
||||
tw_cmd_state.pathv = defpath;
|
||||
} /* tw_cmd_start */
|
||||
|
||||
@ -589,7 +589,7 @@ tw_var_next(struct Strbuf *res, struct Strbuf *dir, int *flags)
|
||||
* Initialize lognames to the beginning of the list
|
||||
*/
|
||||
/*ARGSUSED*/
|
||||
void
|
||||
void
|
||||
tw_logname_start(DIR *dfd, const Char *pat)
|
||||
{
|
||||
USE(pat);
|
||||
@ -655,7 +655,7 @@ tw_logname_end(void)
|
||||
* Initialize grpnames to the beginning of the list
|
||||
*/
|
||||
/*ARGSUSED*/
|
||||
void
|
||||
void
|
||||
tw_grpname_start(DIR *dfd, const Char *pat)
|
||||
{
|
||||
USE(pat);
|
||||
@ -736,7 +736,7 @@ tw_file_start(DIR *dfd, const Char *pat)
|
||||
|
||||
|
||||
/* tw_file_next():
|
||||
* Return the next file in the directory
|
||||
* Return the next file in the directory
|
||||
*/
|
||||
int
|
||||
tw_file_next(struct Strbuf *res, struct Strbuf *dir, int *flags)
|
||||
@ -783,8 +783,8 @@ tw_item_free(void)
|
||||
} /* end tw_item_free */
|
||||
|
||||
|
||||
/* tw_item_get():
|
||||
* Return the list of items
|
||||
/* tw_item_get():
|
||||
* Return the list of items
|
||||
*/
|
||||
Char **
|
||||
tw_item_get(void)
|
||||
@ -807,7 +807,7 @@ tw_item_add(const struct Strbuf *s)
|
||||
|
||||
|
||||
/* tw_item_find():
|
||||
* Find the string if it exists in the item list
|
||||
* Find the string if it exists in the item list
|
||||
* end return it.
|
||||
*/
|
||||
Char *
|
||||
@ -1016,7 +1016,7 @@ tw_job_next(struct Strbuf *res, struct Strbuf *dir, int *flags)
|
||||
for (j = proclist.p_next; j != NULL; j = j->p_next)
|
||||
if (j->p_index == tw_index && j->p_procid == j->p_jobid)
|
||||
break;
|
||||
if (j == NULL)
|
||||
if (j == NULL)
|
||||
continue;
|
||||
Strbuf_append(res, j->p_command);
|
||||
tw_index++;
|
||||
|
@ -54,25 +54,25 @@
|
||||
/* TW_BINDING, TW_WORDLIST, TW_LIMIT, TW_SIGNAL */
|
||||
/* TW_JOB, TW_EXPLAIN, TW_TEXT, TW_GRPNAME */
|
||||
static void (*const tw_start_entry[]) (DIR *, const Char *) = {
|
||||
tw_file_start, tw_cmd_start, tw_var_start, tw_logname_start,
|
||||
tw_file_start, tw_file_start, tw_vl_start, tw_logname_start,
|
||||
tw_complete_start, tw_alias_start, tw_var_start, tw_var_start,
|
||||
tw_file_start, tw_cmd_start, tw_var_start, tw_logname_start,
|
||||
tw_file_start, tw_file_start, tw_vl_start, tw_logname_start,
|
||||
tw_complete_start, tw_alias_start, tw_var_start, tw_var_start,
|
||||
tw_bind_start, tw_wl_start, tw_limit_start, tw_sig_start,
|
||||
tw_job_start, tw_file_start, tw_file_start, tw_grpname_start
|
||||
};
|
||||
|
||||
static int (*const tw_next_entry[]) (struct Strbuf *, struct Strbuf *,
|
||||
int *) = {
|
||||
tw_file_next, tw_cmd_next, tw_var_next, tw_logname_next,
|
||||
tw_file_next, tw_file_next, tw_var_next, tw_logname_next,
|
||||
tw_var_next, tw_var_next, tw_shvar_next, tw_envvar_next,
|
||||
tw_file_next, tw_cmd_next, tw_var_next, tw_logname_next,
|
||||
tw_file_next, tw_file_next, tw_var_next, tw_logname_next,
|
||||
tw_var_next, tw_var_next, tw_shvar_next, tw_envvar_next,
|
||||
tw_bind_next, tw_wl_next, tw_limit_next, tw_sig_next,
|
||||
tw_job_next, tw_file_next, tw_file_next, tw_grpname_next
|
||||
};
|
||||
|
||||
static void (*const tw_end_entry[]) (void) = {
|
||||
tw_dir_end, tw_dir_end, tw_dir_end, tw_logname_end,
|
||||
tw_dir_end, tw_dir_end, tw_dir_end, tw_logname_end,
|
||||
tw_dir_end, tw_dir_end, tw_dir_end, tw_logname_end,
|
||||
tw_dir_end, tw_dir_end, tw_dir_end, tw_dir_end,
|
||||
tw_dir_end, tw_dir_end, tw_dir_end, tw_dir_end,
|
||||
tw_dir_end, tw_dir_end, tw_dir_end, tw_grpname_end
|
||||
@ -447,7 +447,7 @@ tenematch(Char *inputline, int num_read, COMMAND command)
|
||||
int found;
|
||||
|
||||
found = cmd_expand(qline.s + wordp, &p);
|
||||
|
||||
|
||||
if (!found) {
|
||||
xfree(p);
|
||||
search_ret = 0;
|
||||
@ -527,14 +527,14 @@ t_glob(Char ***v, int cmd)
|
||||
Char **av = *v, *p;
|
||||
int fwd, i;
|
||||
|
||||
for (i = 0, fwd = 0; av[i] != NULL; i++)
|
||||
for (i = 0, fwd = 0; av[i] != NULL; i++)
|
||||
if (!executable(NULL, av[i], 0)) {
|
||||
fwd++;
|
||||
fwd++;
|
||||
p = av[i];
|
||||
av[i] = NULL;
|
||||
xfree(p);
|
||||
}
|
||||
else if (fwd)
|
||||
else if (fwd)
|
||||
av[i - fwd] = av[i];
|
||||
|
||||
if (fwd)
|
||||
@ -714,13 +714,13 @@ is_prefixmatch(Char *check, Char *template, int enhanced)
|
||||
if ((*check & TRIM) != (*template & TRIM)) {
|
||||
MCH1 = (*check & TRIM);
|
||||
MCH2 = (*template & TRIM);
|
||||
LCH1 = Isupper(MCH1) ? Tolower(MCH1) :
|
||||
LCH1 = Isupper(MCH1) ? Tolower(MCH1) :
|
||||
enhanced == 2 && MCH1 == '_' ? '-' : MCH1;
|
||||
LCH2 = Isupper(MCH2) ? Tolower(MCH2) :
|
||||
enhanced == 2 && MCH2 == '_' ? '-' : MCH2;
|
||||
if (MCH1 != MCH2 && MCH1 != LCH2 &&
|
||||
(LCH1 != MCH2 || enhanced == 2)) {
|
||||
if (enhanced && ((*check & TRIM) == '-' ||
|
||||
if (enhanced && ((*check & TRIM) == '-' ||
|
||||
(*check & TRIM) == '.' ||
|
||||
(*check & TRIM) == '_')) {
|
||||
MCH1 = MCH2 = (*check & TRIM);
|
||||
@ -814,7 +814,7 @@ starting_a_command(Char *wordstart, Char *inputline)
|
||||
* look for the characters previous to this word if we find a command
|
||||
* starting delimiter we break. if we find whitespace and another previous
|
||||
* word then we are not a command
|
||||
*
|
||||
*
|
||||
* count is our state machine: 0 looking for anything 1 found white-space
|
||||
* looking for non-ws
|
||||
*/
|
||||
@ -952,7 +952,7 @@ tw_collect_items(COMMAND command, int looking, struct Strbuf *exp_dir,
|
||||
|
||||
showdots = DOT_NONE;
|
||||
if ((ptr = varval(STRlistflags)) != STRNULL)
|
||||
while (*ptr)
|
||||
while (*ptr)
|
||||
switch (*ptr++) {
|
||||
case 'a':
|
||||
showdots = DOT_ALL;
|
||||
@ -1159,7 +1159,7 @@ tw_collect_items(COMMAND command, int looking, struct Strbuf *exp_dir,
|
||||
numitems++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (command == RECOGNIZE || command == RECOGNIZE_ALL ||
|
||||
command == RECOGNIZE_SCROLL) {
|
||||
if (ignoring && ignored(item.s)) {
|
||||
@ -1220,7 +1220,7 @@ tw_collect_items(COMMAND command, int looking, struct Strbuf *exp_dir,
|
||||
if (command == SPELL)
|
||||
return d;
|
||||
else {
|
||||
if (ignoring && numitems == 0 && nignored > 0)
|
||||
if (ignoring && numitems == 0 && nignored > 0)
|
||||
return -nignored;
|
||||
else
|
||||
return numitems;
|
||||
@ -1252,13 +1252,13 @@ tw_suffix(int looking, struct Strbuf *word, const Char *exp_dir, Char *exp_name)
|
||||
*/
|
||||
if ((vp = adrof(exp_name)) != NULL && vp->vec != NULL) {
|
||||
if ((ptr = vp->vec[0]) == NULL || *ptr == '\0' ||
|
||||
vp->vec[1] != NULL)
|
||||
vp->vec[1] != NULL)
|
||||
return ' ';
|
||||
}
|
||||
else if ((ptr = tgetenv(exp_name)) == NULL || *ptr == '\0')
|
||||
return ' ';
|
||||
|
||||
if ((dol = Strrchr(word->s, '$')) != 0 &&
|
||||
if ((dol = Strrchr(word->s, '$')) != 0 &&
|
||||
dol[1] == '{' && Strchr(dol, '}') == NULL)
|
||||
return '}';
|
||||
|
||||
@ -1544,7 +1544,7 @@ t_search(struct Strbuf *word, COMMAND command, int looking, int list_max,
|
||||
target = name;
|
||||
gpat = 0; /* Override pattern mechanism */
|
||||
}
|
||||
else if ((target = Strrchr(name, '$')) != 0 &&
|
||||
else if ((target = Strrchr(name, '$')) != 0 &&
|
||||
(target[1] != '{' || Strchr(target, '}') == NULL) &&
|
||||
(Strchr(name, '/') == NULL)) {
|
||||
target++;
|
||||
@ -1781,7 +1781,7 @@ t_search(struct Strbuf *word, COMMAND command, int looking, int list_max,
|
||||
case RECOGNIZE:
|
||||
case RECOGNIZE_ALL:
|
||||
case RECOGNIZE_SCROLL:
|
||||
if (numitems <= 0)
|
||||
if (numitems <= 0)
|
||||
break;
|
||||
|
||||
Strbuf_terminate(&exp_name);
|
||||
@ -2164,8 +2164,8 @@ print_by_column(Char *dir, Char *items[], int count, int no_file_suffix)
|
||||
|
||||
lbuffed = 0; /* turn off line buffering */
|
||||
|
||||
|
||||
across = ((val = varval(STRlistflags)) != STRNULL) &&
|
||||
|
||||
across = ((val = varval(STRlistflags)) != STRNULL) &&
|
||||
(Strchr(val, 'x') != NULL);
|
||||
|
||||
for (i = 0; i < count; i++) { /* find widest string */
|
||||
@ -2237,7 +2237,7 @@ print_by_column(Char *dir, Char *items[], int count, int no_file_suffix)
|
||||
int
|
||||
StrQcmp(const Char *str1, const Char *str2)
|
||||
{
|
||||
for (; *str1 && samecase(*str1 & TRIM) == samecase(*str2 & TRIM);
|
||||
for (; *str1 && samecase(*str1 & TRIM) == samecase(*str2 & TRIM);
|
||||
str1++, str2++)
|
||||
continue;
|
||||
/*
|
||||
|
@ -221,7 +221,7 @@ tgetstr(char *id, char **area)
|
||||
cp++;
|
||||
if (*cp != '=')
|
||||
return(NULL);
|
||||
for (ret = *area, cp++; *cp && *cp != ':' ;
|
||||
for (ret = *area, cp++; *cp && *cp != ':' ;
|
||||
(*area)++, cp++)
|
||||
switch(*cp) {
|
||||
case '^' :
|
||||
|
Loading…
Reference in New Issue
Block a user