#include <h/mh.h>
#include <h/addrsbr.h>
#include <h/fmt_scan.h>
+#include <h/utils.h>
#include <locale.h>
#include <sysexits.h>
{ NULL, 0 }
};
+char *version=VERSION;
+
static struct format *fmt;
static int dat[5];
(q = &pq)->pq_next = NULL;
while ((cp = getname(arg))) {
- if ((p = (struct pqpair *)
- mh_xcalloc((size_t) 1, sizeof(*p))) == NULL)
- adios(EX_OSERR, NULL, "unable to allocate pqpair memory");
+ p = mh_xcalloc(1, sizeof(*p));
if ((mp = getm(cp, NULL, 0, norm, error)) == NULL) {
- p->pq_text = getcpy(cp);
- p->pq_error = getcpy(error);
+ p->pq_text = mh_xstrdup(cp);
+ p->pq_error = mh_xstrdup(error);
status++;
} else {
- p->pq_text = getcpy(mp->m_text);
+ p->pq_text = mh_xstrdup(mp->m_text);
mnfree(mp);
}
q = (q->pq_next = p);
fmt_scan(fmt, buffer, BUFSIZ, dat);
fputs(buffer, stdout);
- free(p->pq_text);
+ mh_free0(&(p->pq_text));
if (p->pq_error)
- free(p->pq_error);
+ mh_free0(&(p->pq_error));
q = p->pq_next;
- free((char *) p);
+ mh_free0(&p);
}
return status;