]> diplodocus.org Git - nmh/commitdiff
Move terminal.c's prototypes from prototypes.h to new terminal.h.
authorRalph Corderoy <ralph@inputplus.co.uk>
Mon, 28 Aug 2017 18:33:53 +0000 (19:33 +0100)
committerRalph Corderoy <ralph@inputplus.co.uk>
Mon, 28 Aug 2017 19:00:35 +0000 (20:00 +0100)
Makefile.am
h/prototypes.h
sbr/fmt_compile.c
sbr/terminal.c
sbr/terminal.h [new file with mode: 0644]
uip/ap.c
uip/dp.c
uip/fmttest.c
uip/mhlsbr.c
uip/scan.c
uip/scansbr.c

index 9781dfd..3a3f9a4 100644 (file)
@@ -367,6 +367,7 @@ noinst_HEADERS = \
     sbr/makedir.h \
     sbr/message_id.h \
     sbr/mime_type.h \
+    sbr/terminal.h \
     sbr/unquote.h \
     thirdparty/jsmn/jsmn.h \
     uip/mhfree.h \
index e62ea06..ab9e83d 100644 (file)
@@ -171,57 +171,6 @@ char *getcpy(const char *str);
 char *get_default_editor(void);
 char *getfolder(int) PURE;
 
-/*
- * Get a string from the terminfo database for the current terminal.
- *
- * Retrieve the specified terminfo capability and return a string that
- * can be output to the terminal.  The string returned has already been
- * processed by tputs(), so it is safe to output directly.  The return
- * value of this function is valid until the next call.
- *
- * Arguments:
- *
- * capability  - The name of the terminfo capability (see terminfo(5)).
- *
- * Returns a tputs-processed string, or NULL if terminal initialization failed
- * or the capability wasn't found.
- */
-char *get_term_stringcap(char *capability);
-
-/*
- * Get a parameterized string from the terminfo database for the current
- * terminal.
- *
- * We don't yet have a standardized tparm() that will take a stdarg
- * argument.  Right now we don't want many parameters, so we only
- * take two.  Everything gets passed to tparm() as-is.  If we need
- * a capability with more arguments, we'll just add more later.
- *
- * Arguments:
- *
- * capability  - The name of the terminfo capability (see terminfo(5)).
- * arg1..argN  - Arguments 1-N.
- *
- * Returns a tparm and tputs-processed string, or NULL if there was a problem
- * initialising the terminal or retrieving the capability.
- */
-char *get_term_stringparm(char *capability, long arg1, long arg2);
-
-/*
- * Get a number from the terminfo database for the current terminal.
- *
- * Retrieve the specified terminfo capability and return the numeric
- * value of that capability from the terminfo database.
- *
- * Arguments:
- *
- * capability  - The name of the terminfo capability (see terminfo(5)).
- *
- * Returns the output of tigetnum() for that capability, or -1 if it was
- * unable to initialize the terminfo database.
- */
-int get_term_numcap(char *capability);
-
 int m_atoi (char *) PURE;
 char *m_backup (const char *);
 int m_convert (struct msgs *, char *);
@@ -240,10 +189,6 @@ char *m_name (int);
 void m_unknown(m_getfld_state_t *, FILE *);
 void m_unknown2(m_getfld_state_t *);
 
-/*
- * Clear the screen, using the appropriate entry from the terminfo database
- */
-void nmh_clear_screen(void);
 char *nmh_getpass(const char *);
 char *new_fs (char *, char *, char *);
 char *path(char *, int);
@@ -380,12 +325,9 @@ int mhlsbr(int, char **, FILE *(*)(char *));
 int distout (char *, char *, char *);
 void replout (FILE *, char *, char *, struct msgs *, int,
        int, char *, char *, char *, int);
-int sc_length(void);
-int sc_width(void);
 int build_form (char *, char *, int *, char *, char *, char *, char *,
                char *, char *);
 int sendsbr (char **, int, char *, char *, struct stat *, int, const char *);
-int SOprintf (char *, ...) CHECK_PRINTF(1, 2);
 int what_now (char *, int, int, char *, char *,
        int, struct msgs *, char *, int, char *, int);
 int WhatNow(int, char **) NORETURN;
index a9dad42..3930f8c 100644 (file)
@@ -46,6 +46,7 @@
 #include <h/fmt_compile.h>
 #include <h/mts.h>
 #include <h/utils.h>
+#include "terminal.h"
 
 #ifdef HAVE_SYS_TIME_H
 # include <sys/time.h>
index 51dd129..761ed24 100644 (file)
@@ -19,6 +19,8 @@
 # include <sys/ptem.h>
 #endif
 
+#include "terminal.h"
+
 static int initLI = 0;
 static int initCO = 0;
 
