X-Git-Url: https://diplodocus.org/git/nmh/blobdiff_plain/6fc2909634fb431c65ecfa8b6db4f6519f99b389..a30ef3465250ae21bb3928a6e120ba4351cf8ff0:/uip/prompter.c diff --git a/uip/prompter.c b/uip/prompter.c index f5332e46..0532c219 100644 --- a/uip/prompter.c +++ b/uip/prompter.c @@ -1,6 +1,4 @@ - -/* - * prompter.c -- simple prompting editor front-end +/* prompter.c -- simple prompting editor front-end * * This code is Copyright (c) 2002, by the authors of nmh. See the * COPYRIGHT file in the root directory of the nmh distribution for @@ -10,6 +8,7 @@ #include #include #include +#include "../sbr/m_mktemp.h" #include #include @@ -71,7 +70,7 @@ main (int argc, char **argv) int body = 1, prepend = 1, rapid = 0; int doteof = 0, fdi, fdo, i, state; char *cp, *drft = NULL, *erasep = NULL; - char *killp = NULL, name[NAMESZ], field[BUFSIZ]; + char *killp = NULL, name[NAMESZ], field[NMH_BUFSIZ]; char buffer[BUFSIZ]; char **arguments, **argp; FILE *in, *out; @@ -214,8 +213,8 @@ main (int argc, char **argv) while (state == FLDPLUS) { fieldsz = sizeof field; state = m_getfld (&gstate, name, field, &fieldsz, in); - printf ("%s", field); - fprintf (out, "%s", field); + fputs(field, stdout); + fputs(field, out); } } else { /* Else, get value of header field */ @@ -235,7 +234,7 @@ abort: do { if (field[0] != ' ' && field[0] != '\t') putc (' ', out); - fprintf (out, "%s", field); + fputs(field, out); } while (i == 1 && (i = getln (field, sizeof(field))) >= 0); if (i == -1) @@ -251,7 +250,7 @@ abort: break; fprintf (out, "--------\n"); if (field[0] == 0 || !prepend) - printf ("--------\n"); + puts("--------"); if (field[0]) { if (prepend && body) { printf ("\n--------Enter initial text\n\n"); @@ -262,14 +261,14 @@ abort: break; if (buffer[0] == 0) break; - fprintf (out, "%s", buffer); + fputs(buffer, out); } } do { - fprintf (out, "%s", field); + fputs(field, out); if (!rapid && !sigint) - printf ("%s", field); + fputs(field, stdout); } while (state == BODY && (fieldsz = sizeof field, state = m_getfld (&gstate, name, field, &fieldsz, in))); @@ -286,7 +285,7 @@ abort: break; if (field[0] == 0) break; - fprintf (out, "%s", field); + fputs(field, out); } break; @@ -298,7 +297,7 @@ abort: m_getfld_state_destroy (&gstate); if (body) - printf ("--------\n"); + puts("--------"); fflush (stdout); fclose (in);