char *ak_name; /* name to match against */
struct adr *ak_addr; /* list of addresses that it maps to */
struct aka *ak_next; /* next aka in list */
- char ak_visible; /* should be visible in headers */
+ bool ak_visible; /* should be visible in headers */
};
struct adr {
/*
* prototypes for some routines in uip
*/
-int annotate (char *, char *, char *, int, int, int, int);
+int annotate (char *, char *, char *, bool, bool, int, bool);
void annolist(char *, char *, char *, int);
void annopreserve(int);
void m_pclose(void);
char *akerror (int);
static char *akval (struct aka *, char *);
-static int aleq (char *, char *);
+static bool aleq (char *, char *);
static char *scanp (char *);
static char *getp (char *);
static char *seekp (char *, char *, char **);
}
-static int
+static bool
aleq (char *string, char *aliasent)
{
char c;
while ((c = *string++)) {
if (*aliasent == '*')
- return 1;
+ return true;
if (tolower((unsigned char)c) != tolower((unsigned char)*aliasent))
- return 0;
+ return false;
aliasent++;
}
}
switch (lc) {
case ':':
- ak->ak_visible = 0;
+ ak->ak_visible = false;
break;
case ';':
- ak->ak_visible = 1;
+ ak->ak_visible = true;
break;
default:
NEW(p);
p->ak_name = getcpy (id);
- p->ak_visible = 0;
+ p->ak_visible = false;
p->ak_addr = NULL;
p->ak_next = NULL;
if (akatail != NULL)
int
main (int argc, char **argv)
{
- int inplace = 1, datesw = 1;
+ bool inplace, datesw;
int msgnum;
char *cp, *maildir;
char *comp = NULL, *text = NULL, *folder = NULL, buf[BUFSIZ];
char **argp, **arguments;
struct msgs_array msgs = { 0, 0, NULL };
struct msgs *mp;
- int append = 0; /* append annotations instead of default prepend */
+ bool append; /* append annotations instead of default prepend */
int delete = -2; /* delete header element if set */
char *draft = NULL; /* draft file name */
int isdf = 0; /* return needed for m_draft() */
- int list = 0; /* list header elements if set */
+ bool list; /* list header elements if set */
int number = 0; /* delete specific number of like elements if set */
if (nmh_init(argv[0], 1)) { return 1; }
arguments = getarguments (invo_name, argc, argv, 1);
argp = arguments;
+ append = list = false;
+ inplace = datesw = true;
while ((cp = *argp++)) {
if (*cp == '-') {
switch (smatch (++cp, switches)) {
continue;
case DATESW:
- datesw++;
+ datesw = true;
continue;
case NDATESW:
- datesw = 0;
+ datesw = false;
continue;
case INPLSW:
- inplace++;
+ inplace = true;
continue;
case NINPLSW:
- inplace = 0;
+ inplace = false;
continue;
case TEXTSW:
continue;
case LISTSW: /* produce a listing */
- list = 1;
+ list = true;
continue;
case NUMBERSW: /* number listing or delete by number */
continue;
case APPENDSW: /* append annotations instead of default prepend */
- append = 1;
+ append = true;
continue;
case PRESERVESW: /* preserve access and modification times on annotated message */
/*
* static prototypes
*/
-static int annosbr (int, char *, char *, char *, int, int, int, int);
+static int annosbr (int, char *, char *, char *, bool, bool, int, bool);
/*
* This "local" global and the annopreserve() function are a hack that allows additional
static int preserve_actime_and_modtime = 0; /* set to preserve access and modification times on annotated message */
int
-annotate (char *file, char *comp, char *text, int inplace, int datesw, int delete, int append)
+annotate (char *file, char *comp, char *text, bool inplace, bool datesw, int delete, bool append)
{
int i, fd;
struct utimbuf b;
}
static int
-annosbr (int fd, char *file, char *comp, char *text, int inplace, int datesw, int delete, int append)
+annosbr (int fd, char *file, char *comp, char *text, bool inplace, bool datesw, int delete, bool append)
{
int mode, tmpfd;
char *cp, *sp;
* as they're read in. This buffer is grown as needed later.
*/
- if (delete >= -1 || append != 0) {
+ if (delete >= -1 || append) {
if ((fp = fdopen(fd, "r")) == NULL)
adios(NULL, "unable to fdopen file.");