diff options
author | Erik Andersen <andersen@codepoet.org> | 2000-04-17 16:16:10 +0000 |
---|---|---|
committer | Erik Andersen <andersen@codepoet.org> | 2000-04-17 16:16:10 +0000 |
commit | e5b6c7dd9cb32852a7f5b19a9855cf3c32543396 (patch) | |
tree | afe963cde5e3882b8785c963d7d1ec07d458a85a | |
parent | 4fd10fc73be4ce707c7d55f608d47894a2d1b12c (diff) | |
download | busybox-w32-e5b6c7dd9cb32852a7f5b19a9855cf3c32543396.tar.gz busybox-w32-e5b6c7dd9cb32852a7f5b19a9855cf3c32543396.tar.bz2 busybox-w32-e5b6c7dd9cb32852a7f5b19a9855cf3c32543396.zip |
More updates to the docs, and fixes to sync things with the docs.
-Erik
-rw-r--r-- | Changelog | 1 | ||||
-rw-r--r-- | coreutils/tty.c | 4 | ||||
-rw-r--r-- | coreutils/uniq.c | 14 | ||||
-rw-r--r-- | coreutils/wc.c | 3 | ||||
-rw-r--r-- | coreutils/whoami.c | 4 | ||||
-rw-r--r-- | coreutils/yes.c | 8 | ||||
-rw-r--r-- | docs/busybox.pod | 133 | ||||
-rw-r--r-- | lash.c | 5 | ||||
-rw-r--r-- | miscutils/update.c | 16 | ||||
-rw-r--r-- | sh.c | 5 | ||||
-rw-r--r-- | shell/lash.c | 5 | ||||
-rw-r--r-- | tty.c | 4 | ||||
-rw-r--r-- | uniq.c | 14 | ||||
-rw-r--r-- | update.c | 16 | ||||
-rw-r--r-- | wc.c | 3 | ||||
-rw-r--r-- | whoami.c | 4 | ||||
-rw-r--r-- | yes.c | 8 |
17 files changed, 182 insertions, 65 deletions
@@ -1,4 +1,5 @@ | |||
1 | 0.43 | 1 | 0.43 |
2 | * Major update to the provided documentation. | ||
2 | * Busybox now includes a shell! It currently costs 7.5 k (plus an | 3 | * Busybox now includes a shell! It currently costs 7.5 k (plus an |
3 | additional 2.5 k if you compile in command line editing). Handles | 4 | additional 2.5 k if you compile in command line editing). Handles |
4 | job control, has the usual set of builtins, and does everything | 5 | job control, has the usual set of builtins, and does everything |
diff --git a/coreutils/tty.c b/coreutils/tty.c index 8ac1c1fcd..6f98d1b79 100644 --- a/coreutils/tty.c +++ b/coreutils/tty.c | |||
@@ -25,8 +25,8 @@ | |||
25 | #include <sys/types.h> | 25 | #include <sys/types.h> |
26 | 26 | ||
27 | static const char tty_usage[] = "tty\n\n" | 27 | static const char tty_usage[] = "tty\n\n" |
28 | "Print the file name of the terminal connected to standard input.\n" | 28 | "Print the file name of the terminal connected to standard input.\n\n" |
29 | 29 | "Options:\n" | |
30 | "\t-s\tprint nothing, only return an exit status\n"; | 30 | "\t-s\tprint nothing, only return an exit status\n"; |
31 | 31 | ||
32 | extern int tty_main(int argc, char **argv) | 32 | extern int tty_main(int argc, char **argv) |
diff --git a/coreutils/uniq.c b/coreutils/uniq.c index 2eedb886d..0324856fd 100644 --- a/coreutils/uniq.c +++ b/coreutils/uniq.c | |||
@@ -28,15 +28,9 @@ | |||
28 | #include <errno.h> | 28 | #include <errno.h> |
29 | 29 | ||
30 | static const char uniq_usage[] = | 30 | static const char uniq_usage[] = |
31 | "uniq [OPTION]... [INPUT [OUTPUT]]\n" | 31 | "uniq [OPTION]... [INPUT [OUTPUT]]\n\n" |
32 | "Discard all but one of successive identical lines from INPUT (or\n" | 32 | "Discard all but one of successive identical lines from INPUT\n" |
33 | "standard input), writing to OUTPUT (or standard output).\n" | 33 | "(or standard input), writing to OUTPUT (or standard output).\n"; |
34 | "\n" | ||
35 | "\t-h\tdisplay this help and exit\n" | ||
36 | |||
37 | "\n" | ||
38 | "A field is a run of whitespace, then non-whitespace characters.\n" | ||
39 | "Fields are skipped before chars.\n"; | ||
40 | 34 | ||
41 | /* max chars in line */ | 35 | /* max chars in line */ |
42 | #define UNIQ_MAX 4096 | 36 | #define UNIQ_MAX 4096 |
@@ -190,4 +184,4 @@ int uniq_main(int argc, char **argv) | |||
190 | exit(0); | 184 | exit(0); |
191 | } | 185 | } |
192 | 186 | ||
193 | /* $Id: uniq.c,v 1.8 2000/04/13 01:18:56 erik Exp $ */ | 187 | /* $Id: uniq.c,v 1.9 2000/04/17 16:16:10 erik Exp $ */ |
diff --git a/coreutils/wc.c b/coreutils/wc.c index 8004e6294..030afa9d6 100644 --- a/coreutils/wc.c +++ b/coreutils/wc.c | |||
@@ -25,7 +25,8 @@ | |||
25 | 25 | ||
26 | static const char wc_usage[] = "wc [OPTION]... [FILE]...\n\n" | 26 | static const char wc_usage[] = "wc [OPTION]... [FILE]...\n\n" |
27 | "Print line, word, and byte counts for each FILE, and a total line if\n" | 27 | "Print line, word, and byte counts for each FILE, and a total line if\n" |
28 | "more than one FILE is specified. With no FILE, read standard input.\n" | 28 | "more than one FILE is specified. With no FILE, read standard input.\n\n" |
29 | "Options:\n" | ||
29 | "\t-c\tprint the byte counts\n" | 30 | "\t-c\tprint the byte counts\n" |
30 | "\t-l\tprint the newline counts\n" | 31 | "\t-l\tprint the newline counts\n" |
31 | 32 | ||
diff --git a/coreutils/whoami.c b/coreutils/whoami.c index 3677c2fbc..5c3fea13f 100644 --- a/coreutils/whoami.c +++ b/coreutils/whoami.c | |||
@@ -25,9 +25,7 @@ | |||
25 | #include <pwd.h> | 25 | #include <pwd.h> |
26 | 26 | ||
27 | static const char whoami_usage[] = "whoami\n\n" | 27 | static const char whoami_usage[] = "whoami\n\n" |
28 | "Print the user name associated with the current effective user id.\n" | 28 | "Prints the user name associated with the current effective user id.\n"; |
29 | |||
30 | "Same as id -un.\n"; | ||
31 | 29 | ||
32 | extern int whoami_main(int argc, char **argv) | 30 | extern int whoami_main(int argc, char **argv) |
33 | { | 31 | { |
diff --git a/coreutils/yes.c b/coreutils/yes.c index ac67845ac..a822ebc1d 100644 --- a/coreutils/yes.c +++ b/coreutils/yes.c | |||
@@ -27,12 +27,18 @@ extern int yes_main(int argc, char **argv) | |||
27 | { | 27 | { |
28 | int i; | 28 | int i; |
29 | 29 | ||
30 | if (argc == 1) | 30 | if (argc >=1 && *argv[1]=='-') { |
31 | usage("yes [OPTION]... [STRING]...\n\n" | ||
32 | "Repeatedly outputs a line with all specified STRING(s), or `y'.\n"); | ||
33 | } | ||
34 | |||
35 | if (argc == 1) { | ||
31 | while (1) | 36 | while (1) |
32 | if (puts("y") == EOF) { | 37 | if (puts("y") == EOF) { |
33 | perror("yes"); | 38 | perror("yes"); |
34 | exit(FALSE); | 39 | exit(FALSE); |
35 | } | 40 | } |
41 | } | ||
36 | 42 | ||
37 | while (1) | 43 | while (1) |
38 | for (i = 1; i < argc; i++) | 44 | for (i = 1; i < argc; i++) |
diff --git a/docs/busybox.pod b/docs/busybox.pod index e1d2f4804..9926cffd2 100644 --- a/docs/busybox.pod +++ b/docs/busybox.pod | |||
@@ -1290,6 +1290,10 @@ Example: | |||
1290 | 1290 | ||
1291 | =item sh | 1291 | =item sh |
1292 | 1292 | ||
1293 | Usage: sh | ||
1294 | |||
1295 | lash -- the BusyBox LAme SHell (command interpreter) | ||
1296 | |||
1293 | FIXME | 1297 | FIXME |
1294 | 1298 | ||
1295 | ------------------------------- | 1299 | ------------------------------- |
@@ -1528,12 +1532,10 @@ Example: | |||
1528 | 1532 | ||
1529 | =item tr | 1533 | =item tr |
1530 | 1534 | ||
1531 | Usage: | 1535 | Usage: tr [-csu] string1 string2 |
1532 | 1536 | tr [-cu] -d string1 | |
1533 | tr [-csu] string1 string2 | 1537 | tr [-cu] -s string1 |
1534 | tr [-cu] -d string1 | 1538 | tr [-cu] -ds string1 string2 |
1535 | tr [-cu] -s string1 | ||
1536 | tr [-cu] -ds string1 string2 | ||
1537 | 1539 | ||
1538 | Translate, squeeze, and/or delete characters from standard | 1540 | Translate, squeeze, and/or delete characters from standard |
1539 | input, writing to standard output. | 1541 | input, writing to standard output. |
@@ -1559,67 +1561,162 @@ Example: | |||
1559 | 1561 | ||
1560 | =item tty | 1562 | =item tty |
1561 | 1563 | ||
1562 | FIXME | 1564 | Usage: tty |
1565 | |||
1566 | Print the file name of the terminal connected to standard input. | ||
1567 | |||
1568 | Options: | ||
1569 | |||
1570 | -s print nothing, only return an exit status | ||
1571 | |||
1572 | Example: | ||
1573 | |||
1574 | $ tty | ||
1575 | /dev/tty2 | ||
1563 | 1576 | ||
1564 | ------------------------------- | 1577 | ------------------------------- |
1565 | 1578 | ||
1566 | =item umount | 1579 | =item umount |
1567 | 1580 | ||
1568 | FIXME | 1581 | Usage: umount [flags] filesystem|directory |
1582 | |||
1583 | Flags: | ||
1584 | |||
1585 | -a: Unmount all file systems | ||
1586 | -r: Try to remount devices as read-only if mount is busy | ||
1587 | -f: Do not free loop device (if a loop device has been used) | ||
1588 | |||
1589 | Example: | ||
1590 | |||
1591 | $ umount /dev/hdc1 | ||
1569 | 1592 | ||
1570 | ------------------------------- | 1593 | ------------------------------- |
1571 | 1594 | ||
1572 | =item uname | 1595 | =item uname |
1573 | 1596 | ||
1574 | FIXME | 1597 | Usage: uname [OPTION]... |
1598 | |||
1599 | Print certain system information. With no OPTION, same as -s. | ||
1600 | |||
1601 | Options: | ||
1602 | |||
1603 | -a print all information | ||
1604 | -m the machine (hardware) type | ||
1605 | -n print the machine's network node hostname | ||
1606 | -r print the operating system release | ||
1607 | -s print the operating system name | ||
1608 | -p print the host processor type | ||
1609 | -v print the operating system version | ||
1610 | |||
1611 | Example: | ||
1612 | |||
1613 | $ uname -a | ||
1614 | Linux debian 2.2.15pre13 #5 Tue Mar 14 16:03:50 MST 2000 i686 unknown | ||
1575 | 1615 | ||
1576 | ------------------------------- | 1616 | ------------------------------- |
1577 | 1617 | ||
1578 | =item uniq | 1618 | =item uniq |
1579 | 1619 | ||
1580 | FIXME | 1620 | Usage: uniq [OPTION]... [INPUT [OUTPUT]] |
1621 | |||
1622 | Discard all but one of successive identical lines from INPUT | ||
1623 | (or standard input), writing to OUTPUT (or standard output). | ||
1624 | |||
1625 | Example: | ||
1626 | |||
1627 | $ echo -e "a\na\nb\nc\nc\na" | sort | uniq | ||
1628 | a | ||
1629 | b | ||
1630 | c | ||
1581 | 1631 | ||
1582 | ------------------------------- | 1632 | ------------------------------- |
1583 | 1633 | ||
1584 | =item update | 1634 | =item update |
1585 | 1635 | ||
1586 | FIXME | 1636 | Usage: update [options] |
1637 | |||
1638 | Periodically flushes filesystem buffers. | ||
1639 | |||
1640 | Options: | ||
1641 | |||
1642 | -S force use of sync(2) instead of flushing | ||
1643 | -s SECS call sync this often (default 30) | ||
1644 | -f SECS flush some buffers this often (default 5) | ||
1587 | 1645 | ||
1588 | ------------------------------- | 1646 | ------------------------------- |
1589 | 1647 | ||
1590 | =item uptime | 1648 | =item uptime |
1591 | 1649 | ||
1592 | FIXME | 1650 | Usage: uptime |
1651 | |||
1652 | Tells how long the system has been running since boot. | ||
1653 | |||
1654 | Example: | ||
1655 | |||
1656 | $ uptime | ||
1657 | 1:55pm up 2:30, load average: 0.09, 0.04, 0.00 | ||
1593 | 1658 | ||
1594 | ------------------------------- | 1659 | ------------------------------- |
1595 | 1660 | ||
1596 | =item usleep | 1661 | =item usleep |
1597 | 1662 | ||
1598 | FIXME | 1663 | Usage: usleep N |
1664 | |||
1665 | Pauses for N microseconds. | ||
1666 | |||
1667 | Example: | ||
1668 | |||
1669 | $ usleep 1000000 | ||
1670 | [pauses for 1 second] | ||
1599 | 1671 | ||
1600 | ------------------------------- | 1672 | ------------------------------- |
1601 | 1673 | ||
1602 | =item wc | 1674 | =item wc |
1603 | 1675 | ||
1604 | FIXME | 1676 | Usage: wc [OPTION]... [FILE]... |
1677 | |||
1678 | Print line, word, and byte counts for each FILE, and a total line if | ||
1679 | more than one FILE is specified. With no FILE, read standard input. | ||
1680 | |||
1681 | Options: | ||
1682 | |||
1683 | -c print the byte counts | ||
1684 | -l print the newline counts | ||
1685 | -L print the length of the longest line | ||
1686 | -w print the word counts | ||
1687 | |||
1688 | Example: | ||
1689 | |||
1690 | $ wc /etc/passwd | ||
1691 | 31 46 1365 /etc/passwd | ||
1605 | 1692 | ||
1606 | ------------------------------- | 1693 | ------------------------------- |
1607 | 1694 | ||
1608 | =item whoami | 1695 | =item whoami |
1609 | 1696 | ||
1610 | FIXME | 1697 | Usage: whoami |
1698 | |||
1699 | Prints the user name associated with the current effective user id. | ||
1700 | |||
1701 | Example: | ||
1702 | |||
1703 | $ whoami | ||
1704 | andersen | ||
1611 | 1705 | ||
1612 | ------------------------------- | 1706 | ------------------------------- |
1613 | 1707 | ||
1614 | =item yes | 1708 | =item yes |
1615 | 1709 | ||
1616 | FIXME | 1710 | Usage: yes [OPTION]... [STRING]... |
1711 | |||
1712 | Repeatedly outputs a line with all specified STRING(s), or `y'. | ||
1617 | 1713 | ||
1618 | ------------------------------- | 1714 | ------------------------------- |
1619 | 1715 | ||
1620 | =item zcat | 1716 | =item zcat |
1621 | 1717 | ||
1622 | FIXME | 1718 | This is essentially an alias for invoking "gunzip -c", where |
1719 | it decompresses the file inquestion and send the output to stdout. | ||
1623 | 1720 | ||
1624 | ------------------------------- | 1721 | ------------------------------- |
1625 | 1722 | ||
@@ -1684,4 +1781,4 @@ Enrique Zanardi <ezanardi@ull.es> | |||
1684 | 1781 | ||
1685 | =cut | 1782 | =cut |
1686 | 1783 | ||
1687 | # $Id: busybox.pod,v 1.12 2000/04/17 05:13:59 beppu Exp $ | 1784 | # $Id: busybox.pod,v 1.13 2000/04/17 16:16:10 erik Exp $ |
@@ -961,9 +961,12 @@ int shell_main(int argc, char **argv) | |||
961 | fprintf(stdout, "\n\nBusyBox v%s (%s) Built-in shell\n", BB_VER, BB_BT); | 961 | fprintf(stdout, "\n\nBusyBox v%s (%s) Built-in shell\n", BB_VER, BB_BT); |
962 | fprintf(stdout, "Enter 'help' for a list of built-in commands.\n\n"); | 962 | fprintf(stdout, "Enter 'help' for a list of built-in commands.\n\n"); |
963 | } else { | 963 | } else { |
964 | if (*argv[1]=='-') { | ||
965 | usage("sh\n\nlash -- the BusyBox LAme SHell (command interpreter)\n"); | ||
966 | } | ||
964 | input = fopen(argv[1], "r"); | 967 | input = fopen(argv[1], "r"); |
965 | if (!input) { | 968 | if (!input) { |
966 | fatalError("A: Couldn't open file '%s': %s\n", argv[1], | 969 | fatalError("sh: Couldn't open file '%s': %s\n", argv[1], |
967 | strerror(errno)); | 970 | strerror(errno)); |
968 | } | 971 | } |
969 | } | 972 | } |
diff --git a/miscutils/update.c b/miscutils/update.c index bb77c5f1f..1e3e032fd 100644 --- a/miscutils/update.c +++ b/miscutils/update.c | |||
@@ -35,10 +35,12 @@ _syscall2(int, bdflush, int, func, int, data); | |||
35 | #endif /* __GLIBC__ */ | 35 | #endif /* __GLIBC__ */ |
36 | 36 | ||
37 | static char update_usage[] = | 37 | static char update_usage[] = |
38 | "update [options]\n" | 38 | "update [options]\n\n" |
39 | " -S\tforce use of sync(2) instead of flushing\n" | 39 | "Periodically flushes filesystem buffers.\n\n" |
40 | " -s SECS\tcall sync this often (default 30)\n" | 40 | "Options:\n" |
41 | " -f SECS\tflush some buffers this often (default 5)\n"; | 41 | "\t-S\tforce use of sync(2) instead of flushing\n" |
42 | "\t-s SECS\tcall sync this often (default 30)\n" | ||
43 | "\t-f SECS\tflush some buffers this often (default 5)\n"; | ||
42 | 44 | ||
43 | static unsigned int sync_duration = 30; | 45 | static unsigned int sync_duration = 30; |
44 | static unsigned int flush_duration = 5; | 46 | static unsigned int flush_duration = 5; |
@@ -48,6 +50,8 @@ extern int update_main(int argc, char **argv) | |||
48 | { | 50 | { |
49 | int pid; | 51 | int pid; |
50 | 52 | ||
53 | argc--; | ||
54 | argv++; | ||
51 | while (**argv == '-') { | 55 | while (**argv == '-') { |
52 | while (*++(*argv)) { | 56 | while (*++(*argv)) { |
53 | switch (**argv) { | 57 | switch (**argv) { |
@@ -62,6 +66,8 @@ extern int update_main(int argc, char **argv) | |||
62 | if (--argc < 1) usage(update_usage); | 66 | if (--argc < 1) usage(update_usage); |
63 | flush_duration = atoi(*(++argv)); | 67 | flush_duration = atoi(*(++argv)); |
64 | break; | 68 | break; |
69 | default: | ||
70 | usage(update_usage); | ||
65 | } | 71 | } |
66 | } | 72 | } |
67 | argc--; | 73 | argc--; |
@@ -100,7 +106,7 @@ extern int update_main(int argc, char **argv) | |||
100 | } | 106 | } |
101 | } | 107 | } |
102 | } | 108 | } |
103 | return TRUE; | 109 | exit( TRUE); |
104 | } | 110 | } |
105 | 111 | ||
106 | /* | 112 | /* |
@@ -961,9 +961,12 @@ int shell_main(int argc, char **argv) | |||
961 | fprintf(stdout, "\n\nBusyBox v%s (%s) Built-in shell\n", BB_VER, BB_BT); | 961 | fprintf(stdout, "\n\nBusyBox v%s (%s) Built-in shell\n", BB_VER, BB_BT); |
962 | fprintf(stdout, "Enter 'help' for a list of built-in commands.\n\n"); | 962 | fprintf(stdout, "Enter 'help' for a list of built-in commands.\n\n"); |
963 | } else { | 963 | } else { |
964 | if (*argv[1]=='-') { | ||
965 | usage("sh\n\nlash -- the BusyBox LAme SHell (command interpreter)\n"); | ||
966 | } | ||
964 | input = fopen(argv[1], "r"); | 967 | input = fopen(argv[1], "r"); |
965 | if (!input) { | 968 | if (!input) { |
966 | fatalError("A: Couldn't open file '%s': %s\n", argv[1], | 969 | fatalError("sh: Couldn't open file '%s': %s\n", argv[1], |
967 | strerror(errno)); | 970 | strerror(errno)); |
968 | } | 971 | } |
969 | } | 972 | } |
diff --git a/shell/lash.c b/shell/lash.c index 44ffe968f..bd95ba761 100644 --- a/shell/lash.c +++ b/shell/lash.c | |||
@@ -961,9 +961,12 @@ int shell_main(int argc, char **argv) | |||
961 | fprintf(stdout, "\n\nBusyBox v%s (%s) Built-in shell\n", BB_VER, BB_BT); | 961 | fprintf(stdout, "\n\nBusyBox v%s (%s) Built-in shell\n", BB_VER, BB_BT); |
962 | fprintf(stdout, "Enter 'help' for a list of built-in commands.\n\n"); | 962 | fprintf(stdout, "Enter 'help' for a list of built-in commands.\n\n"); |
963 | } else { | 963 | } else { |
964 | if (*argv[1]=='-') { | ||
965 | usage("sh\n\nlash -- the BusyBox LAme SHell (command interpreter)\n"); | ||
966 | } | ||
964 | input = fopen(argv[1], "r"); | 967 | input = fopen(argv[1], "r"); |
965 | if (!input) { | 968 | if (!input) { |
966 | fatalError("A: Couldn't open file '%s': %s\n", argv[1], | 969 | fatalError("sh: Couldn't open file '%s': %s\n", argv[1], |
967 | strerror(errno)); | 970 | strerror(errno)); |
968 | } | 971 | } |
969 | } | 972 | } |
@@ -25,8 +25,8 @@ | |||
25 | #include <sys/types.h> | 25 | #include <sys/types.h> |
26 | 26 | ||
27 | static const char tty_usage[] = "tty\n\n" | 27 | static const char tty_usage[] = "tty\n\n" |
28 | "Print the file name of the terminal connected to standard input.\n" | 28 | "Print the file name of the terminal connected to standard input.\n\n" |
29 | 29 | "Options:\n" | |
30 | "\t-s\tprint nothing, only return an exit status\n"; | 30 | "\t-s\tprint nothing, only return an exit status\n"; |
31 | 31 | ||
32 | extern int tty_main(int argc, char **argv) | 32 | extern int tty_main(int argc, char **argv) |
@@ -28,15 +28,9 @@ | |||
28 | #include <errno.h> | 28 | #include <errno.h> |
29 | 29 | ||
30 | static const char uniq_usage[] = | 30 | static const char uniq_usage[] = |
31 | "uniq [OPTION]... [INPUT [OUTPUT]]\n" | 31 | "uniq [OPTION]... [INPUT [OUTPUT]]\n\n" |
32 | "Discard all but one of successive identical lines from INPUT (or\n" | 32 | "Discard all but one of successive identical lines from INPUT\n" |
33 | "standard input), writing to OUTPUT (or standard output).\n" | 33 | "(or standard input), writing to OUTPUT (or standard output).\n"; |
34 | "\n" | ||
35 | "\t-h\tdisplay this help and exit\n" | ||
36 | |||
37 | "\n" | ||
38 | "A field is a run of whitespace, then non-whitespace characters.\n" | ||
39 | "Fields are skipped before chars.\n"; | ||
40 | 34 | ||
41 | /* max chars in line */ | 35 | /* max chars in line */ |
42 | #define UNIQ_MAX 4096 | 36 | #define UNIQ_MAX 4096 |
@@ -190,4 +184,4 @@ int uniq_main(int argc, char **argv) | |||
190 | exit(0); | 184 | exit(0); |
191 | } | 185 | } |
192 | 186 | ||
193 | /* $Id: uniq.c,v 1.8 2000/04/13 01:18:56 erik Exp $ */ | 187 | /* $Id: uniq.c,v 1.9 2000/04/17 16:16:10 erik Exp $ */ |
@@ -35,10 +35,12 @@ _syscall2(int, bdflush, int, func, int, data); | |||
35 | #endif /* __GLIBC__ */ | 35 | #endif /* __GLIBC__ */ |
36 | 36 | ||
37 | static char update_usage[] = | 37 | static char update_usage[] = |
38 | "update [options]\n" | 38 | "update [options]\n\n" |
39 | " -S\tforce use of sync(2) instead of flushing\n" | 39 | "Periodically flushes filesystem buffers.\n\n" |
40 | " -s SECS\tcall sync this often (default 30)\n" | 40 | "Options:\n" |
41 | " -f SECS\tflush some buffers this often (default 5)\n"; | 41 | "\t-S\tforce use of sync(2) instead of flushing\n" |
42 | "\t-s SECS\tcall sync this often (default 30)\n" | ||
43 | "\t-f SECS\tflush some buffers this often (default 5)\n"; | ||
42 | 44 | ||
43 | static unsigned int sync_duration = 30; | 45 | static unsigned int sync_duration = 30; |
44 | static unsigned int flush_duration = 5; | 46 | static unsigned int flush_duration = 5; |
@@ -48,6 +50,8 @@ extern int update_main(int argc, char **argv) | |||
48 | { | 50 | { |
49 | int pid; | 51 | int pid; |
50 | 52 | ||
53 | argc--; | ||
54 | argv++; | ||
51 | while (**argv == '-') { | 55 | while (**argv == '-') { |
52 | while (*++(*argv)) { | 56 | while (*++(*argv)) { |
53 | switch (**argv) { | 57 | switch (**argv) { |
@@ -62,6 +66,8 @@ extern int update_main(int argc, char **argv) | |||
62 | if (--argc < 1) usage(update_usage); | 66 | if (--argc < 1) usage(update_usage); |
63 | flush_duration = atoi(*(++argv)); | 67 | flush_duration = atoi(*(++argv)); |
64 | break; | 68 | break; |
69 | default: | ||
70 | usage(update_usage); | ||
65 | } | 71 | } |
66 | } | 72 | } |
67 | argc--; | 73 | argc--; |
@@ -100,7 +106,7 @@ extern int update_main(int argc, char **argv) | |||
100 | } | 106 | } |
101 | } | 107 | } |
102 | } | 108 | } |
103 | return TRUE; | 109 | exit( TRUE); |
104 | } | 110 | } |
105 | 111 | ||
106 | /* | 112 | /* |
@@ -25,7 +25,8 @@ | |||
25 | 25 | ||
26 | static const char wc_usage[] = "wc [OPTION]... [FILE]...\n\n" | 26 | static const char wc_usage[] = "wc [OPTION]... [FILE]...\n\n" |
27 | "Print line, word, and byte counts for each FILE, and a total line if\n" | 27 | "Print line, word, and byte counts for each FILE, and a total line if\n" |
28 | "more than one FILE is specified. With no FILE, read standard input.\n" | 28 | "more than one FILE is specified. With no FILE, read standard input.\n\n" |
29 | "Options:\n" | ||
29 | "\t-c\tprint the byte counts\n" | 30 | "\t-c\tprint the byte counts\n" |
30 | "\t-l\tprint the newline counts\n" | 31 | "\t-l\tprint the newline counts\n" |
31 | 32 | ||
@@ -25,9 +25,7 @@ | |||
25 | #include <pwd.h> | 25 | #include <pwd.h> |
26 | 26 | ||
27 | static const char whoami_usage[] = "whoami\n\n" | 27 | static const char whoami_usage[] = "whoami\n\n" |
28 | "Print the user name associated with the current effective user id.\n" | 28 | "Prints the user name associated with the current effective user id.\n"; |
29 | |||
30 | "Same as id -un.\n"; | ||
31 | 29 | ||
32 | extern int whoami_main(int argc, char **argv) | 30 | extern int whoami_main(int argc, char **argv) |
33 | { | 31 | { |
@@ -27,12 +27,18 @@ extern int yes_main(int argc, char **argv) | |||
27 | { | 27 | { |
28 | int i; | 28 | int i; |
29 | 29 | ||
30 | if (argc == 1) | 30 | if (argc >=1 && *argv[1]=='-') { |
31 | usage("yes [OPTION]... [STRING]...\n\n" | ||
32 | "Repeatedly outputs a line with all specified STRING(s), or `y'.\n"); | ||
33 | } | ||
34 | |||
35 | if (argc == 1) { | ||
31 | while (1) | 36 | while (1) |
32 | if (puts("y") == EOF) { | 37 | if (puts("y") == EOF) { |
33 | perror("yes"); | 38 | perror("yes"); |
34 | exit(FALSE); | 39 | exit(FALSE); |
35 | } | 40 | } |
41 | } | ||
36 | 42 | ||
37 | while (1) | 43 | while (1) |
38 | for (i = 1; i < argc; i++) | 44 | for (i = 1; i < argc; i++) |