s/#ifdef CONFIG_/#if ENABLE_/g
authorDenis Vlasenko <vda.linux@googlemail.com>
Mon, 13 Aug 2007 10:36:25 +0000 (10:36 -0000)
committerDenis Vlasenko <vda.linux@googlemail.com>
Mon, 13 Aug 2007 10:36:25 +0000 (10:36 -0000)
22 files changed:
archival/bbunzip.c
archival/dpkg.c
archival/dpkg_deb.c
archival/libunarchive/decompress_unlzma.c
archival/libunarchive/filter_accept_list_reassign.c
archival/libunarchive/seek_by_jump.c
coreutils/df.c
coreutils/wc.c
docs/style-guide.txt
include/libbb.h
include/usage.h
libbb/create_icmp6_socket.c
libbb/create_icmp_socket.c
libbb/inet_common.c
libbb/xgethostbyname.c
miscutils/makedevs.c
modutils/lsmod.c
modutils/rmmod.c
networking/ipcalc.c
util-linux/fbset.c
util-linux/hwclock.c
util-linux/ipcrm.c

index bd1526b20d863e33f59a9ae606f3bd09931b4f14..f842d458ba116d45281b81938e39032312239fb7 100644 (file)
@@ -212,7 +212,7 @@ char* make_new_name_gunzip(char *filename)
 
        extension++;
        if (strcmp(extension, "tgz" + 1) == 0
-#ifdef CONFIG_FEATURE_GUNZIP_UNCOMPRESS
+#if  ENABLE_FEATURE_GUNZIP_UNCOMPRESS
         || strcmp(extension, "Z") == 0
 #endif
        ) {
index 0c1f96fc97ab6a04cf943aa54491358d6042e9b3..caa50f90da5611e854f805e3e1d89de57a351c4c 100644 (file)
@@ -1412,10 +1412,10 @@ static void init_archive_deb_control(archive_handle_t *ar_handle)
        tar_handle->src_fd = ar_handle->src_fd;
 
        /* We don't care about data.tar.* or debian-binary, just control.tar.* */
-#ifdef CONFIG_FEATURE_DEB_TAR_GZ
+#if  ENABLE_FEATURE_DEB_TAR_GZ
        llist_add_to(&(ar_handle->accept), (char*)"control.tar.gz");
 #endif
-#ifdef CONFIG_FEATURE_DEB_TAR_BZ2
+#if  ENABLE_FEATURE_DEB_TAR_BZ2
        llist_add_to(&(ar_handle->accept), (char*)"control.tar.bz2");
 #endif
 
@@ -1432,10 +1432,10 @@ static void init_archive_deb_data(archive_handle_t *ar_handle)
        tar_handle->src_fd = ar_handle->src_fd;
 
        /* We don't care about control.tar.* or debian-binary, just data.tar.* */
-#ifdef CONFIG_FEATURE_DEB_TAR_GZ
+#if  ENABLE_FEATURE_DEB_TAR_GZ
        llist_add_to(&(ar_handle->accept), (char*)"data.tar.gz");
 #endif
-#ifdef CONFIG_FEATURE_DEB_TAR_BZ2
+#if  ENABLE_FEATURE_DEB_TAR_BZ2
        llist_add_to(&(ar_handle->accept), (char*)"data.tar.bz2");
 #endif
 
index 138caff3905836142ce16aabfd31162cb6eb0deb..6dd81710185400b3ce2438a091c539d3e819ef0a 100644 (file)
@@ -31,12 +31,12 @@ int dpkg_deb_main(int argc, char **argv)
        ar_archive->sub_archive = tar_archive;
        ar_archive->filter = filter_accept_list_reassign;
 
-#ifdef CONFIG_FEATURE_DEB_TAR_GZ
+#if ENABLE_FEATURE_DEB_TAR_GZ
        llist_add_to(&(ar_archive->accept), (char*)"data.tar.gz");
        llist_add_to(&control_tar_llist, (char*)"control.tar.gz");
 #endif
 
-#ifdef CONFIG_FEATURE_DEB_TAR_BZ2
+#if ENABLE_FEATURE_DEB_TAR_BZ2
        llist_add_to(&(ar_archive->accept), (char*)"data.tar.bz2");
        llist_add_to(&control_tar_llist, (char*)"control.tar.bz2");
 #endif
index 2800a7ecd79ec7c5234f9c35c8fdf8e0db4e937e..4f36c060f2d404d7db67ea927c4d14735af88b87 100644 (file)
@@ -12,7 +12,7 @@
 #include "libbb.h"
 #include "unarchive.h"
 
-#ifdef CONFIG_FEATURE_LZMA_FAST
+#if ENABLE_FEATURE_LZMA_FAST
 #  define speed_inline ALWAYS_INLINE
 #else
 #  define speed_inline
@@ -99,9 +99,11 @@ static ALWAYS_INLINE void rc_normalize(rc_t * rc)
        }
 }
 
