add -fvisibility=hidden to CC flags, mark XXX_main functions

EXTERNALLY_VISIBLE. 5% size reduction of libbusybox.so
This commit is contained in:
Denis Vlasenko 2007-10-11 10:05:36 +00:00
parent 8d82cf72c9
commit 9b49a5ed85
260 changed files with 325 additions and 307 deletions

View File

@ -56,10 +56,13 @@ ifeq ($(CONFIG_DEBUG),y)
CFLAGS += $(call cc-option,-g) CFLAGS += $(call cc-option,-g)
endif endif
ifeq ($(CONFIG_BUILD_LIBBUSYBOX),y)
# on i386: 14% smaller libbusybox.so # on i386: 14% smaller libbusybox.so
# (code itself is 9% bigger, we save on relocs/PLT/GOT) # (code itself is 9% bigger, we save on relocs/PLT/GOT)
ifeq ($(CONFIG_BUILD_LIBBUSYBOX),y)
CFLAGS += -fpic CFLAGS += -fpic
# and another 4% reduction of libbusybox.so:
# (external entry points must be marked EXTERNALLY_VISIBLE)
CFLAGS += $(call cc-option,-fvisibility=hidden)
endif endif
ifeq ($(CONFIG_STATIC),y) ifeq ($(CONFIG_STATIC),y)

View File

@ -24,6 +24,6 @@
#if ENABLE_BUILD_LIBBUSYBOX #if ENABLE_BUILD_LIBBUSYBOX
int main(int argc, char **argv) int main(int argc, char **argv)
{ {
return libbusybox_main(argc, argv); return lbb_main(argc, argv);
} }
#endif #endif

View File

