misc: add static keyword to where needed [smatch scan]

text-utils/rev.c:68:9: warning: symbol 'buf' was not declared. Should it be
static?

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
This commit is contained in:
Sami Kerola 2017-02-12 00:19:33 +00:00 committed by Karel Zak
parent 8791804065
commit 2ba641e5f3
38 changed files with 197 additions and 198 deletions

View 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)

View File

@ -20,7 +20,7 @@
#define SECTOR_SIZE 512
struct floppy_struct param;
static struct floppy_struct param;
static void format_begin(int ctrl)

View 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 = {

View 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;

View File

@ -69,11 +69,11 @@
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

View 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;

View File

@ -32,11 +32,11 @@
#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);

View 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)

View 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)

View 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)

View 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,

View 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;

View 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,

View 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;

View 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);

View File

@ -46,7 +46,7 @@
#include "ttyutils.h"
#include "xalloc.h"
int raw_chars;
static int raw_chars;
static void print_version(FILE *out)
{

View 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__)));

View 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

View File

@ -82,7 +82,7 @@ struct kill_control {
verbose:1;
};
struct signv {
static const struct signv {
const char *name;
int val;
} sys_signame[] = {

View File

@ -66,12 +66,12 @@
#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;

View 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 {

View 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)

View 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",

View File

@ -66,12 +66,12 @@
# 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

View 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,

View 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;

View 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"},

View 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 {

View 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")},

View 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"),

View 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")},

View 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)

View 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) \

View 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)

View 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

View 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 */
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 */
char *copyright;
const char *helpscreen = N_("\
static char *copyright;
static const char *helpscreen = N_("\
-------------------------------------------------------\n\
h this screen\n\
q or Q quit program\n\

View 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__)))
{

View 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;
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 {
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)