*: fix fallout from -Wunused-parameter
authorDenis Vlasenko <vda.linux@googlemail.com>
Mon, 17 Mar 2008 09:04:04 +0000 (09:04 -0000)
committerDenis Vlasenko <vda.linux@googlemail.com>
Mon, 17 Mar 2008 09:04:04 +0000 (09:04 -0000)
function                                             old     new   delta
bbunpack                                             358     366      +8
passwd_main                                         1070    1072      +2
handle_incoming_and_exit                            2651    2653      +2
getpty                                                88      86      -2
script_main                                          975     972      -3
inetd_main                                          2036    2033      -3
dname_enc                                            377     373      -4
make_new_session                                     474     462     -12
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 3/5 up/down: 12/-24)            Total: -12 bytes
   text    data     bss     dec     hex filename
 797429     658    7428  805515   c4a8b busybox_old
 797417     658    7428  805503   c4a7f busybox_unstripped

36 files changed:
applets/applets.c
archival/bzip2.c
archival/gzip.c
console-tools/reset.c
coreutils/stat.c
findutils/find.c
include/busybox.h
include/libbb.h
include/usage.h
init/halt.c
libbb/appletlib.c
libbb/getpty.c
libbb/lineedit.c
loginutils/login.c
miscutils/bbconfig.c
miscutils/chat.c
modutils/insmod.c
modutils/lsmod.c
networking/Kbuild
networking/ether-wake.c
networking/httpd.c
networking/ifupdown.c
networking/inetd.c
networking/nc.c
networking/sendmail.c
networking/telnetd.c
networking/traceroute.c
networking/udhcp/clientsocket.c
networking/wget.c
procps/ps.c
shell/ash.c
shell/cttyhack.c
util-linux/fbset.c
util-linux/fdisk.c
util-linux/script.c
util-linux/volume_id/get_devname.c

index 40c4824..fbe7666 100644 (file)
@@ -11,8 +11,8 @@
 #include "busybox.h"
 
 #if ENABLE_BUILD_LIBBUSYBOX
-int main(int argc, char **argv)
+int main(int argc ATTRIBUTE_UNUSED, char **argv)
 {
-       return lbb_main(argc, argv);
+       return lbb_main(argv);
 }
 #endif
index 7696336..eb570c4 100644 (file)
@@ -141,7 +141,7 @@ char* make_new_name_bzip2(char *filename)
 }
 
 int bzip2_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
-int bzip2_main(int argc, char **argv)
+int bzip2_main(int argc ATTRIBUTE_UNUSED, char **argv)
 {
        unsigned opt;
 
index 36502fa..a96d029 100644 (file)
@@ -2026,7 +2026,11 @@ USE_DESKTOP(long long) int pack_gzip(void)
 }
 
 int gzip_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
+#if ENABLE_GUNZIP
 int gzip_main(int argc, char **argv)
+#else
+int gzip_main(int argc ATTRIBUTE_UNUSED, char **argv)
+#endif
 {
        unsigned opt;
 
index f36ef54..a2bf44d 100644 (file)
@@ -40,7 +40,7 @@ int reset_main(int argc ATTRIBUTE_UNUSED, char **argv ATTRIBUTE_UNUSED)
 #if ENABLE_STTY
                return stty_main(2, (char**)args);
 #else
-               execvp("stty", args);
+               execvp("stty", (char**)args);
 #endif
        }
        return EXIT_SUCCESS;
index 5996268..b2b1913 100644 (file)
 #define OPT_DEREFERENCE (1 << 2)
 #define OPT_SELINUX     (1 << 3)
 