@ -37,7 +37,7 @@ static void header_verbose_list_ar(const file_header_t *file_header)
#define AR_OPT_CREATE 0x20 #define AR_OPT_CREATE 0x20
#define AR_OPT_INSERT 0x40 #define AR_OPT_INSERT 0x40
int ar_main(int argc, char **argv); int ar_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
int ar_main(int argc, char **argv) int ar_main(int argc, char **argv)
{ {
static const char msg_unsupported_err[] ALIGN1 = static const char msg_unsupported_err[] ALIGN1 =

View File

@ -158,7 +158,7 @@ USE_DESKTOP(long long) int unpack_bunzip2(void)
return unpack_bz2_stream(STDIN_FILENO, STDOUT_FILENO); return unpack_bz2_stream(STDIN_FILENO, STDOUT_FILENO);
} }
int bunzip2_main(int argc, char **argv); int bunzip2_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
int bunzip2_main(int argc, char **argv) int bunzip2_main(int argc, char **argv)
{ {
getopt32(argv, "cf"); getopt32(argv, "cf");
@ -256,7 +256,7 @@ USE_DESKTOP(long long) int unpack_gunzip(void)
return status; return status;
} }
int gunzip_main(int argc, char **argv); int gunzip_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
int gunzip_main(int argc, char **argv) int gunzip_main(int argc, char **argv)
{ {
getopt32(argv, "cfvdt"); getopt32(argv, "cfvdt");
@ -294,7 +294,7 @@ USE_DESKTOP(long long) int unpack_unlzma(void)
return unpack_lzma_stream(STDIN_FILENO, STDOUT_FILENO); return unpack_lzma_stream(STDIN_FILENO, STDOUT_FILENO);
} }
int unlzma_main(int argc, char **argv); int unlzma_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
int unlzma_main(int argc, char **argv) int unlzma_main(int argc, char **argv)
{ {
getopt32(argv, "cf"); getopt32(argv, "cf");
@ -336,7 +336,7 @@ USE_DESKTOP(long long) int unpack_uncompress(void)
return status; return status;
} }
int uncompress_main(int argc, char **argv); int uncompress_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
int uncompress_main(int argc, char **argv) int uncompress_main(int argc, char **argv)
{ {
getopt32(argv, "cf"); getopt32(argv, "cf");

View File

@ -22,7 +22,7 @@
#define CPIO_OPT_CREATE_LEADING_DIR 0x20 #define CPIO_OPT_CREATE_LEADING_DIR 0x20
#define CPIO_OPT_PRESERVE_MTIME 0x40 #define CPIO_OPT_PRESERVE_MTIME 0x40
int cpio_main(int argc, char **argv); int cpio_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
int cpio_main(int argc, char **argv) int cpio_main(int argc, char **argv)
{ {
archive_handle_t *archive_handle; archive_handle_t *archive_handle;

View File

@ -1557,7 +1557,7 @@ static void configure_package(deb_file_t *deb_file)
set_status(status_num, "installed", 3); set_status(status_num, "installed", 3);
} }
int dpkg_main(int argc, char **argv); int dpkg_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
int dpkg_main(int argc, char **argv) int dpkg_main(int argc, char **argv)
{ {
deb_file_t **deb_file = NULL; deb_file_t **deb_file = NULL;

View File

@ -13,7 +13,7 @@
#define DPKG_DEB_OPT_EXTRACT 8 #define DPKG_DEB_OPT_EXTRACT 8
#define DPKG_DEB_OPT_EXTRACT_VERBOSE 16 #define DPKG_DEB_OPT_EXTRACT_VERBOSE 16
int dpkg_deb_main(int argc, char **argv); int dpkg_deb_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
int dpkg_deb_main(int argc, char **argv) int dpkg_deb_main(int argc, char **argv)
{ {
archive_handle_t *ar_archive; archive_handle_t *ar_archive;

View File

@ -2025,7 +2025,7 @@ USE_DESKTOP(long long) int pack_gzip(void)
return 0; return 0;
} }
int gzip_main(int argc, char **argv); int gzip_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
int gzip_main(int argc, char **argv) int gzip_main(int argc, char **argv)
{ {
unsigned opt; unsigned opt;

View File

@ -80,7 +80,7 @@ static void fileaction_dobackup(char *filename, int fileref);
static void fileaction_setowngrp(char *filename, int fileref); static void fileaction_setowngrp(char *filename, int fileref);
static void loop_through_files(int filetag, void (*fileaction)(char *filename, int fileref)); static void loop_through_files(int filetag, void (*fileaction)(char *filename, int fileref));
int rpm_main(int argc, char **argv); int rpm_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
int rpm_main(int argc, char **argv) int rpm_main(int argc, char **argv)
{ {
int opt = 0, func = 0, rpm_fd, offset; int opt = 0, func = 0, rpm_fd, offset;

View File

@ -49,7 +49,7 @@ static void skip_header(int rpm_fd)
} }
/* No getopt required */ /* No getopt required */
int rpm2cpio_main(int argc, char **argv); int rpm2cpio_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
int rpm2cpio_main(int argc, char **argv) int rpm2cpio_main(int argc, char **argv)
{ {
struct rpm_lead lead; struct rpm_lead lead;

View File

@ -769,7 +769,7 @@ static const char tar_longopts[] ALIGN1 =
; ;
#endif #endif
int tar_main(int argc, char **argv); int tar_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
int tar_main(int argc, char **argv) int tar_main(int argc, char **argv)
{ {
char (*get_header_ptr)(archive_handle_t *) = get_header_tar; char (*get_header_ptr)(archive_handle_t *) = get_header_tar;

View File

@ -93,7 +93,7 @@ static int unzip_extract(zip_header_t *zip_header, int src_fd, int dst_fd)
return 0; return 0;
} }
int unzip_main(int argc, char **argv); int unzip_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
int unzip_main(int argc, char **argv) int unzip_main(int argc, char **argv)
{ {
zip_header_t zip_header; zip_header_t zip_header;

View File

@ -15,7 +15,7 @@ enum {
VT_WAITACTIVE = 0x5607 /* wait for vt active */ VT_WAITACTIVE = 0x5607 /* wait for vt active */
}; };
int chvt_main(int argc, char **argv); int chvt_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
int chvt_main(int argc, char **argv) int chvt_main(int argc, char **argv)
{ {
int fd, num; int fd, num;

View File

@ -12,7 +12,7 @@
#include "libbb.h" #include "libbb.h"
int clear_main(int argc, char **argv); int clear_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
int clear_main(int argc, char **argv) int clear_main(int argc, char **argv)
{ {
return printf("\033[H\033[J") != 6; return printf("\033[H\033[J") != 6;

View File

@ -15,7 +15,7 @@
/* From <linux/vt.h> */ /* From <linux/vt.h> */
enum { VT_DISALLOCATE = 0x5608 }; /* free memory associated to vt */ enum { VT_DISALLOCATE = 0x5608 }; /* free memory associated to vt */
int deallocvt_main(int argc, char **argv); int deallocvt_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
int deallocvt_main(int argc, char **argv) int deallocvt_main(int argc, char **argv)
{ {
/* num = 0 deallocate all unused consoles */ /* num = 0 deallocate all unused consoles */

View File

@ -22,7 +22,7 @@ struct kbentry {
#define NR_KEYS 128 #define NR_KEYS 128
#define MAX_NR_KEYMAPS 256 #define MAX_NR_KEYMAPS 256
int dumpkmap_main(int argc, char **argv); int dumpkmap_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
int dumpkmap_main(int argc, char **argv) int dumpkmap_main(int argc, char **argv)
{ {
struct kbentry ke; struct kbentry ke;

View File

@ -166,7 +166,7 @@ static void loadnewfont(int fd)
do_loadfont(fd, inbuf + offset, unit, 256); do_loadfont(fd, inbuf + offset, unit, 256);
} }
int loadfont_main(int argc, char **argv); int loadfont_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
int loadfont_main(int argc, char **argv) int loadfont_main(int argc, char **argv)
{ {
int fd; int fd;

View File

@ -25,7 +25,7 @@ struct kbentry {
#define NR_KEYS 128 #define NR_KEYS 128
#define MAX_NR_KEYMAPS 256 #define MAX_NR_KEYMAPS 256
int loadkmap_main(int argc, char **argv); int loadkmap_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
int loadkmap_main(int argc, char **argv) int loadkmap_main(int argc, char **argv)
{ {
struct kbentry ke; struct kbentry ke;

View File

@ -12,7 +12,7 @@
#include "libbb.h" #include "libbb.h"
int openvt_main(int argc, char **argv); int openvt_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
int openvt_main(int argc, char **argv) int openvt_main(int argc, char **argv)
{ {
char vtname[sizeof(VC_FORMAT) + 2]; char vtname[sizeof(VC_FORMAT) + 2];

View File

@ -12,7 +12,7 @@
#include "libbb.h" #include "libbb.h"
int reset_main(int argc, char **argv); int reset_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
int reset_main(int argc, char **argv) int reset_main(int argc, char **argv)
{ {
if (isatty(1)) { if (isatty(1)) {

View File

@ -20,7 +20,7 @@ onintr(int sig ATTRIBUTE_UNUSED)
exit(1); exit(1);
} }
int resize_main(int argc, char **argv); int resize_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
int resize_main(int argc, char **argv) int resize_main(int argc, char **argv)
{ {
struct termios new; struct termios new;

View File

@ -18,7 +18,7 @@ static const char setconsole_longopts[] ALIGN1 =
#define OPT_SETCONS_RESET 1 #define OPT_SETCONS_RESET 1
int setconsole_main(int argc, char **argv); int setconsole_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
int setconsole_main(int argc, char **argv) int setconsole_main(int argc, char **argv)
{ {
unsigned long flags; unsigned long flags;

View File

@ -20,8 +20,8 @@ enum {
KDSETKEYCODE = 0x4B4D /* write kernel keycode table entry */ KDSETKEYCODE = 0x4B4D /* write kernel keycode table entry */
}; };
int setkeycodes_main(int argc, char** argv); int setkeycodes_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
int setkeycodes_main(int argc, char** argv) int setkeycodes_main(int argc, char **argv)
{ {
int fd, sc; int fd, sc;
struct kbkeycode a; struct kbkeycode a;

View File

@ -11,7 +11,7 @@
#include "libbb.h" #include "libbb.h"
int setlogcons_main(int argc, char **argv); int setlogcons_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
int setlogcons_main(int argc, char **argv) int setlogcons_main(int argc, char **argv)
{ {
struct { struct {

View File

@ -24,7 +24,7 @@
/* This is a NOFORK applet. Be very careful! */ /* This is a NOFORK applet. Be very careful! */
int basename_main(int argc, char **argv); int basename_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
int basename_main(int argc, char **argv) int basename_main(int argc, char **argv)
{ {
size_t m, n; size_t m, n;

View File

@ -75,7 +75,7 @@ static char *build_row(char *p, unsigned *dp);
#define J_WEEK_LEN (WEEK_LEN + 7) #define J_WEEK_LEN (WEEK_LEN + 7)
#define HEAD_SEP 2 /* spaces between day headings */ #define HEAD_SEP 2 /* spaces between day headings */
int cal_main(int argc, char **argv); int cal_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
int cal_main(int argc, char **argv) int cal_main(int argc, char **argv)
{ {
struct tm *local_time; struct tm *local_time;

View File

@ -43,7 +43,7 @@ int bb_cat(char **argv)
return retval; return retval;
} }
int cat_main(int argc, char **argv); int cat_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
int cat_main(int argc, char **argv) int cat_main(int argc, char **argv)
{ {
getopt32(argv, "u"); getopt32(argv, "u");

View File

@ -12,7 +12,7 @@
#include "libbb.h" #include "libbb.h"
int catv_main(int argc, char **argv); int catv_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
int catv_main(int argc, char **argv) int catv_main(int argc, char **argv)
{ {
int retval = EXIT_SUCCESS; int retval = EXIT_SUCCESS;

View File

@ -16,7 +16,7 @@
/* This is a NOEXEC applet. Be very careful! */ /* This is a NOEXEC applet. Be very careful! */
int chgrp_main(int argc, char **argv); int chgrp_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
int chgrp_main(int argc, char **argv) int chgrp_main(int argc, char **argv)
{ {
/* "chgrp [opts] abc file(s)" == "chown [opts] :abc file(s)" */ /* "chgrp [opts] abc file(s)" == "chown [opts] :abc file(s)" */

View File

@ -67,7 +67,7 @@ static int fileAction(const char *fileName, struct stat *statbuf, void* param, i
return FALSE; return FALSE;
} }
int chmod_main(int argc, char **argv); int chmod_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
int chmod_main(int argc, char **argv) int chmod_main(int argc, char **argv)
{ {
int retval = EXIT_SUCCESS; int retval = EXIT_SUCCESS;

View File

@ -61,7 +61,7 @@ static int fileAction(const char *fileName, struct stat *statbuf,
return FALSE; return FALSE;
} }
int chown_main(int argc, char **argv); int chown_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
int chown_main(int argc, char **argv) int chown_main(int argc, char **argv)
{ {
int retval = EXIT_SUCCESS; int retval = EXIT_SUCCESS;

View File

@ -11,7 +11,7 @@
#include "libbb.h" #include "libbb.h"
int chroot_main(int argc, char **argv); int chroot_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
int chroot_main(int argc, char **argv) int chroot_main(int argc, char **argv)
{ {
if (argc < 2) { if (argc < 2) {

View File

@ -8,7 +8,7 @@
#include "libbb.h" #include "libbb.h"
int cksum_main(int argc, char **argv); int cksum_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
int cksum_main(int argc, char **argv) int cksum_main(int argc, char **argv)
{ {
uint32_t *crc32_table = crc32_filltable(NULL, 1); uint32_t *crc32_table = crc32_filltable(NULL, 1);

View File

@ -35,7 +35,7 @@ static void writeline(char *line, int class, int flags)
fputs(line, stdout); fputs(line, stdout);
} }
int comm_main(int argc, char **argv); int comm_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
int comm_main(int argc, char **argv) int comm_main(int argc, char **argv)
{ {
#define LINE_LEN 100 #define LINE_LEN 100

View File

@ -21,7 +21,7 @@
/* This is a NOEXEC applet. Be very careful! */ /* This is a NOEXEC applet. Be very careful! */
int cp_main(int argc, char **argv); int cp_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
int cp_main(int argc, char **argv) int cp_main(int argc, char **argv)
{ {
struct stat source_stat; struct stat source_stat;

View File

@ -165,7 +165,7 @@ static void cut_file(FILE * file)
static const char _op_on_field[] ALIGN1 = " only when operating on fields"; static const char _op_on_field[] ALIGN1 = " only when operating on fields";
int cut_main(int argc, char **argv); int cut_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
int cut_main(int argc, char **argv) int cut_main(int argc, char **argv)
{ {
char *sopt, *ltok; char *sopt, *ltok;

View File

@ -38,7 +38,7 @@ static void maybe_set_utc(int opt)
putenv((char*)"TZ=UTC0"); putenv((char*)"TZ=UTC0");
} }
int date_main(int argc, char **argv); int date_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
int date_main(int argc, char **argv) int date_main(int argc, char **argv)
{ {
time_t tm; time_t tm;

View File

@ -73,7 +73,7 @@ static bool write_and_stats(int fd, const void *buf, size_t len, size_t obs,
#define XATOU_SFX xatoul_sfx #define XATOU_SFX xatoul_sfx
#endif #endif
int dd_main(int argc, char **argv); int dd_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
int dd_main(int argc, char **argv) int dd_main(int argc, char **argv)
{ {
enum { enum {

View File

@ -29,7 +29,7 @@ static unsigned long kscale(unsigned long b, unsigned long bs)
} }
#endif #endif
int df_main(int argc, char **argv); int df_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
int df_main(int argc, char **argv) int df_main(int argc, char **argv)
{ {
unsigned long blocks_used; unsigned long blocks_used;

View File

@ -14,7 +14,7 @@
/* This is a NOFORK applet. Be very careful! */ /* This is a NOFORK applet. Be very careful! */
int dirname_main(int argc, char **argv); int dirname_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
int dirname_main(int argc, char **argv) int dirname_main(int argc, char **argv)
{ {
if (argc != 2) { if (argc != 2) {

View File

@ -78,7 +78,7 @@ static int convert(char *fn, int conv_type)
return 0; return 0;
} }
int dos2unix_main(int argc, char **argv); int dos2unix_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
int dos2unix_main(int argc, char **argv) int dos2unix_main(int argc, char **argv)
{ {
int o, conv_type; int o, conv_type;

View File

@ -140,7 +140,7 @@ static unsigned long du(const char *filename)
return sum; return sum;
} }
int du_main(int argc, char **argv); int du_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
int du_main(int argc, char **argv) int du_main(int argc, char **argv)
{ {
unsigned long total; unsigned long total;

View File

@ -119,8 +119,8 @@ int bb_echo(char **argv)
/* This is a NOFORK applet. Be very careful! */ /* This is a NOFORK applet. Be very careful! */
int echo_main(int argc, char** argv); int echo_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
int echo_main(int argc, char** argv) int echo_main(int argc, char **argv)
{ {
return bb_echo(argv); return bb_echo(argv);
} }

View File

@ -41,8 +41,8 @@ static const char env_longopts[] ALIGN1 =
; ;
#endif #endif
int env_main(int argc, char** argv); int env_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
int env_main(int argc, char** argv) int env_main(int argc, char **argv)
{ {
/* cleanenv was static - why? */ /* cleanenv was static - why? */
char *cleanenv[1]; char *cleanenv[1];

View File

@ -125,7 +125,7 @@ static void unexpand(FILE *file, unsigned int tab_size, unsigned opt)
} }
#endif #endif
int expand_main(int argc, char **argv); int expand_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
int expand_main(int argc, char **argv) int expand_main(int argc, char **argv)
{ {
/* Default 8 spaces for 1 tab */ /* Default 8 spaces for 1 tab */

View File

@ -483,7 +483,7 @@ static VALUE *eval(void)
return l; return l;
} }
int expr_main(int argc, char **argv); int expr_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
int expr_main(int argc, char **argv) int expr_main(int argc, char **argv)
{ {
VALUE *v; VALUE *v;

View File

@ -14,7 +14,7 @@
/* This is a NOFORK applet. Be very careful! */ /* This is a NOFORK applet. Be very careful! */
int false_main(int ATTRIBUTE_UNUSED argc, char ATTRIBUTE_UNUSED **argv); int false_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
int false_main(int ATTRIBUTE_UNUSED argc, char ATTRIBUTE_UNUSED **argv) int false_main(int ATTRIBUTE_UNUSED argc, char ATTRIBUTE_UNUSED **argv)
{ {
return EXIT_FAILURE; return EXIT_FAILURE;

View File

@ -38,7 +38,7 @@ static int adjust_column(int column, char c)
return column; return column;
} }
int fold_main(int argc, char **argv); int fold_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
int fold_main(int argc, char **argv) int fold_main(int argc, char **argv)
{ {
char *line_out = NULL; char *line_out = NULL;

View File

@ -31,7 +31,7 @@ static const struct suffix_mult head_suffixes[] = {
static const char header_fmt_str[] ALIGN1 = "\n==> %s <==\n"; static const char header_fmt_str[] ALIGN1 = "\n==> %s <==\n";
int head_main(int argc, char **argv); int head_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
int head_main(int argc, char **argv) int head_main(int argc, char **argv)
{ {
unsigned long count = 10; unsigned long count = 10;

View File

@ -13,7 +13,7 @@
/* This is a NOFORK applet. Be very careful! */ /* This is a NOFORK applet. Be very careful! */
int hostid_main(int argc, char ATTRIBUTE_UNUSED **argv); int hostid_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
int hostid_main(int argc, char ATTRIBUTE_UNUSED **argv) int hostid_main(int argc, char ATTRIBUTE_UNUSED **argv)
{ {
if (argc > 1) { if (argc > 1) {

View File

@ -36,7 +36,7 @@ static int printf_full(unsigned int id, const char *arg, const char prefix)
return status; return status;
} }
int id_main(int argc, char **argv); int id_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
int id_main(int argc, char **argv) int id_main(int argc, char **argv)
{ {
struct passwd *p; struct passwd *p;

View File

@ -66,7 +66,7 @@ static void setdefaultfilecon(const char *path)
#endif #endif
int install_main(int argc, char **argv); int install_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
int install_main(int argc, char **argv) int install_main(int argc, char **argv)
{ {
struct stat statbuf; struct stat statbuf;

View File

@ -6,7 +6,7 @@
/* This is a NOFORK applet. Be very careful! */ /* This is a NOFORK applet. Be very careful! */
int length_main(int argc, char **argv); int length_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
int length_main(int argc, char **argv) int length_main(int argc, char **argv)
{ {
if ((argc != 2) || (**(++argv) == '-')) { if ((argc != 2) || (**(++argv) == '-')) {

View File

@ -22,7 +22,7 @@
#define LN_BACKUP 8 #define LN_BACKUP 8
#define LN_SUFFIX 16 #define LN_SUFFIX 16
int ln_main(int argc, char **argv); int ln_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
int ln_main(int argc, char **argv) int ln_main(int argc, char **argv)
{ {
int status = EXIT_SUCCESS; int status = EXIT_SUCCESS;

View File

@ -24,7 +24,7 @@
/* This is a NOFORK applet. Be very careful! */ /* This is a NOFORK applet. Be very careful! */
int logname_main(int argc, char ATTRIBUTE_UNUSED **argv); int logname_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
int logname_main(int argc, char ATTRIBUTE_UNUSED **argv) int logname_main(int argc, char ATTRIBUTE_UNUSED **argv)
{ {
char buf[128]; char buf[128];

View File

@ -783,7 +783,7 @@ static const unsigned opt_flags[] = {
/* THIS IS A "SAFE" APPLET, main() MAY BE CALLED INTERNALLY FROM SHELL */ /* THIS IS A "SAFE" APPLET, main() MAY BE CALLED INTERNALLY FROM SHELL */
/* BE CAREFUL! */ /* BE CAREFUL! */
int ls_main(int argc, char **argv); int ls_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
int ls_main(int argc, char **argv) int ls_main(int argc, char **argv)
{ {
struct dnode **dnd; struct dnode **dnd;

View File

@ -77,7 +77,7 @@ static uint8_t *hash_file(const char *filename, hash_algo_t hash_algo)
return hash_value; return hash_value;
} }
int md5_sha1_sum_main(int argc, char **argv); int md5_sha1_sum_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
int md5_sha1_sum_main(int argc, char **argv) int md5_sha1_sum_main(int argc, char **argv)
{ {
int return_value = EXIT_SUCCESS; int return_value = EXIT_SUCCESS;

View File

@ -34,7 +34,7 @@ static const char mkdir_longopts[] ALIGN1 =
; ;
#endif #endif
int mkdir_main(int argc, char **argv); int mkdir_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
int mkdir_main(int argc, char **argv) int mkdir_main(int argc, char **argv)
{ {
mode_t mode = (mode_t)(-1); mode_t mode = (mode_t)(-1);

View File

@ -13,7 +13,7 @@
#include "libbb.h" #include "libbb.h"
#include "libcoreutils/coreutils.h" #include "libcoreutils/coreutils.h"
int mkfifo_main(int argc, char **argv); int mkfifo_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
int mkfifo_main(int argc, char **argv) int mkfifo_main(int argc, char **argv)
{ {
mode_t mode; mode_t mode;

View File

@ -17,7 +17,7 @@
static const char modes_chars[] ALIGN1 = { 'p', 'c', 'u', 'b', 0, 1, 1, 2 }; static const char modes_chars[] ALIGN1 = { 'p', 'c', 'u', 'b', 0, 1, 1, 2 };
static const mode_t modes_cubp[] = { S_IFIFO, S_IFCHR, S_IFBLK }; static const mode_t modes_cubp[] = { S_IFIFO, S_IFCHR, S_IFBLK };
int mknod_main(int argc, char **argv); int mknod_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
int mknod_main(int argc, char **argv) int mknod_main(int argc, char **argv)
{ {
mode_t mode; mode_t mode;

View File

@ -33,7 +33,7 @@ static const char mv_longopts[] ALIGN1 =
static const char fmt[] ALIGN1 = static const char fmt[] ALIGN1 =
"cannot overwrite %sdirectory with %sdirectory"; "cannot overwrite %sdirectory with %sdirectory";
int mv_main(int argc, char **argv); int mv_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
int mv_main(int argc, char **argv) int mv_main(int argc, char **argv)
{ {
struct stat dest_stat; struct stat dest_stat;

View File

@ -10,7 +10,7 @@
#include <sys/resource.h> #include <sys/resource.h>
#include "libbb.h" #include "libbb.h"
int nice_main(int argc, char **argv); int nice_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
int nice_main(int argc, char **argv) int nice_main(int argc, char **argv)
{ {
int old_priority, adjustment; int old_priority, adjustment;

View File

@ -12,7 +12,7 @@
#include "libbb.h" #include "libbb.h"
int nohup_main(int argc, char **argv); int nohup_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
int nohup_main(int argc, char **argv) int nohup_main(int argc, char **argv)
{ {
int nullfd; int nullfd;

View File

@ -156,7 +156,7 @@ static const char od_o2si[] ALIGN1 = {
0xb, 1, 8, 9, 0xb, 1, 8, 9,
}; };
int od_main(int argc, char **argv); int od_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
int od_main(int argc, char **argv) int od_main(int argc, char **argv)
{ {
int ch; int ch;

View File

@ -1196,7 +1196,7 @@ dump_strings(void)
check_and_close(); check_and_close();
} }
int od_main(int argc, char **argv); int od_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
int od_main(int argc, char **argv) int od_main(int argc, char **argv)
{ {
static const struct suffix_mult bkm[] = { static const struct suffix_mult bkm[] = {

View File

@ -11,7 +11,7 @@
#include "libbb.h" #include "libbb.h"
extern char **environ; extern char **environ;
int printenv_main(int argc, char **argv); int printenv_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
int printenv_main(int argc, char **argv) int printenv_main(int argc, char **argv)
{ {
/* no variables specified, show whole env */ /* no variables specified, show whole env */

View File

@ -285,7 +285,7 @@ static int print_formatted(char *format, int argc, char **argv)
return save_argc - argc; return save_argc - argc;
} }
int printf_main(int argc, char **argv); int printf_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
int printf_main(int argc, char **argv) int printf_main(int argc, char **argv)
{ {
char *format; char *format;

View File

@ -11,7 +11,7 @@
/* This is a NOFORK applet. Be very careful! */ /* This is a NOFORK applet. Be very careful! */
int pwd_main(int argc, char **argv); int pwd_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
int pwd_main(int argc, char **argv) int pwd_main(int argc, char **argv)
{ {
char *buf; char *buf;

View File

@ -11,7 +11,7 @@
#include "libbb.h" #include "libbb.h"
int readlink_main(int argc, char **argv); int readlink_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
int readlink_main(int argc, char **argv) int readlink_main(int argc, char **argv)
{ {
char *buf; char *buf;

View File

@ -12,7 +12,7 @@
#include "libbb.h" #include "libbb.h"
int realpath_main(int argc, char **argv); int realpath_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
int realpath_main(int argc, char **argv) int realpath_main(int argc, char **argv)
{ {
int retval = EXIT_SUCCESS; int retval = EXIT_SUCCESS;

View File

@ -19,7 +19,7 @@
/* This is a NOFORK applet. Be very careful! */ /* This is a NOFORK applet. Be very careful! */
int rm_main(int argc, char **argv); int rm_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
int rm_main(int argc, char **argv) int rm_main(int argc, char **argv)
{ {
int status = 0; int status = 0;

View File

@ -16,7 +16,7 @@
/* This is a NOFORK applet. Be very careful! */ /* This is a NOFORK applet. Be very careful! */
int rmdir_main(int argc, char **argv); int rmdir_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
int rmdir_main(int argc, char **argv) int rmdir_main(int argc, char **argv)
{ {
int status = EXIT_SUCCESS; int status = EXIT_SUCCESS;

View File

@ -12,7 +12,7 @@
/* This is a NOFORK applet. Be very careful! */ /* This is a NOFORK applet. Be very careful! */
int seq_main(int argc, char **argv); int seq_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
int seq_main(int argc, char **argv) int seq_main(int argc, char **argv)
{ {
double last, increment, i; double last, increment, i;

View File

@ -33,7 +33,7 @@ static const struct suffix_mult sfx[] = {
}; };
#endif #endif
int sleep_main(int argc, char **argv); int sleep_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
int sleep_main(int argc, char **argv) int sleep_main(int argc, char **argv)
{ {
unsigned duration; unsigned duration;

View File

@ -274,7 +274,7 @@ static unsigned str2u(char **str)
} }
#endif #endif
int sort_main(int argc, char **argv); int sort_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
int sort_main(int argc, char **argv) int sort_main(int argc, char **argv)
{ {
FILE *fp, *outfile = stdout; FILE *fp, *outfile = stdout;

View File

@ -55,7 +55,7 @@ enum { READ_BUFFER_SIZE = COMMON_BUFSIZE - 1 };
#define SPLIT_OPT_b (1<<1) #define SPLIT_OPT_b (1<<1)
#define SPLIT_OPT_a (1<<2) #define SPLIT_OPT_a (1<<2)
int split_main(int argc, char **argv); int split_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
int split_main(int argc, char **argv) int split_main(int argc, char **argv)
{ {
unsigned suffix_len = 2; unsigned suffix_len = 2;

View File

@ -609,7 +609,7 @@ static bool do_stat(const char *filename, const char *format)
return 1; return 1;
} }
int stat_main(int argc, char **argv); int stat_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
int stat_main(int argc, char **argv) int stat_main(int argc, char **argv)
{ {
char *format = NULL; char *format = NULL;

View File

@ -911,7 +911,7 @@ static void set_control_char_or_die(const struct control_info *info,
#define STTY_verbose_output (1<<2) #define STTY_verbose_output (1<<2)
#define STTY_recoverable_output (1<<3) #define STTY_recoverable_output (1<<3)
#define STTY_noargs (1<<4) #define STTY_noargs (1<<4)
int stty_main(int argc, char **argv); int stty_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
int stty_main(int argc, char **argv) int stty_main(int argc, char **argv)
{ {
struct termios mode; struct termios mode;

View File

@ -74,7 +74,7 @@ static unsigned sum_file(const char *file, const unsigned type)
#undef buf #undef buf
} }
int sum_main(int argc, char **argv); int sum_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
int sum_main(int argc, char **argv) int sum_main(int argc, char **argv)
{ {
unsigned n; unsigned n;

View File

@ -13,7 +13,7 @@
/* This is a NOFORK applet. Be very careful! */ /* This is a NOFORK applet. Be very careful! */
int sync_main(int argc, char **argv); int sync_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
int sync_main(int argc, char **argv) int sync_main(int argc, char **argv)
{ {
bb_warn_ignoring_args(argc - 1); bb_warn_ignoring_args(argc - 1);

View File

@ -79,7 +79,7 @@ static unsigned eat_num(const char *p)
return xatou_sfx(p, tail_suffixes); return xatou_sfx(p, tail_suffixes);
} }
int tail_main(int argc, char **argv); int tail_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
int tail_main(int argc, char **argv) int tail_main(int argc, char **argv)
{ {
unsigned count = 10; unsigned count = 10;

View File

@ -13,7 +13,7 @@
#include "libbb.h" #include "libbb.h"
#include <signal.h> #include <signal.h>
int tee_main(int argc, char **argv); int tee_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
int tee_main(int argc, char **argv) int tee_main(int argc, char **argv)
{ {
const char *mode = "w\0a"; const char *mode = "w\0a";

View File

@ -21,7 +21,7 @@
/* This is a NOFORK applet. Be very careful! */ /* This is a NOFORK applet. Be very careful! */
int touch_main(int argc, char **argv); int touch_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
int touch_main(int argc, char **argv) int touch_main(int argc, char **argv)
{ {
int fd; int fd;

View File

@ -165,7 +165,7 @@ static int complement(char *buffer, int buffer_len)
return ix; return ix;
} }
int tr_main(int argc, char **argv); int tr_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
int tr_main(int argc, char **argv) int tr_main(int argc, char **argv)
{ {
unsigned char *ptr; unsigned char *ptr;

View File

@ -14,7 +14,7 @@
/* This is a NOFORK applet. Be very careful! */ /* This is a NOFORK applet. Be very careful! */
int true_main(int argc, char **argv); int true_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
int true_main(int argc, char **argv) int true_main(int argc, char **argv)
{ {
return EXIT_SUCCESS; return EXIT_SUCCESS;

View File

@ -12,7 +12,7 @@
#include "libbb.h" #include "libbb.h"
int tty_main(int argc, char **argv); int tty_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
int tty_main(int argc, char **argv) int tty_main(int argc, char **argv)
{ {
const char *s; const char *s;

View File

@ -48,7 +48,7 @@ static const unsigned short utsname_offset[] ALIGN2 = {
offsetof(uname_info_t,processor) offsetof(uname_info_t,processor)
}; };
int uname_main(int argc, char **argv); int uname_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
int uname_main(int argc, char **argv) int uname_main(int argc, char **argv)
{ {
uname_info_t uname_info; uname_info_t uname_info;

View File

@ -27,7 +27,7 @@ static FILE *xgetoptfile_uniq_s(char **argv, int read0write2)
return (read0write2) ? stdout : stdin; return (read0write2) ? stdout : stdin;
} }
int uniq_main(int argc, char **argv); int uniq_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
int uniq_main(int argc, char **argv) int uniq_main(int argc, char **argv)
{ {
FILE *in, *out; FILE *in, *out;

View File

@ -13,7 +13,7 @@
/* This is a NOFORK applet. Be very careful! */ /* This is a NOFORK applet. Be very careful! */
int usleep_main(int argc, char **argv); int usleep_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
int usleep_main(int argc, char **argv) int usleep_main(int argc, char **argv)
{ {
if (argc != 2) { if (argc != 2) {

View File

@ -126,7 +126,7 @@ static void read_base64(FILE *src_stream, FILE *dst_stream)
} }
} }
int uudecode_main(int argc, char **argv); int uudecode_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
int uudecode_main(int argc, char **argv) int uudecode_main(int argc, char **argv)
{ {
FILE *src_stream = stdin; FILE *src_stream = stdin;

View File

@ -15,7 +15,7 @@ enum {
DST_BUF_SIZE = 4 * ((SRC_BUF_SIZE + 2) / 3), DST_BUF_SIZE = 4 * ((SRC_BUF_SIZE + 2) / 3),
}; };
int uuencode_main(int argc, char **argv); int uuencode_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
int uuencode_main(int argc, char **argv) int uuencode_main(int argc, char **argv)
{ {
struct stat stat_buf; struct stat stat_buf;

View File

@ -68,7 +68,7 @@ enum {
WC_LENGTH = 3 WC_LENGTH = 3
}; };
int wc_main(int argc, char **argv); int wc_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
int wc_main(int argc, char **argv) int wc_main(int argc, char **argv)
{ {
FILE *fp; FILE *fp;

View File

@ -39,7 +39,7 @@ static void idle_string(char *str6, time_t t)
strcpy(str6, "old"); strcpy(str6, "old");
} }
int who_main(int argc, char **argv); int who_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
int who_main(int argc, char **argv) int who_main(int argc, char **argv)
{ {
char str6[6]; char str6[6];

View File

@ -13,7 +13,7 @@
/* This is a NOFORK applet. Be very careful! */ /* This is a NOFORK applet. Be very careful! */
int whoami_main(int argc, char **argv); int whoami_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
int whoami_main(int argc, char **argv) int whoami_main(int argc, char **argv)
{ {
if (argc > 1) if (argc > 1)

View File

@ -18,7 +18,7 @@
/* This is a NOFORK applet. Be very careful! */ /* This is a NOFORK applet. Be very careful! */
int yes_main(int argc, char **argv); int yes_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
int yes_main(int argc, char **argv) int yes_main(int argc, char **argv)
{ {
char **first_arg; char **first_arg;

View File

@ -11,7 +11,7 @@
#include "libbb.h" #include "libbb.h"
int mktemp_main(int argc, char **argv); int mktemp_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
int mktemp_main(int argc, char **argv) int mktemp_main(int argc, char **argv)
{ {
unsigned long flags = getopt32(argv, "dqt"); unsigned long flags = getopt32(argv, "dqt");

View File

@ -14,7 +14,7 @@
/* Read a block of data from stdin, write it to stdout. /* Read a block of data from stdin, write it to stdout.
* Activity is indicated by a '.' to stderr * Activity is indicated by a '.' to stderr
*/ */
int pipe_progress_main(int argc, char **argv); int pipe_progress_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
int pipe_progress_main(int argc, char **argv) int pipe_progress_main(int argc, char **argv)
{ {
RESERVE_CONFIG_BUFFER(buf, PIPE_PROGRESS_SIZE); RESERVE_CONFIG_BUFFER(buf, PIPE_PROGRESS_SIZE);

View File

@ -110,7 +110,7 @@ static const char runparts_longopts[] ALIGN1 =
; ;
#endif #endif
int run_parts_main(int argc, char **argv); int run_parts_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
int run_parts_main(int argc, char **argv) int run_parts_main(int argc, char **argv)
{ {
const char *umask_p = "22"; const char *umask_p = "22";

View File

@ -234,7 +234,7 @@ enum {
OPT_NICELEVEL = 0x4000 * ENABLE_FEATURE_START_STOP_DAEMON_FANCY, // -N OPT_NICELEVEL = 0x4000 * ENABLE_FEATURE_START_STOP_DAEMON_FANCY, // -N
}; };
int start_stop_daemon_main(int argc, char **argv); int start_stop_daemon_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
int start_stop_daemon_main(int argc, char **argv) int start_stop_daemon_main(int argc, char **argv)
{ {
unsigned opt; unsigned opt;

View File

@ -12,7 +12,7 @@
#include "libbb.h" #include "libbb.h"
int which_main(int argc, char **argv); int which_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
int which_main(int argc, char **argv) int which_main(int argc, char **argv)
{ {
int status = EXIT_SUCCESS; int status = EXIT_SUCCESS;

Some files were not shown because too many files have changed in this diff Show More