summaryrefslogtreecommitdiffstats
path: root/text-utils
diff options
context:
space:
mode:
authorSami Kerola2017-02-12 01:19:33 +0100
committerKarel Zak2017-02-20 12:58:49 +0100
commit2ba641e5f3879593e36fa84872289872a4060d03 (patch)
tree4381e82a91b01343555d803c8afe772e1d15826d /text-utils
parentmisc: do not use plain 0 as NULL [smatch scan] (diff)
downloadkernel-qcow2-util-linux-2ba641e5f3879593e36fa84872289872a4060d03.tar.gz
kernel-qcow2-util-linux-2ba641e5f3879593e36fa84872289872a4060d03.tar.xz
kernel-qcow2-util-linux-2ba641e5f3879593e36fa84872289872a4060d03.zip
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>
Diffstat (limited to 'text-utils')
-rw-r--r--text-utils/col.c16
-rw-r--r--text-utils/column.c4
-rw-r--r--text-utils/more.c106
-rw-r--r--text-utils/pg.c64
-rw-r--r--text-utils/rev.c2
-rw-r--r--text-utils/ul.c45
6 files changed, 118 insertions, 119 deletions
diff --git a/text-utils/col.c b/text-utils/col.c
index b35306e48..b236b891f 100644
--- a/text-utils/col.c
+++ b/text-utils/col.c
@@ -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) \
diff --git a/text-utils/column.c b/text-utils/column.c
index deeea855e..3d50f2e27 100644
--- a/text-utils/column.c
+++ b/text-utils/column.c
@@ -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)
diff --git a/text-utils/more.c b/text-utils/more.c
index ea881e8ed..d4aba11e4 100644
--- a/text-utils/more.c
+++ b/text-utils/more.c
@@ -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
diff --git a/text-utils/pg.c b/text-utils/pg.c
index ed62adcfd..b05ec3d70 100644
--- a/text-utils/pg.c
+++ b/text-utils/pg.c
@@ -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\
diff --git a/text-utils/rev.c b/text-utils/rev.c
index b4ae892f1..feed2b167 100644
--- a/text-utils/rev.c
+++ b/text-utils/rev.c
@@ -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__)))
{
diff --git a/text-utils/ul.c b/text-utils/ul.c
index de6da8178..178d5cb7f 100644
--- a/text-utils/ul.c
+++ b/text-utils/ul.c
@@ -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)