@@ -148,8 +150,19 @@ SOprintf (char *fmt, ...)
 }
 
 /*
- * Return the specified capability as a string that has already been
- * processed with tputs().
+ * Get a string from the terminfo database for the current terminal.
+ *
+ * Retrieve the specified terminfo capability and return a string that
+ * can be output to the terminal.  The string returned has already been
+ * processed by tputs(), so it is safe to output directly.  The return
+ * value of this function is valid until the next call.
+ *
+ * Arguments:
+ *
+ * capability  - The name of the terminfo capability (see terminfo(5)).
+ *
+ * Returns a tputs-processed string, or NULL if terminal initialization failed
+ * or the capability wasn't found.
  */
 
 char *
@@ -178,9 +191,22 @@ get_term_stringcap(char *capability)
 }
 
 /*
- * Return a parameterized terminfo capability
+ * Get a parameterized string from the terminfo database for the current
+ * terminal.
+ *
+ * We don't yet have a standardized tparm() that will take a stdarg
+ * argument.  Right now we don't want many parameters, so we only
+ * take two.  Everything gets passed to tparm() as-is.  If we need
+ * a capability with more arguments, we'll just add more later.
+ *
+ * Arguments:
+ *
+ * capability  - The name of the terminfo capability (see terminfo(5)).
+ * arg1..argN  - Arguments 1-N.
+ *
+ * Returns a tparm and tputs-processed string, or NULL if there was a problem
+ * initialising the terminal or retrieving the capability.
  */
-
 char *
 get_term_stringparm(char *capability, long arg1, long arg2)
 {
@@ -209,9 +235,18 @@ get_term_stringparm(char *capability, long arg1, long arg2)
 }
 
 /*
- * Return the value of the specified numeric capability
+ * Get a number from the terminfo database for the current terminal.
+ *
+ * Retrieve the specified terminfo capability and return the numeric
+ * value of that capability from the terminfo database.
+ *
+ * Arguments:
+ *
+ * capability  - The name of the terminfo capability (see terminfo(5)).
+ *
+ * Returns the output of tigetnum() for that capability, or -1 if it was
+ * unable to initialize the terminfo database.
  */
-
 int
 get_term_numcap(char *capability)
 {
diff --git a/sbr/terminal.h b/sbr/terminal.h
new file mode 100644 (file)
index 0000000..867a9fd
--- /dev/null
@@ -0,0 +1,14 @@
+/* terminal.h -- termcap support
+ *
+ * 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.
+ */
+
+int sc_width(void);
+int sc_length(void);
+void nmh_clear_screen(void);
+int SOprintf(char *fmt, ...) CHECK_PRINTF(1, 2);
+char *get_term_stringcap(char *capability);
+char *get_term_stringparm(char *capability, long arg1, long arg2);
+int get_term_numcap(char *capability);
index a44ecf5..a20747f 100644 (file)
--- a/uip/ap.c
+++ b/uip/ap.c
@@ -10,6 +10,7 @@
 #include <h/fmt_scan.h>
 #include <h/mts.h>
 #include <h/utils.h>
+#include "../sbr/terminal.h"
 
 #define        NADDRS  100
 
index ece04a3..617da20 100644 (file)
--- a/uip/dp.c
+++ b/uip/dp.c
@@ -9,6 +9,7 @@
 #include <h/utils.h>
 #include <h/fmt_scan.h>
 #include <h/tws.h>
+#include "../sbr/terminal.h"
 
 #define        NDATES 100
 
index d5d4731..1c4159a 100644 (file)
@@ -12,6 +12,7 @@
 #include <h/scansbr.h>
 #include <h/addrsbr.h>
 #include "../sbr/m_maildir.h"
+#include "../sbr/terminal.h"
 
 #define FMTTEST_SWITCHES \
     X("form formatfile", 0, FORMSW) \
index 7625312..d32d38f 100644 (file)
@@ -14,6 +14,7 @@
 #include "../sbr/m_popen.h"
 #include <setjmp.h>
 #include <sys/types.h>
+#include "../sbr/terminal.h"
 
 /*
  * MAJOR BUG:
index d9d8ca9..b65fef7 100644 (file)
@@ -12,6 +12,7 @@
 #include <h/mts.h>
 #include <h/utils.h>
 #include "../sbr/m_maildir.h"
+#include "../sbr/terminal.h"
 
 #define SCAN_SWITCHES \
     X("clear", 0, CLRSW) \
index 24609d2..bbc5a16 100644 (file)
@@ -11,6 +11,7 @@
 #include <h/scansbr.h>
 #include <h/tws.h>
 #include <h/utils.h>
+#include "../sbr/terminal.h"
 
 static struct format *fmt;
 static struct comp *datecomp;          /* pntr to "date" comp             */