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 | |
| 7 | static int been_there_done_that = 0; |
| 8 | |
Erik Andersen | 3163821 | 2000-01-15 22:28:50 +0000 | [diff] [blame] | 9 | /* It has been alledged that doing such things can |
| 10 | * help reduce binary size when staticly linking, |
| 11 | * of course with glibc, this is unlikely as long |
| 12 | * as we use things like printf -- perhaps a printf |
| 13 | * replacement may be in order |
| 14 | */ |
Erik Andersen | 05df239 | 2000-01-13 04:43:48 +0000 | [diff] [blame] | 15 | #if 0 |
Erik Andersen | e49d5ec | 2000-02-08 19:58:47 +0000 | [diff] [blame] | 16 | void exit(int status) __attribute__ ((noreturn)); |
| 17 | void exit(int status) |
| 18 | { |
| 19 | _exit(status); |
| 20 | }; |
| 21 | void abort(void) __attribute__ ((__noreturn__)); |
| 22 | void abort(void) |
| 23 | { |
| 24 | _exit(0); |
| 25 | }; |
| 26 | int atexit(void (*__func) (void)) |
| 27 | { |
| 28 | _exit(0); |
| 29 | }; |
Erik Andersen | 05df239 | 2000-01-13 04:43:48 +0000 | [diff] [blame] | 30 | void *__libc_stack_end; |
| 31 | #endif |
| 32 | |
Eric Andersen | cc8ed39 | 1999-10-05 16:24:54 +0000 | [diff] [blame] | 33 | static const struct Applet applets[] = { |
| 34 | |
Erik Andersen | 298854f | 2000-03-23 01:09:18 +0000 | [diff] [blame] | 35 | #ifdef BB_BASENAME |
Erik Andersen | d75af99 | 2000-03-16 08:09:09 +0000 | [diff] [blame] | 36 | {"basename", basename_main, _BB_DIR_USR_BIN}, |
Erik Andersen | e272915 | 2000-02-18 21:34:17 +0000 | [diff] [blame] | 37 | #endif |
Erik Andersen | 298854f | 2000-03-23 01:09:18 +0000 | [diff] [blame] | 38 | #ifdef BB_BUSYBOX |
Erik Andersen | d75af99 | 2000-03-16 08:09:09 +0000 | [diff] [blame] | 39 | {"busybox", busybox_main, _BB_DIR_BIN}, |
Eric Andersen | cc8ed39 | 1999-10-05 16:24:54 +0000 | [diff] [blame] | 40 | #endif |
Erik Andersen | 298854f | 2000-03-23 01:09:18 +0000 | [diff] [blame] | 41 | #ifdef BB_BLOCK_DEVICE |
Erik Andersen | d75af99 | 2000-03-16 08:09:09 +0000 | [diff] [blame] | 42 | {"block_device", block_device_main, _BB_DIR_SBIN}, |
Eric Andersen | cc8ed39 | 1999-10-05 16:24:54 +0000 | [diff] [blame] | 43 | #endif |
Erik Andersen | 298854f | 2000-03-23 01:09:18 +0000 | [diff] [blame] | 44 | #ifdef BB_CAT |
Erik Andersen | d75af99 | 2000-03-16 08:09:09 +0000 | [diff] [blame] | 45 | {"cat", cat_main, _BB_DIR_BIN}, |
Eric Andersen | cc8ed39 | 1999-10-05 16:24:54 +0000 | [diff] [blame] | 46 | #endif |
Erik Andersen | 298854f | 2000-03-23 01:09:18 +0000 | [diff] [blame] | 47 | #ifdef BB_CHMOD_CHOWN_CHGRP |
Erik Andersen | d75af99 | 2000-03-16 08:09:09 +0000 | [diff] [blame] | 48 | {"chmod", chmod_chown_chgrp_main, _BB_DIR_BIN}, |
| 49 | #endif |
Erik Andersen | 298854f | 2000-03-23 01:09:18 +0000 | [diff] [blame] | 50 | #ifdef BB_CHMOD_CHOWN_CHGRP |
Erik Andersen | d75af99 | 2000-03-16 08:09:09 +0000 | [diff] [blame] | 51 | {"chown", chmod_chown_chgrp_main, _BB_DIR_BIN}, |
| 52 | #endif |
Erik Andersen | 298854f | 2000-03-23 01:09:18 +0000 | [diff] [blame] | 53 | #ifdef BB_CHMOD_CHOWN_CHGRP |
Erik Andersen | d75af99 | 2000-03-16 08:09:09 +0000 | [diff] [blame] | 54 | {"chgrp", chmod_chown_chgrp_main, _BB_DIR_BIN}, |
Eric Andersen | cc8ed39 | 1999-10-05 16:24:54 +0000 | [diff] [blame] | 55 | #endif |
Erik Andersen | 298854f | 2000-03-23 01:09:18 +0000 | [diff] [blame] | 56 | #ifdef BB_CHROOT |
Erik Andersen | d75af99 | 2000-03-16 08:09:09 +0000 | [diff] [blame] | 57 | {"chroot", chroot_main, _BB_DIR_SBIN}, |
Eric Andersen | cc8ed39 | 1999-10-05 16:24:54 +0000 | [diff] [blame] | 58 | #endif |
Erik Andersen | 298854f | 2000-03-23 01:09:18 +0000 | [diff] [blame] | 59 | #ifdef BB_CLEAR |
Erik Andersen | d75af99 | 2000-03-16 08:09:09 +0000 | [diff] [blame] | 60 | {"clear", clear_main, _BB_DIR_USR_BIN}, |
Eric Andersen | cc8ed39 | 1999-10-05 16:24:54 +0000 | [diff] [blame] | 61 | #endif |
Erik Andersen | 298854f | 2000-03-23 01:09:18 +0000 | [diff] [blame] | 62 | #ifdef BB_CHVT |
Erik Andersen | d75af99 | 2000-03-16 08:09:09 +0000 | [diff] [blame] | 63 | {"chvt", chvt_main, _BB_DIR_USR_BIN}, |
Eric Andersen | abc0f4f | 1999-12-08 23:19:36 +0000 | [diff] [blame] | 64 | #endif |
Erik Andersen | 298854f | 2000-03-23 01:09:18 +0000 | [diff] [blame] | 65 | #ifdef BB_CP_MV |
Erik Andersen | d75af99 | 2000-03-16 08:09:09 +0000 | [diff] [blame] | 66 | {"cp", cp_mv_main, _BB_DIR_BIN}, |
| 67 | #endif |
Erik Andersen | 298854f | 2000-03-23 01:09:18 +0000 | [diff] [blame] | 68 | #ifdef BB_CP_MV |
Erik Andersen | d75af99 | 2000-03-16 08:09:09 +0000 | [diff] [blame] | 69 | {"mv", cp_mv_main, _BB_DIR_BIN}, |
Eric Andersen | cc8ed39 | 1999-10-05 16:24:54 +0000 | [diff] [blame] | 70 | #endif |
Erik Andersen | 298854f | 2000-03-23 01:09:18 +0000 | [diff] [blame] | 71 | #ifdef BB_DATE |
Erik Andersen | d75af99 | 2000-03-16 08:09:09 +0000 | [diff] [blame] | 72 | {"date", date_main, _BB_DIR_BIN}, |
Eric Andersen | cc8ed39 | 1999-10-05 16:24:54 +0000 | [diff] [blame] | 73 | #endif |
Erik Andersen | 298854f | 2000-03-23 01:09:18 +0000 | [diff] [blame] | 74 | #ifdef BB_DD |
Erik Andersen | d75af99 | 2000-03-16 08:09:09 +0000 | [diff] [blame] | 75 | {"dd", dd_main, _BB_DIR_BIN}, |
Eric Andersen | cc8ed39 | 1999-10-05 16:24:54 +0000 | [diff] [blame] | 76 | #endif |
Erik Andersen | 298854f | 2000-03-23 01:09:18 +0000 | [diff] [blame] | 77 | #ifdef BB_DF |
Erik Andersen | d75af99 | 2000-03-16 08:09:09 +0000 | [diff] [blame] | 78 | {"df", df_main, _BB_DIR_BIN}, |
Eric Andersen | cc8ed39 | 1999-10-05 16:24:54 +0000 | [diff] [blame] | 79 | #endif |
Erik Andersen | 298854f | 2000-03-23 01:09:18 +0000 | [diff] [blame] | 80 | #ifdef BB_DIRNAME |
Erik Andersen | d75af99 | 2000-03-16 08:09:09 +0000 | [diff] [blame] | 81 | {"dirname", dirname_main, _BB_DIR_USR_BIN}, |
Erik Andersen | fb002d0 | 2000-03-05 08:07:00 +0000 | [diff] [blame] | 82 | #endif |
Erik Andersen | 298854f | 2000-03-23 01:09:18 +0000 | [diff] [blame] | 83 | #ifdef BB_DMESG |
Erik Andersen | d75af99 | 2000-03-16 08:09:09 +0000 | [diff] [blame] | 84 | {"dmesg", dmesg_main, _BB_DIR_BIN}, |
Eric Andersen | cc8ed39 | 1999-10-05 16:24:54 +0000 | [diff] [blame] | 85 | #endif |
Erik Andersen | 298854f | 2000-03-23 01:09:18 +0000 | [diff] [blame] | 86 | #ifdef BB_DU |
Erik Andersen | d75af99 | 2000-03-16 08:09:09 +0000 | [diff] [blame] | 87 | {"du", du_main, _BB_DIR_BIN}, |
John Beppu | 7a98606 | 1999-12-09 18:29:29 +0000 | [diff] [blame] | 88 | #endif |
Erik Andersen | 298854f | 2000-03-23 01:09:18 +0000 | [diff] [blame] | 89 | #ifdef BB_DUTMP |
Erik Andersen | d75af99 | 2000-03-16 08:09:09 +0000 | [diff] [blame] | 90 | {"dutmp", dutmp_main, _BB_DIR_USR_SBIN}, |
| 91 | #endif |
Erik Andersen | 298854f | 2000-03-23 01:09:18 +0000 | [diff] [blame] | 92 | #ifdef BB_ECHO |
Erik Andersen | d75af99 | 2000-03-16 08:09:09 +0000 | [diff] [blame] | 93 | {"echo", echo_main, _BB_DIR_BIN}, |
Eric Andersen | cc8ed39 | 1999-10-05 16:24:54 +0000 | [diff] [blame] | 94 | #endif |
Erik Andersen | 298854f | 2000-03-23 01:09:18 +0000 | [diff] [blame] | 95 | #ifdef BB_FBSET |
Erik Andersen | d75af99 | 2000-03-16 08:09:09 +0000 | [diff] [blame] | 96 | {"fbset", fbset_main, _BB_DIR_USR_SBIN}, |
Erik Andersen | 1c5b258 | 1999-12-16 20:59:36 +0000 | [diff] [blame] | 97 | #endif |
Erik Andersen | 298854f | 2000-03-23 01:09:18 +0000 | [diff] [blame] | 98 | #ifdef BB_FDFLUSH |
Erik Andersen | d75af99 | 2000-03-16 08:09:09 +0000 | [diff] [blame] | 99 | {"fdflush", fdflush_main, _BB_DIR_BIN}, |
Eric Andersen | cc8ed39 | 1999-10-05 16:24:54 +0000 | [diff] [blame] | 100 | #endif |
Erik Andersen | 298854f | 2000-03-23 01:09:18 +0000 | [diff] [blame] | 101 | #ifdef BB_FIND |
Erik Andersen | d75af99 | 2000-03-16 08:09:09 +0000 | [diff] [blame] | 102 | {"find", find_main, _BB_DIR_USR_BIN}, |
Eric Andersen | cc8ed39 | 1999-10-05 16:24:54 +0000 | [diff] [blame] | 103 | #endif |
Erik Andersen | 298854f | 2000-03-23 01:09:18 +0000 | [diff] [blame] | 104 | #ifdef BB_FREE |
Erik Andersen | d75af99 | 2000-03-16 08:09:09 +0000 | [diff] [blame] | 105 | {"free", free_main, _BB_DIR_USR_BIN}, |
Eric Andersen | 0460ff2 | 1999-10-25 23:32:44 +0000 | [diff] [blame] | 106 | #endif |
Erik Andersen | 298854f | 2000-03-23 01:09:18 +0000 | [diff] [blame] | 107 | #ifdef BB_FREERAMDISK |
Erik Andersen | d75af99 | 2000-03-16 08:09:09 +0000 | [diff] [blame] | 108 | {"freeramdisk", freeramdisk_main, _BB_DIR_SBIN}, |
Erik Andersen | 6437170 | 2000-03-04 22:23:27 +0000 | [diff] [blame] | 109 | #endif |
Erik Andersen | 298854f | 2000-03-23 01:09:18 +0000 | [diff] [blame] | 110 | #ifdef BB_DEALLOCVT |
Erik Andersen | d75af99 | 2000-03-16 08:09:09 +0000 | [diff] [blame] | 111 | {"deallocvt", deallocvt_main, _BB_DIR_USR_BIN}, |
Eric Andersen | 0460ff2 | 1999-10-25 23:32:44 +0000 | [diff] [blame] | 112 | #endif |
Erik Andersen | 298854f | 2000-03-23 01:09:18 +0000 | [diff] [blame] | 113 | #ifdef BB_FSCK_MINIX |
Erik Andersen | d75af99 | 2000-03-16 08:09:09 +0000 | [diff] [blame] | 114 | {"fsck.minix", fsck_minix_main, _BB_DIR_SBIN}, |
Eric Andersen | e494fdd | 1999-10-19 20:23:03 +0000 | [diff] [blame] | 115 | #endif |
Erik Andersen | 298854f | 2000-03-23 01:09:18 +0000 | [diff] [blame] | 116 | #ifdef BB_MKFS_MINIX |
Erik Andersen | d75af99 | 2000-03-16 08:09:09 +0000 | [diff] [blame] | 117 | {"mkfs.minix", mkfs_minix_main, _BB_DIR_SBIN}, |
Eric Andersen | e494fdd | 1999-10-19 20:23:03 +0000 | [diff] [blame] | 118 | #endif |
Erik Andersen | 298854f | 2000-03-23 01:09:18 +0000 | [diff] [blame] | 119 | #ifdef BB_GREP |
Erik Andersen | d75af99 | 2000-03-16 08:09:09 +0000 | [diff] [blame] | 120 | {"grep", grep_main, _BB_DIR_BIN}, |
Eric Andersen | cc8ed39 | 1999-10-05 16:24:54 +0000 | [diff] [blame] | 121 | #endif |
Erik Andersen | 298854f | 2000-03-23 01:09:18 +0000 | [diff] [blame] | 122 | #ifdef BB_HALT |
Erik Andersen | d75af99 | 2000-03-16 08:09:09 +0000 | [diff] [blame] | 123 | {"halt", halt_main, _BB_DIR_SBIN}, |
Eric Andersen | cc8ed39 | 1999-10-05 16:24:54 +0000 | [diff] [blame] | 124 | #endif |
Erik Andersen | 298854f | 2000-03-23 01:09:18 +0000 | [diff] [blame] | 125 | #ifdef BB_HEAD |
Erik Andersen | d75af99 | 2000-03-16 08:09:09 +0000 | [diff] [blame] | 126 | {"head", head_main, _BB_DIR_BIN}, |
John Beppu | 3157b1f | 1999-12-10 07:42:50 +0000 | [diff] [blame] | 127 | #endif |
Erik Andersen | 298854f | 2000-03-23 01:09:18 +0000 | [diff] [blame] | 128 | #ifdef BB_HOSTID |
Erik Andersen | d75af99 | 2000-03-16 08:09:09 +0000 | [diff] [blame] | 129 | {"hostid", hostid_main, _BB_DIR_USR_BIN}, |
Erik Andersen | 3163821 | 2000-01-15 22:28:50 +0000 | [diff] [blame] | 130 | #endif |
Erik Andersen | 298854f | 2000-03-23 01:09:18 +0000 | [diff] [blame] | 131 | #ifdef BB_HOSTNAME |
Erik Andersen | d75af99 | 2000-03-16 08:09:09 +0000 | [diff] [blame] | 132 | {"hostname", hostname_main, _BB_DIR_BIN}, |
Eric Andersen | 485b955 | 1999-12-07 23:14:59 +0000 | [diff] [blame] | 133 | #endif |
Erik Andersen | 298854f | 2000-03-23 01:09:18 +0000 | [diff] [blame] | 134 | #ifdef BB_INIT |
Erik Andersen | d75af99 | 2000-03-16 08:09:09 +0000 | [diff] [blame] | 135 | {"init", init_main, _BB_DIR_SBIN}, |
Eric Andersen | cc8ed39 | 1999-10-05 16:24:54 +0000 | [diff] [blame] | 136 | #endif |
Erik Andersen | 298854f | 2000-03-23 01:09:18 +0000 | [diff] [blame] | 137 | #ifdef BB_INSMOD |
Erik Andersen | d75af99 | 2000-03-16 08:09:09 +0000 | [diff] [blame] | 138 | {"insmod", insmod_main, _BB_DIR_SBIN}, |
Erik Andersen | 6da0ae8 | 1999-12-17 01:08:27 +0000 | [diff] [blame] | 139 | #endif |
Erik Andersen | e49d5ec | 2000-02-08 19:58:47 +0000 | [diff] [blame] | 140 | #ifdef BB_FEATURE_LINUXRC // |
Erik Andersen | d75af99 | 2000-03-16 08:09:09 +0000 | [diff] [blame] | 141 | {"linuxrc", init_main, _BB_DIR_ROOT}, |
Eric Andersen | 6a76e65 | 1999-11-19 05:31:45 +0000 | [diff] [blame] | 142 | #endif |
Erik Andersen | 298854f | 2000-03-23 01:09:18 +0000 | [diff] [blame] | 143 | #ifdef BB_KILL |
Erik Andersen | d75af99 | 2000-03-16 08:09:09 +0000 | [diff] [blame] | 144 | {"kill", kill_main, _BB_DIR_BIN}, |
Eric Andersen | cc8ed39 | 1999-10-05 16:24:54 +0000 | [diff] [blame] | 145 | #endif |
Erik Andersen | 298854f | 2000-03-23 01:09:18 +0000 | [diff] [blame] | 146 | #ifdef BB_KILLALL |
Erik Andersen | d75af99 | 2000-03-16 08:09:09 +0000 | [diff] [blame] | 147 | {"killall", kill_main, _BB_DIR_USR_BIN}, |
Erik Andersen | 246cc6d | 2000-03-07 07:41:42 +0000 | [diff] [blame] | 148 | #endif |
Erik Andersen | 298854f | 2000-03-23 01:09:18 +0000 | [diff] [blame] | 149 | #ifdef BB_LENGTH |
Erik Andersen | d75af99 | 2000-03-16 08:09:09 +0000 | [diff] [blame] | 150 | {"length", length_main, _BB_DIR_USR_BIN}, |
Eric Andersen | cc8ed39 | 1999-10-05 16:24:54 +0000 | [diff] [blame] | 151 | #endif |
Erik Andersen | 298854f | 2000-03-23 01:09:18 +0000 | [diff] [blame] | 152 | #ifdef BB_LN |
Erik Andersen | d75af99 | 2000-03-16 08:09:09 +0000 | [diff] [blame] | 153 | {"ln", ln_main, _BB_DIR_BIN}, |
Eric Andersen | cc8ed39 | 1999-10-05 16:24:54 +0000 | [diff] [blame] | 154 | #endif |
Erik Andersen | 298854f | 2000-03-23 01:09:18 +0000 | [diff] [blame] | 155 | #ifdef BB_LOADACM |
Erik Andersen | d75af99 | 2000-03-16 08:09:09 +0000 | [diff] [blame] | 156 | {"loadacm", loadacm_main, _BB_DIR_USR_BIN}, |
Eric Andersen | 3e0fbae | 1999-10-19 06:02:44 +0000 | [diff] [blame] | 157 | #endif |
Erik Andersen | 298854f | 2000-03-23 01:09:18 +0000 | [diff] [blame] | 158 | #ifdef BB_LOADFONT |
Erik Andersen | d75af99 | 2000-03-16 08:09:09 +0000 | [diff] [blame] | 159 | {"loadfont", loadfont_main, _BB_DIR_USR_BIN}, |
Eric Andersen | cc8ed39 | 1999-10-05 16:24:54 +0000 | [diff] [blame] | 160 | #endif |
Erik Andersen | 298854f | 2000-03-23 01:09:18 +0000 | [diff] [blame] | 161 | #ifdef BB_LOADKMAP |
Erik Andersen | d75af99 | 2000-03-16 08:09:09 +0000 | [diff] [blame] | 162 | {"loadkmap", loadkmap_main, _BB_DIR_SBIN}, |
Eric Andersen | cc8ed39 | 1999-10-05 16:24:54 +0000 | [diff] [blame] | 163 | #endif |
Erik Andersen | 298854f | 2000-03-23 01:09:18 +0000 | [diff] [blame] | 164 | #ifdef BB_LS |
Erik Andersen | d75af99 | 2000-03-16 08:09:09 +0000 | [diff] [blame] | 165 | {"ls", ls_main, _BB_DIR_BIN}, |
Erik Andersen | 6f23cec | 1999-12-15 22:14:12 +0000 | [diff] [blame] | 166 | #endif |
Erik Andersen | 298854f | 2000-03-23 01:09:18 +0000 | [diff] [blame] | 167 | #ifdef BB_LSMOD |
Erik Andersen | d75af99 | 2000-03-16 08:09:09 +0000 | [diff] [blame] | 168 | {"lsmod", lsmod_main, _BB_DIR_SBIN}, |
Eric Andersen | cc8ed39 | 1999-10-05 16:24:54 +0000 | [diff] [blame] | 169 | #endif |
Erik Andersen | 298854f | 2000-03-23 01:09:18 +0000 | [diff] [blame] | 170 | #ifdef BB_MAKEDEVS |
Erik Andersen | d75af99 | 2000-03-16 08:09:09 +0000 | [diff] [blame] | 171 | {"makedevs", makedevs_main, _BB_DIR_SBIN}, |
Eric Andersen | cc8ed39 | 1999-10-05 16:24:54 +0000 | [diff] [blame] | 172 | #endif |
Erik Andersen | 298854f | 2000-03-23 01:09:18 +0000 | [diff] [blame] | 173 | #ifdef BB_MATH |
Erik Andersen | d75af99 | 2000-03-16 08:09:09 +0000 | [diff] [blame] | 174 | {"math", math_main, _BB_DIR_USR_BIN}, |
Eric Andersen | cc8ed39 | 1999-10-05 16:24:54 +0000 | [diff] [blame] | 175 | #endif |
Erik Andersen | 298854f | 2000-03-23 01:09:18 +0000 | [diff] [blame] | 176 | #ifdef BB_MKDIR |
Erik Andersen | d75af99 | 2000-03-16 08:09:09 +0000 | [diff] [blame] | 177 | {"mkdir", mkdir_main, _BB_DIR_BIN}, |
Erik Andersen | e49d5ec | 2000-02-08 19:58:47 +0000 | [diff] [blame] | 178 | #endif |
Erik Andersen | 298854f | 2000-03-23 01:09:18 +0000 | [diff] [blame] | 179 | #ifdef BB_MKFIFO |
Erik Andersen | d75af99 | 2000-03-16 08:09:09 +0000 | [diff] [blame] | 180 | {"mkfifo", mkfifo_main, _BB_DIR_USR_BIN}, |
Eric Andersen | 19db07b | 1999-12-11 08:41:28 +0000 | [diff] [blame] | 181 | #endif |
Erik Andersen | 298854f | 2000-03-23 01:09:18 +0000 | [diff] [blame] | 182 | #ifdef BB_MKNOD |
Erik Andersen | d75af99 | 2000-03-16 08:09:09 +0000 | [diff] [blame] | 183 | {"mknod", mknod_main, _BB_DIR_BIN}, |
Eric Andersen | cc8ed39 | 1999-10-05 16:24:54 +0000 | [diff] [blame] | 184 | #endif |
Erik Andersen | 298854f | 2000-03-23 01:09:18 +0000 | [diff] [blame] | 185 | #ifdef BB_MKSWAP |
Erik Andersen | d75af99 | 2000-03-16 08:09:09 +0000 | [diff] [blame] | 186 | {"mkswap", mkswap_main, _BB_DIR_SBIN}, |
Eric Andersen | cc8ed39 | 1999-10-05 16:24:54 +0000 | [diff] [blame] | 187 | #endif |
Erik Andersen | 298854f | 2000-03-23 01:09:18 +0000 | [diff] [blame] | 188 | #ifdef BB_MNC |
Erik Andersen | d75af99 | 2000-03-16 08:09:09 +0000 | [diff] [blame] | 189 | {"mnc", mnc_main, _BB_DIR_USR_BIN}, |
Eric Andersen | cc8ed39 | 1999-10-05 16:24:54 +0000 | [diff] [blame] | 190 | #endif |
Erik Andersen | 298854f | 2000-03-23 01:09:18 +0000 | [diff] [blame] | 191 | #ifdef BB_MORE |
Erik Andersen | d75af99 | 2000-03-16 08:09:09 +0000 | [diff] [blame] | 192 | {"more", more_main, _BB_DIR_BIN}, |
Eric Andersen | cc8ed39 | 1999-10-05 16:24:54 +0000 | [diff] [blame] | 193 | #endif |
Erik Andersen | 298854f | 2000-03-23 01:09:18 +0000 | [diff] [blame] | 194 | #ifdef BB_MOUNT |
Erik Andersen | d75af99 | 2000-03-16 08:09:09 +0000 | [diff] [blame] | 195 | {"mount", mount_main, _BB_DIR_BIN}, |
Eric Andersen | cc8ed39 | 1999-10-05 16:24:54 +0000 | [diff] [blame] | 196 | #endif |
Erik Andersen | 298854f | 2000-03-23 01:09:18 +0000 | [diff] [blame] | 197 | #ifdef BB_MT |
Erik Andersen | d75af99 | 2000-03-16 08:09:09 +0000 | [diff] [blame] | 198 | {"mt", mt_main, _BB_DIR_BIN}, |
Eric Andersen | cc8ed39 | 1999-10-05 16:24:54 +0000 | [diff] [blame] | 199 | #endif |
Erik Andersen | 298854f | 2000-03-23 01:09:18 +0000 | [diff] [blame] | 200 | #ifdef BB_NSLOOKUP |
Erik Andersen | d75af99 | 2000-03-16 08:09:09 +0000 | [diff] [blame] | 201 | {"nslookup", nslookup_main, _BB_DIR_USR_BIN}, |
John Beppu | b332e77 | 2000-01-29 12:59:01 +0000 | [diff] [blame] | 202 | #endif |
Erik Andersen | 298854f | 2000-03-23 01:09:18 +0000 | [diff] [blame] | 203 | #ifdef BB_PING |
Erik Andersen | d75af99 | 2000-03-16 08:09:09 +0000 | [diff] [blame] | 204 | {"ping", ping_main, _BB_DIR_BIN}, |
Eric Andersen | 485b955 | 1999-12-07 23:14:59 +0000 | [diff] [blame] | 205 | #endif |
Erik Andersen | 298854f | 2000-03-23 01:09:18 +0000 | [diff] [blame] | 206 | #ifdef BB_POWEROFF |
Erik Andersen | d75af99 | 2000-03-16 08:09:09 +0000 | [diff] [blame] | 207 | {"poweroff", poweroff_main, _BB_DIR_SBIN}, |
Eric Andersen | 2cb5507 | 1999-12-10 08:25:07 +0000 | [diff] [blame] | 208 | #endif |
Erik Andersen | 298854f | 2000-03-23 01:09:18 +0000 | [diff] [blame] | 209 | #ifdef BB_PRINTF |
Erik Andersen | d75af99 | 2000-03-16 08:09:09 +0000 | [diff] [blame] | 210 | {"printf", printf_main, _BB_DIR_USR_BIN}, |
Eric Andersen | cc8ed39 | 1999-10-05 16:24:54 +0000 | [diff] [blame] | 211 | #endif |
Erik Andersen | 298854f | 2000-03-23 01:09:18 +0000 | [diff] [blame] | 212 | #ifdef BB_PS |
Erik Andersen | d75af99 | 2000-03-16 08:09:09 +0000 | [diff] [blame] | 213 | {"ps", ps_main, _BB_DIR_BIN}, |
Eric Andersen | ef8b6c7 | 1999-10-20 08:05:35 +0000 | [diff] [blame] | 214 | #endif |
Erik Andersen | 298854f | 2000-03-23 01:09:18 +0000 | [diff] [blame] | 215 | #ifdef BB_PWD |
Erik Andersen | d75af99 | 2000-03-16 08:09:09 +0000 | [diff] [blame] | 216 | {"pwd", pwd_main, _BB_DIR_BIN}, |
Eric Andersen | cc8ed39 | 1999-10-05 16:24:54 +0000 | [diff] [blame] | 217 | #endif |
Erik Andersen | 298854f | 2000-03-23 01:09:18 +0000 | [diff] [blame] | 218 | #ifdef BB_REBOOT |
Erik Andersen | d75af99 | 2000-03-16 08:09:09 +0000 | [diff] [blame] | 219 | {"reboot", reboot_main, _BB_DIR_SBIN}, |
Eric Andersen | cc8ed39 | 1999-10-05 16:24:54 +0000 | [diff] [blame] | 220 | #endif |
Erik Andersen | 298854f | 2000-03-23 01:09:18 +0000 | [diff] [blame] | 221 | #ifdef BB_RM |
Erik Andersen | d75af99 | 2000-03-16 08:09:09 +0000 | [diff] [blame] | 222 | {"rm", rm_main, _BB_DIR_BIN}, |
Eric Andersen | cc8ed39 | 1999-10-05 16:24:54 +0000 | [diff] [blame] | 223 | #endif |
Erik Andersen | 298854f | 2000-03-23 01:09:18 +0000 | [diff] [blame] | 224 | #ifdef BB_RMDIR |
Erik Andersen | d75af99 | 2000-03-16 08:09:09 +0000 | [diff] [blame] | 225 | {"rmdir", rmdir_main, _BB_DIR_BIN}, |
Eric Andersen | cc8ed39 | 1999-10-05 16:24:54 +0000 | [diff] [blame] | 226 | #endif |
Erik Andersen | 298854f | 2000-03-23 01:09:18 +0000 | [diff] [blame] | 227 | #ifdef BB_RMMOD |
Erik Andersen | d75af99 | 2000-03-16 08:09:09 +0000 | [diff] [blame] | 228 | {"rmmod", rmmod_main, _BB_DIR_SBIN}, |
Erik Andersen | 3d7e341 | 1999-12-16 23:04:20 +0000 | [diff] [blame] | 229 | #endif |
Erik Andersen | 298854f | 2000-03-23 01:09:18 +0000 | [diff] [blame] | 230 | #ifdef BB_SED |
Erik Andersen | d75af99 | 2000-03-16 08:09:09 +0000 | [diff] [blame] | 231 | {"sed", sed_main, _BB_DIR_BIN}, |
Erik Andersen | 3522eb1 | 2000-03-12 23:49:18 +0000 | [diff] [blame] | 232 | #endif |
Erik Andersen | 298854f | 2000-03-23 01:09:18 +0000 | [diff] [blame] | 233 | #ifdef BB_SH |
Erik Andersen | d75af99 | 2000-03-16 08:09:09 +0000 | [diff] [blame] | 234 | {"sh", shell_main, _BB_DIR_BIN}, |
Erik Andersen | 3522eb1 | 2000-03-12 23:49:18 +0000 | [diff] [blame] | 235 | #endif |
Erik Andersen | 298854f | 2000-03-23 01:09:18 +0000 | [diff] [blame] | 236 | #ifdef BB_SFDISK |
Erik Andersen | d75af99 | 2000-03-16 08:09:09 +0000 | [diff] [blame] | 237 | {"sfdisk", sfdisk_main, _BB_DIR_SBIN}, |
Eric Andersen | e77ae3a | 1999-10-19 20:03:34 +0000 | [diff] [blame] | 238 | #endif |
Erik Andersen | 298854f | 2000-03-23 01:09:18 +0000 | [diff] [blame] | 239 | #ifdef BB_SLEEP |
Erik Andersen | d75af99 | 2000-03-16 08:09:09 +0000 | [diff] [blame] | 240 | {"sleep", sleep_main, _BB_DIR_BIN}, |
Eric Andersen | cc8ed39 | 1999-10-05 16:24:54 +0000 | [diff] [blame] | 241 | #endif |
Erik Andersen | 298854f | 2000-03-23 01:09:18 +0000 | [diff] [blame] | 242 | #ifdef BB_SORT |
Erik Andersen | d75af99 | 2000-03-16 08:09:09 +0000 | [diff] [blame] | 243 | {"sort", sort_main, _BB_DIR_BIN}, |
John Beppu | 019513a | 1999-12-22 17:57:31 +0000 | [diff] [blame] | 244 | #endif |
Erik Andersen | 298854f | 2000-03-23 01:09:18 +0000 | [diff] [blame] | 245 | #ifdef BB_SYNC |
Erik Andersen | d75af99 | 2000-03-16 08:09:09 +0000 | [diff] [blame] | 246 | {"sync", sync_main, _BB_DIR_BIN}, |
Eric Andersen | 3843e96 | 1999-11-25 07:30:46 +0000 | [diff] [blame] | 247 | #endif |
Erik Andersen | 298854f | 2000-03-23 01:09:18 +0000 | [diff] [blame] | 248 | #ifdef BB_SYSLOGD |
Erik Andersen | d75af99 | 2000-03-16 08:09:09 +0000 | [diff] [blame] | 249 | {"syslogd", syslogd_main, _BB_DIR_SBIN}, |
Eric Andersen | 3843e96 | 1999-11-25 07:30:46 +0000 | [diff] [blame] | 250 | #endif |
Erik Andersen | 298854f | 2000-03-23 01:09:18 +0000 | [diff] [blame] | 251 | #ifdef BB_LOGGER |
Erik Andersen | d75af99 | 2000-03-16 08:09:09 +0000 | [diff] [blame] | 252 | {"logger", logger_main, _BB_DIR_USR_BIN}, |
Eric Andersen | cc8ed39 | 1999-10-05 16:24:54 +0000 | [diff] [blame] | 253 | #endif |
Erik Andersen | 298854f | 2000-03-23 01:09:18 +0000 | [diff] [blame] | 254 | #ifdef BB_LOGNAME |
Erik Andersen | d75af99 | 2000-03-16 08:09:09 +0000 | [diff] [blame] | 255 | {"logname", logname_main, _BB_DIR_USR_BIN}, |
Erik Andersen | 3163821 | 2000-01-15 22:28:50 +0000 | [diff] [blame] | 256 | #endif |
Erik Andersen | 298854f | 2000-03-23 01:09:18 +0000 | [diff] [blame] | 257 | #ifdef BB_SWAPONOFF |
Erik Andersen | d75af99 | 2000-03-16 08:09:09 +0000 | [diff] [blame] | 258 | {"swapon", swap_on_off_main, _BB_DIR_SBIN}, |
| 259 | #endif |
Erik Andersen | 298854f | 2000-03-23 01:09:18 +0000 | [diff] [blame] | 260 | #ifdef BB_SWAPONOFF |
Erik Andersen | d75af99 | 2000-03-16 08:09:09 +0000 | [diff] [blame] | 261 | {"swapoff", swap_on_off_main, _BB_DIR_SBIN}, |
Eric Andersen | cc8ed39 | 1999-10-05 16:24:54 +0000 | [diff] [blame] | 262 | #endif |
Erik Andersen | 298854f | 2000-03-23 01:09:18 +0000 | [diff] [blame] | 263 | #ifdef BB_TAIL |
Erik Andersen | d75af99 | 2000-03-16 08:09:09 +0000 | [diff] [blame] | 264 | {"tail", tail_main, _BB_DIR_USR_BIN}, |
Eric Andersen | abc0f4f | 1999-12-08 23:19:36 +0000 | [diff] [blame] | 265 | #endif |
Erik Andersen | 298854f | 2000-03-23 01:09:18 +0000 | [diff] [blame] | 266 | #ifdef BB_TAR |
Erik Andersen | d75af99 | 2000-03-16 08:09:09 +0000 | [diff] [blame] | 267 | {"tar", tar_main, _BB_DIR_BIN}, |
Eric Andersen | cc8ed39 | 1999-10-05 16:24:54 +0000 | [diff] [blame] | 268 | #endif |
Erik Andersen | 298854f | 2000-03-23 01:09:18 +0000 | [diff] [blame] | 269 | #ifdef BB_TELNET |
Erik Andersen | d75af99 | 2000-03-16 08:09:09 +0000 | [diff] [blame] | 270 | {"telnet", telnet_main, _BB_DIR_USR_BIN}, |
| 271 | #endif |
Erik Andersen | 298854f | 2000-03-23 01:09:18 +0000 | [diff] [blame] | 272 | #ifdef BB_TEST |
Erik Andersen | d75af99 | 2000-03-16 08:09:09 +0000 | [diff] [blame] | 273 | {"[", test_main, _BB_DIR_USR_BIN}, |
| 274 | #endif |
Erik Andersen | 298854f | 2000-03-23 01:09:18 +0000 | [diff] [blame] | 275 | #ifdef BB_TEST |
Erik Andersen | d75af99 | 2000-03-16 08:09:09 +0000 | [diff] [blame] | 276 | {"test", test_main, _BB_DIR_USR_BIN}, |
Erik Andersen | f7c49ef | 2000-02-22 17:17:45 +0000 | [diff] [blame] | 277 | #endif |
Erik Andersen | 298854f | 2000-03-23 01:09:18 +0000 | [diff] [blame] | 278 | #ifdef BB_TEE |
Erik Andersen | d75af99 | 2000-03-16 08:09:09 +0000 | [diff] [blame] | 279 | {"tee", tee_main, _BB_DIR_BIN}, |
John Beppu | 059f152 | 1999-12-10 05:27:16 +0000 | [diff] [blame] | 280 | #endif |
Erik Andersen | 298854f | 2000-03-23 01:09:18 +0000 | [diff] [blame] | 281 | #ifdef BB_TOUCH |
Erik Andersen | d75af99 | 2000-03-16 08:09:09 +0000 | [diff] [blame] | 282 | {"touch", touch_main, _BB_DIR_USR_BIN}, |
Eric Andersen | cc8ed39 | 1999-10-05 16:24:54 +0000 | [diff] [blame] | 283 | #endif |
Erik Andersen | 298854f | 2000-03-23 01:09:18 +0000 | [diff] [blame] | 284 | #ifdef BB_TR |
Erik Andersen | d75af99 | 2000-03-16 08:09:09 +0000 | [diff] [blame] | 285 | {"tr", tr_main, _BB_DIR_USR_BIN}, |
Erik Andersen | fb002d0 | 2000-03-05 08:07:00 +0000 | [diff] [blame] | 286 | #endif |
Erik Andersen | 298854f | 2000-03-23 01:09:18 +0000 | [diff] [blame] | 287 | #ifdef BB_TRUE_FALSE |
Erik Andersen | d75af99 | 2000-03-16 08:09:09 +0000 | [diff] [blame] | 288 | {"true", true_main, _BB_DIR_BIN}, |
| 289 | #endif |
Erik Andersen | 298854f | 2000-03-23 01:09:18 +0000 | [diff] [blame] | 290 | #ifdef BB_TRUE_FALSE |
Erik Andersen | d75af99 | 2000-03-16 08:09:09 +0000 | [diff] [blame] | 291 | {"false", false_main, _BB_DIR_BIN}, |
Eric Andersen | cc8ed39 | 1999-10-05 16:24:54 +0000 | [diff] [blame] | 292 | #endif |
Erik Andersen | 298854f | 2000-03-23 01:09:18 +0000 | [diff] [blame] | 293 | #ifdef BB_TTY |
Erik Andersen | d75af99 | 2000-03-16 08:09:09 +0000 | [diff] [blame] | 294 | {"tty", tty_main, _BB_DIR_USR_BIN}, |
Erik Andersen | 05df239 | 2000-01-13 04:43:48 +0000 | [diff] [blame] | 295 | #endif |
Erik Andersen | 298854f | 2000-03-23 01:09:18 +0000 | [diff] [blame] | 296 | #ifdef BB_UMOUNT |
Erik Andersen | d75af99 | 2000-03-16 08:09:09 +0000 | [diff] [blame] | 297 | {"umount", umount_main, _BB_DIR_BIN}, |
Erik Andersen | 66be5e7 | 2000-03-05 07:52:05 +0000 | [diff] [blame] | 298 | #endif |
Erik Andersen | 298854f | 2000-03-23 01:09:18 +0000 | [diff] [blame] | 299 | #ifdef BB_UNAME |
Erik Andersen | d75af99 | 2000-03-16 08:09:09 +0000 | [diff] [blame] | 300 | {"uname", uname_main, _BB_DIR_BIN}, |
Eric Andersen | 0460ff2 | 1999-10-25 23:32:44 +0000 | [diff] [blame] | 301 | #endif |
Erik Andersen | 298854f | 2000-03-23 01:09:18 +0000 | [diff] [blame] | 302 | #ifdef BB_UPTIME |
Erik Andersen | d75af99 | 2000-03-16 08:09:09 +0000 | [diff] [blame] | 303 | {"uptime", uptime_main, _BB_DIR_USR_BIN}, |
Eric Andersen | cc8ed39 | 1999-10-05 16:24:54 +0000 | [diff] [blame] | 304 | #endif |
Erik Andersen | 298854f | 2000-03-23 01:09:18 +0000 | [diff] [blame] | 305 | #ifdef BB_UNIQ |
Erik Andersen | d75af99 | 2000-03-16 08:09:09 +0000 | [diff] [blame] | 306 | {"uniq", uniq_main, _BB_DIR_BIN}, |
John Beppu | abb4772 | 2000-01-06 00:48:21 +0000 | [diff] [blame] | 307 | #endif |
Erik Andersen | 298854f | 2000-03-23 01:09:18 +0000 | [diff] [blame] | 308 | #ifdef BB_UPDATE |
Erik Andersen | d75af99 | 2000-03-16 08:09:09 +0000 | [diff] [blame] | 309 | {"update", update_main, _BB_DIR_SBIN}, |
Eric Andersen | cc8ed39 | 1999-10-05 16:24:54 +0000 | [diff] [blame] | 310 | #endif |
Erik Andersen | b99ca13 | 2000-04-04 18:49:18 +0000 | [diff] [blame] | 311 | #ifdef BB_USLEEP |
| 312 | {"usleep", usleep_main, _BB_DIR_BIN}, |
| 313 | #endif |
Erik Andersen | 298854f | 2000-03-23 01:09:18 +0000 | [diff] [blame] | 314 | #ifdef BB_WC |
Erik Andersen | d75af99 | 2000-03-16 08:09:09 +0000 | [diff] [blame] | 315 | {"wc", wc_main, _BB_DIR_USR_BIN}, |
Erik Andersen | 3163821 | 2000-01-15 22:28:50 +0000 | [diff] [blame] | 316 | #endif |
Erik Andersen | 298854f | 2000-03-23 01:09:18 +0000 | [diff] [blame] | 317 | #ifdef BB_WHOAMI |
Erik Andersen | d75af99 | 2000-03-16 08:09:09 +0000 | [diff] [blame] | 318 | {"whoami", whoami_main, _BB_DIR_USR_BIN}, |
Erik Andersen | 3163821 | 2000-01-15 22:28:50 +0000 | [diff] [blame] | 319 | #endif |
Erik Andersen | 298854f | 2000-03-23 01:09:18 +0000 | [diff] [blame] | 320 | #ifdef BB_YES |
Erik Andersen | d75af99 | 2000-03-16 08:09:09 +0000 | [diff] [blame] | 321 | {"yes", yes_main, _BB_DIR_USR_BIN}, |
Erik Andersen | 3163821 | 2000-01-15 22:28:50 +0000 | [diff] [blame] | 322 | #endif |
Erik Andersen | 298854f | 2000-03-23 01:09:18 +0000 | [diff] [blame] | 323 | #ifdef BB_GUNZIP |
Erik Andersen | d75af99 | 2000-03-16 08:09:09 +0000 | [diff] [blame] | 324 | {"zcat", gunzip_main, _BB_DIR_BIN}, |
| 325 | #endif |
Erik Andersen | 298854f | 2000-03-23 01:09:18 +0000 | [diff] [blame] | 326 | #ifdef BB_GUNZIP |
Erik Andersen | d75af99 | 2000-03-16 08:09:09 +0000 | [diff] [blame] | 327 | {"gunzip", gunzip_main, _BB_DIR_BIN}, |
Eric Andersen | cc8ed39 | 1999-10-05 16:24:54 +0000 | [diff] [blame] | 328 | #endif |
Erik Andersen | 298854f | 2000-03-23 01:09:18 +0000 | [diff] [blame] | 329 | #ifdef BB_GZIP |
Erik Andersen | d75af99 | 2000-03-16 08:09:09 +0000 | [diff] [blame] | 330 | {"gzip", gzip_main, _BB_DIR_BIN}, |
Eric Andersen | cc8ed39 | 1999-10-05 16:24:54 +0000 | [diff] [blame] | 331 | #endif |
Erik Andersen | e49d5ec | 2000-02-08 19:58:47 +0000 | [diff] [blame] | 332 | {0} |
Eric Andersen | cc8ed39 | 1999-10-05 16:24:54 +0000 | [diff] [blame] | 333 | }; |
| 334 | |
Erik Andersen | 05df239 | 2000-01-13 04:43:48 +0000 | [diff] [blame] | 335 | |
| 336 | |
Eric Andersen | cc8ed39 | 1999-10-05 16:24:54 +0000 | [diff] [blame] | 337 | int main(int argc, char **argv) |
| 338 | { |
Erik Andersen | d75af99 | 2000-03-16 08:09:09 +0000 | [diff] [blame] | 339 | char *s; |
| 340 | char *name; |
Erik Andersen | 029011b | 2000-03-04 21:19:32 +0000 | [diff] [blame] | 341 | const struct Applet *a = applets; |
Eric Andersen | cc8ed39 | 1999-10-05 16:24:54 +0000 | [diff] [blame] | 342 | |
Erik Andersen | d75af99 | 2000-03-16 08:09:09 +0000 | [diff] [blame] | 343 | for (s = name = argv[0]; *s != '\0';) { |
Erik Andersen | e49d5ec | 2000-02-08 19:58:47 +0000 | [diff] [blame] | 344 | if (*s++ == '/') |
| 345 | name = s; |
Eric Andersen | cc8ed39 | 1999-10-05 16:24:54 +0000 | [diff] [blame] | 346 | } |
Erik Andersen | e49d5ec | 2000-02-08 19:58:47 +0000 | [diff] [blame] | 347 | |
Erik Andersen | 029011b | 2000-03-04 21:19:32 +0000 | [diff] [blame] | 348 | *argv = name; |
| 349 | |
Erik Andersen | e49d5ec | 2000-02-08 19:58:47 +0000 | [diff] [blame] | 350 | while (a->name != 0) { |
| 351 | if (strcmp(name, a->name) == 0) { |
| 352 | int status; |
| 353 | |
| 354 | status = ((*(a->main)) (argc, argv)); |
| 355 | if (status < 0) { |
| 356 | fprintf(stderr, "%s: %s\n", a->name, strerror(errno)); |
| 357 | } |
| 358 | fprintf(stderr, "\n"); |
| 359 | exit(status); |
| 360 | } |
| 361 | a++; |
| 362 | } |
| 363 | exit(busybox_main(argc, argv)); |
Eric Andersen | cc8ed39 | 1999-10-05 16:24:54 +0000 | [diff] [blame] | 364 | } |
| 365 | |
| 366 | |
| 367 | int busybox_main(int argc, char **argv) |
| 368 | { |
Erik Andersen | e49d5ec | 2000-02-08 19:58:47 +0000 | [diff] [blame] | 369 | int col = 0; |
Eric Andersen | cc8ed39 | 1999-10-05 16:24:54 +0000 | [diff] [blame] | 370 | |
Erik Andersen | e49d5ec | 2000-02-08 19:58:47 +0000 | [diff] [blame] | 371 | argc--; |
| 372 | argv++; |
Eric Andersen | cc8ed39 | 1999-10-05 16:24:54 +0000 | [diff] [blame] | 373 | |
Erik Andersen | e49d5ec | 2000-02-08 19:58:47 +0000 | [diff] [blame] | 374 | if (been_there_done_that == 1 || argc < 1) { |
| 375 | const struct Applet *a = applets; |
| 376 | |
| 377 | fprintf(stderr, "BusyBox v%s (%s) multi-call binary -- GPL2\n\n", |
| 378 | BB_VER, BB_BT); |
| 379 | fprintf(stderr, "Usage: busybox [function] [arguments]...\n"); |
| 380 | fprintf(stderr, " or: [function] [arguments]...\n\n"); |
| 381 | fprintf(stderr, |
John Beppu | b4f8606 | 2000-04-13 03:36:01 +0000 | [diff] [blame^] | 382 | "\tBusyBox is a multi-call binary that combines many common Unix\n" |
| 383 | "\tutilities into a single executable. Most people will create a\n" |
| 384 | "\tlink to busybox for each function they wish to use, and BusyBox\n" |
| 385 | "\twill act like whatever it was invoked as.\n"); |
Erik Andersen | e49d5ec | 2000-02-08 19:58:47 +0000 | [diff] [blame] | 386 | fprintf(stderr, "\nCurrently defined functions:\n"); |
| 387 | |
| 388 | while (a->name != 0) { |
| 389 | col += |
| 390 | fprintf(stderr, "%s%s", ((col == 0) ? "\t" : ", "), |
| 391 | (a++)->name); |
| 392 | if (col > 60 && a->name != 0) { |
| 393 | fprintf(stderr, ",\n"); |
| 394 | col = 0; |
| 395 | } |
| 396 | } |
| 397 | fprintf(stderr, "\n\n"); |
| 398 | exit(-1); |
| 399 | } else { |
| 400 | /* If we've already been here once, exit now */ |
| 401 | been_there_done_that = 1; |
| 402 | return (main(argc, argv)); |
Eric Andersen | cc8ed39 | 1999-10-05 16:24:54 +0000 | [diff] [blame] | 403 | } |
Eric Andersen | cc8ed39 | 1999-10-05 16:24:54 +0000 | [diff] [blame] | 404 | } |
Erik Andersen | 029011b | 2000-03-04 21:19:32 +0000 | [diff] [blame] | 405 | |
| 406 | /* |
| 407 | Local Variables: |
| 408 | c-file-style: "linux" |
| 409 | c-basic-offset: 4 |
| 410 | tab-width: 4 |
| 411 | End: |
| 412 | */ |