X-Git-Url: http://git.marmaro.de/?p=mmh;a=blobdiff_plain;f=uip%2Fmhtest.c;h=d4bf6a6a05b107a4e7e167a42fa520fdffd5ed4a;hp=5b47f22c64858b88763a886f07bd86a1d6fbd373;hb=6e9577f324bef90765a5edc02044eb111ec48072;hpb=cf1205b5cbea2f0cd6ea710ec16c637df85b647c diff --git a/uip/mhtest.c b/uip/mhtest.c index 5b47f22..d4bf6a6 100644 --- a/uip/mhtest.c +++ b/uip/mhtest.c @@ -42,6 +42,7 @@ static struct swit switches[] = { { NULL, 0 } }; +char *version=VERSION; /* mhparse.c */ extern char *tmp; /* directory to place temp files */ @@ -153,14 +154,14 @@ main(int argc, char **argv) if (!(cp = *argp++) || (*cp == '-' && cp[1])) adios(EX_USAGE, NULL, "missing argument to %s", argp[-2]); - file = *cp == '-' ? cp : getcpy(expanddir(cp)); + file = *cp == '-' ? cp : mh_xstrdup(expanddir(cp)); continue; case OUTFILESW: if (!(cp = *argp++) || (*cp == '-' && cp[1])) adios(EX_USAGE, NULL, "missing argument to %s", argp[-2]); - outfile = *cp == '-' ? cp : getcpy(expanddir(cp)); + outfile = *cp == '-' ? cp : mh_xstrdup(expanddir(cp)); continue; case VERBSW: @@ -178,7 +179,7 @@ main(int argc, char **argv) if (folder) adios(EX_USAGE, NULL, "only one folder at a time!"); else - folder = getcpy(expandfol(cp)); + folder = mh_xstrdup(expandfol(cp)); } else app_msgarg(&msgs, cp); } @@ -200,7 +201,7 @@ main(int argc, char **argv) if ((cp = context_find(nmhstorage)) && *cp) tmp = concat(cp, "/", invo_name, NULL); else - tmp = getcpy(toabsdir(invo_name)); + tmp = mh_xstrdup(toabsdir(invo_name)); if (file && msgs.size) adios(EX_USAGE, NULL, "cannot specify msg and file at same time!"); @@ -209,8 +210,7 @@ main(int argc, char **argv) ** check if message is coming from file */ if (file) { - if (!(cts = (CT *) calloc((size_t) 2, sizeof(*cts)))) - adios(EX_OSERR, NULL, "out of memory"); + cts = mh_xcalloc(2, sizeof(*cts)); ctp = cts; if ((ct = parse_mime(file))) @@ -242,9 +242,7 @@ main(int argc, char **argv) exit(EX_USAGE); seq_setprev(mp); /* set the previous-sequence */ - if (!(cts = (CT *) calloc((size_t) (mp->numsel + 1), - sizeof(*cts)))) - adios(EX_OSERR, NULL, "out of memory"); + cts = mh_xcalloc(mp->numsel + 1, sizeof(*cts)); ctp = cts; for (msgnum = mp->lowsel; msgnum <= mp->hghsel; msgnum++) { @@ -289,8 +287,7 @@ main(int argc, char **argv) for (ctp = cts; *ctp; ctp++) free_content(*ctp); - free((char *) cts); - cts = NULL; + mh_free0(&cts); /* If reading from a folder, do some updating */ if (mp) {