diff options
author | Eric Andersen <andersen@codepoet.org> | 2001-05-07 22:47:45 +0000 |
---|---|---|
committer | Eric Andersen <andersen@codepoet.org> | 2001-05-07 22:47:45 +0000 |
commit | 8f3e51b4adac772957633eaa070bad011f4724ed (patch) | |
tree | 56f14e7812408aff43841a35629248526abf72ce /coreutils/stty.c | |
parent | 8d35134ad8d83acd76b32eb1e9b6255a00c4556b (diff) | |
download | busybox-w32-8f3e51b4adac772957633eaa070bad011f4724ed.tar.gz busybox-w32-8f3e51b4adac772957633eaa070bad011f4724ed.tar.bz2 busybox-w32-8f3e51b4adac772957633eaa070bad011f4724ed.zip |
Patch from Vladimir to remove testing stuff from stty
Diffstat (limited to 'coreutils/stty.c')
-rw-r--r-- | coreutils/stty.c | 67 |
1 files changed, 0 insertions, 67 deletions
diff --git a/coreutils/stty.c b/coreutils/stty.c index 0075b2210..1e1343370 100644 --- a/coreutils/stty.c +++ b/coreutils/stty.c | |||
@@ -1362,76 +1362,9 @@ static const char *visible(unsigned int ch) | |||
1362 | } | 1362 | } |
1363 | 1363 | ||
1364 | #ifdef TEST | 1364 | #ifdef TEST |
1365 | unsigned long parse_number(const char *numstr, | ||
1366 | const struct suffix_mult *suffixes) | ||
1367 | { | ||
1368 | const struct suffix_mult *sm; | ||
1369 | unsigned long int ret; | ||
1370 | int len; | ||
1371 | char *end; | ||
1372 | |||
1373 | ret = strtoul(numstr, &end, 10); | ||
1374 | if (numstr == end) | ||
1375 | error_msg_and_die("invalid number `%s'", numstr); | ||
1376 | while (end[0] != '\0') { | ||
1377 | sm = suffixes; | ||
1378 | while ( sm != 0 ) { | ||
1379 | if(sm->suffix) { | ||
1380 | len = strlen(sm->suffix); | ||
1381 | if (strncmp(sm->suffix, end, len) == 0) { | ||
1382 | ret *= sm->mult; | ||
1383 | end += len; | ||
1384 | break; | ||
1385 | } | ||
1386 | sm++; | ||
1387 | |||
1388 | } else | ||
1389 | sm = 0; | ||
1390 | } | ||
1391 | if (sm == 0) | ||
1392 | error_msg_and_die("invalid number `%s'", numstr); | ||
1393 | } | ||
1394 | return ret; | ||
1395 | } | ||
1396 | 1365 | ||
1397 | const char *applet_name = "stty"; | 1366 | const char *applet_name = "stty"; |
1398 | 1367 | ||
1399 | static void verror_msg(const char *s, va_list p) | ||
1400 | { | ||
1401 | fflush(stdout); | ||
1402 | fprintf(stderr, "%s: ", applet_name); | ||
1403 | vfprintf(stderr, s, p); | ||
1404 | } | ||
1405 | |||
1406 | extern void error_msg_and_die(const char *s, ...) | ||
1407 | { | ||
1408 | va_list p; | ||
1409 | |||
1410 | va_start(p, s); | ||
1411 | verror_msg(s, p); | ||
1412 | va_end(p); | ||
1413 | putc('\n', stderr); | ||
1414 | exit(EXIT_FAILURE); | ||
1415 | } | ||
1416 | |||
1417 | static void vperror_msg(const char *s, va_list p) | ||
1418 | { | ||
1419 | int err=errno; | ||
1420 | verror_msg(s, p); | ||
1421 | if (*s) s = ": "; | ||
1422 | fprintf(stderr, "%s%s\n", s, strerror(err)); | ||
1423 | } | ||
1424 | |||
1425 | extern void perror_msg_and_die(const char *s, ...) | ||
1426 | { | ||
1427 | va_list p; | ||
1428 | |||
1429 | va_start(p, s); | ||
1430 | vperror_msg(s, p); | ||
1431 | va_end(p); | ||
1432 | exit(EXIT_FAILURE); | ||
1433 | } | ||
1434 | |||
1435 | #endif | 1368 | #endif |
1436 | 1369 | ||
1437 | /* | 1370 | /* |