X-Git-Url: http://git.marmaro.de/?a=blobdiff_plain;f=uip%2Fprompter.c;h=7c28aeced74d7ba2db8bbff5ebe9cfc43b43aacf;hb=a01a41d031c796b526329a4170eb23f0ac93b949;hp=fa1bfae8ec5f807c4ef90517dd61d65b0df710b2;hpb=1691e80890e5d8ba258c51c214a3e91880e1db2b;p=mmh diff --git a/uip/prompter.c b/uip/prompter.c index fa1bfae..7c28aec 100644 --- a/uip/prompter.c +++ b/uip/prompter.c @@ -2,7 +2,9 @@ /* * prompter.c -- simple prompting editor front-end * - * $Id$ + * This code is Copyright (c) 2002, by the authors of nmh. See the + * COPYRIGHT file in the root directory of the nmh distribution for + * complete copyright information. */ #include @@ -56,11 +58,10 @@ static struct swit switches[] = { #define VERSIONSW 10 { "version", 0 }, #define HELPSW 11 - { "help", 4 }, + { "help", 0 }, { NULL, 0 } }; -extern int errno; #ifdef HAVE_TERMIOS_H static struct termios tio; @@ -105,6 +106,7 @@ main (int argc, char **argv) char buffer[BUFSIZ], tmpfil[BUFSIZ]; char **arguments, **argp; FILE *in, *out; + char *tfile = NULL; #ifdef LOCALE setlocale(LC_ALL, ""); @@ -182,10 +184,10 @@ main (int argc, char **argv) if ((in = fopen (drft, "r")) == NULL) adios (drft, "unable to open"); - strncpy (tmpfil, m_tmpfil (invo_name), sizeof(tmpfil)); - if ((out = fopen (tmpfil, "w")) == NULL) - adios (tmpfil, "unable to create"); + tfile = m_mktemp2(NULL, invo_name, NULL, &out); + if (tfile == NULL) adios("prompter", "unable to create temporary file"); chmod (tmpfil, 0600); + strncpy (tmpfil, tfile, sizeof(tmpfil)); /* * Are we changing the kill or erase character? @@ -398,6 +400,7 @@ no_body: context_save (); /* save the context file */ done (0); + return 1; }