*
* - Add code to fmttest.c to display your new function.
*
- * - Document the new function in the mh-format(5) man page.
+ * - Document the new function in mh-format(5).
*
*/
while ((nm = t->name)) {
if (*nm == c && strcmp (nm, name) == 0)
- return (ftbl = t);
+ return ftbl = t;
t++;
}
inform("\"%s\": format compile error - %s",
&usr_fstring[errpos-errctx], str);
- adios (NULL, "%*s", errctx+1, "^");
+ die("%*s", errctx+1, "^");
}
/*
{
char *cp;
size_t i;
- static int comptable_initialized = 0;
+ static bool comptable_initialized;
format_string = mh_xstrdup(fstring);
usr_fstring = fstring;
if (reset_comptable || !comptable_initialized) {
free_comptable();
- comptable_initialized = 1;
+ comptable_initialized = true;
}
/* it takes at least 4 char to generate one format so we
{
char *cp = sp;
int c;
-#ifndef lint
- int ljust = 0;
-#endif /* not lint */
+ bool ljust = false;
int wid = 0;
char fill = ' ';
c = *cp++;
if (c == '-') {
- ljust++;
+ ljust = true;
c = *cp++;
}
if (c == '0') {
char *cp = sp;
int c;
int i;
- static int primed = 0;
+ static bool primed;
while (isalnum(c = *cp++) || c == '-' || c == '_')
;
case FT_GETMYADDR:
if (!primed) {
ismymbox(NULL);
- primed++;
+ primed = true;
}
/* FALLTHRU */
case FT_PARSEADDR:
{
char *cp = sp;
struct format *fexpr,
- *fif = (struct format *)NULL;
+ *fif = NULL;
int c = '<';
for (;;) {
fif = fp; /* loc of GOTO */
fexpr->f_skip = next_fp - fexpr;
- fexpr = (struct format *)NULL;/* no extra ENDIF */
+ fexpr = NULL; /* no extra ENDIF */
cp = compile (cp); /* compile ELSE stmts */
fif->f_skip = next_fp - fif;
int
fmt_addcomptext(char *component, char *text)
{
- int i, found = 0, bucket = CHASH(component);
+ int i;
+ bool found = false;
+ int bucket = CHASH(component);
struct comp *cptr = wantcomp[bucket];
char *cp;
while (cptr) {
if (strcasecmp(component, FENDNULL(cptr->c_name)) == 0) {
- found++;
+ found = true;
if (! cptr->c_text) {
cptr->c_text = getcpy(text);
} else {