summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2015-11-09 16:39:14 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2015-11-09 16:39:14 +0000
commit09e0a564ee0d7993ffe3cd115be1e567dfcb464d (patch)
treee18b1cb036f3edecbafc6bfba7a134c1475a55e6
parent449a8b6a5cad2487bd8f8e2beb10fc2356f91538 (diff)
error() is not a stdarg function, so there is no reason for NULL_PARG
to be special. Simply use NULL.
-rw-r--r--usr.bin/less/brac.c10
-rw-r--r--usr.bin/less/ch.c12
-rw-r--r--usr.bin/less/command.c30
-rw-r--r--usr.bin/less/decode.c6
-rw-r--r--usr.bin/less/edit.c6
-rw-r--r--usr.bin/less/filename.c4
-rw-r--r--usr.bin/less/jump.c10
-rw-r--r--usr.bin/less/less.h2
-rw-r--r--usr.bin/less/linenum.c4
-rw-r--r--usr.bin/less/lsystem.c4
-rw-r--r--usr.bin/less/main.c10
-rw-r--r--usr.bin/less/mark.c8
-rw-r--r--usr.bin/less/optfunc.c22
-rw-r--r--usr.bin/less/option.c8
-rw-r--r--usr.bin/less/pattern.c2
-rw-r--r--usr.bin/less/search.c8
-rw-r--r--usr.bin/less/tags.c8
17 files changed, 76 insertions, 78 deletions
diff --git a/usr.bin/less/brac.c b/usr.bin/less/brac.c
index 1a8ce4691ef..b27ea6162f5 100644
--- a/usr.bin/less/brac.c
+++ b/usr.bin/less/brac.c
@@ -40,9 +40,9 @@ match_brac(int obrac, int cbrac, int forwdir, int n)
pos = position((forwdir) ? TOP : BOTTOM);
if (pos == -1 || ch_seek(pos)) {
if (forwdir)
- error("Nothing in top line", NULL_PARG);
+ error("Nothing in top line", NULL);
else
- error("Nothing in bottom line", NULL_PARG);
+ error("Nothing in bottom line", NULL);
return;
}
@@ -52,9 +52,9 @@ match_brac(int obrac, int cbrac, int forwdir, int n)
do {
if ((c = ch_forw_get()) == '\n' || c == EOI) {
if (forwdir)
- error("No bracket in top line", NULL_PARG);
+ error("No bracket in top line", NULL);
else
- error("No bracket in bottom line", NULL_PARG);
+ error("No bracket in bottom line", NULL);
return;
}
} while (c != obrac || --n > 0);
@@ -86,5 +86,5 @@ match_brac(int obrac, int cbrac, int forwdir, int n)
return;
}
}
- error("No matching bracket", NULL_PARG);
+ error("No matching bracket", NULL);
}
diff --git a/usr.bin/less/ch.c b/usr.bin/less/ch.c
index 38a502a233c..547345896d8 100644
--- a/usr.bin/less/ch.c
+++ b/usr.bin/less/ch.c
@@ -227,7 +227,7 @@ read_more:
if (!(ch_flags & CH_CANSEEK))
return ('?');
if (lseek(ch_file, (off_t)pos, SEEK_SET) == BAD_LSEEK) {
- error("seek error", NULL_PARG);
+ error("seek error", NULL);
clear_eol();
return (EOI);
}
@@ -251,7 +251,7 @@ read_more:
if (n == READ_INTR)
return (EOI);
if (n < 0) {
- error("read error", NULL_PARG);
+ error("read error", NULL);
clear_eol();
n = 0;
}
@@ -341,7 +341,7 @@ void
ch_ungetchar(int c)
{
if (c != -1 && ch_ungotchar != -1)
- error("ch_ungetchar overrun", NULL_PARG);
+ error("ch_ungetchar overrun", NULL);
ch_ungotchar = c;
}
@@ -358,7 +358,7 @@ end_logfile(void)
return;
if (!tried && ch_fsize == -1) {
tried = TRUE;
- ierror("Finishing logfile", NULL_PARG);
+ ierror("Finishing logfile", NULL);
while (ch_forw_get() != EOI)
if (ABORT_SIGS())
break;
@@ -395,7 +395,7 @@ sync_logfile(void)
}
}
if (!wrote && !warned) {
- error("Warning: log file is incomplete", NULL_PARG);
+ error("Warning: log file is incomplete", NULL);
warned = TRUE;
}
}
@@ -661,7 +661,7 @@ ch_flush(void)
* there's a good chance we're at the beginning anyway.
* {{ I think this is bogus reasoning. }}
*/
- error("seek error to 0", NULL_PARG);
+ error("seek error to 0", NULL);
}
}
diff --git a/usr.bin/less/command.c b/usr.bin/less/command.c
index 25ec46e23c7..c60c0b23f25 100644
--- a/usr.bin/less/command.c
+++ b/usr.bin/less/command.c
@@ -227,11 +227,11 @@ exec_mca(void)
/* POSIX behavior - probably not generally useful */
if (less_is_more && (strcmp(cbuf, "#") == 0)) {
if (ntags()) {
- error("No previous file", NULL_PARG);
+ error("No previous file", NULL);
break;
}
if (edit_prev(1)) {
- error("No previous file", NULL_PARG);
+ error("No previous file", NULL);
} else {
jump_back(1);
}
@@ -245,7 +245,7 @@ exec_mca(void)
if (secure)
break;
(void) pipe_mark(pipec, cbuf);
- error("|done", NULL_PARG);
+ error("|done", NULL);
break;
}
}
@@ -857,7 +857,7 @@ multi_search(char *pattern, int n)
* Print an error message if we haven't already.
*/
if (n > 0)
- error("Pattern not found", NULL_PARG);
+ error("Pattern not found", NULL);
if (changed_file) {
/*
@@ -1375,7 +1375,7 @@ again:
error(less_is_more
? "Invalid option -p h"
: "Invalid option ++h",
- NULL_PARG);
+ NULL);
break;
}
cmd_exec();
@@ -1389,7 +1389,7 @@ again:
* Edit a new file. Get the filename.
*/
if (secure) {
- error("Command not available", NULL_PARG);
+ error("Command not available", NULL);
break;
}
start_mca(A_EXAMINE, "Examine: ", ml_examine, 0);
@@ -1401,18 +1401,18 @@ again:
* Invoke an editor on the input file.
*/
if (secure) {
- error("Command not available", NULL_PARG);
+ error("Command not available", NULL);
break;
}
if (ch_getflags() & CH_HELPFILE)
break;
if (strcmp(get_filename(curr_ifile), "-") == 0) {
- error("Cannot edit standard input", NULL_PARG);
+ error("Cannot edit standard input", NULL);
break;
}
if (curr_altfilename != NULL) {
error("WARNING: This file was viewed via "
- "LESSOPEN", NULL_PARG);
+ "LESSOPEN", NULL);
}
/*
* Expand the editor prototype string
@@ -1430,7 +1430,7 @@ again:
* Examine next file.
*/
if (ntags()) {
- error("No next file", NULL_PARG);
+ error("No next file", NULL);
break;
}
if (number <= 0)
@@ -1449,7 +1449,7 @@ again:
* Examine previous file.
*/
if (ntags()) {
- error("No previous file", NULL_PARG);
+ error("No previous file", NULL);
break;
}
if (number <= 0)
@@ -1465,7 +1465,7 @@ again:
number = 1;
tagfile = nexttag((int)number);
if (tagfile == NULL) {
- error("No next tag", NULL_PARG);
+ error("No next tag", NULL);
break;
}
if (edit(tagfile) == 0) {
@@ -1480,7 +1480,7 @@ again:
number = 1;
tagfile = prevtag((int)number);
if (tagfile == NULL) {
- error("No previous tag", NULL_PARG);
+ error("No previous tag", NULL);
break;
}
if (edit(tagfile) == 0) {
@@ -1497,7 +1497,7 @@ again:
if (number <= 0)
number = 1;
if (edit_index((int)number))
- error("No such file", NULL_PARG);
+ error("No such file", NULL);
break;
case A_REMOVE_FILE:
@@ -1570,7 +1570,7 @@ again:
case A_PIPE:
if (secure) {
- error("Command not available", NULL_PARG);
+ error("Command not available", NULL);
break;
}
start_mca(A_PIPE, "|mark: ", (void*)NULL, 0);
diff --git a/usr.bin/less/decode.c b/usr.bin/less/decode.c
index e1ea0d56119..a03c65606e6 100644
--- a/usr.bin/less/decode.c
+++ b/usr.bin/less/decode.c
@@ -345,7 +345,7 @@ void
add_fcmd_table(char *buf, int len)
{
if (add_cmd_table(&list_fcmd_tables, buf, len) < 0)
- error("Warning: some commands disabled", NULL_PARG);
+ error("Warning: some commands disabled", NULL);
}
/*
@@ -355,7 +355,7 @@ void
add_ecmd_table(char *buf, int len)
{
if (add_cmd_table(&list_ecmd_tables, buf, len) < 0)
- error("Warning: some edit commands disabled", NULL_PARG);
+ error("Warning: some edit commands disabled", NULL);
}
/*
@@ -366,7 +366,7 @@ add_var_table(struct tablelist **tlist, char *buf, int len)
{
if (add_cmd_table(tlist, buf, len) < 0)
error("Warning: environment variables from "
- "lesskey file unavailable", NULL_PARG);
+ "lesskey file unavailable", NULL);
}
/*
diff --git a/usr.bin/less/edit.c b/usr.bin/less/edit.c
index 7df69297c74..9cdbcd6e4f0 100644
--- a/usr.bin/less/edit.c
+++ b/usr.bin/less/edit.c
@@ -605,10 +605,10 @@ edit_stdin(void)
if (isatty(fd0)) {
if (less_is_more) {
error("Missing filename (\"more -h\" for help)",
- NULL_PARG);
+ NULL);
} else {
error("Missing filename (\"less --help\" for help)",
- NULL_PARG);
+ NULL);
}
quit(QUIT_OK);
}
@@ -705,7 +705,7 @@ loop:
* Eh?
*/
answer = query("Overwrite, Append, or Don't log? "
- "(Type \"O\", \"A\", \"D\" or \"q\") ", NULL_PARG);
+ "(Type \"O\", \"A\", \"D\" or \"q\") ", NULL);
goto loop;
}
diff --git a/usr.bin/less/filename.c b/usr.bin/less/filename.c
index 86ea1150cec..43548aed45e 100644
--- a/usr.bin/less/filename.c
+++ b/usr.bin/less/filename.c
@@ -611,7 +611,7 @@ open_altfile(char *filename, int *pf, void **pfd)
}
if ((cmd = expand_pct_s(lessopen, filename, NULL)) == NULL) {
- error("Invalid LESSOPEN variable", NULL_PARG);
+ error("Invalid LESSOPEN variable", NULL);
return (NULL);
}
fd = shellcmd(cmd);
@@ -681,7 +681,7 @@ close_altfile(char *altfilename, char *filename, void *pipefd)
return;
cmd = expand_pct_s(lessclose, filename, altfilename, NULL);
if (cmd == NULL) {
- error("Invalid LESSCLOSE variable", NULL_PARG);
+ error("Invalid LESSCLOSE variable", NULL);
return;
}
fd = shellcmd(cmd);
diff --git a/usr.bin/less/jump.c b/usr.bin/less/jump.c
index f0dd5d273d9..c6873c8ecbf 100644
--- a/usr.bin/less/jump.c
+++ b/usr.bin/less/jump.c
@@ -33,7 +33,7 @@ jump_forw(void)
off_t end_pos;
if (ch_end_seek()) {
- error("Cannot seek to end of file", NULL_PARG);
+ error("Cannot seek to end of file", NULL);
return;
}
/*
@@ -81,7 +81,7 @@ jump_back(LINENUM linenum)
jump_loc(pos, jump_sline);
} else if (linenum <= 1 && ch_beg_seek() == 0) {
jump_loc(ch_tell(), jump_sline);
- error("Cannot seek to beginning of file", NULL_PARG);
+ error("Cannot seek to beginning of file", NULL);
} else {
parg.p_linenum = linenum;
error("Cannot seek to line number %n", &parg);
@@ -117,11 +117,11 @@ jump_percent(int percent, long fraction)
* (the specified percentage of the file's length).
*/
if ((len = ch_length()) == -1) {
- ierror("Determining length of file", NULL_PARG);
+ ierror("Determining length of file", NULL);
ch_end_seek();
}
if ((len = ch_length()) == -1) {
- error("Don't know length of file", NULL_PARG);
+ error("Don't know length of file", NULL);
return;
}
pos = percent_pos(len, percent, fraction);
@@ -193,7 +193,7 @@ jump_loc(off_t pos, int sline)
* Seek to the desired location.
*/
if (ch_seek(pos)) {
- error("Cannot seek to that file position", NULL_PARG);
+ error("Cannot seek to that file position", NULL);
return;
}
diff --git a/usr.bin/less/less.h b/usr.bin/less/less.h
index c58e591e183..d76542b2ac6 100644
--- a/usr.bin/less/less.h
+++ b/usr.bin/less/less.h
@@ -115,8 +115,6 @@ typedef union parg {
LINENUM p_linenum;
} PARG;
-#define NULL_PARG ((PARG *)NULL)
-
struct textlist {
char *string;
char *endstring;
diff --git a/usr.bin/less/linenum.c b/usr.bin/less/linenum.c
index e3c4e592601..8d79fa0bd3e 100644
--- a/usr.bin/less/linenum.c
+++ b/usr.bin/less/linenum.c
@@ -203,7 +203,7 @@ add_lnum(LINENUM linenum, off_t pos)
static void
longloopmessage(void)
{
- ierror("Calculating line numbers", NULL_PARG);
+ ierror("Calculating line numbers", NULL);
}
static int loopcount;
@@ -234,7 +234,7 @@ abort_long(void)
*/
screen_trashed = 1;
linenums = 0;
- error("Line numbers turned off", NULL_PARG);
+ error("Line numbers turned off", NULL);
}
/*
diff --git a/usr.bin/less/lsystem.c b/usr.bin/less/lsystem.c
index 19ff2aeaf4e..1dae8d688cb 100644
--- a/usr.bin/less/lsystem.c
+++ b/usr.bin/less/lsystem.c
@@ -193,12 +193,12 @@ pipe_data(char *cmd, off_t spos, off_t epos)
* the command, and reinitialization after it.
*/
if (ch_seek(spos) != 0) {
- error("Cannot seek to start position", NULL_PARG);
+ error("Cannot seek to start position", NULL);
return (-1);
}
if ((f = popen(cmd, "w")) == NULL) {
- error("Cannot create pipe", NULL_PARG);
+ error("Cannot create pipe", NULL);
return (-1);
}
clear_bot();
diff --git a/usr.bin/less/main.c b/usr.bin/less/main.c
index 341608edf0d..0597ad13399 100644
--- a/usr.bin/less/main.c
+++ b/usr.bin/less/main.c
@@ -218,7 +218,7 @@ main(int argc, char *argv[])
}
if (missing_cap && !know_dumb)
- error("WARNING: terminal is not fully functional", NULL_PARG);
+ error("WARNING: terminal is not fully functional", NULL);
init_mark();
open_getchr();
@@ -240,7 +240,7 @@ main(int argc, char *argv[])
* and search for the proper line in the file.
*/
if (nifile() > 0) {
- error("No filenames allowed with -t option", NULL_PARG);
+ error("No filenames allowed with -t option", NULL);
quit(QUIT_ERROR);
}
findtag(tagoption);
@@ -281,7 +281,7 @@ ecalloc(int count, unsigned int size)
p = calloc(count, size);
if (p != NULL)
return (p);
- error("Cannot allocate memory", NULL_PARG);
+ error("Cannot allocate memory", NULL);
quit(QUIT_ERROR);
/*NOTREACHED*/
return (NULL);
@@ -299,7 +299,7 @@ easprintf(const char *fmt, ...)
va_end(ap);
if (p == NULL || rv < 0) {
- error("Cannot allocate memory", NULL_PARG);
+ error("Cannot allocate memory", NULL);
quit(QUIT_ERROR);
/*NOTREACHED*/
}
@@ -313,7 +313,7 @@ estrdup(const char *str)
n = strdup(str);
if (n == NULL) {
- error("Cannot allocate memory", NULL_PARG);
+ error("Cannot allocate memory", NULL);
quit(QUIT_ERROR);
}
return (n);
diff --git a/usr.bin/less/mark.c b/usr.bin/less/mark.c
index 2794a5cd82e..057f19bd942 100644
--- a/usr.bin/less/mark.c
+++ b/usr.bin/less/mark.c
@@ -56,7 +56,7 @@ getumark(int c)
if (c >= 'A' && c <= 'Z')
return (&marks[c-'A'+26]);
- error("Invalid mark letter", NULL_PARG);
+ error("Invalid mark letter", NULL);
return (NULL);
}
@@ -86,7 +86,7 @@ getmark(int c)
* End of the current file.
*/
if (ch_end_seek()) {
- error("Cannot seek to end of file", NULL_PARG);
+ error("Cannot seek to end of file", NULL);
return (NULL);
}
m = &sm;
@@ -116,7 +116,7 @@ getmark(int c)
if (m == NULL)
break;
if (m->m_scrpos.pos == -1) {
- error("Mark not set", NULL_PARG);
+ error("Mark not set", NULL);
return (NULL);
}
break;
@@ -225,7 +225,7 @@ markpos(int c)
return (-1);
if (m->m_ifile != curr_ifile) {
- error("Mark not in current file", NULL_PARG);
+ error("Mark not in current file", NULL);
return (-1);
}
return (m->m_scrpos.pos);
diff --git a/usr.bin/less/optfunc.c b/usr.bin/less/optfunc.c
index d522f6424e8..b8e4e2c31ba 100644
--- a/usr.bin/less/optfunc.c
+++ b/usr.bin/less/optfunc.c
@@ -66,7 +66,7 @@ opt_o(int type, char *s)
PARG parg;
if (secure) {
- error("log file support is not available", NULL_PARG);
+ error("log file support is not available", NULL);
return;
}
switch (type) {
@@ -75,11 +75,11 @@ opt_o(int type, char *s)
break;
case TOGGLE:
if (ch_getflags() & CH_CANSEEK) {
- error("Input is not a pipe", NULL_PARG);
+ error("Input is not a pipe", NULL);
return;
}
if (logfile >= 0) {
- error("Log file is already in use", NULL_PARG);
+ error("Log file is already in use", NULL);
return;
}
s = skipsp(s);
@@ -89,7 +89,7 @@ opt_o(int type, char *s)
break;
case QUERY:
if (logfile < 0) {
- error("No log file", NULL_PARG);
+ error("No log file", NULL);
} else {
parg.p_string = namelogfile;
error("Log file \"%s\"", &parg);
@@ -126,13 +126,13 @@ opt_j(int type, char *s)
s++;
jump_sline_fraction = getfraction(&s, "j", &err);
if (err)
- error("Invalid line fraction", NULL_PARG);
+ error("Invalid line fraction", NULL);
else
calc_jump_sline();
} else {
int sline = getnum(&s, "j", &err);
if (err) {
- error("Invalid line number", NULL_PARG);
+ error("Invalid line number", NULL);
} else {
jump_sline = sline;
jump_sline_fraction = -1;
@@ -183,13 +183,13 @@ opt_shift(int type, char *s)
s++;
shift_count_fraction = getfraction(&s, "#", &err);
if (err)
- error("Invalid column fraction", NULL_PARG);
+ error("Invalid column fraction", NULL);
else
calc_shift_count();
} else {
int hs = getnum(&s, "#", &err);
if (err) {
- error("Invalid column number", NULL_PARG);
+ error("Invalid column number", NULL);
} else {
shift_count = hs;
shift_count_fraction = -1;
@@ -254,7 +254,7 @@ opt_t(int type, char *s)
break;
case TOGGLE:
if (secure) {
- error("tags support is not available", NULL_PARG);
+ error("tags support is not available", NULL);
break;
}
findtag(skipsp(s));
@@ -501,7 +501,7 @@ opt_quote(int type, char *s)
}
if (s[1] != '\0' && s[2] != '\0') {
error("-\" must be followed by 1 or 2 chars",
- NULL_PARG);
+ NULL);
return;
}
openquote = s[0];
@@ -531,7 +531,7 @@ opt_query(int type, char *s)
switch (type) {
case QUERY:
case TOGGLE:
- error("Use \"h\" for help", NULL_PARG);
+ error("Use \"h\" for help", NULL);
break;
case INIT:
dohelp = 1;
diff --git a/usr.bin/less/option.c b/usr.bin/less/option.c
index b0ea0dbcfe3..11fb216580c 100644
--- a/usr.bin/less/option.c
+++ b/usr.bin/less/option.c
@@ -332,7 +332,7 @@ toggle_option(struct loption *o, int lower, char *s, int how_toggle)
how_toggle &= ~OPT_NO_PROMPT;
if (o == NULL) {
- error("No such option", NULL_PARG);
+ error("No such option", NULL);
return;
}
@@ -415,7 +415,7 @@ toggle_option(struct loption *o, int lower, char *s, int how_toggle)
case OPT_SET:
case OPT_UNSET:
error("Cannot use \"-+\" or \"--\" "
- "for a string option", NULL_PARG);
+ "for a string option", NULL);
return;
}
break;
@@ -434,7 +434,7 @@ toggle_option(struct loption *o, int lower, char *s, int how_toggle)
break;
case OPT_SET:
error("Can't use \"-!\" for a numeric option",
- NULL_PARG);
+ NULL);
return;
}
break;
@@ -461,7 +461,7 @@ toggle_option(struct loption *o, int lower, char *s, int how_toggle)
/*
* Print the odesc message.
*/
- error(o->odesc[*(o->ovar)], NULL_PARG);
+ error(o->odesc[*(o->ovar)], NULL);
break;
case NUMBER:
/*
diff --git a/usr.bin/less/pattern.c b/usr.bin/less/pattern.c
index c173a530445..01c2903420c 100644
--- a/usr.bin/less/pattern.c
+++ b/usr.bin/less/pattern.c
@@ -32,7 +32,7 @@ compile_pattern2(char *pattern, int search_type, regex_t **comp_pattern)
comp = ecalloc(1, sizeof (regex_t));
if (regcomp(comp, pattern, less_is_more ? 0 : REGCOMP_FLAG)) {
free(comp);
- error("Invalid pattern", NULL_PARG);
+ error("Invalid pattern", NULL);
return (-1);
}
if (*comp_pattern != NULL)
diff --git a/usr.bin/less/search.c b/usr.bin/less/search.c
index 3675515dc8b..7c7b5a3408e 100644
--- a/usr.bin/less/search.c
+++ b/usr.bin/less/search.c
@@ -271,7 +271,7 @@ void
undo_search(void)
{
if (!prev_pattern(&search_info)) {
- error("No previous regular expression", NULL_PARG);
+ error("No previous regular expression", NULL);
return;
}
hide_hilite = !hide_hilite;
@@ -860,12 +860,12 @@ search(int search_type, char *pattern, int n)
*/
search_type |= SRCH_AFTER_TARGET;
if (!prev_pattern(&search_info) && !hist_pattern(search_type)) {
- error("No previous regular expression", NULL_PARG);
+ error("No previous regular expression", NULL);
return (-1);
}
if ((search_type & SRCH_NO_REGEX) !=
(search_info.search_type & SRCH_NO_REGEX)) {
- error("Please re-enter search pattern", NULL_PARG);
+ error("Please re-enter search pattern", NULL);
return (-1);
}
if (hilite_search == OPT_ON) {
@@ -919,7 +919,7 @@ search(int search_type, char *pattern, int n)
if (search_type & SRCH_PAST_EOF)
return (n);
/* repaint(); -- why was this here? */
- error("Nothing to search", NULL_PARG);
+ error("Nothing to search", NULL);
return (-1);
}
diff --git a/usr.bin/less/tags.c b/usr.bin/less/tags.c
index 6df12866bc2..a6e5ba52dab 100644
--- a/usr.bin/less/tags.c
+++ b/usr.bin/less/tags.c
@@ -116,13 +116,13 @@ findtag(char *tag)
case TAG_INTR:
break;
case TAG_NOFILE:
- error("No tags file", NULL_PARG);
+ error("No tags file", NULL);
break;
case TAG_NOTAG:
- error("No such tag in tags file", NULL_PARG);
+ error("No such tag in tags file", NULL);
break;
case TAG_NOTYPE:
- error("unknown tag type", NULL_PARG);
+ error("unknown tag type", NULL);
break;
}
}
@@ -345,7 +345,7 @@ ctagsearch(void)
/*
* We hit EOF without a match.
*/
- error("Tag not found", NULL_PARG);
+ error("Tag not found", NULL);
return (-1);
}