Mercurial > hg > xemacs-beta
diff src/termcap.c @ 412:697ef44129c6 r21-2-14
Import from CVS: tag r21-2-14
author | cvs |
---|---|
date | Mon, 13 Aug 2007 11:20:41 +0200 |
parents | 74fd4e045ea6 |
children |
line wrap: on
line diff
--- a/src/termcap.c Mon Aug 13 11:19:22 2007 +0200 +++ b/src/termcap.c Mon Aug 13 11:20:41 2007 +0200 @@ -26,9 +26,18 @@ #include "lisp.h" /* For encapsulated open, close, read */ #include "device.h" /* For DEVICE_BAUD_RATE */ #else /* not emacs */ +#if defined(USG) || defined(STDC_HEADERS) +#define memcpy(d, s, n) memcpy ((d), (s), (n)) +#endif +#ifdef STDC_HEADERS #include <stdlib.h> #include <string.h> +#else +char *getenv (); +char *malloc (); +char *realloc (); +#endif #ifdef HAVE_UNISTD_H #include <unistd.h> @@ -94,16 +103,16 @@ for tgetnum, tgetflag and tgetstr to find. */ static char *term_entry; -static const char *tgetst1 (const char *ptr, char **area); +static CONST char *tgetst1 (CONST char *ptr, char **area); /* Search entry BP for capability CAP. Return a pointer to the capability (in BP) if found, 0 if not found. */ -static const char * +static CONST char * find_capability (bp, cap) - const char *bp; - const char *cap; + CONST char *bp; + CONST char *cap; { for (; *bp; bp++) if (bp[0] == ':' @@ -115,9 +124,9 @@ int tgetnum (cap) - const char *cap; + CONST char *cap; { - const char *ptr = find_capability (term_entry, cap); + CONST char *ptr = find_capability (term_entry, cap); if (!ptr || ptr[-1] != '#') return -1; return atoi (ptr); @@ -125,9 +134,9 @@ int tgetflag (cap) - const char *cap; + CONST char *cap; { - const char *ptr = find_capability (term_entry, cap); + CONST char *ptr = find_capability (term_entry, cap); return 0 != ptr && ptr[-1] == ':'; } @@ -136,12 +145,12 @@ to store the string. That pointer is advanced over the space used. If AREA is zero, space is allocated with `malloc'. */ -const char * +CONST char * tgetstr (cap, area) - const char *cap; + CONST char *cap; char **area; { - const char *ptr = find_capability (term_entry, cap); + CONST char *ptr = find_capability (term_entry, cap); if (!ptr || (ptr[-1] != '=' && ptr[-1] != '~')) return 0; return tgetst1 (ptr, area); @@ -162,12 +171,12 @@ into the block that *AREA points to, or to newly allocated storage if AREA is 0. */ -static const char * +static CONST char * tgetst1 (ptr, area) - const char *ptr; + CONST char *ptr; char **area; { - const char *p; + CONST char *p; char *r; int c; int size; @@ -250,7 +259,7 @@ void tputs (string, nlines, outfun) - const char *string; + CONST char *string; int nlines; void (*outfun) (int); { @@ -269,7 +278,7 @@ if (string == (char *) 0) return; - while (isdigit (* (const unsigned char *) string)) + while (isdigit (* (CONST unsigned char *) string)) { padcount += *string++ - '0'; padcount *= 10; @@ -328,21 +337,23 @@ If BP is zero, space is dynamically allocated. */ +extern char *getenv (); + int tgetent (bp, name) char *bp; - const char *name; + CONST char *name; { char *tem; int fd; struct buffer buf; char *bp1; char *bp2; - const char *term; + CONST char *term; int malloc_size = 0; int c; char *tcenv; /* TERMCAP value, if it contais :tc=. */ - const char *indirect = 0; /* Terminal type in :tc= in TERMCAP value. */ + CONST char *indirect = 0; /* Terminal type in :tc= in TERMCAP value. */ tem = getenv ("TERMCAP"); if (tem && *tem == 0) tem = 0; @@ -354,7 +365,7 @@ it is the entry itself, but only if the name the caller requested matches the TERM variable. */ - if (tem && !IS_DIRECTORY_SEP (*tem) && !strcmp (name, getenv ("TERM"))) + if (tem && !IS_DIRECTORY_SEP (*tem) && !strcmp (name, (char *) getenv ("TERM"))) { indirect = tgetst1 (find_capability (tem, "tc"), 0); if (!indirect) @@ -637,7 +648,7 @@ } tprint (cap) - const char *cap; + CONST char *cap; { char *x = tgetstr (cap, 0); char *y;