*/
#include "h/mh.h"
+#include "sbr/fmt_new.h"
+#include "mhlsbr.h"
#include "sbr/m_getfld.h"
#include "sbr/getarguments.h"
#include "sbr/concat.h"
formatproc != NULL) {
filterbody(c1, buf, sizeof(buf), state, gstate);
} else {
- holder.c_text = mh_xmalloc (sizeof(buf));
- strncpy (holder.c_text, buf, sizeof(buf));
+ bufsz = sizeof buf;
+ holder.c_text = mh_xmalloc(bufsz);
+ strncpy(holder.c_text, buf, bufsz);
while (state == BODY) {
putcomp (c1, &holder, BODYCOMP);
bufsz = sizeof buf;
switch (filterpid = fork()) {
char **args, *program;
struct arglist *a;
- int i, dat[5], s, argp;
+ int i, dat[5], argp;
case 0:
/*
fmt_scan(a->a_fmt, scanl, BUFSIZ, dat, NULL);
args[i] = charstring_buffer_copy (scanl);
charstring_free (scanl);
- /*
- * fmt_scan likes to put a trailing newline at the end of the
- * format string. If we have one, get rid of it.
- */
- s = strlen(args[i]);
- if (args[i][s - 1] == '\n')
- args[i][s - 1] = '\0';
-
+ /* Trim a trailing linefeed that fmt_scan() likes to put at
+ * the end of the format string. */
+ trim_suffix_c(args[i], '\n');
if (mhldebug)
fprintf(stderr, "filterarg: fmt=\"%s\", output=\"%s\"\n",
a->a_nfs, args[i]);