]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
misc: add static keyword to where needed [smatch scan]
authorSami Kerola <kerolasa@iki.fi>
Sun, 12 Feb 2017 00:19:33 +0000 (00:19 +0000)
committerKarel Zak <kzak@redhat.com>
Mon, 20 Feb 2017 11:58:49 +0000 (12:58 +0100)
text-utils/rev.c:68:9: warning: symbol 'buf' was not declared. Should it be
static?

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
38 files changed:
disk-utils/cfdisk.c
disk-utils/fdformat.c
disk-utils/fdisk-menu.c
disk-utils/fsck.c
disk-utils/fsck.cramfs.c
disk-utils/partx.c
disk-utils/raw.c
disk-utils/sfdisk.c
lib/colors.c
lib/loopdev.c
libblkid/src/superblocks/drbdmanage.c
libblkid/src/topology/evms.c
libfdisk/src/sun.c
login-utils/sulogin.c
login-utils/vipw.c
misc-utils/blkid.c
misc-utils/findmnt.c
misc-utils/getopt.c
misc-utils/kill.c
misc-utils/look.c
misc-utils/lsblk.c
misc-utils/whereis.c
schedutils/ionice.c
sys-utils/hwclock-cmos.c
sys-utils/hwclock.c
sys-utils/ipcs.c
sys-utils/lscpu.c
sys-utils/lsns.c
sys-utils/prlimit.c
sys-utils/renice.c
sys-utils/swapon.c
term-utils/script.c
text-utils/col.c
text-utils/column.c
text-utils/more.c
text-utils/pg.c
text-utils/rev.c
text-utils/ul.c

index 4ad52842ccb5dfd9485e8fc84ce70b6dea586901..f06dad1c857135c205a56cb4d19823f9b0998f12 100644 (file)
@@ -150,8 +150,8 @@ static int ui_resize;
 
 /* ncurses LINES and COLS may be actual variables or *macros*, but we need
  * something portable and writable */
