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