diff options
author | ache <ache@FreeBSD.org> | 2000-11-30 21:05:33 +0000 |
---|---|---|
committer | ache <ache@FreeBSD.org> | 2000-11-30 21:05:33 +0000 |
commit | 5e7fc01bd9bf3444f2d8b21ab1c56c1f2d599068 (patch) | |
tree | a212ee10b5214f5c4302ff44d44c2542d83cf7b6 /contrib/tcsh/sh.func.c | |
parent | d7d472004aa5fe13bc67f9aa639952d978d342e9 (diff) | |
download | FreeBSD-src-5e7fc01bd9bf3444f2d8b21ab1c56c1f2d599068.zip FreeBSD-src-5e7fc01bd9bf3444f2d8b21ab1c56c1f2d599068.tar.gz |
Initial import of slightly trimmed tcsh 6.10
Diffstat (limited to 'contrib/tcsh/sh.func.c')
-rw-r--r-- | contrib/tcsh/sh.func.c | 83 |
1 files changed, 40 insertions, 43 deletions
diff --git a/contrib/tcsh/sh.func.c b/contrib/tcsh/sh.func.c index fb8c898..b26ea8e 100644 --- a/contrib/tcsh/sh.func.c +++ b/contrib/tcsh/sh.func.c @@ -1,4 +1,4 @@ -/* $Header: /src/pub/tcsh/sh.func.c,v 3.87 2000/06/09 19:43:43 kim Exp $ */ +/* $Header: /src/pub/tcsh/sh.func.c,v 3.91 2000/11/11 23:03:36 christos Exp $ */ /* * sh.func.c: csh builtin functions */ @@ -36,14 +36,14 @@ */ #include "sh.h" -RCSID("$Id: sh.func.c,v 3.87 2000/06/09 19:43:43 kim Exp $") +RCSID("$Id: sh.func.c,v 3.91 2000/11/11 23:03:36 christos Exp $") #include "ed.h" #include "tw.h" #include "tc.h" -#ifdef WINNT +#ifdef WINNT_NATIVE #include "nt.const.h" -#endif /* WINNT */ +#endif /* WINNT_NATIVE */ /* * C shell @@ -126,9 +126,9 @@ isbfunc(t) else bp1 = bp + 1; } -#ifdef WINNT +#ifdef WINNT_NATIVE return nt_check_additional_builtins(cp); -#endif /*WINNT*/ +#endif /*WINNT_NATIVE*/ return (0); } @@ -347,9 +347,9 @@ dologin(v, c) struct command *c; { USE(c); -#ifdef WINNT +#ifdef WINNT_NATIVE USE(v); -#else /* !WINNT */ +#else /* !WINNT_NATIVE */ islogin(); rechist(NULL, adrof(STRsavehist) != NULL); (void) signal(SIGTERM, parterm); @@ -357,7 +357,7 @@ dologin(v, c) (void) execl(_PATH_USRBIN_LOGIN, "login", short2str(v[1]), NULL); untty(); xexit(1); -#endif /* !WINNT */ +#endif /* !WINNT_NATIVE */ } @@ -484,7 +484,7 @@ gotolab(lab) */ zlast = TC_GOTO; for (wp = whyles; wp; wp = wp->w_next) - if (wp->w_end.type == F_SEEK && wp->w_end.f_seek == 0) { + if (wp->w_end.type == TCSH_F_SEEK && wp->w_end.f_seek == 0) { search(TC_BREAK, 0, NULL); btell(&wp->w_end); } @@ -600,7 +600,7 @@ doforeach(v, c) btell(&nwp->w_start); nwp->w_fename = Strsave(cp); nwp->w_next = whyles; - nwp->w_end.type = F_SEEK; + nwp->w_end.type = TCSH_F_SEEK; whyles = nwp; /* * Pre-read the loop so as to be more comprehensible to a terminal user. @@ -639,7 +639,7 @@ dowhile(v, c) (struct whyle *) xcalloc(1, sizeof(*nwp)); nwp->w_start = lineloc; - nwp->w_end.type = F_SEEK; + nwp->w_end.type = TCSH_F_SEEK; nwp->w_end.f_seek = 0; nwp->w_next = whyles; whyles = nwp; @@ -661,7 +661,7 @@ dowhile(v, c) static void preread() { - whyles->w_end.type = I_SEEK; + whyles->w_end.type = TCSH_I_SEEK; if (setintr) #ifdef BSDSIGS (void) sigsetmask(sigblock((sigmask_t) 0) & ~sigmask(SIGINT)); @@ -836,12 +836,12 @@ search(type, level, goal) Sgoal = goal; if (type == TC_GOTO) { struct Ain a; - a.type = F_SEEK; + a.type = TCSH_F_SEEK; a.f_seek = 0; bseek(&a); } do { - if (intty && fseekp == feobp && aret == F_SEEK) + if (intty && fseekp == feobp && aret == TCSH_F_SEEK) printprompt(1, isrchx(type == TC_BREAK ? zlast : type)); /* xprintf("? "), flush(); */ aword[0] = 0; @@ -1020,7 +1020,7 @@ past: static void toend() { - if (whyles->w_end.type == F_SEEK && whyles->w_end.f_seek == 0) { + if (whyles->w_end.type == TCSH_F_SEEK && whyles->w_end.f_seek == 0) { search(TC_BREAK, 0, NULL); btell(&whyles->w_end); whyles->w_end.f_seek--; @@ -1066,9 +1066,9 @@ wfree() /* * XXX: We free loops that have different seek types. */ - if (wp->w_end.type != I_SEEK && wp->w_start.type == wp->w_end.type && + 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 == F_SEEK) { + if (wp->w_end.type == TCSH_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; @@ -1390,18 +1390,13 @@ dosetenv(v, c) xfree((ptr_t) lp); return; } -#ifdef WINNT +#ifdef WINNT_NATIVE if (eq(vp, STRtcshlang)) { nlsinit(); xfree((ptr_t) lp); return; } - if (eq(vp, STRtcshonlystartexes)) { - __nt_only_start_exes = 1; - xfree((ptr_t) lp); - return; - } -#endif /* WINNT */ +#endif /* WINNT_NATIVE */ if (eq(vp, STRKTERM)) { char *t; set(STRterm, quote(lp), VAR_READWRITE); /* lp memory used here */ @@ -1571,15 +1566,12 @@ dounsetenv(v, c) ed_InitNLSMaps(); } -#ifdef WINNT +#ifdef WINNT_NATIVE else if (eq(name,(STRtcshlang))) { nls_dll_unload(); nlsinit(); } - else if (eq(name,(STRtcshonlystartexes))) { - __nt_only_start_exes = 0; - } -#endif /* WINNT */ +#endif /* WINNT_NATIVE */ #ifdef COLOR_LS_F else if (eq(name, STRLS_COLORS)) parseLS_COLORS(n); @@ -1617,16 +1609,16 @@ tsetenv(name, val) Char *blk[2]; Char **oep = ep; -#ifdef WINNT +#ifdef WINNT_NATIVE nt_set_env(name,val); -#endif /* WINNT */ +#endif /* WINNT_NATIVE */ for (; *ep; ep++) { -#ifdef WINNT +#ifdef WINNT_NATIVE for (cp = name, dp = *ep; *cp && Tolower(*cp & TRIM) == Tolower(*dp); cp++, dp++) #else for (cp = name, dp = *ep; *cp && (*cp & TRIM) == *dp; cp++, dp++) -#endif /* WINNT */ +#endif /* WINNT_NATIVE */ continue; if (*cp != 0 || *dp != '=') continue; @@ -1657,9 +1649,9 @@ Unsetenv(name) register Char *cp, *dp; Char **oep = ep; -#ifdef WINNT +#ifdef WINNT_NATIVE nt_set_env(name,NULL); -#endif /*WINNT */ +#endif /*WINNT_NATIVE */ for (; *ep; ep++) { for (cp = name, dp = *ep; *cp && *cp == *dp; cp++, dp++) continue; @@ -1938,7 +1930,7 @@ getval(lp, v) cp++; if (*cp == 0) { if (*v == 0) - return f == 0.0 ? (RLIM_TYPE) 0 : restrict_limit((f + 0.5) * lp->limdiv); + return restrict_limit((f * lp->limdiv) + 0.5); cp = *v; } switch (*cp) { @@ -2375,13 +2367,13 @@ struct command *c; xputchar('\n'); } } -#ifdef WINNT +#ifdef WINNT_NATIVE nt_print_builtins(maxwidth); #else if (Tty_raw_mode) xputchar('\r'); xputchar('\n'); -#endif /* WINNT */ +#endif /* WINNT_NATIVE */ lbuffed = 1; /* turn back on line buffering */ flush(); @@ -2391,11 +2383,16 @@ void nlsinit() { #ifdef NLS_CATALOGS - catd = catopen("tcsh", MCLoadBySet); -#endif -#ifdef WINNT + char catalog[ 256 ] = { 't', 'c', 's', 'h', '\0' }; + + if (adrof(STRcatalog) != NULL) + xsnprintf((char *)catalog, sizeof(catalog), "tcsh.%s", + short2str(varval(STRcatalog))); + catd = catopen(catalog, MCLoadBySet); +#endif /* NLS_CATALOGS */ +#ifdef WINNT_NATIVE nls_dll_init(); -#endif /* WINNT */ +#endif /* WINNT_NATIVE */ errinit(); /* init the errorlist in correct locale */ mesginit(); /* init the messages for signals */ dateinit(); /* init the messages for dates */ |