diff options
| author | Bernhard Reutner-Fischer <rep.dot.nop@gmail.com> | 2006-06-25 22:08:53 +0000 |
|---|---|---|
| committer | Bernhard Reutner-Fischer <rep.dot.nop@gmail.com> | 2006-06-25 22:08:53 +0000 |
| commit | f087798e8bf5857b679c369601426ca29334caee (patch) | |
| tree | e5f71b53c9af54ca4db5ca7aca9a7ab99a9d3934 /shell | |
| parent | a892bf82840423f680bba65c0e679657b0dd347f (diff) | |
| download | busybox-w32-f087798e8bf5857b679c369601426ca29334caee.tar.gz busybox-w32-f087798e8bf5857b679c369601426ca29334caee.tar.bz2 busybox-w32-f087798e8bf5857b679c369601426ca29334caee.zip | |
- convert old-style parameter declarations (K&R) to modern style.
Diffstat (limited to 'shell')
| -rw-r--r-- | shell/ash.c | 5 | ||||
| -rw-r--r-- | shell/msh.c | 461 |
2 files changed, 153 insertions, 313 deletions
diff --git a/shell/ash.c b/shell/ash.c index 35d58b5d7..c2e70a535 100644 --- a/shell/ash.c +++ b/shell/ash.c | |||
| @@ -9026,8 +9026,7 @@ setcmd(int argc, char **argv) | |||
| 9026 | 9026 | ||
| 9027 | #ifdef CONFIG_ASH_GETOPTS | 9027 | #ifdef CONFIG_ASH_GETOPTS |
| 9028 | static void | 9028 | static void |
| 9029 | getoptsreset(value) | 9029 | getoptsreset(const char *value) |
| 9030 | const char *value; | ||
| 9031 | { | 9030 | { |
| 9032 | shellparam.optind = number(value); | 9031 | shellparam.optind = number(value); |
| 9033 | shellparam.optoff = -1; | 9032 | shellparam.optoff = -1; |
| @@ -9994,7 +9993,7 @@ static const char xxreadtoken_tokens[] = { | |||
| 9994 | #define xxreadtoken_singles \ | 9993 | #define xxreadtoken_singles \ |
| 9995 | (sizeof(xxreadtoken_chars) - xxreadtoken_doubles - 1) | 9994 | (sizeof(xxreadtoken_chars) - xxreadtoken_doubles - 1) |
| 9996 | 9995 | ||
| 9997 | static int xxreadtoken() | 9996 | static int xxreadtoken(void) |
| 9998 | { | 9997 | { |
| 9999 | int c; | 9998 | int c; |
| 10000 | 9999 | ||
diff --git a/shell/msh.c b/shell/msh.c index 2c0184392..a2d3864a3 100644 --- a/shell/msh.c +++ b/shell/msh.c | |||
| @@ -308,7 +308,7 @@ static struct var *lookup(char *n); | |||
| 308 | static int rlookup(char *n); | 308 | static int rlookup(char *n); |
| 309 | static struct wdblock *glob(char *cp, struct wdblock *wb); | 309 | static struct wdblock *glob(char *cp, struct wdblock *wb); |
| 310 | static int my_getc(int ec); | 310 | static int my_getc(int ec); |
| 311 | static int subgetc(int ec, int quoted); | 311 | static int subgetc(char ec, int quoted); |
| 312 | static char **makenv(int all, struct wdblock *wb); | 312 | static char **makenv(int all, struct wdblock *wb); |
| 313 | static char **eval(char **ap, int f); | 313 | static char **eval(char **ap, int f); |
| 314 | static int setstatus(int s); | 314 | static int setstatus(int s); |
| @@ -522,7 +522,7 @@ static int run(struct ioarg *argp, int (*f) (struct ioarg *)); | |||
| 522 | static int eofc(void); | 522 | static int eofc(void); |
| 523 | static int readc(void); | 523 | static int readc(void); |
| 524 | static void unget(int c); | 524 | static void unget(int c); |
| 525 | static void ioecho(int c); | 525 | static void ioecho(char c); |
| 526 | static void prs(const char *s); | 526 | static void prs(const char *s); |
| 527 | static void prn(unsigned u); | 527 | static void prn(unsigned u); |
| 528 | static void closef(int i); | 528 | static void closef(int i); |
| @@ -1020,7 +1020,7 @@ int msh_main(int argc, char **argv) | |||
| 1020 | DBGPRINTF(("MSH_MAIN: returning.\n")); | 1020 | DBGPRINTF(("MSH_MAIN: returning.\n")); |
| 1021 | } | 1021 | } |
| 1022 | 1022 | ||
| 1023 | static void setdash() | 1023 | static void setdash(void) |
| 1024 | { | 1024 | { |
| 1025 | REGISTER char *cp; | 1025 | REGISTER char *cp; |
| 1026 | REGISTER int c; | 1026 | REGISTER int c; |
| @@ -1034,8 +1034,7 @@ static void setdash() | |||
| 1034 | setval(lookup("-"), m); | 1034 | setval(lookup("-"), m); |
| 1035 | } | 1035 | } |
| 1036 | 1036 | ||
| 1037 | static int newfile(s) | 1037 | static int newfile(REGISTER char *s) |
| 1038 | REGISTER char *s; | ||
| 1039 | { | 1038 | { |
| 1040 | REGISTER int f; | 1039 | REGISTER int f; |
| 1041 | 1040 | ||
| @@ -1057,8 +1056,7 @@ REGISTER char *s; | |||
| 1057 | } | 1056 | } |
| 1058 | 1057 | ||
| 1059 | 1058 | ||
| 1060 | struct op *scantree(head) | 1059 | struct op *scantree(struct op *head) |
| 1061 | struct op *head; | ||
| 1062 | { | 1060 | { |
| 1063 | struct op *dotnode; | 1061 | struct op *dotnode; |
| 1064 | 1062 | ||
| @@ -1091,7 +1089,7 @@ struct op *head; | |||
| 1091 | } | 1089 | } |
| 1092 | 1090 | ||
| 1093 | 1091 | ||
| 1094 | static void onecommand() | 1092 | static void onecommand(void) |
| 1095 | { | 1093 | { |
| 1096 | REGISTER int i; | 1094 | REGISTER int i; |
| 1097 | jmp_buf m1; | 1095 | jmp_buf m1; |
| @@ -1152,13 +1150,13 @@ static void onecommand() | |||
| 1152 | } | 1150 | } |
| 1153 | } | 1151 | } |
| 1154 | 1152 | ||
| 1155 | static void fail() | 1153 | static void fail(void) |
| 1156 | { | 1154 | { |
| 1157 | longjmp(failpt, 1); | 1155 | longjmp(failpt, 1); |
| 1158 | /* NOTREACHED */ | 1156 | /* NOTREACHED */ |
| 1159 | } | 1157 | } |
| 1160 | 1158 | ||
| 1161 | static void leave() | 1159 | static void leave(void) |
| 1162 | { | 1160 | { |
| 1163 | DBGPRINTF(("LEAVE: leave called!\n")); | 1161 | DBGPRINTF(("LEAVE: leave called!\n")); |
| 1164 | 1162 | ||
| @@ -1171,8 +1169,7 @@ static void leave() | |||
| 1171 | /* NOTREACHED */ | 1169 | /* NOTREACHED */ |
| 1172 | } | 1170 | } |
| 1173 | 1171 | ||
| 1174 | static void warn(s) | 1172 | static void warn(REGISTER char *s) |
| 1175 | REGISTER char *s; | ||
| 1176 | { | 1173 | { |
| 1177 | if (*s) { | 1174 | if (*s) { |
| 1178 | prs(s); | 1175 | prs(s); |
| @@ -1183,8 +1180,7 @@ REGISTER char *s; | |||
| 1183 | leave(); | 1180 | leave(); |
| 1184 | } | 1181 | } |
| 1185 | 1182 | ||
| 1186 | static void err(s) | 1183 | static void err(char *s) |
| 1187 | char *s; | ||
| 1188 | { | 1184 | { |
| 1189 | warn(s); | 1185 | warn(s); |
| 1190 | if (flag['n']) | 1186 | if (flag['n']) |
| @@ -1197,8 +1193,7 @@ char *s; | |||
| 1197 | e.iop = e.iobase = iostack; | 1193 | e.iop = e.iobase = iostack; |
| 1198 | } | 1194 | } |
| 1199 | 1195 | ||
| 1200 | static int newenv(f) | 1196 | static int newenv(int f) |
| 1201 | int f; | ||
| 1202 | { | 1197 | { |
| 1203 | REGISTER struct env *ep; | 1198 | REGISTER struct env *ep; |
| 1204 | 1199 | ||
| @@ -1222,7 +1217,7 @@ int f; | |||
| 1222 | return (0); | 1217 | return (0); |
| 1223 | } | 1218 | } |
| 1224 | 1219 | ||
| 1225 | static void quitenv() | 1220 | static void quitenv(void) |
| 1226 | { | 1221 | { |
| 1227 | REGISTER struct env *ep; | 1222 | REGISTER struct env *ep; |
| 1228 | REGISTER int fd; | 1223 | REGISTER int fd; |
| @@ -1242,8 +1237,7 @@ static void quitenv() | |||
| 1242 | /* | 1237 | /* |
| 1243 | * Is any character from s1 in s2? | 1238 | * Is any character from s1 in s2? |
| 1244 | */ | 1239 | */ |
| 1245 | static int anys(s1, s2) | 1240 | static int anys(REGISTER char *s1, REGISTER char *s2) |
| 1246 | REGISTER char *s1, *s2; | ||
| 1247 | { | 1241 | { |
| 1248 | while (*s1) | 1242 | while (*s1) |
| 1249 | if (any(*s1++, s2)) | 1243 | if (any(*s1++, s2)) |
| @@ -1254,9 +1248,7 @@ REGISTER char *s1, *s2; | |||
| 1254 | /* | 1248 | /* |
| 1255 | * Is character c in s? | 1249 | * Is character c in s? |
| 1256 | */ | 1250 | */ |
| 1257 | static int any(c, s) | 1251 | static int any(REGISTER int c, REGISTER char *s) |
| 1258 | REGISTER int c; | ||
| 1259 | REGISTER char *s; | ||
| 1260 | { | 1252 | { |
| 1261 | while (*s) | 1253 | while (*s) |
| 1262 | if (*s++ == c) | 1254 | if (*s++ == c) |
| @@ -1264,14 +1256,12 @@ REGISTER char *s; | |||
| 1264 | return (0); | 1256 | return (0); |
| 1265 | } | 1257 | } |
| 1266 | 1258 | ||
| 1267 | static char *putn(n) | 1259 | static char *putn(REGISTER int n) |
| 1268 | REGISTER int n; | ||
| 1269 | { | 1260 | { |
| 1270 | return (itoa(n)); | 1261 | return (itoa(n)); |
| 1271 | } | 1262 | } |
| 1272 | 1263 | ||
| 1273 | static char *itoa(n) | 1264 | static char *itoa(REGISTER int n) |
| 1274 | REGISTER int n; | ||
| 1275 | { | 1265 | { |
| 1276 | static char s[20]; | 1266 | static char s[20]; |
| 1277 | 1267 | ||
| @@ -1285,8 +1275,7 @@ static void next(int f) | |||
| 1285 | PUSHIO(afile, f, filechar); | 1275 | PUSHIO(afile, f, filechar); |
| 1286 | } | 1276 | } |
| 1287 | 1277 | ||
| 1288 | static void onintr(s) | 1278 | static void onintr(int s) /* ANSI C requires a parameter */ |
| 1289 | int s; /* ANSI C requires a parameter */ | ||
| 1290 | { | 1279 | { |
| 1291 | signal(SIGINT, onintr); | 1280 | signal(SIGINT, onintr); |
| 1292 | intr = 1; | 1281 | intr = 1; |
| @@ -1301,8 +1290,7 @@ int s; /* ANSI C requires a parameter */ | |||
| 1301 | } | 1290 | } |
| 1302 | } | 1291 | } |
| 1303 | 1292 | ||
| 1304 | static char *space(n) | 1293 | static char *space(int n) |
| 1305 | int n; | ||
| 1306 | { | 1294 | { |
| 1307 | REGISTER char *cp; | 1295 | REGISTER char *cp; |
| 1308 | 1296 | ||
| @@ -1311,9 +1299,7 @@ int n; | |||
| 1311 | return (cp); | 1299 | return (cp); |
| 1312 | } | 1300 | } |
| 1313 | 1301 | ||
| 1314 | static char *strsave(s, a) | 1302 | static char *strsave(REGISTER char *s, int a) |
| 1315 | REGISTER char *s; | ||
| 1316 | int a; | ||
| 1317 | { | 1303 | { |
| 1318 | REGISTER char *cp, *xp; | 1304 | REGISTER char *cp, *xp; |
| 1319 | 1305 | ||
| @@ -1328,15 +1314,13 @@ int a; | |||
| 1328 | /* | 1314 | /* |
| 1329 | * trap handling | 1315 | * trap handling |
| 1330 | */ | 1316 | */ |
| 1331 | static void sig(i) | 1317 | static void sig(REGISTER int i) |
| 1332 | REGISTER int i; | ||
| 1333 | { | 1318 | { |
| 1334 | trapset = i; | 1319 | trapset = i; |
| 1335 | signal(i, sig); | 1320 | signal(i, sig); |
| 1336 | } | 1321 | } |
| 1337 | 1322 | ||
| 1338 | static void runtrap(i) | 1323 | static void runtrap(int i) |
| 1339 | int i; | ||
| 1340 | { | 1324 | { |
| 1341 | char *trapstr; | 1325 | char *trapstr; |
| 1342 | 1326 | ||
| @@ -1357,8 +1341,7 @@ int i; | |||
| 1357 | * not previously there, enter it now and | 1341 | * not previously there, enter it now and |
| 1358 | * return a null value. | 1342 | * return a null value. |
| 1359 | */ | 1343 | */ |
| 1360 | static struct var *lookup(n) | 1344 | static struct var *lookup(REGISTER char *n) |
| 1361 | REGISTER char *n; | ||
| 1362 | { | 1345 | { |
| 1363 | REGISTER struct var *vp; | 1346 | REGISTER struct var *vp; |
| 1364 | REGISTER char *cp; | 1347 | REGISTER char *cp; |
| @@ -1398,9 +1381,7 @@ REGISTER char *n; | |||
| 1398 | /* | 1381 | /* |
| 1399 | * give variable at `vp' the value `val'. | 1382 | * give variable at `vp' the value `val'. |
| 1400 | */ | 1383 | */ |
| 1401 | static void setval(vp, val) | 1384 | static void setval(struct var *vp, char *val) |
| 1402 | struct var *vp; | ||
| 1403 | char *val; | ||
| 1404 | { | 1385 | { |
| 1405 | nameval(vp, val, (char *) NULL); | 1386 | nameval(vp, val, (char *) NULL); |
| 1406 | } | 1387 | } |
| @@ -1412,9 +1393,7 @@ char *val; | |||
| 1412 | * this is all so that exporting | 1393 | * this is all so that exporting |
| 1413 | * values is reasonably painless. | 1394 | * values is reasonably painless. |
| 1414 | */ | 1395 | */ |
| 1415 | static void nameval(vp, val, name) | 1396 | static void nameval(REGISTER struct var *vp, char *val, char *name) |
| 1416 | REGISTER struct var *vp; | ||
| 1417 | char *val, *name; | ||
| 1418 | { | 1397 | { |
| 1419 | REGISTER char *cp, *xp; | 1398 | REGISTER char *cp, *xp; |
| 1420 | char *nv; | 1399 | char *nv; |
| @@ -1449,21 +1428,18 @@ char *val, *name; | |||
| 1449 | vp->status |= fl; | 1428 | vp->status |= fl; |
| 1450 | } | 1429 | } |
| 1451 | 1430 | ||
| 1452 | static void export(vp) | 1431 | static void export(struct var *vp) |
| 1453 | struct var *vp; | ||
| 1454 | { | 1432 | { |
| 1455 | vp->status |= EXPORT; | 1433 | vp->status |= EXPORT; |
| 1456 | } | 1434 | } |
| 1457 | 1435 | ||
| 1458 | static void ronly(vp) | 1436 | static void ronly(struct var *vp) |
| 1459 | struct var *vp; | ||
| 1460 | { | 1437 | { |
| 1461 | if (isalpha(vp->name[0]) || vp->name[0] == '_') /* not an internal symbol */ | 1438 | if (isalpha(vp->name[0]) || vp->name[0] == '_') /* not an internal symbol */ |
| 1462 | vp->status |= RONLY; | 1439 | vp->status |= RONLY; |
| 1463 | } | 1440 | } |
| 1464 | 1441 | ||
| 1465 | static int isassign(s) | 1442 | static int isassign(REGISTER char *s) |
| 1466 | REGISTER char *s; | ||
| 1467 | { | 1443 | { |
| 1468 | DBGPRINTF7(("ISASSIGN: enter, s=%s\n", s)); | 1444 | DBGPRINTF7(("ISASSIGN: enter, s=%s\n", s)); |
| 1469 | 1445 | ||
| @@ -1476,9 +1452,7 @@ REGISTER char *s; | |||
| 1476 | return (1); | 1452 | return (1); |
| 1477 | } | 1453 | } |
| 1478 | 1454 | ||
| 1479 | static int assign(s, cf) | 1455 | static int assign(REGISTER char *s, int cf) |
| 1480 | REGISTER char *s; | ||
| 1481 | int cf; | ||
| 1482 | { | 1456 | { |
| 1483 | REGISTER char *cp; | 1457 | REGISTER char *cp; |
| 1484 | struct var *vp; | 1458 | struct var *vp; |
| @@ -1497,8 +1471,7 @@ int cf; | |||
| 1497 | return (1); | 1471 | return (1); |
| 1498 | } | 1472 | } |
| 1499 | 1473 | ||
| 1500 | static int checkname(cp) | 1474 | static int checkname(REGISTER char *cp) |
| 1501 | REGISTER char *cp; | ||
| 1502 | { | 1475 | { |
| 1503 | DBGPRINTF7(("CHECKNAME: enter, cp=%s\n", cp)); | 1476 | DBGPRINTF7(("CHECKNAME: enter, cp=%s\n", cp)); |
| 1504 | 1477 | ||
| @@ -1510,8 +1483,7 @@ REGISTER char *cp; | |||
| 1510 | return (1); | 1483 | return (1); |
| 1511 | } | 1484 | } |
| 1512 | 1485 | ||
| 1513 | static void putvlist(f, out) | 1486 | static void putvlist(REGISTER int f, REGISTER int out) |
| 1514 | REGISTER int f, out; | ||
| 1515 | { | 1487 | { |
| 1516 | REGISTER struct var *vp; | 1488 | REGISTER struct var *vp; |
| 1517 | 1489 | ||
| @@ -1526,8 +1498,7 @@ REGISTER int f, out; | |||
| 1526 | } | 1498 | } |
| 1527 | } | 1499 | } |
| 1528 | 1500 | ||
| 1529 | static int eqname(n1, n2) | 1501 | static int eqname(REGISTER char *n1, REGISTER char *n2) |
| 1530 | REGISTER char *n1, *n2; | ||
| 1531 | { | 1502 | { |
| 1532 | for (; *n1 != '=' && *n1 != 0; n1++) | 1503 | for (; *n1 != '=' && *n1 != 0; n1++) |
| 1533 | if (*n2++ != *n1) | 1504 | if (*n2++ != *n1) |
| @@ -1535,8 +1506,7 @@ REGISTER char *n1, *n2; | |||
| 1535 | return (*n2 == 0 || *n2 == '='); | 1506 | return (*n2 == 0 || *n2 == '='); |
| 1536 | } | 1507 | } |
| 1537 | 1508 | ||
| 1538 | static char *findeq(cp) | 1509 | static char *findeq(REGISTER char *cp) |
| 1539 | REGISTER char *cp; | ||
| 1540 | { | 1510 | { |
| 1541 | while (*cp != '\0' && *cp != '=') | 1511 | while (*cp != '\0' && *cp != '=') |
| 1542 | cp++; | 1512 | cp++; |
| @@ -1556,8 +1526,7 @@ REGISTER char *cp; | |||
| 1556 | #define QMASK (CMASK&~QUOTE) | 1526 | #define QMASK (CMASK&~QUOTE) |
| 1557 | #define NOT '!' /* might use ^ */ | 1527 | #define NOT '!' /* might use ^ */ |
| 1558 | 1528 | ||
| 1559 | static int gmatch(s, p) | 1529 | static int gmatch(REGISTER char *s, REGISTER char *p) |
| 1560 | REGISTER char *s, *p; | ||
| 1561 | { | 1530 | { |
| 1562 | REGISTER int sc, pc; | 1531 | REGISTER int sc, pc; |
| 1563 | 1532 | ||
| @@ -1592,9 +1561,7 @@ REGISTER char *s, *p; | |||
| 1592 | return (*s == 0); | 1561 | return (*s == 0); |
| 1593 | } | 1562 | } |
| 1594 | 1563 | ||
| 1595 | static char *cclass(p, sub) | 1564 | static char *cclass(REGISTER char *p, REGISTER int sub) |
| 1596 | REGISTER char *p; | ||
| 1597 | REGISTER int sub; | ||
| 1598 | { | 1565 | { |
| 1599 | REGISTER int c, d, not, found; | 1566 | REGISTER int c, d, not, found; |
| 1600 | 1567 | ||
| @@ -1627,7 +1594,7 @@ REGISTER int sub; | |||
| 1627 | 1594 | ||
| 1628 | #define sbrk(X) ({ void * __q = (void *)-1; if (brkaddr + (int)(X) < brktop) { __q = brkaddr; brkaddr+=(int)(X); } __q;}) | 1595 | #define sbrk(X) ({ void * __q = (void *)-1; if (brkaddr + (int)(X) < brktop) { __q = brkaddr; brkaddr+=(int)(X); } __q;}) |
| 1629 | 1596 | ||
| 1630 | static void initarea() | 1597 | static void initarea(void) |
| 1631 | { | 1598 | { |
| 1632 | brkaddr = xmalloc(AREASIZE); | 1599 | brkaddr = xmalloc(AREASIZE); |
| 1633 | brktop = brkaddr + AREASIZE; | 1600 | brktop = brkaddr + AREASIZE; |
| @@ -1642,8 +1609,7 @@ static void initarea() | |||
| 1642 | areanxt = areabot; | 1609 | areanxt = areabot; |
| 1643 | } | 1610 | } |
| 1644 | 1611 | ||
| 1645 | char *getcell(nbytes) | 1612 | char *getcell(unsigned nbytes) |
| 1646 | unsigned nbytes; | ||
| 1647 | { | 1613 | { |
| 1648 | REGISTER int nregio; | 1614 | REGISTER int nregio; |
| 1649 | REGISTER struct region *p, *q; | 1615 | REGISTER struct region *p, *q; |
| @@ -1711,8 +1677,7 @@ unsigned nbytes; | |||
| 1711 | return ((char *) (p + 1)); | 1677 | return ((char *) (p + 1)); |
| 1712 | } | 1678 | } |
| 1713 | 1679 | ||
| 1714 | static void freecell(cp) | 1680 | static void freecell(char *cp) |
| 1715 | char *cp; | ||
| 1716 | { | 1681 | { |
| 1717 | REGISTER struct region *p; | 1682 | REGISTER struct region *p; |
| 1718 | 1683 | ||
| @@ -1724,8 +1689,7 @@ char *cp; | |||
| 1724 | } | 1689 | } |
| 1725 | } | 1690 | } |
| 1726 | 1691 | ||
| 1727 | static void freearea(a) | 1692 | static void freearea(REGISTER int a) |
| 1728 | REGISTER int a; | ||
| 1729 | { | 1693 | { |
| 1730 | REGISTER struct region *p, *top; | 1694 | REGISTER struct region *p, *top; |
| 1731 | 1695 | ||
| @@ -1735,9 +1699,7 @@ REGISTER int a; | |||
| 1735 | p->area = FREE; | 1699 | p->area = FREE; |
| 1736 | } | 1700 | } |
| 1737 | 1701 | ||
| 1738 | static void setarea(cp, a) | 1702 | static void setarea(char *cp, int a) |
| 1739 | char *cp; | ||
| 1740 | int a; | ||
| 1741 | { | 1703 | { |
| 1742 | REGISTER struct region *p; | 1704 | REGISTER struct region *p; |
| 1743 | 1705 | ||
| @@ -1745,13 +1707,12 @@ int a; | |||
| 1745 | (p - 1)->area = a; | 1707 | (p - 1)->area = a; |
| 1746 | } | 1708 | } |
| 1747 | 1709 | ||
| 1748 | int getarea(cp) | 1710 | int getarea(char *cp) |
| 1749 | char *cp; | ||
| 1750 | { | 1711 | { |
| 1751 | return ((struct region *) cp - 1)->area; | 1712 | return ((struct region *) cp - 1)->area; |
| 1752 | } | 1713 | } |
| 1753 | 1714 | ||
| 1754 | static void garbage() | 1715 | static void garbage(void) |
| 1755 | { | 1716 | { |
| 1756 | REGISTER struct region *p, *q, *top; | 1717 | REGISTER struct region *p, *q, *top; |
| 1757 | 1718 | ||
| @@ -1778,7 +1739,7 @@ static void garbage() | |||
| 1778 | * shell: syntax (C version) | 1739 | * shell: syntax (C version) |
| 1779 | */ | 1740 | */ |
| 1780 | 1741 | ||
| 1781 | int yyparse() | 1742 | int yyparse(void) |
| 1782 | { | 1743 | { |
| 1783 | DBGPRINTF7(("YYPARSE: enter...\n")); | 1744 | DBGPRINTF7(("YYPARSE: enter...\n")); |
| 1784 | 1745 | ||
| @@ -1790,8 +1751,7 @@ int yyparse() | |||
| 1790 | return (yynerrs != 0); | 1751 | return (yynerrs != 0); |
| 1791 | } | 1752 | } |
| 1792 | 1753 | ||
| 1793 | static struct op *pipeline(cf) | 1754 | static struct op *pipeline(int cf) |
| 1794 | int cf; | ||
| 1795 | { | 1755 | { |
| 1796 | REGISTER struct op *t, *p; | 1756 | REGISTER struct op *t, *p; |
| 1797 | REGISTER int c; | 1757 | REGISTER int c; |
| @@ -1823,7 +1783,7 @@ int cf; | |||
| 1823 | return (t); | 1783 | return (t); |
| 1824 | } | 1784 | } |
| 1825 | 1785 | ||
| 1826 | static struct op *andor() | 1786 | static struct op *andor(void) |
| 1827 | { | 1787 | { |
| 1828 | REGISTER struct op *t, *p; | 1788 | REGISTER struct op *t, *p; |
| 1829 | REGISTER int c; | 1789 | REGISTER int c; |
| @@ -1851,7 +1811,7 @@ static struct op *andor() | |||
| 1851 | return (t); | 1811 | return (t); |
| 1852 | } | 1812 | } |
| 1853 | 1813 | ||
| 1854 | static struct op *c_list() | 1814 | static struct op *c_list(void) |
| 1855 | { | 1815 | { |
| 1856 | REGISTER struct op *t, *p; | 1816 | REGISTER struct op *t, *p; |
| 1857 | REGISTER int c; | 1817 | REGISTER int c; |
| @@ -1883,8 +1843,7 @@ static struct op *c_list() | |||
| 1883 | return (t); | 1843 | return (t); |
| 1884 | } | 1844 | } |
| 1885 | 1845 | ||
| 1886 | static int synio(cf) | 1846 | static int synio(int cf) |
| 1887 | int cf; | ||
| 1888 | { | 1847 | { |
| 1889 | REGISTER struct ioword *iop; | 1848 | REGISTER struct ioword *iop; |
| 1890 | REGISTER int i; | 1849 | REGISTER int i; |
| @@ -1909,8 +1868,7 @@ int cf; | |||
| 1909 | return (1); | 1868 | return (1); |
| 1910 | } | 1869 | } |
| 1911 | 1870 | ||
| 1912 | static void musthave(c, cf) | 1871 | static void musthave(int c, int cf) |
| 1913 | int c, cf; | ||
| 1914 | { | 1872 | { |
| 1915 | if ((peeksym = yylex(cf)) != c) { | 1873 | if ((peeksym = yylex(cf)) != c) { |
| 1916 | DBGPRINTF7(("MUSTHAVE: error!\n")); | 1874 | DBGPRINTF7(("MUSTHAVE: error!\n")); |
| @@ -1920,7 +1878,7 @@ int c, cf; | |||
| 1920 | peeksym = 0; | 1878 | peeksym = 0; |
| 1921 | } | 1879 | } |
| 1922 | 1880 | ||
| 1923 | static struct op *simple() | 1881 | static struct op *simple(void) |
| 1924 | { | 1882 | { |
| 1925 | REGISTER struct op *t; | 1883 | REGISTER struct op *t; |
| 1926 | 1884 | ||
| @@ -1947,8 +1905,7 @@ static struct op *simple() | |||
| 1947 | } | 1905 | } |
| 1948 | } | 1906 | } |
| 1949 | 1907 | ||
| 1950 | static struct op *nested(type, mark) | 1908 | static struct op *nested(int type, int mark) |
| 1951 | int type, mark; | ||
| 1952 | { | 1909 | { |
| 1953 | REGISTER struct op *t; | 1910 | REGISTER struct op *t; |
| 1954 | 1911 | ||
| @@ -1961,8 +1918,7 @@ int type, mark; | |||
| 1961 | return (block(type, t, NOBLOCK, NOWORDS)); | 1918 | return (block(type, t, NOBLOCK, NOWORDS)); |
| 1962 | } | 1919 | } |
| 1963 | 1920 | ||
| 1964 | static struct op *command(cf) | 1921 | static struct op *command(int cf) |
| 1965 | int cf; | ||
| 1966 | { | 1922 | { |
| 1967 | REGISTER struct op *t; | 1923 | REGISTER struct op *t; |
| 1968 | struct wdblock *iosave; | 1924 | struct wdblock *iosave; |
| @@ -2075,9 +2031,7 @@ int cf; | |||
| 2075 | return (t); | 2031 | return (t); |
| 2076 | } | 2032 | } |
| 2077 | 2033 | ||
| 2078 | static struct op *dowholefile(type, mark) | 2034 | static struct op *dowholefile(int type, int mark) |
| 2079 | int type; | ||
| 2080 | int mark; | ||
| 2081 | { | 2035 | { |
| 2082 | REGISTER struct op *t; | 2036 | REGISTER struct op *t; |
| 2083 | 2037 | ||
| @@ -2091,8 +2045,7 @@ int mark; | |||
| 2091 | return (t); | 2045 | return (t); |
| 2092 | } | 2046 | } |
| 2093 | 2047 | ||
| 2094 | static struct op *dogroup(onlydone) | 2048 | static struct op *dogroup(int onlydone) |
| 2095 | int onlydone; | ||
| 2096 | { | 2049 | { |
| 2097 | REGISTER int c; | 2050 | REGISTER int c; |
| 2098 | REGISTER struct op *mylist; | 2051 | REGISTER struct op *mylist; |
| @@ -2107,7 +2060,7 @@ int onlydone; | |||
| 2107 | return (mylist); | 2060 | return (mylist); |
| 2108 | } | 2061 | } |
| 2109 | 2062 | ||
| 2110 | static struct op *thenpart() | 2063 | static struct op *thenpart(void) |
| 2111 | { | 2064 | { |
| 2112 | REGISTER int c; | 2065 | REGISTER int c; |
| 2113 | REGISTER struct op *t; | 2066 | REGISTER struct op *t; |
| @@ -2125,7 +2078,7 @@ static struct op *thenpart() | |||
| 2125 | return (t); | 2078 | return (t); |
| 2126 | } | 2079 | } |
| 2127 | 2080 | ||
| 2128 | static struct op *elsepart() | 2081 | static struct op *elsepart(void) |
| 2129 | { | 2082 | { |
| 2130 | REGISTER int c; | 2083 | REGISTER int c; |
| 2131 | REGISTER struct op *t; | 2084 | REGISTER struct op *t; |
| @@ -2149,7 +2102,7 @@ static struct op *elsepart() | |||
| 2149 | } | 2102 | } |
| 2150 | } | 2103 | } |
| 2151 | 2104 | ||
| 2152 | static struct op *caselist() | 2105 | static struct op *caselist(void) |
| 2153 | { | 2106 | { |
| 2154 | REGISTER struct op *t; | 2107 | REGISTER struct op *t; |
| 2155 | 2108 | ||
| @@ -2163,7 +2116,7 @@ static struct op *caselist() | |||
| 2163 | return (t); | 2116 | return (t); |
| 2164 | } | 2117 | } |
| 2165 | 2118 | ||
| 2166 | static struct op *casepart() | 2119 | static struct op *casepart(void) |
| 2167 | { | 2120 | { |
| 2168 | REGISTER struct op *t; | 2121 | REGISTER struct op *t; |
| 2169 | 2122 | ||
| @@ -2182,7 +2135,7 @@ static struct op *casepart() | |||
| 2182 | return (t); | 2135 | return (t); |
| 2183 | } | 2136 | } |
| 2184 | 2137 | ||
| 2185 | static char **pattern() | 2138 | static char **pattern(void) |
| 2186 | { | 2139 | { |
| 2187 | REGISTER int c, cf; | 2140 | REGISTER int c, cf; |
| 2188 | 2141 | ||
| @@ -2198,7 +2151,7 @@ static char **pattern() | |||
| 2198 | return (copyw()); | 2151 | return (copyw()); |
| 2199 | } | 2152 | } |
| 2200 | 2153 | ||
| 2201 | static char **wordlist() | 2154 | static char **wordlist(void) |
| 2202 | { | 2155 | { |
| 2203 | REGISTER int c; | 2156 | REGISTER int c; |
| 2204 | 2157 | ||
| @@ -2217,8 +2170,7 @@ static char **wordlist() | |||
| 2217 | /* | 2170 | /* |
| 2218 | * supporting functions | 2171 | * supporting functions |
| 2219 | */ | 2172 | */ |
| 2220 | static struct op *list(t1, t2) | 2173 | static struct op *list(REGISTER struct op *t1, REGISTER struct op *t2) |
| 2221 | REGISTER struct op *t1, *t2; | ||
| 2222 | { | 2174 | { |
| 2223 | DBGPRINTF7(("LIST: enter, t1=%p, t2=%p\n", t1, t2)); | 2175 | DBGPRINTF7(("LIST: enter, t1=%p, t2=%p\n", t1, t2)); |
| 2224 | 2176 | ||
| @@ -2230,10 +2182,7 @@ REGISTER struct op *t1, *t2; | |||
| 2230 | return (block(TLIST, t1, t2, NOWORDS)); | 2182 | return (block(TLIST, t1, t2, NOWORDS)); |
| 2231 | } | 2183 | } |
| 2232 | 2184 | ||
| 2233 | static struct op *block(type, t1, t2, wp) | 2185 | static struct op *block(int type, struct op *t1, struct op *t2, char **wp) |
| 2234 | int type; | ||
| 2235 | struct op *t1, *t2; | ||
| 2236 | char **wp; | ||
| 2237 | { | 2186 | { |
| 2238 | REGISTER struct op *t; | 2187 | REGISTER struct op *t; |
| 2239 | 2188 | ||
| @@ -2252,8 +2201,7 @@ char **wp; | |||
| 2252 | } | 2201 | } |
| 2253 | 2202 | ||
| 2254 | /* See if given string is a shell multiline (FOR, IF, etc) */ | 2203 | /* See if given string is a shell multiline (FOR, IF, etc) */ |
| 2255 | static int rlookup(n) | 2204 | static int rlookup(REGISTER char *n) |
| 2256 | REGISTER char *n; | ||
| 2257 | { | 2205 | { |
| 2258 | REGISTER const struct res *rp; | 2206 | REGISTER const struct res *rp; |
| 2259 | 2207 | ||
| @@ -2269,7 +2217,7 @@ REGISTER char *n; | |||
| 2269 | return (0); /* Not a shell multiline */ | 2217 | return (0); /* Not a shell multiline */ |
| 2270 | } | 2218 | } |
| 2271 | 2219 | ||
| 2272 | static struct op *newtp() | 2220 | static struct op *newtp(void) |
| 2273 | { | 2221 | { |
| 2274 | REGISTER struct op *t; | 2222 | REGISTER struct op *t; |
| 2275 | 2223 | ||
| @@ -2286,8 +2234,7 @@ static struct op *newtp() | |||
| 2286 | return (t); | 2234 | return (t); |
| 2287 | } | 2235 | } |
| 2288 | 2236 | ||
| 2289 | static struct op *namelist(t) | 2237 | static struct op *namelist(REGISTER struct op *t) |
| 2290 | REGISTER struct op *t; | ||
| 2291 | { | 2238 | { |
| 2292 | 2239 | ||
| 2293 | DBGPRINTF7(("NAMELIST: enter, t=%p, type %s, iolist=%p\n", t, | 2240 | DBGPRINTF7(("NAMELIST: enter, t=%p, type %s, iolist=%p\n", t, |
| @@ -2315,7 +2262,7 @@ REGISTER struct op *t; | |||
| 2315 | return (t); | 2262 | return (t); |
| 2316 | } | 2263 | } |
| 2317 | 2264 | ||
| 2318 | static char **copyw() | 2265 | static char **copyw(void) |
| 2319 | { | 2266 | { |
| 2320 | REGISTER char **wd; | 2267 | REGISTER char **wd; |
| 2321 | 2268 | ||
| @@ -2324,13 +2271,12 @@ static char **copyw() | |||
| 2324 | return (wd); | 2271 | return (wd); |
| 2325 | } | 2272 | } |
| 2326 | 2273 | ||
| 2327 | static void word(cp) | 2274 | static void word(char *cp) |
| 2328 | char *cp; | ||
| 2329 | { | 2275 | { |
| 2330 | wdlist = addword(cp, wdlist); | 2276 | wdlist = addword(cp, wdlist); |
| 2331 | } | 2277 | } |
| 2332 | 2278 | ||
| 2333 | static struct ioword **copyio() | 2279 | static struct ioword **copyio(void) |
| 2334 | { | 2280 | { |
| 2335 | REGISTER struct ioword **iop; | 2281 | REGISTER struct ioword **iop; |
| 2336 | 2282 | ||
| @@ -2339,10 +2285,7 @@ static struct ioword **copyio() | |||
| 2339 | return (iop); | 2285 | return (iop); |
| 2340 | } | 2286 | } |
| 2341 | 2287 | ||
| 2342 | static struct ioword *io(u, f, cp) | 2288 | static struct ioword *io(int u, int f, char *cp) |
| 2343 | int u; | ||
| 2344 | int f; | ||
| 2345 | char *cp; | ||
| 2346 | { | 2289 | { |
| 2347 | REGISTER struct ioword *iop; | 2290 | REGISTER struct ioword *iop; |
| 2348 | 2291 | ||
| @@ -2354,13 +2297,12 @@ char *cp; | |||
| 2354 | return (iop); | 2297 | return (iop); |
| 2355 | } | 2298 | } |
| 2356 | 2299 | ||
| 2357 | static void zzerr() | 2300 | static void zzerr(void) |
| 2358 | { | 2301 | { |
| 2359 | yyerror("syntax error"); | 2302 | yyerror("syntax error"); |
| 2360 | } | 2303 | } |
| 2361 | 2304 | ||
| 2362 | static void yyerror(s) | 2305 | static void yyerror(char *s) |
| 2363 | char *s; | ||
| 2364 | { | 2306 | { |
| 2365 | yynerrs++; | 2307 | yynerrs++; |
| 2366 | if (interactive && e.iop <= iostack) { | 2308 | if (interactive && e.iop <= iostack) { |
| @@ -2371,8 +2313,7 @@ char *s; | |||
| 2371 | fail(); | 2313 | fail(); |
| 2372 | } | 2314 | } |
| 2373 | 2315 | ||
| 2374 | static int yylex(cf) | 2316 | static int yylex(int cf) |
| 2375 | int cf; | ||
| 2376 | { | 2317 | { |
| 2377 | REGISTER int c, c1; | 2318 | REGISTER int c, c1; |
| 2378 | int atstart; | 2319 | int atstart; |
| @@ -2505,8 +2446,7 @@ int cf; | |||
| 2505 | } | 2446 | } |
| 2506 | 2447 | ||
| 2507 | 2448 | ||
| 2508 | static int collect(c, c1) | 2449 | static int collect(REGISTER int c, REGISTER int c1) |
| 2509 | REGISTER int c, c1; | ||
| 2510 | { | 2450 | { |
| 2511 | char s[2]; | 2451 | char s[2]; |
| 2512 | 2452 | ||
| @@ -2541,8 +2481,7 @@ REGISTER int c, c1; | |||
| 2541 | 2481 | ||
| 2542 | /* "multiline commands" helper func */ | 2482 | /* "multiline commands" helper func */ |
| 2543 | /* see if next 2 chars form a shell multiline */ | 2483 | /* see if next 2 chars form a shell multiline */ |
| 2544 | static int dual(c) | 2484 | static int dual(REGISTER int c) |
| 2545 | REGISTER int c; | ||
| 2546 | { | 2485 | { |
| 2547 | char s[3]; | 2486 | char s[3]; |
| 2548 | REGISTER char *cp = s; | 2487 | REGISTER char *cp = s; |
| @@ -2560,8 +2499,7 @@ REGISTER int c; | |||
| 2560 | return (c); /* String is multiline, return numeric multiline (restab) code */ | 2499 | return (c); /* String is multiline, return numeric multiline (restab) code */ |
| 2561 | } | 2500 | } |
| 2562 | 2501 | ||
| 2563 | static void diag(ec) | 2502 | static void diag(REGISTER int ec) |
| 2564 | REGISTER int ec; | ||
| 2565 | { | 2503 | { |
| 2566 | REGISTER int c; | 2504 | REGISTER int c; |
| 2567 | 2505 | ||
| @@ -2581,8 +2519,7 @@ REGISTER int ec; | |||
| 2581 | yylval.i |= IODUP; | 2519 | yylval.i |= IODUP; |
| 2582 | } | 2520 | } |
| 2583 | 2521 | ||
| 2584 | static char *tree(size) | 2522 | static char *tree(unsigned size) |
| 2585 | unsigned size; | ||
| 2586 | { | 2523 | { |
| 2587 | REGISTER char *t; | 2524 | REGISTER char *t; |
| 2588 | 2525 | ||
| @@ -2605,10 +2542,7 @@ unsigned size; | |||
| 2605 | */ | 2542 | */ |
| 2606 | 2543 | ||
| 2607 | 2544 | ||
| 2608 | static int execute(t, pin, pout, act) | 2545 | static int execute(REGISTER struct op *t, int *pin, int *pout, int act) |
| 2609 | REGISTER struct op *t; | ||
| 2610 | int *pin, *pout; | ||
| 2611 | int act; | ||
| 2612 | { | 2546 | { |
| 2613 | REGISTER struct op *t1; | 2547 | REGISTER struct op *t1; |
| 2614 | volatile int i, rv, a; | 2548 | volatile int i, rv, a; |
| @@ -3065,9 +2999,7 @@ forkexec(REGISTER struct op *t, int *pin, int *pout, int act, char **wp) | |||
| 3065 | * 0< 1> are ignored as required | 2999 | * 0< 1> are ignored as required |
| 3066 | * within pipelines. | 3000 | * within pipelines. |
| 3067 | */ | 3001 | */ |
| 3068 | static int iosetup(iop, pipein, pipeout) | 3002 | static int iosetup(REGISTER struct ioword *iop, int pipein, int pipeout) |
| 3069 | REGISTER struct ioword *iop; | ||
| 3070 | int pipein, pipeout; | ||
| 3071 | { | 3003 | { |
| 3072 | REGISTER int u = -1; | 3004 | REGISTER int u = -1; |
| 3073 | char *cp = NULL, *msg; | 3005 | char *cp = NULL, *msg; |
| @@ -3143,8 +3075,7 @@ int pipein, pipeout; | |||
| 3143 | return (0); | 3075 | return (0); |
| 3144 | } | 3076 | } |
| 3145 | 3077 | ||
| 3146 | static void echo(wp) | 3078 | static void echo(REGISTER char **wp) |
| 3147 | REGISTER char **wp; | ||
| 3148 | { | 3079 | { |
| 3149 | REGISTER int i; | 3080 | REGISTER int i; |
| 3150 | 3081 | ||
| @@ -3157,9 +3088,7 @@ REGISTER char **wp; | |||
| 3157 | prs("\n"); | 3088 | prs("\n"); |
| 3158 | } | 3089 | } |
| 3159 | 3090 | ||
| 3160 | static struct op **find1case(t, w) | 3091 | static struct op **find1case(struct op *t, char *w) |
| 3161 | struct op *t; | ||
| 3162 | char *w; | ||
| 3163 | { | 3092 | { |
| 3164 | REGISTER struct op *t1; | 3093 | REGISTER struct op *t1; |
| 3165 | struct op **tp; | 3094 | struct op **tp; |
| @@ -3194,9 +3123,7 @@ char *w; | |||
| 3194 | return ((struct op **) NULL); | 3123 | return ((struct op **) NULL); |
| 3195 | } | 3124 | } |
| 3196 | 3125 | ||
| 3197 | static struct op *findcase(t, w) | 3126 | static struct op *findcase(struct op *t, char *w) |
| 3198 | struct op *t; | ||
| 3199 | char *w; | ||
| 3200 | { | 3127 | { |
| 3201 | REGISTER struct op **tp; | 3128 | REGISTER struct op **tp; |
| 3202 | 3129 | ||
| @@ -3206,8 +3133,7 @@ char *w; | |||
| 3206 | /* | 3133 | /* |
| 3207 | * Enter a new loop level (marked for break/continue). | 3134 | * Enter a new loop level (marked for break/continue). |
| 3208 | */ | 3135 | */ |
| 3209 | static void brkset(bc) | 3136 | static void brkset(struct brkcon *bc) |
| 3210 | struct brkcon *bc; | ||
| 3211 | { | 3137 | { |
| 3212 | bc->nextlev = brklist; | 3138 | bc->nextlev = brklist; |
| 3213 | brklist = bc; | 3139 | brklist = bc; |
| @@ -3220,9 +3146,7 @@ struct brkcon *bc; | |||
| 3220 | * Ignore interrupt signals while waiting | 3146 | * Ignore interrupt signals while waiting |
| 3221 | * unless `canintr' is true. | 3147 | * unless `canintr' is true. |
| 3222 | */ | 3148 | */ |
| 3223 | static int waitfor(lastpid, canintr) | 3149 | static int waitfor(REGISTER int lastpid, int canintr) |
| 3224 | REGISTER int lastpid; | ||
| 3225 | int canintr; | ||
| 3226 | { | 3150 | { |
| 3227 | REGISTER int pid, rv; | 3151 | REGISTER int pid, rv; |
| 3228 | int s; | 3152 | int s; |
| @@ -3277,8 +3201,7 @@ int canintr; | |||
| 3277 | return (rv); | 3201 | return (rv); |
| 3278 | } | 3202 | } |
| 3279 | 3203 | ||
| 3280 | static int setstatus(s) | 3204 | static int setstatus(REGISTER int s) |
| 3281 | REGISTER int s; | ||
| 3282 | { | 3205 | { |
| 3283 | exstat = s; | 3206 | exstat = s; |
| 3284 | setval(lookup("?"), putn(s)); | 3207 | setval(lookup("?"), putn(s)); |
| @@ -3290,8 +3213,7 @@ REGISTER int s; | |||
| 3290 | * If getenv("PATH") were kept up-to-date, | 3213 | * If getenv("PATH") were kept up-to-date, |
| 3291 | * execvp might be used. | 3214 | * execvp might be used. |
| 3292 | */ | 3215 | */ |
| 3293 | static char *rexecve(c, v, envp) | 3216 | static char *rexecve(char *c, char **v, char **envp) |
| 3294 | char *c, **v, **envp; | ||
| 3295 | { | 3217 | { |
| 3296 | REGISTER int i; | 3218 | REGISTER int i; |
| 3297 | REGISTER char *sp, *tp; | 3219 | REGISTER char *sp, *tp; |
| @@ -3455,8 +3377,7 @@ static int dolabel(struct op *t) | |||
| 3455 | return (0); | 3377 | return (0); |
| 3456 | } | 3378 | } |
| 3457 | 3379 | ||
| 3458 | static int dochdir(t) | 3380 | static int dochdir(REGISTER struct op *t) |
| 3459 | REGISTER struct op *t; | ||
| 3460 | { | 3381 | { |
| 3461 | REGISTER char *cp, *er; | 3382 | REGISTER char *cp, *er; |
| 3462 | 3383 | ||
| @@ -3471,8 +3392,7 @@ REGISTER struct op *t; | |||
| 3471 | return (1); | 3392 | return (1); |
| 3472 | } | 3393 | } |
| 3473 | 3394 | ||
| 3474 | static int doshift(t) | 3395 | static int doshift(REGISTER struct op *t) |
| 3475 | REGISTER struct op *t; | ||
| 3476 | { | 3396 | { |
| 3477 | REGISTER int n; | 3397 | REGISTER int n; |
| 3478 | 3398 | ||
| @@ -3491,8 +3411,7 @@ REGISTER struct op *t; | |||
| 3491 | /* | 3411 | /* |
| 3492 | * execute login and newgrp directly | 3412 | * execute login and newgrp directly |
| 3493 | */ | 3413 | */ |
| 3494 | static int dologin(t) | 3414 | static int dologin(struct op *t) |
| 3495 | struct op *t; | ||
| 3496 | { | 3415 | { |
| 3497 | REGISTER char *cp; | 3416 | REGISTER char *cp; |
| 3498 | 3417 | ||
| @@ -3507,8 +3426,7 @@ struct op *t; | |||
| 3507 | return (1); | 3426 | return (1); |
| 3508 | } | 3427 | } |
| 3509 | 3428 | ||
| 3510 | static int doumask(t) | 3429 | static int doumask(REGISTER struct op *t) |
| 3511 | REGISTER struct op *t; | ||
| 3512 | { | 3430 | { |
| 3513 | REGISTER int i, n; | 3431 | REGISTER int i, n; |
| 3514 | REGISTER char *cp; | 3432 | REGISTER char *cp; |
| @@ -3527,8 +3445,7 @@ REGISTER struct op *t; | |||
| 3527 | return (0); | 3445 | return (0); |
| 3528 | } | 3446 | } |
| 3529 | 3447 | ||
| 3530 | static int doexec(t) | 3448 | static int doexec(REGISTER struct op *t) |
| 3531 | REGISTER struct op *t; | ||
| 3532 | { | 3449 | { |
| 3533 | REGISTER int i; | 3450 | REGISTER int i; |
| 3534 | jmp_buf ex; | 3451 | jmp_buf ex; |
| @@ -3547,8 +3464,7 @@ REGISTER struct op *t; | |||
| 3547 | return (1); | 3464 | return (1); |
| 3548 | } | 3465 | } |
| 3549 | 3466 | ||
| 3550 | static int dodot(t) | 3467 | static int dodot(struct op *t) |
| 3551 | struct op *t; | ||
| 3552 | { | 3468 | { |
| 3553 | REGISTER int i; | 3469 | REGISTER int i; |
| 3554 | REGISTER char *sp, *tp; | 3470 | REGISTER char *sp, *tp; |
| @@ -3600,8 +3516,7 @@ struct op *t; | |||
| 3600 | return (-1); | 3516 | return (-1); |
| 3601 | } | 3517 | } |
| 3602 | 3518 | ||
| 3603 | static int dowait(t) | 3519 | static int dowait(struct op *t) |
| 3604 | struct op *t; | ||
| 3605 | { | 3520 | { |
| 3606 | REGISTER int i; | 3521 | REGISTER int i; |
| 3607 | REGISTER char *cp; | 3522 | REGISTER char *cp; |
| @@ -3616,8 +3531,7 @@ struct op *t; | |||
| 3616 | return (0); | 3531 | return (0); |
| 3617 | } | 3532 | } |
| 3618 | 3533 | ||
| 3619 | static int doread(t) | 3534 | static int doread(struct op *t) |
| 3620 | struct op *t; | ||
| 3621 | { | 3535 | { |
| 3622 | REGISTER char *cp, **wp; | 3536 | REGISTER char *cp, **wp; |
| 3623 | REGISTER int nb = 0; | 3537 | REGISTER int nb = 0; |
| @@ -3640,14 +3554,12 @@ struct op *t; | |||
| 3640 | return (nb <= 0); | 3554 | return (nb <= 0); |
| 3641 | } | 3555 | } |
| 3642 | 3556 | ||
| 3643 | static int doeval(t) | 3557 | static int doeval(REGISTER struct op *t) |
| 3644 | REGISTER struct op *t; | ||
| 3645 | { | 3558 | { |
| 3646 | return (RUN(awordlist, t->words + 1, wdchar)); | 3559 | return (RUN(awordlist, t->words + 1, wdchar)); |
| 3647 | } | 3560 | } |
| 3648 | 3561 | ||
| 3649 | static int dotrap(t) | 3562 | static int dotrap(REGISTER struct op *t) |
| 3650 | REGISTER struct op *t; | ||
| 3651 | { | 3563 | { |
| 3652 | REGISTER int n, i; | 3564 | REGISTER int n, i; |
| 3653 | REGISTER int resetsig; | 3565 | REGISTER int resetsig; |
| @@ -3686,8 +3598,7 @@ REGISTER struct op *t; | |||
| 3686 | return (0); | 3598 | return (0); |
| 3687 | } | 3599 | } |
| 3688 | 3600 | ||
| 3689 | static int getsig(s) | 3601 | static int getsig(char *s) |
| 3690 | char *s; | ||
| 3691 | { | 3602 | { |
| 3692 | REGISTER int n; | 3603 | REGISTER int n; |
| 3693 | 3604 | ||
| @@ -3708,8 +3619,7 @@ static void setsig(REGISTER int n, sighandler_t f) | |||
| 3708 | } | 3619 | } |
| 3709 | } | 3620 | } |
| 3710 | 3621 | ||
| 3711 | static int getn(as) | 3622 | static int getn(char *as) |
| 3712 | char *as; | ||
| 3713 | { | 3623 | { |
| 3714 | REGISTER char *s; | 3624 | REGISTER char *s; |
| 3715 | REGISTER int n, m; | 3625 | REGISTER int n, m; |
| @@ -3729,21 +3639,17 @@ char *as; | |||
| 3729 | return (n * m); | 3639 | return (n * m); |
| 3730 | } | 3640 | } |
| 3731 | 3641 | ||
| 3732 | static int dobreak(t) | 3642 | static int dobreak(struct op *t) |
| 3733 | struct op *t; | ||
| 3734 | { | 3643 | { |
| 3735 | return (brkcontin(t->words[1], 1)); | 3644 | return (brkcontin(t->words[1], 1)); |
| 3736 | } | 3645 | } |
| 3737 | 3646 | ||
| 3738 | static int docontinue(t) | 3647 | static int docontinue(struct op *t) |
| 3739 | struct op *t; | ||
| 3740 | { | 3648 | { |
| 3741 | return (brkcontin(t->words[1], 0)); | 3649 | return (brkcontin(t->words[1], 0)); |
| 3742 | } | 3650 | } |
| 3743 | 3651 | ||
| 3744 | static int brkcontin(cp, val) | 3652 | static int brkcontin(REGISTER char *cp, int val) |
| 3745 | REGISTER char *cp; | ||
| 3746 | int val; | ||
| 3747 | { | 3653 | { |
| 3748 | REGISTER struct brkcon *bc; | 3654 | REGISTER struct brkcon *bc; |
| 3749 | REGISTER int nl; | 3655 | REGISTER int nl; |
| @@ -3765,8 +3671,7 @@ int val; | |||
| 3765 | /* NOTREACHED */ | 3671 | /* NOTREACHED */ |
| 3766 | } | 3672 | } |
| 3767 | 3673 | ||
| 3768 | static int doexit(t) | 3674 | static int doexit(struct op *t) |
| 3769 | struct op *t; | ||
| 3770 | { | 3675 | { |
| 3771 | REGISTER char *cp; | 3676 | REGISTER char *cp; |
| 3772 | 3677 | ||
| @@ -3781,15 +3686,13 @@ struct op *t; | |||
| 3781 | return (0); | 3686 | return (0); |
| 3782 | } | 3687 | } |
| 3783 | 3688 | ||
| 3784 | static int doexport(t) | 3689 | static int doexport(struct op *t) |
| 3785 | struct op *t; | ||
| 3786 | { | 3690 | { |
| 3787 | rdexp(t->words + 1, export, EXPORT); | 3691 | rdexp(t->words + 1, export, EXPORT); |
| 3788 | return (0); | 3692 | return (0); |
| 3789 | } | 3693 | } |
| 3790 | 3694 | ||
| 3791 | static int doreadonly(t) | 3695 | static int doreadonly(struct op *t) |
| 3792 | struct op *t; | ||
| 3793 | { | 3696 | { |
| 3794 | rdexp(t->words + 1, ronly, RONLY); | 3697 | rdexp(t->words + 1, ronly, RONLY); |
| 3795 | return (0); | 3698 | return (0); |
| @@ -3818,15 +3721,13 @@ static void rdexp(char **wp, void (*f) (struct var *), int key) | |||
| 3818 | putvlist(key, 1); | 3721 | putvlist(key, 1); |
| 3819 | } | 3722 | } |
| 3820 | 3723 | ||
| 3821 | static void badid(s) | 3724 | static void badid(REGISTER char *s) |
| 3822 | REGISTER char *s; | ||
| 3823 | { | 3725 | { |
| 3824 | prs(s); | 3726 | prs(s); |
| 3825 | err(": bad identifier"); | 3727 | err(": bad identifier"); |
| 3826 | } | 3728 | } |
| 3827 | 3729 | ||
| 3828 | static int doset(t) | 3730 | static int doset(REGISTER struct op *t) |
| 3829 | REGISTER struct op *t; | ||
| 3830 | { | 3731 | { |
| 3831 | REGISTER struct var *vp; | 3732 | REGISTER struct var *vp; |
| 3832 | REGISTER char *cp; | 3733 | REGISTER char *cp; |
| @@ -3869,9 +3770,7 @@ REGISTER struct op *t; | |||
| 3869 | return (0); | 3770 | return (0); |
| 3870 | } | 3771 | } |
| 3871 | 3772 | ||
| 3872 | static void varput(s, out) | 3773 | static void varput(REGISTER char *s, int out) |
| 3873 | REGISTER char *s; | ||
| 3874 | int out; | ||
| 3875 | { | 3774 | { |
| 3876 | if (isalnum(*s) || *s == '_') { | 3775 | if (isalnum(*s) || *s == '_') { |
| 3877 | write(out, s, strlen(s)); | 3776 | write(out, s, strlen(s)); |
| @@ -3981,9 +3880,7 @@ static char **makenv(int all, struct wdblock *wb) | |||
| 3981 | return (getwords(wb)); | 3880 | return (getwords(wb)); |
| 3982 | } | 3881 | } |
| 3983 | 3882 | ||
| 3984 | static char *evalstr(cp, f) | 3883 | static char *evalstr(REGISTER char *cp, int f) |
| 3985 | REGISTER char *cp; | ||
| 3986 | int f; | ||
| 3987 | { | 3884 | { |
| 3988 | struct wdblock *wb; | 3885 | struct wdblock *wb; |
| 3989 | 3886 | ||
| @@ -4046,8 +3943,7 @@ static int expand(char *cp, REGISTER struct wdblock **wbp, int f) | |||
| 4046 | /* | 3943 | /* |
| 4047 | * Blank interpretation and quoting | 3944 | * Blank interpretation and quoting |
| 4048 | */ | 3945 | */ |
| 4049 | static char *blank(f) | 3946 | static char *blank(int f) |
| 4050 | int f; | ||
| 4051 | { | 3947 | { |
| 4052 | REGISTER int c, c1; | 3948 | REGISTER int c, c1; |
| 4053 | REGISTER char *sp; | 3949 | REGISTER char *sp; |
| @@ -4116,9 +4012,7 @@ int f; | |||
| 4116 | /* | 4012 | /* |
| 4117 | * Get characters, substituting for ` and $ | 4013 | * Get characters, substituting for ` and $ |
| 4118 | */ | 4014 | */ |
| 4119 | static int subgetc(ec, quoted) | 4015 | static int subgetc(REGISTER char ec, int quoted) |
| 4120 | REGISTER char ec; | ||
| 4121 | int quoted; | ||
| 4122 | { | 4016 | { |
| 4123 | REGISTER char c; | 4017 | REGISTER char c; |
| 4124 | 4018 | ||
| @@ -4144,8 +4038,7 @@ int quoted; | |||
| 4144 | /* | 4038 | /* |
| 4145 | * Prepare to generate the string returned by ${} substitution. | 4039 | * Prepare to generate the string returned by ${} substitution. |
| 4146 | */ | 4040 | */ |
| 4147 | static int dollar(quoted) | 4041 | static int dollar(int quoted) |
| 4148 | int quoted; | ||
| 4149 | { | 4042 | { |
| 4150 | int otask; | 4043 | int otask; |
| 4151 | struct io *oiop; | 4044 | struct io *oiop; |
| @@ -4249,8 +4142,7 @@ int quoted; | |||
| 4249 | * Run the command in `...` and read its output. | 4142 | * Run the command in `...` and read its output. |
| 4250 | */ | 4143 | */ |
| 4251 | 4144 | ||
| 4252 | static int grave(quoted) | 4145 | static int grave(int quoted) |
| 4253 | int quoted; | ||
| 4254 | { | 4146 | { |
| 4255 | char *cp; | 4147 | char *cp; |
| 4256 | REGISTER int i; | 4148 | REGISTER int i; |
| @@ -4429,8 +4321,7 @@ int quoted; | |||
| 4429 | } | 4321 | } |
| 4430 | 4322 | ||
| 4431 | 4323 | ||
| 4432 | static char *unquote(as) | 4324 | static char *unquote(REGISTER char *as) |
| 4433 | REGISTER char *as; | ||
| 4434 | { | 4325 | { |
| 4435 | REGISTER char *s; | 4326 | REGISTER char *s; |
| 4436 | 4327 | ||
| @@ -4453,9 +4344,7 @@ REGISTER char *as; | |||
| 4453 | static struct wdblock *cl, *nl; | 4344 | static struct wdblock *cl, *nl; |
| 4454 | static char spcl[] = "[?*"; | 4345 | static char spcl[] = "[?*"; |
| 4455 | 4346 | ||
| 4456 | static struct wdblock *glob(cp, wb) | 4347 | static struct wdblock *glob(char *cp, struct wdblock *wb) |
| 4457 | char *cp; | ||
| 4458 | struct wdblock *wb; | ||
| 4459 | { | 4348 | { |
| 4460 | REGISTER int i; | 4349 | REGISTER int i; |
| 4461 | REGISTER char *pp; | 4350 | REGISTER char *pp; |
| @@ -4499,9 +4388,7 @@ struct wdblock *wb; | |||
| 4499 | return (wb); | 4388 | return (wb); |
| 4500 | } | 4389 | } |
| 4501 | 4390 | ||
| 4502 | static void globname(we, pp) | 4391 | static void globname(char *we, REGISTER char *pp) |
| 4503 | char *we; | ||
| 4504 | REGISTER char *pp; | ||
| 4505 | { | 4392 | { |
| 4506 | REGISTER char *np, *cp; | 4393 | REGISTER char *np, *cp; |
| 4507 | char *name, *gp, *dp; | 4394 | char *name, *gp, *dp; |
| @@ -4562,10 +4449,7 @@ REGISTER char *pp; | |||
| 4562 | * start..end1 / middle end | 4449 | * start..end1 / middle end |
| 4563 | * the slashes come for free | 4450 | * the slashes come for free |
| 4564 | */ | 4451 | */ |
| 4565 | static char *generate(start1, end1, middle, end) | 4452 | static char *generate(char *start1, REGISTER char *end1, char *middle, char *end) |
| 4566 | char *start1; | ||
| 4567 | REGISTER char *end1; | ||
| 4568 | char *middle, *end; | ||
| 4569 | { | 4453 | { |
| 4570 | char *p; | 4454 | char *p; |
| 4571 | REGISTER char *op, *xp; | 4455 | REGISTER char *op, *xp; |
| @@ -4580,8 +4464,7 @@ char *middle, *end; | |||
| 4580 | return (p); | 4464 | return (p); |
| 4581 | } | 4465 | } |
| 4582 | 4466 | ||
| 4583 | static int anyspcl(wb) | 4467 | static int anyspcl(REGISTER struct wdblock *wb) |
| 4584 | REGISTER struct wdblock *wb; | ||
| 4585 | { | 4468 | { |
| 4586 | REGISTER int i; | 4469 | REGISTER int i; |
| 4587 | REGISTER char **wd; | 4470 | REGISTER char **wd; |
| @@ -4593,16 +4476,14 @@ REGISTER struct wdblock *wb; | |||
| 4593 | return (0); | 4476 | return (0); |
| 4594 | } | 4477 | } |
| 4595 | 4478 | ||
| 4596 | static int xstrcmp(p1, p2) | 4479 | static int xstrcmp(char *p1, char *p2) |
| 4597 | char *p1, *p2; | ||
| 4598 | { | 4480 | { |
| 4599 | return (strcmp(*(char **) p1, *(char **) p2)); | 4481 | return (strcmp(*(char **) p1, *(char **) p2)); |
| 4600 | } | 4482 | } |
| 4601 | 4483 | ||
| 4602 | /* -------- word.c -------- */ | 4484 | /* -------- word.c -------- */ |
| 4603 | 4485 | ||
| 4604 | static struct wdblock *newword(nw) | 4486 | static struct wdblock *newword(REGISTER int nw) |
| 4605 | REGISTER int nw; | ||
| 4606 | { | 4487 | { |
| 4607 | REGISTER struct wdblock *wb; | 4488 | REGISTER struct wdblock *wb; |
| 4608 | 4489 | ||
| @@ -4612,9 +4493,7 @@ REGISTER int nw; | |||
| 4612 | return (wb); | 4493 | return (wb); |
| 4613 | } | 4494 | } |
| 4614 | 4495 | ||
| 4615 | static struct wdblock *addword(wd, wb) | 4496 | static struct wdblock *addword(char *wd, REGISTER struct wdblock *wb) |
| 4616 | char *wd; | ||
| 4617 | REGISTER struct wdblock *wb; | ||
| 4618 | { | 4497 | { |
| 4619 | REGISTER struct wdblock *wb2; | 4498 | REGISTER struct wdblock *wb2; |
| 4620 | REGISTER int nw; | 4499 | REGISTER int nw; |
| @@ -4634,8 +4513,7 @@ REGISTER struct wdblock *wb; | |||
| 4634 | } | 4513 | } |
| 4635 | 4514 | ||
| 4636 | static | 4515 | static |
| 4637 | char **getwords(wb) | 4516 | char **getwords(REGISTER struct wdblock *wb) |
| 4638 | REGISTER struct wdblock *wb; | ||
| 4639 | { | 4517 | { |
| 4640 | REGISTER char **wd; | 4518 | REGISTER char **wd; |
| 4641 | REGISTER int nb; | 4519 | REGISTER int nb; |
| @@ -4655,19 +4533,14 @@ REGISTER struct wdblock *wb; | |||
| 4655 | static int (*func) (char *, char *); | 4533 | static int (*func) (char *, char *); |
| 4656 | static int globv; | 4534 | static int globv; |
| 4657 | 4535 | ||
| 4658 | static void glob0(a0, a1, a2, a3) | 4536 | static void glob0(char *a0, unsigned a1, int a2, int (*a3) (char *, char *)) |
| 4659 | char *a0; | ||
| 4660 | unsigned a1; | ||
| 4661 | int a2; | ||
| 4662 | int (*a3) (char *, char *); | ||
| 4663 | { | 4537 | { |
| 4664 | func = a3; | 4538 | func = a3; |
| 4665 | globv = a2; | 4539 | globv = a2; |
| 4666 | glob1(a0, a0 + a1 * a2); | 4540 | glob1(a0, a0 + a1 * a2); |
| 4667 | } | 4541 | } |
| 4668 | 4542 | ||
| 4669 | static void glob1(base, lim) | 4543 | static void glob1(char *base, char *lim) |
| 4670 | char *base, *lim; | ||
| 4671 | { | 4544 | { |
| 4672 | REGISTER char *i, *j; | 4545 | REGISTER char *i, *j; |
| 4673 | int v2; | 4546 | int v2; |
| @@ -4736,8 +4609,7 @@ char *base, *lim; | |||
| 4736 | } | 4609 | } |
| 4737 | } | 4610 | } |
| 4738 | 4611 | ||
| 4739 | static void glob2(i, j) | 4612 | static void glob2(char *i, char *j) |
| 4740 | char *i, *j; | ||
| 4741 | { | 4613 | { |
| 4742 | REGISTER char *index1, *index2, c; | 4614 | REGISTER char *index1, *index2, c; |
| 4743 | int m; | 4615 | int m; |
| @@ -4752,8 +4624,7 @@ char *i, *j; | |||
| 4752 | } while (--m); | 4624 | } while (--m); |
| 4753 | } | 4625 | } |
| 4754 | 4626 | ||
| 4755 | static void glob3(i, j, k) | 4627 | static void glob3(char *i, char *j, char *k) |
| 4756 | char *i, *j, *k; | ||
| 4757 | { | 4628 | { |
| 4758 | REGISTER char *index1, *index2, *index3; | 4629 | REGISTER char *index1, *index2, *index3; |
| 4759 | int c; | 4630 | int c; |
| @@ -4799,19 +4670,18 @@ static int my_getc(int ec) | |||
| 4799 | return (c); | 4670 | return (c); |
| 4800 | } | 4671 | } |
| 4801 | 4672 | ||
| 4802 | static void unget(c) | 4673 | static void unget(int c) |
| 4803 | int c; | ||
| 4804 | { | 4674 | { |
| 4805 | if (e.iop >= e.iobase) | 4675 | if (e.iop >= e.iobase) |
| 4806 | e.iop->peekc = c; | 4676 | e.iop->peekc = c; |
| 4807 | } | 4677 | } |
| 4808 | 4678 | ||
| 4809 | static int eofc() | 4679 | static int eofc(void) |
| 4810 | { | 4680 | { |
| 4811 | return e.iop < e.iobase || (e.iop->peekc == 0 && e.iop->prev == 0); | 4681 | return e.iop < e.iobase || (e.iop->peekc == 0 && e.iop->prev == 0); |
| 4812 | } | 4682 | } |
| 4813 | 4683 | ||
| 4814 | static int readc() | 4684 | static int readc(void) |
| 4815 | { | 4685 | { |
| 4816 | REGISTER int c; | 4686 | REGISTER int c; |
| 4817 | 4687 | ||
| @@ -4867,8 +4737,7 @@ static int readc() | |||
| 4867 | return (0); | 4737 | return (0); |
| 4868 | } | 4738 | } |
| 4869 | 4739 | ||
| 4870 | static void ioecho(c) | 4740 | static void ioecho(char c) |
| 4871 | char c; | ||
| 4872 | { | 4741 | { |
| 4873 | if (flag['v']) | 4742 | if (flag['v']) |
| 4874 | write(2, &c, sizeof c); | 4743 | write(2, &c, sizeof c); |
| @@ -4940,8 +4809,7 @@ static void pushio(struct ioarg *argp, int (*fn) (struct ioarg *)) | |||
| 4940 | return; | 4809 | return; |
| 4941 | } | 4810 | } |
| 4942 | 4811 | ||
| 4943 | static struct io *setbase(ip) | 4812 | static struct io *setbase(struct io *ip) |
| 4944 | struct io *ip; | ||
| 4945 | { | 4813 | { |
| 4946 | REGISTER struct io *xp; | 4814 | REGISTER struct io *xp; |
| 4947 | 4815 | ||
| @@ -4957,8 +4825,7 @@ struct io *ip; | |||
| 4957 | /* | 4825 | /* |
| 4958 | * Produce the characters of a string, then a newline, then EOF. | 4826 | * Produce the characters of a string, then a newline, then EOF. |
| 4959 | */ | 4827 | */ |
| 4960 | static int nlchar(ap) | 4828 | static int nlchar(REGISTER struct ioarg *ap) |
| 4961 | REGISTER struct ioarg *ap; | ||
| 4962 | { | 4829 | { |
| 4963 | REGISTER int c; | 4830 | REGISTER int c; |
| 4964 | 4831 | ||
| @@ -4975,8 +4842,7 @@ REGISTER struct ioarg *ap; | |||
| 4975 | * Given a list of words, produce the characters | 4842 | * Given a list of words, produce the characters |
| 4976 | * in them, with a space after each word. | 4843 | * in them, with a space after each word. |
| 4977 | */ | 4844 | */ |
| 4978 | static int wdchar(ap) | 4845 | static int wdchar(REGISTER struct ioarg *ap) |
| 4979 | REGISTER struct ioarg *ap; | ||
| 4980 | { | 4846 | { |
| 4981 | REGISTER char c; | 4847 | REGISTER char c; |
| 4982 | REGISTER char **wl; | 4848 | REGISTER char **wl; |
| @@ -4997,8 +4863,7 @@ REGISTER struct ioarg *ap; | |||
| 4997 | * Return the characters of a list of words, | 4863 | * Return the characters of a list of words, |
| 4998 | * producing a space between them. | 4864 | * producing a space between them. |
| 4999 | */ | 4865 | */ |
| 5000 | static int dolchar(ap) | 4866 | static int dolchar(REGISTER struct ioarg *ap) |
| 5001 | REGISTER struct ioarg *ap; | ||
| 5002 | { | 4867 | { |
| 5003 | REGISTER char *wp; | 4868 | REGISTER char *wp; |
| 5004 | 4869 | ||
| @@ -5009,8 +4874,7 @@ REGISTER struct ioarg *ap; | |||
| 5009 | return (0); | 4874 | return (0); |
| 5010 | } | 4875 | } |
| 5011 | 4876 | ||
| 5012 | static int xxchar(ap) | 4877 | static int xxchar(REGISTER struct ioarg *ap) |
| 5013 | REGISTER struct ioarg *ap; | ||
| 5014 | { | 4878 | { |
| 5015 | REGISTER int c; | 4879 | REGISTER int c; |
| 5016 | 4880 | ||
| @@ -5026,8 +4890,7 @@ REGISTER struct ioarg *ap; | |||
| 5026 | /* | 4890 | /* |
| 5027 | * Produce the characters from a single word (string). | 4891 | * Produce the characters from a single word (string). |
| 5028 | */ | 4892 | */ |
| 5029 | static int strchar(ap) | 4893 | static int strchar(REGISTER struct ioarg *ap) |
| 5030 | REGISTER struct ioarg *ap; | ||
| 5031 | { | 4894 | { |
| 5032 | REGISTER int c; | 4895 | REGISTER int c; |
| 5033 | 4896 | ||
| @@ -5039,8 +4902,7 @@ REGISTER struct ioarg *ap; | |||
| 5039 | /* | 4902 | /* |
| 5040 | * Produce quoted characters from a single word (string). | 4903 | * Produce quoted characters from a single word (string). |
| 5041 | */ | 4904 | */ |
| 5042 | static int qstrchar(ap) | 4905 | static int qstrchar(REGISTER struct ioarg *ap) |
| 5043 | REGISTER struct ioarg *ap; | ||
| 5044 | { | 4906 | { |
| 5045 | REGISTER int c; | 4907 | REGISTER int c; |
| 5046 | 4908 | ||
| @@ -5052,8 +4914,7 @@ REGISTER struct ioarg *ap; | |||
| 5052 | /* | 4914 | /* |
| 5053 | * Return the characters from a file. | 4915 | * Return the characters from a file. |
| 5054 | */ | 4916 | */ |
| 5055 | static int filechar(ap) | 4917 | static int filechar(REGISTER struct ioarg *ap) |
| 5056 | REGISTER struct ioarg *ap; | ||
| 5057 | { | 4918 | { |
| 5058 | REGISTER int i; | 4919 | REGISTER int i; |
| 5059 | char c; | 4920 | char c; |
| @@ -5104,8 +4965,7 @@ REGISTER struct ioarg *ap; | |||
| 5104 | /* | 4965 | /* |
| 5105 | * Return the characters from a here temp file. | 4966 | * Return the characters from a here temp file. |
| 5106 | */ | 4967 | */ |
| 5107 | static int herechar(ap) | 4968 | static int herechar(REGISTER struct ioarg *ap) |
| 5108 | REGISTER struct ioarg *ap; | ||
| 5109 | { | 4969 | { |
| 5110 | char c; | 4970 | char c; |
| 5111 | 4971 | ||
| @@ -5122,9 +4982,7 @@ REGISTER struct ioarg *ap; | |||
| 5122 | * Return the characters produced by a process (`...`). | 4982 | * Return the characters produced by a process (`...`). |
| 5123 | * Quote them if required, and remove any trailing newline characters. | 4983 | * Quote them if required, and remove any trailing newline characters. |
| 5124 | */ | 4984 | */ |
| 5125 | static int gravechar(ap, iop) | 4985 | static int gravechar(struct ioarg *ap, struct io *iop) |
| 5126 | struct ioarg *ap; | ||
| 5127 | struct io *iop; | ||
| 5128 | { | 4986 | { |
| 5129 | REGISTER int c; | 4987 | REGISTER int c; |
| 5130 | 4988 | ||
| @@ -5133,9 +4991,7 @@ struct io *iop; | |||
| 5133 | return (c); | 4991 | return (c); |
| 5134 | } | 4992 | } |
| 5135 | 4993 | ||
| 5136 | static int qgravechar(ap, iop) | 4994 | static int qgravechar(REGISTER struct ioarg *ap, struct io *iop) |
| 5137 | REGISTER struct ioarg *ap; | ||
| 5138 | struct io *iop; | ||
| 5139 | { | 4995 | { |
| 5140 | REGISTER int c; | 4996 | REGISTER int c; |
| 5141 | 4997 | ||
| @@ -5164,8 +5020,7 @@ struct io *iop; | |||
| 5164 | /* | 5020 | /* |
| 5165 | * Return a single command (usually the first line) from a file. | 5021 | * Return a single command (usually the first line) from a file. |
| 5166 | */ | 5022 | */ |
| 5167 | static int linechar(ap) | 5023 | static int linechar(REGISTER struct ioarg *ap) |
| 5168 | REGISTER struct ioarg *ap; | ||
| 5169 | { | 5024 | { |
| 5170 | REGISTER int c; | 5025 | REGISTER int c; |
| 5171 | 5026 | ||
| @@ -5178,27 +5033,24 @@ REGISTER struct ioarg *ap; | |||
| 5178 | return (c); | 5033 | return (c); |
| 5179 | } | 5034 | } |
| 5180 | 5035 | ||
| 5181 | static void prs(s) | 5036 | static void prs(REGISTER const char *s) |
| 5182 | REGISTER const char *s; | ||
| 5183 | { | 5037 | { |
| 5184 | if (*s) | 5038 | if (*s) |
| 5185 | write(2, s, strlen(s)); | 5039 | write(2, s, strlen(s)); |
| 5186 | } | 5040 | } |
| 5187 | 5041 | ||
| 5188 | static void prn(u) | 5042 | static void prn(unsigned u) |
| 5189 | unsigned u; | ||
| 5190 | { | 5043 | { |
| 5191 | prs(itoa(u)); | 5044 | prs(itoa(u)); |
| 5192 | } | 5045 | } |
| 5193 | 5046 | ||
| 5194 | static void closef(i) | 5047 | static void closef(REGISTER int i) |
| 5195 | REGISTER int i; | ||
| 5196 | { | 5048 | { |
| 5197 | if (i > 2) | 5049 | if (i > 2) |
| 5198 | close(i); | 5050 | close(i); |
| 5199 | } | 5051 | } |
| 5200 | 5052 | ||
| 5201 | static void closeall() | 5053 | static void closeall(void) |
| 5202 | { | 5054 | { |
| 5203 | REGISTER int u; | 5055 | REGISTER int u; |
| 5204 | 5056 | ||
| @@ -5210,8 +5062,7 @@ static void closeall() | |||
| 5210 | /* | 5062 | /* |
| 5211 | * remap fd into Shell's fd space | 5063 | * remap fd into Shell's fd space |
| 5212 | */ | 5064 | */ |
| 5213 | static int remap(fd) | 5065 | static int remap(REGISTER int fd) |
| 5214 | REGISTER int fd; | ||
| 5215 | { | 5066 | { |
| 5216 | REGISTER int i; | 5067 | REGISTER int i; |
| 5217 | int map[NOFILE]; | 5068 | int map[NOFILE]; |
| @@ -5241,8 +5092,7 @@ REGISTER int fd; | |||
| 5241 | return (fd); | 5092 | return (fd); |
| 5242 | } | 5093 | } |
| 5243 | 5094 | ||
| 5244 | static int openpipe(pv) | 5095 | static int openpipe(REGISTER int *pv) |
| 5245 | REGISTER int *pv; | ||
| 5246 | { | 5096 | { |
| 5247 | REGISTER int i; | 5097 | REGISTER int i; |
| 5248 | 5098 | ||
| @@ -5251,8 +5101,7 @@ REGISTER int *pv; | |||
| 5251 | return (i); | 5101 | return (i); |
| 5252 | } | 5102 | } |
| 5253 | 5103 | ||
| 5254 | static void closepipe(pv) | 5104 | static void closepipe(REGISTER int *pv) |
| 5255 | REGISTER int *pv; | ||
| 5256 | { | 5105 | { |
| 5257 | if (pv != NULL) { | 5106 | if (pv != NULL) { |
| 5258 | close(*pv++); | 5107 | close(*pv++); |
| @@ -5266,9 +5115,7 @@ REGISTER int *pv; | |||
| 5266 | * here documents | 5115 | * here documents |
| 5267 | */ | 5116 | */ |
| 5268 | 5117 | ||
| 5269 | static void markhere(s, iop) | 5118 | static void markhere(REGISTER char *s, struct ioword *iop) |
| 5270 | REGISTER char *s; | ||
| 5271 | struct ioword *iop; | ||
| 5272 | { | 5119 | { |
| 5273 | REGISTER struct here *h, *lh; | 5120 | REGISTER struct here *h, *lh; |
| 5274 | 5121 | ||
| @@ -5302,7 +5149,7 @@ struct ioword *iop; | |||
| 5302 | h->h_dosub = iop->io_flag & IOXHERE; | 5149 | h->h_dosub = iop->io_flag & IOXHERE; |
| 5303 | } | 5150 | } |
| 5304 | 5151 | ||
| 5305 | static void gethere() | 5152 | static void gethere(void) |
| 5306 | { | 5153 | { |
| 5307 | REGISTER struct here *h, *hp; | 5154 | REGISTER struct here *h, *hp; |
| 5308 | 5155 | ||
| @@ -5320,10 +5167,7 @@ static void gethere() | |||
| 5320 | } | 5167 | } |
| 5321 | } | 5168 | } |
| 5322 | 5169 | ||
| 5323 | static void readhere(name, s, ec) | 5170 | static void readhere(char **name, REGISTER char *s, int ec) |
| 5324 | char **name; | ||
| 5325 | REGISTER char *s; | ||
| 5326 | int ec; | ||
| 5327 | { | 5171 | { |
| 5328 | int tf; | 5172 | int tf; |
| 5329 | char tname[30] = ".msh_XXXXXX"; | 5173 | char tname[30] = ".msh_XXXXXX"; |
| @@ -5382,9 +5226,7 @@ int ec; | |||
| 5382 | * open here temp file. | 5226 | * open here temp file. |
| 5383 | * if unquoted here, expand here temp file into second temp file. | 5227 | * if unquoted here, expand here temp file into second temp file. |
| 5384 | */ | 5228 | */ |
| 5385 | static int herein(hname, xdoll) | 5229 | static int herein(char *hname, int xdoll) |
| 5386 | char *hname; | ||
| 5387 | int xdoll; | ||
| 5388 | { | 5230 | { |
| 5389 | REGISTER int hf; | 5231 | REGISTER int hf; |
| 5390 | int tf; | 5232 | int tf; |
| @@ -5428,7 +5270,7 @@ int xdoll; | |||
| 5428 | return (hf); | 5270 | return (hf); |
| 5429 | } | 5271 | } |
| 5430 | 5272 | ||
| 5431 | static void scraphere() | 5273 | static void scraphere(void) |
| 5432 | { | 5274 | { |
| 5433 | REGISTER struct here *h; | 5275 | REGISTER struct here *h; |
| 5434 | 5276 | ||
| @@ -5442,8 +5284,7 @@ static void scraphere() | |||
| 5442 | } | 5284 | } |
| 5443 | 5285 | ||
| 5444 | /* unlink here temp files before a freearea(area) */ | 5286 | /* unlink here temp files before a freearea(area) */ |
| 5445 | static void freehere(area) | 5287 | static void freehere(int area) |
| 5446 | int area; | ||
| 5447 | { | 5288 | { |
| 5448 | REGISTER struct here *h, *hl; | 5289 | REGISTER struct here *h, *hl; |
| 5449 | 5290 | ||
