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 |
Eric Andersen | 92a61c1 | 2000-09-22 20:01:23 +0000 | [diff] [blame] | 352 | #ifdef BB_XARGS |
| 353 | {"xargs", xargs_main, _BB_DIR_USR_BIN, xargs_usage}, |
| 354 | #endif |
Erik Andersen | 298854f | 2000-03-23 01:09:18 +0000 | [diff] [blame] | 355 | #ifdef BB_YES |
Matt Kraai | 27a8042 | 2000-07-19 19:24:01 +0000 | [diff] [blame] | 356 | {"yes", yes_main, _BB_DIR_USR_BIN, yes_usage}, |
Erik Andersen | 3163821 | 2000-01-15 22:28:50 +0000 | [diff] [blame] | 357 | #endif |
Erik Andersen | 298854f | 2000-03-23 01:09:18 +0000 | [diff] [blame] | 358 | #ifdef BB_GUNZIP |
Matt Kraai | 27a8042 | 2000-07-19 19:24:01 +0000 | [diff] [blame] | 359 | {"zcat", gunzip_main, _BB_DIR_BIN, gunzip_usage}, |
Erik Andersen | d75af99 | 2000-03-16 08:09:09 +0000 | [diff] [blame] | 360 | #endif |
Erik Andersen | 5e1189e | 2000-04-15 16:34:54 +0000 | [diff] [blame] | 361 | #ifdef BB_TEST |
Matt Kraai | 27a8042 | 2000-07-19 19:24:01 +0000 | [diff] [blame] | 362 | {"[", test_main, _BB_DIR_USR_BIN, test_usage}, |
Eric Andersen | cc8ed39 | 1999-10-05 16:24:54 +0000 | [diff] [blame] | 363 | #endif |
Matt Kraai | 27a8042 | 2000-07-19 19:24:01 +0000 | [diff] [blame] | 364 | {0,NULL,0,NULL} |
Eric Andersen | cc8ed39 | 1999-10-05 16:24:54 +0000 | [diff] [blame] | 365 | }; |
| 366 | |
Eric Andersen | 501c88b | 2000-07-28 15:14:45 +0000 | [diff] [blame] | 367 | const char *applet_name; |
Erik Andersen | 05df239 | 2000-01-13 04:43:48 +0000 | [diff] [blame] | 368 | |
John Beppu | 8f425db | 2000-06-27 04:50:02 +0000 | [diff] [blame] | 369 | #ifdef BB_FEATURE_INSTALLER |
| 370 | /* |
| 371 | * directory table |
John Beppu | eb02833 | 2000-06-28 00:55:31 +0000 | [diff] [blame] | 372 | * this should be consistent w/ the enum, internal.h::Location, |
| 373 | * or else... |
John Beppu | 8f425db | 2000-06-27 04:50:02 +0000 | [diff] [blame] | 374 | */ |
| 375 | static char* install_dir[] = { |
John Beppu | eb02833 | 2000-06-28 00:55:31 +0000 | [diff] [blame] | 376 | "/", |
| 377 | "/bin", |
| 378 | "/sbin", |
| 379 | "/usr/bin", |
| 380 | "/usr/sbin", |
John Beppu | 8f425db | 2000-06-27 04:50:02 +0000 | [diff] [blame] | 381 | }; |
| 382 | |
| 383 | /* abstract link() */ |
| 384 | typedef int (*__link_f)(const char *, const char *); |
| 385 | |
John Beppu | 7cdc76d | 2000-06-28 00:41:26 +0000 | [diff] [blame] | 386 | /* |
| 387 | * Where in the filesystem is this busybox? |
| 388 | * [return] |
| 389 | * malloc'd string w/ full pathname of busybox's location |
| 390 | * NULL on failure |
| 391 | */ |
| 392 | static char *busybox_fullpath() |
| 393 | { |
John Beppu | eb02833 | 2000-06-28 00:55:31 +0000 | [diff] [blame] | 394 | pid_t pid; |
| 395 | char path[256]; |
| 396 | char proc[256]; |
| 397 | int len; |
John Beppu | 7cdc76d | 2000-06-28 00:41:26 +0000 | [diff] [blame] | 398 | |
| 399 | pid = getpid(); |
| 400 | sprintf(proc, "/proc/%d/exe", pid); |
| 401 | len = readlink(proc, path, 256); |
| 402 | if (len != -1) { |
| 403 | path[len] = 0; |
| 404 | } else { |
Matt Kraai | d537a95 | 2000-07-14 01:51:25 +0000 | [diff] [blame] | 405 | errorMsg("%s: %s\n", proc, strerror(errno)); |
John Beppu | 7cdc76d | 2000-06-28 00:41:26 +0000 | [diff] [blame] | 406 | return NULL; |
| 407 | } |
| 408 | return strdup(path); |
| 409 | } |
| 410 | |
John Beppu | 8f425db | 2000-06-27 04:50:02 +0000 | [diff] [blame] | 411 | /* create (sym)links for each applet */ |
Eric Andersen | c5949f6 | 2000-09-25 20:35:54 +0000 | [diff] [blame^] | 412 | static void install_links(const char *busybox, int use_symbolic_links) |
John Beppu | 8f425db | 2000-06-27 04:50:02 +0000 | [diff] [blame] | 413 | { |
John Beppu | eb02833 | 2000-06-28 00:55:31 +0000 | [diff] [blame] | 414 | __link_f Link = link; |
John Beppu | 8f425db | 2000-06-27 04:50:02 +0000 | [diff] [blame] | 415 | |
John Beppu | eb02833 | 2000-06-28 00:55:31 +0000 | [diff] [blame] | 416 | char command[256]; |
| 417 | int i; |
Eric Andersen | c5949f6 | 2000-09-25 20:35:54 +0000 | [diff] [blame^] | 418 | int rc; |
John Beppu | 8f425db | 2000-06-27 04:50:02 +0000 | [diff] [blame] | 419 | |
| 420 | if (use_symbolic_links) Link = symlink; |
| 421 | |
John Beppu | eb02833 | 2000-06-28 00:55:31 +0000 | [diff] [blame] | 422 | for (i = 0; applets[i].name != NULL; i++) { |
Eric Andersen | c5949f6 | 2000-09-25 20:35:54 +0000 | [diff] [blame^] | 423 | sprintf ( command, "%s/%s", |
| 424 | install_dir[applets[i].location], |
| 425 | applets[i].name); |
| 426 | rc = Link(busybox, command); |
| 427 | |
John Beppu | 8f425db | 2000-06-27 04:50:02 +0000 | [diff] [blame] | 428 | if (rc) { |
Matt Kraai | d537a95 | 2000-07-14 01:51:25 +0000 | [diff] [blame] | 429 | errorMsg("%s: %s\n", command, strerror(errno)); |
John Beppu | 8f425db | 2000-06-27 04:50:02 +0000 | [diff] [blame] | 430 | } |
John Beppu | eb02833 | 2000-06-28 00:55:31 +0000 | [diff] [blame] | 431 | } |
John Beppu | 8f425db | 2000-06-27 04:50:02 +0000 | [diff] [blame] | 432 | } |
| 433 | |
John Beppu | 8f425db | 2000-06-27 04:50:02 +0000 | [diff] [blame] | 434 | #endif /* BB_FEATURE_INSTALLER */ |
| 435 | |
Erik Andersen | 05df239 | 2000-01-13 04:43:48 +0000 | [diff] [blame] | 436 | |
Eric Andersen | cc8ed39 | 1999-10-05 16:24:54 +0000 | [diff] [blame] | 437 | int main(int argc, char **argv) |
| 438 | { |
Eric Andersen | 501c88b | 2000-07-28 15:14:45 +0000 | [diff] [blame] | 439 | const char *s; |
Erik Andersen | bcd6177 | 2000-05-13 06:33:19 +0000 | [diff] [blame] | 440 | const struct BB_applet *a = applets; |
Matt Kraai | d537a95 | 2000-07-14 01:51:25 +0000 | [diff] [blame] | 441 | applet_name = "busybox"; |
Eric Andersen | cc8ed39 | 1999-10-05 16:24:54 +0000 | [diff] [blame] | 442 | |
John Beppu | 8f425db | 2000-06-27 04:50:02 +0000 | [diff] [blame] | 443 | #ifdef BB_FEATURE_INSTALLER |
John Beppu | 27b5924 | 2000-06-27 04:56:45 +0000 | [diff] [blame] | 444 | /* |
| 445 | * This style of argument parsing doesn't scale well |
| 446 | * in the event that busybox starts wanting more --options. |
| 447 | * If someone has a cleaner approach, by all means implement it. |
| 448 | */ |
John Beppu | 8f425db | 2000-06-27 04:50:02 +0000 | [diff] [blame] | 449 | if (argc > 1 && (strcmp(argv[1], "--install") == 0)) { |
| 450 | int use_symbolic_links = 0; |
John Beppu | 7cdc76d | 2000-06-28 00:41:26 +0000 | [diff] [blame] | 451 | int rc = 0; |
| 452 | char *busybox; |
John Beppu | 8f425db | 2000-06-27 04:50:02 +0000 | [diff] [blame] | 453 | |
John Beppu | 27b5924 | 2000-06-27 04:56:45 +0000 | [diff] [blame] | 454 | /* to use symlinks, or not to use symlinks... */ |
John Beppu | 8f425db | 2000-06-27 04:50:02 +0000 | [diff] [blame] | 455 | if (argc > 2) { |
| 456 | if ((strcmp(argv[2], "-s") == 0)) { |
| 457 | use_symbolic_links = 1; |
| 458 | } |
| 459 | } |
John Beppu | 7cdc76d | 2000-06-28 00:41:26 +0000 | [diff] [blame] | 460 | |
| 461 | /* link */ |
| 462 | busybox = busybox_fullpath(); |
| 463 | if (busybox) { |
| 464 | install_links(busybox, use_symbolic_links); |
| 465 | free(busybox); |
| 466 | } else { |
| 467 | rc = 1; |
| 468 | } |
| 469 | return rc; |
John Beppu | 8f425db | 2000-06-27 04:50:02 +0000 | [diff] [blame] | 470 | } |
| 471 | #endif /* BB_FEATURE_INSTALLER */ |
| 472 | |
Matt Kraai | 7719008 | 2000-07-11 20:03:24 +0000 | [diff] [blame] | 473 | for (s = applet_name = argv[0]; *s != '\0';) { |
Erik Andersen | e49d5ec | 2000-02-08 19:58:47 +0000 | [diff] [blame] | 474 | if (*s++ == '/') |
Matt Kraai | 7719008 | 2000-07-11 20:03:24 +0000 | [diff] [blame] | 475 | applet_name = s; |
Eric Andersen | cc8ed39 | 1999-10-05 16:24:54 +0000 | [diff] [blame] | 476 | } |
Erik Andersen | e49d5ec | 2000-02-08 19:58:47 +0000 | [diff] [blame] | 477 | |
Eric Andersen | 501c88b | 2000-07-28 15:14:45 +0000 | [diff] [blame] | 478 | *argv = (char*)applet_name; |
Erik Andersen | 029011b | 2000-03-04 21:19:32 +0000 | [diff] [blame] | 479 | |
Eric Andersen | 5d41d60 | 2000-06-29 20:20:14 +0000 | [diff] [blame] | 480 | #ifdef BB_SH |
| 481 | /* Add in a special case hack -- whenever **argv == '-' |
| 482 | * (i.e. '-su' or '-sh') always invoke the shell */ |
Eric Andersen | bf960f5 | 2000-07-21 21:32:12 +0000 | [diff] [blame] | 483 | if (**argv == '-' && *(*argv+1)!= '-') { |
Eric Andersen | 5d41d60 | 2000-06-29 20:20:14 +0000 | [diff] [blame] | 484 | exit(((*(shell_main)) (argc, argv))); |
Eric Andersen | bf960f5 | 2000-07-21 21:32:12 +0000 | [diff] [blame] | 485 | } |
Eric Andersen | 5d41d60 | 2000-06-29 20:20:14 +0000 | [diff] [blame] | 486 | #endif |
| 487 | |
Erik Andersen | e49d5ec | 2000-02-08 19:58:47 +0000 | [diff] [blame] | 488 | while (a->name != 0) { |
Matt Kraai | 7719008 | 2000-07-11 20:03:24 +0000 | [diff] [blame] | 489 | if (strcmp(applet_name, a->name) == 0) { |
Matt Kraai | 27a8042 | 2000-07-19 19:24:01 +0000 | [diff] [blame] | 490 | if (a->usage && argv[1] && strcmp(argv[1], "--help") == 0) |
| 491 | usage(a->usage); |
Eric Andersen | b610615 | 2000-06-19 17:25:40 +0000 | [diff] [blame] | 492 | exit(((*(a->main)) (argc, argv))); |
Erik Andersen | e49d5ec | 2000-02-08 19:58:47 +0000 | [diff] [blame] | 493 | } |
| 494 | a++; |
| 495 | } |
Eric Andersen | b610615 | 2000-06-19 17:25:40 +0000 | [diff] [blame] | 496 | return(busybox_main(argc, argv)); |
Eric Andersen | cc8ed39 | 1999-10-05 16:24:54 +0000 | [diff] [blame] | 497 | } |
| 498 | |
| 499 | |
| 500 | int busybox_main(int argc, char **argv) |
| 501 | { |
Erik Andersen | e49d5ec | 2000-02-08 19:58:47 +0000 | [diff] [blame] | 502 | int col = 0; |
Eric Andersen | cc8ed39 | 1999-10-05 16:24:54 +0000 | [diff] [blame] | 503 | |
Erik Andersen | e49d5ec | 2000-02-08 19:58:47 +0000 | [diff] [blame] | 504 | argc--; |
| 505 | argv++; |
Eric Andersen | cc8ed39 | 1999-10-05 16:24:54 +0000 | [diff] [blame] | 506 | |
Erik Andersen | e49d5ec | 2000-02-08 19:58:47 +0000 | [diff] [blame] | 507 | if (been_there_done_that == 1 || argc < 1) { |
Erik Andersen | bcd6177 | 2000-05-13 06:33:19 +0000 | [diff] [blame] | 508 | const struct BB_applet *a = applets; |
Erik Andersen | e49d5ec | 2000-02-08 19:58:47 +0000 | [diff] [blame] | 509 | |
Pavel Roskin | 9c5fcc3 | 2000-07-17 23:45:12 +0000 | [diff] [blame] | 510 | fprintf(stderr, "%s\n\n" |
Erik Andersen | 330fd2b | 2000-05-19 05:35:19 +0000 | [diff] [blame] | 511 | "Usage: busybox [function] [arguments]...\n" |
| 512 | " or: [function] [arguments]...\n\n" |
John Beppu | b4f8606 | 2000-04-13 03:36:01 +0000 | [diff] [blame] | 513 | "\tBusyBox is a multi-call binary that combines many common Unix\n" |
| 514 | "\tutilities into a single executable. Most people will create a\n" |
| 515 | "\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] | 516 | "\twill act like whatever it was invoked as.\n" |
Pavel Roskin | 9c5fcc3 | 2000-07-17 23:45:12 +0000 | [diff] [blame] | 517 | "\nCurrently defined functions:\n", full_version); |
Erik Andersen | e49d5ec | 2000-02-08 19:58:47 +0000 | [diff] [blame] | 518 | |
| 519 | while (a->name != 0) { |
| 520 | col += |
| 521 | fprintf(stderr, "%s%s", ((col == 0) ? "\t" : ", "), |
| 522 | (a++)->name); |
| 523 | if (col > 60 && a->name != 0) { |
| 524 | fprintf(stderr, ",\n"); |
| 525 | col = 0; |
| 526 | } |
| 527 | } |
| 528 | fprintf(stderr, "\n\n"); |
| 529 | exit(-1); |
Eric Andersen | cc8ed39 | 1999-10-05 16:24:54 +0000 | [diff] [blame] | 530 | } |
Eric Andersen | b610615 | 2000-06-19 17:25:40 +0000 | [diff] [blame] | 531 | /* If we've already been here once, exit now */ |
| 532 | been_there_done_that = 1; |
| 533 | return (main(argc, argv)); |
Eric Andersen | cc8ed39 | 1999-10-05 16:24:54 +0000 | [diff] [blame] | 534 | } |
Erik Andersen | 029011b | 2000-03-04 21:19:32 +0000 | [diff] [blame] | 535 | |
| 536 | /* |
| 537 | Local Variables: |
| 538 | c-file-style: "linux" |
| 539 | c-basic-offset: 4 |
| 540 | tab-width: 4 |
| 541 | End: |
| 542 | */ |