-size_t ui_lines;
-size_t ui_cols;
+static size_t ui_lines;
+static size_t ui_cols;
 
 /* menu item */
 struct cfdisk_menuitem {
@@ -245,7 +245,7 @@ struct cfdisk {
 /*
  * let's use include/debug.h stuff for cfdisk too
  */
-UL_DEBUG_DEFINE_MASK(cfdisk);
+static UL_DEBUG_DEFINE_MASK(cfdisk);
 UL_DEBUG_DEFINE_MASKNAMES(cfdisk) = UL_DEBUG_EMPTY_MASKNAMES;
 
 #define CFDISK_DEBUG_INIT      (1 << 1)
index ad6b62b50d4f1b8ce9e7bf43374bec6ec487d8d3..142bca0ecfdf5eeb293d71a5821ab0f89ec13ad1 100644 (file)
@@ -20,7 +20,7 @@
 
 #define SECTOR_SIZE 512
 
-struct floppy_struct param;
+static struct floppy_struct param;
 
 
 static void format_begin(int ctrl)
index baac9791a04863036b00f6ae24a6efdfc13ec695..9ab28c43f99fbeb8eeb84e9cf8142938ec1871f8 100644 (file)
@@ -89,7 +89,7 @@ DECLARE_MENU_CB(generic_menu_cb);
 #define MENU_XENT_NEST(k, t, l, p)     { .title = t, .key = k, .expert = 1, .label = l, .parent = p }
 
 /* Generic menu */
-struct menu menu_generic = {
+static const struct menu menu_generic = {
        .callback       = generic_menu_cb,
        .entries        = {
                MENU_BSEP(N_("Generic")),
@@ -127,7 +127,7 @@ struct menu menu_generic = {
        }
 };
 
-struct menu menu_createlabel = {
+static const struct menu menu_createlabel = {
        .callback = createlabel_menu_cb,
        .exclude = FDISK_DISKLABEL_BSD,
        .nonested = 1,
@@ -145,7 +145,7 @@ struct menu menu_createlabel = {
        }
 };
 
-struct menu menu_geo = {
+static const struct menu menu_geo = {
        .callback = geo_menu_cb,
        .exclude = FDISK_DISKLABEL_GPT | FDISK_DISKLABEL_BSD,
        .entries = {
@@ -157,7 +157,7 @@ struct menu menu_geo = {
        }
 };
 
-struct menu menu_gpt = {
+static const struct menu menu_gpt = {
        .callback = gpt_menu_cb,
        .label = FDISK_DISKLABEL_GPT,
        .entries = {
@@ -178,7 +178,7 @@ struct menu menu_gpt = {
        }
 };
 
-struct menu menu_sun = {
+static const struct menu menu_sun = {
        .callback = sun_menu_cb,
        .label = FDISK_DISKLABEL_SUN,
        .entries = {
@@ -195,7 +195,7 @@ struct menu menu_sun = {
        }
 };
 
-struct menu menu_sgi = {
+static const struct menu menu_sgi = {
        .callback = sgi_menu_cb,
        .label = FDISK_DISKLABEL_SGI,
        .entries = {
@@ -208,7 +208,7 @@ struct menu menu_sgi = {
        }
 };
 
-struct menu menu_dos = {
+static const struct menu menu_dos = {
        .callback = dos_menu_cb,
        .label = FDISK_DISKLABEL_DOS,
        .entries = {
@@ -226,7 +226,7 @@ struct menu menu_dos = {
        }
 };
 
-struct menu menu_bsd = {
+static const struct menu menu_bsd = {
        .callback = bsd_menu_cb,
        .label = FDISK_DISKLABEL_BSD,
        .entries = {
index 93296c97d615b1ab9572486953d86b2fcb2b0743..cb1b21278c3c3a9c0a2f5aad14d061639e7b82d6 100644 (file)
@@ -931,7 +931,7 @@ err:
 /*
  * Deal with the fsck -t argument.
  */
-struct fs_type_compile {
+static struct fs_type_compile {
        char **list;
        int *type;
        int  negate;
index 81e17be27b57825adf62b3385c8e5aed3d806170..63033d626d2debfa0666ac4493e6ebae6edad770 100644 (file)
 
 static int fd;                 /* ROM image file descriptor */
 static char *filename;         /* ROM image filename */
-struct cramfs_super super;     /* just find the cramfs superblock once */
+static struct cramfs_super super;      /* just find the cramfs superblock once */
 static int cramfs_is_big_endian = 0;   /* source is big endian */
 static int opt_verbose = 0;    /* 1 = verbose (-v), 2+ = very verbose (-vv) */
 static int opt_extract = 0;    /* extract cramfs (-x) */
-char *extract_dir = "";                /* optional extraction directory (-x) */
+static char *extract_dir = "";         /* optional extraction directory (-x) */
 
 #define PAD_SIZE 512
 
index d1964b458f04a1c5347b3465983e20214adae323..a0e337b78b45739a456d1d10fba90672c9c21aa7 100644 (file)
@@ -82,7 +82,7 @@ struct colinfo {
 };
 
 /* columns descriptions */
-struct colinfo infos[] = {
+static struct colinfo infos[] = {
        [COL_PARTNO]   = { "NR",    0.25, SCOLS_FL_RIGHT, N_("partition number") },
        [COL_START]    = { "START",   0.30, SCOLS_FL_RIGHT, N_("start of the partition in sectors") },
        [COL_END]      = { "END",     0.30, SCOLS_FL_RIGHT, N_("end of the partition in sectors") },
@@ -99,7 +99,7 @@ struct colinfo infos[] = {
 
 /* array with IDs of enabled columns */
 static int columns[NCOLS];
-size_t ncolumns;
+static size_t ncolumns;
 
 static int verbose;
 static int partx_flags;
index d5c2a681f102952f5d15a33957e0d58fbf388fca..395e367033b8a07409b6700ccc43b4465fbed1a3 100644 (file)
 
 #define RAW_NR_MINORS 8192
 
-int do_query;
-int do_query_all;
+static int do_query;
+static int do_query_all;
 
-int master_fd;
-int raw_minor;
+static int master_fd;
+static int raw_minor;
 
 void open_raw_ctl(void);
 static int query(int minor_raw, const char *raw_name, int quiet);
index b304acb534123328282da05181da3107e6eb7ebb..f4f9b6b1ad4310f685044989673404816644a6f5 100644 (file)
@@ -55,7 +55,7 @@
 /*
  * sfdisk debug stuff (see fdisk.h and include/debug.h)
  */
-UL_DEBUG_DEFINE_MASK(sfdisk);
+static UL_DEBUG_DEFINE_MASK(sfdisk);
 UL_DEBUG_DEFINE_MASKNAMES(sfdisk) = UL_DEBUG_EMPTY_MASKNAMES;
 
 #define SFDISKPROG_DEBUG_INIT  (1 << 1)
index 99e2228ed29bd4fdd518355526bf23d355a0f5c4..4b280fe2702b4617f1b82260d0d32e8ae1cacdd5 100644 (file)
@@ -34,7 +34,7 @@
 /*
  * terminal-colors.d debug stuff
  */
-UL_DEBUG_DEFINE_MASK(termcolors);
+static UL_DEBUG_DEFINE_MASK(termcolors);
 UL_DEBUG_DEFINE_MASKNAMES(termcolors) = UL_DEBUG_EMPTY_MASKNAMES;
 
 #define TERMCOLORS_DEBUG_INIT  (1 << 1)
index a57e7a73b4e347af7fc265e7dadba2950e78298b..fd4f16692d52acab284364f9459eb269b98a8d3b 100644 (file)
@@ -46,7 +46,7 @@
 /*
  * Debug stuff (based on include/debug.h)
  */
-UL_DEBUG_DEFINE_MASK(loopdev);
+static UL_DEBUG_DEFINE_MASK(loopdev);
 UL_DEBUG_DEFINE_MASKNAMES(loopdev) = UL_DEBUG_EMPTY_MASKNAMES;
 
 #define LOOPDEV_DEBUG_INIT     (1 << 1)
index e84efa3438a2ae83694dfb07a56a13d89c441959..48bf1dabf02ad91781983b3667e95b1029482021 100644 (file)
@@ -35,7 +35,7 @@ struct drbdmanage_pers {
 } __attribute__ ((packed));
 
 
-const char persistence_magic[4] = "\x1a\xdb\x98\xa2";
+static const char persistence_magic[4] = "\x1a\xdb\x98\xa2";
 
 
 static int probe_drbdmanage(blkid_probe pr,
index eed41d8b4fb2e8fa90bf4857ea934c9b67797965..a4656d5b88b222a3a0c150c31045a21fb7e6ce7b 100644 (file)
@@ -30,7 +30,7 @@
 #define _IOT_evms_stripe_info _IOT (_IOTS(uint32_t), 2, 0, 0, 0, 0)
 #define EVMS_GET_STRIPE_INFO   _IOR(EVMS_MAJOR, 0xF0, struct evms_stripe_info)
 
-struct evms_stripe_info {
+static struct evms_stripe_info {
        uint32_t        size;           /* stripe unit 512-byte blocks */
        uint32_t        width;          /* the number of stripe members or RAID data disks */
 } evms_stripe_info;
index ac46d2ae57e34562844f96e9509a4006aee9b0b2..5414a927c62d580c7bc486cfb681c5d0fbcb86b7 100644 (file)
@@ -1121,7 +1121,7 @@ static const struct fdisk_field sun_fields[] =
        { FDISK_FIELD_ATTR,     N_("Flags"),      0,    FDISK_FIELDFL_NUMBER }
 };
 
-const struct fdisk_label_operations sun_operations =
+static const struct fdisk_label_operations sun_operations =
 {
        .probe          = sun_probe_label,
        .write          = sun_write_disklabel,
index b1e8c90f4c6b9abbb69e4fe56ee9ffb623282920..9f539d791d33bd8f5b5bc5defec9645c62a191f2 100644 (file)
@@ -71,11 +71,11 @@ static unsigned int timeout;
 static int profile;
 static volatile uint32_t openfd;               /* Remember higher file descriptors */
 
-struct sigaction saved_sigint;
-struct sigaction saved_sigtstp;
-struct sigaction saved_sigquit;
-struct sigaction saved_sighup;
-struct sigaction saved_sigchld;
+static struct sigaction saved_sigint;
+static struct sigaction saved_sigtstp;
+static struct sigaction saved_sigquit;
+static struct sigaction saved_sighup;
+static struct sigaction saved_sigchld;
 
 static volatile sig_atomic_t alarm_rised;
 static volatile sig_atomic_t sigchild;
index d12ea73164606b25d98f9edc06ef41e75aaf1a7c..4d85924346a1c7ff3ba52895e1e35e772275884d 100644 (file)
@@ -81,9 +81,9 @@ enum {
        VIPW,
        VIGR
 };
-int program;
-char orig_file[FILENAMELEN];   /* original file /etc/passwd or /etc/group */
-char *tmp_file;                        /* tmp file */
+static int program;
+static char orig_file[FILENAMELEN];    /* original file /etc/passwd or /etc/group */
+static char *tmp_file;                 /* tmp file */
 
 void pw_error (char *, int, int);
 
index ca07e9ee7fd4ea860fd9834c513925e9414f3d79..9278553c7045550fb53ccebd927242a0420838db 100644 (file)
@@ -46,7 +46,7 @@
 #include "ttyutils.h"
 #include "xalloc.h"
 
-int raw_chars;
+static int raw_chars;
 
 static void print_version(FILE *out)
 {
index b15a52b9d8c9e367cd1fdd1c138f427911309a17..d83dca92c306faa93d49f050ec4f921af2e329cb 100644 (file)
@@ -154,7 +154,7 @@ struct libmnt_cache *cache;
 
 
 #ifdef HAVE_LIBUDEV
-struct udev *udev;
+static struct udev *udev;
 #endif
 
 static int match_func(struct libmnt_fs *fs, void *data __attribute__ ((__unused__)));
index 94cfec5ad5c1d05b524c53ea97b3e9e968cc0e24..af4cf386a8bd4a3dfac18ca4d1609d6a56390b5f 100644 (file)
@@ -97,8 +97,8 @@ struct getopt_control {
 enum { REALLOC_INCREMENT = 8 };
 
 /* Allow changing which getopt is in use with function pointer. */
-int (*getopt_long_fp) (int argc, char *const *argv, const char *optstr,
-                      const struct option * longopts, int *longindex);
+static int (*getopt_long_fp) (int argc, char *const *argv, const char *optstr,
+                             const struct option * longopts, int *longindex);
 
 /*
  * This function 'normalizes' a single argument: it puts single quotes
index e52a03d4ba81c1ea8f1dc3b84104a5af40c5621e..9046d76d1e0a09a1a411fc81c628168b6419236a 100644 (file)
@@ -82,7 +82,7 @@ struct kill_control {
                verbose:1;
 };
 
-struct signv {
+static const struct signv {
        const char *name;
        int val;
 } sys_signame[] = {
index ae0d576ddc6e73a1bd724a311f157b82fed2192e..3f785a727fcd2b696e9ab1ce9861cd3c12847f46 100644 (file)
 #define        GREATER         1
 #define        LESS            (-1)
 
-int dflag, fflag;
+static int dflag, fflag;
 /* uglified the source a bit with globals, so that we only need
    to allocate comparbuf once */
-int stringlen;
-char *string;
-char *comparbuf;
+static int stringlen;
+static char *string;
+static char *comparbuf;
 
 static char *binary_search (char *, char *);
 static int compare (char *, char *);
@@ -164,7 +164,7 @@ main(int argc, char *argv[])
        return look(front, back);
 }
 
-int
+static int
 look(char *front, char *back)
 {
        int ch;
@@ -232,7 +232,7 @@ look(char *front, char *back)
 #define        SKIP_PAST_NEWLINE(p, back) \
        while (p < back && *p++ != '\n')
 
-char *
+static char *
 binary_search(char *front, char *back)
 {
        char *p;
@@ -266,7 +266,7 @@ binary_search(char *front, char *back)
  *     o front points at the first character in a line.
  *     o front is before or at the first line to be printed.
  */
-char *
+static char *
 linear_search(char *front, char *back)
 {
        while (front < back) {
@@ -286,7 +286,7 @@ linear_search(char *front, char *back)
 /*
  * Print as many lines as match string, starting at front.
  */
-void
+static void
 print_from(char *front, char *back)
 {
        int eol;
@@ -321,7 +321,7 @@ print_from(char *front, char *back)
  * We use strcasecmp etc, since it knows how to ignore case also
  * in other locales.
  */
-int
+static int
 compare(char *s2, char *s2end) {
        int i;
        char *p;
index 5f8a02e8c1e75ca7312e345ead7e78177f29e8b9..a5efb42766ecfec40852fa239477f77e013c1e2c 100644 (file)
@@ -63,7 +63,7 @@
 
 #include "debug.h"
 
-UL_DEBUG_DEFINE_MASK(lsblk);
+static UL_DEBUG_DEFINE_MASK(lsblk);
 UL_DEBUG_DEFINE_MASKNAMES(lsblk) = UL_DEBUG_EMPTY_MASKNAMES;
 
 #define LSBLK_DEBUG_INIT       (1 << 1)
@@ -216,7 +216,7 @@ struct lsblk {
        unsigned int sort_hidden:1;     /* sort column not between output columns */
 };
 
-struct lsblk *lsblk;   /* global handler */
+static struct lsblk *lsblk;    /* global handler */
 
 /* columns[] array specifies all currently wanted output column. The columns
  * are defined by infos[] array and you can specify (on command line) each
@@ -247,7 +247,7 @@ static struct libmnt_table *mtab, *swaps;
 static struct libmnt_cache *mntcache;
 
 #ifdef HAVE_LIBUDEV
-struct udev *udev;
+static struct udev *udev;
 #endif
 
 struct blkdev_cxt {
index 697d66626d8ae1bebdb69754a61b4e011b38dfd3..b5b35f5f5cfb7298bc6849f9d5f38a0f75eba7a1 100644 (file)
@@ -57,7 +57,7 @@
 
 #include "debug.h"
 
-UL_DEBUG_DEFINE_MASK(whereis);
+static UL_DEBUG_DEFINE_MASK(whereis);
 UL_DEBUG_DEFINE_MASKNAMES(whereis) = UL_DEBUG_EMPTY_MASKNAMES;
 
 #define WHEREIS_DEBUG_INIT     (1 << 1)
index 38a6846f9b8452efc5516f3a0159a87ae61d3351..1cbde8faafd7d3645fcb2541e91dd8a7d8766213 100644 (file)
@@ -51,7 +51,7 @@ enum {
 #define IOPRIO_PRIO_DATA(mask) ((mask) & IOPRIO_PRIO_MASK)
 #define IOPRIO_PRIO_VALUE(class, data) (((class) << IOPRIO_CLASS_SHIFT) | data)
 
-const char *to_prio[] = {
+static const char *to_prio[] = {
        [IOPRIO_CLASS_NONE] = "none",
        [IOPRIO_CLASS_RT]   = "realtime",
        [IOPRIO_CLASS_BE]   = "best-effort",
index 013fe094df666978e4df4026f41f7463067746dd..4915471bd3706f37e0a91f0e7acbdd992985d5f2 100644 (file)
 #  undef __i386__
 #  undef __x86_64__
 #  warning "disable cmos access - no sys/io.h or asm/io.h"
-void outb(int a __attribute__((__unused__)),
-         int b __attribute__((__unused__)))
+static void outb(int a __attribute__((__unused__)),
+                int b __attribute__((__unused__)))
 {
 }
 
-int inb(int c __attribute__((__unused__)))
+static int inb(int c __attribute__((__unused__)))
 {
        return 0;
 }
@@ -117,7 +117,7 @@ static int inb(int c __attribute__((__unused__)))
  * like SRM.) It is reported that ALPHA_PRE_V1_2_SRM_CONSOLE uses 1958.
  */
 #define TM_EPOCH 1900
-int cmos_epoch = 1900;
+static int cmos_epoch = 1900;
 
 /*
  * Martin Ostermann writes:
@@ -133,18 +133,18 @@ int cmos_epoch = 1900;
  * Jensen when USE_DEV_PORT was defined, but not with the normal inb/outb
  * functions.
  */
-int use_dev_port = 0;          /* 1 for Jensen */
-int dev_port_fd;
-unsigned short clock_ctl_addr = 0x70;  /* 0x170 for Jensen */
-unsigned short clock_data_addr = 0x71; /* 0x171 for Jensen */
+static int use_dev_port = 0;           /* 1 for Jensen */
+static int dev_port_fd;
+static unsigned short clock_ctl_addr = 0x70;   /* 0x170 for Jensen */
+static unsigned short clock_data_addr = 0x71;  /* 0x171 for Jensen */
 
-int century_byte = 0;          /* 0: don't access a century byte
-                                * 50 (0x32): usual PC value
-                                * 55 (0x37): PS/2
-                                */
+static int century_byte = 0;           /* 0: don't access a century byte
+                                        * 50 (0x32): usual PC value
+                                        * 55 (0x37): PS/2
+                                        */
 
 #ifdef __alpha__
-int funkyTOY = 0;              /* 1 for PC164/LX164/SX164 type alpha */
+static int funkyTOY = 0;               /* 1 for PC164/LX164/SX164 type alpha */
 #endif
 
 #ifdef __alpha
index 9fae9df235376130a74d0b0afeab5d9bb120f3cf..21d1304e11e716763f9746a268595083cc36d655 100644 (file)
@@ -90,7 +90,7 @@ static int hwaudit_fd = -1;
 #endif
 
 /* The struct that holds our hardware access routines */
-struct clock_ops *ur;
+static struct clock_ops *ur;
 
 /* Maximal clock adjustment in seconds per day.
    (adjtime() glibc call has 2145 seconds limit on i386, so it is good enough for us as well,
index 6fab5b8108a7feb448da0a6a984489451dc94946..4f3d23d90762afcc0cd1560d8c92b6133a260ba7 100644 (file)
@@ -596,7 +596,7 @@ static void print_shm(int shmid, int unit)
        ipc_shm_free_info(shmdata);
 }
 
-void print_msg(int msgid, int unit)
+static void print_msg(int msgid, int unit)
 {
        struct msg_data *msgdata;
 
index 92ffba44ae7a2a11724cbfc69c92c33608b2325a..683fd66f7009ad86f19182c27cc80680e33f3243 100644 (file)
@@ -104,14 +104,14 @@ enum {
        VIRT_FULL,
        VIRT_CONT
 };
-const char *virt_types[] = {
+static const char *virt_types[] = {
        [VIRT_NONE]     = N_("none"),
        [VIRT_PARA]     = N_("para"),
        [VIRT_FULL]     = N_("full"),
        [VIRT_CONT]     = N_("container"),
 };
 
-const char *hv_vendors[] = {
+static const char *hv_vendors[] = {
        [HYPER_NONE]    = NULL,
        [HYPER_XEN]     = "Xen",
        [HYPER_KVM]     = "KVM",
@@ -130,7 +130,7 @@ const char *hv_vendors[] = {
        [HYPER_WSL]     = "Windows Subsystem for Linux"
 };
 
-const int hv_vendor_pci[] = {
+static const int hv_vendor_pci[] = {
        [HYPER_NONE]    = 0x0000,
        [HYPER_XEN]     = 0x5853,
        [HYPER_KVM]     = 0x0000,
@@ -139,7 +139,7 @@ const int hv_vendor_pci[] = {
        [HYPER_VBOX]    = 0x80ee,
 };
 
-const int hv_graphics_pci[] = {
+static const int hv_graphics_pci[] = {
        [HYPER_NONE]    = 0x0000,
        [HYPER_XEN]     = 0x0001,
        [HYPER_KVM]     = 0x0000,
@@ -169,7 +169,7 @@ enum {
        DISP_VERTICAL   = 1
 };
 
-const char *disp_modes[] = {
+static const char *disp_modes[] = {
        [DISP_HORIZONTAL]       = N_("horizontal"),
        [DISP_VERTICAL]         = N_("vertical")
 };
@@ -188,7 +188,7 @@ struct polarization_modes {
        char *readable;
 };
 
-struct polarization_modes polar_modes[] = {
+static struct polarization_modes polar_modes[] = {
        [POLAR_UNKNOWN]    = {"U",  "-"},
        [POLAR_VLOW]       = {"VL", "vert-low"},
        [POLAR_VMEDIUM]    = {"VM", "vert-medium"},
index 0c4ff449d5cf64ee776d759292c2e71db1076635..ecb0d896947031f5b291a74af1ae19cdeb55780e 100644 (file)
@@ -44,7 +44,7 @@
 
 #include "debug.h"
 
-UL_DEBUG_DEFINE_MASK(lsns);
+static UL_DEBUG_DEFINE_MASK(lsns);
 UL_DEBUG_DEFINE_MASKNAMES(lsns) = UL_DEBUG_EMPTY_MASKNAMES;
 
 #define LSNS_DEBUG_INIT                (1 << 1)
@@ -55,7 +55,7 @@ UL_DEBUG_DEFINE_MASKNAMES(lsns) = UL_DEBUG_EMPTY_MASKNAMES;
 #define DBG(m, x)       __UL_DBG(lsns, LSNS_DEBUG_, m, x)
 #define ON_DBG(m, x)    __UL_DBG_CALL(lsns, LSNS_DEBUG_, m, x)
 
-struct idcache *uid_cache = NULL;
+static struct idcache *uid_cache = NULL;
 
 /* column IDs */
 enum {
index b4ad739ed08e27f4606fe5241919c55959bef4c5..c96d38589ebf9c3fe3bbad2f3b4ff23104c4272a 100644 (file)
@@ -119,7 +119,7 @@ struct colinfo {
 };
 
 /* columns descriptions */
-struct colinfo infos[] = {
+static struct colinfo infos[] = {
        [COL_RES]     = { "RESOURCE",    0.25, SCOLS_FL_TRUNC, N_("resource name") },
        [COL_HELP]    = { "DESCRIPTION", 0.1,  SCOLS_FL_TRUNC, N_("resource description")},
        [COL_SOFT]    = { "SOFT",        0.1,  SCOLS_FL_RIGHT, N_("soft limit")},
index 656a111dad42e09f5a4eb8689e2a043a07dc6f5e..bc6e3c849b45e5a5dabfbcca932d1d82df850ade 100644 (file)
@@ -48,7 +48,7 @@
 #include "c.h"
 #include "closestream.h"
 
-const char *idtype[] = {
+static const char *idtype[] = {
        [PRIO_PROCESS]  = N_("process ID"),
        [PRIO_PGRP]     = N_("process group ID"),
        [PRIO_USER]     = N_("user ID"),
index d0ad6bb6f48ad36923acc45fe107fb0c8b1b10a4..f6005e67d48f22e3f99bf423c7feade52db91068 100644 (file)
@@ -89,7 +89,7 @@ enum {
        COL_UUID,
        COL_LABEL
 };
-struct colinfo infos[] = {
+static struct colinfo infos[] = {
        [COL_PATH]     = { "NAME",      0.20, 0, N_("device file or partition path") },
        [COL_TYPE]     = { "TYPE",      0.20, SCOLS_FL_TRUNC, N_("type of the device")},
        [COL_SIZE]     = { "SIZE",      0.20, SCOLS_FL_RIGHT, N_("size of the swap area")},
index 6e12ecaa9829a60eeefb4612e6ca28783da0ecb8..d1ef07203f7afa1d0be8878a2d46c1f31fba3e77 100644 (file)
@@ -73,7 +73,7 @@
 
 #include "debug.h"
 
-UL_DEBUG_DEFINE_MASK(script);
+static UL_DEBUG_DEFINE_MASK(script);
 UL_DEBUG_DEFINE_MASKNAMES(script) = UL_DEBUG_EMPTY_MASKNAMES;
 
 #define SCRIPT_DEBUG_INIT      (1 << 1)
index b35306e48faaf8426265023b53f40d0aa2ac7b4c..b236b891f7e419fd3abaec9b141179fd23ce4432 100644 (file)
@@ -111,14 +111,14 @@ void flush_lines(int);
 void flush_blanks(void);
 LINE *alloc_line(void);
 
-CSET last_set;                 /* char_set of last char printed */
-LINE *lines;
-int compress_spaces;           /* if doing space -> tab conversion */
-int fine;                      /* if `fine' resolution (half lines) */
-unsigned max_bufd_lines;       /* max # lines to keep in memory */
-int nblank_lines;              /* # blanks after last flushed line */
-int no_backspaces;             /* if not to output any backspaces */
-int pass_unknown_seqs;         /* whether to pass unknown control sequences */
+static CSET last_set;                  /* char_set of last char printed */
+static LINE *lines;
+static int compress_spaces;            /* if doing space -> tab conversion */
+static int fine;                       /* if `fine' resolution (half lines) */
+static unsigned max_bufd_lines;                /* max # lines to keep in memory */
+static int nblank_lines;               /* # blanks after last flushed line */
+static int no_backspaces;              /* if not to output any backspaces */
+static int pass_unknown_seqs;          /* whether to pass unknown control sequences */
 
 #define        PUTC(ch) \
        if (putwchar(ch) == WEOF) \
index deeea855e70390c7306ed1f53098acb2f83062d0..3d50f2e27f7fd540f7eaa81dcd5683bf03b3ccd2 100644 (file)
@@ -308,8 +308,8 @@ static void print(wchar_t **list, int entries)
        }
 }
 
-wchar_t *local_wcstok(wchar_t * p, const wchar_t * separator, int greedy,
-                     wchar_t ** wcstok_state)
+static wchar_t *local_wcstok(wchar_t *p, const wchar_t *separator, int greedy,
+                            wchar_t **wcstok_state)
 {
        wchar_t *result;
        if (greedy)
index ea881e8ed0bc93e5572f36f84d14d176a05d393c..d4aba11e46a5f7f6a03fdd5b2e2477cf78a96491 100644 (file)
@@ -136,56 +136,56 @@ void prepare_line_buffer(void);
 #define COMMAND_BUF    200
 #define REGERR_BUF     NUM_COLUMNS
 
-struct termios otty, savetty0;
-long file_pos, file_size;
-int fnum, no_intty, no_tty, slow_tty;
-int dum_opt, dlines;
-void onquit(int), onsusp(int), chgwinsz(int), end_it(int);
-int nscroll = SCROLL_LEN;      /* Number of lines scrolled by 'd' */
-int fold_opt = 1;              /* Fold long lines */
-int stop_opt = 1;              /* Stop after form feeds */
-int ssp_opt = 0;               /* Suppress white space */
-int ul_opt = 1;                        /* Underline as best we can */
-int promptlen;
-int Currline;                  /* Line we are currently at */
-int startup = 1;
-int firstf = 1;
-int notell = 1;
-int docrterase = 0;
-int docrtkill = 0;
-int bad_so;                    /* True if overwriting does not turn
-                                  off standout */
-int inwait, Pause, errors;
-int within;                    /* true if we are within a file,
-                                  false if we are between files */
-int hard, dumb, noscroll, hardtabs, clreol, eatnl;
-int catch_susp;                        /* We should catch the SIGTSTP signal */
-char **fnames;                 /* The list of file names */
-int nfiles;                    /* Number of files left to process */
-char *shell;                   /* The name of the shell to use */
-int shellp;                    /* A previous shell command exists */
-sigjmp_buf restore;
-char *Line;                    /* Line buffer */
-size_t LineLen;                        /* size of Line buffer */
-int Lpp = LINES_PER_PAGE;      /* lines per page */
-char *Clear;                   /* clear screen */
-char *eraseln;                 /* erase line */
-char *Senter, *Sexit;          /* enter and exit standout mode */
-char *ULenter, *ULexit;                /* enter and exit underline mode */
-char *chUL;                    /* underline character */
-char *chBS;                    /* backspace character */
-char *Home;                    /* go to home */
-char *cursorm;                 /* cursor movement */
-char cursorhome[40];           /* contains cursor movement to home */
-char *EodClr;                  /* clear rest of screen */
-int Mcol = NUM_COLUMNS;                /* number of columns */
-int Wrap = 1;                  /* set if automargins */
-int soglitch;                  /* terminal has standout mode glitch */
-int ulglitch;                  /* terminal has underline mode glitch */
-int pstate = 0;                        /* current UL state */
+static struct termios otty, savetty0;
+static long file_pos, file_size;
+static int fnum, no_intty, no_tty, slow_tty;
+static int dum_opt, dlines;
+static void onquit(int), onsusp(int), chgwinsz(int), end_it(int);
+static int nscroll = SCROLL_LEN;       /* Number of lines scrolled by 'd' */
+static int fold_opt = 1;               /* Fold long lines */
+static int stop_opt = 1;               /* Stop after form feeds */
+static int ssp_opt = 0;                        /* Suppress white space */
+static int ul_opt = 1;                 /* Underline as best we can */
+static int promptlen;
+static int Currline;                   /* Line we are currently at */
+static int startup = 1;
+static int firstf = 1;
+static int notell = 1;
+static int docrterase = 0;
+static int docrtkill = 0;
+static int bad_so;                     /* True if overwriting does not turn
+                                          off standout */
+static int inwait, Pause, errors;
+static int within;                     /* true if we are within a file,
+                                          false if we are between files */
+static int hard, dumb, noscroll, hardtabs, clreol, eatnl;
+static int catch_susp;                 /* We should catch the SIGTSTP signal */
+static char **fnames;                  /* The list of file names */
+static int nfiles;                     /* Number of files left to process */
+static char *shell;                    /* The name of the shell to use */
+static int shellp;                     /* A previous shell command exists */
+static sigjmp_buf restore;
+static char *Line;                     /* Line buffer */
+static size_t LineLen;                 /* size of Line buffer */
+static int Lpp = LINES_PER_PAGE;       /* lines per page */
+static char *Clear;                    /* clear screen */
+static char *eraseln;                  /* erase line */
+static char *Senter, *Sexit;           /* enter and exit standout mode */
+static char *ULenter, *ULexit;         /* enter and exit underline mode */
+static char *chUL;                     /* underline character */
+static char *chBS;                     /* backspace character */
+static char *Home;                     /* go to home */
+static char *cursorm;                  /* cursor movement */
+static char cursorhome[40];            /* contains cursor movement to home */
+static char *EodClr;                   /* clear rest of screen */
+static int Mcol = NUM_COLUMNS;         /* number of columns */
+static int Wrap = 1;                   /* set if automargins */
+static int soglitch;                   /* terminal has standout mode glitch */
+static int ulglitch;                   /* terminal has underline mode glitch */
+static int pstate = 0;                 /* current UL state */
 static int magic(FILE *, char *);
-char *previousre;              /* previous search() buf[] item */
-struct {
+static char *previousre;               /* previous search() buf[] item */
+static struct {
        long chrctr, line;
 } context, screen_start;
 extern char PC;                        /* pad character */
@@ -631,7 +631,7 @@ void screen(register FILE *f, register int num_lines)
 }
 
 /* Come here if a quit signal is received */
-void onquit(int dummy __attribute__((__unused__)))
+static void onquit(int dummy __attribute__((__unused__)))
 {
        signal(SIGQUIT, SIG_IGN);
        if (!inwait) {
@@ -650,7 +650,7 @@ void onquit(int dummy __attribute__((__unused__)))
 
 /* Come here if a signal for a window size change is received */
 #ifdef SIGWINCH
-void chgwinsz(int dummy __attribute__((__unused__)))
+static void chgwinsz(int dummy __attribute__((__unused__)))
 {
        struct winsize win;
 
@@ -671,7 +671,7 @@ void chgwinsz(int dummy __attribute__((__unused__)))
 #endif                         /* SIGWINCH */
 
 /* Clean up terminal state and exit. Also come here if interrupt signal received */
-void __attribute__((__noreturn__)) end_it(int dummy __attribute__((__unused__)))
+static void __attribute__((__noreturn__)) end_it(int dummy __attribute__((__unused__)))
 {
        /* May be executed as a signal handler as well as by main process.
         *
@@ -1096,7 +1096,7 @@ void home(void)
 
 static int lastcmd, lastarg, lastp;
 static int lastcolon;
-char shell_line[SHELL_LINE];
+static char shell_line[SHELL_LINE];
 
 /* Read a command and do it.  A command consists of an optional integer
  * argument followed by the command character.  Return the number of
index ed62adcfde66e5c2b7647d0579f6820bcccbcca5..b05ec3d70eb68532955490b54f7eed85b9cd3a04 100644 (file)
@@ -96,7 +96,7 @@ enum {
 };
 
 /* Current command */
-struct {
+static struct {
        char cmdline[CMDBUF];
        size_t cmdlen;
        int count;
@@ -106,42 +106,42 @@ struct {
 } cmd;
 
 /* Position of file arguments on argv[] to main() */
-struct {
+static struct {
        int first;
        int current;
        int last;
 } files;
 
-void (*oldint) (int);          /* old SIGINT handler */
-void (*oldquit) (int);         /* old SIGQUIT handler */
-void (*oldterm) (int);         /* old SIGTERM handler */
-char *tty;                     /* result of ttyname(1) */
-unsigned ontty;                        /* whether running on tty device */
-unsigned exitstatus;           /* exit status */
-int pagelen = 23;              /* lines on a single screen page */
-int ttycols = 79;              /* screen columns (starting at 0) */
-struct termios otio;           /* old termios settings */
-int tinfostat = -1;            /* terminfo routines initialized */
-int searchdisplay = TOP;       /* matching line position */
-regex_t re;                    /* regular expression to search for */
-int remembered;                        /* have a remembered search string */
-int cflag;                     /* clear screen before each page */
-int eflag;                     /* suppress (EOF) */
-int fflag;                     /* do not split lines */
-int nflag;                     /* no newline for commands required */
-int rflag;                     /* "restricted" pg */
-int sflag;                     /* use standout mode */
-const char *pstring = ":";     /* prompt string */
-char *searchfor;               /* search pattern from argv[] */
-int havepagelen;               /* page length is manually defined */
-long startline;                        /* start line from argv[] */
-int nextfile = 1;              /* files to advance */
-jmp_buf jmpenv;                        /* jump from signal handlers */
-int canjump;                   /* jmpenv is valid */
-wchar_t wbuf[READBUF];         /* used in several widechar routines */
-
-char *copyright;
-const char *helpscreen = N_("\
+static void (*oldint) (int);           /* old SIGINT handler */
+static void (*oldquit) (int);          /* old SIGQUIT handler */
+static void (*oldterm) (int);          /* old SIGTERM handler */
+static char *tty;                      /* result of ttyname(1) */
+static unsigned ontty;                 /* whether running on tty device */
+static unsigned exitstatus;            /* exit status */
+static int pagelen = 23;               /* lines on a single screen page */
+static int ttycols = 79;               /* screen columns (starting at 0) */
+static struct termios otio;            /* old termios settings */
+static int tinfostat = -1;             /* terminfo routines initialized */
+static int searchdisplay = TOP;        /* matching line position */
+static regex_t re;                     /* regular expression to search for */
+static int remembered;                 /* have a remembered search string */
+static int cflag;                      /* clear screen before each page */
+static int eflag;                      /* suppress (EOF) */
+static int fflag;                      /* do not split lines */
+static int nflag;                      /* no newline for commands required */
+static int rflag;                      /* "restricted" pg */
+static int sflag;                      /* use standout mode */
+static const char *pstring = ":";      /* prompt string */
+static char *searchfor;                /* search pattern from argv[] */
+static int havepagelen;                /* page length is manually defined */
+static long startline;                 /* start line from argv[] */
+static int nextfile = 1;               /* files to advance */
+static jmp_buf jmpenv;                 /* jump from signal handlers */
+static int canjump;                    /* jmpenv is valid */
+static wchar_t wbuf[READBUF];          /* used in several widechar routines */
+
+static char *copyright;
+static const char *helpscreen = N_("\
 -------------------------------------------------------\n\
   h                       this screen\n\
   q or Q                  quit program\n\
index b4ae892f16115c6074f13b9e338bb5c6d0db966b..feed2b167c4effc6983f372bae078edd6bf36969 100644 (file)
@@ -64,7 +64,7 @@
 #include "c.h"
 #include "closestream.h"
 
-wchar_t *buf;
+static wchar_t *buf;
 
 static void sig_handler(int signo __attribute__ ((__unused__)))
 {
index de6da81780ff74bac36ea72b53a801685eeb8a66..178d5cb7fbb5ffe64c397a2679fee7eb9837ee1e 100644 (file)
@@ -70,7 +70,6 @@ static int put1wc(int c)
 #define putwp(s) putp(s)
 #endif
 
-static void usage(FILE *out);
 static int handle_escape(FILE * f);
 static void filter(FILE *f);
 static void flushln(void);
@@ -101,33 +100,33 @@ static void print_out(char *line);
 #define        UNDERL  010     /* Ul */
 #define        BOLD    020     /* Bold */
 
-int    must_use_uc, must_overstrike;
-char   *CURS_UP,
-       *CURS_RIGHT,
-       *CURS_LEFT,
-       *ENTER_STANDOUT,
-       *EXIT_STANDOUT,
-       *ENTER_UNDERLINE,
-       *EXIT_UNDERLINE,
-       *ENTER_DIM,
-       *ENTER_BOLD,
-       *ENTER_REVERSE,
-       *UNDER_CHAR,
-       *EXIT_ATTRIBUTES;
-
-struct CHAR    {
+static int     must_use_uc, must_overstrike;
+static char    *CURS_UP,
+               *CURS_RIGHT,
+               *CURS_LEFT,
+               *ENTER_STANDOUT,
+               *EXIT_STANDOUT,
+               *ENTER_UNDERLINE,
+               *EXIT_UNDERLINE,
+               *ENTER_DIM,
+               *ENTER_BOLD,
+               *ENTER_REVERSE,
+               *UNDER_CHAR,
+               *EXIT_ATTRIBUTES;
+
+struct CHAR {
        char    c_mode;
        wchar_t c_char;
        int     c_width;
 };
 
-struct CHAR    *obuf;
-int    obuflen;
-int    col, maxcol;
-int    mode;
-int    halfpos;
-int    upln;
-int    iflag;
+static struct  CHAR    *obuf;
+static int     obuflen;
+static int     col, maxcol;
+static int     mode;
+static int     halfpos;
+static int     upln;
+static int     iflag;
 
 static void __attribute__((__noreturn__))
 usage(FILE *out)