Erik Andersen | e49d5ec | 2000-02-08 19:58:47 +0000 | [diff] [blame] | 1 | /* vi: set sw=4 ts=4: */ |
Eric Andersen | cc8ed39 | 1999-10-05 16:24:54 +0000 | [diff] [blame] | 2 | #include "internal.h" |
| 3 | #include <stdio.h> |
| 4 | #include <string.h> |
| 5 | #include <errno.h> |
| 6 | |
Pavel Roskin | 9c5fcc3 | 2000-07-17 23:45:12 +0000 | [diff] [blame] | 7 | #define bb_need_full_version |
| 8 | #define BB_DECLARE_EXTERN |
| 9 | #include "messages.c" |
| 10 | |
Eric Andersen | cc8ed39 | 1999-10-05 16:24:54 +0000 | [diff] [blame] | 11 | static int been_there_done_that = 0; |
| 12 | |
Erik Andersen | bcd6177 | 2000-05-13 06:33:19 +0000 | [diff] [blame] | 13 | const struct BB_applet applets[] = { |
Eric Andersen | cc8ed39 | 1999-10-05 16:24:54 +0000 | [diff] [blame] | 14 | |
Eric Andersen | 86ab8a3 | 2000-06-02 03:21:42 +0000 | [diff] [blame] | 15 | #ifdef BB_AR |
Matt Kraai | 27a8042 | 2000-07-19 19:24:01 +0000 | [diff] [blame] | 16 | {"ar", ar_main, _BB_DIR_USR_BIN, ar_usage}, |
Eric Andersen | 86ab8a3 | 2000-06-02 03:21:42 +0000 | [diff] [blame] | 17 | #endif |
Erik Andersen | 298854f | 2000-03-23 01:09:18 +0000 | [diff] [blame] | 18 | #ifdef BB_BASENAME |
Matt Kraai | 27a8042 | 2000-07-19 19:24:01 +0000 | [diff] [blame] | 19 | {"basename", basename_main, _BB_DIR_USR_BIN, basename_usage}, |
Erik Andersen | e272915 | 2000-02-18 21:34:17 +0000 | [diff] [blame] | 20 | #endif |
Matt Kraai | 27a8042 | 2000-07-19 19:24:01 +0000 | [diff] [blame] | 21 | {"busybox", busybox_main, _BB_DIR_BIN, NULL}, |
Erik Andersen | 298854f | 2000-03-23 01:09:18 +0000 | [diff] [blame] | 22 | #ifdef BB_CAT |
Matt Kraai | 27a8042 | 2000-07-19 19:24:01 +0000 | [diff] [blame] | 23 | {"cat", cat_main, _BB_DIR_BIN, cat_usage}, |
Eric Andersen | cc8ed39 | 1999-10-05 16:24:54 +0000 | [diff] [blame] | 24 | #endif |
Erik Andersen | 298854f | 2000-03-23 01:09:18 +0000 | [diff] [blame] | 25 | #ifdef BB_CHMOD_CHOWN_CHGRP |
Matt Kraai | 27a8042 | 2000-07-19 19:24:01 +0000 | [diff] [blame] | 26 | {"chgrp", chmod_chown_chgrp_main, _BB_DIR_BIN, chgrp_usage}, |
Erik Andersen | 5e1189e | 2000-04-15 16:34:54 +0000 | [diff] [blame] | 27 | #endif |
| 28 | #ifdef BB_CHMOD_CHOWN_CHGRP |
Matt Kraai | 27a8042 | 2000-07-19 19:24:01 +0000 | [diff] [blame] | 29 | {"chmod", chmod_chown_chgrp_main, _BB_DIR_BIN, chmod_usage}, |
Erik Andersen | d75af99 | 2000-03-16 08:09:09 +0000 | [diff] [blame] | 30 | #endif |
Erik Andersen | 298854f | 2000-03-23 01:09:18 +0000 | [diff] [blame] | 31 | #ifdef BB_CHMOD_CHOWN_CHGRP |
Matt Kraai | 27a8042 | 2000-07-19 19:24:01 +0000 | [diff] [blame] | 32 | {"chown", chmod_chown_chgrp_main, _BB_DIR_BIN, chown_usage}, |
Erik Andersen | d75af99 | 2000-03-16 08:09:09 +0000 | [diff] [blame] | 33 | #endif |
Erik Andersen | 298854f | 2000-03-23 01:09:18 +0000 | [diff] [blame] | 34 | #ifdef BB_CHROOT |
Eric Andersen | 88f50b6 | 2000-08-10 17:59:11 +0000 | [diff] [blame] | 35 | {"chroot", chroot_main, _BB_DIR_USR_SBIN, chroot_usage}, |
Eric Andersen | cc8ed39 | 1999-10-05 16:24:54 +0000 | [diff] [blame] | 36 | #endif |
Erik Andersen | 298854f | 2000-03-23 01:09:18 +0000 | [diff] [blame] | 37 | #ifdef BB_CLEAR |
Matt Kraai | 27a8042 | 2000-07-19 19:24:01 +0000 | [diff] [blame] | 38 | {"clear", clear_main, _BB_DIR_USR_BIN, clear_usage}, |
Eric Andersen | cc8ed39 | 1999-10-05 16:24:54 +0000 | [diff] [blame] | 39 | #endif |
Erik Andersen | 298854f | 2000-03-23 01:09:18 +0000 | [diff] [blame] | 40 | #ifdef BB_CHVT |
Matt Kraai | 27a8042 | 2000-07-19 19:24:01 +0000 | [diff] [blame] | 41 | {"chvt", chvt_main, _BB_DIR_USR_BIN, chvt_usage}, |
Eric Andersen | abc0f4f | 1999-12-08 23:19:36 +0000 | [diff] [blame] | 42 | #endif |
Erik Andersen | 298854f | 2000-03-23 01:09:18 +0000 | [diff] [blame] | 43 | #ifdef BB_CP_MV |
Matt Kraai | 27a8042 | 2000-07-19 19:24:01 +0000 | [diff] [blame] | 44 | {"cp", cp_mv_main, _BB_DIR_BIN, cp_usage}, |
Erik Andersen | d75af99 | 2000-03-16 08:09:09 +0000 | [diff] [blame] | 45 | #endif |
Erik Andersen | 7ab9c7e | 2000-05-12 19:41:47 +0000 | [diff] [blame] | 46 | #ifdef BB_CUT |
Matt Kraai | 27a8042 | 2000-07-19 19:24:01 +0000 | [diff] [blame] | 47 | {"cut", cut_main, _BB_DIR_USR_BIN, cut_usage}, |
Erik Andersen | 7ab9c7e | 2000-05-12 19:41:47 +0000 | [diff] [blame] | 48 | #endif |
Erik Andersen | 298854f | 2000-03-23 01:09:18 +0000 | [diff] [blame] | 49 | #ifdef BB_DATE |
Matt Kraai | 27a8042 | 2000-07-19 19:24:01 +0000 | [diff] [blame] | 50 | {"date", date_main, _BB_DIR_BIN, date_usage}, |
Eric Andersen | cc8ed39 | 1999-10-05 16:24:54 +0000 | [diff] [blame] | 51 | #endif |
John Beppu | 0021679 | 2000-06-21 19:06:16 +0000 | [diff] [blame] | 52 | #ifdef BB_DC |
Matt Kraai | 27a8042 | 2000-07-19 19:24:01 +0000 | [diff] [blame] | 53 | {"dc", dc_main, _BB_DIR_USR_BIN, dc_usage}, |
John Beppu | 0021679 | 2000-06-21 19:06:16 +0000 | [diff] [blame] | 54 | #endif |
Erik Andersen | 298854f | 2000-03-23 01:09:18 +0000 | [diff] [blame] | 55 | #ifdef BB_DD |
Matt Kraai | 27a8042 | 2000-07-19 19:24:01 +0000 | [diff] [blame] | 56 | {"dd", dd_main, _BB_DIR_BIN, dd_usage}, |
Eric Andersen | cc8ed39 | 1999-10-05 16:24:54 +0000 | [diff] [blame] | 57 | #endif |
Erik Andersen | 298854f | 2000-03-23 01:09:18 +0000 | [diff] [blame] | 58 | #ifdef BB_DF |
Matt Kraai | 27a8042 | 2000-07-19 19:24:01 +0000 | [diff] [blame] | 59 | {"df", df_main, _BB_DIR_BIN, df_usage}, |
Eric Andersen | cc8ed39 | 1999-10-05 16:24:54 +0000 | [diff] [blame] | 60 | #endif |
Erik Andersen | 298854f | 2000-03-23 01:09:18 +0000 | [diff] [blame] | 61 | #ifdef BB_DIRNAME |
Matt Kraai | 27a8042 | 2000-07-19 19:24:01 +0000 | [diff] [blame] | 62 | {"dirname", dirname_main, _BB_DIR_USR_BIN, dirname_usage}, |
Erik Andersen | fb002d0 | 2000-03-05 08:07:00 +0000 | [diff] [blame] | 63 | #endif |
Erik Andersen | 298854f | 2000-03-23 01:09:18 +0000 | [diff] [blame] | 64 | #ifdef BB_DMESG |
Matt Kraai | 27a8042 | 2000-07-19 19:24:01 +0000 | [diff] [blame] | 65 | {"dmesg", dmesg_main, _BB_DIR_BIN, dmesg_usage}, |
Eric Andersen | cc8ed39 | 1999-10-05 16:24:54 +0000 | [diff] [blame] | 66 | #endif |
Eric Andersen | cff3fe3 | 2000-09-20 19:22:26 +0000 | [diff] [blame] | 67 | #ifdef BB_DOS2UNIX |
| 68 | {"dos2unix", dos2unix_main, _BB_DIR_USR_BIN, dos2unix_usage}, |
| 69 | #endif |
Erik Andersen | 298854f | 2000-03-23 01:09:18 +0000 | [diff] [blame] | 70 | #ifdef BB_DU |
Eric Andersen | 88f50b6 | 2000-08-10 17:59:11 +0000 | [diff] [blame] | 71 | {"du", du_main, _BB_DIR_USR_BIN, du_usage}, |
John Beppu | 7a98606 | 1999-12-09 18:29:29 +0000 | [diff] [blame] | 72 | #endif |
Eric Andersen | 61dc057 | 2000-07-11 17:29:36 +0000 | [diff] [blame] | 73 | #ifdef BB_DUMPKMAP |
Matt Kraai | 27a8042 | 2000-07-19 19:24:01 +0000 | [diff] [blame] | 74 | {"dumpkmap", dumpkmap_main, _BB_DIR_BIN, dumpkmap_usage}, |
Eric Andersen | 61dc057 | 2000-07-11 17:29:36 +0000 | [diff] [blame] | 75 | #endif |
Erik Andersen | 298854f | 2000-03-23 01:09:18 +0000 | [diff] [blame] | 76 | #ifdef BB_DUTMP |
Matt Kraai | 27a8042 | 2000-07-19 19:24:01 +0000 | [diff] [blame] | 77 | {"dutmp", dutmp_main, _BB_DIR_USR_SBIN, dutmp_usage}, |
Erik Andersen | d75af99 | 2000-03-16 08:09:09 +0000 | [diff] [blame] | 78 | #endif |
Erik Andersen | 298854f | 2000-03-23 01:09:18 +0000 | [diff] [blame] | 79 | #ifdef BB_ECHO |
Matt Kraai | 27a8042 | 2000-07-19 19:24:01 +0000 | [diff] [blame] | 80 | {"echo", echo_main, _BB_DIR_BIN, echo_usage}, |
Eric Andersen | cc8ed39 | 1999-10-05 16:24:54 +0000 | [diff] [blame] | 81 | #endif |
Eric Andersen | 1b355eb | 2000-09-05 17:37:48 +0000 | [diff] [blame] | 82 | #ifdef BB_EXPR |
| 83 | {"expr", expr_main, _BB_DIR_USR_BIN, expr_usage}, |
| 84 | #endif |
Erik Andersen | 5e1189e | 2000-04-15 16:34:54 +0000 | [diff] [blame] | 85 | #ifdef BB_TRUE_FALSE |
Matt Kraai | 27a8042 | 2000-07-19 19:24:01 +0000 | [diff] [blame] | 86 | {"false", false_main, _BB_DIR_BIN, false_usage}, |
Erik Andersen | 5e1189e | 2000-04-15 16:34:54 +0000 | [diff] [blame] | 87 | #endif |
Erik Andersen | 298854f | 2000-03-23 01:09:18 +0000 | [diff] [blame] | 88 | #ifdef BB_FBSET |
Matt Kraai | 27a8042 | 2000-07-19 19:24:01 +0000 | [diff] [blame] | 89 | {"fbset", fbset_main, _BB_DIR_USR_SBIN, NULL}, |
Erik Andersen | 1c5b258 | 1999-12-16 20:59:36 +0000 | [diff] [blame] | 90 | #endif |
Erik Andersen | 298854f | 2000-03-23 01:09:18 +0000 | [diff] [blame] | 91 | #ifdef BB_FDFLUSH |
Matt Kraai | 27a8042 | 2000-07-19 19:24:01 +0000 | [diff] [blame] | 92 | {"fdflush", fdflush_main, _BB_DIR_BIN, fdflush_usage}, |
Eric Andersen | cc8ed39 | 1999-10-05 16:24:54 +0000 | [diff] [blame] | 93 | #endif |
Erik Andersen | 298854f | 2000-03-23 01:09:18 +0000 | [diff] [blame] | 94 | #ifdef BB_FIND |
Matt Kraai | 27a8042 | 2000-07-19 19:24:01 +0000 | [diff] [blame] | 95 | {"find", find_main, _BB_DIR_USR_BIN, find_usage}, |
Eric Andersen | cc8ed39 | 1999-10-05 16:24:54 +0000 | [diff] [blame] | 96 | #endif |
Erik Andersen | 298854f | 2000-03-23 01:09:18 +0000 | [diff] [blame] | 97 | #ifdef BB_FREE |
Matt Kraai | 27a8042 | 2000-07-19 19:24:01 +0000 | [diff] [blame] | 98 | {"free", free_main, _BB_DIR_USR_BIN, free_usage}, |
Eric Andersen | 0460ff2 | 1999-10-25 23:32:44 +0000 | [diff] [blame] | 99 | #endif |
Erik Andersen | 298854f | 2000-03-23 01:09:18 +0000 | [diff] [blame] | 100 | #ifdef BB_FREERAMDISK |
Matt Kraai | 27a8042 | 2000-07-19 19:24:01 +0000 | [diff] [blame] | 101 | {"freeramdisk", freeramdisk_main, _BB_DIR_SBIN, freeramdisk_usage}, |
Erik Andersen | 6437170 | 2000-03-04 22:23:27 +0000 | [diff] [blame] | 102 | #endif |
Erik Andersen | 298854f | 2000-03-23 01:09:18 +0000 | [diff] [blame] | 103 | #ifdef BB_DEALLOCVT |
Matt Kraai | 27a8042 | 2000-07-19 19:24:01 +0000 | [diff] [blame] | 104 | {"deallocvt", deallocvt_main, _BB_DIR_USR_BIN, deallocvt_usage}, |
Eric Andersen | 0460ff2 | 1999-10-25 23:32:44 +0000 | [diff] [blame] | 105 | #endif |
Erik Andersen | 298854f | 2000-03-23 01:09:18 +0000 | [diff] [blame] | 106 | #ifdef BB_FSCK_MINIX |
Matt Kraai | 27a8042 | 2000-07-19 19:24:01 +0000 | [diff] [blame] | 107 | {"fsck.minix", fsck_minix_main, _BB_DIR_SBIN, fsck_minix_usage}, |
Eric Andersen | e494fdd | 1999-10-19 20:23:03 +0000 | [diff] [blame] | 108 | #endif |
Eric Andersen | a1f16bb | 2000-08-21 22:02:34 +0000 | [diff] [blame] | 109 | #ifdef BB_GETOPT |
| 110 | {"getopt", getopt_main, _BB_DIR_BIN}, |
| 111 | #endif |
Erik Andersen | 298854f | 2000-03-23 01:09:18 +0000 | [diff] [blame] | 112 | #ifdef BB_GREP |
Matt Kraai | 27a8042 | 2000-07-19 19:24:01 +0000 | [diff] [blame] | 113 | {"grep", grep_main, _BB_DIR_BIN, grep_usage}, |
Eric Andersen | cc8ed39 | 1999-10-05 16:24:54 +0000 | [diff] [blame] | 114 | #endif |
Erik Andersen | 5e1189e | 2000-04-15 16:34:54 +0000 | [diff] [blame] | 115 | #ifdef BB_GUNZIP |
Matt Kraai | 27a8042 | 2000-07-19 19:24:01 +0000 | [diff] [blame] | 116 | {"gunzip", gunzip_main, _BB_DIR_BIN, gunzip_usage}, |
Erik Andersen | 5e1189e | 2000-04-15 16:34:54 +0000 | [diff] [blame] | 117 | #endif |
| 118 | #ifdef BB_GZIP |
Matt Kraai | 27a8042 | 2000-07-19 19:24:01 +0000 | [diff] [blame] | 119 | {"gzip", gzip_main, _BB_DIR_BIN, gzip_usage}, |
Erik Andersen | 5e1189e | 2000-04-15 16:34:54 +0000 | [diff] [blame] | 120 | #endif |
Erik Andersen | 298854f | 2000-03-23 01:09:18 +0000 | [diff] [blame] | 121 | #ifdef BB_HALT |
Matt Kraai | 27a8042 | 2000-07-19 19:24:01 +0000 | [diff] [blame] | 122 | {"halt", halt_main, _BB_DIR_SBIN, halt_usage}, |
Eric Andersen | cc8ed39 | 1999-10-05 16:24:54 +0000 | [diff] [blame] | 123 | #endif |
Erik Andersen | 298854f | 2000-03-23 01:09:18 +0000 | [diff] [blame] | 124 | #ifdef BB_HEAD |
Matt Kraai | 27a8042 | 2000-07-19 19:24:01 +0000 | [diff] [blame] | 125 | {"head", head_main, _BB_DIR_USR_BIN, head_usage}, |
John Beppu | 3157b1f | 1999-12-10 07:42:50 +0000 | [diff] [blame] | 126 | #endif |
Erik Andersen | 298854f | 2000-03-23 01:09:18 +0000 | [diff] [blame] | 127 | #ifdef BB_HOSTID |
Matt Kraai | 27a8042 | 2000-07-19 19:24:01 +0000 | [diff] [blame] | 128 | {"hostid", hostid_main, _BB_DIR_USR_BIN, hostid_usage}, |
Erik Andersen | 3163821 | 2000-01-15 22:28:50 +0000 | [diff] [blame] | 129 | #endif |
Erik Andersen | 298854f | 2000-03-23 01:09:18 +0000 | [diff] [blame] | 130 | #ifdef BB_HOSTNAME |
Matt Kraai | 27a8042 | 2000-07-19 19:24:01 +0000 | [diff] [blame] | 131 | {"hostname", hostname_main, _BB_DIR_BIN, hostname_usage}, |
Eric Andersen | 485b955 | 1999-12-07 23:14:59 +0000 | [diff] [blame] | 132 | #endif |
Erik Andersen | 94f5e0b | 2000-05-01 19:10:52 +0000 | [diff] [blame] | 133 | #ifdef BB_ID |
Matt Kraai | 27a8042 | 2000-07-19 19:24:01 +0000 | [diff] [blame] | 134 | {"id", id_main, _BB_DIR_USR_BIN, id_usage}, |
Erik Andersen | 94f5e0b | 2000-05-01 19:10:52 +0000 | [diff] [blame] | 135 | #endif |
Erik Andersen | 298854f | 2000-03-23 01:09:18 +0000 | [diff] [blame] | 136 | #ifdef BB_INIT |
Matt Kraai | 27a8042 | 2000-07-19 19:24:01 +0000 | [diff] [blame] | 137 | {"init", init_main, _BB_DIR_SBIN, NULL}, |
Eric Andersen | cc8ed39 | 1999-10-05 16:24:54 +0000 | [diff] [blame] | 138 | #endif |
Erik Andersen | 298854f | 2000-03-23 01:09:18 +0000 | [diff] [blame] | 139 | #ifdef BB_INSMOD |
Matt Kraai | 27a8042 | 2000-07-19 19:24:01 +0000 | [diff] [blame] | 140 | {"insmod", insmod_main, _BB_DIR_SBIN, insmod_usage}, |
Erik Andersen | 6da0ae8 | 1999-12-17 01:08:27 +0000 | [diff] [blame] | 141 | #endif |
Erik Andersen | 298854f | 2000-03-23 01:09:18 +0000 | [diff] [blame] | 142 | #ifdef BB_KILL |
Matt Kraai | 27a8042 | 2000-07-19 19:24:01 +0000 | [diff] [blame] | 143 | {"kill", kill_main, _BB_DIR_BIN, kill_usage}, |
Eric Andersen | cc8ed39 | 1999-10-05 16:24:54 +0000 | [diff] [blame] | 144 | #endif |
Erik Andersen | 298854f | 2000-03-23 01:09:18 +0000 | [diff] [blame] | 145 | #ifdef BB_KILLALL |
Matt Kraai | 27a8042 | 2000-07-19 19:24:01 +0000 | [diff] [blame] | 146 | {"killall", kill_main, _BB_DIR_USR_BIN, kill_usage}, |
Erik Andersen | 246cc6d | 2000-03-07 07:41:42 +0000 | [diff] [blame] | 147 | #endif |
Erik Andersen | 298854f | 2000-03-23 01:09:18 +0000 | [diff] [blame] | 148 | #ifdef BB_LENGTH |
Matt Kraai | 27a8042 | 2000-07-19 19:24:01 +0000 | [diff] [blame] | 149 | {"length", length_main, _BB_DIR_USR_BIN, length_usage}, |
Eric Andersen | cc8ed39 | 1999-10-05 16:24:54 +0000 | [diff] [blame] | 150 | #endif |
Erik Andersen | 9a8195c | 2000-04-18 23:32:10 +0000 | [diff] [blame] | 151 | #ifdef BB_LINUXRC |
Eric Andersen | cb91d69 | 2000-09-01 18:43:02 +0000 | [diff] [blame] | 152 | {"linuxrc", init_main, _BB_DIR_ROOT, NULL}, |
Erik Andersen | 5e1189e | 2000-04-15 16:34:54 +0000 | [diff] [blame] | 153 | #endif |
Erik Andersen | 298854f | 2000-03-23 01:09:18 +0000 | [diff] [blame] | 154 | #ifdef BB_LN |
Matt Kraai | 27a8042 | 2000-07-19 19:24:01 +0000 | [diff] [blame] | 155 | {"ln", ln_main, _BB_DIR_BIN, ln_usage}, |
Eric Andersen | cc8ed39 | 1999-10-05 16:24:54 +0000 | [diff] [blame] | 156 | #endif |
Erik Andersen | 298854f | 2000-03-23 01:09:18 +0000 | [diff] [blame] | 157 | #ifdef BB_LOADACM |
Matt Kraai | 27a8042 | 2000-07-19 19:24:01 +0000 | [diff] [blame] | 158 | {"loadacm", loadacm_main, _BB_DIR_USR_BIN, loadacm_usage}, |
Eric Andersen | 3e0fbae | 1999-10-19 06:02:44 +0000 | [diff] [blame] | 159 | #endif |
Erik Andersen | 298854f | 2000-03-23 01:09:18 +0000 | [diff] [blame] | 160 | #ifdef BB_LOADFONT |
Matt Kraai | 27a8042 | 2000-07-19 19:24:01 +0000 | [diff] [blame] | 161 | {"loadfont", loadfont_main, _BB_DIR_USR_BIN, loadfont_usage}, |
Eric Andersen | cc8ed39 | 1999-10-05 16:24:54 +0000 | [diff] [blame] | 162 | #endif |
Erik Andersen | 298854f | 2000-03-23 01:09:18 +0000 | [diff] [blame] | 163 | #ifdef BB_LOADKMAP |
Matt Kraai | 27a8042 | 2000-07-19 19:24:01 +0000 | [diff] [blame] | 164 | {"loadkmap", loadkmap_main, _BB_DIR_SBIN, loadkmap_usage}, |
Eric Andersen | cc8ed39 | 1999-10-05 16:24:54 +0000 | [diff] [blame] | 165 | #endif |
Erik Andersen | 5e1189e | 2000-04-15 16:34:54 +0000 | [diff] [blame] | 166 | #ifdef BB_LOGGER |
Matt Kraai | 27a8042 | 2000-07-19 19:24:01 +0000 | [diff] [blame] | 167 | {"logger", logger_main, _BB_DIR_USR_BIN, logger_usage}, |
Erik Andersen | 5e1189e | 2000-04-15 16:34:54 +0000 | [diff] [blame] | 168 | #endif |
| 169 | #ifdef BB_LOGNAME |
Matt Kraai | 27a8042 | 2000-07-19 19:24:01 +0000 | [diff] [blame] | 170 | {"logname", logname_main, _BB_DIR_USR_BIN, logname_usage}, |
Erik Andersen | 5e1189e | 2000-04-15 16:34:54 +0000 | [diff] [blame] | 171 | #endif |
Erik Andersen | 298854f | 2000-03-23 01:09:18 +0000 | [diff] [blame] | 172 | #ifdef BB_LS |
Matt Kraai | 27a8042 | 2000-07-19 19:24:01 +0000 | [diff] [blame] | 173 | {"ls", ls_main, _BB_DIR_BIN, ls_usage}, |
Erik Andersen | 6f23cec | 1999-12-15 22:14:12 +0000 | [diff] [blame] | 174 | #endif |
Erik Andersen | 298854f | 2000-03-23 01:09:18 +0000 | [diff] [blame] | 175 | #ifdef BB_LSMOD |
Matt Kraai | 27a8042 | 2000-07-19 19:24:01 +0000 | [diff] [blame] | 176 | {"lsmod", lsmod_main, _BB_DIR_SBIN, lsmod_usage}, |
Eric Andersen | cc8ed39 | 1999-10-05 16:24:54 +0000 | [diff] [blame] | 177 | #endif |
Erik Andersen | 298854f | 2000-03-23 01:09:18 +0000 | [diff] [blame] | 178 | #ifdef BB_MAKEDEVS |
Matt Kraai | 27a8042 | 2000-07-19 19:24:01 +0000 | [diff] [blame] | 179 | {"makedevs", makedevs_main, _BB_DIR_SBIN, makedevs_usage}, |
Eric Andersen | cc8ed39 | 1999-10-05 16:24:54 +0000 | [diff] [blame] | 180 | #endif |
Eric Andersen | 2b6ab3c | 2000-06-13 06:54:53 +0000 | [diff] [blame] | 181 | #ifdef BB_MD5SUM |
Matt Kraai | 27a8042 | 2000-07-19 19:24:01 +0000 | [diff] [blame] | 182 | {"md5sum", md5sum_main, _BB_DIR_USR_BIN, md5sum_usage}, |
Eric Andersen | 2b6ab3c | 2000-06-13 06:54:53 +0000 | [diff] [blame] | 183 | #endif |
Erik Andersen | 298854f | 2000-03-23 01:09:18 +0000 | [diff] [blame] | 184 | #ifdef BB_MKDIR |
Matt Kraai | 27a8042 | 2000-07-19 19:24:01 +0000 | [diff] [blame] | 185 | {"mkdir", mkdir_main, _BB_DIR_BIN, mkdir_usage}, |
Erik Andersen | e49d5ec | 2000-02-08 19:58:47 +0000 | [diff] [blame] | 186 | #endif |
Erik Andersen | 298854f | 2000-03-23 01:09:18 +0000 | [diff] [blame] | 187 | #ifdef BB_MKFIFO |
Matt Kraai | 27a8042 | 2000-07-19 19:24:01 +0000 | [diff] [blame] | 188 | {"mkfifo", mkfifo_main, _BB_DIR_USR_BIN, mkfifo_usage}, |
Eric Andersen | 19db07b | 1999-12-11 08:41:28 +0000 | [diff] [blame] | 189 | #endif |
Erik Andersen | 5e1189e | 2000-04-15 16:34:54 +0000 | [diff] [blame] | 190 | #ifdef BB_MKFS_MINIX |
Matt Kraai | 27a8042 | 2000-07-19 19:24:01 +0000 | [diff] [blame] | 191 | {"mkfs.minix", mkfs_minix_main, _BB_DIR_SBIN, mkfs_minix_usage}, |
Erik Andersen | 5e1189e | 2000-04-15 16:34:54 +0000 | [diff] [blame] | 192 | #endif |
Erik Andersen | 298854f | 2000-03-23 01:09:18 +0000 | [diff] [blame] | 193 | #ifdef BB_MKNOD |
Matt Kraai | 27a8042 | 2000-07-19 19:24:01 +0000 | [diff] [blame] | 194 | {"mknod", mknod_main, _BB_DIR_BIN, mknod_usage}, |
Eric Andersen | cc8ed39 | 1999-10-05 16:24:54 +0000 | [diff] [blame] | 195 | #endif |
Erik Andersen | 298854f | 2000-03-23 01:09:18 +0000 | [diff] [blame] | 196 | #ifdef BB_MKSWAP |
Matt Kraai | 27a8042 | 2000-07-19 19:24:01 +0000 | [diff] [blame] | 197 | {"mkswap", mkswap_main, _BB_DIR_SBIN, mkswap_usage}, |
Eric Andersen | cc8ed39 | 1999-10-05 16:24:54 +0000 | [diff] [blame] | 198 | #endif |
Erik Andersen | 227a59b | 2000-04-25 23:24:55 +0000 | [diff] [blame] | 199 | #ifdef BB_MKTEMP |
Matt Kraai | 27a8042 | 2000-07-19 19:24:01 +0000 | [diff] [blame] | 200 | {"mktemp", mktemp_main, _BB_DIR_BIN, mktemp_usage}, |
Erik Andersen | 227a59b | 2000-04-25 23:24:55 +0000 | [diff] [blame] | 201 | #endif |
Erik Andersen | 7ab9c7e | 2000-05-12 19:41:47 +0000 | [diff] [blame] | 202 | #ifdef BB_NC |
Matt Kraai | 27a8042 | 2000-07-19 19:24:01 +0000 | [diff] [blame] | 203 | {"nc", nc_main, _BB_DIR_USR_BIN, nc_usage}, |
Eric Andersen | cc8ed39 | 1999-10-05 16:24:54 +0000 | [diff] [blame] | 204 | #endif |
Erik Andersen | 298854f | 2000-03-23 01:09:18 +0000 | [diff] [blame] | 205 | #ifdef BB_MORE |
Matt Kraai | 27a8042 | 2000-07-19 19:24:01 +0000 | [diff] [blame] | 206 | {"more", more_main, _BB_DIR_BIN, more_usage}, |
Eric Andersen | cc8ed39 | 1999-10-05 16:24:54 +0000 | [diff] [blame] | 207 | #endif |
Erik Andersen | 298854f | 2000-03-23 01:09:18 +0000 | [diff] [blame] | 208 | #ifdef BB_MOUNT |
Matt Kraai | 27a8042 | 2000-07-19 19:24:01 +0000 | [diff] [blame] | 209 | {"mount", mount_main, _BB_DIR_BIN, mount_usage}, |
Eric Andersen | cc8ed39 | 1999-10-05 16:24:54 +0000 | [diff] [blame] | 210 | #endif |
Erik Andersen | 298854f | 2000-03-23 01:09:18 +0000 | [diff] [blame] | 211 | #ifdef BB_MT |
Matt Kraai | 27a8042 | 2000-07-19 19:24:01 +0000 | [diff] [blame] | 212 | {"mt", mt_main, _BB_DIR_BIN, mt_usage}, |
Eric Andersen | cc8ed39 | 1999-10-05 16:24:54 +0000 | [diff] [blame] | 213 | #endif |
Erik Andersen | 5e1189e | 2000-04-15 16:34:54 +0000 | [diff] [blame] | 214 | #ifdef BB_CP_MV |
Matt Kraai | 27a8042 | 2000-07-19 19:24:01 +0000 | [diff] [blame] | 215 | {"mv", cp_mv_main, _BB_DIR_BIN, mv_usage}, |
Erik Andersen | 5e1189e | 2000-04-15 16:34:54 +0000 | [diff] [blame] | 216 | #endif |
Erik Andersen | 298854f | 2000-03-23 01:09:18 +0000 | [diff] [blame] | 217 | #ifdef BB_NSLOOKUP |
Matt Kraai | 27a8042 | 2000-07-19 19:24:01 +0000 | [diff] [blame] | 218 | {"nslookup", nslookup_main, _BB_DIR_USR_BIN, nslookup_usage}, |
John Beppu | b332e77 | 2000-01-29 12:59:01 +0000 | [diff] [blame] | 219 | #endif |
Erik Andersen | 298854f | 2000-03-23 01:09:18 +0000 | [diff] [blame] | 220 | #ifdef BB_PING |
Matt Kraai | 27a8042 | 2000-07-19 19:24:01 +0000 | [diff] [blame] | 221 | {"ping", ping_main, _BB_DIR_BIN, ping_usage}, |
Eric Andersen | 485b955 | 1999-12-07 23:14:59 +0000 | [diff] [blame] | 222 | #endif |
Erik Andersen | 298854f | 2000-03-23 01:09:18 +0000 | [diff] [blame] | 223 | #ifdef BB_POWEROFF |
Matt Kraai | 27a8042 | 2000-07-19 19:24:01 +0000 | [diff] [blame] | 224 | {"poweroff", poweroff_main, _BB_DIR_SBIN, poweroff_usage}, |
Eric Andersen | 2cb5507 | 1999-12-10 08:25:07 +0000 | [diff] [blame] | 225 | #endif |
Erik Andersen | 298854f | 2000-03-23 01:09:18 +0000 | [diff] [blame] | 226 | #ifdef BB_PRINTF |
Matt Kraai | 27a8042 | 2000-07-19 19:24:01 +0000 | [diff] [blame] | 227 | {"printf", printf_main, _BB_DIR_USR_BIN, printf_usage}, |
Eric Andersen | cc8ed39 | 1999-10-05 16:24:54 +0000 | [diff] [blame] | 228 | #endif |
Erik Andersen | 298854f | 2000-03-23 01:09:18 +0000 | [diff] [blame] | 229 | #ifdef BB_PS |
Matt Kraai | 27a8042 | 2000-07-19 19:24:01 +0000 | [diff] [blame] | 230 | {"ps", ps_main, _BB_DIR_BIN, ps_usage}, |
Eric Andersen | ef8b6c7 | 1999-10-20 08:05:35 +0000 | [diff] [blame] | 231 | #endif |
Erik Andersen | 298854f | 2000-03-23 01:09:18 +0000 | [diff] [blame] | 232 | #ifdef BB_PWD |
Matt Kraai | 27a8042 | 2000-07-19 19:24:01 +0000 | [diff] [blame] | 233 | {"pwd", pwd_main, _BB_DIR_BIN, pwd_usage}, |
Eric Andersen | cc8ed39 | 1999-10-05 16:24:54 +0000 | [diff] [blame] | 234 | #endif |
Eric Andersen | 918507e | 2000-08-21 22:46:33 +0000 | [diff] [blame] | 235 | #ifdef BB_RDATE |
| 236 | {"rdate", rdate_main, _BB_DIR_USR_BIN, rdate_usage}, |
| 237 | #endif |
Erik Andersen | 298854f | 2000-03-23 01:09:18 +0000 | [diff] [blame] | 238 | #ifdef BB_REBOOT |
Matt Kraai | 27a8042 | 2000-07-19 19:24:01 +0000 | [diff] [blame] | 239 | {"reboot", reboot_main, _BB_DIR_SBIN, reboot_usage}, |
Eric Andersen | cc8ed39 | 1999-10-05 16:24:54 +0000 | [diff] [blame] | 240 | #endif |
Eric Andersen | bf960f5 | 2000-07-21 21:32:12 +0000 | [diff] [blame] | 241 | #ifdef BB_RENICE |
| 242 | {"renice", renice_main, _BB_DIR_USR_BIN}, |
| 243 | #endif |
Eric Andersen | fa405d0 | 2000-08-21 21:18:52 +0000 | [diff] [blame] | 244 | #ifdef BB_RESET |
| 245 | {"reset", reset_main, _BB_DIR_USR_BIN, reset_usage}, |
| 246 | #endif |
Erik Andersen | 298854f | 2000-03-23 01:09:18 +0000 | [diff] [blame] | 247 | #ifdef BB_RM |
Matt Kraai | 27a8042 | 2000-07-19 19:24:01 +0000 | [diff] [blame] | 248 | {"rm", rm_main, _BB_DIR_BIN, rm_usage}, |
Eric Andersen | cc8ed39 | 1999-10-05 16:24:54 +0000 | [diff] [blame] | 249 | #endif |
Erik Andersen | 298854f | 2000-03-23 01:09:18 +0000 | [diff] [blame] | 250 | #ifdef BB_RMDIR |
Matt Kraai | 27a8042 | 2000-07-19 19:24:01 +0000 | [diff] [blame] | 251 | {"rmdir", rmdir_main, _BB_DIR_BIN, rmdir_usage}, |
Eric Andersen | cc8ed39 | 1999-10-05 16:24:54 +0000 | [diff] [blame] | 252 | #endif |
Erik Andersen | 298854f | 2000-03-23 01:09:18 +0000 | [diff] [blame] | 253 | #ifdef BB_RMMOD |
Matt Kraai | 27a8042 | 2000-07-19 19:24:01 +0000 | [diff] [blame] | 254 | {"rmmod", rmmod_main, _BB_DIR_SBIN, rmmod_usage}, |
Erik Andersen | 3d7e341 | 1999-12-16 23:04:20 +0000 | [diff] [blame] | 255 | #endif |
Erik Andersen | 298854f | 2000-03-23 01:09:18 +0000 | [diff] [blame] | 256 | #ifdef BB_SED |
Matt Kraai | 27a8042 | 2000-07-19 19:24:01 +0000 | [diff] [blame] | 257 | {"sed", sed_main, _BB_DIR_BIN, sed_usage}, |
Erik Andersen | 3522eb1 | 2000-03-12 23:49:18 +0000 | [diff] [blame] | 258 | #endif |
Erik Andersen | 4f3f757 | 2000-04-28 00:18:56 +0000 | [diff] [blame] | 259 | #ifdef BB_SETKEYCODES |
Matt Kraai | 27a8042 | 2000-07-19 19:24:01 +0000 | [diff] [blame] | 260 | {"setkeycodes", setkeycodes_main, _BB_DIR_USR_BIN, setkeycodes_usage}, |
Erik Andersen | 3522eb1 | 2000-03-12 23:49:18 +0000 | [diff] [blame] | 261 | #endif |
Erik Andersen | 4f3f757 | 2000-04-28 00:18:56 +0000 | [diff] [blame] | 262 | #ifdef BB_SH |
Matt Kraai | 27a8042 | 2000-07-19 19:24:01 +0000 | [diff] [blame] | 263 | {"sh", shell_main, _BB_DIR_BIN, shell_usage}, |
Erik Andersen | 4f3f757 | 2000-04-28 00:18:56 +0000 | [diff] [blame] | 264 | #endif |
Erik Andersen | 298854f | 2000-03-23 01:09:18 +0000 | [diff] [blame] | 265 | #ifdef BB_SLEEP |
Matt Kraai | 27a8042 | 2000-07-19 19:24:01 +0000 | [diff] [blame] | 266 | {"sleep", sleep_main, _BB_DIR_BIN, sleep_usage}, |
Eric Andersen | cc8ed39 | 1999-10-05 16:24:54 +0000 | [diff] [blame] | 267 | #endif |
Erik Andersen | 298854f | 2000-03-23 01:09:18 +0000 | [diff] [blame] | 268 | #ifdef BB_SORT |
Eric Andersen | 88f50b6 | 2000-08-10 17:59:11 +0000 | [diff] [blame] | 269 | {"sort", sort_main, _BB_DIR_USR_BIN, sort_usage}, |
John Beppu | 019513a | 1999-12-22 17:57:31 +0000 | [diff] [blame] | 270 | #endif |
Erik Andersen | 298854f | 2000-03-23 01:09:18 +0000 | [diff] [blame] | 271 | #ifdef BB_SYNC |
Matt Kraai | 27a8042 | 2000-07-19 19:24:01 +0000 | [diff] [blame] | 272 | {"sync", sync_main, _BB_DIR_BIN, sync_usage}, |
Eric Andersen | 3843e96 | 1999-11-25 07:30:46 +0000 | [diff] [blame] | 273 | #endif |
Erik Andersen | 298854f | 2000-03-23 01:09:18 +0000 | [diff] [blame] | 274 | #ifdef BB_SYSLOGD |
Matt Kraai | 27a8042 | 2000-07-19 19:24:01 +0000 | [diff] [blame] | 275 | {"syslogd", syslogd_main, _BB_DIR_SBIN, syslogd_usage}, |
Eric Andersen | 3843e96 | 1999-11-25 07:30:46 +0000 | [diff] [blame] | 276 | #endif |
Erik Andersen | 298854f | 2000-03-23 01:09:18 +0000 | [diff] [blame] | 277 | #ifdef BB_SWAPONOFF |
Matt Kraai | 27a8042 | 2000-07-19 19:24:01 +0000 | [diff] [blame] | 278 | {"swapon", swap_on_off_main, _BB_DIR_SBIN, swapon_usage}, |
Erik Andersen | d75af99 | 2000-03-16 08:09:09 +0000 | [diff] [blame] | 279 | #endif |
Erik Andersen | 298854f | 2000-03-23 01:09:18 +0000 | [diff] [blame] | 280 | #ifdef BB_SWAPONOFF |
Matt Kraai | 27a8042 | 2000-07-19 19:24:01 +0000 | [diff] [blame] | 281 | {"swapoff", swap_on_off_main, _BB_DIR_SBIN, swapoff_usage}, |
Eric Andersen | cc8ed39 | 1999-10-05 16:24:54 +0000 | [diff] [blame] | 282 | #endif |
Erik Andersen | 298854f | 2000-03-23 01:09:18 +0000 | [diff] [blame] | 283 | #ifdef BB_TAIL |
Matt Kraai | 27a8042 | 2000-07-19 19:24:01 +0000 | [diff] [blame] | 284 | {"tail", tail_main, _BB_DIR_USR_BIN, tail_usage}, |
Eric Andersen | abc0f4f | 1999-12-08 23:19:36 +0000 | [diff] [blame] | 285 | #endif |
Erik Andersen | 298854f | 2000-03-23 01:09:18 +0000 | [diff] [blame] | 286 | #ifdef BB_TAR |
Matt Kraai | 27a8042 | 2000-07-19 19:24:01 +0000 | [diff] [blame] | 287 | {"tar", tar_main, _BB_DIR_BIN, tar_usage}, |
Eric Andersen | cc8ed39 | 1999-10-05 16:24:54 +0000 | [diff] [blame] | 288 | #endif |
Erik Andersen | 298854f | 2000-03-23 01:09:18 +0000 | [diff] [blame] | 289 | #ifdef BB_TELNET |
Matt Kraai | 27a8042 | 2000-07-19 19:24:01 +0000 | [diff] [blame] | 290 | {"telnet", telnet_main, _BB_DIR_USR_BIN, telnet_usage}, |
Erik Andersen | d75af99 | 2000-03-16 08:09:09 +0000 | [diff] [blame] | 291 | #endif |
Erik Andersen | 298854f | 2000-03-23 01:09:18 +0000 | [diff] [blame] | 292 | #ifdef BB_TEST |
Matt Kraai | 27a8042 | 2000-07-19 19:24:01 +0000 | [diff] [blame] | 293 | {"test", test_main, _BB_DIR_USR_BIN, test_usage}, |
Erik Andersen | f7c49ef | 2000-02-22 17:17:45 +0000 | [diff] [blame] | 294 | #endif |
Erik Andersen | 298854f | 2000-03-23 01:09:18 +0000 | [diff] [blame] | 295 | #ifdef BB_TEE |
Eric Andersen | 88f50b6 | 2000-08-10 17:59:11 +0000 | [diff] [blame] | 296 | {"tee", tee_main, _BB_DIR_USR_BIN, tee_usage}, |
John Beppu | 059f152 | 1999-12-10 05:27:16 +0000 | [diff] [blame] | 297 | #endif |
Erik Andersen | 298854f | 2000-03-23 01:09:18 +0000 | [diff] [blame] | 298 | #ifdef BB_TOUCH |
Eric Andersen | e89267c | 2000-08-19 20:16:16 +0000 | [diff] [blame] | 299 | {"touch", touch_main, _BB_DIR_BIN, touch_usage}, |
Eric Andersen | cc8ed39 | 1999-10-05 16:24:54 +0000 | [diff] [blame] | 300 | #endif |
Erik Andersen | 298854f | 2000-03-23 01:09:18 +0000 | [diff] [blame] | 301 | #ifdef BB_TR |
Matt Kraai | 27a8042 | 2000-07-19 19:24:01 +0000 | [diff] [blame] | 302 | {"tr", tr_main, _BB_DIR_USR_BIN, tr_usage}, |
Erik Andersen | fb002d0 | 2000-03-05 08:07:00 +0000 | [diff] [blame] | 303 | #endif |
Erik Andersen | 298854f | 2000-03-23 01:09:18 +0000 | [diff] [blame] | 304 | #ifdef BB_TRUE_FALSE |
Matt Kraai | 27a8042 | 2000-07-19 19:24:01 +0000 | [diff] [blame] | 305 | {"true", true_main, _BB_DIR_BIN, true_usage}, |
Erik Andersen | d75af99 | 2000-03-16 08:09:09 +0000 | [diff] [blame] | 306 | #endif |
Erik Andersen | 298854f | 2000-03-23 01:09:18 +0000 | [diff] [blame] | 307 | #ifdef BB_TTY |
Matt Kraai | 27a8042 | 2000-07-19 19:24:01 +0000 | [diff] [blame] | 308 | {"tty", tty_main, _BB_DIR_USR_BIN, tty_usage}, |
Erik Andersen | 05df239 | 2000-01-13 04:43:48 +0000 | [diff] [blame] | 309 | #endif |
Erik Andersen | 298854f | 2000-03-23 01:09:18 +0000 | [diff] [blame] | 310 | #ifdef BB_UMOUNT |
Matt Kraai | 27a8042 | 2000-07-19 19:24:01 +0000 | [diff] [blame] | 311 | {"umount", umount_main, _BB_DIR_BIN, umount_usage}, |
Erik Andersen | 66be5e7 | 2000-03-05 07:52:05 +0000 | [diff] [blame] | 312 | #endif |
Erik Andersen | 298854f | 2000-03-23 01:09:18 +0000 | [diff] [blame] | 313 | #ifdef BB_UNAME |
Matt Kraai | 27a8042 | 2000-07-19 19:24:01 +0000 | [diff] [blame] | 314 | {"uname", uname_main, _BB_DIR_BIN, uname_usage}, |
Eric Andersen | 0460ff2 | 1999-10-25 23:32:44 +0000 | [diff] [blame] | 315 | #endif |
Erik Andersen | 298854f | 2000-03-23 01:09:18 +0000 | [diff] [blame] | 316 | #ifdef BB_UNIQ |
Matt Kraai | 27a8042 | 2000-07-19 19:24:01 +0000 | [diff] [blame] | 317 | {"uniq", uniq_main, _BB_DIR_USR_BIN, uniq_usage}, |
John Beppu | abb4772 | 2000-01-06 00:48:21 +0000 | [diff] [blame] | 318 | #endif |
Eric Andersen | cff3fe3 | 2000-09-20 19:22:26 +0000 | [diff] [blame] | 319 | #ifdef BB_UNIX2DOS |
| 320 | {"unix2dos", unix2dos_main, _BB_DIR_USR_BIN, unix2dos_usage}, |
| 321 | #endif |
| 322 | #ifdef BB_UNRPM |
| 323 | {"unrpm", unrpm_main, _BB_DIR_USR_BIN, unrpm_usage}, |
| 324 | #endif |
Erik Andersen | 298854f | 2000-03-23 01:09:18 +0000 | [diff] [blame] | 325 | #ifdef BB_UPDATE |
Matt Kraai | 27a8042 | 2000-07-19 19:24:01 +0000 | [diff] [blame] | 326 | {"update", update_main, _BB_DIR_SBIN, update_usage}, |
Eric Andersen | cc8ed39 | 1999-10-05 16:24:54 +0000 | [diff] [blame] | 327 | #endif |
Erik Andersen | 5e1189e | 2000-04-15 16:34:54 +0000 | [diff] [blame] | 328 | #ifdef BB_UPTIME |
Matt Kraai | 27a8042 | 2000-07-19 19:24:01 +0000 | [diff] [blame] | 329 | {"uptime", uptime_main, _BB_DIR_USR_BIN, uptime_usage}, |
Erik Andersen | 5e1189e | 2000-04-15 16:34:54 +0000 | [diff] [blame] | 330 | #endif |
Eric Andersen | 2b6ab3c | 2000-06-13 06:54:53 +0000 | [diff] [blame] | 331 | #ifdef BB_UUENCODE |
Matt Kraai | 27a8042 | 2000-07-19 19:24:01 +0000 | [diff] [blame] | 332 | {"uuencode", uuencode_main, _BB_DIR_USR_BIN, uuencode_usage}, |
Eric Andersen | 2b6ab3c | 2000-06-13 06:54:53 +0000 | [diff] [blame] | 333 | #endif |
| 334 | #ifdef BB_UUDECODE |
Matt Kraai | 27a8042 | 2000-07-19 19:24:01 +0000 | [diff] [blame] | 335 | {"uudecode", uudecode_main, _BB_DIR_USR_BIN, uudecode_usage}, |
Eric Andersen | 2b6ab3c | 2000-06-13 06:54:53 +0000 | [diff] [blame] | 336 | #endif |
Erik Andersen | b99ca13 | 2000-04-04 18:49:18 +0000 | [diff] [blame] | 337 | #ifdef BB_USLEEP |
Matt Kraai | 27a8042 | 2000-07-19 19:24:01 +0000 | [diff] [blame] | 338 | {"usleep", usleep_main, _BB_DIR_BIN, usleep_usage}, |
Erik Andersen | b99ca13 | 2000-04-04 18:49:18 +0000 | [diff] [blame] | 339 | #endif |
Erik Andersen | 298854f | 2000-03-23 01:09:18 +0000 | [diff] [blame] | 340 | #ifdef BB_WC |
Matt Kraai | 27a8042 | 2000-07-19 19:24:01 +0000 | [diff] [blame] | 341 | {"wc", wc_main, _BB_DIR_USR_BIN, wc_usage}, |
Erik Andersen | 3163821 | 2000-01-15 22:28:50 +0000 | [diff] [blame] | 342 | #endif |
Eric Andersen | 9670083 | 2000-09-04 15:15:55 +0000 | [diff] [blame] | 343 | #ifdef BB_WGET |
| 344 | {"wget", wget_main, _BB_DIR_USR_BIN, wget_usage}, |
| 345 | #endif |
Erik Andersen | 330fd2b | 2000-05-19 05:35:19 +0000 | [diff] [blame] | 346 | #ifdef BB_WHICH |
Matt Kraai | 27a8042 | 2000-07-19 19:24:01 +0000 | [diff] [blame] | 347 | {"which", which_main, _BB_DIR_USR_BIN, which_usage}, |
Erik Andersen | 330fd2b | 2000-05-19 05:35:19 +0000 | [diff] [blame] | 348 | #endif |
Erik Andersen | 298854f | 2000-03-23 01:09:18 +0000 | [diff] [blame] | 349 | #ifdef BB_WHOAMI |
Matt Kraai | 27a8042 | 2000-07-19 19:24:01 +0000 | [diff] [blame] | 350 | {"whoami", whoami_main, _BB_DIR_USR_BIN, whoami_usage}, |
Erik Andersen | 3163821 | 2000-01-15 22:28:50 +0000 | [diff] [blame] | 351 | #endif |
Erik Andersen | 298854f | 2000-03-23 01:09:18 +0000 | [diff] [blame] | 352 | #ifdef BB_YES |
Matt Kraai | 27a8042 | 2000-07-19 19:24:01 +0000 | [diff] [blame] | 353 | {"yes", yes_main, _BB_DIR_USR_BIN, yes_usage}, |
Erik Andersen | 3163821 | 2000-01-15 22:28:50 +0000 | [diff] [blame] | 354 | #endif |
Erik Andersen | 298854f | 2000-03-23 01:09:18 +0000 | [diff] [blame] | 355 | #ifdef BB_GUNZIP |
Matt Kraai | 27a8042 | 2000-07-19 19:24:01 +0000 | [diff] [blame] | 356 | {"zcat", gunzip_main, _BB_DIR_BIN, gunzip_usage}, |
Erik Andersen | d75af99 | 2000-03-16 08:09:09 +0000 | [diff] [blame] | 357 | #endif |
Erik Andersen | 5e1189e | 2000-04-15 16:34:54 +0000 | [diff] [blame] | 358 | #ifdef BB_TEST |
Matt Kraai | 27a8042 | 2000-07-19 19:24:01 +0000 | [diff] [blame] | 359 | {"[", test_main, _BB_DIR_USR_BIN, test_usage}, |
Eric Andersen | cc8ed39 | 1999-10-05 16:24:54 +0000 | [diff] [blame] | 360 | #endif |
Matt Kraai | 27a8042 | 2000-07-19 19:24:01 +0000 | [diff] [blame] | 361 | {0,NULL,0,NULL} |
Eric Andersen | cc8ed39 | 1999-10-05 16:24:54 +0000 | [diff] [blame] | 362 | }; |
| 363 | |
Eric Andersen | 501c88b | 2000-07-28 15:14:45 +0000 | [diff] [blame] | 364 | const char *applet_name; |
Erik Andersen | 05df239 | 2000-01-13 04:43:48 +0000 | [diff] [blame] | 365 | |
John Beppu | 8f425db | 2000-06-27 04:50:02 +0000 | [diff] [blame] | 366 | #ifdef BB_FEATURE_INSTALLER |
| 367 | /* |
| 368 | * directory table |
John Beppu | eb02833 | 2000-06-28 00:55:31 +0000 | [diff] [blame] | 369 | * this should be consistent w/ the enum, internal.h::Location, |
| 370 | * or else... |
John Beppu | 8f425db | 2000-06-27 04:50:02 +0000 | [diff] [blame] | 371 | */ |
| 372 | static char* install_dir[] = { |
John Beppu | eb02833 | 2000-06-28 00:55:31 +0000 | [diff] [blame] | 373 | "/", |
| 374 | "/bin", |
| 375 | "/sbin", |
| 376 | "/usr/bin", |
| 377 | "/usr/sbin", |
John Beppu | 8f425db | 2000-06-27 04:50:02 +0000 | [diff] [blame] | 378 | }; |
| 379 | |
| 380 | /* abstract link() */ |
| 381 | typedef int (*__link_f)(const char *, const char *); |
| 382 | |
John Beppu | 7cdc76d | 2000-06-28 00:41:26 +0000 | [diff] [blame] | 383 | /* |
| 384 | * Where in the filesystem is this busybox? |
| 385 | * [return] |
| 386 | * malloc'd string w/ full pathname of busybox's location |
| 387 | * NULL on failure |
| 388 | */ |
| 389 | static char *busybox_fullpath() |
| 390 | { |
John Beppu | eb02833 | 2000-06-28 00:55:31 +0000 | [diff] [blame] | 391 | pid_t pid; |
| 392 | char path[256]; |
| 393 | char proc[256]; |
| 394 | int len; |
John Beppu | 7cdc76d | 2000-06-28 00:41:26 +0000 | [diff] [blame] | 395 | |
| 396 | pid = getpid(); |
| 397 | sprintf(proc, "/proc/%d/exe", pid); |
| 398 | len = readlink(proc, path, 256); |
| 399 | if (len != -1) { |
| 400 | path[len] = 0; |
| 401 | } else { |
Matt Kraai | d537a95 | 2000-07-14 01:51:25 +0000 | [diff] [blame] | 402 | errorMsg("%s: %s\n", proc, strerror(errno)); |
John Beppu | 7cdc76d | 2000-06-28 00:41:26 +0000 | [diff] [blame] | 403 | return NULL; |
| 404 | } |
| 405 | return strdup(path); |
| 406 | } |
| 407 | |
John Beppu | 8f425db | 2000-06-27 04:50:02 +0000 | [diff] [blame] | 408 | /* create (sym)links for each applet */ |
John Beppu | 495869f | 2000-06-27 07:54:33 +0000 | [diff] [blame] | 409 | static int install_links(const char *busybox, int use_symbolic_links) |
John Beppu | 8f425db | 2000-06-27 04:50:02 +0000 | [diff] [blame] | 410 | { |
John Beppu | eb02833 | 2000-06-28 00:55:31 +0000 | [diff] [blame] | 411 | __link_f Link = link; |
John Beppu | 8f425db | 2000-06-27 04:50:02 +0000 | [diff] [blame] | 412 | |
John Beppu | eb02833 | 2000-06-28 00:55:31 +0000 | [diff] [blame] | 413 | char command[256]; |
| 414 | int i; |
| 415 | int rc = 0; |
John Beppu | 8f425db | 2000-06-27 04:50:02 +0000 | [diff] [blame] | 416 | |
| 417 | if (use_symbolic_links) Link = symlink; |
| 418 | |
John Beppu | eb02833 | 2000-06-28 00:55:31 +0000 | [diff] [blame] | 419 | for (i = 0; applets[i].name != NULL; i++) { |
| 420 | sprintf ( |
John Beppu | 8f425db | 2000-06-27 04:50:02 +0000 | [diff] [blame] | 421 | command, |
| 422 | "%s/%s", |
| 423 | install_dir[applets[i].location], |
| 424 | applets[i].name |
| 425 | ); |
John Beppu | 7cdc76d | 2000-06-28 00:41:26 +0000 | [diff] [blame] | 426 | #if 1 |
John Beppu | eb02833 | 2000-06-28 00:55:31 +0000 | [diff] [blame] | 427 | rc |= Link(busybox, command); |
John Beppu | 8f425db | 2000-06-27 04:50:02 +0000 | [diff] [blame] | 428 | #else |
John Beppu | eb02833 | 2000-06-28 00:55:31 +0000 | [diff] [blame] | 429 | puts(command); |
John Beppu | 8f425db | 2000-06-27 04:50:02 +0000 | [diff] [blame] | 430 | #endif |
| 431 | if (rc) { |
Matt Kraai | d537a95 | 2000-07-14 01:51:25 +0000 | [diff] [blame] | 432 | errorMsg("%s: %s\n", command, strerror(errno)); |
John Beppu | 8f425db | 2000-06-27 04:50:02 +0000 | [diff] [blame] | 433 | } |
John Beppu | eb02833 | 2000-06-28 00:55:31 +0000 | [diff] [blame] | 434 | } |
John Beppu | 8f425db | 2000-06-27 04:50:02 +0000 | [diff] [blame] | 435 | return rc; |
| 436 | } |
| 437 | |
John Beppu | 8f425db | 2000-06-27 04:50:02 +0000 | [diff] [blame] | 438 | #endif /* BB_FEATURE_INSTALLER */ |
| 439 | |
Erik Andersen | 05df239 | 2000-01-13 04:43:48 +0000 | [diff] [blame] | 440 | |
Eric Andersen | cc8ed39 | 1999-10-05 16:24:54 +0000 | [diff] [blame] | 441 | int main(int argc, char **argv) |
| 442 | { |
Eric Andersen | 501c88b | 2000-07-28 15:14:45 +0000 | [diff] [blame] | 443 | const char *s; |
Erik Andersen | bcd6177 | 2000-05-13 06:33:19 +0000 | [diff] [blame] | 444 | const struct BB_applet *a = applets; |
Matt Kraai | d537a95 | 2000-07-14 01:51:25 +0000 | [diff] [blame] | 445 | applet_name = "busybox"; |
Eric Andersen | cc8ed39 | 1999-10-05 16:24:54 +0000 | [diff] [blame] | 446 | |
John Beppu | 8f425db | 2000-06-27 04:50:02 +0000 | [diff] [blame] | 447 | #ifdef BB_FEATURE_INSTALLER |
John Beppu | 27b5924 | 2000-06-27 04:56:45 +0000 | [diff] [blame] | 448 | /* |
| 449 | * This style of argument parsing doesn't scale well |
| 450 | * in the event that busybox starts wanting more --options. |
| 451 | * If someone has a cleaner approach, by all means implement it. |
| 452 | */ |
John Beppu | 8f425db | 2000-06-27 04:50:02 +0000 | [diff] [blame] | 453 | if (argc > 1 && (strcmp(argv[1], "--install") == 0)) { |
| 454 | int use_symbolic_links = 0; |
John Beppu | 7cdc76d | 2000-06-28 00:41:26 +0000 | [diff] [blame] | 455 | int rc = 0; |
| 456 | char *busybox; |
John Beppu | 8f425db | 2000-06-27 04:50:02 +0000 | [diff] [blame] | 457 | |
John Beppu | 27b5924 | 2000-06-27 04:56:45 +0000 | [diff] [blame] | 458 | /* to use symlinks, or not to use symlinks... */ |
John Beppu | 8f425db | 2000-06-27 04:50:02 +0000 | [diff] [blame] | 459 | if (argc > 2) { |
| 460 | if ((strcmp(argv[2], "-s") == 0)) { |
| 461 | use_symbolic_links = 1; |
| 462 | } |
| 463 | } |
John Beppu | 7cdc76d | 2000-06-28 00:41:26 +0000 | [diff] [blame] | 464 | |
| 465 | /* link */ |
| 466 | busybox = busybox_fullpath(); |
| 467 | if (busybox) { |
| 468 | install_links(busybox, use_symbolic_links); |
| 469 | free(busybox); |
| 470 | } else { |
| 471 | rc = 1; |
| 472 | } |
| 473 | return rc; |
John Beppu | 8f425db | 2000-06-27 04:50:02 +0000 | [diff] [blame] | 474 | } |
| 475 | #endif /* BB_FEATURE_INSTALLER */ |
| 476 | |
Matt Kraai | 7719008 | 2000-07-11 20:03:24 +0000 | [diff] [blame] | 477 | for (s = applet_name = argv[0]; *s != '\0';) { |
Erik Andersen | e49d5ec | 2000-02-08 19:58:47 +0000 | [diff] [blame] | 478 | if (*s++ == '/') |
Matt Kraai | 7719008 | 2000-07-11 20:03:24 +0000 | [diff] [blame] | 479 | applet_name = s; |
Eric Andersen | cc8ed39 | 1999-10-05 16:24:54 +0000 | [diff] [blame] | 480 | } |
Erik Andersen | e49d5ec | 2000-02-08 19:58:47 +0000 | [diff] [blame] | 481 | |
Eric Andersen | 501c88b | 2000-07-28 15:14:45 +0000 | [diff] [blame] | 482 | *argv = (char*)applet_name; |
Erik Andersen | 029011b | 2000-03-04 21:19:32 +0000 | [diff] [blame] | 483 | |
Eric Andersen | 5d41d60 | 2000-06-29 20:20:14 +0000 | [diff] [blame] | 484 | #ifdef BB_SH |
| 485 | /* Add in a special case hack -- whenever **argv == '-' |
| 486 | * (i.e. '-su' or '-sh') always invoke the shell */ |
Eric Andersen | bf960f5 | 2000-07-21 21:32:12 +0000 | [diff] [blame] | 487 | if (**argv == '-' && *(*argv+1)!= '-') { |
Eric Andersen | 5d41d60 | 2000-06-29 20:20:14 +0000 | [diff] [blame] | 488 | exit(((*(shell_main)) (argc, argv))); |
Eric Andersen | bf960f5 | 2000-07-21 21:32:12 +0000 | [diff] [blame] | 489 | } |
Eric Andersen | 5d41d60 | 2000-06-29 20:20:14 +0000 | [diff] [blame] | 490 | #endif |
| 491 | |
Erik Andersen | e49d5ec | 2000-02-08 19:58:47 +0000 | [diff] [blame] | 492 | while (a->name != 0) { |
Matt Kraai | 7719008 | 2000-07-11 20:03:24 +0000 | [diff] [blame] | 493 | if (strcmp(applet_name, a->name) == 0) { |
Matt Kraai | 27a8042 | 2000-07-19 19:24:01 +0000 | [diff] [blame] | 494 | if (a->usage && argv[1] && strcmp(argv[1], "--help") == 0) |
| 495 | usage(a->usage); |
Eric Andersen | b610615 | 2000-06-19 17:25:40 +0000 | [diff] [blame] | 496 | exit(((*(a->main)) (argc, argv))); |
Erik Andersen | e49d5ec | 2000-02-08 19:58:47 +0000 | [diff] [blame] | 497 | } |
| 498 | a++; |
| 499 | } |
Eric Andersen | b610615 | 2000-06-19 17:25:40 +0000 | [diff] [blame] | 500 | return(busybox_main(argc, argv)); |
Eric Andersen | cc8ed39 | 1999-10-05 16:24:54 +0000 | [diff] [blame] | 501 | } |
| 502 | |
| 503 | |
| 504 | int busybox_main(int argc, char **argv) |
| 505 | { |
Erik Andersen | e49d5ec | 2000-02-08 19:58:47 +0000 | [diff] [blame] | 506 | int col = 0; |
Eric Andersen | cc8ed39 | 1999-10-05 16:24:54 +0000 | [diff] [blame] | 507 | |
Erik Andersen | e49d5ec | 2000-02-08 19:58:47 +0000 | [diff] [blame] | 508 | argc--; |
| 509 | argv++; |
Eric Andersen | cc8ed39 | 1999-10-05 16:24:54 +0000 | [diff] [blame] | 510 | |
Erik Andersen | e49d5ec | 2000-02-08 19:58:47 +0000 | [diff] [blame] | 511 | if (been_there_done_that == 1 || argc < 1) { |
Erik Andersen | bcd6177 | 2000-05-13 06:33:19 +0000 | [diff] [blame] | 512 | const struct BB_applet *a = applets; |
Erik Andersen | e49d5ec | 2000-02-08 19:58:47 +0000 | [diff] [blame] | 513 | |
Pavel Roskin | 9c5fcc3 | 2000-07-17 23:45:12 +0000 | [diff] [blame] | 514 | fprintf(stderr, "%s\n\n" |
Erik Andersen | 330fd2b | 2000-05-19 05:35:19 +0000 | [diff] [blame] | 515 | "Usage: busybox [function] [arguments]...\n" |
| 516 | " or: [function] [arguments]...\n\n" |
John Beppu | b4f8606 | 2000-04-13 03:36:01 +0000 | [diff] [blame] | 517 | "\tBusyBox is a multi-call binary that combines many common Unix\n" |
| 518 | "\tutilities into a single executable. Most people will create a\n" |
| 519 | "\tlink to busybox for each function they wish to use, and BusyBox\n" |
Erik Andersen | 330fd2b | 2000-05-19 05:35:19 +0000 | [diff] [blame] | 520 | "\twill act like whatever it was invoked as.\n" |
Pavel Roskin | 9c5fcc3 | 2000-07-17 23:45:12 +0000 | [diff] [blame] | 521 | "\nCurrently defined functions:\n", full_version); |
Erik Andersen | e49d5ec | 2000-02-08 19:58:47 +0000 | [diff] [blame] | 522 | |
| 523 | while (a->name != 0) { |
| 524 | col += |
| 525 | fprintf(stderr, "%s%s", ((col == 0) ? "\t" : ", "), |
| 526 | (a++)->name); |
| 527 | if (col > 60 && a->name != 0) { |
| 528 | fprintf(stderr, ",\n"); |
| 529 | col = 0; |
| 530 | } |
| 531 | } |
| 532 | fprintf(stderr, "\n\n"); |
| 533 | exit(-1); |
Eric Andersen | cc8ed39 | 1999-10-05 16:24:54 +0000 | [diff] [blame] | 534 | } |
Eric Andersen | b610615 | 2000-06-19 17:25:40 +0000 | [diff] [blame] | 535 | /* If we've already been here once, exit now */ |
| 536 | been_there_done_that = 1; |
| 537 | return (main(argc, argv)); |
Eric Andersen | cc8ed39 | 1999-10-05 16:24:54 +0000 | [diff] [blame] | 538 | } |
Erik Andersen | 029011b | 2000-03-04 21:19:32 +0000 | [diff] [blame] | 539 | |
| 540 | /* |
| 541 | Local Variables: |
| 542 | c-file-style: "linux" |
| 543 | c-basic-offset: 4 |
| 544 | tab-width: 4 |
| 545 | End: |
| 546 | */ |