mail: Use a C89 function pointer type for command functions.

The command function is defined to always take a void *.  Functions
which accept a pointer to an array of pointers use a local temporary
'argv' assigned from the void *arg.

Reviewed by:	zlei
Differential Revision:	https://reviews.freebsd.org/D39527
This commit is contained in:
John Baldwin 2023-04-18 11:27:29 -07:00
parent c330a185b7
commit d28a95513e
11 changed files with 52 additions and 46 deletions

View File

@ -211,7 +211,7 @@ printhead(int mesg)
* Print out the value of dot.
*/
int
pdot(void)
pdot(void *arg __unused)
{
printf("%td\n", dot - &message[0] + 1);
return (0);
@ -221,7 +221,7 @@ pdot(void)
* Print out all the possible commands.
*/
int
pcmdlist(void)
pcmdlist(void *arg __unused)
{
extern const struct cmd cmdtab[];
const struct cmd *cp;
@ -439,7 +439,7 @@ mboxit(void *v)
* List the folders the user currently has.
*/
int
folders(void)
folders(void *arg __unused)
{
char dirname[PATHSIZE];
char *cmd;

View File

@ -360,7 +360,7 @@ undeletecmd(void *v)
* Interactively dump core on "core"
*/
int
core(void)
core(void *arg __unused)
{
int pid;
@ -386,8 +386,9 @@ core(void)
* Clobber as many bytes of stack as the user requests.
*/
int
clobber(char **argv)
clobber(void *arg)
{
char **argv = arg;
int times;
if (argv[0] == 0)

View File

@ -51,7 +51,7 @@ __FBSDID("$FreeBSD$");
* and forking a sh -c
*/
int
shell(char *str)
shell(void *str)
{
sig_t sigint = signal(SIGINT, SIG_IGN);
char *sh;
@ -74,7 +74,7 @@ shell(char *str)
*/
/*ARGSUSED*/
int
dosh(char *str __unused)
dosh(void *str __unused)
{
sig_t sigint = signal(SIGINT, SIG_IGN);
char *sh;
@ -146,7 +146,7 @@ overf:
*/
int
help(void)
help(void *arg __unused)
{
int c;
FILE *f;
@ -530,7 +530,7 @@ diction(const void *a, const void *b)
/*ARGSUSED*/
int
null(int e __unused)
null(void *arg __unused)
{
return (0);
}
@ -540,8 +540,9 @@ null(int e __unused)
* the current file.
*/
int
file(char **argv)
file(void *arg)
{
char **argv = arg;
if (argv[0] == NULL) {
newfileinfo(0);
@ -557,8 +558,9 @@ file(char **argv)
* Expand file names like echo
*/
int
echo(char **argv)
echo(void *arg)
{
char **argv = arg;
char **ap, *cp;
for (ap = argv; *ap != NULL; ap++) {
@ -574,7 +576,7 @@ echo(char **argv)
}
int
Respond(int *msgvec)
Respond(void *msgvec)
{
if (value("Replyall") == NULL && value("flipr") == NULL)
return (doRespond(msgvec));
@ -625,8 +627,9 @@ doRespond(int msgvec[])
* .mailrc and do some things if sending, others if receiving.
*/
int
ifcmd(char **argv)
ifcmd(void *arg)
{
char **argv = arg;
char *cp;
if (cond != CANY) {
@ -656,7 +659,7 @@ ifcmd(char **argv)
* flip over the conditional flag.
*/
int
elsecmd(void)
elsecmd(void *arg __unused)
{
switch (cond) {
@ -684,7 +687,7 @@ elsecmd(void)
* End of if statement. Just set cond back to anything.
*/
int
endifcmd(void)
endifcmd(void *arg __unused)
{
if (cond == CANY) {
@ -699,8 +702,9 @@ endifcmd(void)
* Set the list of alternate names.
*/
int
alternates(char **namelist)
alternates(void *arg)
{
char **namelist = arg;
int c;
char **ap, **ap2, *cp;

View File

@ -199,7 +199,7 @@ cont:
/*
* Dump core.
*/
core();
core(NULL);
break;
case '!':
/*

View File

@ -106,7 +106,7 @@ struct message {
*/
struct cmd {
const char *c_name; /* Name of command */
int (*c_func)(); /* Implementor of the command */
int (*c_func)(void *); /* Implementor of the command */
short c_argtype; /* Type of arglist (see below) */
short c_msgflag; /* Required flags of messages */
short c_msgmask; /* Relevant flags of messages */

View File

@ -51,7 +51,7 @@ __FBSDID("$FreeBSD$");
* Edit a message list.
*/
int
editor(int *msgvec)
editor(void *msgvec)
{
return (edit1(msgvec, 'e'));
@ -61,7 +61,7 @@ editor(int *msgvec)
* Invoke the visual editor on a message list.
*/
int
visual(int *msgvec)
visual(void *msgvec)
{
return (edit1(msgvec, 'v'));

View File

@ -75,12 +75,12 @@ char *yanklogin(char *, char *);
int Fclose(FILE *);
int More(void *);
int Pclose(FILE *);
int Respond(int *);
int Respond(void *);
int Type(void *);
int doRespond(int *);
int dorespond(int *);
void alter(char *);
int alternates(char **);
int alternates(void *);
void announce(void);
int append(struct message *, FILE *);
int argcount(char **);
@ -90,7 +90,7 @@ void brokpipe(int);
int charcount(char *, int);
int check(int, int);
void clob1(int);
int clobber(char **);
int clobber(void *);
void close_all_files(void);
int cmatch(char *, char *);
void collhup(int);
@ -98,32 +98,32 @@ void collint(int);
void collstop(int);
void commands(void);
int copycmd(void *v);
int core(void);
int core(void *);
int count(struct name *);
int deletecmd(void *);
int delm(int *);
int deltype(void *);
void demail(void);
int diction(const void *, const void *);
int dosh(char *);
int echo(char **);
int dosh(void *);
int echo(void *);
int edit1(int *, int);
int editor(int *);
int editor(void *);
void edstop(void);
int elsecmd(void);
int endifcmd(void);
int elsecmd(void *);
int endifcmd(void *);
int evalcol(int);
int execute(char *, int);
int exwrite(char *, FILE *, int);
void fail(const char *, const char *);
int file(char **);
int file(void *);
struct grouphead *
findgroup(char *);
void findmail(char *, char *, int);
int first(int, int);
void fixhead(struct header *, struct name *);
void fmt(const char *, struct name *, FILE *, int);
int folders(void);
int folders(void *);
int forward(char *, FILE *, char *, int);
void free_child(int);
int from(void *);
@ -139,9 +139,9 @@ void hangup(int);
int hash(const char *);
void hdrstop(int);
int headers(void *);
int help(void);
int help(void *);
void holdsigs(void);
int ifcmd(char **);
int ifcmd(void *);
int igcomp(const void *, const void *);
int igfield(void *);
int ignore1(char **, struct ignoretab *, const char *);
@ -178,10 +178,10 @@ int metamess(int, int);
int more(void *);
int newfileinfo(int);
int next(void *);
int null(int);
int null(void *);
void parse(char *, struct headline *, char *);
int pcmdlist(void);
int pdot(void);
int pcmdlist(void *);
int pdot(void *);
void prepare_child(sigset_t *, int, int);
int preserve(void *);
void prettyprint(struct name *);
@ -189,9 +189,9 @@ void printgroup(char *);
void printhead(int);
int puthead(struct header *, FILE *, int);
int putline(FILE *, char *, int);
int pversion(int);
int pversion(void *);
void quit(void);
int quitcmd(void);
int quitcmd(void *);
int readline(FILE *, char *, int);
void register_file(FILE *, int, int);
void regret(int);
@ -213,16 +213,16 @@ int schdir(void *);
int screensize(void);
int scroll(void *);
int sendmessage(struct message *, FILE *, struct ignoretab *, char *);
int sendmail(char *);
int sendmail(void *);
int set(void *);
int setfile(char *);
void setmsize(int);
void setptr(FILE *, off_t);
void setscreensize(void);
int shell(char *);
int shell(void *);
void sigchild(int);
void sort(char **);
int source(char **);
int source(void *);
void spreserve(void);
void sreset(void);
int start_command(char *, sigset_t *, int, int, ...);
@ -245,7 +245,7 @@ void unregister_file(FILE *);
int unset(void *);
int unstack(void);
void vfree(char *);
int visual(int *);
int visual(void *);
int wait_child(int);
int wait_command(int);
int writeback(FILE *);

View File

@ -672,7 +672,7 @@ newfileinfo(int omsgCount)
*/
int
pversion(int e __unused)
pversion(void *arg __unused)
{
printf("Version %s\n", version);

View File

@ -51,7 +51,7 @@ __FBSDID("$FreeBSD$");
* The "quit" command.
*/
int
quitcmd(void)
quitcmd(void *arg __unused)
{
/*
* If we are sourcing, then return 1 so execute() can handle it.

View File

@ -268,7 +268,7 @@ mail(struct name *to, struct name *cc, struct name *bcc, struct name *smopts,
* the mail routine below.
*/
int
sendmail(char *str)
sendmail(void *str)
{
struct header head;

View File

@ -265,8 +265,9 @@ static struct sstack sstack[SSTACK_SIZE];
* that they are no longer reading from a tty (in all probability).
*/
int
source(char **arglist)
source(void *arg)
{
char **arglist = arg;
FILE *fi;
char *cp;