From: Ralph Corderoy Date: Sun, 12 Nov 2017 00:26:11 +0000 (+0000) Subject: read_switch.c: Move interface declaration to own file. X-Git-Url: https://diplodocus.org/git/nmh/commitdiff_plain/d43c995de90c5022b8a2be60e8595b0a968f6089 read_switch.c: Move interface declaration to own file. --- diff --git a/Makefile.am b/Makefile.am index 3db6bfad..fb982b14 100644 --- a/Makefile.am +++ b/Makefile.am @@ -419,6 +419,7 @@ noinst_HEADERS = \ sbr/push.h \ sbr/r1bindex.h \ sbr/read_line.h \ + sbr/read_switch.h \ sbr/readconfig.h \ sbr/refile.h \ sbr/remdir.h \ diff --git a/h/prototypes.h b/h/prototypes.h index 970cd210..dff1a035 100644 --- a/h/prototypes.h +++ b/h/prototypes.h @@ -15,13 +15,6 @@ char *etcpath(char *) NONNULL(1); struct msgs_array; -/* - * Print null-terminated PROMPT to and flush standard output. Read answers from - * standard input until one matches an entry in SWITCHES. When one matches, - * return its swret field. Return 0 on EOF. - */ -int read_switch(const char *PROMPT, const struct swit *SWITCHES); - /* * 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 diff --git a/sbr/read_switch.c b/sbr/read_switch.c index 8cdbfe4f..1c3e851e 100644 --- a/sbr/read_switch.c +++ b/sbr/read_switch.c @@ -6,6 +6,7 @@ */ #include "h/mh.h" +#include "read_switch.h" #include "smatch.h" diff --git a/sbr/read_switch.h b/sbr/read_switch.h new file mode 100644 index 00000000..2ee51ce3 --- /dev/null +++ b/sbr/read_switch.h @@ -0,0 +1,12 @@ +/* read_switch.h -- prompt the user for an answer from the list + * + * 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. */ + +/* + * Print null-terminated PROMPT to and flush standard output. Read answers from + * standard input until one matches an entry in SWITCHES. When one matches, + * return its swret field. Return 0 on EOF. + */ +int read_switch(const char *, const struct swit *); diff --git a/sbr/read_yes_or_no_if_tty.c b/sbr/read_yes_or_no_if_tty.c index 8d7dac6e..15450c5d 100644 --- a/sbr/read_yes_or_no_if_tty.c +++ b/sbr/read_yes_or_no_if_tty.c @@ -6,6 +6,7 @@ */ #include "h/mh.h" +#include "read_switch.h" int diff --git a/uip/install-mh.c b/uip/install-mh.c index ee051022..97e1ac46 100644 --- a/uip/install-mh.c +++ b/uip/install-mh.c @@ -6,6 +6,7 @@ */ #include "h/mh.h" +#include "sbr/read_switch.h" #include "sbr/concat.h" #include "sbr/smatch.h" #include "sbr/context_save.h" diff --git a/uip/replsbr.c b/uip/replsbr.c index 93088975..e9f250b0 100644 --- a/uip/replsbr.c +++ b/uip/replsbr.c @@ -6,6 +6,7 @@ */ #include "h/mh.h" +#include "sbr/read_switch.h" #include "sbr/concat.h" #include "sbr/closefds.h" #include "sbr/uprf.h"