diff options
Diffstat (limited to 'src/tparam.c')
| -rw-r--r-- | src/tparam.c | 73 |
1 files changed, 5 insertions, 68 deletions
diff --git a/src/tparam.c b/src/tparam.c index dcf79a3b617..d8a8f0260f0 100644 --- a/src/tparam.c +++ b/src/tparam.c | |||
| @@ -18,66 +18,14 @@ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | |||
| 18 | Boston, MA 02110-1301, USA. */ | 18 | Boston, MA 02110-1301, USA. */ |
| 19 | 19 | ||
| 20 | /* Emacs config.h may rename various library functions such as malloc. */ | 20 | /* Emacs config.h may rename various library functions such as malloc. */ |
| 21 | #ifdef HAVE_CONFIG_H | ||
| 22 | #include <config.h> | 21 | #include <config.h> |
| 23 | #endif | ||
| 24 | |||
| 25 | #ifdef emacs | ||
| 26 | #include <setjmp.h> | 22 | #include <setjmp.h> |
| 27 | #include "lisp.h" /* for xmalloc */ | 23 | #include "lisp.h" /* for xmalloc */ |
| 28 | #else | ||
| 29 | |||
| 30 | #ifdef STDC_HEADERS | ||
| 31 | #include <stdlib.h> | ||
| 32 | #include <string.h> | ||
| 33 | #else | ||
| 34 | char *malloc (); | ||
| 35 | char *realloc (); | ||
| 36 | #endif | ||
| 37 | |||
| 38 | /* Do this after the include, in case string.h prototypes bcopy. */ | ||
| 39 | #if (defined(HAVE_STRING_H) || defined(STDC_HEADERS)) && !defined(bcopy) | ||
| 40 | #define bcopy(s, d, n) memcpy ((d), (s), (n)) | ||
| 41 | #endif | ||
| 42 | |||
| 43 | #endif /* not emacs */ | ||
| 44 | 24 | ||
| 45 | #ifndef NULL | 25 | #ifndef NULL |
| 46 | #define NULL (char *) 0 | 26 | #define NULL (char *) 0 |
| 47 | #endif | 27 | #endif |
| 48 | 28 | ||
| 49 | #ifndef emacs | ||
| 50 | static void | ||
| 51 | memory_out () | ||
| 52 | { | ||
| 53 | write (2, "virtual memory exhausted\n", 25); | ||
| 54 | exit (1); | ||
| 55 | } | ||
| 56 | |||
| 57 | static char * | ||
| 58 | xmalloc (size) | ||
| 59 | unsigned size; | ||
| 60 | { | ||
| 61 | register char *tem = malloc (size); | ||
| 62 | |||
| 63 | if (!tem) | ||
| 64 | memory_out (); | ||
| 65 | return tem; | ||
| 66 | } | ||
| 67 | |||
| 68 | static char * | ||
| 69 | xrealloc (ptr, size) | ||
| 70 | char *ptr; | ||
| 71 | unsigned size; | ||
| 72 | { | ||
| 73 | register char *tem = realloc (ptr, size); | ||
| 74 | |||
| 75 | if (!tem) | ||
| 76 | memory_out (); | ||
| 77 | return tem; | ||
| 78 | } | ||
| 79 | #endif /* not emacs */ | ||
| 80 | |||
| 81 | /* Assuming STRING is the value of a termcap string entry | 29 | /* Assuming STRING is the value of a termcap string entry |
| 82 | containing `%' constructs to expand parameters, | 30 | containing `%' constructs to expand parameters, |
| 83 | merge in parameter values and store result in block OUTSTRING points to. | 31 | merge in parameter values and store result in block OUTSTRING points to. |
| @@ -90,15 +38,11 @@ xrealloc (ptr, size) | |||
| 90 | 38 | ||
| 91 | The fourth and following args to tparam serve as the parameter values. */ | 39 | The fourth and following args to tparam serve as the parameter values. */ |
| 92 | 40 | ||
| 93 | static char *tparam1 (); | 41 | static char *tparam1 (char *string, char *outstring, int len, char *up, char *left, register int *argp); |
| 94 | 42 | ||
| 95 | /* VARARGS 2 */ | 43 | /* VARARGS 2 */ |
| 96 | char * | 44 | char * |
| 97 | tparam (string, outstring, len, arg0, arg1, arg2, arg3) | 45 | tparam (char *string, char *outstring, int len, int arg0, int arg1, int arg2, int arg3) |
| 98 | char *string; | ||
| 99 | char *outstring; | ||
| 100 | int len; | ||
| 101 | int arg0, arg1, arg2, arg3; | ||
| 102 | { | 46 | { |
| 103 | int arg[4]; | 47 | int arg[4]; |
| 104 | 48 | ||
| @@ -115,9 +59,7 @@ char *UP; | |||
| 115 | static char tgoto_buf[50]; | 59 | static char tgoto_buf[50]; |
| 116 | 60 | ||
| 117 | char * | 61 | char * |
| 118 | tgoto (cm, hpos, vpos) | 62 | tgoto (char *cm, int hpos, int vpos) |
| 119 | char *cm; | ||
| 120 | int hpos, vpos; | ||
| 121 | { | 63 | { |
| 122 | int args[2]; | 64 | int args[2]; |
| 123 | if (!cm) | 65 | if (!cm) |
| @@ -128,12 +70,7 @@ tgoto (cm, hpos, vpos) | |||
| 128 | } | 70 | } |
| 129 | 71 | ||
| 130 | static char * | 72 | static char * |
| 131 | tparam1 (string, outstring, len, up, left, argp) | 73 | tparam1 (char *string, char *outstring, int len, char *up, char *left, register int *argp) |
| 132 | char *string; | ||
| 133 | char *outstring; | ||
| 134 | int len; | ||
| 135 | char *up, *left; | ||
| 136 | register int *argp; | ||
| 137 | { | 74 | { |
| 138 | register int c; | 75 | register int c; |
| 139 | register char *p = string; | 76 | register char *p = string; |
| @@ -162,7 +99,7 @@ tparam1 (string, outstring, len, up, left, argp) | |||
| 162 | { | 99 | { |
| 163 | outlen = len + 40; | 100 | outlen = len + 40; |
| 164 | new = (char *) xmalloc (outlen); | 101 | new = (char *) xmalloc (outlen); |
| 165 | bcopy (outstring, new, offset); | 102 | memcpy (new, outstring, offset); |
| 166 | } | 103 | } |
| 167 | else | 104 | else |
| 168 | { | 105 | { |