2 * Copyright (c) 1980, 1991, 1993
3 * The Regents of the University of California. All rights reserved.
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 * 3. All advertising materials mentioning features or use of this software
14 * must display the following acknowledgement:
15 * This product includes software developed by the University of
16 * California, Berkeley and its contributors.
17 * 4. Neither the name of the University nor the names of its contributors
18 * may be used to endorse or promote products derived from this software
19 * without specific prior written permission.
21 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
22 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
25 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
36 static char sccsid[] = "@(#)func.c 8.1 (Berkeley) 5/31/93";
38 static const char rcsid[] =
39 "$Id: func.c,v 1.9 1997/08/08 00:54:03 steve Exp $";
43 #include <sys/types.h>
58 #include "pathnames.h"
60 extern char **environ;
62 static int zlast = -1;
63 static void islogin __P((void));
64 static void reexecute __P((struct command *));
65 static void preread __P((void));
66 static void doagain __P((void));
67 static void search __P((int, int, Char *));
68 static int getword __P((Char *));
69 static int keyword __P((Char *));
70 static void toend __P((void));
71 static void xecho __P((int, Char **));
72 static void Unsetenv __P((Char *));
78 Char *cp = t->t_dcom[0];
79 struct biltins *bp, *bp1, *bp2;
80 static struct biltins label = {"", dozip, 0, 0};
81 static struct biltins foregnd = {"%job", dofg1, 0, 0};
82 static struct biltins backgnd = {"%job &", dobg1, 0, 0};
84 if (lastchr(cp) == ':') {
85 label.bname = short2str(cp);
89 if (t->t_dflg & F_AMPERSAND) {
90 t->t_dflg &= ~F_AMPERSAND;
91 backgnd.bname = short2str(cp);
94 foregnd.bname = short2str(cp);
98 * Binary search Bp1 is the beginning of the current search range. Bp2 is
101 for (bp1 = bfunc, bp2 = bfunc + nbfunc; bp1 < bp2;) {
104 bp = bp1 + ((bp2 - bp1) >> 1);
105 if ((i = *cp - *bp->bname) == 0 &&
106 (i = Strcmp(cp, str2short(bp->bname))) == 0)
125 i = blklen(t->t_dcom) - 1;
127 stderror(ERR_NAME | ERR_TOOFEW);
129 stderror(ERR_NAME | ERR_TOOMANY);
130 (*bp->bfunct) (t->t_dcom, t);
142 if (parintr == SIG_IGN)
144 if (setintr && intty)
145 stderror(ERR_NAME | ERR_TERMINAL);
151 (void) sigblock(sigmask(SIGINT));
153 (void) signal(SIGINT, SIG_DFL);
156 else if (eq((vv = strip(vv)), STRminus)) {
157 (void) signal(SIGINT, SIG_IGN);
158 gointr = Strsave(STRminus);
161 gointr = Strsave(vv);
162 (void) signal(SIGINT, pintr);
173 stderror(ERR_NAME | ERR_TERMINAL);
175 (void) signal(SIGHUP, SIG_IGN);
208 vp = adrof1(strip(p), &aliases);
210 blkpr(cshout, vp->vec);
215 if (eq(p, STRalias) || eq(p, STRunalias)) {
217 stderror(ERR_NAME | ERR_DANGER);
219 set1(strip(p), saveblk(v), &aliases);
250 (void) signal(SIGTERM, parterm);
251 (void) execl(_PATH_LOGIN, "login", short2str(v[1]), NULL);
259 if (chkstop == 0 && setintr)
263 stderror(ERR_NOTLOGIN);
278 stderror(ERR_NAME | ERR_EMPTYIF);
279 if (eq(*vv, STRthen)) {
281 stderror(ERR_NAME | ERR_IMPRTHEN);
282 setname(vis_str(STRthen));
284 * If expression was zero, then scan to else, otherwise just fall into
288 search(T_IF, 0, NULL);
292 * Simple command attached to this if. Left shift the node in this tree,
293 * munging it so we can reexecute it.
296 lshift(kp->t_dcom, vv - kp->t_dcom);
303 * Reexecute a command, being careful not
304 * to redo i/o redirection, which is already set up.
310 kp->t_dflg &= F_SAVE;
311 kp->t_dflg |= F_REPEAT;
313 * If tty is still ours to arbitrate, arbitrate it; otherwise dont even set
314 * pgrp's as the jobs would then have no way to get the tty (we can't give
315 * it to them, and our parent wouldn't know their pgrp, etc.
317 execute(kp, (tpgrp > 0 ? tpgrp : -1), NULL, NULL);
326 search(T_ELSE, 0, NULL);
337 gotolab(lp = globone(v[1], G_ERROR));
347 * While we still can, locate any unknown ends of existing loops. This
348 * obscure code is the WORST result of the fact that we don't really parse.
351 for (wp = whyles; wp; wp = wp->w_next)
352 if (wp->w_end.type == F_SEEK && wp->w_end.f_seek == 0) {
353 search(T_BREAK, 0, NULL);
358 search(T_GOTO, 0, lab);
360 * Eliminate loops which were exited.
374 if (!*v || *(*v++) != '(')
375 stderror(ERR_SYNTAX);
376 cp = **v == ')' ? STRNULL : *v++;
380 stderror(ERR_SYNTAX);
381 search(T_SWITCH, 0, lp = globone(cp, G_ERROR));
394 stderror(ERR_NAME | ERR_NOTWHILE);
403 if (chkstop == 0 && (intty || intact) && evalvec == 0)
406 * Don't DEMAND parentheses here either.
410 set(STRstatus, putn(expr(&v)));
412 stderror(ERR_NAME | ERR_EXPRESSION);
431 stderror(ERR_NAME | ERR_VARBEGIN);
432 while (*cp && alnum(*cp))
435 stderror(ERR_NAME | ERR_VARALNUM);
436 if ((cp - sp) > MAXVARLEN)
437 stderror(ERR_NAME | ERR_VARTOOLONG);
439 if (v[0][0] != '(' || v[blklen(v) - 1][0] != ')')
440 stderror(ERR_NAME | ERR_NOPAREN);
445 stderror(ERR_NAME | ERR_NOMATCH);
446 nwp = (struct whyle *) xcalloc(1, sizeof *nwp);
447 nwp->w_fe = nwp->w_fe0 = v;
449 btell(&nwp->w_start);
450 nwp->w_fename = Strsave(cp);
451 nwp->w_next = whyles;
452 nwp->w_end.type = F_SEEK;
455 * Pre-read the loop so as to be more comprehensible to a terminal user.
470 bool again = whyles != 0 && SEEKEQ(&whyles->w_start, &lineloc) &&
471 whyles->w_fename == 0;
475 * Implement prereading here also, taking care not to evaluate the
476 * expression before the loop has been read up from a terminal.
479 status = !exp0(&v, 1);
483 stderror(ERR_NAME | ERR_EXPRESSION);
486 (struct whyle *) xcalloc(1, sizeof(*nwp));
488 nwp->w_start = lineloc;
489 nwp->w_end.type = F_SEEK;
490 nwp->w_end.f_seek = 0;
491 nwp->w_next = whyles;
504 /* We ain't gonna loop no more, no more! */
511 whyles->w_end.type = I_SEEK;
513 (void) sigsetmask(sigblock(0) & ~sigmask(SIGINT));
515 search(T_BREAK, 0, NULL); /* read the expression in */
517 (void) sigblock(sigmask(SIGINT));
518 btell(&whyles->w_end);
528 stderror(ERR_NAME | ERR_NOTWHILE);
529 btell(&whyles->w_end);
540 stderror(ERR_NAME | ERR_NOTWHILE);
547 /* Repeating a while is simple */
548 if (whyles->w_fename == 0) {
549 bseek(&whyles->w_start);
553 * The foreach variable list actually has a spurious word ")" at the end of
554 * the w_fe list. Thus we are at the of the list if one word beyond this
557 if (!whyles->w_fe[1]) {
561 set(whyles->w_fename, Strsave(*whyles->w_fe++));
562 bseek(&whyles->w_start);
575 omask = sigblock(sigmask(SIGINT)) & ~sigmask(SIGINT);
579 (void) sigsetmask(omask);
585 (void) sigsetmask(omask);
594 search(T_BRKSW, 0, NULL);
601 struct srch *sp, *sp1, *sp2;
605 * Binary search Sp1 is the beginning of the current search range. Sp2 is
608 for (sp1 = srchn, sp2 = srchn + nsrchn; sp1 < sp2;) {
609 sp = sp1 + ((sp2 - sp1) >> 1);
610 if ((i = *cp - *sp->s_name) == 0 &&
611 (i = Strcmp(cp, str2short(sp->s_name))) == 0)
626 search(type, level, goal)
631 Char wordbuf[BUFSIZ];
632 Char *aword = wordbuf;
637 if (type == T_GOTO) {
644 if (intty && fseekp == feobp && aret == F_SEEK)
645 (void) fprintf(cshout, "? "), (void) fflush(cshout);
647 (void) getword(aword);
648 switch (srchx(aword)) {
651 if (level == 0 && type == T_IF)
656 while (getword(aword))
658 if ((type == T_IF || type == T_ELSE) &&
664 if (type == T_IF || type == T_ELSE)
680 if (type == T_SWITCH || type == T_BRKSW)
685 if (type == T_SWITCH || type == T_BRKSW)
690 if (type == T_GOTO && getword(aword) && eq(aword, goal))
695 if (type != T_GOTO && (type != T_SWITCH || level != 0))
697 if (lastchr(aword) != ':')
699 aword[Strlen(aword) - 1] = 0;
700 if ((type == T_GOTO && eq(aword, goal)) ||
701 (type == T_SWITCH && eq(aword, STRdefault)))
706 if (type != T_SWITCH || level != 0)
708 (void) getword(aword);
709 if (lastchr(aword) == ':')
710 aword[Strlen(aword) - 1] = 0;
711 cp = strip(Dfix1(aword));
712 if (Gmatch(goal, cp))
718 if (type == T_SWITCH && level == 0)
722 (void) getword(NULL);
723 } while (level >= 0);
738 while (c == ' ' || c == '\t')
743 while (c >= 0 && c != '\n');
755 if (c == '\\' && (c = readc(1)) == '\n')
757 if (c == '\'' || c == '"')
766 *wp = 0; /* end the string b4 test */
768 } while ((d || (!(kwd = keyword(owp)) && c != ' '
769 && c != '\t')) && c != '\n');
773 * if we have read a keyword ( "if", "switch" or "while" ) then we do not
774 * need to unreadc the look-ahead char
788 stderror(ERR_NAME | ERR_NOTFOUND, "then/endif");
791 stderror(ERR_NAME | ERR_NOTFOUND, "endif");
795 stderror(ERR_NAME | ERR_NOTFOUND, "endsw");
798 stderror(ERR_NAME | ERR_NOTFOUND, "end");
801 setname(vis_str(Sgoal));
802 stderror(ERR_NAME | ERR_NOTFOUND, "label");
809 * keyword(wp) determines if wp is one of the built-n functions if,
810 * switch or while. It seems that when an if statement looks like
811 * "if(" then getword above sucks in the '(' and so the search routine
812 * never finds what it is scanning for. Rather than rewrite doword, I hack
813 * in a test to see if the string forms a keyword. Then doword stops
814 * and returns the word "if" -strike
821 static Char STRif[] = {'i', 'f', '\0'};
822 static Char STRwhile[] = {'w', 'h', 'i', 'l', 'e', '\0'};
823 static Char STRswitch[] = {'s', 'w', 'i', 't', 'c', 'h', '\0'};
828 if ((Strcmp(wp, STRif) == 0) || (Strcmp(wp, STRwhile) == 0)
829 || (Strcmp(wp, STRswitch) == 0))
838 if (whyles->w_end.type == F_SEEK && whyles->w_end.f_seek == 0) {
839 search(T_BREAK, 0, NULL);
840 btell(&whyles->w_end);
841 whyles->w_end.f_seek--;
844 bseek(&whyles->w_end);
856 for (; whyles; whyles = nwp) {
857 struct whyle *wp = whyles;
861 * We free loops that have different seek types.
863 if (wp->w_end.type != I_SEEK && wp->w_start.type == wp->w_end.type &&
864 wp->w_start.type == o.type) {
865 if (wp->w_end.type == F_SEEK) {
866 if (o.f_seek >= wp->w_start.f_seek &&
867 (wp->w_end.f_seek == 0 || o.f_seek < wp->w_end.f_seek))
871 if (o.a_seek >= wp->w_start.a_seek &&
872 (wp->w_end.a_seek == 0 || o.a_seek < wp->w_end.a_seek))
880 xfree((ptr_t) wp->w_fename);
901 (void) fflush(cshout);
913 (void) sigsetmask(sigblock(0) & ~sigmask(SIGINT));
921 stderror(ERR_NAME | ERR_NOMATCH);
924 v = gargv = saveblk(v);
927 if (sep == ' ' && *v && eq(*v, STRmn))
929 while ((cp = *v++) != NULL) {
932 while ((c = *cp++) != '\0')
933 (void) vis_fputc(c | QUOTE, cshout);
936 (void) vis_fputc(sep | QUOTE, cshout);
938 if (sep && nonl == 0)
939 (void) fputc('\n', cshout);
941 (void) fflush(cshout);
943 (void) sigblock(sigmask(SIGINT));
945 blkfree(gargv), gargv = 0;
957 if ((vp = *v++) == 0) {
961 (void) sigsetmask(sigblock(0) & ~sigmask(SIGINT));
962 for (ep = STR_environ; *ep; ep++)
963 (void) fprintf(cshout, "%s\n", vis_str(*ep));
966 if ((lp = *v++) == 0)
968 Setenv(vp, lp = globone(lp, G_APPEND));
969 if (eq(vp, STRPATH)) {
973 else if (eq(vp, STRLANG) || eq(vp, STRLC_CTYPE) ||
974 eq(vp, STRLC_ALL) || eq(vp, STRLC_COLLATE)) {
978 (void) setlocale(LC_ALL, "");
979 for (k = 0200; k <= 0377 && !Isprint(k); k++)
981 AsciiOnly = k > 0377;
997 static Char *name = NULL;
1000 xfree((ptr_t) name);
1002 * Find the longest environment variable
1004 for (maxi = 0, ep = STR_environ; *ep; ep++) {
1005 for (i = 0, p = *ep; *p && *p != '='; p++, i++)
1011 name = (Char *) xmalloc((size_t) (maxi + 1) * sizeof(Char));
1014 for (maxi = 1; maxi;)
1015 for (maxi = 0, ep = STR_environ; *ep; ep++) {
1016 for (n = name, p = *ep; *p && *p != '='; *n++ = *p++)
1019 if (!Gmatch(name, *v))
1023 * Delete name, and start again cause the environment changes
1026 if (eq(name, STRLANG) || eq(name, STRLC_CTYPE) ||
1027 eq(name, STRLC_ALL) || eq(name, STRLC_COLLATE)) {
1031 (void) setlocale(LC_ALL, "");
1032 for (k = 0200; k <= 0377 && !Isprint(k); k++)
1034 AsciiOnly = k > 0377;
1036 AsciiOnly = getenv("LANG") == NULL &&
1037 getenv("LC_ALL") == NULL &&
1038 getenv("LC_CTYPE") == NULL;
1043 xfree((ptr_t) name);
1051 Char **ep = STR_environ;
1058 for (cp = name, dp = *ep; *cp && *cp == *dp; cp++, dp++)
1060 if (*cp != 0 || *dp != '=')
1062 cp = Strspl(STRequal, val);
1063 xfree((ptr_t) * ep);
1064 *ep = strip(Strspl(name, cp));
1066 blkfree((Char **) environ);
1067 environ = short2blk(STR_environ);
1070 cp = Strspl(name, STRequal);
1071 blk[0] = strip(Strspl(cp, val));
1074 STR_environ = blkspl(STR_environ, blk);
1075 blkfree((Char **) environ);
1076 environ = short2blk(STR_environ);
1084 Char **ep = STR_environ;
1089 for (cp = name, dp = *ep; *cp && *cp == *dp; cp++, dp++)
1091 if (*cp != 0 || *dp != '=')
1095 STR_environ = blkspl(STR_environ, ep + 1);
1096 environ = short2blk(STR_environ);
1116 (void) fprintf(cshout, "%o\n", i);
1120 while (Isdigit(*cp) && *cp != '8' && *cp != '9')
1121 i = i * 8 + *cp++ - '0';
1122 if (*cp || i < 0 || i > 0777)
1123 stderror(ERR_NAME | ERR_MASK);
1127 typedef quad_t RLIM_TYPE;
1129 static struct limits {
1135 { RLIMIT_CPU, "cputime", 1, "seconds" },
1136 { RLIMIT_FSIZE, "filesize", 1024, "kbytes" },
1137 { RLIMIT_DATA, "datasize", 1024, "kbytes" },
1138 { RLIMIT_STACK, "stacksize", 1024, "kbytes" },
1139 { RLIMIT_CORE, "coredumpsize", 1024, "kbytes" },
1140 { RLIMIT_RSS, "memoryuse", 1024, "kbytes" },
1141 { RLIMIT_MEMLOCK, "memorylocked", 1024, "kbytes" },
1142 { RLIMIT_NPROC, "maxproc", 1, "" },
1143 { RLIMIT_NOFILE, "openfiles", 1, "" },
1144 { -1, NULL, 0, NULL }
1147 static struct limits *findlim();
1148 static RLIM_TYPE getval();
1149 static void limtail();
1151 static int setlim();
1153 static struct limits *
1157 struct limits *lp, *res;
1159 res = (struct limits *) NULL;
1160 for (lp = limits; lp->limconst >= 0; lp++)
1161 if (prefix(cp, str2short(lp->limname))) {
1163 stderror(ERR_NAME | ERR_AMBIG);
1168 stderror(ERR_NAME | ERR_LIMIT);
1184 if (*v && eq(*v, STRmh)) {
1189 for (lp = limits; lp->limconst >= 0; lp++)
1198 limit = getval(lp, v + 1);
1199 if (setlim(lp, hard, limit) < 0)
1200 stderror(ERR_SILENT);
1211 f = atof(short2str(cp));
1213 while (Isdigit(*cp) || *cp == '.' || *cp == 'e' || *cp == 'E')
1217 return ((RLIM_TYPE) ((f + 0.5) * lp->limdiv));
1222 if (lp->limconst != RLIMIT_CPU)
1224 return ((RLIM_TYPE) (f * 60.0 + atof(short2str(cp + 1))));
1226 if (lp->limconst != RLIMIT_CPU)
1228 limtail(cp, "hours");
1232 if (lp->limconst == RLIMIT_CPU) {
1233 limtail(cp, "minutes");
1238 limtail(cp, "megabytes");
1239 f *= 1024.0 * 1024.0;
1242 if (lp->limconst != RLIMIT_CPU)
1244 limtail(cp, "seconds");
1247 if (lp->limconst == RLIMIT_CPU)
1250 limtail(cp, "megabytes");
1251 f *= 1024.0 * 1024.0;
1254 if (lp->limconst == RLIMIT_CPU)
1256 limtail(cp, "kbytes");
1260 limtail(cp, "unlimited");
1261 return (RLIM_INFINITY);
1264 stderror(ERR_NAME | ERR_SCALEF);
1267 if (f > (float) RLIM_INFINITY)
1268 return RLIM_INFINITY;
1270 return ((RLIM_TYPE) f);
1278 while (*cp && *cp == *str)
1281 stderror(ERR_BADSCALE, str);
1294 (void) fprintf(cshout, "%s \t", lp->limname);
1296 (void) getrlimit(lp->limconst, &rlim);
1297 limit = hard ? rlim.rlim_max : rlim.rlim_cur;
1299 if (limit == RLIM_INFINITY)
1300 (void) fprintf(cshout, "unlimited");
1301 else if (lp->limconst == RLIMIT_CPU)
1302 psecs((long) limit);
1304 (void) fprintf(cshout, "%ld %s", (long) (limit / lp->limdiv),
1306 (void) fputc('\n', cshout);
1320 if (*v && eq(*v, STRmh)) {
1325 for (lp = limits; lp->limconst >= 0; lp++)
1326 if (setlim(lp, hard, (RLIM_TYPE) RLIM_INFINITY) < 0)
1329 stderror(ERR_SILENT);
1334 if (setlim(lp, hard, (RLIM_TYPE) RLIM_INFINITY) < 0)
1335 stderror(ERR_SILENT);
1340 setlim(lp, hard, limit)
1347 (void) getrlimit(lp->limconst, &rlim);
1350 rlim.rlim_max = limit;
1351 else if (limit == RLIM_INFINITY && geteuid() != 0)
1352 rlim.rlim_cur = rlim.rlim_max;
1354 rlim.rlim_cur = limit;
1356 if (setrlimit(lp->limconst, &rlim) < 0) {
1357 (void) fprintf(csherr, "%s: %s: Can't %s%s limit\n", bname, lp->limname,
1358 limit == RLIM_INFINITY ? "remove" : "set",
1359 hard ? " hard" : "");
1373 void (*old) __P((int));
1376 stderror(ERR_SUSPLOG);
1379 old = signal(SIGTSTP, SIG_DFL);
1380 (void) kill(0, SIGTSTP);
1381 /* the shell stops here */
1382 (void) signal(SIGTSTP, old);
1385 ctpgrp = tcgetpgrp(FSHTTY);
1386 while (ctpgrp != opgrp) {
1387 old = signal(SIGTTIN, SIG_DFL);
1388 (void) kill(0, SIGTTIN);
1389 (void) signal(SIGTTIN, old);
1391 (void) setpgid(0, shpgrp);
1392 (void) tcsetpgrp(FSHTTY, shpgrp);
1396 /* This is the dreaded EVAL built-in.
1397 * If you don't fiddle with file descriptors, and reset didfds,
1398 * this command will either ignore redirection inside or outside
1399 * its aguments, e.g. eval "date >x" vs. eval "date" >x
1400 * The stuff here seems to work, but I did it by trial and error rather
1401 * than really knowing what was going on. If tpgrp is zero, we are
1402 * probably a background eval, e.g. "eval date &", and we want to
1403 * make sure that any processes we start stay in our pgrp.
1404 * This is also the case for "time eval date" -- stay in same pgrp.
1405 * Otherwise, under stty tostop, processes will stop in the wrong
1406 * pgrp, with no way for the shell to get them going again. -IAN!
1408 static Char **gv = NULL;
1440 gflag = 0, tglob(v);
1442 gv = v = globall(v);
1445 stderror(ERR_NOMATCH);
1454 saveIN = dcopy(SHIN, -1);
1455 saveOUT = dcopy(SHOUT, -1);
1456 saveERR = dcopy(SHERR, -1);
1460 if ((my_reenter = setexit()) == 0) {
1463 SHIN = dcopy(0, -1);
1464 SHOUT = dcopy(1, -1);
1465 SHERR = dcopy(2, -1);
1475 (void) close(SHOUT);
1476 (void) close(SHERR);
1477 SHIN = dmove(saveIN, oSHIN);
1478 SHOUT = dmove(saveOUT, oSHOUT);
1479 SHERR = dmove(saveERR, oSHERR);
1481 blkfree(gv), gv = NULL;
1485 stderror(ERR_SILENT);
1495 extern int progprintf __P((int, char **));
1498 ret = progprintf(blklen(v), c = short2blk(v));
1499 (void) fflush(cshout);
1500 (void) fflush(csherr);
1502 blkfree((Char **) c);
1504 stderror(ERR_SILENT);