Mercurial > hg > xemacs-beta
diff src/termcap.c @ 398:74fd4e045ea6 r21-2-29
Import from CVS: tag r21-2-29
author | cvs |
---|---|
date | Mon, 13 Aug 2007 11:13:30 +0200 |
parents | 41ff10fd062f |
children | 697ef44129c6 |
line wrap: on
line diff
--- a/src/termcap.c Mon Aug 13 11:12:06 2007 +0200 +++ b/src/termcap.c Mon Aug 13 11:13:30 2007 +0200 @@ -26,18 +26,9 @@ #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> @@ -103,16 +94,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] == ':' @@ -124,9 +115,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); @@ -134,9 +125,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] == ':'; } @@ -145,12 +136,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); @@ -171,12 +162,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; @@ -259,7 +250,7 @@ void tputs (string, nlines, outfun) - CONST char *string; + const char *string; int nlines; void (*outfun) (int); { @@ -278,7 +269,7 @@ if (string == (char *) 0) return; - while (isdigit (* (CONST unsigned char *) string)) + while (isdigit (* (const unsigned char *) string)) { padcount += *string++ - '0'; padcount *= 10; @@ -337,23 +328,21 @@ 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; @@ -365,7 +354,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, (char *) getenv ("TERM"))) + if (tem && !IS_DIRECTORY_SEP (*tem) && !strcmp (name, getenv ("TERM"))) { indirect = tgetst1 (find_capability (tem, "tc"), 0); if (!indirect) @@ -648,7 +637,7 @@ } tprint (cap) - CONST char *cap; + const char *cap; { char *x = tgetstr (cap, 0); char *y;