diff options
Diffstat (limited to 'src/termcap.c')
| -rw-r--r-- | src/termcap.c | 29 |
1 files changed, 16 insertions, 13 deletions
diff --git a/src/termcap.c b/src/termcap.c index 9e64d027640..5b71ad229d7 100644 --- a/src/termcap.c +++ b/src/termcap.c | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | /* Work-alike for termcap, plus extra features. | 1 | /* Work-alike for termcap, plus extra features. |
| 2 | Copyright (C) 1985, 1986, 1993, 1994, 1995, 2000, 2001, 2002, 2003, | 2 | Copyright (C) 1985, 1986, 1993, 1994, 1995, 2000, 2001, 2002, 2003, |
| 3 | 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. | 3 | 2004, 2005, 2006, 2007, 2008, 2011 Free Software Foundation, Inc. |
| 4 | 4 | ||
| 5 | This program is free software; you can redistribute it and/or modify | 5 | This program is free software; you can redistribute it and/or modify |
| 6 | it under the terms of the GNU General Public License as published by | 6 | it under the terms of the GNU General Public License as published by |
| @@ -25,6 +25,10 @@ Boston, MA 02110-1301, USA. */ | |||
| 25 | #include <unistd.h> | 25 | #include <unistd.h> |
| 26 | 26 | ||
| 27 | #include "lisp.h" | 27 | #include "lisp.h" |
| 28 | #include "tparam.h" | ||
| 29 | #ifdef MSDOS | ||
| 30 | #include "msdos.h" | ||
| 31 | #endif | ||
| 28 | 32 | ||
| 29 | #ifndef NULL | 33 | #ifndef NULL |
| 30 | #define NULL (char *) 0 | 34 | #define NULL (char *) 0 |
| @@ -65,7 +69,7 @@ static char *tgetst1 (char *ptr, char **area); | |||
| 65 | 0 if not found. */ | 69 | 0 if not found. */ |
| 66 | 70 | ||
| 67 | static char * | 71 | static char * |
| 68 | find_capability (register char *bp, register char *cap) | 72 | find_capability (register char *bp, register const char *cap) |
| 69 | { | 73 | { |
| 70 | for (; *bp; bp++) | 74 | for (; *bp; bp++) |
| 71 | if (bp[0] == ':' | 75 | if (bp[0] == ':' |
| @@ -76,7 +80,7 @@ find_capability (register char *bp, register char *cap) | |||
| 76 | } | 80 | } |
| 77 | 81 | ||
| 78 | int | 82 | int |
| 79 | tgetnum (char *cap) | 83 | tgetnum (const char *cap) |
| 80 | { | 84 | { |
| 81 | register char *ptr = find_capability (term_entry, cap); | 85 | register char *ptr = find_capability (term_entry, cap); |
| 82 | if (!ptr || ptr[-1] != '#') | 86 | if (!ptr || ptr[-1] != '#') |
| @@ -85,7 +89,7 @@ tgetnum (char *cap) | |||
| 85 | } | 89 | } |
| 86 | 90 | ||
| 87 | int | 91 | int |
| 88 | tgetflag (char *cap) | 92 | tgetflag (const char *cap) |
| 89 | { | 93 | { |
| 90 | register char *ptr = find_capability (term_entry, cap); | 94 | register char *ptr = find_capability (term_entry, cap); |
| 91 | return ptr && ptr[-1] == ':'; | 95 | return ptr && ptr[-1] == ':'; |
| @@ -97,7 +101,7 @@ tgetflag (char *cap) | |||
| 97 | If AREA is null, space is allocated with `malloc'. */ | 101 | If AREA is null, space is allocated with `malloc'. */ |
| 98 | 102 | ||
| 99 | char * | 103 | char * |
| 100 | tgetstr (char *cap, char **area) | 104 | tgetstr (const char *cap, char **area) |
| 101 | { | 105 | { |
| 102 | register char *ptr = find_capability (term_entry, cap); | 106 | register char *ptr = find_capability (term_entry, cap); |
| 103 | if (!ptr || (ptr[-1] != '=' && ptr[-1] != '~')) | 107 | if (!ptr || (ptr[-1] != '=' && ptr[-1] != '~')) |
| @@ -263,12 +267,11 @@ tgetst1 (char *ptr, char **area) | |||
| 263 | char PC; | 267 | char PC; |
| 264 | 268 | ||
| 265 | void | 269 | void |
| 266 | tputs (register char *str, int nlines, register int (*outfun) (/* ??? */)) | 270 | tputs (register const char *str, int nlines, int (*outfun) (int)) |
| 267 | { | 271 | { |
| 268 | register int padcount = 0; | 272 | register int padcount = 0; |
| 269 | register int speed; | 273 | register int speed; |
| 270 | 274 | ||
| 271 | extern EMACS_INT baud_rate; | ||
| 272 | speed = baud_rate; | 275 | speed = baud_rate; |
| 273 | /* For quite high speeds, convert to the smaller | 276 | /* For quite high speeds, convert to the smaller |
| 274 | units to avoid overflow. */ | 277 | units to avoid overflow. */ |
| @@ -356,7 +359,7 @@ valid_filename_p (fn) | |||
| 356 | in it, and some other value otherwise. */ | 359 | in it, and some other value otherwise. */ |
| 357 | 360 | ||
| 358 | int | 361 | int |
| 359 | tgetent (char *bp, char *name) | 362 | tgetent (char *bp, const char *name) |
| 360 | { | 363 | { |
| 361 | register char *termcap_name; | 364 | register char *termcap_name; |
| 362 | register int fd; | 365 | register int fd; |
| @@ -443,7 +446,7 @@ tgetent (char *bp, char *name) | |||
| 443 | buf.size = BUFSIZE; | 446 | buf.size = BUFSIZE; |
| 444 | /* Add 1 to size to ensure room for terminating null. */ | 447 | /* Add 1 to size to ensure room for terminating null. */ |
| 445 | buf.beg = (char *) xmalloc (buf.size + 1); | 448 | buf.beg = (char *) xmalloc (buf.size + 1); |
| 446 | term = indirect ? indirect : name; | 449 | term = indirect ? indirect : (char *)name; |
| 447 | 450 | ||
| 448 | if (!bp) | 451 | if (!bp) |
| 449 | { | 452 | { |
| @@ -465,15 +468,15 @@ tgetent (char *bp, char *name) | |||
| 465 | if (scan_file (term, fd, &buf) == 0) | 468 | if (scan_file (term, fd, &buf) == 0) |
| 466 | { | 469 | { |
| 467 | close (fd); | 470 | close (fd); |
| 468 | free (buf.beg); | 471 | xfree (buf.beg); |
| 469 | if (malloc_size) | 472 | if (malloc_size) |
| 470 | free (bp); | 473 | xfree (bp); |
| 471 | return 0; | 474 | return 0; |
| 472 | } | 475 | } |
| 473 | 476 | ||
| 474 | /* Free old `term' if appropriate. */ | 477 | /* Free old `term' if appropriate. */ |
| 475 | if (term != name) | 478 | if (term != name) |
| 476 | free (term); | 479 | xfree (term); |
| 477 | 480 | ||
| 478 | /* If BP is malloc'd by us, make sure it is big enough. */ | 481 | /* If BP is malloc'd by us, make sure it is big enough. */ |
| 479 | if (malloc_size) | 482 | if (malloc_size) |
| @@ -503,7 +506,7 @@ tgetent (char *bp, char *name) | |||
| 503 | } | 506 | } |
| 504 | 507 | ||
| 505 | close (fd); | 508 | close (fd); |
| 506 | free (buf.beg); | 509 | xfree (buf.beg); |
| 507 | 510 | ||
| 508 | if (malloc_size) | 511 | if (malloc_size) |
| 509 | bp = (char *) xrealloc (bp, bp1 - bp + 1); | 512 | bp = (char *) xrealloc (bp, bp1 - bp + 1); |