aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile.flags5
-rw-r--r--applets/applets.c2
-rw-r--r--archival/ar.c2
-rw-r--r--archival/bbunzip.c8
-rw-r--r--archival/cpio.c2
-rw-r--r--archival/dpkg.c2
-rw-r--r--archival/dpkg_deb.c2
-rw-r--r--archival/gzip.c2
-rw-r--r--archival/rpm.c2
-rw-r--r--archival/rpm2cpio.c2
-rw-r--r--archival/tar.c2
-rw-r--r--archival/unzip.c2
-rw-r--r--console-tools/chvt.c2
-rw-r--r--console-tools/clear.c2
-rw-r--r--console-tools/deallocvt.c2
-rw-r--r--console-tools/dumpkmap.c2
-rw-r--r--console-tools/loadfont.c2
-rw-r--r--console-tools/loadkmap.c2
-rw-r--r--console-tools/openvt.c2
-rw-r--r--console-tools/reset.c2
-rw-r--r--console-tools/resize.c2
-rw-r--r--console-tools/setconsole.c2
-rw-r--r--console-tools/setkeycodes.c4
-rw-r--r--console-tools/setlogcons.c2
-rw-r--r--coreutils/basename.c2
-rw-r--r--coreutils/cal.c2
-rw-r--r--coreutils/cat.c2
-rw-r--r--coreutils/catv.c2
-rw-r--r--coreutils/chgrp.c2
-rw-r--r--coreutils/chmod.c2
-rw-r--r--coreutils/chown.c2
-rw-r--r--coreutils/chroot.c2
-rw-r--r--coreutils/cksum.c2
-rw-r--r--coreutils/comm.c2
-rw-r--r--coreutils/cp.c2
-rw-r--r--coreutils/cut.c2
-rw-r--r--coreutils/date.c2
-rw-r--r--coreutils/dd.c2
-rw-r--r--coreutils/df.c2
-rw-r--r--coreutils/dirname.c2
-rw-r--r--coreutils/dos2unix.c2
-rw-r--r--coreutils/du.c2
-rw-r--r--coreutils/echo.c4
-rw-r--r--coreutils/env.c4
-rw-r--r--coreutils/expand.c2
-rw-r--r--coreutils/expr.c2
-rw-r--r--coreutils/false.c2
-rw-r--r--coreutils/fold.c2
-rw-r--r--coreutils/head.c2
-rw-r--r--coreutils/hostid.c2
-rw-r--r--coreutils/id.c2
-rw-r--r--coreutils/install.c2
-rw-r--r--coreutils/length.c2
-rw-r--r--coreutils/ln.c2
-rw-r--r--coreutils/logname.c2
-rw-r--r--coreutils/ls.c2
-rw-r--r--coreutils/md5_sha1_sum.c2
-rw-r--r--coreutils/mkdir.c2
-rw-r--r--coreutils/mkfifo.c2
-rw-r--r--coreutils/mknod.c2
-rw-r--r--coreutils/mv.c2
-rw-r--r--coreutils/nice.c2
-rw-r--r--coreutils/nohup.c2
-rw-r--r--coreutils/od.c2
-rw-r--r--coreutils/od_bloaty.c2
-rw-r--r--coreutils/printenv.c2
-rw-r--r--coreutils/printf.c2
-rw-r--r--coreutils/pwd.c2
-rw-r--r--coreutils/readlink.c2
-rw-r--r--coreutils/realpath.c2
-rw-r--r--coreutils/rm.c2
-rw-r--r--coreutils/rmdir.c2
-rw-r--r--coreutils/seq.c2
-rw-r--r--coreutils/sleep.c2
-rw-r--r--coreutils/sort.c2
-rw-r--r--coreutils/split.c2
-rw-r--r--coreutils/stat.c2
-rw-r--r--coreutils/stty.c2
-rw-r--r--coreutils/sum.c2
-rw-r--r--coreutils/sync.c2
-rw-r--r--coreutils/tail.c2
-rw-r--r--coreutils/tee.c2
-rw-r--r--coreutils/touch.c2
-rw-r--r--coreutils/tr.c2
-rw-r--r--coreutils/true.c2
-rw-r--r--coreutils/tty.c2
-rw-r--r--coreutils/uname.c2
-rw-r--r--coreutils/uniq.c2
-rw-r--r--coreutils/usleep.c2
-rw-r--r--coreutils/uudecode.c2
-rw-r--r--coreutils/uuencode.c2
-rw-r--r--coreutils/wc.c2
-rw-r--r--coreutils/who.c2
-rw-r--r--coreutils/whoami.c2
-rw-r--r--coreutils/yes.c2
-rw-r--r--debianutils/mktemp.c2
-rw-r--r--debianutils/pipe_progress.c2
-rw-r--r--debianutils/run_parts.c2
-rw-r--r--debianutils/start_stop_daemon.c2
-rw-r--r--debianutils/which.c2
-rw-r--r--docs/new-applet-HOWTO.txt2
-rw-r--r--e2fsprogs/chattr.c2
-rw-r--r--e2fsprogs/fsck.c2
-rw-r--r--e2fsprogs/lsattr.c2
-rw-r--r--e2fsprogs/old_e2fsprogs/chattr.c2
-rw-r--r--e2fsprogs/old_e2fsprogs/fsck.c2
-rw-r--r--e2fsprogs/old_e2fsprogs/lsattr.c2
-rw-r--r--e2fsprogs/old_e2fsprogs/tune2fs.c2
-rw-r--r--editors/awk.c2
-rw-r--r--editors/cmp.c2
-rw-r--r--editors/diff.c2
-rw-r--r--editors/ed.c2
-rw-r--r--editors/patch.c2
-rw-r--r--editors/sed.c2
-rw-r--r--editors/vi.c2
-rw-r--r--findutils/find.c2
-rw-r--r--findutils/grep.c2
-rw-r--r--findutils/xargs.c2
-rw-r--r--include/applets.h10
-rw-r--r--include/busybox.h14
-rw-r--r--include/libbb.h19
-rw-r--r--include/platform.h5
-rw-r--r--init/halt.c2
-rw-r--r--init/init.c2
-rw-r--r--init/mesg.c2
-rw-r--r--ipsvd/tcpudp.c2
-rw-r--r--libbb/appletlib.c6
-rw-r--r--loginutils/addgroup.c2
-rw-r--r--loginutils/adduser.c2
-rw-r--r--loginutils/chpasswd.c2
-rw-r--r--loginutils/cryptpw.c2
-rw-r--r--loginutils/deluser.c2
-rw-r--r--loginutils/getty.c2
-rw-r--r--loginutils/login.c2
-rw-r--r--loginutils/passwd.c2
-rw-r--r--loginutils/su.c2
-rw-r--r--loginutils/sulogin.c2
-rw-r--r--loginutils/vlock.c2
-rw-r--r--miscutils/adjtimex.c2
-rw-r--r--miscutils/bbconfig.c2
-rw-r--r--miscutils/chrt.c4
-rw-r--r--miscutils/crond.c2
-rw-r--r--miscutils/crontab.c2
-rw-r--r--miscutils/dc.c2
-rw-r--r--miscutils/devfsd.c2
-rw-r--r--miscutils/eject.c2
-rw-r--r--miscutils/hdparm.c2
-rw-r--r--miscutils/last.c2
-rw-r--r--miscutils/less.c2
-rw-r--r--miscutils/makedevs.c4
-rw-r--r--miscutils/microcom.c2
-rw-r--r--miscutils/mountpoint.c2
-rw-r--r--miscutils/mt.c2
-rw-r--r--miscutils/raidautorun.c2
-rw-r--r--miscutils/readahead.c2
-rw-r--r--miscutils/runlevel.c2
-rw-r--r--miscutils/rx.c2
-rw-r--r--miscutils/setsid.c2
-rw-r--r--miscutils/strings.c2
-rw-r--r--miscutils/taskset.c4
-rw-r--r--miscutils/time.c2
-rw-r--r--miscutils/ttysize.c2
-rw-r--r--miscutils/watchdog.c2
-rw-r--r--modutils/insmod.c8
-rw-r--r--modutils/lsmod.c4
-rw-r--r--modutils/modprobe.c4
-rw-r--r--modutils/rmmod.c2
-rw-r--r--networking/arp.c2
-rw-r--r--networking/arping.c2
-rw-r--r--networking/dnsd.c2
-rw-r--r--networking/ether-wake.c2
-rw-r--r--networking/ftpgetput.c2
-rw-r--r--networking/hostname.c2
-rw-r--r--networking/httpd.c2
-rw-r--r--networking/ifconfig.c2
-rw-r--r--networking/ifupdown.c2
-rw-r--r--networking/inetd.c2
-rw-r--r--networking/ip.c12
-rw-r--r--networking/ipcalc.c2
-rw-r--r--networking/isrv_identd.c2
-rw-r--r--networking/nameif.c2
-rw-r--r--networking/nc.c2
-rw-r--r--networking/nc_bloaty.c2
-rw-r--r--networking/netstat.c2
-rw-r--r--networking/nslookup.c2
-rw-r--r--networking/ping.c6
-rw-r--r--networking/pscan.c2
-rw-r--r--networking/route.c2
-rw-r--r--networking/slattach.c2
-rw-r--r--networking/telnet.c4
-rw-r--r--networking/telnetd.c2
-rw-r--r--networking/tftp.c2
-rw-r--r--networking/traceroute.c2
-rw-r--r--networking/udhcp/dhcpc.c2
-rw-r--r--networking/udhcp/dhcpd.c2
-rw-r--r--networking/udhcp/dhcprelay.c2
-rw-r--r--networking/udhcp/dumpleases.c2
-rw-r--r--networking/vconfig.c2
-rw-r--r--networking/wget.c2
-rw-r--r--networking/zcip.c2
-rw-r--r--procps/free.c2
-rw-r--r--procps/fuser.c2
-rw-r--r--procps/kill.c2
-rw-r--r--procps/nmeter.c2
-rw-r--r--procps/pgrep.c2
-rw-r--r--procps/pidof.c2
-rw-r--r--procps/ps.c4
-rw-r--r--procps/renice.c2
-rw-r--r--procps/sysctl.c2
-rw-r--r--procps/top.c2
-rw-r--r--procps/uptime.c2
-rw-r--r--procps/watch.c2
-rw-r--r--runit/chpst.c2
-rw-r--r--runit/runsv.c2
-rw-r--r--runit/runsvdir.c2
-rw-r--r--runit/sv.c2
-rw-r--r--runit/svlogd.c2
-rwxr-xr-xscripts/trylink8
-rw-r--r--selinux/chcon.c2
-rw-r--r--selinux/getenforce.c2
-rw-r--r--selinux/getsebool.c2
-rw-r--r--selinux/load_policy.c2
-rw-r--r--selinux/matchpathcon.c2
-rw-r--r--selinux/runcon.c2
-rw-r--r--selinux/selinuxenabled.c2
-rw-r--r--selinux/setenforce.c2
-rw-r--r--selinux/setfiles.c2
-rw-r--r--shell/ash.c2
-rw-r--r--shell/bbsh.c2
-rw-r--r--shell/hush.c2
-rw-r--r--shell/lash.c2
-rw-r--r--shell/msh.c2
-rw-r--r--sysklogd/klogd.c2
-rw-r--r--sysklogd/logger.c2
-rw-r--r--sysklogd/logread.c2
-rw-r--r--sysklogd/syslogd.c2
-rw-r--r--util-linux/dmesg.c2
-rw-r--r--util-linux/fbset.c2
-rw-r--r--util-linux/fdformat.c13
-rw-r--r--util-linux/fdisk.c2
-rw-r--r--util-linux/freeramdisk.c2
-rw-r--r--util-linux/fsck_minix.c2
-rw-r--r--util-linux/getopt.c4
-rw-r--r--util-linux/hexdump.c2
-rw-r--r--util-linux/hwclock.c2
-rw-r--r--util-linux/ipcrm.c2
-rw-r--r--util-linux/ipcs.c2
-rw-r--r--util-linux/losetup.c2
-rw-r--r--util-linux/mdev.c2
-rw-r--r--util-linux/mkfs_minix.c2
-rw-r--r--util-linux/mkswap.c2
-rw-r--r--util-linux/more.c2
-rw-r--r--util-linux/mount.c2
-rw-r--r--util-linux/pivot_root.c2
-rw-r--r--util-linux/rdate.c2
-rw-r--r--util-linux/readprofile.c2
-rw-r--r--util-linux/setarch.c2
-rw-r--r--util-linux/swaponoff.c2
-rw-r--r--util-linux/switch_root.c2
-rw-r--r--util-linux/umount.c2
260 files changed, 325 insertions, 307 deletions
diff --git a/Makefile.flags b/Makefile.flags
index 243f095e2..c023299d7 100644
--- a/Makefile.flags
+++ b/Makefile.flags
@@ -56,10 +56,13 @@ ifeq ($(CONFIG_DEBUG),y)
56CFLAGS += $(call cc-option,-g) 56CFLAGS += $(call cc-option,-g)
57endif 57endif
58 58
59ifeq ($(CONFIG_BUILD_LIBBUSYBOX),y)
59# on i386: 14% smaller libbusybox.so 60# on i386: 14% smaller libbusybox.so
60# (code itself is 9% bigger, we save on relocs/PLT/GOT) 61# (code itself is 9% bigger, we save on relocs/PLT/GOT)
61ifeq ($(CONFIG_BUILD_LIBBUSYBOX),y)
62CFLAGS += -fpic 62CFLAGS += -fpic
63# and another 4% reduction of libbusybox.so:
64# (external entry points must be marked EXTERNALLY_VISIBLE)
65CFLAGS += $(call cc-option,-fvisibility=hidden)
63endif 66endif
64 67
65ifeq ($(CONFIG_STATIC),y) 68ifeq ($(CONFIG_STATIC),y)
diff --git a/applets/applets.c b/applets/applets.c
index bbf150c79..1950cf34e 100644
--- a/applets/applets.c
+++ b/applets/applets.c
@@ -24,6 +24,6 @@
24#if ENABLE_BUILD_LIBBUSYBOX 24#if ENABLE_BUILD_LIBBUSYBOX
25int main(int argc, char **argv) 25int main(int argc, char **argv)
26{ 26{
27 return libbusybox_main(argc, argv); 27 return lbb_main(argc, argv);
28} 28}
29#endif 29#endif
diff --git a/archival/ar.c b/archival/ar.c
index cbe4d8e0e..0a95e5c85 100644
--- a/archival/ar.c
+++ b/archival/ar.c
@@ -37,7 +37,7 @@ static void header_verbose_list_ar(const file_header_t *file_header)
37#define AR_OPT_CREATE 0x20 37#define AR_OPT_CREATE 0x20
38#define AR_OPT_INSERT 0x40 38#define AR_OPT_INSERT 0x40
39 39
40int ar_main(int argc, char **argv); 40int ar_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
41int ar_main(int argc, char **argv) 41int ar_main(int argc, char **argv)
42{ 42{
43 static const char msg_unsupported_err[] ALIGN1 = 43 static const char msg_unsupported_err[] ALIGN1 =
diff --git a/archival/bbunzip.c b/archival/bbunzip.c
index e106bf0ed..61b5e39da 100644
--- a/archival/bbunzip.c
+++ b/archival/bbunzip.c
@@ -158,7 +158,7 @@ USE_DESKTOP(long long) int unpack_bunzip2(void)
158 return unpack_bz2_stream(STDIN_FILENO, STDOUT_FILENO); 158 return unpack_bz2_stream(STDIN_FILENO, STDOUT_FILENO);
159} 159}
160 160
161int bunzip2_main(int argc, char **argv); 161int bunzip2_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
162int bunzip2_main(int argc, char **argv) 162int bunzip2_main(int argc, char **argv)
163{ 163{
164 getopt32(argv, "cf"); 164 getopt32(argv, "cf");
@@ -256,7 +256,7 @@ USE_DESKTOP(long long) int unpack_gunzip(void)
256 return status; 256 return status;
257} 257}
258 258
259int gunzip_main(int argc, char **argv); 259int gunzip_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
260int gunzip_main(int argc, char **argv) 260int gunzip_main(int argc, char **argv)
261{ 261{
262 getopt32(argv, "cfvdt"); 262 getopt32(argv, "cfvdt");
@@ -294,7 +294,7 @@ USE_DESKTOP(long long) int unpack_unlzma(void)
294 return unpack_lzma_stream(STDIN_FILENO, STDOUT_FILENO); 294 return unpack_lzma_stream(STDIN_FILENO, STDOUT_FILENO);
295} 295}
296 296
297int unlzma_main(int argc, char **argv); 297int unlzma_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
298int unlzma_main(int argc, char **argv) 298int unlzma_main(int argc, char **argv)
299{ 299{
300 getopt32(argv, "cf"); 300 getopt32(argv, "cf");
@@ -336,7 +336,7 @@ USE_DESKTOP(long long) int unpack_uncompress(void)
336 return status; 336 return status;
337} 337}
338 338
339int uncompress_main(int argc, char **argv); 339int uncompress_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
340int uncompress_main(int argc, char **argv) 340int uncompress_main(int argc, char **argv)
341{ 341{
342 getopt32(argv, "cf"); 342 getopt32(argv, "cf");
diff --git a/archival/cpio.c b/archival/cpio.c
index 9188e09f1..59ae60c77 100644
--- a/archival/cpio.c
+++ b/archival/cpio.c
@@ -22,7 +22,7 @@
22#define CPIO_OPT_CREATE_LEADING_DIR 0x20 22#define CPIO_OPT_CREATE_LEADING_DIR 0x20
23#define CPIO_OPT_PRESERVE_MTIME 0x40 23#define CPIO_OPT_PRESERVE_MTIME 0x40
24 24
25int cpio_main(int argc, char **argv); 25int cpio_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
26int cpio_main(int argc, char **argv) 26int cpio_main(int argc, char **argv)
27{ 27{
28 archive_handle_t *archive_handle; 28 archive_handle_t *archive_handle;
diff --git a/archival/dpkg.c b/archival/dpkg.c
index 337576ccd..27512eb5d 100644
--- a/archival/dpkg.c
+++ b/archival/dpkg.c
@@ -1557,7 +1557,7 @@ static void configure_package(deb_file_t *deb_file)
1557 set_status(status_num, "installed", 3); 1557 set_status(status_num, "installed", 3);
1558} 1558}
1559 1559
1560int dpkg_main(int argc, char **argv); 1560int dpkg_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
1561int dpkg_main(int argc, char **argv) 1561int dpkg_main(int argc, char **argv)
1562{ 1562{
1563 deb_file_t **deb_file = NULL; 1563 deb_file_t **deb_file = NULL;
diff --git a/archival/dpkg_deb.c b/archival/dpkg_deb.c
index 9781b54e5..e1d2cd0ed 100644
--- a/archival/dpkg_deb.c
+++ b/archival/dpkg_deb.c
@@ -13,7 +13,7 @@
13#define DPKG_DEB_OPT_EXTRACT 8 13#define DPKG_DEB_OPT_EXTRACT 8
14#define DPKG_DEB_OPT_EXTRACT_VERBOSE 16 14#define DPKG_DEB_OPT_EXTRACT_VERBOSE 16
15 15
16int dpkg_deb_main(int argc, char **argv); 16int dpkg_deb_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
17int dpkg_deb_main(int argc, char **argv) 17int dpkg_deb_main(int argc, char **argv)
18{ 18{
19 archive_handle_t *ar_archive; 19 archive_handle_t *ar_archive;
diff --git a/archival/gzip.c b/archival/gzip.c
index cabcc5ecb..bc7502e70 100644
--- a/archival/gzip.c
+++ b/archival/gzip.c
@@ -2025,7 +2025,7 @@ USE_DESKTOP(long long) int pack_gzip(void)
2025 return 0; 2025 return 0;
2026} 2026}
2027 2027
2028int gzip_main(int argc, char **argv); 2028int gzip_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
2029int gzip_main(int argc, char **argv) 2029int gzip_main(int argc, char **argv)
2030{ 2030{
2031 unsigned opt; 2031 unsigned opt;
diff --git a/archival/rpm.c b/archival/rpm.c
index 0b7741a15..f078aea10 100644
--- a/archival/rpm.c
+++ b/archival/rpm.c
@@ -80,7 +80,7 @@ static void fileaction_dobackup(char *filename, int fileref);
80static void fileaction_setowngrp(char *filename, int fileref); 80static void fileaction_setowngrp(char *filename, int fileref);
81static void loop_through_files(int filetag, void (*fileaction)(char *filename, int fileref)); 81static void loop_through_files(int filetag, void (*fileaction)(char *filename, int fileref));
82 82
83int rpm_main(int argc, char **argv); 83int rpm_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
84int rpm_main(int argc, char **argv) 84int rpm_main(int argc, char **argv)
85{ 85{
86 int opt = 0, func = 0, rpm_fd, offset; 86 int opt = 0, func = 0, rpm_fd, offset;
diff --git a/archival/rpm2cpio.c b/archival/rpm2cpio.c
index fe71e9867..329f8f71d 100644
--- a/archival/rpm2cpio.c
+++ b/archival/rpm2cpio.c
@@ -49,7 +49,7 @@ static void skip_header(int rpm_fd)
49} 49}
50 50
51/* No getopt required */ 51/* No getopt required */
52int rpm2cpio_main(int argc, char **argv); 52int rpm2cpio_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
53int rpm2cpio_main(int argc, char **argv) 53int rpm2cpio_main(int argc, char **argv)
54{ 54{
55 struct rpm_lead lead; 55 struct rpm_lead lead;
diff --git a/archival/tar.c b/archival/tar.c
index 18b626701..3fe188656 100644
--- a/archival/tar.c
+++ b/archival/tar.c
@@ -769,7 +769,7 @@ static const char tar_longopts[] ALIGN1 =
769 ; 769 ;
770#endif 770#endif
771 771
772int tar_main(int argc, char **argv); 772int tar_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
773int tar_main(int argc, char **argv) 773int tar_main(int argc, char **argv)
774{ 774{
775 char (*get_header_ptr)(archive_handle_t *) = get_header_tar; 775 char (*get_header_ptr)(archive_handle_t *) = get_header_tar;
diff --git a/archival/unzip.c b/archival/unzip.c
index 21d4c2535..bd113af20 100644
--- a/archival/unzip.c
+++ b/archival/unzip.c
@@ -93,7 +93,7 @@ static int unzip_extract(zip_header_t *zip_header, int src_fd, int dst_fd)
93 return 0; 93 return 0;
94} 94}
95 95
96int unzip_main(int argc, char **argv); 96int unzip_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
97int unzip_main(int argc, char **argv) 97int unzip_main(int argc, char **argv)
98{ 98{
99 zip_header_t zip_header; 99 zip_header_t zip_header;
diff --git a/console-tools/chvt.c b/console-tools/chvt.c
index b1f81a20e..8390c6001 100644
--- a/console-tools/chvt.c
+++ b/console-tools/chvt.c
@@ -15,7 +15,7 @@ enum {
15 VT_WAITACTIVE = 0x5607 /* wait for vt active */ 15 VT_WAITACTIVE = 0x5607 /* wait for vt active */
16}; 16};
17 17
18int chvt_main(int argc, char **argv); 18int chvt_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
19int chvt_main(int argc, char **argv) 19int chvt_main(int argc, char **argv)
20{ 20{
21 int fd, num; 21 int fd, num;
diff --git a/console-tools/clear.c b/console-tools/clear.c
index 3c7d704b5..769ce3121 100644
--- a/console-tools/clear.c
+++ b/console-tools/clear.c
@@ -12,7 +12,7 @@
12 12
13#include "libbb.h" 13#include "libbb.h"
14 14
15int clear_main(int argc, char **argv); 15int clear_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
16int clear_main(int argc, char **argv) 16int clear_main(int argc, char **argv)
17{ 17{
18 return printf("\033[H\033[J") != 6; 18 return printf("\033[H\033[J") != 6;
diff --git a/console-tools/deallocvt.c b/console-tools/deallocvt.c
index bf2bac186..48783fbb1 100644
--- a/console-tools/deallocvt.c
+++ b/console-tools/deallocvt.c
@@ -15,7 +15,7 @@
15/* From <linux/vt.h> */ 15/* From <linux/vt.h> */
16enum { VT_DISALLOCATE = 0x5608 }; /* free memory associated to vt */ 16enum { VT_DISALLOCATE = 0x5608 }; /* free memory associated to vt */
17 17
18int deallocvt_main(int argc, char **argv); 18int deallocvt_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
19int deallocvt_main(int argc, char **argv) 19int deallocvt_main(int argc, char **argv)
20{ 20{
21 /* num = 0 deallocate all unused consoles */ 21 /* num = 0 deallocate all unused consoles */
diff --git a/console-tools/dumpkmap.c b/console-tools/dumpkmap.c
index a606d568e..40b58f716 100644
--- a/console-tools/dumpkmap.c
+++ b/console-tools/dumpkmap.c
@@ -22,7 +22,7 @@ struct kbentry {
22#define NR_KEYS 128 22#define NR_KEYS 128
23#define MAX_NR_KEYMAPS 256 23#define MAX_NR_KEYMAPS 256
24 24
25int dumpkmap_main(int argc, char **argv); 25int dumpkmap_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
26int dumpkmap_main(int argc, char **argv) 26int dumpkmap_main(int argc, char **argv)
27{ 27{
28 struct kbentry ke; 28 struct kbentry ke;
diff --git a/console-tools/loadfont.c b/console-tools/loadfont.c
index 6b4dcb475..882b8817a 100644
--- a/console-tools/loadfont.c
+++ b/console-tools/loadfont.c
@@ -166,7 +166,7 @@ static void loadnewfont(int fd)
166 do_loadfont(fd, inbuf + offset, unit, 256); 166 do_loadfont(fd, inbuf + offset, unit, 256);
167} 167}
168 168
169int loadfont_main(int argc, char **argv); 169int loadfont_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
170int loadfont_main(int argc, char **argv) 170int loadfont_main(int argc, char **argv)
171{ 171{
172 int fd; 172 int fd;
diff --git a/console-tools/loadkmap.c b/console-tools/loadkmap.c
index 4a726f9c8..40885ee0c 100644
--- a/console-tools/loadkmap.c
+++ b/console-tools/loadkmap.c
@@ -25,7 +25,7 @@ struct kbentry {
25#define NR_KEYS 128 25#define NR_KEYS 128
26#define MAX_NR_KEYMAPS 256 26#define MAX_NR_KEYMAPS 256
27 27
28int loadkmap_main(int argc, char **argv); 28int loadkmap_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
29int loadkmap_main(int argc, char **argv) 29int loadkmap_main(int argc, char **argv)
30{ 30{
31 struct kbentry ke; 31 struct kbentry ke;
diff --git a/console-tools/openvt.c b/console-tools/openvt.c
index c050ba19e..ff169530d 100644
--- a/console-tools/openvt.c
+++ b/console-tools/openvt.c
@@ -12,7 +12,7 @@
12 12
13#include "libbb.h" 13#include "libbb.h"
14 14
15int openvt_main(int argc, char **argv); 15int openvt_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
16int openvt_main(int argc, char **argv) 16int openvt_main(int argc, char **argv)
17{ 17{
18 char vtname[sizeof(VC_FORMAT) + 2]; 18 char vtname[sizeof(VC_FORMAT) + 2];
diff --git a/console-tools/reset.c b/console-tools/reset.c
index deffe286d..bb096cf9f 100644
--- a/console-tools/reset.c
+++ b/console-tools/reset.c
@@ -12,7 +12,7 @@
12 12
13#include "libbb.h" 13#include "libbb.h"
14 14
15int reset_main(int argc, char **argv); 15int reset_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
16int reset_main(int argc, char **argv) 16int reset_main(int argc, char **argv)
17{ 17{
18 if (isatty(1)) { 18 if (isatty(1)) {
diff --git a/console-tools/resize.c b/console-tools/resize.c
index 32551b2f2..b4cdf50d0 100644
--- a/console-tools/resize.c
+++ b/console-tools/resize.c
@@ -20,7 +20,7 @@ onintr(int sig ATTRIBUTE_UNUSED)
20 exit(1); 20 exit(1);
21} 21}
22 22
23int resize_main(int argc, char **argv); 23int resize_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
24int resize_main(int argc, char **argv) 24int resize_main(int argc, char **argv)
25{ 25{
26 struct termios new; 26 struct termios new;
diff --git a/console-tools/setconsole.c b/console-tools/setconsole.c
index 32218ae8f..0aa1d3a35 100644
--- a/console-tools/setconsole.c
+++ b/console-tools/setconsole.c
@@ -18,7 +18,7 @@ static const char setconsole_longopts[] ALIGN1 =
18 18
19#define OPT_SETCONS_RESET 1 19#define OPT_SETCONS_RESET 1
20 20
21int setconsole_main(int argc, char **argv); 21int setconsole_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
22int setconsole_main(int argc, char **argv) 22int setconsole_main(int argc, char **argv)
23{ 23{
24 unsigned long flags; 24 unsigned long flags;
diff --git a/console-tools/setkeycodes.c b/console-tools/setkeycodes.c
index 3de5f9856..ba3d2e44e 100644
--- a/console-tools/setkeycodes.c
+++ b/console-tools/setkeycodes.c
@@ -20,8 +20,8 @@ enum {
20 KDSETKEYCODE = 0x4B4D /* write kernel keycode table entry */ 20 KDSETKEYCODE = 0x4B4D /* write kernel keycode table entry */
21}; 21};
22 22
23int setkeycodes_main(int argc, char** argv); 23int setkeycodes_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
24int setkeycodes_main(int argc, char** argv) 24int setkeycodes_main(int argc, char **argv)
25{ 25{
26 int fd, sc; 26 int fd, sc;
27 struct kbkeycode a; 27 struct kbkeycode a;
diff --git a/console-tools/setlogcons.c b/console-tools/setlogcons.c
index 2e2a5a471..0f6491c72 100644
--- a/console-tools/setlogcons.c
+++ b/console-tools/setlogcons.c
@@ -11,7 +11,7 @@
11 11
12#include "libbb.h" 12#include "libbb.h"
13 13
14int setlogcons_main(int argc, char **argv); 14int setlogcons_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
15int setlogcons_main(int argc, char **argv) 15int setlogcons_main(int argc, char **argv)
16{ 16{
17 struct { 17 struct {
diff --git a/coreutils/basename.c b/coreutils/basename.c
index ec1f85bef..d536a1bf3 100644
--- a/coreutils/basename.c
+++ b/coreutils/basename.c
@@ -24,7 +24,7 @@
24 24
25/* This is a NOFORK applet. Be very careful! */ 25/* This is a NOFORK applet. Be very careful! */
26 26
27int basename_main(int argc, char **argv); 27int basename_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
28int basename_main(int argc, char **argv) 28int basename_main(int argc, char **argv)
29{ 29{
30 size_t m, n; 30 size_t m, n;
diff --git a/coreutils/cal.c b/coreutils/cal.c
index 3116e1ebe..8a08a9ae7 100644
--- a/coreutils/cal.c
+++ b/coreutils/cal.c
@@ -75,7 +75,7 @@ static char *build_row(char *p, unsigned *dp);
75#define J_WEEK_LEN (WEEK_LEN + 7) 75#define J_WEEK_LEN (WEEK_LEN + 7)
76#define HEAD_SEP 2 /* spaces between day headings */ 76#define HEAD_SEP 2 /* spaces between day headings */
77 77
78int cal_main(int argc, char **argv); 78int cal_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
79int cal_main(int argc, char **argv) 79int cal_main(int argc, char **argv)
80{ 80{
81 struct tm *local_time; 81 struct tm *local_time;
diff --git a/coreutils/cat.c b/coreutils/cat.c
index cd5277819..a1db4cd45 100644
--- a/coreutils/cat.c
+++ b/coreutils/cat.c
@@ -43,7 +43,7 @@ int bb_cat(char **argv)
43 return retval; 43 return retval;
44} 44}
45 45
46int cat_main(int argc, char **argv); 46int cat_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
47int cat_main(int argc, char **argv) 47int cat_main(int argc, char **argv)
48{ 48{
49 getopt32(argv, "u"); 49 getopt32(argv, "u");
diff --git a/coreutils/catv.c b/coreutils/catv.c
index 5d5a5500f..5f5f1bf86 100644
--- a/coreutils/catv.c
+++ b/coreutils/catv.c
@@ -12,7 +12,7 @@
12 12
13#include "libbb.h" 13#include "libbb.h"
14 14
15int catv_main(int argc, char **argv); 15int catv_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
16int catv_main(int argc, char **argv) 16int catv_main(int argc, char **argv)
17{ 17{
18 int retval = EXIT_SUCCESS; 18 int retval = EXIT_SUCCESS;
diff --git a/coreutils/chgrp.c b/coreutils/chgrp.c
index 90a1cfe2b..7f3904805 100644
--- a/coreutils/chgrp.c
+++ b/coreutils/chgrp.c
@@ -16,7 +16,7 @@
16/* This is a NOEXEC applet. Be very careful! */ 16/* This is a NOEXEC applet. Be very careful! */
17 17
18 18
19int chgrp_main(int argc, char **argv); 19int chgrp_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
20int chgrp_main(int argc, char **argv) 20int chgrp_main(int argc, char **argv)
21{ 21{
22 /* "chgrp [opts] abc file(s)" == "chown [opts] :abc file(s)" */ 22 /* "chgrp [opts] abc file(s)" == "chown [opts] :abc file(s)" */
diff --git a/coreutils/chmod.c b/coreutils/chmod.c
index dd7b78412..a58e4f8e1 100644
--- a/coreutils/chmod.c
+++ b/coreutils/chmod.c
@@ -67,7 +67,7 @@ static int fileAction(const char *fileName, struct stat *statbuf, void* param, i
67 return FALSE; 67 return FALSE;
68} 68}
69 69
70int chmod_main(int argc, char **argv); 70int chmod_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
71int chmod_main(int argc, char **argv) 71int chmod_main(int argc, char **argv)
72{ 72{
73 int retval = EXIT_SUCCESS; 73 int retval = EXIT_SUCCESS;
diff --git a/coreutils/chown.c b/coreutils/chown.c
index d974493b6..df3b77dac 100644
--- a/coreutils/chown.c
+++ b/coreutils/chown.c
@@ -61,7 +61,7 @@ static int fileAction(const char *fileName, struct stat *statbuf,
61 return FALSE; 61 return FALSE;
62} 62}
63 63
64int chown_main(int argc, char **argv); 64int chown_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
65int chown_main(int argc, char **argv) 65int chown_main(int argc, char **argv)
66{ 66{
67 int retval = EXIT_SUCCESS; 67 int retval = EXIT_SUCCESS;
diff --git a/coreutils/chroot.c b/coreutils/chroot.c
index 192daa894..a3e70e925 100644
--- a/coreutils/chroot.c
+++ b/coreutils/chroot.c
@@ -11,7 +11,7 @@
11 11
12#include "libbb.h" 12#include "libbb.h"
13 13
14int chroot_main(int argc, char **argv); 14int chroot_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
15int chroot_main(int argc, char **argv) 15int chroot_main(int argc, char **argv)
16{ 16{
17 if (argc < 2) { 17 if (argc < 2) {
diff --git a/coreutils/cksum.c b/coreutils/cksum.c
index 987f5f32c..dd274afc2 100644
--- a/coreutils/cksum.c
+++ b/coreutils/cksum.c
@@ -8,7 +8,7 @@
8 8
9#include "libbb.h" 9#include "libbb.h"
10 10
11int cksum_main(int argc, char **argv); 11int cksum_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
12int cksum_main(int argc, char **argv) 12int cksum_main(int argc, char **argv)
13{ 13{
14 uint32_t *crc32_table = crc32_filltable(NULL, 1); 14 uint32_t *crc32_table = crc32_filltable(NULL, 1);
diff --git a/coreutils/comm.c b/coreutils/comm.c
index a4ab14826..67088e06c 100644
--- a/coreutils/comm.c
+++ b/coreutils/comm.c
@@ -35,7 +35,7 @@ static void writeline(char *line, int class, int flags)
35 fputs(line, stdout); 35 fputs(line, stdout);
36} 36}
37 37
38int comm_main(int argc, char **argv); 38int comm_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
39int comm_main(int argc, char **argv) 39int comm_main(int argc, char **argv)
40{ 40{
41#define LINE_LEN 100 41#define LINE_LEN 100
diff --git a/coreutils/cp.c b/coreutils/cp.c
index 046067f35..6cf1e21a1 100644
--- a/coreutils/cp.c
+++ b/coreutils/cp.c
@@ -21,7 +21,7 @@
21/* This is a NOEXEC applet. Be very careful! */ 21/* This is a NOEXEC applet. Be very careful! */
22 22
23 23
24int cp_main(int argc, char **argv); 24int cp_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
25int cp_main(int argc, char **argv) 25int cp_main(int argc, char **argv)
26{ 26{
27 struct stat source_stat; 27 struct stat source_stat;
diff --git a/coreutils/cut.c b/coreutils/cut.c
index 1cf49c2af..257f3d649 100644
--- a/coreutils/cut.c
+++ b/coreutils/cut.c
@@ -165,7 +165,7 @@ static void cut_file(FILE * file)
165 165
166static const char _op_on_field[] ALIGN1 = " only when operating on fields"; 166static const char _op_on_field[] ALIGN1 = " only when operating on fields";
167 167
168int cut_main(int argc, char **argv); 168int cut_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
169int cut_main(int argc, char **argv) 169int cut_main(int argc, char **argv)
170{ 170{
171 char *sopt, *ltok; 171 char *sopt, *ltok;
diff --git a/coreutils/date.c b/coreutils/date.c
index e33a9777d..a8e339333 100644
--- a/coreutils/date.c
+++ b/coreutils/date.c
@@ -38,7 +38,7 @@ static void maybe_set_utc(int opt)
38 putenv((char*)"TZ=UTC0"); 38 putenv((char*)"TZ=UTC0");
39} 39}
40 40
41int date_main(int argc, char **argv); 41int date_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
42int date_main(int argc, char **argv) 42int date_main(int argc, char **argv)
43{ 43{
44 time_t tm; 44 time_t tm;
diff --git a/coreutils/dd.c b/coreutils/dd.c
index b9f5b4cba..fd4e7e8a2 100644
--- a/coreutils/dd.c
+++ b/coreutils/dd.c
@@ -73,7 +73,7 @@ static bool write_and_stats(int fd, const void *buf, size_t len, size_t obs,
73#define XATOU_SFX xatoul_sfx 73#define XATOU_SFX xatoul_sfx
74#endif 74#endif
75 75
76int dd_main(int argc, char **argv); 76int dd_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
77int dd_main(int argc, char **argv) 77int dd_main(int argc, char **argv)
78{ 78{
79 enum { 79 enum {
diff --git a/coreutils/df.c b/coreutils/df.c
index 6fe8e2fba..ad6a4f370 100644
--- a/coreutils/df.c
+++ b/coreutils/df.c
@@ -29,7 +29,7 @@ static unsigned long kscale(unsigned long b, unsigned long bs)
29} 29}
30#endif 30#endif
31 31
32int df_main(int argc, char **argv); 32int df_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
33int df_main(int argc, char **argv) 33int df_main(int argc, char **argv)
34{ 34{
35 unsigned long blocks_used; 35 unsigned long blocks_used;
diff --git a/coreutils/dirname.c b/coreutils/dirname.c
index fd2c381c8..c0c0925e5 100644
--- a/coreutils/dirname.c
+++ b/coreutils/dirname.c
@@ -14,7 +14,7 @@
14 14
15/* This is a NOFORK applet. Be very careful! */ 15/* This is a NOFORK applet. Be very careful! */
16 16
17int dirname_main(int argc, char **argv); 17int dirname_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
18int dirname_main(int argc, char **argv) 18int dirname_main(int argc, char **argv)
19{ 19{
20 if (argc != 2) { 20 if (argc != 2) {
diff --git a/coreutils/dos2unix.c b/coreutils/dos2unix.c
index 28110980a..295be2909 100644
--- a/coreutils/dos2unix.c
+++ b/coreutils/dos2unix.c
@@ -78,7 +78,7 @@ static int convert(char *fn, int conv_type)
78 return 0; 78 return 0;
79} 79}
80 80
81int dos2unix_main(int argc, char **argv); 81int dos2unix_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
82int dos2unix_main(int argc, char **argv) 82int dos2unix_main(int argc, char **argv)
83{ 83{
84 int o, conv_type; 84 int o, conv_type;
diff --git a/coreutils/du.c b/coreutils/du.c
index 2697acf13..3941151e1 100644
--- a/coreutils/du.c
+++ b/coreutils/du.c
@@ -140,7 +140,7 @@ static unsigned long du(const char *filename)
140 return sum; 140 return sum;
141} 141}
142 142
143int du_main(int argc, char **argv); 143int du_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
144int du_main(int argc, char **argv) 144int du_main(int argc, char **argv)
145{ 145{
146 unsigned long total; 146 unsigned long total;
diff --git a/coreutils/echo.c b/coreutils/echo.c
index 851d2efb2..860853f02 100644
--- a/coreutils/echo.c
+++ b/coreutils/echo.c
@@ -119,8 +119,8 @@ int bb_echo(char **argv)
119 119
120/* This is a NOFORK applet. Be very careful! */ 120/* This is a NOFORK applet. Be very careful! */
121 121
122int echo_main(int argc, char** argv); 122int echo_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
123int echo_main(int argc, char** argv) 123int echo_main(int argc, char **argv)
124{ 124{
125 return bb_echo(argv); 125 return bb_echo(argv);
126} 126}
diff --git a/coreutils/env.c b/coreutils/env.c
index 5d0cd8256..b45cbcc7d 100644
--- a/coreutils/env.c
+++ b/coreutils/env.c
@@ -41,8 +41,8 @@ static const char env_longopts[] ALIGN1 =
41 ; 41 ;
42#endif 42#endif
43 43
44int env_main(int argc, char** argv); 44int env_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
45int env_main(int argc, char** argv) 45int env_main(int argc, char **argv)
46{ 46{
47 /* cleanenv was static - why? */ 47 /* cleanenv was static - why? */
48 char *cleanenv[1]; 48 char *cleanenv[1];
diff --git a/coreutils/expand.c b/coreutils/expand.c
index 0ef106dbf..96a74a336 100644
--- a/coreutils/expand.c
+++ b/coreutils/expand.c
@@ -125,7 +125,7 @@ static void unexpand(FILE *file, unsigned int tab_size, unsigned opt)
125} 125}
126#endif 126#endif
127 127
128int expand_main(int argc, char **argv); 128int expand_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
129int expand_main(int argc, char **argv) 129int expand_main(int argc, char **argv)
130{ 130{
131 /* Default 8 spaces for 1 tab */ 131 /* Default 8 spaces for 1 tab */
diff --git a/coreutils/expr.c b/coreutils/expr.c
index c2d966966..959f5200c 100644
--- a/coreutils/expr.c
+++ b/coreutils/expr.c
@@ -483,7 +483,7 @@ static VALUE *eval(void)
483 return l; 483 return l;
484} 484}
485 485
486int expr_main(int argc, char **argv); 486int expr_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
487int expr_main(int argc, char **argv) 487int expr_main(int argc, char **argv)
488{ 488{
489 VALUE *v; 489 VALUE *v;
diff --git a/coreutils/false.c b/coreutils/false.c
index 07cf9e83e..5beb58a28 100644
--- a/coreutils/false.c
+++ b/coreutils/false.c
@@ -14,7 +14,7 @@
14 14
15/* This is a NOFORK applet. Be very careful! */ 15/* This is a NOFORK applet. Be very careful! */
16 16
17int false_main(int ATTRIBUTE_UNUSED argc, char ATTRIBUTE_UNUSED **argv); 17int false_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
18int false_main(int ATTRIBUTE_UNUSED argc, char ATTRIBUTE_UNUSED **argv) 18int false_main(int ATTRIBUTE_UNUSED argc, char ATTRIBUTE_UNUSED **argv)
19{ 19{
20 return EXIT_FAILURE; 20 return EXIT_FAILURE;
diff --git a/coreutils/fold.c b/coreutils/fold.c
index bf4b19831..ed484edf0 100644
--- a/coreutils/fold.c
+++ b/coreutils/fold.c
@@ -38,7 +38,7 @@ static int adjust_column(int column, char c)
38 return column; 38 return column;
39} 39}
40 40
41int fold_main(int argc, char **argv); 41int fold_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
42int fold_main(int argc, char **argv) 42int fold_main(int argc, char **argv)
43{ 43{
44 char *line_out = NULL; 44 char *line_out = NULL;
diff --git a/coreutils/head.c b/coreutils/head.c
index af9e9f41e..629307719 100644
--- a/coreutils/head.c
+++ b/coreutils/head.c
@@ -31,7 +31,7 @@ static const struct suffix_mult head_suffixes[] = {
31 31
32static const char header_fmt_str[] ALIGN1 = "\n==> %s <==\n"; 32static const char header_fmt_str[] ALIGN1 = "\n==> %s <==\n";
33 33
34int head_main(int argc, char **argv); 34int head_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
35int head_main(int argc, char **argv) 35int head_main(int argc, char **argv)
36{ 36{
37 unsigned long count = 10; 37 unsigned long count = 10;
diff --git a/coreutils/hostid.c b/coreutils/hostid.c
index 7d96651e7..433eccc45 100644
--- a/coreutils/hostid.c
+++ b/coreutils/hostid.c
@@ -13,7 +13,7 @@
13 13
14/* This is a NOFORK applet. Be very careful! */ 14/* This is a NOFORK applet. Be very careful! */
15 15
16int hostid_main(int argc, char ATTRIBUTE_UNUSED **argv); 16int hostid_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
17int hostid_main(int argc, char ATTRIBUTE_UNUSED **argv) 17int hostid_main(int argc, char ATTRIBUTE_UNUSED **argv)
18{ 18{
19 if (argc > 1) { 19 if (argc > 1) {
diff --git a/coreutils/id.c b/coreutils/id.c
index f72a027fa..7dba80284 100644
--- a/coreutils/id.c
+++ b/coreutils/id.c
@@ -36,7 +36,7 @@ static int printf_full(unsigned int id, const char *arg, const char prefix)
36 return status; 36 return status;
37} 37}
38 38
39int id_main(int argc, char **argv); 39int id_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
40int id_main(int argc, char **argv) 40int id_main(int argc, char **argv)
41{ 41{
42 struct passwd *p; 42 struct passwd *p;
diff --git a/coreutils/install.c b/coreutils/install.c
index 516208474..4adcadb94 100644
--- a/coreutils/install.c
+++ b/coreutils/install.c
@@ -66,7 +66,7 @@ static void setdefaultfilecon(const char *path)
66 66
67#endif 67#endif
68 68
69int install_main(int argc, char **argv); 69int install_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
70int install_main(int argc, char **argv) 70int install_main(int argc, char **argv)
71{ 71{
72 struct stat statbuf; 72 struct stat statbuf;
diff --git a/coreutils/length.c b/coreutils/length.c
index a310b3b2f..c7523a02a 100644
--- a/coreutils/length.c
+++ b/coreutils/length.c
@@ -6,7 +6,7 @@
6 6
7/* This is a NOFORK applet. Be very careful! */ 7/* This is a NOFORK applet. Be very careful! */
8 8
9int length_main(int argc, char **argv); 9int length_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
10int length_main(int argc, char **argv) 10int length_main(int argc, char **argv)
11{ 11{
12 if ((argc != 2) || (**(++argv) == '-')) { 12 if ((argc != 2) || (**(++argv) == '-')) {
diff --git a/coreutils/ln.c b/coreutils/ln.c
index 658e32e94..eb7171959 100644
--- a/coreutils/ln.c
+++ b/coreutils/ln.c
@@ -22,7 +22,7 @@
22#define LN_BACKUP 8 22#define LN_BACKUP 8
23#define LN_SUFFIX 16 23#define LN_SUFFIX 16
24 24
25int ln_main(int argc, char **argv); 25int ln_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
26int ln_main(int argc, char **argv) 26int ln_main(int argc, char **argv)
27{ 27{
28 int status = EXIT_SUCCESS; 28 int status = EXIT_SUCCESS;
diff --git a/coreutils/logname.c b/coreutils/logname.c
index 2e628bc14..09fd3960d 100644
--- a/coreutils/logname.c
+++ b/coreutils/logname.c
@@ -24,7 +24,7 @@
24 24
25/* This is a NOFORK applet. Be very careful! */ 25/* This is a NOFORK applet. Be very careful! */
26 26
27int logname_main(int argc, char ATTRIBUTE_UNUSED **argv); 27int logname_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
28int logname_main(int argc, char ATTRIBUTE_UNUSED **argv) 28int logname_main(int argc, char ATTRIBUTE_UNUSED **argv)
29{ 29{
30 char buf[128]; 30 char buf[128];
diff --git a/coreutils/ls.c b/coreutils/ls.c
index 92a9a289d..dbf1c5ba6 100644
--- a/coreutils/ls.c
+++ b/coreutils/ls.c
@@ -783,7 +783,7 @@ static const unsigned opt_flags[] = {
783/* THIS IS A "SAFE" APPLET, main() MAY BE CALLED INTERNALLY FROM SHELL */ 783/* THIS IS A "SAFE" APPLET, main() MAY BE CALLED INTERNALLY FROM SHELL */
784/* BE CAREFUL! */ 784/* BE CAREFUL! */
785 785
786int ls_main(int argc, char **argv); 786int ls_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
787int ls_main(int argc, char **argv) 787int ls_main(int argc, char **argv)
788{ 788{
789 struct dnode **dnd; 789 struct dnode **dnd;
diff --git a/coreutils/md5_sha1_sum.c b/coreutils/md5_sha1_sum.c
index 7f8b08497..e94f2ceb1 100644
--- a/coreutils/md5_sha1_sum.c
+++ b/coreutils/md5_sha1_sum.c
@@ -77,7 +77,7 @@ static uint8_t *hash_file(const char *filename, hash_algo_t hash_algo)
77 return hash_value; 77 return hash_value;
78} 78}
79 79
80int md5_sha1_sum_main(int argc, char **argv); 80int md5_sha1_sum_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
81int md5_sha1_sum_main(int argc, char **argv) 81int md5_sha1_sum_main(int argc, char **argv)
82{ 82{
83 int return_value = EXIT_SUCCESS; 83 int return_value = EXIT_SUCCESS;
diff --git a/coreutils/mkdir.c b/coreutils/mkdir.c
index d1a4380ad..6bdf76d29 100644
--- a/coreutils/mkdir.c
+++ b/coreutils/mkdir.c
@@ -34,7 +34,7 @@ static const char mkdir_longopts[] ALIGN1 =
34 ; 34 ;
35#endif 35#endif
36 36
37int mkdir_main(int argc, char **argv); 37int mkdir_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
38int mkdir_main(int argc, char **argv) 38int mkdir_main(int argc, char **argv)
39{ 39{
40 mode_t mode = (mode_t)(-1); 40 mode_t mode = (mode_t)(-1);
diff --git a/coreutils/mkfifo.c b/coreutils/mkfifo.c
index e66f81778..d298adae0 100644
--- a/coreutils/mkfifo.c
+++ b/coreutils/mkfifo.c
@@ -13,7 +13,7 @@
13#include "libbb.h" 13#include "libbb.h"
14#include "libcoreutils/coreutils.h" 14#include "libcoreutils/coreutils.h"
15 15
16int mkfifo_main(int argc, char **argv); 16int mkfifo_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
17int mkfifo_main(int argc, char **argv) 17int mkfifo_main(int argc, char **argv)
18{ 18{
19 mode_t mode; 19 mode_t mode;
diff --git a/coreutils/mknod.c b/coreutils/mknod.c
index a876daaf1..ee539e387 100644
--- a/coreutils/mknod.c
+++ b/coreutils/mknod.c
@@ -17,7 +17,7 @@
17static const char modes_chars[] ALIGN1 = { 'p', 'c', 'u', 'b', 0, 1, 1, 2 }; 17static const char modes_chars[] ALIGN1 = { 'p', 'c', 'u', 'b', 0, 1, 1, 2 };
18static const mode_t modes_cubp[] = { S_IFIFO, S_IFCHR, S_IFBLK }; 18static const mode_t modes_cubp[] = { S_IFIFO, S_IFCHR, S_IFBLK };
19 19
20int mknod_main(int argc, char **argv); 20int mknod_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
21int mknod_main(int argc, char **argv) 21int mknod_main(int argc, char **argv)
22{ 22{
23 mode_t mode; 23 mode_t mode;
diff --git a/coreutils/mv.c b/coreutils/mv.c
index d13f4d54f..5d0b51561 100644
--- a/coreutils/mv.c
+++ b/coreutils/mv.c
@@ -33,7 +33,7 @@ static const char mv_longopts[] ALIGN1 =
33static const char fmt[] ALIGN1 = 33static const char fmt[] ALIGN1 =
34 "cannot overwrite %sdirectory with %sdirectory"; 34 "cannot overwrite %sdirectory with %sdirectory";
35 35
36int mv_main(int argc, char **argv); 36int mv_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
37int mv_main(int argc, char **argv) 37int mv_main(int argc, char **argv)
38{ 38{
39 struct stat dest_stat; 39 struct stat dest_stat;
diff --git a/coreutils/nice.c b/coreutils/nice.c
index 0cb31e4fa..d24a95b45 100644
--- a/coreutils/nice.c
+++ b/coreutils/nice.c
@@ -10,7 +10,7 @@
10#include <sys/resource.h> 10#include <sys/resource.h>
11#include "libbb.h" 11#include "libbb.h"
12 12
13int nice_main(int argc, char **argv); 13int nice_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
14int nice_main(int argc, char **argv) 14int nice_main(int argc, char **argv)
15{ 15{
16 int old_priority, adjustment; 16 int old_priority, adjustment;
diff --git a/coreutils/nohup.c b/coreutils/nohup.c
index e27bd2e35..da8f58c72 100644
--- a/coreutils/nohup.c
+++ b/coreutils/nohup.c
@@ -12,7 +12,7 @@
12 12
13#include "libbb.h" 13#include "libbb.h"
14 14
15int nohup_main(int argc, char **argv); 15int nohup_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
16int nohup_main(int argc, char **argv) 16int nohup_main(int argc, char **argv)
17{ 17{
18 int nullfd; 18 int nullfd;
diff --git a/coreutils/od.c b/coreutils/od.c
index 114a746fa..85e979f7e 100644
--- a/coreutils/od.c
+++ b/coreutils/od.c
@@ -156,7 +156,7 @@ static const char od_o2si[] ALIGN1 = {
156 0xb, 1, 8, 9, 156 0xb, 1, 8, 9,
157}; 157};
158 158
159int od_main(int argc, char **argv); 159int od_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
160int od_main(int argc, char **argv) 160int od_main(int argc, char **argv)
161{ 161{
162 int ch; 162 int ch;
diff --git a/coreutils/od_bloaty.c b/coreutils/od_bloaty.c
index 1bd1b0c84..9655c2398 100644
--- a/coreutils/od_bloaty.c
+++ b/coreutils/od_bloaty.c
@@ -1196,7 +1196,7 @@ dump_strings(void)
1196 check_and_close(); 1196 check_and_close();
1197} 1197}
1198 1198
1199int od_main(int argc, char **argv); 1199int od_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
1200int od_main(int argc, char **argv) 1200int od_main(int argc, char **argv)
1201{ 1201{
1202 static const struct suffix_mult bkm[] = { 1202 static const struct suffix_mult bkm[] = {
diff --git a/coreutils/printenv.c b/coreutils/printenv.c
index 19fa832c8..bac77e2a8 100644
--- a/coreutils/printenv.c
+++ b/coreutils/printenv.c
@@ -11,7 +11,7 @@
11#include "libbb.h" 11#include "libbb.h"
12extern char **environ; 12extern char **environ;
13 13
14int printenv_main(int argc, char **argv); 14int printenv_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
15int printenv_main(int argc, char **argv) 15int printenv_main(int argc, char **argv)
16{ 16{
17 /* no variables specified, show whole env */ 17 /* no variables specified, show whole env */
diff --git a/coreutils/printf.c b/coreutils/printf.c
index d5ef32e8c..a9ef61f68 100644
--- a/coreutils/printf.c
+++ b/coreutils/printf.c
@@ -285,7 +285,7 @@ static int print_formatted(char *format, int argc, char **argv)
285 return save_argc - argc; 285 return save_argc - argc;
286} 286}
287 287
288int printf_main(int argc, char **argv); 288int printf_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
289int printf_main(int argc, char **argv) 289int printf_main(int argc, char **argv)
290{ 290{
291 char *format; 291 char *format;
diff --git a/coreutils/pwd.c b/coreutils/pwd.c
index 73a9d5be8..ac604db97 100644
--- a/coreutils/pwd.c
+++ b/coreutils/pwd.c
@@ -11,7 +11,7 @@
11 11
12/* This is a NOFORK applet. Be very careful! */ 12/* This is a NOFORK applet. Be very careful! */
13 13
14int pwd_main(int argc, char **argv); 14int pwd_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
15int pwd_main(int argc, char **argv) 15int pwd_main(int argc, char **argv)
16{ 16{
17 char *buf; 17 char *buf;
diff --git a/coreutils/readlink.c b/coreutils/readlink.c
index 39edc0569..b6e389a21 100644
--- a/coreutils/readlink.c
+++ b/coreutils/readlink.c
@@ -11,7 +11,7 @@
11 11
12#include "libbb.h" 12#include "libbb.h"
13 13
14int readlink_main(int argc, char **argv); 14int readlink_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
15int readlink_main(int argc, char **argv) 15int readlink_main(int argc, char **argv)
16{ 16{
17 char *buf; 17 char *buf;
diff --git a/coreutils/realpath.c b/coreutils/realpath.c
index 9c4298720..bcb73a8dc 100644
--- a/coreutils/realpath.c
+++ b/coreutils/realpath.c
@@ -12,7 +12,7 @@
12 12
13#include "libbb.h" 13#include "libbb.h"
14 14
15int realpath_main(int argc, char **argv); 15int realpath_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
16int realpath_main(int argc, char **argv) 16int realpath_main(int argc, char **argv)
17{ 17{
18 int retval = EXIT_SUCCESS; 18 int retval = EXIT_SUCCESS;
diff --git a/coreutils/rm.c b/coreutils/rm.c
index a686fc40c..a123156d2 100644
--- a/coreutils/rm.c
+++ b/coreutils/rm.c
@@ -19,7 +19,7 @@
19 19
20/* This is a NOFORK applet. Be very careful! */ 20/* This is a NOFORK applet. Be very careful! */
21 21
22int rm_main(int argc, char **argv); 22int rm_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
23int rm_main(int argc, char **argv) 23int rm_main(int argc, char **argv)
24{ 24{
25 int status = 0; 25 int status = 0;
diff --git a/coreutils/rmdir.c b/coreutils/rmdir.c
index 315401e0e..71d29dd98 100644
--- a/coreutils/rmdir.c
+++ b/coreutils/rmdir.c
@@ -16,7 +16,7 @@
16/* This is a NOFORK applet. Be very careful! */ 16/* This is a NOFORK applet. Be very careful! */
17 17
18 18
19int rmdir_main(int argc, char **argv); 19int rmdir_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
20int rmdir_main(int argc, char **argv) 20int rmdir_main(int argc, char **argv)
21{ 21{
22 int status = EXIT_SUCCESS; 22 int status = EXIT_SUCCESS;
diff --git a/coreutils/seq.c b/coreutils/seq.c
index 050c33317..01d71f256 100644
--- a/coreutils/seq.c
+++ b/coreutils/seq.c
@@ -12,7 +12,7 @@
12/* This is a NOFORK applet. Be very careful! */ 12/* This is a NOFORK applet. Be very careful! */
13 13
14 14
15int seq_main(int argc, char **argv); 15int seq_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
16int seq_main(int argc, char **argv) 16int seq_main(int argc, char **argv)
17{ 17{
18 double last, increment, i; 18 double last, increment, i;
diff --git a/coreutils/sleep.c b/coreutils/sleep.c
index 26cdbc470..6890e35c1 100644
--- a/coreutils/sleep.c
+++ b/coreutils/sleep.c
@@ -33,7 +33,7 @@ static const struct suffix_mult sfx[] = {
33}; 33};
34#endif 34#endif
35 35
36int sleep_main(int argc, char **argv); 36int sleep_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
37int sleep_main(int argc, char **argv) 37int sleep_main(int argc, char **argv)
38{ 38{
39 unsigned duration; 39 unsigned duration;
diff --git a/coreutils/sort.c b/coreutils/sort.c
index 311c774ae..313234675 100644
--- a/coreutils/sort.c
+++ b/coreutils/sort.c
@@ -274,7 +274,7 @@ static unsigned str2u(char **str)
274} 274}
275#endif 275#endif
276 276
277int sort_main(int argc, char **argv); 277int sort_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
278int sort_main(int argc, char **argv) 278int sort_main(int argc, char **argv)
279{ 279{
280 FILE *fp, *outfile = stdout; 280 FILE *fp, *outfile = stdout;
diff --git a/coreutils/split.c b/coreutils/split.c
index 6d8924aeb..51a631c56 100644
--- a/coreutils/split.c
+++ b/coreutils/split.c
@@ -55,7 +55,7 @@ enum { READ_BUFFER_SIZE = COMMON_BUFSIZE - 1 };
55#define SPLIT_OPT_b (1<<1) 55#define SPLIT_OPT_b (1<<1)
56#define SPLIT_OPT_a (1<<2) 56#define SPLIT_OPT_a (1<<2)
57 57
58int split_main(int argc, char **argv); 58int split_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
59int split_main(int argc, char **argv) 59int split_main(int argc, char **argv)
60{ 60{
61 unsigned suffix_len = 2; 61 unsigned suffix_len = 2;
diff --git a/coreutils/stat.c b/coreutils/stat.c
index ed6580ef0..a5a30546d 100644
--- a/coreutils/stat.c
+++ b/coreutils/stat.c
@@ -609,7 +609,7 @@ static bool do_stat(const char *filename, const char *format)
609 return 1; 609 return 1;
610} 610}
611 611
612int stat_main(int argc, char **argv); 612int stat_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
613int stat_main(int argc, char **argv) 613int stat_main(int argc, char **argv)
614{ 614{
615 char *format = NULL; 615 char *format = NULL;
diff --git a/coreutils/stty.c b/coreutils/stty.c
index 1f0d4227e..8ad12e65e 100644
--- a/coreutils/stty.c
+++ b/coreutils/stty.c
@@ -911,7 +911,7 @@ static void set_control_char_or_die(const struct control_info *info,
911#define STTY_verbose_output (1<<2) 911#define STTY_verbose_output (1<<2)
912#define STTY_recoverable_output (1<<3) 912#define STTY_recoverable_output (1<<3)
913#define STTY_noargs (1<<4) 913#define STTY_noargs (1<<4)
914int stty_main(int argc, char **argv); 914int stty_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
915int stty_main(int argc, char **argv) 915int stty_main(int argc, char **argv)
916{ 916{
917 struct termios mode; 917 struct termios mode;
diff --git a/coreutils/sum.c b/coreutils/sum.c
index a75dd321d..65478b0a1 100644
--- a/coreutils/sum.c
+++ b/coreutils/sum.c
@@ -74,7 +74,7 @@ static unsigned sum_file(const char *file, const unsigned type)
74#undef buf 74#undef buf
75} 75}
76 76
77int sum_main(int argc, char **argv); 77int sum_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
78int sum_main(int argc, char **argv) 78int sum_main(int argc, char **argv)
79{ 79{
80 unsigned n; 80 unsigned n;
diff --git a/coreutils/sync.c b/coreutils/sync.c
index d562f3fc5..9dbdd98aa 100644
--- a/coreutils/sync.c
+++ b/coreutils/sync.c
@@ -13,7 +13,7 @@
13 13
14/* This is a NOFORK applet. Be very careful! */ 14/* This is a NOFORK applet. Be very careful! */
15 15
16int sync_main(int argc, char **argv); 16int sync_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
17int sync_main(int argc, char **argv) 17int sync_main(int argc, char **argv)
18{ 18{
19 bb_warn_ignoring_args(argc - 1); 19 bb_warn_ignoring_args(argc - 1);
diff --git a/coreutils/tail.c b/coreutils/tail.c
index 53dbf33ac..beecbaedf 100644
--- a/coreutils/tail.c
+++ b/coreutils/tail.c
@@ -79,7 +79,7 @@ static unsigned eat_num(const char *p)
79 return xatou_sfx(p, tail_suffixes); 79 return xatou_sfx(p, tail_suffixes);
80} 80}
81 81
82int tail_main(int argc, char **argv); 82int tail_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
83int tail_main(int argc, char **argv) 83int tail_main(int argc, char **argv)
84{ 84{
85 unsigned count = 10; 85 unsigned count = 10;
diff --git a/coreutils/tee.c b/coreutils/tee.c
index 831325812..13fb4a3c1 100644
--- a/coreutils/tee.c
+++ b/coreutils/tee.c
@@ -13,7 +13,7 @@
13#include "libbb.h" 13#include "libbb.h"
14#include <signal.h> 14#include <signal.h>
15 15
16int tee_main(int argc, char **argv); 16int tee_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
17int tee_main(int argc, char **argv) 17int tee_main(int argc, char **argv)
18{ 18{
19 const char *mode = "w\0a"; 19 const char *mode = "w\0a";
diff --git a/coreutils/touch.c b/coreutils/touch.c
index d8498d854..1b83dc44c 100644
--- a/coreutils/touch.c
+++ b/coreutils/touch.c
@@ -21,7 +21,7 @@
21 21
22/* This is a NOFORK applet. Be very careful! */ 22/* This is a NOFORK applet. Be very careful! */
23 23
24int touch_main(int argc, char **argv); 24int touch_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
25int touch_main(int argc, char **argv) 25int touch_main(int argc, char **argv)
26{ 26{
27 int fd; 27 int fd;
diff --git a/coreutils/tr.c b/coreutils/tr.c
index 6a34e3087..9521bbcd5 100644
--- a/coreutils/tr.c
+++ b/coreutils/tr.c
@@ -165,7 +165,7 @@ static int complement(char *buffer, int buffer_len)
165 return ix; 165 return ix;
166} 166}
167 167
168int tr_main(int argc, char **argv); 168int tr_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
169int tr_main(int argc, char **argv) 169int tr_main(int argc, char **argv)
170{ 170{
171 unsigned char *ptr; 171 unsigned char *ptr;
diff --git a/coreutils/true.c b/coreutils/true.c
index 9dcd69aa3..2b5919320 100644
--- a/coreutils/true.c
+++ b/coreutils/true.c
@@ -14,7 +14,7 @@
14 14
15/* This is a NOFORK applet. Be very careful! */ 15/* This is a NOFORK applet. Be very careful! */
16 16
17int true_main(int argc, char **argv); 17int true_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
18int true_main(int argc, char **argv) 18int true_main(int argc, char **argv)
19{ 19{
20 return EXIT_SUCCESS; 20 return EXIT_SUCCESS;
diff --git a/coreutils/tty.c b/coreutils/tty.c
index d8ce78c00..b0a50ff61 100644
--- a/coreutils/tty.c
+++ b/coreutils/tty.c
@@ -12,7 +12,7 @@
12 12
13#include "libbb.h" 13#include "libbb.h"
14 14
15int tty_main(int argc, char **argv); 15int tty_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
16int tty_main(int argc, char **argv) 16int tty_main(int argc, char **argv)
17{ 17{
18 const char *s; 18 const char *s;
diff --git a/coreutils/uname.c b/coreutils/uname.c
index e70b1f9b6..2eecb5d6d 100644
--- a/coreutils/uname.c
+++ b/coreutils/uname.c
@@ -48,7 +48,7 @@ static const unsigned short utsname_offset[] ALIGN2 = {
48 offsetof(uname_info_t,processor) 48 offsetof(uname_info_t,processor)
49}; 49};
50 50
51int uname_main(int argc, char **argv); 51int uname_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
52int uname_main(int argc, char **argv) 52int uname_main(int argc, char **argv)
53{ 53{
54 uname_info_t uname_info; 54 uname_info_t uname_info;
diff --git a/coreutils/uniq.c b/coreutils/uniq.c
index 719bbb5e3..cda1e61a9 100644
--- a/coreutils/uniq.c
+++ b/coreutils/uniq.c
@@ -27,7 +27,7 @@ static FILE *xgetoptfile_uniq_s(char **argv, int read0write2)
27 return (read0write2) ? stdout : stdin; 27 return (read0write2) ? stdout : stdin;
28} 28}
29 29
30int uniq_main(int argc, char **argv); 30int uniq_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
31int uniq_main(int argc, char **argv) 31int uniq_main(int argc, char **argv)
32{ 32{
33 FILE *in, *out; 33 FILE *in, *out;
diff --git a/coreutils/usleep.c b/coreutils/usleep.c
index e0cd56e54..1c9022325 100644
--- a/coreutils/usleep.c
+++ b/coreutils/usleep.c
@@ -13,7 +13,7 @@
13 13
14/* This is a NOFORK applet. Be very careful! */ 14/* This is a NOFORK applet. Be very careful! */
15 15
16int usleep_main(int argc, char **argv); 16int usleep_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
17int usleep_main(int argc, char **argv) 17int usleep_main(int argc, char **argv)
18{ 18{
19 if (argc != 2) { 19 if (argc != 2) {
diff --git a/coreutils/uudecode.c b/coreutils/uudecode.c
index 7a52bdbda..46836624c 100644
--- a/coreutils/uudecode.c
+++ b/coreutils/uudecode.c
@@ -126,7 +126,7 @@ static void read_base64(FILE *src_stream, FILE *dst_stream)
126 } 126 }
127} 127}
128 128
129int uudecode_main(int argc, char **argv); 129int uudecode_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
130int uudecode_main(int argc, char **argv) 130int uudecode_main(int argc, char **argv)
131{ 131{
132 FILE *src_stream = stdin; 132 FILE *src_stream = stdin;
diff --git a/coreutils/uuencode.c b/coreutils/uuencode.c
index 17def8d9a..e19f99676 100644
--- a/coreutils/uuencode.c
+++ b/coreutils/uuencode.c
@@ -15,7 +15,7 @@ enum {
15 DST_BUF_SIZE = 4 * ((SRC_BUF_SIZE + 2) / 3), 15 DST_BUF_SIZE = 4 * ((SRC_BUF_SIZE + 2) / 3),
16}; 16};
17 17
18int uuencode_main(int argc, char **argv); 18int uuencode_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
19int uuencode_main(int argc, char **argv) 19int uuencode_main(int argc, char **argv)
20{ 20{
21 struct stat stat_buf; 21 struct stat stat_buf;
diff --git a/coreutils/wc.c b/coreutils/wc.c
index c8a4865b1..291af411f 100644
--- a/coreutils/wc.c
+++ b/coreutils/wc.c
@@ -68,7 +68,7 @@ enum {
68 WC_LENGTH = 3 68 WC_LENGTH = 3
69}; 69};
70 70
71int wc_main(int argc, char **argv); 71int wc_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
72int wc_main(int argc, char **argv) 72int wc_main(int argc, char **argv)
73{ 73{
74 FILE *fp; 74 FILE *fp;
diff --git a/coreutils/who.c b/coreutils/who.c
index 546050aee..6e7710c2d 100644
--- a/coreutils/who.c
+++ b/coreutils/who.c
@@ -39,7 +39,7 @@ static void idle_string(char *str6, time_t t)
39 strcpy(str6, "old"); 39 strcpy(str6, "old");
40} 40}
41 41
42int who_main(int argc, char **argv); 42int who_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
43int who_main(int argc, char **argv) 43int who_main(int argc, char **argv)
44{ 44{
45 char str6[6]; 45 char str6[6];
diff --git a/coreutils/whoami.c b/coreutils/whoami.c
index 3718358d5..e2fdfc955 100644
--- a/coreutils/whoami.c
+++ b/coreutils/whoami.c
@@ -13,7 +13,7 @@
13 13
14/* This is a NOFORK applet. Be very careful! */ 14/* This is a NOFORK applet. Be very careful! */
15 15
16int whoami_main(int argc, char **argv); 16int whoami_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
17int whoami_main(int argc, char **argv) 17int whoami_main(int argc, char **argv)
18{ 18{
19 if (argc > 1) 19 if (argc > 1)
diff --git a/coreutils/yes.c b/coreutils/yes.c
index 5529eab14..269d2a0c2 100644
--- a/coreutils/yes.c
+++ b/coreutils/yes.c
@@ -18,7 +18,7 @@
18 18
19/* This is a NOFORK applet. Be very careful! */ 19/* This is a NOFORK applet. Be very careful! */
20 20
21int yes_main(int argc, char **argv); 21int yes_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
22int yes_main(int argc, char **argv) 22int yes_main(int argc, char **argv)
23{ 23{
24 char **first_arg; 24 char **first_arg;
diff --git a/debianutils/mktemp.c b/debianutils/mktemp.c
index 1c71c2e43..5772ad9ee 100644
--- a/debianutils/mktemp.c
+++ b/debianutils/mktemp.c
@@ -11,7 +11,7 @@
11 11
12#include "libbb.h" 12#include "libbb.h"
13 13
14int mktemp_main(int argc, char **argv); 14int mktemp_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
15int mktemp_main(int argc, char **argv) 15int mktemp_main(int argc, char **argv)
16{ 16{
17 unsigned long flags = getopt32(argv, "dqt"); 17 unsigned long flags = getopt32(argv, "dqt");
diff --git a/debianutils/pipe_progress.c b/debianutils/pipe_progress.c
index ac8fb50f6..4bfdf6aa4 100644
--- a/debianutils/pipe_progress.c
+++ b/debianutils/pipe_progress.c
@@ -14,7 +14,7 @@
14/* Read a block of data from stdin, write it to stdout. 14/* Read a block of data from stdin, write it to stdout.
15 * Activity is indicated by a '.' to stderr 15 * Activity is indicated by a '.' to stderr
16 */ 16 */
17int pipe_progress_main(int argc, char **argv); 17int pipe_progress_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
18int pipe_progress_main(int argc, char **argv) 18int pipe_progress_main(int argc, char **argv)
19{ 19{
20 RESERVE_CONFIG_BUFFER(buf, PIPE_PROGRESS_SIZE); 20 RESERVE_CONFIG_BUFFER(buf, PIPE_PROGRESS_SIZE);
diff --git a/debianutils/run_parts.c b/debianutils/run_parts.c
index 56f70c6ee..338817f8f 100644
--- a/debianutils/run_parts.c
+++ b/debianutils/run_parts.c
@@ -110,7 +110,7 @@ static const char runparts_longopts[] ALIGN1 =
110 ; 110 ;
111#endif 111#endif
112 112
113int run_parts_main(int argc, char **argv); 113int run_parts_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
114int run_parts_main(int argc, char **argv) 114int run_parts_main(int argc, char **argv)
115{ 115{
116 const char *umask_p = "22"; 116 const char *umask_p = "22";
diff --git a/debianutils/start_stop_daemon.c b/debianutils/start_stop_daemon.c
index 7633cb057..6860bab6b 100644
--- a/debianutils/start_stop_daemon.c
+++ b/debianutils/start_stop_daemon.c
@@ -234,7 +234,7 @@ enum {
234 OPT_NICELEVEL = 0x4000 * ENABLE_FEATURE_START_STOP_DAEMON_FANCY, // -N 234 OPT_NICELEVEL = 0x4000 * ENABLE_FEATURE_START_STOP_DAEMON_FANCY, // -N
235}; 235};
236 236
237int start_stop_daemon_main(int argc, char **argv); 237int start_stop_daemon_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
238int start_stop_daemon_main(int argc, char **argv) 238int start_stop_daemon_main(int argc, char **argv)
239{ 239{
240 unsigned opt; 240 unsigned opt;
diff --git a/debianutils/which.c b/debianutils/which.c
index b556a9fd9..883813059 100644
--- a/debianutils/which.c
+++ b/debianutils/which.c
@@ -12,7 +12,7 @@
12 12
13#include "libbb.h" 13#include "libbb.h"
14 14
15int which_main(int argc, char **argv); 15int which_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
16int which_main(int argc, char **argv) 16int which_main(int argc, char **argv)
17{ 17{
18 int status = EXIT_SUCCESS; 18 int status = EXIT_SUCCESS;
diff --git a/docs/new-applet-HOWTO.txt b/docs/new-applet-HOWTO.txt
index 05ff92f26..37a78e95b 100644
--- a/docs/new-applet-HOWTO.txt
+++ b/docs/new-applet-HOWTO.txt
@@ -42,7 +42,7 @@ For a new applet mu, here is the code that would go in mu.c:
42#include "libbb.h" 42#include "libbb.h"
43#include "other.h" 43#include "other.h"
44 44
45int mu_main(int argc, char **argv); 45int mu_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
46int mu_main(int argc, char **argv) 46int mu_main(int argc, char **argv)
47{ 47{
48 int fd; 48 int fd;
diff --git a/e2fsprogs/chattr.c b/e2fsprogs/chattr.c
index 35424f842..db5437228 100644
--- a/e2fsprogs/chattr.c
+++ b/e2fsprogs/chattr.c
@@ -142,7 +142,7 @@ static void change_attributes(const char *name, struct globals *gp)
142 iterate_on_dir(name, chattr_dir_proc, gp); 142 iterate_on_dir(name, chattr_dir_proc, gp);
143} 143}
144 144
145int chattr_main(int argc, char **argv); 145int chattr_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
146int chattr_main(int argc, char **argv) 146int chattr_main(int argc, char **argv)
147{ 147{
148 struct globals g; 148 struct globals g;
diff --git a/e2fsprogs/fsck.c b/e2fsprogs/fsck.c
index 110b3d246..f80de8178 100644
--- a/e2fsprogs/fsck.c
+++ b/e2fsprogs/fsck.c
@@ -1153,7 +1153,7 @@ static void signal_cancel(int sig ATTRIBUTE_UNUSED)
1153 cancel_requested = 1; 1153 cancel_requested = 1;
1154} 1154}
1155 1155
1156int fsck_main(int argc, char **argv); 1156int fsck_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
1157int fsck_main(int argc, char **argv) 1157int fsck_main(int argc, char **argv)
1158{ 1158{
1159 int i, status = 0; 1159 int i, status = 0;
diff --git a/e2fsprogs/lsattr.c b/e2fsprogs/lsattr.c
index 5f4f87276..6f4b9742c 100644
--- a/e2fsprogs/lsattr.c
+++ b/e2fsprogs/lsattr.c
@@ -95,7 +95,7 @@ static void lsattr_args(const char *name)
95 } 95 }
96} 96}
97 97
98int lsattr_main(int argc, char **argv); 98int lsattr_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
99int lsattr_main(int argc, char **argv) 99int lsattr_main(int argc, char **argv)
100{ 100{
101 getopt32(argv, "Radlv"); 101 getopt32(argv, "Radlv");
diff --git a/e2fsprogs/old_e2fsprogs/chattr.c b/e2fsprogs/old_e2fsprogs/chattr.c
index b9339387d..ae39d9224 100644
--- a/e2fsprogs/old_e2fsprogs/chattr.c
+++ b/e2fsprogs/old_e2fsprogs/chattr.c
@@ -170,7 +170,7 @@ static int chattr_dir_proc(const char *dir_name, struct dirent *de,
170 return 0; 170 return 0;
171} 171}
172 172
173int chattr_main(int argc, char **argv); 173int chattr_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
174int chattr_main(int argc, char **argv) 174int chattr_main(int argc, char **argv)
175{ 175{
176 int i; 176 int i;
diff --git a/e2fsprogs/old_e2fsprogs/fsck.c b/e2fsprogs/old_e2fsprogs/fsck.c
index 7e7383898..d4914a571 100644
--- a/e2fsprogs/old_e2fsprogs/fsck.c
+++ b/e2fsprogs/old_e2fsprogs/fsck.c
@@ -1321,7 +1321,7 @@ static void PRS(int argc, char **argv)
1321 max_running = atoi(tmp); 1321 max_running = atoi(tmp);
1322} 1322}
1323 1323
1324int fsck_main(int argc, char **argv); 1324int fsck_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
1325int fsck_main(int argc, char **argv) 1325int fsck_main(int argc, char **argv)
1326{ 1326{
1327 int i, status = 0; 1327 int i, status = 0;
diff --git a/e2fsprogs/old_e2fsprogs/lsattr.c b/e2fsprogs/old_e2fsprogs/lsattr.c
index bbc03aa9d..277ec7c2c 100644
--- a/e2fsprogs/old_e2fsprogs/lsattr.c
+++ b/e2fsprogs/old_e2fsprogs/lsattr.c
@@ -112,7 +112,7 @@ static int lsattr_dir_proc(const char *dir_name, struct dirent *de,
112 return 0; 112 return 0;
113} 113}
114 114
115int lsattr_main(int argc, char **argv); 115int lsattr_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
116int lsattr_main(int argc, char **argv) 116int lsattr_main(int argc, char **argv)
117{ 117{
118 int i; 118 int i;
diff --git a/e2fsprogs/old_e2fsprogs/tune2fs.c b/e2fsprogs/old_e2fsprogs/tune2fs.c
index 920a50c6a..c5c84d68e 100644
--- a/e2fsprogs/old_e2fsprogs/tune2fs.c
+++ b/e2fsprogs/old_e2fsprogs/tune2fs.c
@@ -577,7 +577,7 @@ static void tune2fs_clean_up(void)
577 if (ENABLE_FEATURE_CLEAN_UP && journal_device) free(journal_device); 577 if (ENABLE_FEATURE_CLEAN_UP && journal_device) free(journal_device);
578} 578}
579 579
580int tune2fs_main(int argc, char **argv); 580int tune2fs_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
581int tune2fs_main(int argc, char **argv) 581int tune2fs_main(int argc, char **argv)
582{ 582{
583 errcode_t retval; 583 errcode_t retval;
diff --git a/editors/awk.c b/editors/awk.c
index a820c7a17..da3401b37 100644
--- a/editors/awk.c
+++ b/editors/awk.c
@@ -2752,7 +2752,7 @@ static rstream *next_input_file(void)
2752#undef files_happen 2752#undef files_happen
2753} 2753}
2754 2754
2755int awk_main(int argc, char **argv); 2755int awk_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
2756int awk_main(int argc, char **argv) 2756int awk_main(int argc, char **argv)
2757{ 2757{
2758 unsigned opt; 2758 unsigned opt;
diff --git a/editors/cmp.c b/editors/cmp.c
index 34a0de50a..6dfe0401b 100644
--- a/editors/cmp.c
+++ b/editors/cmp.c
@@ -42,7 +42,7 @@ static const char opt_chars[] ALIGN1 = "sl";
42#define CMP_OPT_s (1<<0) 42#define CMP_OPT_s (1<<0)
43#define CMP_OPT_l (1<<1) 43#define CMP_OPT_l (1<<1)
44 44
45int cmp_main(int argc, char **argv); 45int cmp_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
46int cmp_main(int argc, char **argv) 46int cmp_main(int argc, char **argv)
47{ 47{
48 FILE *fp1, *fp2, *outfile = stdout; 48 FILE *fp1, *fp2, *outfile = stdout;
diff --git a/editors/diff.c b/editors/diff.c
index 3a694e087..c158c8763 100644
--- a/editors/diff.c
+++ b/editors/diff.c
@@ -1207,7 +1207,7 @@ static void diffdir(char *p1, char *p2)
1207#endif 1207#endif
1208 1208
1209 1209
1210int diff_main(int argc, char **argv); 1210int diff_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
1211int diff_main(int argc, char **argv) 1211int diff_main(int argc, char **argv)
1212{ 1212{
1213 bool gotstdin = 0; 1213 bool gotstdin = 0;
diff --git a/editors/ed.c b/editors/ed.c
index 31185d9b6..cceff0c40 100644
--- a/editors/ed.c
+++ b/editors/ed.c
@@ -88,7 +88,7 @@ static char *skip_blank(const char *cp)
88} 88}
89 89
90 90
91int ed_main(int argc, char **argv); 91int ed_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
92int ed_main(int argc, char **argv) 92int ed_main(int argc, char **argv)
93{ 93{
94 INIT_G(); 94 INIT_G();
diff --git a/editors/patch.c b/editors/patch.c
index 65791dfe6..07fa5cfaf 100644
--- a/editors/patch.c
+++ b/editors/patch.c
@@ -77,7 +77,7 @@ static int file_doesnt_exist(const char *filename)
77 return stat(filename, &statbuf); 77 return stat(filename, &statbuf);
78} 78}
79 79
80int patch_main(int argc, char **argv); 80int patch_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
81int patch_main(int argc, char **argv) 81int patch_main(int argc, char **argv)
82{ 82{
83 int patch_level = -1; 83 int patch_level = -1;
diff --git a/editors/sed.c b/editors/sed.c
index dcdf382dc..f75fceea5 100644
--- a/editors/sed.c
+++ b/editors/sed.c
@@ -1223,7 +1223,7 @@ static void add_cmd_block(char *cmdstr)
1223 free(sv); 1223 free(sv);
1224} 1224}
1225 1225
1226int sed_main(int argc, char **argv); 1226int sed_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
1227int sed_main(int argc, char **argv) 1227int sed_main(int argc, char **argv)
1228{ 1228{
1229 enum { 1229 enum {
diff --git a/editors/vi.c b/editors/vi.c
index 25c8234b4..249bf29bf 100644
--- a/editors/vi.c
+++ b/editors/vi.c
@@ -311,7 +311,7 @@ static void write1(const char *out)
311 fputs(out, stdout); 311 fputs(out, stdout);
312} 312}
313 313
314int vi_main(int argc, char **argv); 314int vi_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
315int vi_main(int argc, char **argv) 315int vi_main(int argc, char **argv)
316{ 316{
317 int c; 317 int c;
diff --git a/findutils/find.c b/findutils/find.c
index b61881497..9efe2db40 100644
--- a/findutils/find.c
+++ b/findutils/find.c
@@ -794,7 +794,7 @@ static action*** parse_params(char **argv)
794} 794}
795 795
796 796
797int find_main(int argc, char **argv); 797int find_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
798int find_main(int argc, char **argv) 798int find_main(int argc, char **argv)
799{ 799{
800 static const char options[] ALIGN1 = 800 static const char options[] ALIGN1 =
diff --git a/findutils/grep.c b/findutils/grep.c
index 2d886a025..fc40be244 100644
--- a/findutils/grep.c
+++ b/findutils/grep.c
@@ -393,7 +393,7 @@ static int grep_dir(const char *dir)
393 return matched; 393 return matched;
394} 394}
395 395
396int grep_main(int argc, char **argv); 396int grep_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
397int grep_main(int argc, char **argv) 397int grep_main(int argc, char **argv)
398{ 398{
399 FILE *file; 399 FILE *file;
diff --git a/findutils/xargs.c b/findutils/xargs.c
index f7c7832d5..ee16ea675 100644
--- a/findutils/xargs.c
+++ b/findutils/xargs.c
@@ -373,7 +373,7 @@ enum {
373 USE_FEATURE_XARGS_SUPPORT_TERMOPT( "x") \ 373 USE_FEATURE_XARGS_SUPPORT_TERMOPT( "x") \
374 USE_FEATURE_XARGS_SUPPORT_ZERO_TERM( "0") 374 USE_FEATURE_XARGS_SUPPORT_ZERO_TERM( "0")
375 375
376int xargs_main(int argc, char **argv); 376int xargs_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
377int xargs_main(int argc, char **argv) 377int xargs_main(int argc, char **argv)
378{ 378{
379 char **args; 379 char **args;
diff --git a/include/applets.h b/include/applets.h
index ac3f65f6d..ceab00334 100644
--- a/include/applets.h
+++ b/include/applets.h
@@ -24,11 +24,11 @@ s - suid type:
24*/ 24*/
25 25
26#if defined(PROTOTYPES) 26#if defined(PROTOTYPES)
27# define APPLET(name,l,s) int name##_main(int argc, char **argv); 27# define APPLET(name,l,s) int name##_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
28# define APPLET_NOUSAGE(name,main,l,s) int main##_main(int argc, char **argv); 28# define APPLET_NOUSAGE(name,main,l,s) int main##_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
29# define APPLET_ODDNAME(name,main,l,s,name2) int main##_main(int argc, char **argv); 29# define APPLET_ODDNAME(name,main,l,s,name2) int main##_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
30# define APPLET_NOEXEC(name,main,l,s,name2) int main##_main(int argc, char **argv); 30# define APPLET_NOEXEC(name,main,l,s,name2) int main##_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
31# define APPLET_NOFORK(name,main,l,s,name2) int main##_main(int argc, char **argv); 31# define APPLET_NOFORK(name,main,l,s,name2) int main##_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
32 32
33#elif defined(NAME_MAIN_CNAME) 33#elif defined(NAME_MAIN_CNAME)
34# define APPLET(name,l,s) name name##_main name 34# define APPLET(name,l,s) name name##_main name
diff --git a/include/busybox.h b/include/busybox.h
index 1c23b9bb0..5c01eca8d 100644
--- a/include/busybox.h
+++ b/include/busybox.h
@@ -48,12 +48,22 @@ struct bb_applet {
48#endif 48#endif
49}; 49};
50 50
51
51/* Defined in appletlib.c */ 52/* Defined in appletlib.c */
52extern const struct bb_applet applets[]; 53extern const struct bb_applet applets[];
53extern const unsigned short NUM_APPLETS; 54extern const unsigned short NUM_APPLETS;
54void bbox_prepare_main(char **argv); 55
56/* Length of these names has effect on size of libbusybox
57 * and "individual" binaries. Keep them short.
58 */
59void lbb_prepare(char **argv) MAIN_EXTERNALLY_VISIBLE;
55#if ENABLE_BUILD_LIBBUSYBOX 60#if ENABLE_BUILD_LIBBUSYBOX
56int libbusybox_main(int argc, char **argv); 61#if ENABLE_FEATURE_SHARED_BUSYBOX
62int lbb_main(int argc, char **argv) EXTERNALLY_VISIBLE;
63#else
64int lbb_main(int argc, char **argv);
57#endif 65#endif
66#endif
67
58 68
59#endif /* _BB_INTERNAL_H_ */ 69#endif /* _BB_INTERNAL_H_ */
diff --git a/include/libbb.h b/include/libbb.h
index 9d8b5f3df..be548a306 100644
--- a/include/libbb.h
+++ b/include/libbb.h
@@ -673,7 +673,7 @@ extern int die_sleep;
673extern int xfunc_error_retval; 673extern int xfunc_error_retval;
674extern jmp_buf die_jmp; 674extern jmp_buf die_jmp;
675extern void xfunc_die(void) ATTRIBUTE_NORETURN; 675extern void xfunc_die(void) ATTRIBUTE_NORETURN;
676extern void bb_show_usage(void) ATTRIBUTE_NORETURN ATTRIBUTE_EXTERNALLY_VISIBLE; 676extern void bb_show_usage(void) ATTRIBUTE_NORETURN;
677extern void bb_error_msg(const char *s, ...) __attribute__ ((format (printf, 1, 2))); 677extern void bb_error_msg(const char *s, ...) __attribute__ ((format (printf, 1, 2)));
678extern void bb_error_msg_and_die(const char *s, ...) __attribute__ ((noreturn, format (printf, 1, 2))); 678extern void bb_error_msg_and_die(const char *s, ...) __attribute__ ((noreturn, format (printf, 1, 2)));
679extern void bb_perror_msg(const char *s, ...) __attribute__ ((format (printf, 1, 2))); 679extern void bb_perror_msg(const char *s, ...) __attribute__ ((format (printf, 1, 2)));
@@ -687,18 +687,27 @@ extern void bb_perror_nomsg(void);
687extern void bb_info_msg(const char *s, ...) __attribute__ ((format (printf, 1, 2))); 687extern void bb_info_msg(const char *s, ...) __attribute__ ((format (printf, 1, 2)));
688extern void bb_verror_msg(const char *s, va_list p, const char *strerr); 688extern void bb_verror_msg(const char *s, va_list p, const char *strerr);
689 689
690/* We need to export XXX_main from libbusybox
691 * only if we build "individual" binaries
692 */
693#if ENABLE_FEATURE_INDIVIDUAL
694#define MAIN_EXTERNALLY_VISIBLE EXTERNALLY_VISIBLE
695#else
696#define MAIN_EXTERNALLY_VISIBLE
697#endif
698
690 699
691/* applets which are useful from another applets */ 700/* applets which are useful from another applets */
692int bb_cat(char** argv); 701int bb_cat(char** argv);
693int bb_echo(char** argv); 702int bb_echo(char** argv);
694int test_main(int argc, char** argv); 703int test_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
695int kill_main(int argc, char **argv); 704int kill_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
696#if ENABLE_ROUTE 705#if ENABLE_ROUTE
697void bb_displayroutes(int noresolve, int netstatfmt); 706void bb_displayroutes(int noresolve, int netstatfmt);
698#endif 707#endif
699int chown_main(int argc, char **argv); 708int chown_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
700#if ENABLE_GUNZIP 709#if ENABLE_GUNZIP
701int gunzip_main(int argc, char **argv); 710int gunzip_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
702#endif 711#endif
703int bbunpack(char **argv, 712int bbunpack(char **argv,
704 char* (*make_new_name)(char *filename), 713 char* (*make_new_name)(char *filename),
diff --git a/include/platform.h b/include/platform.h
index 39809450e..53d72829f 100644
--- a/include/platform.h
+++ b/include/platform.h
@@ -71,9 +71,10 @@
71/* -fwhole-program makes all symbols local. The attribute externally_visible 71/* -fwhole-program makes all symbols local. The attribute externally_visible
72 forces a symbol global. */ 72 forces a symbol global. */
73# if __GNUC_PREREQ (4,1) 73# if __GNUC_PREREQ (4,1)
74# define ATTRIBUTE_EXTERNALLY_VISIBLE __attribute__ ((__externally_visible__)) 74# define EXTERNALLY_VISIBLE __attribute__(( visibility("default") ));
75//__attribute__ ((__externally_visible__))
75# else 76# else
76# define ATTRIBUTE_EXTERNALLY_VISIBLE 77# define EXTERNALLY_VISIBLE
77# endif /* GNUC >= 4.1 */ 78# endif /* GNUC >= 4.1 */
78 79
79/* We use __extension__ in some places to suppress -pedantic warnings 80/* We use __extension__ in some places to suppress -pedantic warnings
diff --git a/init/halt.c b/init/halt.c
index e21ad57cc..d9f8b1afc 100644
--- a/init/halt.c
+++ b/init/halt.c
@@ -10,7 +10,7 @@
10#include "libbb.h" 10#include "libbb.h"
11#include <sys/reboot.h> 11#include <sys/reboot.h>
12 12
13int halt_main(int argc, char **argv); 13int halt_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
14int halt_main(int argc, char **argv) 14int halt_main(int argc, char **argv)
15{ 15{
16 static const int magic[] = { 16 static const int magic[] = {
diff --git a/init/init.c b/init/init.c
index 5e8401163..409e8c41f 100644
--- a/init/init.c
+++ b/init/init.c
@@ -882,7 +882,7 @@ static void reload_signal(int sig ATTRIBUTE_UNUSED)
882} 882}
883#endif /* FEATURE_USE_INITTAB */ 883#endif /* FEATURE_USE_INITTAB */
884 884
885int init_main(int argc, char **argv); 885int init_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
886int init_main(int argc, char **argv) 886int init_main(int argc, char **argv)
887{ 887{
888 struct init_action *a; 888 struct init_action *a;
diff --git a/init/mesg.c b/init/mesg.c
index 1a576cb37..cfb517f60 100644
--- a/init/mesg.c
+++ b/init/mesg.c
@@ -15,7 +15,7 @@
15#define S_IWGRP_OR_S_IWOTH (S_IWGRP | S_IWOTH) 15#define S_IWGRP_OR_S_IWOTH (S_IWGRP | S_IWOTH)
16#endif 16#endif
17 17
18int mesg_main(int argc, char **argv); 18int mesg_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
19int mesg_main(int argc, char **argv) 19int mesg_main(int argc, char **argv)
20{ 20{
21 struct stat sb; 21 struct stat sb;
diff --git a/ipsvd/tcpudp.c b/ipsvd/tcpudp.c
index 537a5240f..98b075ff1 100644
--- a/ipsvd/tcpudp.c
+++ b/ipsvd/tcpudp.c
@@ -133,7 +133,7 @@ static void sig_child_handler(int sig)
133 connection_status(); 133 connection_status();
134} 134}
135 135
136int tcpudpsvd_main(int argc, char **argv); 136int tcpudpsvd_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
137int tcpudpsvd_main(int argc, char **argv) 137int tcpudpsvd_main(int argc, char **argv)
138{ 138{
139 char *str_c, *str_C, *str_b, *str_t; 139 char *str_c, *str_C, *str_b, *str_t;
diff --git a/libbb/appletlib.c b/libbb/appletlib.c
index 7808df501..953f1e7e5 100644
--- a/libbb/appletlib.c
+++ b/libbb/appletlib.c
@@ -127,7 +127,7 @@ const struct bb_applet *find_applet_by_name(const char *name)
127int *const bb_errno __attribute__ ((section (".data"))); 127int *const bb_errno __attribute__ ((section (".data")));
128#endif 128#endif
129 129
130void bbox_prepare_main(char **argv) 130void lbb_prepare(char **argv)
131{ 131{
132#ifdef __GLIBC__ 132#ifdef __GLIBC__
133 (*(int **)&bb_errno) = __errno_location(); 133 (*(int **)&bb_errno) = __errno_location();
@@ -661,12 +661,12 @@ void run_applet_and_exit(const char *name, char **argv)
661 661
662 662
663#if ENABLE_BUILD_LIBBUSYBOX 663#if ENABLE_BUILD_LIBBUSYBOX
664int libbusybox_main(int argc, char **argv) 664int lbb_main(int argc, char **argv)
665#else 665#else
666int main(int argc, char **argv) 666int main(int argc, char **argv)
667#endif 667#endif
668{ 668{
669 bbox_prepare_main(argv); 669 lbb_prepare(argv);
670 670
671#if !BB_MMU 671#if !BB_MMU
672 /* NOMMU re-exec trick sets high-order bit in first byte of name */ 672 /* NOMMU re-exec trick sets high-order bit in first byte of name */
diff --git a/loginutils/addgroup.c b/loginutils/addgroup.c
index b213074a6..9b2c6790f 100644
--- a/loginutils/addgroup.c
+++ b/loginutils/addgroup.c
@@ -122,7 +122,7 @@ static void add_user_to_group(char **args,
122 * If called with two non-option arguments, addgroup 122 * If called with two non-option arguments, addgroup
123 * will add an existing user to an existing group. 123 * will add an existing user to an existing group.
124 */ 124 */
125int addgroup_main(int argc, char **argv); 125int addgroup_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
126int addgroup_main(int argc, char **argv) 126int addgroup_main(int argc, char **argv)
127{ 127{
128 char *group; 128 char *group;
diff --git a/loginutils/adduser.c b/loginutils/adduser.c
index 149ea9c4b..5c624285f 100644
--- a/loginutils/adduser.c
+++ b/loginutils/adduser.c
@@ -165,7 +165,7 @@ static int adduser(struct passwd *p)
165 * 165 *
166 * can be customized via command-line parameters. 166 * can be customized via command-line parameters.
167 */ 167 */
168int adduser_main(int argc, char **argv); 168int adduser_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
169int adduser_main(int argc, char **argv) 169int adduser_main(int argc, char **argv)
170{ 170{
171 struct passwd pw; 171 struct passwd pw;
diff --git a/loginutils/chpasswd.c b/loginutils/chpasswd.c
index 61f9b896a..7d47899fe 100644
--- a/loginutils/chpasswd.c
+++ b/loginutils/chpasswd.c
@@ -20,7 +20,7 @@ static const char chpasswd_longopts[] ALIGN1 =
20#define OPT_ENC 1 20#define OPT_ENC 1
21#define OPT_MD5 2 21#define OPT_MD5 2
22 22
23int chpasswd_main(int argc, char **argv); 23int chpasswd_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
24int chpasswd_main(int argc, char **argv) 24int chpasswd_main(int argc, char **argv)
25{ 25{
26 char *name, *pass; 26 char *name, *pass;
diff --git a/loginutils/cryptpw.c b/loginutils/cryptpw.c
index 0847857de..06817a681 100644
--- a/loginutils/cryptpw.c
+++ b/loginutils/cryptpw.c
@@ -7,7 +7,7 @@
7 7
8#include "libbb.h" 8#include "libbb.h"
9 9
10int cryptpw_main(int argc, char **argv); 10int cryptpw_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
11int cryptpw_main(int argc, char **argv) 11int cryptpw_main(int argc, char **argv)
12{ 12{
13 char salt[sizeof("$N$XXXXXXXX")]; 13 char salt[sizeof("$N$XXXXXXXX")];
diff --git a/loginutils/deluser.c b/loginutils/deluser.c
index 0e4f02ddc..c67ad7200 100644
--- a/loginutils/deluser.c
+++ b/loginutils/deluser.c
@@ -93,7 +93,7 @@ static void del_line_matching(char **args,
93 free(new); 93 free(new);
94} 94}
95 95
96int deluser_main(int argc, char **argv); 96int deluser_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
97int deluser_main(int argc, char **argv) 97int deluser_main(int argc, char **argv)
98{ 98{
99 if (argc == 2 99 if (argc == 2
diff --git a/loginutils/getty.c b/loginutils/getty.c
index db8d7cef5..bc735d0c4 100644
--- a/loginutils/getty.c
+++ b/loginutils/getty.c
@@ -699,7 +699,7 @@ static void update_utmp(const char *line)
699#endif /* SYSV_STYLE */ 699#endif /* SYSV_STYLE */
700 700
701 701
702int getty_main(int argc, char **argv); 702int getty_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
703int getty_main(int argc, char **argv) 703int getty_main(int argc, char **argv)
704{ 704{
705 int nullfd; 705 int nullfd;
diff --git a/loginutils/login.c b/loginutils/login.c
index dfdc58b30..bddc0f533 100644
--- a/loginutils/login.c
+++ b/loginutils/login.c
@@ -219,7 +219,7 @@ static void alarm_handler(int sig ATTRIBUTE_UNUSED)
219 exit(EXIT_SUCCESS); 219 exit(EXIT_SUCCESS);
220} 220}
221 221
222int login_main(int argc, char **argv); 222int login_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
223int login_main(int argc, char **argv) 223int login_main(int argc, char **argv)
224{ 224{
225 enum { 225 enum {
diff --git a/loginutils/passwd.c b/loginutils/passwd.c
index ce333b49e..99afde223 100644
--- a/loginutils/passwd.c
+++ b/loginutils/passwd.c
@@ -70,7 +70,7 @@ static char* new_password(const struct passwd *pw, uid_t myuid, int algo)
70 return ret; 70 return ret;
71} 71}
72 72
73int passwd_main(int argc, char **argv); 73int passwd_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
74int passwd_main(int argc, char **argv) 74int passwd_main(int argc, char **argv)
75{ 75{
76 enum { 76 enum {
diff --git a/loginutils/su.c b/loginutils/su.c
index 123907e28..8c55170ca 100644
--- a/loginutils/su.c
+++ b/loginutils/su.c
@@ -11,7 +11,7 @@
11#define SU_OPT_mp (3) 11#define SU_OPT_mp (3)
12#define SU_OPT_l (4) 12#define SU_OPT_l (4)
13 13
14int su_main(int argc, char **argv); 14int su_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
15int su_main(int argc, char **argv) 15int su_main(int argc, char **argv)
16{ 16{
17 unsigned flags; 17 unsigned flags;
diff --git a/loginutils/sulogin.c b/loginutils/sulogin.c
index 5c73bda93..7f100a162 100644
--- a/loginutils/sulogin.c
+++ b/loginutils/sulogin.c
@@ -34,7 +34,7 @@ static void catchalarm(int ATTRIBUTE_UNUSED junk)
34} 34}
35 35
36 36
37int sulogin_main(int argc, char **argv); 37int sulogin_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
38int sulogin_main(int argc, char **argv) 38int sulogin_main(int argc, char **argv)
39{ 39{
40 char *cp; 40 char *cp;
diff --git a/loginutils/vlock.c b/loginutils/vlock.c
index 8e3a1ea4b..6e928e239 100644
--- a/loginutils/vlock.c
+++ b/loginutils/vlock.c
@@ -33,7 +33,7 @@ static void acquire_vt(int signo)
33 ioctl(vfd, VT_RELDISP, VT_ACKACQ); 33 ioctl(vfd, VT_RELDISP, VT_ACKACQ);
34} 34}
35 35
36int vlock_main(int argc, char **argv); 36int vlock_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
37int vlock_main(int argc, char **argv) 37int vlock_main(int argc, char **argv)
38{ 38{
39 sigset_t sig; 39 sigset_t sig;
diff --git a/miscutils/adjtimex.c b/miscutils/adjtimex.c
index b11807d75..67dd0a93b 100644
--- a/miscutils/adjtimex.c
+++ b/miscutils/adjtimex.c
@@ -43,7 +43,7 @@ static const char *const ret_code_descript[] = {
43 "clock not synchronized" 43 "clock not synchronized"
44}; 44};
45 45
46int adjtimex_main(int argc, char **argv); 46int adjtimex_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
47int adjtimex_main(int argc, char **argv) 47int adjtimex_main(int argc, char **argv)
48{ 48{
49 enum { 49 enum {
diff --git a/miscutils/bbconfig.c b/miscutils/bbconfig.c
index 803d1d94b..ee566788b 100644
--- a/miscutils/bbconfig.c
+++ b/miscutils/bbconfig.c
@@ -4,7 +4,7 @@
4#include "libbb.h" 4#include "libbb.h"
5#include "bbconfigopts.h" 5#include "bbconfigopts.h"
6 6
7int bbconfig_main(int argc, char **argv); 7int bbconfig_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
8int bbconfig_main(int argc, char **argv) 8int bbconfig_main(int argc, char **argv)
9{ 9{
10 printf(bbconfig_config); 10 printf(bbconfig_config);
diff --git a/miscutils/chrt.c b/miscutils/chrt.c
index 1f5465c40..418e7ae79 100644
--- a/miscutils/chrt.c
+++ b/miscutils/chrt.c
@@ -41,8 +41,8 @@ static void show_min_max(int pol)
41#define OPT_f (1<<3) 41#define OPT_f (1<<3)
42#define OPT_o (1<<4) 42#define OPT_o (1<<4)
43 43
44int chrt_main(int argc, char** argv); 44int chrt_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
45int chrt_main(int argc, char** argv) 45int chrt_main(int argc, char **argv)
46{ 46{
47 pid_t pid = 0; 47 pid_t pid = 0;
48 unsigned opt; 48 unsigned opt;
diff --git a/miscutils/crond.c b/miscutils/crond.c
index fa7b3da08..8ee7e5837 100644
--- a/miscutils/crond.c
+++ b/miscutils/crond.c
@@ -128,7 +128,7 @@ static void crondlog(const char *ctl, ...)
128 } 128 }
129} 129}
130 130
131int crond_main(int ac, char **av); 131int crond_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
132int crond_main(int ac, char **av) 132int crond_main(int ac, char **av)
133{ 133{
134 unsigned opt; 134 unsigned opt;
diff --git a/miscutils/crontab.c b/miscutils/crontab.c
index 1b827d791..6d245da90 100644
--- a/miscutils/crontab.c
+++ b/miscutils/crontab.c
@@ -31,7 +31,7 @@ static void EditFile(const char *user, const char *file);
31static int GetReplaceStream(const char *user, const char *file); 31static int GetReplaceStream(const char *user, const char *file);
32static int ChangeUser(const char *user, short dochdir); 32static int ChangeUser(const char *user, short dochdir);
33 33
34int crontab_main(int ac, char **av); 34int crontab_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
35int crontab_main(int ac, char **av) 35int crontab_main(int ac, char **av)
36{ 36{
37 enum { NONE, EDIT, LIST, REPLACE, DELETE } option = NONE; 37 enum { NONE, EDIT, LIST, REPLACE, DELETE } option = NONE;
diff --git a/miscutils/dc.c b/miscutils/dc.c
index ced5149df..ffc3f8df4 100644
--- a/miscutils/dc.c
+++ b/miscutils/dc.c
@@ -197,7 +197,7 @@ static int number_of_tokens(char *buffer)
197 return i; 197 return i;
198} 198}
199 199
200int dc_main(int argc, char **argv); 200int dc_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
201int dc_main(int argc, char **argv) 201int dc_main(int argc, char **argv)
202{ 202{
203 /* take stuff from stdin if no args are given */ 203 /* take stuff from stdin if no args are given */
diff --git a/miscutils/devfsd.c b/miscutils/devfsd.c
index 734d4a7d9..cd94869ae 100644
--- a/miscutils/devfsd.c
+++ b/miscutils/devfsd.c
@@ -336,7 +336,7 @@ static unsigned int scan_dev_name(const char *d, unsigned int n, const char *ptr
336 336
337/* Public functions follow */ 337/* Public functions follow */
338 338
339int devfsd_main(int argc, char **argv); 339int devfsd_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
340int devfsd_main(int argc, char **argv) 340int devfsd_main(int argc, char **argv)
341{ 341{
342 int print_version = FALSE; 342 int print_version = FALSE;
diff --git a/miscutils/eject.c b/miscutils/eject.c
index e66d74e70..99f01aba9 100644
--- a/miscutils/eject.c
+++ b/miscutils/eject.c
@@ -25,7 +25,7 @@
25#define FLAG_CLOSE 1 25#define FLAG_CLOSE 1
26#define FLAG_SMART 2 26#define FLAG_SMART 2
27 27
28int eject_main(int argc, char **argv); 28int eject_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
29int eject_main(int argc, char **argv) 29int eject_main(int argc, char **argv)
30{ 30{
31 unsigned long flags; 31 unsigned long flags;
diff --git a/miscutils/hdparm.c b/miscutils/hdparm.c
index 365e24cba..869a5b246 100644
--- a/miscutils/hdparm.c
+++ b/miscutils/hdparm.c
@@ -2005,7 +2005,7 @@ static const char hdparm_options[] ALIGN1 =
2005/*-------------------------------------*/ 2005/*-------------------------------------*/
2006 2006
2007/* our main() routine: */ 2007/* our main() routine: */
2008int hdparm_main(int argc, char **argv); 2008int hdparm_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
2009int hdparm_main(int argc, char **argv) 2009int hdparm_main(int argc, char **argv)
2010{ 2010{
2011 int c; 2011 int c;
diff --git a/miscutils/last.c b/miscutils/last.c
index f38c4b878..fc5916ec2 100644
--- a/miscutils/last.c
+++ b/miscutils/last.c
@@ -26,7 +26,7 @@
26#error struct utmp member char[] size(s) have changed! 26#error struct utmp member char[] size(s) have changed!
27#endif 27#endif
28 28
29int last_main(int argc, char **argv); 29int last_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
30int last_main(int argc, char **argv) 30int last_main(int argc, char **argv)
31{ 31{
32 struct utmp ut; 32 struct utmp ut;
diff --git a/miscutils/less.c b/miscutils/less.c
index b1e5ce93f..5ffebcd6d 100644
--- a/miscutils/less.c
+++ b/miscutils/less.c
@@ -1311,7 +1311,7 @@ static void sig_catcher(int sig ATTRIBUTE_UNUSED)
1311 exit(1); 1311 exit(1);
1312} 1312}
1313 1313
1314int less_main(int argc, char **argv); 1314int less_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
1315int less_main(int argc, char **argv) 1315int less_main(int argc, char **argv)
1316{ 1316{
1317 int keypress; 1317 int keypress;
diff --git a/miscutils/makedevs.c b/miscutils/makedevs.c
index d36c6956a..1f88f3428 100644
--- a/miscutils/makedevs.c
+++ b/miscutils/makedevs.c
@@ -10,7 +10,7 @@
10#include "libbb.h" 10#include "libbb.h"
11 11
12#if ENABLE_FEATURE_MAKEDEVS_LEAF 12#if ENABLE_FEATURE_MAKEDEVS_LEAF
13int makedevs_main(int argc, char **argv); 13int makedevs_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
14int makedevs_main(int argc, char **argv) 14int makedevs_main(int argc, char **argv)
15{ 15{
16 mode_t mode; 16 mode_t mode;
@@ -69,7 +69,7 @@ int makedevs_main(int argc, char **argv)
69 69
70/* Licensed under the GPL v2 or later, see the file LICENSE in this tarball. */ 70/* Licensed under the GPL v2 or later, see the file LICENSE in this tarball. */
71 71
72int makedevs_main(int argc, char **argv); 72int makedevs_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
73int makedevs_main(int argc, char **argv) 73int makedevs_main(int argc, char **argv)
74{ 74{
75 FILE *table = stdin; 75 FILE *table = stdin;
diff --git a/miscutils/microcom.c b/miscutils/microcom.c
index e097dc437..1235f0634 100644
--- a/miscutils/microcom.c
+++ b/miscutils/microcom.c
@@ -9,7 +9,7 @@
9 */ 9 */
10#include "libbb.h" 10#include "libbb.h"
11 11
12int microcom_main(int argc, char **argv); 12int microcom_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
13int microcom_main(int argc, char **argv) 13int microcom_main(int argc, char **argv)
14{ 14{
15 struct pollfd pfd[2]; 15 struct pollfd pfd[2];
diff --git a/miscutils/mountpoint.c b/miscutils/mountpoint.c
index 376bd9531..5647e4c5b 100644
--- a/miscutils/mountpoint.c
+++ b/miscutils/mountpoint.c
@@ -11,7 +11,7 @@
11 11
12#include "libbb.h" 12#include "libbb.h"
13 13
14int mountpoint_main(int argc, char **argv); 14int mountpoint_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
15int mountpoint_main(int argc, char **argv) 15int mountpoint_main(int argc, char **argv)
16{ 16{
17 struct stat st; 17 struct stat st;
diff --git a/miscutils/mt.c b/miscutils/mt.c
index b9bc2a11b..be1f21a12 100644
--- a/miscutils/mt.c
+++ b/miscutils/mt.c
@@ -50,7 +50,7 @@ static const struct mt_opcodes opcodes[] = {
50 {0, 0} 50 {0, 0}
51}; 51};
52 52
53int mt_main(int argc, char **argv); 53int mt_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
54int mt_main(int argc, char **argv) 54int mt_main(int argc, char **argv)
55{ 55{
56 const char *file = "/dev/tape"; 56 const char *file = "/dev/tape";
diff --git a/miscutils/raidautorun.c b/miscutils/raidautorun.c
index edcb6d66d..2766245db 100644
--- a/miscutils/raidautorun.c
+++ b/miscutils/raidautorun.c
@@ -13,7 +13,7 @@
13#include <linux/major.h> 13#include <linux/major.h>
14#include <linux/raid/md_u.h> 14#include <linux/raid/md_u.h>
15 15
16int raidautorun_main(int argc, char **argv); 16int raidautorun_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
17int raidautorun_main(int argc, char **argv) 17int raidautorun_main(int argc, char **argv)
18{ 18{
19 if (argc != 2) 19 if (argc != 2)
diff --git a/miscutils/readahead.c b/miscutils/readahead.c
index 103ce8e5d..647eb3121 100644
--- a/miscutils/readahead.c
+++ b/miscutils/readahead.c
@@ -12,7 +12,7 @@
12 12
13#include "libbb.h" 13#include "libbb.h"
14 14
15int readahead_main(int argc, char **argv); 15int readahead_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
16int readahead_main(int argc, char **argv) 16int readahead_main(int argc, char **argv)
17{ 17{
18 FILE *f; 18 FILE *f;
diff --git a/miscutils/runlevel.c b/miscutils/runlevel.c
index f51a647be..04064ee73 100644
--- a/miscutils/runlevel.c
+++ b/miscutils/runlevel.c
@@ -15,7 +15,7 @@
15#include <utmp.h> 15#include <utmp.h>
16#include "libbb.h" 16#include "libbb.h"
17 17
18int runlevel_main(int argc, char **argv); 18int runlevel_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
19int runlevel_main(int argc, char **argv) 19int runlevel_main(int argc, char **argv)
20{ 20{
21 struct utmp *ut; 21 struct utmp *ut;
diff --git a/miscutils/rx.c b/miscutils/rx.c
index 675aad2a0..898703c59 100644
--- a/miscutils/rx.c
+++ b/miscutils/rx.c
@@ -249,7 +249,7 @@ static void sigalrm_handler(int ATTRIBUTE_UNUSED signum)
249{ 249{
250} 250}
251 251
252int rx_main(int argc, char **argv); 252int rx_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
253int rx_main(int argc, char **argv) 253int rx_main(int argc, char **argv)
254{ 254{
255 char *fn; 255 char *fn;
diff --git a/miscutils/setsid.c b/miscutils/setsid.c
index 8d738edfb..110bb6bb6 100644
--- a/miscutils/setsid.c
+++ b/miscutils/setsid.c
@@ -16,7 +16,7 @@
16 16
17#include "libbb.h" 17#include "libbb.h"
18 18
19int setsid_main(int argc, char **argv); 19int setsid_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
20int setsid_main(int argc, char **argv) 20int setsid_main(int argc, char **argv)
21{ 21{
22 if (argc < 2) 22 if (argc < 2)
diff --git a/miscutils/strings.c b/miscutils/strings.c
index b7f5a0b57..d75beccea 100644
--- a/miscutils/strings.c
+++ b/miscutils/strings.c
@@ -16,7 +16,7 @@
16#define PRINT_OFFSET 4 16#define PRINT_OFFSET 4
17#define SIZE 8 17#define SIZE 8
18 18
19int strings_main(int argc, char **argv); 19int strings_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
20int strings_main(int argc, char **argv) 20int strings_main(int argc, char **argv)
21{ 21{
22 int n, c, status = EXIT_SUCCESS; 22 int n, c, status = EXIT_SUCCESS;
diff --git a/miscutils/taskset.c b/miscutils/taskset.c
index 3c117da92..e64fd655b 100644
--- a/miscutils/taskset.c
+++ b/miscutils/taskset.c
@@ -41,8 +41,8 @@ static char *__from_cpuset(cpu_set_t *mask)
41 41
42#define OPT_p 1 42#define OPT_p 1
43 43
44int taskset_main(int argc, char** argv); 44int taskset_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
45int taskset_main(int argc, char** argv) 45int taskset_main(int argc, char **argv)
46{ 46{
47 cpu_set_t mask, new_mask; 47 cpu_set_t mask, new_mask;
48 pid_t pid = 0; 48 pid_t pid = 0;
diff --git a/miscutils/time.c b/miscutils/time.c
index 8f79a51ec..d21944e01 100644
--- a/miscutils/time.c
+++ b/miscutils/time.c
@@ -402,7 +402,7 @@ static void run_command(char *const *cmd, resource_t * resp)
402 signal(SIGQUIT, quit_signal); 402 signal(SIGQUIT, quit_signal);
403} 403}
404 404
405int time_main(int argc, char **argv); 405int time_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
406int time_main(int argc, char **argv) 406int time_main(int argc, char **argv)
407{ 407{
408 resource_t res; 408 resource_t res;
diff --git a/miscutils/ttysize.c b/miscutils/ttysize.c
index 292cfb876..f51b328ea 100644
--- a/miscutils/ttysize.c
+++ b/miscutils/ttysize.c
@@ -11,7 +11,7 @@
11 */ 11 */
12#include "libbb.h" 12#include "libbb.h"
13 13
14int ttysize_main(int argc, char **argv); 14int ttysize_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
15int ttysize_main(int argc, char **argv) 15int ttysize_main(int argc, char **argv)
16{ 16{
17 unsigned w,h; 17 unsigned w,h;
diff --git a/miscutils/watchdog.c b/miscutils/watchdog.c
index 14bd44f48..e040c64fd 100644
--- a/miscutils/watchdog.c
+++ b/miscutils/watchdog.c
@@ -24,7 +24,7 @@ static void watchdog_shutdown(int ATTRIBUTE_UNUSED sig)
24 exit(0); 24 exit(0);
25} 25}
26 26
27int watchdog_main(int argc, char **argv); 27int watchdog_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
28int watchdog_main(int argc, char **argv) 28int watchdog_main(int argc, char **argv)
29{ 29{
30 unsigned opts; 30 unsigned opts;
diff --git a/modutils/insmod.c b/modutils/insmod.c
index d7e4bef68..6f3b7d0f4 100644
--- a/modutils/insmod.c
+++ b/modutils/insmod.c
@@ -72,7 +72,7 @@
72#endif 72#endif
73 73
74#if ENABLE_FEATURE_2_6_MODULES 74#if ENABLE_FEATURE_2_6_MODULES
75extern int insmod_ng_main(int argc, char **argv); 75extern int insmod_ng_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
76#endif 76#endif
77 77
78 78
@@ -3952,8 +3952,8 @@ static void print_load_map(struct obj_file *f)
3952void print_load_map(struct obj_file *f); 3952void print_load_map(struct obj_file *f);
3953#endif 3953#endif
3954 3954
3955int insmod_main( int argc, char **argv); 3955int insmod_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
3956int insmod_main( int argc, char **argv) 3956int insmod_main(int argc, char **argv)
3957{ 3957{
3958 char *opt_o, *arg1; 3958 char *opt_o, *arg1;
3959 int len; 3959 int len;
@@ -4261,7 +4261,7 @@ static const char *moderror(int err)
4261 } 4261 }
4262} 4262}
4263 4263
4264int insmod_ng_main(int argc, char **argv); 4264int insmod_ng_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
4265int insmod_ng_main(int argc, char **argv) 4265int insmod_ng_main(int argc, char **argv)
4266{ 4266{
4267 long ret; 4267 long ret;
diff --git a/modutils/lsmod.c b/modutils/lsmod.c
index 09b03d029..70146814c 100644
--- a/modutils/lsmod.c
+++ b/modutils/lsmod.c
@@ -74,7 +74,7 @@ enum {
74 NEW_MOD_INITIALIZING = 64 74 NEW_MOD_INITIALIZING = 64
75}; 75};
76 76
77int lsmod_main(int argc, char **argv); 77int lsmod_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
78int lsmod_main(int argc, char **argv) 78int lsmod_main(int argc, char **argv)
79{ 79{
80 struct module_info info; 80 struct module_info info;
@@ -140,7 +140,7 @@ int lsmod_main(int argc, char **argv)
140 140
141#else /* CONFIG_FEATURE_QUERY_MODULE_INTERFACE */ 141#else /* CONFIG_FEATURE_QUERY_MODULE_INTERFACE */
142 142
143int lsmod_main(int argc, char **argv); 143int lsmod_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
144int lsmod_main(int argc, char **argv) 144int lsmod_main(int argc, char **argv)
145{ 145{
146 FILE *file = xfopen("/proc/modules", "r"); 146 FILE *file = xfopen("/proc/modules", "r");
diff --git a/modutils/modprobe.c b/modutils/modprobe.c
index 36a3c3535..a67ddea9b 100644
--- a/modutils/modprobe.c
+++ b/modutils/modprobe.c
@@ -861,8 +861,8 @@ static int mod_remove(char *mod)
861 return rc; 861 return rc;
862} 862}
863 863
864int modprobe_main(int argc, char** argv); 864int modprobe_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
865int modprobe_main(int argc, char** argv) 865int modprobe_main(int argc, char **argv)
866{ 866{
867 int rc = EXIT_SUCCESS; 867 int rc = EXIT_SUCCESS;
868 char *unused; 868 char *unused;
diff --git a/modutils/rmmod.c b/modutils/rmmod.c
index ba3e88ca6..61cfbd147 100644
--- a/modutils/rmmod.c
+++ b/modutils/rmmod.c
@@ -38,7 +38,7 @@ void filename2modname(char *modname, const char *afterslash);
38int query_module(const char *name, int which, void *buf, 38int query_module(const char *name, int which, void *buf,
39 size_t bufsize, size_t *ret); 39 size_t bufsize, size_t *ret);
40 40
41int rmmod_main(int argc, char **argv); 41int rmmod_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
42int rmmod_main(int argc, char **argv) 42int rmmod_main(int argc, char **argv)
43{ 43{
44 int n, ret = EXIT_SUCCESS; 44 int n, ret = EXIT_SUCCESS;
diff --git a/networking/arp.c b/networking/arp.c
index 8cdee1832..36985fc5a 100644
--- a/networking/arp.c
+++ b/networking/arp.c
@@ -434,7 +434,7 @@ static int arp_show(char *name)
434 return 0; 434 return 0;
435} 435}
436 436
437int arp_main(int argc, char **argv); 437int arp_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
438int arp_main(int argc, char **argv) 438int arp_main(int argc, char **argv)
439{ 439{
440 char *hw_type; 440 char *hw_type;
diff --git a/networking/arping.c b/networking/arping.c
index a2c4c2247..44615d5b1 100644
--- a/networking/arping.c
+++ b/networking/arping.c
@@ -227,7 +227,7 @@ static int recv_pack(unsigned char *buf, int len, struct sockaddr_ll *FROM)
227 return 1; 227 return 1;
228} 228}
229 229
230int arping_main(int argc, char **argv); 230int arping_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
231int arping_main(int argc, char **argv) 231int arping_main(int argc, char **argv)
232{ 232{
233 const char *device = "eth0"; 233 const char *device = "eth0";
diff --git a/networking/dnsd.c b/networking/dnsd.c
index c906de32a..8f01d5c06 100644
--- a/networking/dnsd.c
+++ b/networking/dnsd.c
@@ -328,7 +328,7 @@ static void interrupt(int x)
328 exit(2); 328 exit(2);
329} 329}
330 330
331int dnsd_main(int argc, char **argv); 331int dnsd_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
332int dnsd_main(int argc, char **argv) 332int dnsd_main(int argc, char **argv)
333{ 333{
334 const char *listen_interface = "0.0.0.0"; 334 const char *listen_interface = "0.0.0.0";
diff --git a/networking/ether-wake.c b/networking/ether-wake.c
index fc26ad07d..b752152e1 100644
--- a/networking/ether-wake.c
+++ b/networking/ether-wake.c
@@ -178,7 +178,7 @@ static int get_wol_pw(const char *ethoptarg, unsigned char *wol_passwd)
178 return byte_cnt; 178 return byte_cnt;
179} 179}
180 180
181int ether_wake_main(int argc, char **argv); 181int ether_wake_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
182int ether_wake_main(int argc, char **argv) 182int ether_wake_main(int argc, char **argv)
183{ 183{
184 const char *ifname = "eth0"; 184 const char *ifname = "eth0";
diff --git a/networking/ftpgetput.c b/networking/ftpgetput.c
index 58847a9f2..587f000ce 100644
--- a/networking/ftpgetput.c
+++ b/networking/ftpgetput.c
@@ -296,7 +296,7 @@ static const char ftpgetput_longopts[] ALIGN1 =
296 ; 296 ;
297#endif 297#endif
298 298
299int ftpgetput_main(int argc, char **argv); 299int ftpgetput_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
300int ftpgetput_main(int argc, char **argv) 300int ftpgetput_main(int argc, char **argv)
301{ 301{
302 /* content-length of the file */ 302 /* content-length of the file */
diff --git a/networking/hostname.c b/networking/hostname.c
index 6783dbacb..2c224bef9 100644
--- a/networking/hostname.c
+++ b/networking/hostname.c
@@ -42,7 +42,7 @@ static void do_sethostname(char *s, int isfile)
42 } 42 }
43} 43}
44 44
45int hostname_main(int argc, char **argv); 45int hostname_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
46int hostname_main(int argc, char **argv) 46int hostname_main(int argc, char **argv)
47{ 47{
48 enum { 48 enum {
diff --git a/networking/httpd.c b/networking/httpd.c
index 06a5a56bc..61185025c 100644
--- a/networking/httpd.c
+++ b/networking/httpd.c
@@ -2111,7 +2111,7 @@ enum {
2111}; 2111};
2112 2112
2113 2113
2114int httpd_main(int argc, char **argv); 2114int httpd_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
2115int httpd_main(int argc, char **argv) 2115int httpd_main(int argc, char **argv)
2116{ 2116{
2117 int server_socket = server_socket; /* for gcc */ 2117 int server_socket = server_socket; /* for gcc */
diff --git a/networking/ifconfig.c b/networking/ifconfig.c
index 0d53676cd..3dcb118ee 100644
--- a/networking/ifconfig.c
+++ b/networking/ifconfig.c
@@ -261,7 +261,7 @@ static int in_ether(const char *bufp, struct sockaddr *sap);
261 * Our main function. 261 * Our main function.
262 */ 262 */
263 263
264int ifconfig_main(int argc, char **argv); 264int ifconfig_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
265int ifconfig_main(int argc, char **argv) 265int ifconfig_main(int argc, char **argv)
266{ 266{
267 struct ifreq ifr; 267 struct ifreq ifr;
diff --git a/networking/ifupdown.c b/networking/ifupdown.c
index bd53f93e8..c4d72524d 100644
--- a/networking/ifupdown.c
+++ b/networking/ifupdown.c
@@ -1133,7 +1133,7 @@ static llist_t *read_iface_state(void)
1133} 1133}
1134 1134
1135 1135
1136int ifupdown_main(int argc, char **argv); 1136int ifupdown_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
1137int ifupdown_main(int argc, char **argv) 1137int ifupdown_main(int argc, char **argv)
1138{ 1138{
1139 int (*cmds)(struct interface_defn_t *) = NULL; 1139 int (*cmds)(struct interface_defn_t *) = NULL;
diff --git a/networking/inetd.c b/networking/inetd.c
index 6d72e13e8..9ea7f9cc1 100644
--- a/networking/inetd.c
+++ b/networking/inetd.c
@@ -1303,7 +1303,7 @@ inetd_setproctitle(char *a, int s)
1303#endif 1303#endif
1304 1304
1305 1305
1306int inetd_main(int argc, char **argv); 1306int inetd_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
1307int inetd_main(int argc, char **argv) 1307int inetd_main(int argc, char **argv)
1308{ 1308{
1309 servtab_t *sep; 1309 servtab_t *sep;
diff --git a/networking/ip.c b/networking/ip.c
index c82d731c1..3ea1b62e1 100644
--- a/networking/ip.c
+++ b/networking/ip.c
@@ -38,7 +38,7 @@ static int ip_do(int argc, char **argv)
38} 38}
39 39
40#if ENABLE_FEATURE_IP_ADDRESS 40#if ENABLE_FEATURE_IP_ADDRESS
41int ipaddr_main(int argc, char **argv); 41int ipaddr_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
42int ipaddr_main(int argc, char **argv) 42int ipaddr_main(int argc, char **argv)
43{ 43{
44 ip_func = do_ipaddr; 44 ip_func = do_ipaddr;
@@ -46,7 +46,7 @@ int ipaddr_main(int argc, char **argv)
46} 46}
47#endif 47#endif
48#if ENABLE_FEATURE_IP_LINK 48#if ENABLE_FEATURE_IP_LINK
49int iplink_main(int argc, char **argv); 49int iplink_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
50int iplink_main(int argc, char **argv) 50int iplink_main(int argc, char **argv)
51{ 51{
52 ip_func = do_iplink; 52 ip_func = do_iplink;
@@ -54,7 +54,7 @@ int iplink_main(int argc, char **argv)
54} 54}
55#endif 55#endif
56#if ENABLE_FEATURE_IP_ROUTE 56#if ENABLE_FEATURE_IP_ROUTE
57int iproute_main(int argc, char **argv); 57int iproute_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
58int iproute_main(int argc, char **argv) 58int iproute_main(int argc, char **argv)
59{ 59{
60 ip_func = do_iproute; 60 ip_func = do_iproute;
@@ -62,7 +62,7 @@ int iproute_main(int argc, char **argv)
62} 62}
63#endif 63#endif
64#if ENABLE_FEATURE_IP_RULE 64#if ENABLE_FEATURE_IP_RULE
65int iprule_main(int argc, char **argv); 65int iprule_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
66int iprule_main(int argc, char **argv) 66int iprule_main(int argc, char **argv)
67{ 67{
68 ip_func = do_iprule; 68 ip_func = do_iprule;
@@ -70,7 +70,7 @@ int iprule_main(int argc, char **argv)
70} 70}
71#endif 71#endif
72#if ENABLE_FEATURE_IP_TUNNEL 72#if ENABLE_FEATURE_IP_TUNNEL
73int iptunnel_main(int argc, char **argv); 73int iptunnel_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
74int iptunnel_main(int argc, char **argv) 74int iptunnel_main(int argc, char **argv)
75{ 75{
76 ip_func = do_iptunnel; 76 ip_func = do_iptunnel;
@@ -79,7 +79,7 @@ int iptunnel_main(int argc, char **argv)
79#endif 79#endif
80 80
81 81
82int ip_main(int argc, char **argv); 82int ip_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
83int ip_main(int argc, char **argv) 83int ip_main(int argc, char **argv)
84{ 84{
85 static const char keywords[] ALIGN1 = 85 static const char keywords[] ALIGN1 =
diff --git a/networking/ipcalc.c b/networking/ipcalc.c
index 759704379..d7c968c25 100644
--- a/networking/ipcalc.c
+++ b/networking/ipcalc.c
@@ -75,7 +75,7 @@ int get_prefix(unsigned long netmask);
75 ; 75 ;
76#endif 76#endif
77 77
78int ipcalc_main(int argc, char **argv); 78int ipcalc_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
79int ipcalc_main(int argc, char **argv) 79int ipcalc_main(int argc, char **argv)
80{ 80{
81 unsigned opt; 81 unsigned opt;
diff --git a/networking/isrv_identd.c b/networking/isrv_identd.c
index 9bc3b607d..a93de1244 100644
--- a/networking/isrv_identd.c
+++ b/networking/isrv_identd.c
@@ -92,7 +92,7 @@ static void inetd_mode(void)
92 while (do_rd(0, (void*)&buf) == 0); 92 while (do_rd(0, (void*)&buf) == 0);
93} 93}
94 94
95int fakeidentd_main(int argc, char **argv); 95int fakeidentd_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
96int fakeidentd_main(int argc, char **argv) 96int fakeidentd_main(int argc, char **argv)
97{ 97{
98 enum { 98 enum {
diff --git a/networking/nameif.c b/networking/nameif.c
index 2114516a7..0369c0807 100644
--- a/networking/nameif.c
+++ b/networking/nameif.c
@@ -55,7 +55,7 @@ static struct ether_addr *cc_macaddr(const char *str_macaddr)
55 return mac; 55 return mac;
56} 56}
57 57
58int nameif_main(int argc, char **argv); 58int nameif_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
59int nameif_main(int argc, char **argv) 59int nameif_main(int argc, char **argv)
60{ 60{
61 mactable_t *clist = NULL; 61 mactable_t *clist = NULL;
diff --git a/networking/nc.c b/networking/nc.c
index 19750e59e..b2f590adf 100644
--- a/networking/nc.c
+++ b/networking/nc.c
@@ -22,7 +22,7 @@ static void timeout(int signum)
22 bb_error_msg_and_die("timed out"); 22 bb_error_msg_and_die("timed out");
23} 23}
24 24
25int nc_main(int argc, char **argv); 25int nc_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
26int nc_main(int argc, char **argv) 26int nc_main(int argc, char **argv)
27{ 27{
28 /* sfd sits _here_ only because of "repeat" option (-l -l). */ 28 /* sfd sits _here_ only because of "repeat" option (-l -l). */
diff --git a/networking/nc_bloaty.c b/networking/nc_bloaty.c
index ab8246531..cbc0a6471 100644
--- a/networking/nc_bloaty.c
+++ b/networking/nc_bloaty.c
@@ -668,7 +668,7 @@ Debug("wrote %d to net, errno %d", rr, errno);
668} /* readwrite */ 668} /* readwrite */
669 669
670/* main: now we pull it all together... */ 670/* main: now we pull it all together... */
671int nc_main(int argc, char **argv); 671int nc_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
672int nc_main(int argc, char **argv) 672int nc_main(int argc, char **argv)
673{ 673{
674 char *str_p, *str_s, *str_w; 674 char *str_p, *str_s, *str_w;
diff --git a/networking/netstat.c b/networking/netstat.c
index e5ed10eb4..11f141947 100644
--- a/networking/netstat.c
+++ b/networking/netstat.c
@@ -484,7 +484,7 @@ static void do_info(const char *file, const char *name, void (*proc)(int, const
484 * Our main function. 484 * Our main function.
485 */ 485 */
486 486
487int netstat_main(int argc, char **argv); 487int netstat_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
488int netstat_main(int argc, char **argv) 488int netstat_main(int argc, char **argv)
489{ 489{
490 const char *net_conn_line_header = PRINT_NET_CONN_HEADER; 490 const char *net_conn_line_header = PRINT_NET_CONN_HEADER;
diff --git a/networking/nslookup.c b/networking/nslookup.c
index fab7e3efc..183ae152d 100644
--- a/networking/nslookup.c
+++ b/networking/nslookup.c
@@ -127,7 +127,7 @@ static void set_default_dns(char *server)
127 } 127 }
128} 128}
129 129
130int nslookup_main(int argc, char **argv); 130int nslookup_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
131int nslookup_main(int argc, char **argv) 131int nslookup_main(int argc, char **argv)
132{ 132{
133 /* We allow 1 or 2 arguments. 133 /* We allow 1 or 2 arguments.
diff --git a/networking/ping.c b/networking/ping.c
index 5d61cd768..8b70d9a33 100644
--- a/networking/ping.c
+++ b/networking/ping.c
@@ -173,7 +173,7 @@ static void ping6(len_and_sockaddr *lsa)
173} 173}
174#endif 174#endif
175 175
176int ping_main(int argc, char **argv); 176int ping_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
177int ping_main(int argc, char **argv) 177int ping_main(int argc, char **argv)
178{ 178{
179 len_and_sockaddr *lsa; 179 len_and_sockaddr *lsa;
@@ -676,7 +676,7 @@ static void ping(len_and_sockaddr *lsa)
676 ping4(lsa); 676 ping4(lsa);
677} 677}
678 678
679int ping_main(int argc, char **argv); 679int ping_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
680int ping_main(int argc, char **argv) 680int ping_main(int argc, char **argv)
681{ 681{
682 len_and_sockaddr *lsa; 682 len_and_sockaddr *lsa;
@@ -724,7 +724,7 @@ int ping_main(int argc, char **argv)
724 724
725 725
726#if ENABLE_PING6 726#if ENABLE_PING6
727int ping6_main(int argc, char **argv); 727int ping6_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
728int ping6_main(int argc, char **argv) 728int ping6_main(int argc, char **argv)
729{ 729{
730 argv[0] = (char*)"-6"; 730 argv[0] = (char*)"-6";
diff --git a/networking/pscan.c b/networking/pscan.c
index 5ae3e61dd..d18f8dbd9 100644
--- a/networking/pscan.c
+++ b/networking/pscan.c
@@ -30,7 +30,7 @@ static const char *port_name(unsigned port)
30/* We don't expect to see 1000+ seconds delay, unsigned is enough */ 30/* We don't expect to see 1000+ seconds delay, unsigned is enough */
31#define MONOTONIC_US() ((unsigned)monotonic_us()) 31#define MONOTONIC_US() ((unsigned)monotonic_us())
32 32
33int pscan_main(int argc, char **argv); 33int pscan_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
34int pscan_main(int argc, char **argv) 34int pscan_main(int argc, char **argv)
35{ 35{
36 const char *opt_max_port = "1024"; /* -P: default max port */ 36 const char *opt_max_port = "1024"; /* -P: default max port */
diff --git a/networking/route.c b/networking/route.c
index 55a6c2155..3425e6397 100644
--- a/networking/route.c
+++ b/networking/route.c
@@ -640,7 +640,7 @@ static const char tbl_verb[] ALIGN1 =
640 "\010\002delete" /* Since it's last, we can save a byte. */ 640 "\010\002delete" /* Since it's last, we can save a byte. */
641; 641;
642 642
643int route_main(int argc, char **argv); 643int route_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
644int route_main(int argc, char **argv) 644int route_main(int argc, char **argv)
645{ 645{
646 unsigned opt; 646 unsigned opt;
diff --git a/networking/slattach.c b/networking/slattach.c
index ce6d705a8..17df4fa9e 100644
--- a/networking/slattach.c
+++ b/networking/slattach.c
@@ -119,7 +119,7 @@ static void sig_handler(int signo)
119 restore_state_and_exit(0); 119 restore_state_and_exit(0);
120} 120}
121 121
122int slattach_main(int argc, char **argv); 122int slattach_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
123int slattach_main(int argc, char **argv) 123int slattach_main(int argc, char **argv)
124{ 124{
125 /* Line discipline code table */ 125 /* Line discipline code table */
diff --git a/networking/telnet.c b/networking/telnet.c
index ae526fa9e..9085c5848 100644
--- a/networking/telnet.c
+++ b/networking/telnet.c
@@ -550,8 +550,8 @@ static void cookmode(void)
550 tcsetattr(0, TCSADRAIN, &G.termios_def); 550 tcsetattr(0, TCSADRAIN, &G.termios_def);
551} 551}
552 552
553int telnet_main(int argc, char** argv); 553int telnet_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
554int telnet_main(int argc, char** argv) 554int telnet_main(int argc, char **argv)
555{ 555{
556 char *host; 556 char *host;
557 int port; 557 int port;
diff --git a/networking/telnetd.c b/networking/telnetd.c
index b21991212..27dde1ae4 100644
--- a/networking/telnetd.c
+++ b/networking/telnetd.c
@@ -360,7 +360,7 @@ void free_session(struct tsession *ts);
360#endif 360#endif
361 361
362 362
363int telnetd_main(int argc, char **argv); 363int telnetd_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
364int telnetd_main(int argc, char **argv) 364int telnetd_main(int argc, char **argv)
365{ 365{
366 fd_set rdfdset, wrfdset; 366 fd_set rdfdset, wrfdset;
diff --git a/networking/tftp.c b/networking/tftp.c
index 59f53ae4a..a2683971a 100644
--- a/networking/tftp.c
+++ b/networking/tftp.c
@@ -391,7 +391,7 @@ static int tftp( USE_GETPUT(const int cmd,)
391 return finished == 0; /* returns 1 on failure */ 391 return finished == 0; /* returns 1 on failure */
392} 392}
393 393
394int tftp_main(int argc, char **argv); 394int tftp_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
395int tftp_main(int argc, char **argv) 395int tftp_main(int argc, char **argv)
396{ 396{
397 len_and_sockaddr *peer_lsa; 397 len_and_sockaddr *peer_lsa;
diff --git a/networking/traceroute.c b/networking/traceroute.c
index e8d486f4c..773fc6a8b 100644
--- a/networking/traceroute.c
+++ b/networking/traceroute.c
@@ -889,7 +889,7 @@ print_delta_ms(unsigned t1p, unsigned t2p)
889 printf(" %u.%03u ms", tt/1000, tt%1000); 889 printf(" %u.%03u ms", tt/1000, tt%1000);
890} 890}
891 891
892int traceroute_main(int argc, char **argv); 892int traceroute_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
893int traceroute_main(int argc, char **argv) 893int traceroute_main(int argc, char **argv)
894{ 894{
895 int code, n; 895 int code, n;
diff --git a/networking/udhcp/dhcpc.c b/networking/udhcp/dhcpc.c
index 21b496c0b..e00379b2a 100644
--- a/networking/udhcp/dhcpc.c
+++ b/networking/udhcp/dhcpc.c
@@ -140,7 +140,7 @@ static uint8_t* alloc_dhcp_option(int code, const char *str, int extra)
140} 140}
141 141
142 142
143int udhcpc_main(int argc, char **argv); 143int udhcpc_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
144int udhcpc_main(int argc, char **argv) 144int udhcpc_main(int argc, char **argv)
145{ 145{
146 uint8_t *temp, *message; 146 uint8_t *temp, *message;
diff --git a/networking/udhcp/dhcpd.c b/networking/udhcp/dhcpd.c
index 4343f1c0e..9679e086c 100644
--- a/networking/udhcp/dhcpd.c
+++ b/networking/udhcp/dhcpd.c
@@ -21,7 +21,7 @@ struct dhcpOfferedAddr *leases;
21/* struct server_config_t server_config is in bb_common_bufsiz1 */ 21/* struct server_config_t server_config is in bb_common_bufsiz1 */
22 22
23 23
24int udhcpd_main(int argc, char **argv); 24int udhcpd_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
25int udhcpd_main(int argc, char **argv) 25int udhcpd_main(int argc, char **argv)
26{ 26{
27 fd_set rfds; 27 fd_set rfds;
diff --git a/networking/udhcp/dhcprelay.c b/networking/udhcp/dhcprelay.c
index 91fcb151b..42378d602 100644
--- a/networking/udhcp/dhcprelay.c
+++ b/networking/udhcp/dhcprelay.c
@@ -279,7 +279,7 @@ static void dhcprelay_loop(int *fds, int num_sockets, int max_socket, char **cli
279 } 279 }
280} 280}
281 281
282int dhcprelay_main(int argc, char **argv); 282int dhcprelay_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
283int dhcprelay_main(int argc, char **argv) 283int dhcprelay_main(int argc, char **argv)
284{ 284{
285 int num_sockets, max_socket; 285 int num_sockets, max_socket;
diff --git a/networking/udhcp/dumpleases.c b/networking/udhcp/dumpleases.c
index 3e931c0b5..218e6bc57 100644
--- a/networking/udhcp/dumpleases.c
+++ b/networking/udhcp/dumpleases.c
@@ -7,7 +7,7 @@
7#include "common.h" 7#include "common.h"
8#include "dhcpd.h" 8#include "dhcpd.h"
9 9
10int dumpleases_main(int argc, char **argv); 10int dumpleases_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
11int dumpleases_main(int argc, char **argv) 11int dumpleases_main(int argc, char **argv)
12{ 12{
13 int fd; 13 int fd;
diff --git a/networking/vconfig.c b/networking/vconfig.c
index 8bd88701f..7b6c2fa04 100644
--- a/networking/vconfig.c
+++ b/networking/vconfig.c
@@ -106,7 +106,7 @@ static const char name_types[] ALIGN1 = {
106 106
107static const char conf_file_name[] ALIGN1 = "/proc/net/vlan/config"; 107static const char conf_file_name[] ALIGN1 = "/proc/net/vlan/config";
108 108
109int vconfig_main(int argc, char **argv); 109int vconfig_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
110int vconfig_main(int argc, char **argv) 110int vconfig_main(int argc, char **argv)
111{ 111{
112 struct vlan_ioctl_args ifr; 112 struct vlan_ioctl_args ifr;
diff --git a/networking/wget.c b/networking/wget.c
index 3f9954cf5..b12d19af2 100644
--- a/networking/wget.c
+++ b/networking/wget.c
@@ -391,7 +391,7 @@ static char *gethdr(char *buf, size_t bufsiz, FILE *fp /*, int *istrunc*/)
391} 391}
392 392
393 393
394int wget_main(int argc, char **argv); 394int wget_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
395int wget_main(int argc, char **argv) 395int wget_main(int argc, char **argv)
396{ 396{
397 char buf[512]; 397 char buf[512];
diff --git a/networking/zcip.c b/networking/zcip.c
index 62350c640..a16a6420c 100644
--- a/networking/zcip.c
+++ b/networking/zcip.c
@@ -156,7 +156,7 @@ static unsigned ALWAYS_INLINE ms_rdelay(unsigned secs)
156/** 156/**
157 * main program 157 * main program
158 */ 158 */
159int zcip_main(int argc, char **argv); 159int zcip_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
160int zcip_main(int argc, char **argv) 160int zcip_main(int argc, char **argv)
161{ 161{
162 int state = PROBE; 162 int state = PROBE;
diff --git a/procps/free.c b/procps/free.c
index 42193fdec..e76dd21a5 100644
--- a/procps/free.c
+++ b/procps/free.c
@@ -11,7 +11,7 @@
11 11
12#include "libbb.h" 12#include "libbb.h"
13 13
14int free_main(int argc, char **argv); 14int free_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
15int free_main(int argc, char **argv) 15int free_main(int argc, char **argv)
16{ 16{
17 struct sysinfo info; 17 struct sysinfo info;
diff --git a/procps/fuser.c b/procps/fuser.c
index 60c10956b..36d634d91 100644
--- a/procps/fuser.c
+++ b/procps/fuser.c
@@ -316,7 +316,7 @@ static int fuser_kill_pid_list(pid_list *plist, int sig)
316 return success; 316 return success;
317} 317}
318 318
319int fuser_main(int argc, char **argv); 319int fuser_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
320int fuser_main(int argc, char **argv) 320int fuser_main(int argc, char **argv)
321{ 321{
322 /*static -- huh???*/ int opt = 0; /* FUSER_OPT_ */ 322 /*static -- huh???*/ int opt = 0; /* FUSER_OPT_ */
diff --git a/procps/kill.c b/procps/kill.c
index 323ee7bf4..0c7c1608f 100644
--- a/procps/kill.c
+++ b/procps/kill.c
@@ -24,7 +24,7 @@
24 * This is needed to avoid collision with kill -9 ... syntax 24 * This is needed to avoid collision with kill -9 ... syntax
25 */ 25 */
26 26
27int kill_main(int argc, char **argv); 27int kill_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
28int kill_main(int argc, char **argv) 28int kill_main(int argc, char **argv)
29{ 29{
30 char *arg; 30 char *arg;
diff --git a/procps/nmeter.c b/procps/nmeter.c
index 127a3d1c1..b846ee5b6 100644
--- a/procps/nmeter.c
+++ b/procps/nmeter.c
@@ -770,7 +770,7 @@ static init_func *const init_functions[] = {
770 init_cr 770 init_cr
771}; 771};
772 772
773int nmeter_main(int argc, char **argv); 773int nmeter_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
774int nmeter_main(int argc, char **argv) 774int nmeter_main(int argc, char **argv)
775{ 775{
776 char buf[32]; 776 char buf[32];
diff --git a/procps/pgrep.c b/procps/pgrep.c
index c5747a163..f5d4cfcc1 100644
--- a/procps/pgrep.c
+++ b/procps/pgrep.c
@@ -44,7 +44,7 @@ static void act(unsigned pid, char *cmd, int signo, unsigned opt)
44 kill(pid, signo); 44 kill(pid, signo);
45} 45}
46 46
47int pgrep_main(int argc, char **argv); 47int pgrep_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
48int pgrep_main(int argc, char **argv) 48int pgrep_main(int argc, char **argv)
49{ 49{
50 unsigned pid = getpid(); 50 unsigned pid = getpid();
diff --git a/procps/pidof.c b/procps/pidof.c
index 962945253..f29561789 100644
--- a/procps/pidof.c
+++ b/procps/pidof.c
@@ -16,7 +16,7 @@ enum {
16 OPT_OMIT = USE_FEATURE_PIDOF_OMIT( (1<<OPTBIT_OMIT )) + 0, 16 OPT_OMIT = USE_FEATURE_PIDOF_OMIT( (1<<OPTBIT_OMIT )) + 0,
17}; 17};
18 18
19int pidof_main(int argc, char **argv); 19int pidof_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
20int pidof_main(int argc, char **argv) 20int pidof_main(int argc, char **argv)
21{ 21{
22 unsigned first = 1; 22 unsigned first = 1;
diff --git a/procps/ps.c b/procps/ps.c
index f5c801d20..08922ebb6 100644
--- a/procps/ps.c
+++ b/procps/ps.c
@@ -278,7 +278,7 @@ static void format_process(const procps_status_t *ps)
278 printf("%.*s\n", terminal_width, buffer); 278 printf("%.*s\n", terminal_width, buffer);
279} 279}
280 280
281int ps_main(int argc, char **argv); 281int ps_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
282int ps_main(int argc, char **argv) 282int ps_main(int argc, char **argv)
283{ 283{
284 procps_status_t *p; 284 procps_status_t *p;
@@ -340,7 +340,7 @@ int ps_main(int argc, char **argv)
340#else /* !ENABLE_DESKTOP */ 340#else /* !ENABLE_DESKTOP */
341 341
342 342
343int ps_main(int argc, char **argv); 343int ps_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
344int ps_main(int argc, char **argv) 344int ps_main(int argc, char **argv)
345{ 345{
346 procps_status_t *p = NULL; 346 procps_status_t *p = NULL;
diff --git a/procps/renice.c b/procps/renice.c
index b2a9ed72e..ab0d3a1c4 100644
--- a/procps/renice.c
+++ b/procps/renice.c
@@ -26,7 +26,7 @@ void BUG_bad_PRIO_PROCESS(void);
26void BUG_bad_PRIO_PGRP(void); 26void BUG_bad_PRIO_PGRP(void);
27void BUG_bad_PRIO_USER(void); 27void BUG_bad_PRIO_USER(void);
28 28
29int renice_main(int argc, char **argv); 29int renice_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
30int renice_main(int argc, char **argv) 30int renice_main(int argc, char **argv)
31{ 31{
32 static const char Xetpriority_msg[] ALIGN1 = "%cetpriority"; 32 static const char Xetpriority_msg[] ALIGN1 = "%cetpriority";
diff --git a/procps/sysctl.c b/procps/sysctl.c
index 5100f57e7..a84f9aef9 100644
--- a/procps/sysctl.c
+++ b/procps/sysctl.c
@@ -59,7 +59,7 @@ static void dwrite_str(int fd, const char *buf)
59/* 59/*
60 * sysctl_main()... 60 * sysctl_main()...
61 */ 61 */
62int sysctl_main(int argc, char **argv); 62int sysctl_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
63int sysctl_main(int argc, char **argv) 63int sysctl_main(int argc, char **argv)
64{ 64{
65 int retval = 0; 65 int retval = 0;
diff --git a/procps/top.c b/procps/top.c
index 1b8c18516..7f1c83fc1 100644
--- a/procps/top.c
+++ b/procps/top.c
@@ -782,7 +782,7 @@ enum {
782 | PSSCAN_COMM, 782 | PSSCAN_COMM,
783}; 783};
784 784
785int top_main(int argc, char **argv); 785int top_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
786int top_main(int argc, char **argv) 786int top_main(int argc, char **argv)
787{ 787{
788 int count, lines, col; 788 int count, lines, col;
diff --git a/procps/uptime.c b/procps/uptime.c
index ee0657e1b..07e8d607d 100644
--- a/procps/uptime.c
+++ b/procps/uptime.c
@@ -25,7 +25,7 @@
25#define LOAD_FRAC(x) LOAD_INT(((x) & (FIXED_1-1)) * 100) 25#define LOAD_FRAC(x) LOAD_INT(((x) & (FIXED_1-1)) * 100)
26 26
27 27
28int uptime_main(int argc, char **argv); 28int uptime_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
29int uptime_main(int argc, char **argv) 29int uptime_main(int argc, char **argv)
30{ 30{
31 int updays, uphours, upminutes; 31 int updays, uphours, upminutes;
diff --git a/procps/watch.c b/procps/watch.c
index 3d18105bf..76d2a87e9 100644
--- a/procps/watch.c
+++ b/procps/watch.c
@@ -23,7 +23,7 @@
23// 23//
24// (procps 3.x and procps 2.x are forks, not newer/older versions of the same) 24// (procps 3.x and procps 2.x are forks, not newer/older versions of the same)
25 25
26int watch_main(int argc, char **argv); 26int watch_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
27int watch_main(int argc, char **argv) 27int watch_main(int argc, char **argv)
28{ 28{
29 unsigned opt; 29 unsigned opt;
diff --git a/runit/chpst.c b/runit/chpst.c
index 1bc8e18a3..0f605cc45 100644
--- a/runit/chpst.c
+++ b/runit/chpst.c
@@ -289,7 +289,7 @@ static void envuidgid(int, char **) ATTRIBUTE_NORETURN;
289static void envdir(int, char **) ATTRIBUTE_NORETURN; 289static void envdir(int, char **) ATTRIBUTE_NORETURN;
290static void softlimit(int, char **) ATTRIBUTE_NORETURN; 290static void softlimit(int, char **) ATTRIBUTE_NORETURN;
291 291
292int chpst_main(int argc, char **argv); 292int chpst_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
293int chpst_main(int argc, char **argv) 293int chpst_main(int argc, char **argv)
294{ 294{
295 INIT_G(); 295 INIT_G();
diff --git a/runit/runsv.c b/runit/runsv.c
index 7cf142d8a..8c5a4d4ea 100644
--- a/runit/runsv.c
+++ b/runit/runsv.c
@@ -439,7 +439,7 @@ static int ctrl(struct svdir *s, char c)
439 return 1; 439 return 1;
440} 440}
441 441
442int runsv_main(int argc, char **argv); 442int runsv_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
443int runsv_main(int argc, char **argv) 443int runsv_main(int argc, char **argv)
444{ 444{
445 struct stat s; 445 struct stat s;
diff --git a/runit/runsvdir.c b/runit/runsvdir.c
index 924f771b7..9e98ca6f8 100644
--- a/runit/runsvdir.c
+++ b/runit/runsvdir.c
@@ -204,7 +204,7 @@ static int setup_log(void)
204 return 1; 204 return 1;
205} 205}
206 206
207int runsvdir_main(int argc, char **argv); 207int runsvdir_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
208int runsvdir_main(int argc, char **argv) 208int runsvdir_main(int argc, char **argv)
209{ 209{
210 struct stat s; 210 struct stat s;
diff --git a/runit/sv.c b/runit/sv.c
index 757391a54..e31adffed 100644
--- a/runit/sv.c
+++ b/runit/sv.c
@@ -411,7 +411,7 @@ static int control(const char *a)
411 return 1; 411 return 1;
412} 412}
413 413
414int sv_main(int argc, char **argv); 414int sv_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
415int sv_main(int argc, char **argv) 415int sv_main(int argc, char **argv)
416{ 416{
417 unsigned opt; 417 unsigned opt;
diff --git a/runit/svlogd.c b/runit/svlogd.c
index bf46ef7f8..5f682b19c 100644
--- a/runit/svlogd.c
+++ b/runit/svlogd.c
@@ -843,7 +843,7 @@ static void logmatch(struct logdir *ld)
843 } 843 }
844} 844}
845 845
846int svlogd_main(int argc, char **argv); 846int svlogd_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
847int svlogd_main(int argc, char **argv) 847int svlogd_main(int argc, char **argv)
848{ 848{
849 char *r,*l,*b; 849 char *r,*l,*b;
diff --git a/scripts/trylink b/scripts/trylink
index 6292dc659..25629aa1a 100755
--- a/scripts/trylink
+++ b/scripts/trylink
@@ -26,7 +26,7 @@ debug=false
26# --enable-new-dtags ? 26# --enable-new-dtags ?
27# -z,combreloc ? 27# -z,combreloc ?
28# -soname="libbusybox.so.$BB_VER" 28# -soname="libbusybox.so.$BB_VER"
29# --undefined=libbusybox_main Seed name to start pulling from 29# --undefined=lbb_main Seed name to start pulling from
30# (otherwise we'll need --whole-archive) 30# (otherwise we'll need --whole-archive)
31# -static Not used, but may be useful! manpage: 31# -static Not used, but may be useful! manpage:
32# "... This option can be used with -shared. 32# "... This option can be used with -shared.
@@ -172,7 +172,7 @@ if test "$CONFIG_BUILD_LIBBUSYBOX" = y; then
172 -Wl,--enable-new-dtags \ 172 -Wl,--enable-new-dtags \
173 -Wl,-z,combreloc \ 173 -Wl,-z,combreloc \
174 -Wl,-soname="libbusybox.so.$BB_VER" \ 174 -Wl,-soname="libbusybox.so.$BB_VER" \
175 -Wl,--undefined=libbusybox_main \ 175 -Wl,--undefined=lbb_main \
176 -Wl,--sort-common \ 176 -Wl,--sort-common \
177 -Wl,--sort-section -Wl,alignment \ 177 -Wl,--sort-section -Wl,alignment \
178 -Wl,--start-group $A_FILES -Wl,--end-group \ 178 -Wl,--start-group $A_FILES -Wl,--end-group \
@@ -220,14 +220,14 @@ if test "$CONFIG_FEATURE_INDIVIDUAL" = y; then
220 while read name main junk; do 220 while read name main junk; do
221 221
222 echo "\ 222 echo "\
223void bbox_prepare_main(char **argv); 223void lbb_prepare(char **argv);
224int $main(int argc, char **argv); 224int $main(int argc, char **argv);
225 225
226const char *applet_name = \"$name\"; 226const char *applet_name = \"$name\";
227 227
228int main(int argc, char **argv) 228int main(int argc, char **argv)
229{ 229{
230 bbox_prepare_main(argv); 230 lbb_prepare(argv);
231 return $main(argc, argv); 231 return $main(argc, argv);
232} 232}
233" >"$sharedlib_dir/applet.c" 233" >"$sharedlib_dir/applet.c"
diff --git a/selinux/chcon.c b/selinux/chcon.c
index 3609880cb..f00e24278 100644
--- a/selinux/chcon.c
+++ b/selinux/chcon.c
@@ -120,7 +120,7 @@ static const char chcon_longopts[] ALIGN1 =
120 ; 120 ;
121#endif 121#endif
122 122
123int chcon_main(int argc, char **argv); 123int chcon_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
124int chcon_main(int argc, char **argv) 124int chcon_main(int argc, char **argv)
125{ 125{
126 char *reference_file; 126 char *reference_file;
diff --git a/selinux/getenforce.c b/selinux/getenforce.c
index 62b42637c..e11e78e31 100644
--- a/selinux/getenforce.c
+++ b/selinux/getenforce.c
@@ -8,7 +8,7 @@
8 8
9#include "libbb.h" 9#include "libbb.h"
10 10
11int getenforce_main(int argc, char **argv); 11int getenforce_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
12int getenforce_main(int argc, char **argv) 12int getenforce_main(int argc, char **argv)
13{ 13{
14 int rc; 14 int rc;
diff --git a/selinux/getsebool.c b/selinux/getsebool.c
index 598a51cc0..ea080d483 100644
--- a/selinux/getsebool.c
+++ b/selinux/getsebool.c
@@ -8,7 +8,7 @@
8 8
9#include "libbb.h" 9#include "libbb.h"
10 10
11int getsebool_main(int argc, char **argv); 11int getsebool_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
12int getsebool_main(int argc, char **argv) 12int getsebool_main(int argc, char **argv)
13{ 13{
14 int i, rc = 0, active, pending, len = 0; 14 int i, rc = 0, active, pending, len = 0;
diff --git a/selinux/load_policy.c b/selinux/load_policy.c
index add5c662c..f9aa49d19 100644
--- a/selinux/load_policy.c
+++ b/selinux/load_policy.c
@@ -4,7 +4,7 @@
4 */ 4 */
5#include "libbb.h" 5#include "libbb.h"
6 6
7int load_policy_main(int argc, char **argv); 7int load_policy_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
8int load_policy_main(int argc, char **argv) 8int load_policy_main(int argc, char **argv)
9{ 9{
10 int rc; 10 int rc;
diff --git a/selinux/matchpathcon.c b/selinux/matchpathcon.c
index bb7099ea6..6de68bceb 100644
--- a/selinux/matchpathcon.c
+++ b/selinux/matchpathcon.c
@@ -29,7 +29,7 @@ static int print_matchpathcon(char *path, int noprint)
29#define OPT_PREFIX (1<<3) /* -p */ 29#define OPT_PREFIX (1<<3) /* -p */
30#define OPT_VERIFY (1<<4) /* -V */ 30#define OPT_VERIFY (1<<4) /* -V */
31 31
32int matchpathcon_main(int argc, char **argv); 32int matchpathcon_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
33int matchpathcon_main(int argc, char **argv) 33int matchpathcon_main(int argc, char **argv)
34{ 34{
35 int error = 0; 35 int error = 0;
diff --git a/selinux/runcon.c b/selinux/runcon.c
index 37ac5d18f..89a4b0555 100644
--- a/selinux/runcon.c
+++ b/selinux/runcon.c
@@ -87,7 +87,7 @@ static const char runcon_longopts[] ALIGN1 =
87#define OPTS_HELP (1<<5) /* h */ 87#define OPTS_HELP (1<<5) /* h */
88#define OPTS_CONTEXT_COMPONENT (OPTS_ROLE | OPTS_TYPE | OPTS_USER | OPTS_RANGE) 88#define OPTS_CONTEXT_COMPONENT (OPTS_ROLE | OPTS_TYPE | OPTS_USER | OPTS_RANGE)
89 89
90int runcon_main(int argc, char **argv); 90int runcon_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
91int runcon_main(int argc, char **argv) 91int runcon_main(int argc, char **argv)
92{ 92{
93 char *role = NULL; 93 char *role = NULL;
diff --git a/selinux/selinuxenabled.c b/selinux/selinuxenabled.c
index 8a9c7cd02..114d2b6e2 100644
--- a/selinux/selinuxenabled.c
+++ b/selinux/selinuxenabled.c
@@ -7,7 +7,7 @@
7 */ 7 */
8#include "libbb.h" 8#include "libbb.h"
9 9
10int selinuxenabled_main(int argc, char **argv); 10int selinuxenabled_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
11int selinuxenabled_main(int argc, char **argv) 11int selinuxenabled_main(int argc, char **argv)
12{ 12{
13 return !is_selinux_enabled(); 13 return !is_selinux_enabled();
diff --git a/selinux/setenforce.c b/selinux/setenforce.c
index 59b1b0fca..198324c91 100644
--- a/selinux/setenforce.c
+++ b/selinux/setenforce.c
@@ -19,7 +19,7 @@ static const char *const setenforce_cmd[] = {
19 NULL, 19 NULL,
20}; 20};
21 21
22int setenforce_main(int argc, char **argv); 22int setenforce_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
23int setenforce_main(int argc, char **argv) 23int setenforce_main(int argc, char **argv)
24{ 24{
25 int i, rc; 25 int i, rc;
diff --git a/selinux/setfiles.c b/selinux/setfiles.c
index 5ae482e65..905333f94 100644
--- a/selinux/setfiles.c
+++ b/selinux/setfiles.c
@@ -486,7 +486,7 @@ static int process_one(char *name)
486 goto out; 486 goto out;
487} 487}
488 488
489int setfiles_main(int argc, char **argv); 489int setfiles_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
490int setfiles_main(int argc, char **argv) 490int setfiles_main(int argc, char **argv)
491{ 491{
492 struct stat sb; 492 struct stat sb;
diff --git a/shell/ash.c b/shell/ash.c
index af96c4d1d..2b9a8ccb6 100644
--- a/shell/ash.c
+++ b/shell/ash.c
@@ -12739,7 +12739,7 @@ extern int etext();
12739 * exception occurs. When an exception occurs the variable "state" 12739 * exception occurs. When an exception occurs the variable "state"
12740 * is used to figure out how far we had gotten. 12740 * is used to figure out how far we had gotten.
12741 */ 12741 */
12742int ash_main(int argc, char **argv); 12742int ash_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
12743int ash_main(int argc, char **argv) 12743int ash_main(int argc, char **argv)
12744{ 12744{
12745 char *shinit; 12745 char *shinit;
diff --git a/shell/bbsh.c b/shell/bbsh.c
index 09c4bd9a2..02e60508f 100644
--- a/shell/bbsh.c
+++ b/shell/bbsh.c
@@ -198,7 +198,7 @@ static void handle(char *command)
198 } 198 }
199} 199}
200 200
201int bbsh_main(int argc, char **argv); 201int bbsh_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
202int bbsh_main(int argc, char **argv) 202int bbsh_main(int argc, char **argv)
203{ 203{
204 char *command=NULL; 204 char *command=NULL;
diff --git a/shell/hush.c b/shell/hush.c
index 1977da0f0..a76327721 100644
--- a/shell/hush.c
+++ b/shell/hush.c
@@ -3675,7 +3675,7 @@ static void setup_job_control(void)
3675} 3675}
3676#endif 3676#endif
3677 3677
3678int hush_main(int argc, char **argv); 3678int hush_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
3679int hush_main(int argc, char **argv) 3679int hush_main(int argc, char **argv)
3680{ 3680{
3681 static const char version_str[] ALIGN1 = "HUSH_VERSION="HUSH_VER_STR; 3681 static const char version_str[] ALIGN1 = "HUSH_VERSION="HUSH_VER_STR;
diff --git a/shell/lash.c b/shell/lash.c
index b7a0a6a37..ce1ce7f6a 100644
--- a/shell/lash.c
+++ b/shell/lash.c
@@ -1491,7 +1491,7 @@ static inline void setup_job_control(void)
1491} 1491}
1492#endif 1492#endif
1493 1493
1494int lash_main(int argc_l, char **argv_l); 1494int lash_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
1495int lash_main(int argc_l, char **argv_l) 1495int lash_main(int argc_l, char **argv_l)
1496{ 1496{
1497 unsigned opt; 1497 unsigned opt;
diff --git a/shell/msh.c b/shell/msh.c
index 41fe1b6ba..7efd7f96e 100644
--- a/shell/msh.c
+++ b/shell/msh.c
@@ -5164,7 +5164,7 @@ static void freehere(int area)
5164 * shell 5164 * shell
5165 */ 5165 */
5166 5166
5167int msh_main(int argc, char **argv); 5167int msh_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
5168int msh_main(int argc, char **argv) 5168int msh_main(int argc, char **argv)
5169{ 5169{
5170 int f; 5170 int f;
diff --git a/sysklogd/klogd.c b/sysklogd/klogd.c
index 2af410590..11642461d 100644
--- a/sysklogd/klogd.c
+++ b/sysklogd/klogd.c
@@ -35,7 +35,7 @@ static void klogd_signal(int sig ATTRIBUTE_UNUSED)
35#define KLOGD_LOGBUF_SIZE BUFSIZ 35#define KLOGD_LOGBUF_SIZE BUFSIZ
36#define log_buffer bb_common_bufsiz1 36#define log_buffer bb_common_bufsiz1
37 37
38int klogd_main(int argc, char **argv); 38int klogd_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
39int klogd_main(int argc, char **argv) 39int klogd_main(int argc, char **argv)
40{ 40{
41 int i = i; /* silence gcc */ 41 int i = i; /* silence gcc */
diff --git a/sysklogd/logger.c b/sysklogd/logger.c
index 6e1debd67..e2d074605 100644
--- a/sysklogd/logger.c
+++ b/sysklogd/logger.c
@@ -81,7 +81,7 @@ static int pencode(char *s)
81} 81}
82 82
83 83
84int logger_main(int argc, char **argv); 84int logger_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
85int logger_main(int argc, char **argv) 85int logger_main(int argc, char **argv)
86{ 86{
87 char *str_p, *str_t; 87 char *str_p, *str_t;
diff --git a/sysklogd/logread.c b/sysklogd/logread.c
index 69a084ff6..6567df374 100644
--- a/sysklogd/logread.c
+++ b/sysklogd/logread.c
@@ -53,7 +53,7 @@ static void interrupted(int sig ATTRIBUTE_UNUSED)
53 exit(0); 53 exit(0);
54} 54}
55 55
56int logread_main(int argc, char **argv); 56int logread_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
57int logread_main(int argc, char **argv) 57int logread_main(int argc, char **argv)
58{ 58{
59 int cur; 59 int cur;
diff --git a/sysklogd/syslogd.c b/sysklogd/syslogd.c
index f27bd8379..284e5743c 100644
--- a/sysklogd/syslogd.c
+++ b/sysklogd/syslogd.c
@@ -556,7 +556,7 @@ static void do_syslogd(void)
556 } /* for */ 556 } /* for */
557} 557}
558 558
559int syslogd_main(int argc, char **argv); 559int syslogd_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
560int syslogd_main(int argc, char **argv) 560int syslogd_main(int argc, char **argv)
561{ 561{
562 char OPTION_DECL; 562 char OPTION_DECL;
diff --git a/util-linux/dmesg.c b/util-linux/dmesg.c
index 3aa99e58f..1adb0fc2f 100644
--- a/util-linux/dmesg.c
+++ b/util-linux/dmesg.c
@@ -12,7 +12,7 @@
12#include <sys/klog.h> 12#include <sys/klog.h>
13#include "libbb.h" 13#include "libbb.h"
14 14
15int dmesg_main(int argc, char **argv); 15int dmesg_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
16int dmesg_main(int argc, char **argv) 16int dmesg_main(int argc, char **argv)
17{ 17{
18 char *size, *level; 18 char *size, *level;
diff --git a/util-linux/fbset.c b/util-linux/fbset.c
index a2b8b3800..f67a283c1 100644
--- a/util-linux/fbset.c
+++ b/util-linux/fbset.c
@@ -309,7 +309,7 @@ static inline void showmode(struct fb_var_screeninfo *v)
309#ifdef STANDALONE 309#ifdef STANDALONE
310int main(int argc, char **argv) 310int main(int argc, char **argv)
311#else 311#else
312int fbset_main(int argc, char **argv); 312int fbset_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
313int fbset_main(int argc, char **argv) 313int fbset_main(int argc, char **argv)
314#endif 314#endif
315{ 315{
diff --git a/util-linux/fdformat.c b/util-linux/fdformat.c
index dc45e23c0..c4f97ae34 100644
--- a/util-linux/fdformat.c
+++ b/util-linux/fdformat.c
@@ -1,12 +1,7 @@
1/* vi: set sw=4 ts=4: */ 1/* vi: set sw=4 ts=4: */
2/* fdformat.c - Low-level formats a floppy disk - Werner Almesberger */ 2/* fdformat.c - Low-level formats a floppy disk - Werner Almesberger */
3 3
4/* 1999-02-22 Arkadiusz Mi¶kiewicz <misiek@pld.ORG.PL> 4/* 5 July 2003 -- modified for Busybox by Erik Andersen
5 * - added Native Language Support
6 * 1999-03-20 Arnaldo Carvalho de Melo <acme@conectiva.com.br>
7 * - more i18n/nls translatable strings marked
8 *
9 * 5 July 2003 -- modified for Busybox by Erik Andersen
10 */ 5 */
11 6
12#include "libbb.h" 7#include "libbb.h"
@@ -45,8 +40,8 @@ struct format_descr {
45#define FDGETPRM _IOR(2, 0x04, struct floppy_struct) 40#define FDGETPRM _IOR(2, 0x04, struct floppy_struct)
46#define FD_FILL_BYTE 0xF6 /* format fill byte. */ 41#define FD_FILL_BYTE 0xF6 /* format fill byte. */
47 42
48int fdformat_main(int argc,char **argv); 43int fdformat_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
49int fdformat_main(int argc,char **argv) 44int fdformat_main(int argc, char **argv)
50{ 45{
51 int fd, n, cyl, read_bytes, verify; 46 int fd, n, cyl, read_bytes, verify;
52 unsigned char *data; 47 unsigned char *data;
@@ -116,7 +111,7 @@ int fdformat_main(int argc,char **argv)
116 /* Check backwards so we don't need a counter */ 111 /* Check backwards so we don't need a counter */
117 while (--read_bytes >= 0) { 112 while (--read_bytes >= 0) {
118 if (data[read_bytes] != FD_FILL_BYTE) { 113 if (data[read_bytes] != FD_FILL_BYTE) {
119 printf("bad data in cyl %d\nContinuing... ",cyl); 114 printf("bad data in cyl %d\nContinuing... ", cyl);
120 } 115 }
121 } 116 }
122 } 117 }
diff --git a/util-linux/fdisk.c b/util-linux/fdisk.c
index 9f30571e9..01c01bd24 100644
--- a/util-linux/fdisk.c
+++ b/util-linux/fdisk.c
@@ -2735,7 +2735,7 @@ unknown_command(int c)
2735} 2735}
2736#endif 2736#endif
2737 2737
2738int fdisk_main(int argc, char **argv); 2738int fdisk_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
2739int fdisk_main(int argc, char **argv) 2739int fdisk_main(int argc, char **argv)
2740{ 2740{
2741 char *str_b, *str_C, *str_H, *str_S; 2741 char *str_b, *str_C, *str_H, *str_S;
diff --git a/util-linux/freeramdisk.c b/util-linux/freeramdisk.c
index 4bd93781b..bde6afc0a 100644
--- a/util-linux/freeramdisk.c
+++ b/util-linux/freeramdisk.c
@@ -14,7 +14,7 @@
14/* From <linux/fd.h> */ 14/* From <linux/fd.h> */
15#define FDFLUSH _IO(2,0x4b) 15#define FDFLUSH _IO(2,0x4b)
16 16
17int freeramdisk_main(int argc, char **argv); 17int freeramdisk_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
18int freeramdisk_main(int argc, char **argv) 18int freeramdisk_main(int argc, char **argv)
19{ 19{
20 int fd; 20 int fd;
diff --git a/util-linux/fsck_minix.c b/util-linux/fsck_minix.c
index 5f92f3511..deb82f75b 100644
--- a/util-linux/fsck_minix.c
+++ b/util-linux/fsck_minix.c
@@ -1249,7 +1249,7 @@ static void check2(void)
1249void check2(void); 1249void check2(void);
1250#endif 1250#endif
1251 1251
1252int fsck_minix_main(int argc, char **argv); 1252int fsck_minix_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
1253int fsck_minix_main(int argc, char **argv) 1253int fsck_minix_main(int argc, char **argv)
1254{ 1254{
1255 struct termios tmp; 1255 struct termios tmp;
diff --git a/util-linux/getopt.c b/util-linux/getopt.c
index 4767d586c..061750e77 100644
--- a/util-linux/getopt.c
+++ b/util-linux/getopt.c
@@ -279,8 +279,8 @@ static const char getopt_longopts[] ALIGN1 =
279 ; 279 ;
280#endif 280#endif
281 281
282int getopt_main(int argc, char *argv[]); 282int getopt_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
283int getopt_main(int argc, char *argv[]) 283int getopt_main(int argc, char **argv)
284{ 284{
285 char *optstr = NULL; 285 char *optstr = NULL;
286 char *name = NULL; 286 char *name = NULL;
diff --git a/util-linux/hexdump.c b/util-linux/hexdump.c
index e294f19da..e6820ae8d 100644
--- a/util-linux/hexdump.c
+++ b/util-linux/hexdump.c
@@ -54,7 +54,7 @@ static const struct suffix_mult suffixes[] = {
54 { } 54 { }
55}; 55};
56 56
57int hexdump_main(int argc, char **argv); 57int hexdump_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
58int hexdump_main(int argc, char **argv) 58int hexdump_main(int argc, char **argv)
59{ 59{
60 const char *p; 60 const char *p;
diff --git a/util-linux/hwclock.c b/util-linux/hwclock.c
index 09b09eb6f..f91379bed 100644
--- a/util-linux/hwclock.c
+++ b/util-linux/hwclock.c
@@ -171,7 +171,7 @@ static int check_utc(void)
171#define HWCLOCK_OPT_SYSTOHC 0x10 171#define HWCLOCK_OPT_SYSTOHC 0x10
172#define HWCLOCK_OPT_RTCFILE 0x20 172#define HWCLOCK_OPT_RTCFILE 0x20
173 173
174int hwclock_main(int argc, char **argv); 174int hwclock_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
175int hwclock_main(int argc, char **argv) 175int hwclock_main(int argc, char **argv)
176{ 176{
177 unsigned opt; 177 unsigned opt;
diff --git a/util-linux/ipcrm.c b/util-linux/ipcrm.c
index f49d28ee2..a9400d174 100644
--- a/util-linux/ipcrm.c
+++ b/util-linux/ipcrm.c
@@ -76,7 +76,7 @@ static int remove_ids(type_id type, int argc, char **argv)
76#endif /* IPCRM_LEGACY */ 76#endif /* IPCRM_LEGACY */
77 77
78 78
79int ipcrm_main(int argc, char **argv); 79int ipcrm_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
80int ipcrm_main(int argc, char **argv) 80int ipcrm_main(int argc, char **argv)
81{ 81{
82 int c; 82 int c;
diff --git a/util-linux/ipcs.c b/util-linux/ipcs.c
index d5325902b..c7b46f589 100644
--- a/util-linux/ipcs.c
+++ b/util-linux/ipcs.c
@@ -558,7 +558,7 @@ static void print_sem(int semid)
558 bb_putchar('\n'); 558 bb_putchar('\n');
559} 559}
560 560
561int ipcs_main(int argc, char **argv); 561int ipcs_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
562int ipcs_main(int argc, char **argv) 562int ipcs_main(int argc, char **argv)
563{ 563{
564 int id = 0; 564 int id = 0;
diff --git a/util-linux/losetup.c b/util-linux/losetup.c
index c61af3d29..a9ecfd58b 100644
--- a/util-linux/losetup.c
+++ b/util-linux/losetup.c
@@ -11,7 +11,7 @@
11 11
12#include "libbb.h" 12#include "libbb.h"
13 13
14int losetup_main(int argc, char **argv); 14int losetup_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
15int losetup_main(int argc, char **argv) 15int losetup_main(int argc, char **argv)
16{ 16{
17 char dev[] = LOOP_NAME"0"; 17 char dev[] = LOOP_NAME"0";
diff --git a/util-linux/mdev.c b/util-linux/mdev.c
index 33dc5d38f..a9c146942 100644
--- a/util-linux/mdev.c
+++ b/util-linux/mdev.c
@@ -287,7 +287,7 @@ static void load_firmware(const char *const firmware, const char *const sysfs_pa
287 } 287 }
288} 288}
289 289
290int mdev_main(int argc, char **argv); 290int mdev_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
291int mdev_main(int argc, char **argv) 291int mdev_main(int argc, char **argv)
292{ 292{
293 char *action; 293 char *action;
diff --git a/util-linux/mkfs_minix.c b/util-linux/mkfs_minix.c
index 2b0697ae5..de9dde32b 100644
--- a/util-linux/mkfs_minix.c
+++ b/util-linux/mkfs_minix.c
@@ -603,7 +603,7 @@ static void setup_tables(void)
603 printf("Maxsize=%ld\n", (long)SB_MAXSIZE); 603 printf("Maxsize=%ld\n", (long)SB_MAXSIZE);
604} 604}
605 605
606int mkfs_minix_main(int argc, char **argv); 606int mkfs_minix_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
607int mkfs_minix_main(int argc, char **argv) 607int mkfs_minix_main(int argc, char **argv)
608{ 608{
609 struct mntent *mp; 609 struct mntent *mp;
diff --git a/util-linux/mkswap.c b/util-linux/mkswap.c
index 88f1fbb03..af4cc10f7 100644
--- a/util-linux/mkswap.c
+++ b/util-linux/mkswap.c
@@ -8,7 +8,7 @@
8 8
9#include "libbb.h" 9#include "libbb.h"
10 10
11int mkswap_main(int argc, char **argv); 11int mkswap_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
12int mkswap_main(int argc, char **argv) 12int mkswap_main(int argc, char **argv)
13{ 13{
14 int fd, pagesize; 14 int fd, pagesize;
diff --git a/util-linux/more.c b/util-linux/more.c
index 0a21a9afa..ee559b102 100644
--- a/util-linux/more.c
+++ b/util-linux/more.c
@@ -52,7 +52,7 @@ static void gotsig(int sig)
52 52
53#define CONVERTED_TAB_SIZE 8 53#define CONVERTED_TAB_SIZE 8
54 54
55int more_main(int argc, char **argv); 55int more_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
56int more_main(int argc, char **argv) 56int more_main(int argc, char **argv)
57{ 57{
58 int c = c; /* for gcc */ 58 int c = c; /* for gcc */
diff --git a/util-linux/mount.c b/util-linux/mount.c
index 10ada5426..7c58aefb9 100644
--- a/util-linux/mount.c
+++ b/util-linux/mount.c
@@ -1559,7 +1559,7 @@ static int singlemount(struct mntent *mp, int ignore_busy)
1559 1559
1560static const char must_be_root[] ALIGN1 = "you must be root"; 1560static const char must_be_root[] ALIGN1 = "you must be root";
1561 1561
1562int mount_main(int argc, char **argv); 1562int mount_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
1563int mount_main(int argc, char **argv) 1563int mount_main(int argc, char **argv)
1564{ 1564{
1565 enum { OPT_ALL = 0x10 }; 1565 enum { OPT_ALL = 0x10 };
diff --git a/util-linux/pivot_root.c b/util-linux/pivot_root.c
index 929ed30db..28af00cc1 100644
--- a/util-linux/pivot_root.c
+++ b/util-linux/pivot_root.c
@@ -12,7 +12,7 @@
12 12
13extern int pivot_root(const char * new_root,const char * put_old); 13extern int pivot_root(const char * new_root,const char * put_old);
14 14
15int pivot_root_main(int argc, char **argv); 15int pivot_root_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
16int pivot_root_main(int argc, char **argv) 16int pivot_root_main(int argc, char **argv)
17{ 17{
18 if (argc != 3) 18 if (argc != 3)
diff --git a/util-linux/rdate.c b/util-linux/rdate.c
index 4387f04de..150efbec4 100644
--- a/util-linux/rdate.c
+++ b/util-linux/rdate.c
@@ -42,7 +42,7 @@ static time_t askremotedate(const char *host)
42 return ntohl(nett) - RFC_868_BIAS; 42 return ntohl(nett) - RFC_868_BIAS;
43} 43}
44 44
45int rdate_main(int argc, char **argv); 45int rdate_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
46int rdate_main(int argc, char **argv) 46int rdate_main(int argc, char **argv)
47{ 47{
48 time_t remote_time; 48 time_t remote_time;
diff --git a/util-linux/readprofile.c b/util-linux/readprofile.c
index 152137654..dbe7c7171 100644
--- a/util-linux/readprofile.c
+++ b/util-linux/readprofile.c
@@ -41,7 +41,7 @@
41static const char defaultmap[] ALIGN1 = "/boot/System.map"; 41static const char defaultmap[] ALIGN1 = "/boot/System.map";
42static const char defaultpro[] ALIGN1 = "/proc/profile"; 42static const char defaultpro[] ALIGN1 = "/proc/profile";
43 43
44int readprofile_main(int argc, char **argv); 44int readprofile_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
45int readprofile_main(int argc, char **argv) 45int readprofile_main(int argc, char **argv)
46{ 46{
47 FILE *map; 47 FILE *map;
diff --git a/util-linux/setarch.c b/util-linux/setarch.c
index 08294e55c..dbc02de5e 100644
--- a/util-linux/setarch.c
+++ b/util-linux/setarch.c
@@ -11,7 +11,7 @@
11 11
12#include "libbb.h" 12#include "libbb.h"
13 13
14int setarch_main(int ATTRIBUTE_UNUSED argc, char **argv); 14int setarch_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
15int setarch_main(int ATTRIBUTE_UNUSED argc, char **argv) 15int setarch_main(int ATTRIBUTE_UNUSED argc, char **argv)
16{ 16{
17 int pers = -1; 17 int pers = -1;
diff --git a/util-linux/swaponoff.c b/util-linux/swaponoff.c
index db43aa52a..6858d2619 100644
--- a/util-linux/swaponoff.c
+++ b/util-linux/swaponoff.c
@@ -58,7 +58,7 @@ static int do_em_all(void)
58 return err; 58 return err;
59} 59}
60 60
61int swap_on_off_main(int argc, char **argv); 61int swap_on_off_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
62int swap_on_off_main(int argc, char **argv) 62int swap_on_off_main(int argc, char **argv)
63{ 63{
64 int ret; 64 int ret;
diff --git a/util-linux/switch_root.c b/util-linux/switch_root.c
index e4e9e21ad..700f7997e 100644
--- a/util-linux/switch_root.c
+++ b/util-linux/switch_root.c
@@ -64,7 +64,7 @@ static void delete_contents(const char *directory)
64 } else unlink(directory); 64 } else unlink(directory);
65} 65}
66 66
67int switch_root_main(int argc, char **argv); 67int switch_root_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
68int switch_root_main(int argc, char **argv) 68int switch_root_main(int argc, char **argv)
69{ 69{
70 char *newroot, *console = NULL; 70 char *newroot, *console = NULL;
diff --git a/util-linux/umount.c b/util-linux/umount.c
index c57a49ef4..17d88b388 100644
--- a/util-linux/umount.c
+++ b/util-linux/umount.c
@@ -21,7 +21,7 @@
21#define OPT_REMOUNT (1 << 4) 21#define OPT_REMOUNT (1 << 4)
22#define OPT_ALL (ENABLE_FEATURE_UMOUNT_ALL ? (1 << 5) : 0) 22#define OPT_ALL (ENABLE_FEATURE_UMOUNT_ALL ? (1 << 5) : 0)
23 23
24int umount_main(int argc, char **argv); 24int umount_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
25int umount_main(int argc, char **argv) 25int umount_main(int argc, char **argv)
26{ 26{
27 int doForce; 27 int doForce;