Using '\0' helps to visually reinforce the types of variables.
There are no functional changes to the code.
mutt_format_s(dest, destlen, fmt, alias->name);
break;
case 'r':
- adr[0] = 0;
+ adr[0] = '\0';
rfc822_write_address(adr, sizeof(adr), alias->addr, 1);
snprintf(tmp, sizeof(tmp), "%%%ss", fmt);
snprintf(dest, destlen, tmp, adr);
break;
case 't':
dest[0] = alias->tagged ? '*' : ' ';
- dest[1] = 0;
+ dest[1] = '\0';
break;
}
}
}
if (!dry)
- *dest = 0;
+ *dest = '\0';
return rv;
}
{
strfcpy(tmp, adr->mailbox, sizeof(tmp));
if ((pc = strchr(tmp, '@')))
- *pc = 0;
+ *pc = '\0';
}
else
tmp[0] = '\0';
if (adr && adr->mailbox)
strfcpy(buf, adr->mailbox, sizeof(buf));
else
- buf[0] = 0;
+ buf[0] = '\0';
mutt_addrlist_to_intl(adr, NULL);
if (adr && adr->personal && !mutt_is_mail_list(adr))
strfcpy(buf, adr->personal, sizeof(buf));
else
- buf[0] = 0;
+ buf[0] = '\0';
if (mutt_get_field(_("Personal name: "), buf, sizeof(buf), 0) != 0)
{
}
new->addr->personal = safe_strdup(buf);
- buf[0] = 0;
+ buf[0] = '\0';
rfc822_write_address(buf, sizeof(buf), new->addr, 1);
snprintf(prompt, sizeof(prompt), _("[%s = %s] Accept?"), new->name, buf);
if (mutt_yesorno(prompt, MUTT_YES) != MUTT_YES)
strfcpy(buf, new->name, sizeof(buf));
recode_buf(buf, sizeof(buf));
fprintf(rc, "alias %s ", buf);
- buf[0] = 0;
+ buf[0] = '\0';
rfc822_write_address(buf, sizeof(buf), new->addr, 0);
recode_buf(buf, sizeof(buf));
write_safe_address(rc, buf);
{
for (i = 0; a->name[i] && a->name[i] == bestname[i]; i++)
;
- bestname[i] = 0;
+ bestname[i] = '\0';
}
}
a = a->next;
}
}
- bestname[0] = 0;
+ bestname[0] = '\0';
mutt_alias_menu(bestname, sizeof(bestname), a_list ? a_list : Aliases);
if (bestname[0] != 0)
strfcpy(s, bestname, buflen);
int have_unnotified = BuffyNotify;
- buffylist[0] = 0;
+ buffylist[0] = '\0';
pos += strlen(strncat(buffylist, _("New mail in "), sizeof(buffylist) - 1 - pos));
for (b = Incoming; b; b = b->next)
{
strfcpy(in, name, sizeof(in));
if ((ext = strchr(in, '/')))
- *ext++ = 0;
+ *ext++ = '\0';
if ((mutt_strcasecmp(in, "utf-8") == 0) || (mutt_strcasecmp(in, "utf8") == 0))
{
return;
}
- buf[0] = 0;
+ buf[0] = '\0';
rfc822_write_address(buf, sizeof(buf), adr, 1);
#define EXTRA_SPACE (15 + 7 + 2)
{
char buffer[LONG_STRING];
- buffer[0] = 0;
+ buffer[0] = '\0';
if (mutt_get_field(_("Pipe to command: "), buffer, sizeof(buffer), MUTT_CMD) != 0 ||
!buffer[0])
return;
{
char buf[LONG_STRING];
- buf[0] = 0;
+ buf[0] = '\0';
if (mutt_get_field(_("Shell command: "), buf, sizeof(buf), MUTT_CMD) == 0)
{
if (!buf[0] && Shell)
char buffer[LONG_STRING];
int r;
- buffer[0] = 0;
+ buffer[0] = '\0';
if (mutt_get_field(":", buffer, sizeof(buffer), MUTT_COMMAND) != 0 || !buffer[0])
return;
mutt_buffer_init(&err);
* software.
*/
- buf[0] = 0;
+ buf[0] = '\0';
rfc822_write_address(buf, sizeof(buf), adr, 0);
mutt_message("%s: %s", pfx, buf);
}
{
if (filepart[i] != nntp_data->group[i])
{
- filepart[i] = 0;
+ filepart[i] = '\0';
break;
}
}
- filepart[i] = 0;
+ filepart[i] = '\0';
}
else
{
if (*s == '=' || *s == '+' || *s == '!')
{
dirpart[0] = *s;
- dirpart[1] = 0;
+ dirpart[1] = '\0';
if (*s == '!')
strfcpy(exp_dirpart, NONULL(SpoolFile), sizeof(exp_dirpart));
else
{
p = s + 1;
strfcpy(dirpart, "/", sizeof(dirpart));
- exp_dirpart[0] = 0;
+ exp_dirpart[0] = '\0';
strfcpy(filepart, p, sizeof(filepart));
dirp = opendir(dirpart);
}
else
{
/* no directory name, so assume current directory. */
- dirpart[0] = 0;
+ dirpart[0] = '\0';
strfcpy(filepart, s, sizeof(filepart));
dirp = opendir(".");
}
{
if (filepart[i] != de->d_name[i])
{
- filepart[i] = 0;
+ filepart[i] = '\0';
break;
}
}
- filepart[i] = 0;
+ filepart[i] = '\0';
}
else
{
return -1;
buf[0] = '\n';
- buf[1] = 0;
+ buf[1] = '\0';
if ((flags & (CH_REORDER | CH_WEED | CH_MIME | CH_DECODE | CH_PREFIX | CH_WEED_DELIVERED)) == 0)
{
(this_one[this_one_len - 1] == '\n'))
{
this_one[this_one_len - 2] = '\n';
- this_one[this_one_len - 1] = 0;
+ this_one[this_one_len - 1] = '\0';
}
}
int reno_ok;
char answer[2];
- answer[1] = 0;
+ answer[1] = '\0';
reyes_ok = (expr = nl_langinfo(YESEXPR)) && expr[0] == '^' &&
!REGCOMP(&reyes, expr, REG_NOSUB);
int off = mutt_wstr_trunc(buf2, sizeof(buf2), w, NULL);
ch = buf2[off];
- buf2[off] = 0;
+ buf2[off] = '\0';
SETCOLOR(MT_COLOR_PROGRESS);
addstr(buf2);
buf2[off] = ch;
else if (ch.ch == '?')
{
mutt_refresh();
- buf[0] = 0;
+ buf[0] = '\0';
if (!flags)
flags = MUTT_SEL_FOLDER;
mutt_unget_event(ch.op ? 0 : ch.ch, ch.op ? ch.op : 0);
if (_mutt_get_field(pc, buf, blen, (buffy ? MUTT_EFILE : MUTT_FILE) | MUTT_CLEAR,
multiple, files, numfiles) != 0)
- buf[0] = 0;
+ buf[0] = '\0';
FREE(&pc);
#ifdef USE_NOTMUCH
if ((flags & MUTT_SEL_VFOLDER) && buf[0] && (strncmp(buf, "notmuch://", 10) != 0))
fprintf(stderr, "%s: found single character token `%c'.\n", Progname, *s);
}
d[0] = *s++;
- d[1] = 0;
+ d[1] = '\0';
return s;
}
docstat = commit_buff(buff, &d, out, docstat);
save = *s;
- *s = 0;
+ *s = '\0';
print_ref(out, output_dollar, ref);
*s = save;
s--;
char *p = tmp;
int tmplen = sizeof(tmp);
- tmp[sizeof(tmp) - 1] = 0;
+ tmp[sizeof(tmp) - 1] = '\0';
if (prefix)
{
strfcpy(tmp, NONULL(Prefix), sizeof(tmp));
if (env->to)
{
addstr("To: ");
- tmp[0] = 0;
+ tmp[0] = '\0';
rfc822_write_address(tmp, sizeof(tmp), env->to, 1);
addstr(tmp);
addch('\n');
if (env->cc)
{
addstr("Cc: ");
- tmp[0] = 0;
+ tmp[0] = '\0';
rfc822_write_address(tmp, sizeof(tmp), env->cc, 1);
addstr(tmp);
addch('\n');
if (env->bcc)
{
addstr("Bcc: ");
- tmp[0] = 0;
+ tmp[0] = '\0';
rfc822_write_address(tmp, sizeof(tmp), env->bcc, 1);
addstr(tmp);
addch('\n');
mutt_window_move(MuttMessageWindow, 0, 0);
addstr("To: ");
- tmp[0] = 0;
+ tmp[0] = '\0';
mutt_addrlist_to_local(e->to);
rfc822_write_address(tmp, sizeof(tmp), e->to, 0);
if (!e->to || force)
e->to = mutt_parse_adrlist(e->to, tmp);
e->to = mutt_expand_aliases(e->to);
mutt_addrlist_to_intl(e->to, NULL); /* XXX - IDNA error reporting? */
- tmp[0] = 0;
+ tmp[0] = '\0';
rfc822_write_address(tmp, sizeof(tmp), e->to, 1);
mutt_window_mvaddstr(MuttMessageWindow, 0, 4, tmp);
}
if ((!e->cc && option(OPT_ASK_CC)) || force)
{
addstr("Cc: ");
- tmp[0] = 0;
+ tmp[0] = '\0';
mutt_addrlist_to_local(e->cc);
rfc822_write_address(tmp, sizeof(tmp), e->cc, 0);
if (mutt_enter_string(tmp, sizeof(tmp), 4, 0) == 0)
rfc822_free_address(&e->cc);
e->cc = mutt_parse_adrlist(e->cc, tmp);
e->cc = mutt_expand_aliases(e->cc);
- tmp[0] = 0;
+ tmp[0] = '\0';
mutt_addrlist_to_intl(e->cc, NULL);
rfc822_write_address(tmp, sizeof(tmp), e->cc, 1);
mutt_window_mvaddstr(MuttMessageWindow, 0, 4, tmp);
if (option(OPT_ASK_BCC) || force)
{
addstr("Bcc: ");
- tmp[0] = 0;
+ tmp[0] = '\0';
mutt_addrlist_to_local(e->bcc);
rfc822_write_address(tmp, sizeof(tmp), e->bcc, 0);
if (mutt_enter_string(tmp, sizeof(tmp), 5, 0) == 0)
e->bcc = mutt_parse_adrlist(e->bcc, tmp);
e->bcc = mutt_expand_aliases(e->bcc);
mutt_addrlist_to_intl(e->bcc, NULL);
- tmp[0] = 0;
+ tmp[0] = '\0';
rfc822_write_address(tmp, sizeof(tmp), e->bcc, 1);
mutt_window_mvaddstr(MuttMessageWindow, 0, 5, tmp);
}
buf = be_snarf_file(path, buf, &bufmax, &buflen, 0);
- tmp[0] = 0;
+ tmp[0] = '\0';
while (!done)
{
if (mutt_enter_string(tmp, sizeof(tmp), 0, 0) == -1)
{
- tmp[0] = 0;
+ tmp[0] = '\0';
continue;
}
addch('\n');
/* remove trailing whitespace from the line */
p = tmp + mutt_strlen(tmp) - 1;
while (p >= tmp && ISSPACE(*p))
- *p-- = 0;
+ *p-- = '\0';
p = tmp + 2;
SKIPWS(p);
{
buflen--;
strfcpy(tmp, buf[buflen], sizeof(tmp));
- tmp[mutt_strlen(tmp) - 1] = 0;
+ tmp[mutt_strlen(tmp) - 1] = '\0';
FREE(&buf[buflen]);
buf[buflen] = NULL;
continue;
buf[buflen++] = safe_strdup(tmp[1] == '~' ? tmp + 1 : tmp);
}
- tmp[0] = 0;
+ tmp[0] = '\0';
}
if (!abort)
int yr;
if (path)
- *path = 0;
+ *path = '\0';
if (mutt_strncmp("From ", s, 5) != 0)
return 0;
if (len + 1 > pathlen)
len = pathlen - 1;
memcpy(path, s, len);
- path[len] = 0;
+ path[len] = '\0';
mutt_debug(3, "is_from(): got return path: %s\n", path);
}
{
while (linelen > 0 && ISSPACE(line[linelen - 1]))
linelen--;
- line[linelen] = 0;
+ line[linelen] = '\0';
}
/* decode and do character set conversion */
char bufi[BUFI_SIZE];
size_t l = 0;
- buf[4] = 0;
+ buf[4] = '\0';
if (istext)
state_set_prefix(s);
{
l = mutt_strlen(buf);
while (l > 0 && buf[l - 1] == ' ')
- buf[--l] = 0;
+ buf[--l] = '\0';
}
if (s->prefix)
state_puts(s->prefix, s);
if (!p)
return true;
- *p = 0;
+ *p = '\0';
if (mutt_mkdir(dir, S_IRWXU | S_IRWXG | S_IRWXO) == 0)
return true;
path[l++] = *p;
}
p = skip_email_wsp(p);
- path[l] = 0;
+ path[l] = '\0';
mutt_expand_path(path, sizeof(path));
if ((body2 = mutt_make_file_attach(path)))
km_expand_key(buf, sizeof(buf), km_find_func(MENU_GENERIC, op)))
snprintf(d, dlen, "%s:%s", buf, txt);
else
- d[0] = 0;
+ d[0] = '\0';
}
char *mutt_compile_help(char *buf, size_t buflen, int menu, const struct Mapping *items)
void mutt_default_save(char *path, size_t pathlen, struct Header *hdr)
{
- *path = 0;
+ *path = '\0';
if (addr_hook(path, pathlen, MUTT_SAVEHOOK, Context, hdr) != 0)
{
char tmp[_POSIX_PATH_MAX];
}
/* we don't care about buffer size if we don't wrap content. But here it is */
- ((char *) send_token.value)[0] = 0;
+ ((char *) send_token.value)[0] = '\0';
buf_size = ntohl(*((long *) send_token.value));
gss_release_buffer(&min_stat, &send_token);
mutt_debug(2, "Unwrapped security level flags: %c%c%c\n",
if (*s != '\"')
return -1;
s++; /* skip past the trailing " */
- *ptmp = 0;
+ *ptmp = '\0';
h->received = imap_parse_date(tmp);
}
else if (mutt_strncasecmp("RFC822.SIZE", s, 11) == 0)
ptmp = tmp;
while (isdigit((unsigned char) *s))
*ptmp++ = *s++;
- *ptmp = 0;
+ *ptmp = '\0';
h->content_length = atoi(tmp);
}
else if ((mutt_strncasecmp("BODY", s, 4) == 0) ||
pn = pc;
while (isdigit((unsigned char) *pc))
pc++;
- *pc = 0;
+ *pc = '\0';
*bytes = atoi(pn);
return 0;
}
}
*pt++ = '"';
- *pt = 0;
+ *pt = '\0';
}
/**
char *s = (char *) b;
int i;
- tmp[SHORT_STRING - 1] = 0;
+ tmp[SHORT_STRING - 1] = '\0';
for (i = 0; i < SHORT_STRING - 2; i++, s++)
{
if (!*s || ISSPACE(*s))
{
- tmp[i] = 0;
+ tmp[i] = '\0';
break;
}
tmp[i] = *s;
}
- tmp[i + 1] = 0;
+ tmp[i + 1] = '\0';
return mutt_strcasecmp(a, tmp);
}
p += escape_string(p, len - (p - dst) + 1, val); /* \0 terminate it */
if (p - dst < len)
*p++ = '"';
- *p = 0;
+ *p = '\0';
}
static int check_charset(struct Option *opt, const char *val)
{
for (l = 0; src[l] && src[l] == dest[l]; l++)
;
- dest[l] = 0;
+ dest[l] = '\0';
}
}
}
if (vlen == 0)
return 0;
- var[vlen - 1] = 0;
+ var[vlen - 1] = '\0';
if ((idx = mutt_option_index(var)) == -1)
{
if ((myvarval = myvar_get(var)) != NULL)
{
buf[0] = '^';
buf[1] = (c + '@') & 0x7f;
- buf[2] = 0;
+ buf[2] = '\0';
}
else
snprintf(buf, sizeof(buf), "\\%d%d%d", c >> 6, (c >> 3) & 7, c & 7);
if (len > (buflen - 1))
len = buflen - 1;
memcpy(buf, tz, len);
- buf[len] = 0;
+ buf[len] = '\0';
return buf;
}
(*line)++;
if (flags & MUTT_EOL)
return s;
- *ch = 0;
+ *ch = '\0';
if ((ch > s) && (*(ch - 1) == '\r'))
- *--ch = 0;
+ *--ch = '\0';
if (!(flags & MUTT_CONT) || (ch == s) || (*(ch - 1) != '\\'))
return s;
offset = ch - s - 1;
* It doesn't appear that the return value is actually checked anywhere mutt_concat_path()
* is called, so we should just copy set dst to nul and let the calling function fail later.
*/
- dst[0] = 0; /* safe since we bail out early if dstlen == 0 */
+ dst[0] = '\0'; /* safe since we bail out early if dstlen == 0 */
return NULL;
}
memcpy(dst + offset, fname, fnamelen);
offset += fnamelen;
}
- dst[offset] = 0;
+ dst[offset] = '\0';
return dst;
}
if (len > (destlen - 1))
len = destlen - 1;
memcpy(dest, begin, len);
- dest[len] = 0;
+ dest[len] = '\0';
return dest;
}
p = safe_malloc(len + 1);
memcpy(p, begin, len);
- p[len] = 0;
+ p[len] = '\0';
return p;
}
char *p = NULL;
for (p = s + mutt_strlen(s) - 1; p >= s && ISSPACE(*p); p--)
- *p = 0;
+ *p = '\0';
}
/**
w++;
}
}
- *w = 0;
+ *w = '\0';
}
/**
ctx->mtime = sb.st_mtime;
ctx->size = sb.st_size;
- buf[sizeof(buf) - 1] = 0;
+ buf[sizeof(buf) - 1] = '\0';
if (!ctx->quiet)
{
break;
}
- return_path[0] = 0;
+ return_path[0] = '\0';
if (!is_from(buf, return_path, sizeof(return_path), &t))
{
int cols = menu->indexwin->cols - shift;
mutt_simple_format(s, n, cols, cols, FMT_LEFT, ' ', scratch, mutt_strlen(scratch), 1);
- s[n - 1] = 0;
+ s[n - 1] = '\0';
FREE(&scratch);
}
if (menu->max)
{
mutt_unget_event(LastKey, 0);
- buf[0] = 0;
+ buf[0] = '\0';
if (mutt_get_field(_("Jump to: "), buf, sizeof(buf), 0) == 0 && buf[0])
{
if (mutt_atoi(buf, &n) == 0 && n > 0 && n < menu->max + 1)
/* kill the previous flags */
if ((p = strchr(newpath, ':')) != NULL)
- *p = 0;
+ *p = '\0';
maildir_flags(suffix, sizeof(suffix), h);