-/* Called 9 times */
+/* rc_is_bit_0 is called 9 times */
 /* Why rc_is_bit_0_helper exists?
- * Because we want to always expose (rc->code < rc->bound) to optimizer
+ * Because we want to always expose (rc->code < rc->bound) to optimizer.
+ * Thus rc_is_bit_0 is always inlined, and rc_is_bit_0_helper is inlined
+ * only if we compile for speed.
  */
 static speed_inline uint32_t rc_is_bit_0_helper(rc_t * rc, uint16_t * p)
 {
index 0fb536fad7e8d1e19c301d54a83c76cd32e4fe99..969dd1e3ef08122f3ff148f22823c24673c34c3f 100644 (file)
@@ -23,13 +23,13 @@ char filter_accept_list_reassign(archive_handle_t *archive_handle)
                name_ptr = strrchr(archive_handle->file_header->name, '.');
 
                /* Modify the subarchive handler based on the extension */
-#ifdef CONFIG_FEATURE_DEB_TAR_GZ
+#if ENABLE_FEATURE_DEB_TAR_GZ
                if (strcmp(name_ptr, ".gz") == 0) {
                        archive_handle->action_data_subarchive = get_header_tar_gz;
                        return EXIT_SUCCESS;
                }
 #endif
-#ifdef CONFIG_FEATURE_DEB_TAR_BZ2
+#if ENABLE_FEATURE_DEB_TAR_BZ2
                if (strcmp(name_ptr, ".bz2") == 0) {
                        archive_handle->action_data_subarchive = get_header_tar_bz2;
                        return EXIT_SUCCESS;
index 6cd2564186ee85098c4a6d309319624fc7b51c77..edbf46b21b5bb013dafb21f27b1404b69a70db9e 100644 (file)
@@ -9,7 +9,7 @@
 void seek_by_jump(const archive_handle_t *archive_handle, const unsigned int amount)
 {
        if (lseek(archive_handle->src_fd, (off_t) amount, SEEK_CUR) == (off_t) -1) {
-#ifdef CONFIG_FEATURE_UNARCHIVE_TAPE
+#if ENABLE_FEATURE_UNARCHIVE_TAPE
                if (errno == ESPIPE) {
                        seek_by_read(archive_handle, amount);
                } else
index 5154eeb451140c3540e99dea334accc0f925bb63..f616398f4e4080feca972f8fce94c2f73a96a362 100644 (file)
@@ -22,7 +22,7 @@
 #include <sys/vfs.h>
 #include "libbb.h"
 
-#ifndef CONFIG_FEATURE_HUMAN_READABLE
+#if !ENABLE_FEATURE_HUMAN_READABLE
 static long kscale(long b, long bs)
 {
        return ( b * (long long) bs + 1024/2 ) / 1024;
@@ -34,7 +34,7 @@ int df_main(int argc, char **argv)
 {
        long blocks_used;
        long blocks_percent_used;
-#ifdef CONFIG_FEATURE_HUMAN_READABLE
+#if  ENABLE_FEATURE_HUMAN_READABLE
        unsigned long df_disp_hr = 1024;
 #endif
        int status = EXIT_SUCCESS;
@@ -46,7 +46,7 @@ int df_main(int argc, char **argv)
        static const char hdr_1k[] ALIGN1 = "1k-blocks";
        const char *disp_units_hdr = hdr_1k;
 
-#ifdef CONFIG_FEATURE_HUMAN_READABLE
+#if  ENABLE_FEATURE_HUMAN_READABLE
        opt_complementary = "h-km:k-hm:m-hk";
        opt = getopt32(argc, argv, "hmk");
        if (opt & 1) {
@@ -125,7 +125,7 @@ int df_main(int argc, char **argv)
                                }
                        }
 
-#ifdef CONFIG_FEATURE_HUMAN_READABLE
+#if ENABLE_FEATURE_HUMAN_READABLE
                        printf("%-20s %9s ", device,
                                make_human_readable_str(s.f_blocks, s.f_bsize, df_disp_hr));
 
index e5353b4cb5fce6569e79059f68411ca5bf60df9b..e7463657872b7ae6a6f299edefa39fcd75eba9c7 100644 (file)
@@ -43,7 +43,7 @@
 
 #include "libbb.h"
 
-#ifdef CONFIG_LOCALE_SUPPORT
+#if  ENABLE_LOCALE_SUPPORT
 #define isspace_given_isprint(c) isspace(c)
 #else
 #undef isspace
index 381275a1ddca70ce4bd381efbcca06e6733aa97f..7560d698623357a12b3ead68a05eb00ecfbab8bd 100644 (file)
@@ -377,13 +377,13 @@ used in the code.
 
        (in .h header file)
 
-               #ifdef CONFIG_FEATURE_FUNKY
-               static inline void maybe_do_funky_stuff (int bar, int baz)
+               #if ENABLE_FEATURE_FUNKY
+               static inline void maybe_do_funky_stuff(int bar, int baz)
                {
                        /* lotsa code in here */
                }
                #else
-               static inline void maybe_do_funky_stuff (int bar, int baz) {}
+               static inline void maybe_do_funky_stuff(int bar, int baz) {}
                #endif
 
        (in the .c source file)
index a14d6be4433e19ccc6601592b2d8a901eb258edf..0ea88a6233b29167c4fcfb64488f69424e80e74f 100644 (file)
@@ -1026,7 +1026,7 @@ extern char bb_common_bufsiz1[COMMON_BUFSIZE];
 /* See docs/keep_data_small.txt */
 struct globals;
 /* '*const' ptr makes gcc optimize code much better.
- * Magic prevents ptr_to_globals from going into rodata
+ * Magic prevents ptr_to_globals from going into rodata.
  * If you want to assign a value, use PTR_TO_GLOBALS = xxx */
 extern struct globals *const ptr_to_globals;
 #define PTR_TO_GLOBALS (*(struct globals**)&ptr_to_globals)
index 3f2916006f53186a38dcf03a4b6dc850b30d7282..a1b39368bdd3d780966abf84f2aebbee4f11c9f3 100644 (file)
 #define lsmod_full_usage \
        "List the currently loaded kernel modules"
 
-#ifdef CONFIG_FEATURE_MAKEDEVS_LEAF
+#if ENABLE_FEATURE_MAKEDEVS_LEAF
 #define makedevs_trivial_usage \
        "NAME TYPE MAJOR MINOR FIRST LAST [s]"
 #define makedevs_full_usage \
        "[creates hda,hda1-hda8]\n"
 #endif
 
-#ifdef CONFIG_FEATURE_MAKEDEVS_TABLE
+#if ENABLE_FEATURE_MAKEDEVS_TABLE
 #define makedevs_trivial_usage \
        "[-d device_table] rootdir"
 #define makedevs_full_usage \
        USE_FEATURE_PIDOF_OMIT( \
        "$ pidof /bin/sh -o %PPID\n20351 5950")
 
-#ifndef CONFIG_FEATURE_FANCY_PING
+#if !ENABLE_FEATURE_FANCY_PING
 #define ping_trivial_usage \
        "host"
 #define ping_full_usage \
@@ -3430,7 +3430,7 @@ USE_FEATURE_RUN_PARTS_FANCY("\n   -l      Prints names of all matching files even when
        "$ cat /tmp/foo\n" \
        "Hello\n"
 
-#ifdef CONFIG_FEATURE_TELNET_AUTOLOGIN
+#if ENABLE_FEATURE_TELNET_AUTOLOGIN
 #define telnet_trivial_usage \
        "[-a] [-l USER] HOST [PORT]"
 #define telnet_full_usage \
index b90f3e9fdd5fe6325f7861fbe0845b92e852f3d8..51899cdc5a01509e508639a888a5305fa43d39e1 100644 (file)
@@ -7,12 +7,12 @@
  *
  */
 
-#include <sys/types.h>
-#include <netdb.h>
-#include <sys/socket.h>
+//#include <sys/types.h>
+//#include <netdb.h>
+//#include <sys/socket.h>
 #include "libbb.h"
 
-#ifdef CONFIG_FEATURE_IPV6
+#if ENABLE_FEATURE_IPV6
 int create_icmp6_socket(void)
 {
        struct protoent *proto;
index dbd4769f60aa3473510f15b7cb909a29ec2eeb12..3a465588578ca01d4f0c29ab3386c4701fee12ae 100644 (file)
@@ -7,9 +7,9 @@
  *
  */
 
-#include <sys/types.h>
-#include <netdb.h>
-#include <sys/socket.h>
+//#include <sys/types.h>
+//#include <netdb.h>
+//#include <sys/socket.h>
 #include "libbb.h"
 
 int create_icmp_socket(void)
index ec3c3f9bbd6d13d8f41c9750a42df9b1b42b8dac..7e799b5e1b9b17cf19d4fad5d1e8f1833f08d00b 100644 (file)
@@ -164,7 +164,7 @@ char *INET_rresolve(struct sockaddr_in *s_in, int numeric, uint32_t netmask)
        return name;
 }
 
-#ifdef CONFIG_FEATURE_IPV6
+#if ENABLE_FEATURE_IPV6
 
 int INET6_resolve(const char *name, struct sockaddr_in6 *sin6)
 {
index c3158c3394a2b0d7e962f200c5503ec71d85310e..3bb522d8045a2f1d072a5b99955066ff000992f8 100644 (file)
@@ -7,7 +7,7 @@
  * Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
  */
 
-#include <netdb.h>
+//#include <netdb.h>
 #include "libbb.h"
 
 struct hostent *xgethostbyname(const char *name)
index 0ad12d798ecbc9485a7bf9da190c4301d64b8190..6a3e808838d54cebf6dfcc426b19c0bad662f752 100644 (file)
@@ -9,7 +9,7 @@
 
 #include "libbb.h"
 
-#ifdef CONFIG_FEATURE_MAKEDEVS_LEAF
+#if ENABLE_FEATURE_MAKEDEVS_LEAF
 int makedevs_main(int argc, char **argv);
 int makedevs_main(int argc, char **argv)
 {
@@ -65,7 +65,7 @@ int makedevs_main(int argc, char **argv)
        return 0;
 }
 
-#elif defined CONFIG_FEATURE_MAKEDEVS_TABLE
+#elif ENABLE_FEATURE_MAKEDEVS_TABLE
 
 /* Licensed under the GPL v2 or later, see the file LICENSE in this tarball. */
 
@@ -162,8 +162,7 @@ int makedevs_main(int argc, char **argv)
                                ret = EXIT_FAILURE;
                                goto loop;
                        }
-               } else
-               {
+               } else {
                        dev_t rdev;
 
                        if (type == 'p') {
index acca23012affe9799fdd46f6d0fffb3212d632aa..01e1c5539ada14b40810deec943890f4e5c1834e 100644 (file)
@@ -14,7 +14,7 @@
 #include "libbb.h"
 
 
-#ifndef CONFIG_FEATURE_CHECK_TAINTED_MODULE
+#if !ENABLE_FEATURE_CHECK_TAINTED_MODULE
 static void check_tainted(void) { puts(""); }
 #else
 #define TAINT_FILENAME                  "/proc/sys/kernel/tainted"
@@ -44,7 +44,7 @@ static void check_tainted(void)
 }
 #endif
 
-#ifdef CONFIG_FEATURE_QUERY_MODULE_INTERFACE
+#if ENABLE_FEATURE_QUERY_MODULE_INTERFACE
 
 struct module_info
 {
@@ -131,7 +131,7 @@ int lsmod_main(int argc, char **argv)
                puts("");
        }
 
-#ifdef CONFIG_FEATURE_CLEAN_UP
+#if ENABLE_FEATURE_CLEAN_UP
        free(module_names);
 #endif
 
index 13f5ec20b1f47ad1bf67f43838d1c6d21bc34488..26bad7d7ec86520c650819098c2e51bf0bfc603c 100644 (file)
@@ -10,7 +10,7 @@
 #include "libbb.h"
 #include <sys/syscall.h>
 
-#ifdef CONFIG_FEATURE_2_6_MODULES
+#if ENABLE_FEATURE_2_6_MODULES
 static inline void filename2modname(char *modname, const char *afterslash)
 {
        unsigned int i;
index 2a099eff012b4b636dfd4ca61c42efca0089f8f7..3f99b7511251b16c2bec8715c7942e05df692de2 100644 (file)
@@ -36,7 +36,7 @@ static unsigned long get_netmask(unsigned long ipaddr)
                return 0;
 }
 
-#ifdef CONFIG_FEATURE_IPCALC_FANCY
+#if ENABLE_FEATURE_IPCALC_FANCY
 static int get_prefix(unsigned long netmask)
 {
        unsigned long msk = 0x80000000;
index 69986df256e4398e8fbf9ee622675d69a359f144..a2b8b3800cc04517a3740080ef4ab1681c037dcc 100644 (file)
@@ -37,7 +37,7 @@ enum {
        CMD_INFO = 12,
        CMD_CHANGE = 13,
 
-#ifdef CONFIG_FEATURE_FBSET_FANCY
+#if ENABLE_FEATURE_FBSET_FANCY
        CMD_XRES = 100,
        CMD_YRES = 101,
        CMD_VXRES = 102,
@@ -130,7 +130,7 @@ static const struct cmdoptions_t {
        { "-laced", 1, CMD_LACED },
        { "-double", 1, CMD_DOUBLE },
        { "-n", 0, CMD_CHANGE },
-#ifdef CONFIG_FEATURE_FBSET_FANCY
+#if ENABLE_FEATURE_FBSET_FANCY
        { "-all", 0, CMD_ALL },
        { "-xres", 1, CMD_XRES },
        { "-yres", 1, CMD_YRES },
@@ -158,7 +158,7 @@ static const struct cmdoptions_t {
        { "", 0, 0 }
 };
 
-#ifdef CONFIG_FEATURE_FBSET_READMODE
+#if ENABLE_FEATURE_FBSET_READMODE
 /* taken from linux/fb.h */
 enum {
        FB_VMODE_INTERLACED = 1,        /* interlaced   */
@@ -173,7 +173,7 @@ enum {
 static int readmode(struct fb_var_screeninfo *base, const char *fn,
                                        const char *mode)
 {
-#ifdef CONFIG_FEATURE_FBSET_READMODE
+#if ENABLE_FEATURE_FBSET_READMODE
        FILE *f;
        char buf[256];
        char *p = buf;
@@ -286,7 +286,7 @@ static inline void showmode(struct fb_var_screeninfo *v)
                vrate = hrate / (v->upper_margin + v->yres + v->lower_margin + v->vsync_len);
        }
        printf("\nmode \"%ux%u-%u\"\n"
-#ifdef CONFIG_FEATURE_FBSET_FANCY
+#if ENABLE_FEATURE_FBSET_FANCY
        "\t# D: %.3f MHz, H: %.3f kHz, V: %.3f Hz\n"
 #endif
        "\tgeometry %u %u %u %u %u\n"
@@ -295,7 +295,7 @@ static inline void showmode(struct fb_var_screeninfo *v)
        "\trgba %u/%u,%u/%u,%u/%u,%u/%u\n"
        "endmode\n\n",
                v->xres, v->yres, (int) (vrate + 0.5),
-#ifdef CONFIG_FEATURE_FBSET_FANCY
+#if ENABLE_FEATURE_FBSET_FANCY
                drate / 1e6, hrate / 1e3, vrate,
 #endif
                v->xres, v->yres, v->xres_virtual, v->yres_virtual, v->bits_per_pixel,
@@ -360,7 +360,7 @@ int fbset_main(int argc, char **argv)
                        case CMD_CHANGE:
                                g_options |= OPT_CHANGE;
                                break;
-#ifdef CONFIG_FEATURE_FBSET_FANCY
+#if ENABLE_FEATURE_FBSET_FANCY
                        case CMD_XRES:
                                varset.xres = xatou32(argv[1]);
                                break;
index 867721482848de8b931c31b0a8f1fd95f171b84b..fcb7308fee06acf2c1bc9336d6daa77db87890f9 100644 (file)
@@ -132,7 +132,7 @@ static void from_sys_clock(int utc)
        write_rtc(tv.tv_sec, utc);
 }
 
-#ifdef CONFIG_FEATURE_HWCLOCK_ADJTIME_FHS
+#if ENABLE_FEATURE_HWCLOCK_ADJTIME_FHS
 # define ADJTIME_PATH "/var/lib/hwclock/adjtime"
 #else
 # define ADJTIME_PATH "/etc/adjtime"
index 1e62062171d6f9c69dca652bbec4dc9ab5044f5d..f49d28ee2f816b85f9e83e2a255147c17109bfc5 100644 (file)
@@ -29,7 +29,10 @@ union semun {
 };
 #endif
 
-#ifndef CONFIG_IPCRM_DROP_LEGACY
+#define IPCRM_LEGACY 1
+
+
+#if IPCRM_LEGACY
 
 typedef enum type_id {
        SHM,
@@ -70,7 +73,7 @@ static int remove_ids(type_id type, int argc, char **argv)
 
        return nb_errors;
 }
-#endif /* #ifndef CONFIG_IPCRM_DROP_LEGACY */
+#endif /* IPCRM_LEGACY */
 
 
 int ipcrm_main(int argc, char **argv);
@@ -82,7 +85,7 @@ int ipcrm_main(int argc, char **argv)
        /* if the command is executed without parameters, do nothing */
        if (argc == 1)
                return 0;
-#ifndef CONFIG_IPCRM_DROP_LEGACY
+#if IPCRM_LEGACY
        /* check to see if the command is being invoked in the old way if so
           then run the old code. Valid commands are msg, shm, sem. */
        {
@@ -113,7 +116,7 @@ int ipcrm_main(int argc, char **argv)
                        return 0;
                }
        }
-#endif /* #ifndef CONFIG_IPCRM_DROP_LEGACY */
+#endif /* IPCRM_LEGACY */
 
        /* process new syntax to conform with SYSV ipcrm */
        while ((c = getopt(argc, argv, "q:m:s:Q:M:S:h?")) != -1) {