This commit is contained in:
christos 2005-07-19 01:38:38 +00:00
parent dccca90900
commit ece0fd5c87
24 changed files with 189 additions and 178 deletions

View File

@ -1,4 +1,4 @@
# $NetBSD: Makefile,v 1.21 2004/05/16 09:53:10 lukem Exp $
# $NetBSD: Makefile,v 1.22 2005/07/19 01:38:38 christos Exp $
# @(#)Makefile 8.3 (Berkeley) 4/20/95
.include <bsd.own.mk>
@ -10,7 +10,7 @@ SRCS= version.c support.c cmd1.c cmd2.c cmd3.c cmdtab.c collect.c dotlock.c \
LINKS= ${BINDIR}/mail ${BINDIR}/Mail ${BINDIR}/mail ${BINDIR}/mailx
MLINKS= mail.1 Mail.1 mail.1 mailx.1
WARNS= 2
WARNS= 3
.PATH: ${.CURDIR}/misc

View File

@ -1,4 +1,4 @@
/* $NetBSD: cmd1.c,v 1.21 2003/08/07 11:14:35 agc Exp $ */
/* $NetBSD: cmd1.c,v 1.22 2005/07/19 01:38:38 christos Exp $ */
/*-
* Copyright (c) 1980, 1993
@ -34,7 +34,7 @@
#if 0
static char sccsid[] = "@(#)cmd1.c 8.2 (Berkeley) 4/20/95";
#else
__RCSID("$NetBSD: cmd1.c,v 1.21 2003/08/07 11:14:35 agc Exp $");
__RCSID("$NetBSD: cmd1.c,v 1.22 2005/07/19 01:38:38 christos Exp $");
#endif
#endif /* not lint */
@ -296,7 +296,7 @@ type1(int *msgvec, int doign, int page)
{
int *ip;
struct message *mp;
char *cp;
const char *cp;
int nlines;
FILE *obuf;
#if __GNUC__
@ -442,7 +442,7 @@ int
folders(void *v)
{
char dirname[PATHSIZE];
char *cmd;
const char *cmd;
if (getfold(dirname) < 0) {
printf("No value set for \"folder\"\n");

View File

@ -1,4 +1,4 @@
/* $NetBSD: cmd2.c,v 1.17 2003/08/07 11:14:36 agc Exp $ */
/* $NetBSD: cmd2.c,v 1.18 2005/07/19 01:38:38 christos Exp $ */
/*
* Copyright (c) 1980, 1993
@ -34,7 +34,7 @@
#if 0
static char sccsid[] = "@(#)cmd2.c 8.1 (Berkeley) 6/6/93";
#else
__RCSID("$NetBSD: cmd2.c,v 1.17 2003/08/07 11:14:36 agc Exp $");
__RCSID("$NetBSD: cmd2.c,v 1.18 2005/07/19 01:38:38 christos Exp $");
#endif
#endif /* not lint */
@ -171,15 +171,16 @@ copycmd(void *v)
* If markmsg is true, mark the message "saved."
*/
int
save1(char str[], int markmsg, char *cmd, struct ignoretab *ignoretabs)
save1(char str[], int markmsg, const char *cmd, struct ignoretab *ignoretabs)
{
int *ip;
struct message *mp;
char *fn, *disp;
const char *fn;
const char *disp;
int f, *msgvec;
FILE *obuf;
msgvec = (int *) salloc((msgCount + 2) * sizeof *msgvec);
msgvec = salloc((msgCount + 2) * sizeof *msgvec);
if ((fn = snarf(str, &f)) == NULL)
return(1);
if (!f) {
@ -471,7 +472,7 @@ saveigfield(void *v)
}
int
ignore1(char *list[], struct ignoretab *tab, char *which)
ignore1(char *list[], struct ignoretab *tab, const char *which)
{
char field[LINESIZE];
int h;
@ -500,7 +501,7 @@ ignore1(char *list[], struct ignoretab *tab, char *which)
* Print out all currently retained fields.
*/
int
igshow(struct ignoretab *tab, char *which)
igshow(struct ignoretab *tab, const char *which)
{
int h;
struct ignore *igp;
@ -510,7 +511,7 @@ igshow(struct ignoretab *tab, char *which)
printf("No fields currently being %s.\n", which);
return 0;
}
ring = (char **) salloc((tab->i_count + 1) * sizeof (char *));
ring = salloc((tab->i_count + 1) * sizeof (char *));
ap = ring;
for (h = 0; h < HSHSIZE; h++)
for (igp = tab->i_head[h]; igp != 0; igp = igp->i_link)
@ -528,5 +529,5 @@ igshow(struct ignoretab *tab, char *which)
static int
igcomp(const void *l, const void *r)
{
return (strcmp(*(char **)l, *(char **)r));
return (strcmp(*(const char *const *)l, *(const char *const *)r));
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: cmd3.c,v 1.25 2003/11/10 21:40:22 ross Exp $ */
/* $NetBSD: cmd3.c,v 1.26 2005/07/19 01:38:38 christos Exp $ */
/*
* Copyright (c) 1980, 1993
@ -34,7 +34,7 @@
#if 0
static char sccsid[] = "@(#)cmd3.c 8.2 (Berkeley) 4/20/95";
#else
__RCSID("$NetBSD: cmd3.c,v 1.25 2003/11/10 21:40:22 ross Exp $");
__RCSID("$NetBSD: cmd3.c,v 1.26 2005/07/19 01:38:38 christos Exp $");
#endif
#endif /* not lint */
@ -57,7 +57,7 @@ shell(void *v)
{
char *str = v;
sig_t sigint = signal(SIGINT, SIG_IGN);
char *shellcmd;
const char *shellcmd;
char cmd[BUFSIZ];
(void)strcpy(cmd, str);
@ -79,7 +79,7 @@ int
dosh(void *v)
{
sig_t sigint = signal(SIGINT, SIG_IGN);
char *shellcmd;
const char *shellcmd;
if ((shellcmd = value("SHELL")) == NULL)
shellcmd = _PATH_CSHELL;
@ -170,7 +170,7 @@ int
schdir(void *v)
{
char **arglist = v;
char *cp;
const char *cp;
if (*arglist == NULL)
cp = homedir;
@ -360,7 +360,7 @@ set(void *v)
{
char **arglist = v;
struct var *vp;
char *cp;
const char *cp;
char varbuf[BUFSIZ], **ap, **p;
int errs, h, s;
size_t l;
@ -369,7 +369,7 @@ set(void *v)
for (h = 0, s = 1; h < HSHSIZE; h++)
for (vp = variables[h]; vp != NULL; vp = vp->v_link)
s++;
ap = (char **) salloc(s * sizeof *ap);
ap = salloc(s * sizeof *ap);
for (h = 0, p = ap; h < HSHSIZE; h++)
for (vp = variables[h]; vp != NULL; vp = vp->v_link)
*p++ = vp->v_name;
@ -460,7 +460,7 @@ group(void *v)
for (h = 0, s = 1; h < HSHSIZE; h++)
for (gh = groups[h]; gh != NULL; gh = gh->g_link)
s++;
ap = (char **) salloc(s * sizeof *ap);
ap = salloc(s * sizeof *ap);
for (h = 0, p = ap; h < HSHSIZE; h++)
for (gh = groups[h]; gh != NULL; gh = gh->g_link)
*p++ = gh->g_name;
@ -522,7 +522,7 @@ sort(char **list)
static int
diction(const void *a, const void *b)
{
return(strcmp(*(char **)a, *(char **)b));
return(strcmp(*(const char *const *)a, *(const char *const *)b));
}
/*
@ -563,7 +563,7 @@ echo(void *v)
{
char **argv = v;
char **ap;
char *cp;
const char *cp;
for (ap = argv; *ap != NULL; ap++) {
cp = *ap;

View File

@ -1,4 +1,4 @@
/* $NetBSD: collect.c,v 1.30 2003/08/07 11:14:36 agc Exp $ */
/* $NetBSD: collect.c,v 1.31 2005/07/19 01:38:38 christos Exp $ */
/*
* Copyright (c) 1980, 1993
@ -34,7 +34,7 @@
#if 0
static char sccsid[] = "@(#)collect.c 8.2 (Berkeley) 4/19/94";
#else
__RCSID("$NetBSD: collect.c,v 1.30 2003/08/07 11:14:36 agc Exp $");
__RCSID("$NetBSD: collect.c,v 1.31 2005/07/19 01:38:38 christos Exp $");
#endif
#endif /* not lint */
@ -79,7 +79,8 @@ collect(struct header *hp, int printheaders)
FILE *fbuf;
int lc, cc, escape, eofcount;
int c, fd, t;
char linebuf[LINESIZE], *cp;
char linebuf[LINESIZE];
const char *cp;
char getsub;
char tempname[PATHSIZE];
char mailtempname[PATHSIZE];
@ -337,7 +338,7 @@ cont:
break;
if (*cp == '!') { /* insert stdout of command */
char *shellcmd;
const char *shellcmd;
int nullfd;
int rc2;
@ -494,7 +495,7 @@ out:
* Write a file, ex-like if f set.
*/
int
exwrite(char name[], FILE *fp, int f)
exwrite(const char name[], FILE *fp, int f)
{
FILE *of;
int c;
@ -564,7 +565,7 @@ mespipe(FILE *fp, char cmd[])
{
FILE *nf;
sig_t sigint = signal(SIGINT, SIG_IGN);
char *shellcmd;
const char *shellcmd;
int fd;
char tempname[PATHSIZE];
@ -617,10 +618,10 @@ forward(char ms[], FILE *fp, char *fn, int f)
{
int *msgvec;
struct ignoretab *ig;
char *tabst;
const char *tabst;
msgvec = (int *) salloc((msgCount+1) * sizeof *msgvec);
if (msgvec == (int *) NULL)
msgvec = salloc((msgCount+1) * sizeof *msgvec);
if (msgvec == NULL)
return(0);
if (getmsglist(ms, msgvec, 0) < 0)
return(0);
@ -720,7 +721,7 @@ savedeadletter(FILE *fp)
{
FILE *dbuf;
int c;
char *cp;
const char *cp;
if (fsize(fp) == 0)
return;

View File

@ -1,4 +1,4 @@
/* $NetBSD: def.h,v 1.16 2003/08/07 11:14:37 agc Exp $ */
/* $NetBSD: def.h,v 1.17 2005/07/19 01:38:38 christos Exp $ */
/*
* Copyright (c) 1980, 1993
* The Regents of the University of California. All rights reserved.
@ -28,7 +28,7 @@
* SUCH DAMAGE.
*
* @(#)def.h 8.4 (Berkeley) 4/20/95
* $NetBSD: def.h,v 1.16 2003/08/07 11:14:37 agc Exp $
* $NetBSD: def.h,v 1.17 2005/07/19 01:38:38 christos Exp $
*/
/*
@ -111,7 +111,7 @@ struct message {
* in lex.c
*/
struct cmd {
char *c_name; /* Name of command */
const char *c_name; /* Name of command */
int (*c_func)(void *); /* Implementor of the command */
short c_argtype; /* Type of arglist (see below) */
short c_msgflag; /* Required flags of messages */

View File

@ -1,4 +1,4 @@
/* $NetBSD: edit.c,v 1.18 2003/08/07 11:14:37 agc Exp $ */
/* $NetBSD: edit.c,v 1.19 2005/07/19 01:38:38 christos Exp $ */
/*
* Copyright (c) 1980, 1993
@ -34,7 +34,7 @@
#if 0
static char sccsid[] = "@(#)edit.c 8.1 (Berkeley) 6/6/93";
#else
__RCSID("$NetBSD: edit.c,v 1.18 2003/08/07 11:14:37 agc Exp $");
__RCSID("$NetBSD: edit.c,v 1.19 2005/07/19 01:38:38 christos Exp $");
#endif
#endif /* not lint */
@ -156,7 +156,7 @@ run_editor(FILE *fp, off_t size, int editortype, int readonlyflag)
FILE *nf = NULL;
int t;
time_t modtime;
char *editcmd;
const char *editcmd;
char tempname[PATHSIZE];
struct stat statb;

View File

@ -1,4 +1,4 @@
/* $NetBSD: extern.h,v 1.19 2003/10/31 01:25:54 ross Exp $ */
/* $NetBSD: extern.h,v 1.20 2005/07/19 01:38:38 christos Exp $ */
/*-
* Copyright (c) 1992, 1993
@ -29,7 +29,7 @@
* SUCH DAMAGE.
*
* @(#)extern.h 8.2 (Berkeley) 4/20/95
* $NetBSD: extern.h,v 1.19 2003/10/31 01:25:54 ross Exp $
* $NetBSD: extern.h,v 1.20 2005/07/19 01:38:38 christos Exp $
*/
struct name;
@ -45,15 +45,15 @@ struct name *outof(struct name *, FILE *, struct header *);
struct name *put(struct name *, struct name *);
struct name *tailof(struct name *);
struct name *usermap(struct name *);
FILE *Fdopen(int, char *);
FILE *Fopen(char *, char *);
FILE *Popen(char *, char *);
FILE *Fdopen(int, const char *);
FILE *Fopen(const char *, const char *);
FILE *Popen(const char *, const char *);
FILE *collect(struct header *, int);
char *copy(char *, char *);
char *copyin(char *, char **);
char *detract(struct name *, int);
char *expand(char *);
char *getdeadletter(void);
const char *expand(const char *);
const char *getdeadletter(void);
const char *getname(int);
struct message;
char *hfield(const char [], const struct message *);
@ -62,18 +62,18 @@ char *ishfield(const char [], char[], const char *);
char *name1(struct message *, int);
char *nameof(struct message *, int);
char *nextword(char *, char *);
char *readtty(char [], char []);
char *readtty(const char [], char []);
char *reedit(char *);
FILE *run_editor(FILE *, off_t, int, int);
char *salloc(int);
void *salloc(int);
char *savestr(const char *);
FILE *setinput(const struct message *);
char *skin(char *);
char *skip_comment(char *);
char *snarf(char [], int *);
const char *username(void);
char *value(char []);
char *vcopy(char []);
char *value(const char []);
char *vcopy(const char []);
char *yankword(char *, char []);
int Fclose(FILE *);
int More(void *);
@ -87,7 +87,7 @@ int alternates(void *);
void announce(void);
int append(struct message *, FILE *);
int argcount(char **);
void assign(char [], char []);
void assign(const char [], const char []);
int bangexp(char *);
int blankline(char []);
void brokpipe(int);
@ -96,7 +96,7 @@ int check(int, int);
void clob1(int);
int clobber(void *);
void close_all_files(void);
int cmatch(char *, char *);
int cmatch(const char *, char *);
void collhup(int);
void collint(int);
void collstop(int);
@ -119,15 +119,15 @@ int elsecmd(void *);
int endifcmd(void *);
int evalcol(int);
int execute(char [], int);
int exwrite(char [], FILE *, int);
void fail(char [], char []);
int exwrite(const char [], FILE *, int);
void fail(char [], const char []);
int file(void *);
struct grouphead *
findgroup(char []);
void findmail(char *, char *);
void findmail(const char *, char *);
int first(int, int);
void fixhead(struct header *, struct name *);
void fmt(char *, struct name *, FILE *, int);
void fmt(const char *, struct name *, FILE *, int);
int folders(void *);
int forward(char [], FILE *, char *, int);
void free_child(int);
@ -136,12 +136,12 @@ off_t fsize(FILE *);
int getfold(char *);
int gethfield(FILE *, char [], int, char **);
int getmsglist(char *, int *, int);
int getrawlist(char [], char **, int);
int getrawlist(const char [], char **, int);
int getuserid(char []);
int grabh(struct header *, int);
int group(void *);
void hangup(int);
int hash(char *);
int hash(const char *);
void hdrstop(int);
int headers(void *);
int help(void *);
@ -149,23 +149,23 @@ void holdsigs(void);
int ifcmd(void *);
int igfield(void *);
struct ignoretab;
int ignore1(char *[], struct ignoretab *, char *);
int igshow(struct ignoretab *, char *);
int ignore1(char *[], struct ignoretab *, const char *);
int igshow(struct ignoretab *, const char *);
void intr(int);
int inc(void *);
int incfile(void);
int isdate(char []);
int isdir(char []);
int isdate(const char []);
int isdir(const char []);
int isfileaddr(char *);
int ishead(char []);
int isign(char *, struct ignoretab []);
int isprefix(char *, char *);
void istrcpy(char *, char *);
int isign(const char *, struct ignoretab []);
int isprefix(char *, const char *);
void istrcpy(char *, const char *);
const struct cmd *
lex(char []);
void load(char *);
void load(const char *);
struct var *
lookup(char []);
lookup(const char []);
int mail(struct name *,
struct name *, struct name *, struct name *, char *);
void mail1(struct header *, int);
@ -194,7 +194,7 @@ void prettyprint(struct name *);
void printgroup(char []);
void printhead(int);
int puthead(struct header *, FILE *, int);
int putline(FILE *, char *, int);
int putline(FILE *, const char *, int);
int pversion(void *);
void quit(void);
int quitcmd(void *);
@ -207,23 +207,24 @@ int respond(void *);
int retfield(void *);
int rexit(void *);
int rm(char *);
int run_command(char *, sigset_t *, int, int, ...);
int run_command(const char *, sigset_t *, int, int, ...);
int save(void *);
int Save(void *);
int save1(char [], int, char *, struct ignoretab *);
int save1(char [], int, const char *, struct ignoretab *);
void savedeadletter(FILE *);
int saveigfield(void *);
int savemail(char [], FILE *);
int savemail(const char [], FILE *);
int saveretfield(void *);
int scan(char **);
void scaninit(void);
int schdir(void *);
int screensize(void);
int scroll(void *);
int sendmessage(struct message *, FILE *, struct ignoretab *, char *);
int sendmessage(struct message *, FILE *, struct ignoretab *,
const char *);
int sendmail(void *);
int set(void *);
int setfile(char *);
int setfile(const char *);
void setmsize(int);
void setptr(FILE *, off_t);
void setscreensize(void);
@ -233,8 +234,8 @@ void sort(char **);
int source(void *);
void spreserve(void);
void sreset(void);
int start_command(char *, sigset_t *, int, int, ...);
void statusput(struct message *, FILE *, char *);
int start_command(const char *, sigset_t *, int, int, ...);
void statusput(struct message *, FILE *, const char *);
void stop(int);
int stouch(void *);
int swrite(void *);
@ -247,7 +248,7 @@ int type(void *);
int type1(int *, int, int);
int undeletecmd(void *);
void unmark(int);
char **unpack(struct name *);
const char **unpack(struct name *);
int unread(void *);
void unregister_file(FILE *);
int unset(void *);

View File

@ -1,4 +1,4 @@
/* $NetBSD: fio.c,v 1.23 2003/10/31 01:25:54 ross Exp $ */
/* $NetBSD: fio.c,v 1.24 2005/07/19 01:38:38 christos Exp $ */
/*
* Copyright (c) 1980, 1993
@ -34,7 +34,7 @@
#if 0
static char sccsid[] = "@(#)fio.c 8.2 (Berkeley) 4/20/95";
#else
__RCSID("$NetBSD: fio.c,v 1.23 2003/10/31 01:25:54 ross Exp $");
__RCSID("$NetBSD: fio.c,v 1.24 2005/07/19 01:38:38 christos Exp $");
#endif
#endif /* not lint */
@ -56,7 +56,8 @@ void
setptr(FILE *ibuf, off_t offset)
{
int c, len;
char *cp, *cp2;
char *cp;
const char *cp2;
struct message this;
FILE *mestmp;
int maybe, inhead;
@ -179,7 +180,7 @@ setptr(FILE *ibuf, off_t offset)
* characters written, including the newline if requested.
*/
int
putline(FILE *obuf, char *linebuf, int outlf)
putline(FILE *obuf, const char *linebuf, int outlf)
{
int c;
@ -336,13 +337,14 @@ fsize(FILE *iob)
* any shell meta character
* Return the file name as a dynamic string.
*/
char *
expand(char *name)
const char *
expand(const char *name)
{
char xname[PATHSIZE];
char cmdbuf[PATHSIZE]; /* also used for file names */
int pid, l;
char *cp, *shellcmd;
char *cp;
const char *shellcmd;
int pivec[2];
struct stat sbuf;
@ -445,10 +447,10 @@ getfold(char *name)
/*
* Return the name of the dead.letter file.
*/
char *
const char *
getdeadletter(void)
{
char *cp;
const char *cp;
if ((cp = value("DEAD")) == NULL || (cp = expand(cp)) == NULL)
cp = expand("~/dead.letter");

View File

@ -1,4 +1,4 @@
/* $NetBSD: head.c,v 1.12 2003/08/07 11:14:38 agc Exp $ */
/* $NetBSD: head.c,v 1.13 2005/07/19 01:38:38 christos Exp $ */
/*
* Copyright (c) 1980, 1993
@ -34,7 +34,7 @@
#if 0
static char sccsid[] = "@(#)head.c 8.2 (Berkeley) 4/20/95";
#else
__RCSID("$NetBSD: head.c,v 1.12 2003/08/07 11:14:38 agc Exp $");
__RCSID("$NetBSD: head.c,v 1.13 2005/07/19 01:38:38 christos Exp $");
#endif
#endif /* not lint */
@ -80,7 +80,7 @@ ishead(char linebuf[])
/*ARGSUSED*/
void
fail(char linebuf[], char reason[])
fail(char linebuf[], const char reason[])
{
/*
@ -165,7 +165,7 @@ char tmztype[] = "Aaa Aaa O0 00:00:00 AAA 0000";
char SysV_tmztype[] = "Aaa Aaa O0 00:00 AAA 0000";
int
isdate(char date[])
isdate(const char date[])
{
return cmatch(date, ctype) ||
@ -178,7 +178,7 @@ isdate(char date[])
* Return 1 if they match, 0 if they don't
*/
int
cmatch(char *cp, char *tp)
cmatch(const char *cp, char *tp)
{
while (*cp && *tp)

View File

@ -1,4 +1,4 @@
/* $NetBSD: lex.c,v 1.23 2003/08/07 11:14:39 agc Exp $ */
/* $NetBSD: lex.c,v 1.24 2005/07/19 01:38:38 christos Exp $ */
/*
* Copyright (c) 1980, 1993
@ -34,7 +34,7 @@
#if 0
static char sccsid[] = "@(#)lex.c 8.2 (Berkeley) 4/20/95";
#else
__RCSID("$NetBSD: lex.c,v 1.23 2003/08/07 11:14:39 agc Exp $");
__RCSID("$NetBSD: lex.c,v 1.24 2005/07/19 01:38:38 christos Exp $");
#endif
#endif /* not lint */
@ -51,7 +51,7 @@ extern char *tmpdir;
extern char *version;
extern const struct cmd cmdtab[];
char *prompt = "& ";
const char *prompt = "& ";
/*
* Set up editing on the given file name.
@ -60,13 +60,13 @@ char *prompt = "& ";
* signficance for mbox and so forth.
*/
int
setfile(char *name)
setfile(const char *name)
{
FILE *ibuf;
int i, fd;
struct stat stb;
char isedit = *name != '%' || getuserid(myname) != getuid();
char *who = name[1] ? name + 1 : myname;
const char *who = name[1] ? name + 1 : myname;
static int shudclob;
char tempname[PATHSIZE];
@ -509,9 +509,10 @@ lex(char word[])
* Return true if yep.
*/
int
isprefix(char *as1, char *as2)
isprefix(char *as1, const char *as2)
{
char *s1, *s2;
char *s1;
const char *s2;
s1 = as1;
s2 = as2;
@ -685,7 +686,7 @@ pversion(void *v)
* Load a file of user definitions.
*/
void
load(char *name)
load(const char *name)
{
FILE *in, *oldin;

View File

@ -1,4 +1,4 @@
/* $NetBSD: list.c,v 1.13 2003/08/07 11:14:39 agc Exp $ */
/* $NetBSD: list.c,v 1.14 2005/07/19 01:38:38 christos Exp $ */
/*
* Copyright (c) 1980, 1993
@ -34,7 +34,7 @@
#if 0
static char sccsid[] = "@(#)list.c 8.4 (Berkeley) 5/1/95";
#else
__RCSID("$NetBSD: list.c,v 1.13 2003/08/07 11:14:39 agc Exp $");
__RCSID("$NetBSD: list.c,v 1.14 2005/07/19 01:38:38 christos Exp $");
#endif
#endif /* not lint */
@ -382,9 +382,10 @@ check(int mesg, int f)
* for a RAWLIST.
*/
int
getrawlist(char line[], char **argv, int argc)
getrawlist(const char line[], char **argv, int argc)
{
char c, *cp, *cp2, quotec;
char c, *cp2, quotec;
const char *cp;
int argn;
char linebuf[BUFSIZ];
@ -665,13 +666,14 @@ matchsender(char *str, int mesg)
* if so.
*/
static char *to_fields[] = { "to", "cc", "bcc", 0 };
static const char *to_fields[] = { "to", "cc", "bcc", 0 };
int
matchto(char *str, int mesg)
{
struct message *mp;
char *cp, *cp2, *backup, **to;
char *cp, *cp2, *backup;
const char **to;
str++;

View File

@ -1,4 +1,4 @@
/* $NetBSD: main.c,v 1.18 2003/08/07 11:14:40 agc Exp $ */
/* $NetBSD: main.c,v 1.19 2005/07/19 01:38:38 christos Exp $ */
/*
* Copyright (c) 1980, 1993
@ -39,7 +39,7 @@ __COPYRIGHT("@(#) Copyright (c) 1980, 1993\n\
#if 0
static char sccsid[] = "@(#)main.c 8.2 (Berkeley) 4/20/95";
#else
__RCSID("$NetBSD: main.c,v 1.18 2003/08/07 11:14:40 agc Exp $");
__RCSID("$NetBSD: main.c,v 1.19 2005/07/19 01:38:38 christos Exp $");
#endif
#endif /* not lint */
@ -67,10 +67,10 @@ main(int argc, char *argv[])
int i;
struct name *to, *cc, *bcc, *smopts;
char *subject;
char *ef;
const char *ef;
char nosrc = 0;
sig_t prevint;
char *rc;
const char *rc;
/*
* Set up a reasonable environment.

View File

@ -1,4 +1,4 @@
/* $NetBSD: names.c,v 1.17 2003/08/07 11:14:40 agc Exp $ */
/* $NetBSD: names.c,v 1.18 2005/07/19 01:38:38 christos Exp $ */
/*
* Copyright (c) 1980, 1993
@ -34,7 +34,7 @@
#if 0
static char sccsid[] = "@(#)names.c 8.1 (Berkeley) 6/6/93";
#else
__RCSID("$NetBSD: names.c,v 1.17 2003/08/07 11:14:40 agc Exp $");
__RCSID("$NetBSD: names.c,v 1.18 2005/07/19 01:38:38 christos Exp $");
#endif
#endif /* not lint */
@ -59,7 +59,7 @@ nalloc(char str[], int ntype)
{
struct name *np;
np = (struct name *) salloc(sizeof *np);
np = salloc(sizeof *np);
np->n_flink = NULL;
np->n_blink = NULL;
np->n_type = ntype;
@ -213,7 +213,8 @@ outof(struct name *names, FILE *fo, struct header *hp)
int c, fd;
struct name *np, *begin;
time_t now;
char *date, *fname;
char *date;
const char *fname;
FILE *fout, *fin;
int ispipe;
char tempname[PATHSIZE];
@ -282,7 +283,7 @@ outof(struct name *names, FILE *fo, struct header *hp)
if (ispipe) {
int pid;
char *shellcmd;
const char *shellcmd;
sigset_t nset;
/*
@ -477,10 +478,10 @@ cat(struct name *n1, struct name *n2)
* Unpack the name list onto a vector of strings.
* Return an error if the name list won't fit.
*/
char **
const char **
unpack(struct name *np)
{
char **ap, **begin;
const char **ap, **begin;
struct name *n;
int t, extra, metoo, verbose;
@ -501,7 +502,7 @@ unpack(struct name *np)
verbose = value("verbose") != NULL;
if (verbose)
extra++;
begin = (char **) salloc((t + extra) * sizeof *begin);
begin = salloc((t + extra) * sizeof *begin);
ap = begin;
*ap++ = "send-mail";
*ap++ = "-i";

View File

@ -1,4 +1,4 @@
/* $NetBSD: popen.c,v 1.17 2003/08/07 11:14:40 agc Exp $ */
/* $NetBSD: popen.c,v 1.18 2005/07/19 01:38:38 christos Exp $ */
/*
* Copyright (c) 1980, 1993
@ -34,7 +34,7 @@
#if 0
static char sccsid[] = "@(#)popen.c 8.1 (Berkeley) 6/6/93";
#else
__RCSID("$NetBSD: popen.c,v 1.17 2003/08/07 11:14:40 agc Exp $");
__RCSID("$NetBSD: popen.c,v 1.18 2005/07/19 01:38:38 christos Exp $");
#endif
#endif /* not lint */
@ -68,10 +68,10 @@ static struct child *child, *child_freelist = NULL;
static struct child *findchild(pid_t, int);
static void delchild(struct child *);
static pid_t file_pid(FILE *);
static pid_t start_commandv(char *, sigset_t *, int, int, va_list);
static pid_t start_commandv(const char *, sigset_t *, int, int, va_list);
FILE *
Fopen(char *fn, char *mode)
Fopen(const char *fn, const char *mode)
{
FILE *fp;
@ -83,7 +83,7 @@ Fopen(char *fn, char *mode)
}
FILE *
Fdopen(int fd, char *mode)
Fdopen(int fd, const char *mode)
{
FILE *fp;
@ -103,7 +103,7 @@ Fclose(FILE *fp)
}
FILE *
Popen(char *cmd, char *mode)
Popen(const char *cmd, const char *mode)
{
int p[2];
int myside, hisside, fd0, fd1;
@ -214,7 +214,8 @@ file_pid(FILE *fp)
* SIGINT is enabled unless it's in "nset".
*/
static pid_t
start_commandv(char *cmd, sigset_t *nset, int infd, int outfd, va_list args)
start_commandv(const char *cmd, sigset_t *nset, int infd, int outfd,
va_list args)
{
pid_t pid;
@ -238,7 +239,7 @@ start_commandv(char *cmd, sigset_t *nset, int infd, int outfd, va_list args)
}
int
run_command(char *cmd, sigset_t *nset, int infd, int outfd, ...)
run_command(const char *cmd, sigset_t *nset, int infd, int outfd, ...)
{
pid_t pid;
va_list args;
@ -252,7 +253,7 @@ run_command(char *cmd, sigset_t *nset, int infd, int outfd, ...)
}
int
start_command(char *cmd, sigset_t *nset, int infd, int outfd, ...)
start_command(const char *cmd, sigset_t *nset, int infd, int outfd, ...)
{
va_list args;
int r;

View File

@ -1,4 +1,4 @@
/* $NetBSD: quit.c,v 1.19 2003/08/07 11:14:41 agc Exp $ */
/* $NetBSD: quit.c,v 1.20 2005/07/19 01:38:38 christos Exp $ */
/*
* Copyright (c) 1980, 1993
@ -34,7 +34,7 @@
#if 0
static char sccsid[] = "@(#)quit.c 8.2 (Berkeley) 4/28/95";
#else
__RCSID("$NetBSD: quit.c,v 1.19 2003/08/07 11:14:41 agc Exp $");
__RCSID("$NetBSD: quit.c,v 1.20 2005/07/19 01:38:38 christos Exp $");
#endif
#endif /* not lint */
@ -77,7 +77,7 @@ quit(void)
struct message *mp;
int c, fd;
struct stat minfo;
char *mbox;
const char *mbox;
char tempname[PATHSIZE];
#ifdef __GNUC__

View File

@ -1,4 +1,4 @@
/* $NetBSD: send.c,v 1.21 2003/08/07 11:14:41 agc Exp $ */
/* $NetBSD: send.c,v 1.22 2005/07/19 01:38:38 christos Exp $ */
/*
* Copyright (c) 1980, 1993
@ -34,7 +34,7 @@
#if 0
static char sccsid[] = "@(#)send.c 8.1 (Berkeley) 6/6/93";
#else
__RCSID("$NetBSD: send.c,v 1.21 2003/08/07 11:14:41 agc Exp $");
__RCSID("$NetBSD: send.c,v 1.22 2005/07/19 01:38:38 christos Exp $");
#endif
#endif /* not lint */
@ -58,7 +58,7 @@ extern char *tmpdir;
*/
int
sendmessage(struct message *mp, FILE *obuf, struct ignoretab *doign,
char *prefix)
const char *prefix)
{
long len;
FILE *ibuf;
@ -73,11 +73,11 @@ sendmessage(struct message *mp, FILE *obuf, struct ignoretab *doign,
* Compute the prefix string, without trailing whitespace
*/
if (prefix != NULL) {
cp2 = 0;
for (cp = prefix; *cp; cp++)
if (*cp != ' ' && *cp != '\t')
cp2 = cp;
prefixlen = cp2 == 0 ? 0 : cp2 - prefix + 1;
const char *dp, *dp2 = NULL;
for (dp = prefix; *dp; dp++)
if (*dp != ' ' && *dp != '\t')
dp2 = dp;
prefixlen = dp2 == 0 ? 0 : dp2 - prefix + 1;
}
ibuf = setinput(mp);
len = mp->m_size;
@ -231,7 +231,7 @@ sendmessage(struct message *mp, FILE *obuf, struct ignoretab *doign,
* Output a reasonable looking status field.
*/
void
statusput(struct message *mp, FILE *obuf, char *prefix)
statusput(struct message *mp, FILE *obuf, const char *prefix)
{
char statout[3];
char *cp = statout;
@ -292,9 +292,9 @@ sendmail(void *v)
void
mail1(struct header *hp, int printheaders)
{
char *cp;
const char *cp;
int pid;
char **namelist;
const char **namelist;
struct name *to;
FILE *mtf;
@ -351,7 +351,7 @@ mail1(struct header *hp, int printheaders)
}
namelist = unpack(cat(hp->h_smopts, to));
if (debug) {
char **t;
const char **t;
printf("Sendmail arguments:");
for (t = namelist; *t != NULL; t++)
@ -386,7 +386,7 @@ mail1(struct header *hp, int printheaders)
cp = expand(cp);
else
cp = _PATH_SENDMAIL;
execv(cp, namelist);
execv(cp, (char *const *)__UNCONST(namelist));
warn("%s", cp);
_exit(1);
}
@ -504,7 +504,7 @@ puthead(struct header *hp, FILE *fo, int w)
* Format the given header line to not exceed 72 characters.
*/
void
fmt(char *str, struct name *np, FILE *fo, int comma)
fmt(const char *str, struct name *np, FILE *fo, int comma)
{
int col, len;
@ -536,7 +536,7 @@ fmt(char *str, struct name *np, FILE *fo, int comma)
/*ARGSUSED*/
int
savemail(char name[], FILE *fi)
savemail(const char name[], FILE *fi)
{
FILE *fo;
char buf[BUFSIZ];

View File

@ -1,4 +1,4 @@
/* $NetBSD: strings.c,v 1.10 2003/08/07 11:14:41 agc Exp $ */
/* $NetBSD: strings.c,v 1.11 2005/07/19 01:38:38 christos Exp $ */
/*
* Copyright (c) 1980, 1993
@ -34,7 +34,7 @@
#if 0
static char sccsid[] = "@(#)strings.c 8.1 (Berkeley) 6/6/93";
#else
__RCSID("$NetBSD: strings.c,v 1.10 2003/08/07 11:14:41 agc Exp $");
__RCSID("$NetBSD: strings.c,v 1.11 2005/07/19 01:38:38 christos Exp $");
#endif
#endif /* not lint */
@ -57,7 +57,7 @@ __RCSID("$NetBSD: strings.c,v 1.10 2003/08/07 11:14:41 agc Exp $");
* the occasional user with enormous string size requests.
*/
char *
void *
salloc(int size)
{
char *t;

View File

@ -1,4 +1,4 @@
/* $NetBSD: support.c,v 1.12 2004/10/30 20:44:39 dsl Exp $ */
/* $NetBSD: support.c,v 1.13 2005/07/19 01:38:38 christos Exp $ */
/*
* Copyright (c) 1980, 1993
@ -34,7 +34,7 @@
#if 0
static char sccsid[] = "@(#)aux.c 8.1 (Berkeley) 6/6/93";
#else
__RCSID("$NetBSD: support.c,v 1.12 2004/10/30 20:44:39 dsl Exp $");
__RCSID("$NetBSD: support.c,v 1.13 2005/07/19 01:38:38 christos Exp $");
#endif
#endif /* not lint */
@ -101,7 +101,7 @@ touch(struct message *mp)
* Return true if it is.
*/
int
isdir(char name[])
isdir(const char name[])
{
struct stat sbuf;
@ -231,7 +231,7 @@ ishfield(const char linebuf[], char *colon, const char field[])
* Copy a string, lowercasing it as we go.
*/
void
istrcpy(char *dest, char *src)
istrcpy(char *dest, const char *src)
{
do {
@ -262,7 +262,7 @@ source(void *v)
{
char **arglist = v;
FILE *fi;
char *cp;
const char *cp;
if ((cp = expand(*arglist)) == NULL)
return(1);
@ -606,7 +606,7 @@ copy(char *s1, char *s2)
* See if the given header field is supposed to be ignored.
*/
int
isign(char *field, struct ignoretab ignoretabs[2])
isign(const char *field, struct ignoretab ignoretabs[2])
{
char realfld[LINESIZE];

View File

@ -1,4 +1,4 @@
/* $NetBSD: temp.c,v 1.16 2003/08/07 11:14:42 agc Exp $ */
/* $NetBSD: temp.c,v 1.17 2005/07/19 01:38:38 christos Exp $ */
/*
* Copyright (c) 1980, 1993
@ -34,7 +34,7 @@
#if 0
static char sccsid[] = "@(#)temp.c 8.1 (Berkeley) 6/6/93";
#else
__RCSID("$NetBSD: temp.c,v 1.16 2003/08/07 11:14:42 agc Exp $");
__RCSID("$NetBSD: temp.c,v 1.17 2005/07/19 01:38:38 christos Exp $");
#endif
#endif /* not lint */
@ -55,10 +55,10 @@ tinit(void)
const char *cp;
char *p;
if ((tmpdir = getenv("TMPDIR")) == NULL || *tmpdir == '\0')
tmpdir = _PATH_TMP;
if ((cp = getenv("TMPDIR")) == NULL || *cp == '\0')
cp = _PATH_TMP;
if ((tmpdir = strdup(tmpdir)) == NULL)
if ((tmpdir = strdup(cp)) == NULL)
errx(1, "Out of memory");
/* Remove trailing slashes. */
@ -77,7 +77,7 @@ tinit(void)
errx(1, "\"%s\" is not a user of this system", myname);
} else {
if ((cp = username()) == NULL) {
myname = "nobody";
myname = savestr("nobody");
if (rcvmode)
exit(1);
} else

View File

@ -1,4 +1,4 @@
/* $NetBSD: tty.c,v 1.17 2003/08/07 11:14:42 agc Exp $ */
/* $NetBSD: tty.c,v 1.18 2005/07/19 01:38:38 christos Exp $ */
/*
* Copyright (c) 1980, 1993
@ -34,7 +34,7 @@
#if 0
static char sccsid[] = "@(#)tty.c 8.2 (Berkeley) 6/6/93";
#else
__RCSID("$NetBSD: tty.c,v 1.17 2003/08/07 11:14:42 agc Exp $");
__RCSID("$NetBSD: tty.c,v 1.18 2005/07/19 01:38:38 christos Exp $");
#endif
#endif /* not lint */
@ -179,11 +179,12 @@ out:
*/
char *
readtty(char pr[], char src[])
readtty(const char pr[], char src[])
{
char ch, canonb[BUFSIZ];
int c;
char *cp, *cp2;
static char empty[] = "";
#if __GNUC__
/* Avoid longjmp clobbering */
(void)&c;
@ -204,7 +205,7 @@ readtty(char pr[], char src[])
fputs(canonb, stdout);
fflush(stdout);
#else
cp = src == NULL ? "" : src;
cp = src == NULL ? empty : src;
while ((c = *cp++) != '\0') {
if ((c_erase != _POSIX_VDISABLE && c == c_erase) ||
(c_kill != _POSIX_VDISABLE && c == c_kill)) {

View File

@ -1,4 +1,4 @@
/* $NetBSD: v7.local.c,v 1.14 2003/08/07 11:14:42 agc Exp $ */
/* $NetBSD: v7.local.c,v 1.15 2005/07/19 01:38:38 christos Exp $ */
/*
* Copyright (c) 1980, 1993
@ -34,7 +34,7 @@
#if 0
static char sccsid[] = "@(#)v7.local.c 8.1 (Berkeley) 6/6/93";
#else
__RCSID("$NetBSD: v7.local.c,v 1.14 2003/08/07 11:14:42 agc Exp $");
__RCSID("$NetBSD: v7.local.c,v 1.15 2005/07/19 01:38:38 christos Exp $");
#endif
#endif /* not lint */
@ -54,7 +54,7 @@ __RCSID("$NetBSD: v7.local.c,v 1.14 2003/08/07 11:14:42 agc Exp $");
* mail is queued).
*/
void
findmail(char *user, char *buf)
findmail(const char *user, char *buf)
{
char *mbox;

View File

@ -1,4 +1,4 @@
/* $NetBSD: vars.c,v 1.12 2003/10/31 01:25:54 ross Exp $ */
/* $NetBSD: vars.c,v 1.13 2005/07/19 01:38:38 christos Exp $ */
/*
* Copyright (c) 1980, 1993
@ -34,7 +34,7 @@
#if 0
static char sccsid[] = "@(#)vars.c 8.1 (Berkeley) 6/6/93";
#else
__RCSID("$NetBSD: vars.c,v 1.12 2003/10/31 01:25:54 ross Exp $");
__RCSID("$NetBSD: vars.c,v 1.13 2005/07/19 01:38:38 christos Exp $");
#endif
#endif /* not lint */
@ -51,7 +51,7 @@ __RCSID("$NetBSD: vars.c,v 1.12 2003/10/31 01:25:54 ross Exp $");
* Assign a value to a variable.
*/
void
assign(char name[], char values[])
assign(const char name[], const char values[])
{
struct var *vp;
int h;
@ -89,13 +89,13 @@ v_free(char *cp)
*/
char *
vcopy(char str[])
vcopy(const char str[])
{
char *new;
unsigned len;
if (*str == '\0')
return "";
return strdup("");
len = strlen(str) + 1;
if ((new = malloc(len)) == NULL)
errx(1, "Out of memory");
@ -109,7 +109,7 @@ vcopy(char str[])
*/
char *
value(char name[])
value(const char name[])
{
struct var *vp;
@ -124,7 +124,7 @@ value(char name[])
*/
struct var *
lookup(char name[])
lookup(const char name[])
{
struct var *vp;
@ -173,7 +173,7 @@ printgroup(char name[])
* the variable or group hash table.
*/
int
hash(char *name)
hash(const char *name)
{
int h = 0;

View File

@ -1,4 +1,4 @@
/* $NetBSD: version.c,v 1.6 2003/08/07 11:14:43 agc Exp $ */
/* $NetBSD: version.c,v 1.7 2005/07/19 01:38:38 christos Exp $ */
/*
* Copyright (c) 1980, 1993
@ -34,7 +34,7 @@
#if 0
static char sccsid[] = "@(#)version.c 8.1 (Berkeley) 6/6/93";
#else
__RCSID("$NetBSD: version.c,v 1.6 2003/08/07 11:14:43 agc Exp $");
__RCSID("$NetBSD: version.c,v 1.7 2005/07/19 01:38:38 christos Exp $");
#endif
#endif /* not lint */
@ -42,4 +42,4 @@ __RCSID("$NetBSD: version.c,v 1.6 2003/08/07 11:14:43 agc Exp $");
* Just keep track of the date/sid of this version of Mail.
* Load this file first to get a "total" Mail version.
*/
char *version = "8.1 6/6/93";
const char *version = "8.1 6/6/93";