+#if ENABLE_FEATURE_STAT_FORMAT
+typedef bool (*statfunc_ptr)(const char *, const char *);
+#else
+typedef bool (*statfunc_ptr)(const char *);
+#endif
+
 static const char *file_type(const struct stat *st)
 {
        /* See POSIX 1003.1-2001 XCU Table 4-8 lines 17093-17107
@@ -338,8 +344,14 @@ static void print_it(const char *masterformat, const char *filename,
 #endif
 
 /* Stat the file system and print what we find.  */
+#if !ENABLE_FEATURE_STAT_FORMAT
+#define do_statfs(filename, format) do_statfs(filename)
+#endif
 static bool do_statfs(const char *filename, const char *format)
 {
+#if !ENABLE_FEATURE_STAT_FORMAT
+       const char *format;
+#endif
        struct statfs statfsbuf;
 #if ENABLE_SELINUX
        security_context_t scontext = NULL;
@@ -447,6 +459,9 @@ static bool do_statfs(const char *filename, const char *format)
 }
 
 /* stat the file and print what we find */
+#if !ENABLE_FEATURE_STAT_FORMAT
+#define do_stat(filename, format) do_stat(filename)
+#endif
 static bool do_stat(const char *filename, const char *format)
 {
        struct stat statbuf;
@@ -612,10 +627,10 @@ static bool do_stat(const char *filename, const char *format)
 int stat_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
 int stat_main(int argc, char **argv)
 {
-       char *format = NULL;
+       USE_FEATURE_STAT_FORMAT(char *format = NULL;)
        int i;
        int ok = 1;
-       bool (*statfunc)(const char *, const char *) = do_stat;
+       statfunc_ptr statfunc = do_stat;
 
        getopt32(argv, "ftL"
                USE_SELINUX("Z")
@@ -633,7 +648,7 @@ int stat_main(int argc, char **argv)
        }
 #endif /* ENABLE_SELINUX */
        for (i = optind; i < argc; ++i)
-               ok &= statfunc(argv[i], format);
+               ok &= statfunc(argv[i] USE_FEATURE_STAT_FORMAT(, format));
 
        return (ok ? EXIT_SUCCESS : EXIT_FAILURE);
 }
index 50c7901..634fbd1 100644 (file)
@@ -374,7 +374,10 @@ ACTF(context)
 #endif
 
 
-static int fileAction(const char *fileName, struct stat *statbuf, void *userData, int depth)
+static int fileAction(const char *fileName,
+               struct stat *statbuf,
+               void *userData SKIP_FEATURE_FIND_MAXDEPTH(ATTRIBUTE_UNUSED),
+               int depth SKIP_FEATURE_FIND_MAXDEPTH(ATTRIBUTE_UNUSED))
 {
        int i;
 #if ENABLE_FEATURE_FIND_MAXDEPTH
index 5272024..cad45ac 100644 (file)
@@ -64,9 +64,9 @@ void lbb_prepare(const char *applet
        ) MAIN_EXTERNALLY_VISIBLE;
 #if ENABLE_BUILD_LIBBUSYBOX
 #if ENABLE_FEATURE_SHARED_BUSYBOX
-int lbb_main(int argc, char **argv) EXTERNALLY_VISIBLE;
+int lbb_main(char **argv) EXTERNALLY_VISIBLE;
 #else
-int lbb_main(int argc, char **argv);
+int lbb_main(char **argv);
 #endif
 #endif
 
index df8b0ec..c6c2be2 100644 (file)
@@ -237,7 +237,8 @@ extern int recursive_action(const char *fileName, unsigned flags,
        int (*dirAction) (const char *fileName, struct stat* statbuf, void* userData, int depth),
        void* userData, unsigned depth);
 extern int device_open(const char *device, int mode);
-extern int getpty(char *line, int size);
+enum { GETPTY_BUFSIZE = 16 }; /* more than enough for "/dev/ttyXXX" */
+extern int getpty(char *line);
 extern int get_console_fd(void);
 extern char *find_block_device(const char *path);
 /* bb_copyfd_XX print read/write errors and return -1 if they occur */
index f94fa2f..507a52d 100644 (file)
        ""
 #define false_full_usage \
        "Return an exit code of FALSE (1)"
+
 #define false_example_usage \
        "$ false\n" \
        "$ echo $?\n" \
index c50d8af..1f0fae3 100644 (file)
@@ -16,7 +16,7 @@
 #endif
 
 int halt_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
-int halt_main(int argc, char **argv)
+int halt_main(int argc ATTRIBUTE_UNUSED, char **argv)
 {
        static const int magic[] = {
 #ifdef RB_HALT_SYSTEM
index de27dd8..aade904 100644 (file)
@@ -661,7 +661,7 @@ void run_applet_and_exit(const char *name, char **argv)
 
 
 #if ENABLE_BUILD_LIBBUSYBOX
-int lbb_main(int argc, char **argv)
+int lbb_main(char **argv)
 #else
 int main(int argc ATTRIBUTE_UNUSED, char **argv)
 #endif
index c006e34..36b3c68 100644 (file)
@@ -10,7 +10,9 @@
 
 #define DEBUG 0
 
-int getpty(char *line, int size)
+#define DEBUG 0
+
+int getpty(char *line)
 {
        int p;
 #if ENABLE_FEATURE_DEVPTS
@@ -24,7 +26,7 @@ int getpty(char *line, int size)
                        bb_perror_msg("ptsname error (is /dev/pts mounted?)");
                        return -1;
                }
-               safe_strncpy(line, name, size);
+               safe_strncpy(line, name, GETPTY_BUFSIZE);
                return p;
        }
 #else
index 7e40820..b25386b 100644 (file)
@@ -294,7 +294,12 @@ static void redraw(int y, int back_cursor)
 
 /* Delete the char in front of the cursor, optionally saving it
  * for later putback */
+#if !ENABLE_FEATURE_EDITING_VI
+static void input_delete(void)
+#define input_delete(save) input_delete()
+#else
 static void input_delete(int save)
+#endif
 {
        int j = cursor;
 
index 79e7494..d7eb8d3 100644 (file)
@@ -130,9 +130,7 @@ static void die_if_nologin(void)
                fclose(fp);
        } else
                puts("\r\nSystem closed for routine maintenance\r");
-       if (!amroot)
-               exit(1);
-       puts("\r\n[Disconnect bypassed -- root login allowed]\r");
+       exit(1);
 }
 #else
 static ALWAYS_INLINE void die_if_nologin(void) {}
index ee56678..f3aef42 100644 (file)
@@ -5,7 +5,7 @@
 #include "bbconfigopts.h"
 
 int bbconfig_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
-int bbconfig_main(int argc, char **argv)
+int bbconfig_main(int argc ATTRIBUTE_UNUSED, char **argv ATTRIBUTE_UNUSED)
 {
        printf(bbconfig_config);
        return 0;
index 50c5ad9..64d4ba4 100644 (file)
@@ -233,7 +233,8 @@ int chat_main(int argc ATTRIBUTE_UNUSED, char **argv)
                        //-----------------------
                        // do expect
                        //-----------------------
-                       size_t expect_len, buf_len = 0;
+                       int expect_len;
+                       size_t buf_len = 0;
                        size_t max_len = max_abort_len;
 
                        struct pollfd pfd;
@@ -315,7 +316,7 @@ int chat_main(int argc ATTRIBUTE_UNUSED, char **argv)
                                exitcode = ERR_OK;
 
                                // expected reply received? -> goto next command
-                               delta = buf_len-expect_len;
+                               delta = buf_len - expect_len;
                                if (delta >= 0 && !memcmp(buf+delta, expect, expect_len))
                                        goto expect_done;
 #undef buf
index 079de69..6274a8d 100644 (file)
@@ -3680,6 +3680,9 @@ static void check_tainted_module(struct obj_file *f, char *m_name)
  * start of some sections.  this info is used by ksymoops to do better
  * debugging.
  */
+#if !ENABLE_FEATURE_INSMOD_VERSION_CHECKING
+#define get_module_version(f, str) get_module_version(str)
+#endif
 static int
 get_module_version(struct obj_file *f, char str[STRVERSIONLEN])
 {
index baf0e2a..da8663a 100644 (file)
@@ -75,7 +75,7 @@ enum {
 };
 
 int lsmod_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
-int lsmod_main(int argc, char **argv)
+int lsmod_main(int argc ATTRIBUTE_UNUSED, char **argv ATTRIBUTE_UNUSED)
 {
        struct module_info info;
        char *module_names, *mn, *deps, *dn;
index e06a124..44258e9 100644 (file)
@@ -17,7 +17,7 @@ lib-$(CONFIG_FTPPUT)       += ftpgetput.o
 lib-$(CONFIG_HOSTNAME)     += hostname.o
 lib-$(CONFIG_HTTPD)        += httpd.o
 lib-$(CONFIG_IFCONFIG)     += ifconfig.o interface.o
-lib-$(CONFIG_IFENSLAVE)    += ifenslave.o
+lib-$(CONFIG_IFENSLAVE)    += ifenslave.o interface.o
 lib-$(CONFIG_IFUPDOWN)     += ifupdown.o
 lib-$(CONFIG_INETD)        += inetd.o
 lib-$(CONFIG_IP)           += ip.o
index b752152..fcd7dd2 100644 (file)
@@ -179,7 +179,7 @@ static int get_wol_pw(const char *ethoptarg, unsigned char *wol_passwd)
 }
 
 int ether_wake_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
-int ether_wake_main(int argc, char **argv)
+int ether_wake_main(int argc ATTRIBUTE_UNUSED, char **argv)
 {
        const char *ifname = "eth0";
        char *pass;
index 54f288c..522e7ee 100644 (file)
@@ -1972,7 +1972,11 @@ static void handle_incoming_and_exit(const len_and_sockaddr *fromAddr)
                        /* Try and do our best to parse more lines */
                        if ((STRNCASECMP(iobuf, "Content-length:") == 0)) {
                                /* extra read only for POST */
-                               if (prequest != request_GET && prequest != request_HEAD) {
+                               if (prequest != request_GET
+#if ENABLE_FEATURE_HTTPD_CGI
+                                && prequest != request_HEAD
+#endif
+                               ) {
                                        tptr = iobuf + sizeof("Content-length:") - 1;
                                        if (!tptr[0])
                                                send_headers_and_exit(HTTP_BAD_REQUEST);
@@ -2129,7 +2133,12 @@ static void handle_incoming_and_exit(const len_and_sockaddr *fromAddr)
         */
 
        send_file_and_exit(tptr,
-               (prequest != request_HEAD ? SEND_HEADERS_AND_BODY : SEND_HEADERS));
+#if ENABLE_FEATURE_HTTPD_CGI
+               (prequest != request_HEAD ? SEND_HEADERS_AND_BODY : SEND_HEADERS)
+#else
+               SEND_HEADERS_AND_BODY
+#endif
+       );
 }
 
 /*
index 6aa929a..586c3db 100644 (file)
@@ -483,9 +483,9 @@ static const struct dhcp_client_t ext_dhcp_clients[] = {
 };
 #endif /* ENABLE_FEATURE_IFUPDOWN_EXTERNAL_DHCPC */
 
+#if ENABLE_FEATURE_IFUPDOWN_EXTERNAL_DHCP
 static int dhcp_up(struct interface_defn_t *ifd, execfn *exec)
 {
-#if ENABLE_FEATURE_IFUPDOWN_EXTERNAL_DHCP
        int i;
 #if ENABLE_FEATURE_IFUPDOWN_IP
        /* ip doesn't up iface when it configures it (unlike ifconfig) */
@@ -498,7 +498,10 @@ static int dhcp_up(struct interface_defn_t *ifd, execfn *exec)
        }
        bb_error_msg("no dhcp clients found");
        return 0;
+}
 #elif ENABLE_APP_UDHCPC
+static int dhcp_up(struct interface_defn_t *ifd, execfn *exec)
+{
 #if ENABLE_FEATURE_IFUPDOWN_IP
        /* ip doesn't up iface when it configures it (unlike ifconfig) */
        if (!execute("ip link set %iface% up", ifd, exec))
@@ -507,14 +510,18 @@ static int dhcp_up(struct interface_defn_t *ifd, execfn *exec)
        return execute("udhcpc -R -n -p /var/run/udhcpc.%iface%.pid "
                        "-i %iface%[[ -H %hostname%]][[ -c %clientid%]][[ -s %script%]]",
                        ifd, exec);
+}
 #else
+static int dhcp_up(struct interface_defn_t *ifd ATTRIBUTE_UNUSED,
+               execfn *exec ATTRIBUTE_UNUSED)
+{
        return 0; /* no dhcp support */
-#endif
 }
+#endif
 
+#if ENABLE_FEATURE_IFUPDOWN_EXTERNAL_DHCP
 static int dhcp_down(struct interface_defn_t *ifd, execfn *exec)
 {
-#if ENABLE_FEATURE_IFUPDOWN_EXTERNAL_DHCP
        int i;
        for (i = 0; i < ARRAY_SIZE(ext_dhcp_clients); i++) {
                if (exists_execable(ext_dhcp_clients[i].name))
@@ -522,13 +529,20 @@ static int dhcp_down(struct interface_defn_t *ifd, execfn *exec)
        }
        bb_error_msg("no dhcp clients found, using static interface shutdown");
        return static_down(ifd, exec);
+}
 #elif ENABLE_APP_UDHCPC
+static int dhcp_down(struct interface_defn_t *ifd, execfn *exec)
+{
        return execute("kill "
                       "`cat /var/run/udhcpc.%iface%.pid` 2>/dev/null", ifd, exec);
+}
 #else
+static int dhcp_down(struct interface_defn_t *ifd ATTRIBUTE_UNUSED,
+               execfn *exec ATTRIBUTE_UNUSED)
+{
        return 0; /* no dhcp support */
-#endif
 }
+#endif
 
 static int manual_up_down(struct interface_defn_t *ifd ATTRIBUTE_UNUSED, execfn *exec ATTRIBUTE_UNUSED)
 {
index 0ddfa6b..b931aa1 100644 (file)
@@ -1331,10 +1331,10 @@ int inetd_main(int argc ATTRIBUTE_UNUSED, char **argv)
                                continue; /* -> check next fd in fd set */
                        }
 
-                       /* we are either child or didn't fork at all */
+                       /* we are either child or didn't vfork at all */
 #ifdef INETD_BUILTINS_ENABLED
                        if (sep->se_builtin) {
-                               if (pid) { /* "pid" is -1: we did fork */
+                               if (pid) { /* "pid" is -1: we did vfork */
                                        close(sep->se_fd); /* listening socket */
                                        logmode = 0; /* make xwrite etc silent */
                                }
@@ -1343,8 +1343,8 @@ int inetd_main(int argc ATTRIBUTE_UNUSED, char **argv)
                                        sep->se_builtin->bi_stream_fn(ctrl, sep);
                                else
                                        sep->se_builtin->bi_dgram_fn(ctrl, sep);
-                               if (pid) /* we did fork */
-                                       _exit(0);
+                               if (pid) /* we did vfork */
+                                       _exit(1);
                                maybe_close(accepted_fd);
                                continue; /* -> check next fd in fd set */
                        }
@@ -1430,11 +1430,15 @@ static void echo_stream(int s, servtab_t *sep ATTRIBUTE_UNUSED)
                xwrite(s, line, sz);
        }
 #else
+       /* We are after vfork here! */
        static const char *const args[] = { "cat", NULL };
-       /* no error messages */
+       /* move network socket to stdin */
+       xmove_fd(s, STDIN_FILENO);
+       xdup2(STDIN_FILENO, STDOUT_FILENO);
+       /* no error messages please... */
        xmove_fd(xopen("/dev/null", O_WRONLY), STDERR_FILENO);
        BB_EXECVP("cat", (char**)args);
-       _exit(1);
+       /* on failure we return to main, which does exit(1) */
 #endif
 }
 static void echo_dg(int s, servtab_t *sep)
@@ -1463,11 +1467,15 @@ static void discard_stream(int s, servtab_t *sep ATTRIBUTE_UNUSED)
        while (safe_read(s, line, LINE_SIZE) > 0)
                continue;
 #else
+       /* We are after vfork here! */
        static const char *const args[] = { "dd", "of=/dev/null", NULL };
+       /* move network socket to stdin */
+       xmove_fd(s, STDIN_FILENO);
+       xdup2(STDIN_FILENO, STDOUT_FILENO);
        /* no error messages */
        xmove_fd(xopen("/dev/null", O_WRONLY), STDERR_FILENO);
        BB_EXECVP("dd", (char**)args);
-       _exit(1);
+       /* on failure we return to main, which does exit(1) */
 #endif
 }
 /* ARGSUSED */
index 7c2aafa..7d4a6e0 100644 (file)
@@ -17,7 +17,7 @@
  * when compared to "standard" nc
  */
 
-static void timeout(int signum)
+static void timeout(int signum ATTRIBUTE_UNUSED)
 {
        bb_error_msg_and_die("timed out");
 }
index 241028b..2eb01dc 100644 (file)
@@ -551,11 +551,11 @@ int sendgetmail_main(int argc ATTRIBUTE_UNUSED, char **argv)
                        int rc;
 
                        // retrieve message in ./tmp/
-                       pop3_check(retr, (const char *)nmsg);
+                       pop3_check(retr, (const char *)(ptrdiff_t)nmsg);
                        pop3_message(filename);
                        // delete message from server
                        if (opts & OPTF_z)
-                               pop3_check("DELE %u", (const char*)nmsg);
+                               pop3_check("DELE %u", (const char*)(ptrdiff_t)nmsg);
 
                        // run postprocessing program
                        if (*fargs) {
index 20c5792..2ed3b74 100644 (file)
@@ -161,14 +161,14 @@ make_new_session(
        const char *login_argv[2];
        struct termios termbuf;
        int fd, pid;
-       char tty_name[32];
+       char tty_name[GETPTY_BUFSIZE];
        struct tsession *ts = xzalloc(sizeof(struct tsession) + BUFSIZE * 2);
 
        /*ts->buf1 = (char *)(ts + 1);*/
        /*ts->buf2 = ts->buf1 + BUFSIZE;*/
 
        /* Got a new connection, set up a tty. */
-       fd = getpty(tty_name, 32);
+       fd = getpty(tty_name);
        if (fd < 0) {
                bb_error_msg("can't create pty");
                return NULL;
index 582840a..c0b4a3f 100644 (file)
@@ -729,6 +729,10 @@ pr_type(unsigned char t)
 }
 #endif
 
+#if !ENABLE_FEATURE_TRACEROUTE_VERBOSE
+#define packet_ok(buf, cc, from, seq) \
+       packet_ok(buf, cc, seq)
+#endif
 static int
 packet_ok(unsigned char *buf, int cc, struct sockaddr_in *from, int seq)
 {
index b5534f8..0be661d 100644 (file)
@@ -76,7 +76,7 @@ int raw_socket(int ifindex)
                BPF_STMT(BPF_LD|BPF_W|BPF_IND, 0),
                BPF_JUMP(BPF_JMP|BPF_JEQ|BPF_K, SERVER_AND_CLIENT_PORTS, 0, 1), /* L3, L4 */
                /* returns */
-               BPF_STMT(BPF_RET|BPF_K, ~0UL),                          /* L3: pass */
+               BPF_STMT(BPF_RET|BPF_K, (~(uint32_t)0) ),               /* L3: pass */
                BPF_STMT(BPF_RET|BPF_K, 0),                             /* L4: reject */
        };
        static const struct sock_fprog filter_prog = {
index dc1dc2a..f8adcd7 100644 (file)
@@ -189,7 +189,7 @@ static void progressmeter(int flag)
  */
 #else /* FEATURE_WGET_STATUSBAR */
 
-static ALWAYS_INLINE void progressmeter(int flag) { }
+static ALWAYS_INLINE void progressmeter(int flag ATTRIBUTE_UNUSED) { }
 
 #endif
 
index 647e03f..aeb8cec 100644 (file)
@@ -484,7 +484,7 @@ int ps_main(int argc ATTRIBUTE_UNUSED, char **argv)
 
 
 int ps_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
-int ps_main(int argc, char **argv)
+int ps_main(int argc ATTRIBUTE_UNUSED, char **argv ATTRIBUTE_UNUSED)
 {
        procps_status_t *p = NULL;
        int len;
index 580918c..d9ce202 100644 (file)
@@ -3247,6 +3247,9 @@ static pid_t backgndpid;        /* pid of last background process */
 static smallint job_warning;    /* user was warned about stopped jobs (can be 2, 1 or 0). */
 
 static struct job *makejob(/*union node *,*/ int);
+#if !JOBS
+#define forkshell(job, node, mode) forkshell(job, mode)
+#endif
 static int forkshell(struct job *, union node *, int);
 static int waitforjob(struct job *);
 
@@ -3424,6 +3427,9 @@ jobno(const struct job *jp)
 /*
  * Convert a job name to a job structure.
  */
+#if !JOBS
+#define getjob(name, getctl) getjob(name)
+#endif
 static struct job *
 getjob(const char *name, int getctl)
 {
@@ -4533,6 +4539,9 @@ forkchild(struct job *jp, /*union node *n,*/ int mode)
 }
 
 /* Called after fork(), in parent */
+#if !JOBS
+#define forkparent(jp, n, mode, pid) forkparent(jp, mode, pid)
+#endif
 static void
 forkparent(struct job *jp, union node *n, int mode, pid_t pid)
 {
@@ -8674,8 +8683,8 @@ preadfd(void)
        char *buf =  parsefile->buf;
        parsenextc = buf;
 
- retry:
 #if ENABLE_FEATURE_EDITING
+ retry:
        if (!iflag || parsefile->fd)
                nr = nonblock_safe_read(parsefile->fd, buf, BUFSIZ - 1);
        else {
@@ -8876,8 +8885,11 @@ pungetc(void)
  * Push a string back onto the input at this current parsefile level.
  * We handle aliases this way.
  */
+#if !ENABLE_ASH_ALIAS
+#define pushstring(s, ap) pushstring(s)
+#endif
 static void
-pushstring(char *s, void *ap)
+pushstring(char *s, struct alias *ap)
 {
        struct strpush *sp;
        size_t len;
@@ -8894,9 +8906,9 @@ pushstring(char *s, void *ap)
        sp->prevstring = parsenextc;
        sp->prevnleft = parsenleft;
 #if ENABLE_ASH_ALIAS
-       sp->ap = (struct alias *)ap;
+       sp->ap = ap;
        if (ap) {
-               ((struct alias *)ap)->flag |= ALIASINUSE;
+               ap->flag |= ALIASINUSE;
                sp->string = s;
        }
 #endif
index 4041817..bbe5149 100644 (file)
@@ -38,7 +38,7 @@ struct serial_struct {
 };
 
 int cttyhack_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
-int cttyhack_main(int argc, char **argv)
+int cttyhack_main(int argc ATTRIBUTE_UNUSED, char **argv)
 {
        int fd;
        char console[sizeof(int)*3 + 16];
index d616abd..ab7770d 100644 (file)
@@ -170,10 +170,10 @@ enum {
 };
 #endif
 
+#if ENABLE_FEATURE_FBSET_READMODE
 static int readmode(struct fb_var_screeninfo *base, const char *fn,
                                        const char *mode)
 {
-#if ENABLE_FEATURE_FBSET_READMODE
        FILE *f;
        char buf[256];
        char *p = buf;
@@ -257,11 +257,9 @@ static int readmode(struct fb_var_screeninfo *base, const char *fn,
                                return 1;
                }
        }
-#else
-       bb_error_msg("mode reading not compiled in");
-#endif
        return 0;
 }
+#endif
 
 static inline void setmode(struct fb_var_screeninfo *base,
                                        struct fb_var_screeninfo *set)
@@ -389,9 +387,13 @@ int fbset_main(int argc, char **argv)
        fh = xopen(fbdev, O_RDONLY);
        xioctl(fh, FBIOGET_VSCREENINFO, &var);
        if (g_options & OPT_READMODE) {
+#if !ENABLE_FEATURE_FBSET_READMODE
+               bb_show_usage();
+#else
                if (!readmode(&var, modefile, mode)) {
                        bb_error_msg_and_die("unknown video mode '%s'", mode);
                }
+#endif
        }
 
        setmode(&var, &varset);
index a75b4f8..dcfae96 100644 (file)
@@ -128,7 +128,11 @@ static unsigned read_int(unsigned low, unsigned dflt, unsigned high, unsigned ba
 #endif
 static const char *partition_type(unsigned char type);
 static void get_geometry(void);
+#if ENABLE_FEATURE_SUN_LABEL || ENABLE_FEATURE_FDISK_WRITABLE
 static int get_boot(enum action what);
+#else
+static int get_boot(void);
+#endif
 
 #define PLURAL   0
 #define SINGULAR 1
@@ -1237,8 +1241,12 @@ get_geometry(void)
  *    0: found or created label
  *    1: I/O error
  */
-static int
-get_boot(enum action what)
+#if ENABLE_FEATURE_SUN_LABEL || ENABLE_FEATURE_FDISK_WRITABLE
+static int get_boot(enum action what)
+#else
+static int get_boot(void)
+#define get_boot(what) get_boot()
+#endif
 {
        int i;
 
index c37fd9d..1c95ea5 100644 (file)
@@ -29,7 +29,7 @@ int script_main(int argc ATTRIBUTE_UNUSED, char **argv)
        int attr_ok; /* NB: 0: ok */
        int winsz_ok;
        int pty;
-       char pty_line[32];
+       char pty_line[GETPTY_BUFSIZE];
        struct termios tt, rtt;
        struct winsize win;
        const char *fname = "typescript";
@@ -69,7 +69,7 @@ int script_main(int argc ATTRIBUTE_UNUSED, char **argv)
                shell = DEFAULT_SHELL;
        }
 
-       pty = getpty(pty_line, sizeof(pty_line));
+       pty = getpty(pty_line);
        if (pty < 0) {
                bb_perror_msg_and_die("can't get pty");
        }
index 75060b0..af03d07 100644 (file)
@@ -26,6 +26,10 @@ static struct uuidCache_s {
 } *uuidCache;
 
 /* for now, only ext2, ext3 and xfs are supported */
+#if !ENABLE_FEATURE_VOLUMEID_ISO9660
+#define get_label_uuid(device, label, uuid, iso_only) \
+       get_label_uuid(device, label, uuid)
+#endif
 static int
 get_label_uuid(const char *device, char **label, char **uuid, int iso_only)
 {
@@ -83,6 +87,10 @@ uuidcache_addentry(char * device, int major, int minor, char *label, char *uuid)
        memcpy(last->uuid, uuid, sizeof(last->uuid));
 }
 
+#if !ENABLE_FEATURE_VOLUMEID_ISO9660
+#define uuidcache_check_device(device_name, ma, mi, iso_only) \
+       uuidcache_check_device(device_name, ma, mi)
+#endif
 static void
 uuidcache_check_device(const char *device_name, int ma, int mi, int iso_only)
 {