termcap: add lost header information
authorAlan Cox <alan@linux.intel.com>
Fri, 21 Aug 2015 19:59:32 +0000 (20:59 +0100)
committerAlan Cox <alan@linux.intel.com>
Fri, 21 Aug 2015 19:59:32 +0000 (20:59 +0100)
It's not clear who filed off most of the copyright info in the past (it's PD
so they were entitled to even if it's rude), but we'll restore the proper
credits

Library/include/termcap.h
Library/libs/termcap.c

index c39322a..691915b 100644 (file)
@@ -9,13 +9,12 @@ extern char *UP;
 extern char *BC;
 extern int ospeed;
 
-extern int tgetent __P((char *, char *));
-extern int tgetflag __P((char *));
-extern int tgetnum __P((char *));
-extern char *tgetstr __P((char *, char **));
+extern int tgetent(char *, const char *);
+extern int tgetflag(char *);
+extern int tgetnum(char *);
+extern char *tgetstr(char *, char **);
 
-extern int tputs __P((char *, int, void (*outc)(int)));
-extern char *tgoto __P((char *, int, int));
-extern char * tparam(char *, char *, int, int, int, int, int); /* VARARGS */
+extern int tputs __P((const char *, int, int (*outc)(int)));
+extern char *tgoto __P((const char *, int, int));
 
 #endif /* _TERMCAP_H */
index 8c142f1..817eb25 100644 (file)
@@ -1,4 +1,39 @@
-/* termcap - print termcap settings    Author: Terrence Holm */
+/*
+ *     termcap.c       V1.1    20/7/87         agc     Joypace Ltd
+ *
+ *     Copyright Joypace Ltd, London, UK, 1987. All rights reserved.
+ *     This file may be freely distributed provided that this notice
+ *     remains attached.
+ *
+ *     A public domain implementation of the termcap(3) routines.
+ *
+ *
+ *
+ *      Klamer Schutte       V1.2    Nov. 1988
+ *
+ *   - Can match multiple terminal names                [tgetent]
+ *   - Removal of **area assignments                    [tgetstr]
+ *
+ *      Terrence W. Holm     V1.3    May, Sep, Oct.  1988
+ *
+ *  - Correct when TERM != name and TERMCAP is defined  [tgetent]
+ *  - Correct the comparison for the terminal name      [tgetent]
+ *  - Correct the value of ^x escapes                   [tgetstr]
+ *  - Added %r to reverse row/column                    [tgoto]
+ *  - Fixed end of definition test                      [tgetnum/flag/str]
+ *
+ *      Terrence W. Holm     V1.4    Jan. 1989
+ *
+ *   - Incorporated Klamer's V1.2 fixes into V1.3
+ *   - Added %d, (old %d is now %2)                     [tgoto]
+ *   - Allow '#' comments in definition file            [tgetent]
+ *
+ * FIXME:
+ *     - support the use of some kind of < 1024 byte buffer
+ *       interface
+ *     - avoid the use of stdio (state machine search for either
+ *       [start of file]name: or \nname:)
+ */
 
 #include <termcap.h>
 #include <stdio.h>
@@ -26,7 +61,7 @@ extern char *UP;              /* up cursor movement */
 int tgetent(char *bp, char *name)
 {
     FILE *fp;
-    char *file;
+    const char *file;
     char *term;
     short len = strlen(name);
 
@@ -42,8 +77,7 @@ int tgetent(char *bp, char *name)
     else if (*file != '/')
        if ((term = getenv("TERM")) != (char *) NULL
            && strcmp(term, name) == 0) {
-           *bp = '\0';
-           strncat(bp, file, 1023);
+           strlcpy(bp, file, 1023);
            return (1);
        } else
            file = "/etc/termcap";