]> diplodocus.org Git - nmh/commitdiff
read_yes_or_no_if_tty.c: Move interface to own file.
authorRalph Corderoy <ralph@inputplus.co.uk>
Sun, 12 Nov 2017 00:28:46 +0000 (00:28 +0000)
committerRalph Corderoy <ralph@inputplus.co.uk>
Sun, 12 Nov 2017 12:25:35 +0000 (12:25 +0000)
Makefile.am
h/prototypes.h
sbr/context_read.c
sbr/read_yes_or_no_if_tty.c
sbr/read_yes_or_no_if_tty.h [new file with mode: 0644]
sbr/utils.c
uip/mhcachesbr.c
uip/mhmisc.c
uip/mhparse.c
uip/packf.c
uip/rmf.c

index fb982b1..e17cd54 100644 (file)
@@ -420,6 +420,7 @@ noinst_HEADERS = \
     sbr/r1bindex.h \
     sbr/read_line.h \
     sbr/read_switch.h \
+    sbr/read_yes_or_no_if_tty.h \
     sbr/readconfig.h \
     sbr/refile.h \
     sbr/remdir.h \
index dff1a03..acf51d9 100644 (file)
@@ -15,14 +15,6 @@ char *etcpath(char *) NONNULL(1);
 
 struct msgs_array;
 
-/*
- * If standard input is not a tty, return 1 without printing anything.  Else,
- * print null-terminated PROMPT to and flush standard output.  Read answers from
- * standard input until one is "yes" or "no", returning 1 for "yes" and 0 for
- * "no".  Also return 0 on EOF.
- */
-int read_yes_or_no_if_tty(const char *PROMPT);
-
 /*
  * Print null-terminated PROMPT to and flush standard output.  Read multi-word
  * answers from standard input until a first word matches an entry in SWITCHES.
index b207201..499dba4 100644 (file)
@@ -22,6 +22,7 @@
  */
 
 #include "h/mh.h"
+#include "read_yes_or_no_if_tty.h"
 #include "concat.h"
 #include "context_read.h"
 #include "context_find.h"
index 15450c5..03a3c0b 100644 (file)
@@ -6,6 +6,7 @@
  */
 
 #include "h/mh.h"
+#include "read_yes_or_no_if_tty.h"
 #include "read_switch.h"
 
 
diff --git a/sbr/read_yes_or_no_if_tty.h b/sbr/read_yes_or_no_if_tty.h
new file mode 100644 (file)
index 0000000..825bd98
--- /dev/null
@@ -0,0 +1,13 @@
+/* read_yes_or_no_if_tty.h -- get a yes/no answer from the user
+ *
+ * This code is Copyright (c) 2017, by the authors of nmh.  See the
+ * COPYRIGHT file in the root directory of the nmh distribution for
+ * complete copyright information. */
+
+/*
+ * If standard input is not a tty, return 1 without printing anything.  Else,
+ * print null-terminated PROMPT to and flush standard output.  Read answers from
+ * standard input until one is "yes" or "no", returning 1 for "yes" and 0 for
+ * "no".  Also return 0 on EOF.
+ */
+int read_yes_or_no_if_tty(const char *);
index f7f006a..d3d4a86 100644 (file)
@@ -6,6 +6,7 @@
  */
 
 #include "h/mh.h"
+#include "read_yes_or_no_if_tty.h"
 #include "concat.h"
 #include "r1bindex.h"
 #include "context_foil.h"
index 9fedd16..44faf5d 100644 (file)
@@ -6,6 +6,7 @@
  */
 
 #include "h/mh.h"
+#include "sbr/read_yes_or_no_if_tty.h"
 #include "sbr/trimcpy.h"
 #include "sbr/error.h"
 #include <fcntl.h>
index fcec3c3..525cc6d 100644 (file)
@@ -6,6 +6,7 @@
  */
 
 #include "h/mh.h"
+#include "sbr/read_yes_or_no_if_tty.h"
 #include "sbr/concat.h"
 #include "sbr/error.h"
 #include "h/mime.h"
index ca9d303..a519c7a 100644 (file)
@@ -6,6 +6,7 @@
  */
 
 #include "h/mh.h"
+#include "sbr/read_yes_or_no_if_tty.h"
 #include "sbr/concat.h"
 #include "sbr/r1bindex.h"
 #include "sbr/ruserpass.h"
index 31079a8..19ab1d4 100644 (file)
@@ -6,6 +6,7 @@
  */
 
 #include "h/mh.h"
+#include "sbr/read_yes_or_no_if_tty.h"
 #include "sbr/concat.h"
 #include "sbr/seq_setprev.h"
 #include "sbr/seq_setcur.h"
index d492df1..1e7f90c 100644 (file)
--- a/uip/rmf.c
+++ b/uip/rmf.c
@@ -6,6 +6,7 @@
  */
 
 #include "h/mh.h"
+#include "sbr/read_yes_or_no_if_tty.h"
 #include "sbr/concat.h"
 #include "sbr/smatch.h"
 #include "sbr/remdir.h"