Mercurial > vim
comparison src/termlib.c @ 7835:4d7ce6c03fda v7.4.1214
commit https://github.com/vim/vim/commit/764b23c8fd3369cb05ae9122abf3ca16fec539d7
Author: Bram Moolenaar <Bram@vim.org>
Date: Sat Jan 30 21:10:09 2016 +0100
patch 7.4.1214
Problem: Using old style function declarations.
Solution: Change to new style function declarations. (script by Hirohito
Higashi)
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Sat, 30 Jan 2016 21:15:04 +0100 |
parents | 0b6c37dd858d |
children | c66e1f50c142 |
comparison
equal
deleted
inserted
replaced
7834:2d1dc9ec41ce | 7835:4d7ce6c03fda |
---|---|
64 # endif | 64 # endif |
65 # endif | 65 # endif |
66 #endif | 66 #endif |
67 | 67 |
68 int | 68 int |
69 tgetent(tbuf, term) | 69 tgetent( |
70 char *tbuf; /* Buffer to hold termcap entry, TBUFSZ bytes max */ | 70 char *tbuf, /* Buffer to hold termcap entry, TBUFSZ bytes max */ |
71 char *term; /* Name of terminal */ | 71 char *term) /* Name of terminal */ |
72 { | 72 { |
73 char tcbuf[32]; /* Temp buffer to handle */ | 73 char tcbuf[32]; /* Temp buffer to handle */ |
74 char *tcptr = tcbuf; /* extended entries */ | 74 char *tcptr = tcbuf; /* extended entries */ |
75 char *tcap = TERMCAPFILE; /* Default termcap file */ | 75 char *tcap = TERMCAPFILE; /* Default termcap file */ |
76 char *tmp; | 76 char *tmp; |
138 fclose(termcap); | 138 fclose(termcap); |
139 return retval; | 139 return retval; |
140 } | 140 } |
141 | 141 |
142 static int | 142 static int |
143 getent(tbuf, term, termcap, buflen) | 143 getent(char *tbuf, *term, FILE *termcap, int buflen) |
144 char *tbuf, *term; | |
145 FILE *termcap; | |
146 int buflen; | |
147 { | 144 { |
148 char *tptr; | 145 char *tptr; |
149 int tlen = strlen(term); | 146 int tlen = strlen(term); |
150 | 147 |
151 while (nextent(tbuf, termcap, buflen)) /* For each possible entry */ | 148 while (nextent(tbuf, termcap, buflen)) /* For each possible entry */ |
169 } | 166 } |
170 } | 167 } |
171 return 0; | 168 return 0; |
172 } | 169 } |
173 | 170 |
171 /* | |
172 * Read 1 entry from TERMCAP file. | |
173 */ | |
174 static int | 174 static int |
175 nextent(tbuf, termcap, buflen) /* Read 1 entry from TERMCAP file */ | 175 nextent(char *tbuf, FILE *termcap, int buflen) |
176 char *tbuf; | |
177 FILE *termcap; | |
178 int buflen; | |
179 { | 176 { |
180 char *lbuf = tbuf; /* lbuf=line buffer */ | 177 char *lbuf = tbuf; /* lbuf=line buffer */ |
181 /* read lines straight into buffer */ | 178 /* read lines straight into buffer */ |
182 | 179 |
183 while (lbuf < tbuf+buflen && /* There's room and */ | 180 while (lbuf < tbuf+buflen && /* There's room and */ |
216 * | 213 * |
217 * Returned values: 1 for success, 0 for failure. | 214 * Returned values: 1 for success, 0 for failure. |
218 */ | 215 */ |
219 | 216 |
220 int | 217 int |
221 tgetflag(id) | 218 tgetflag(char *id) |
222 char *id; | |
223 { | 219 { |
224 char buf[256], *ptr = buf; | 220 char buf[256], *ptr = buf; |
225 | 221 |
226 return tgetstr(id, &ptr) ? 1 : 0; | 222 return tgetstr(id, &ptr) ? 1 : 0; |
227 } | 223 } |
235 * | 231 * |
236 * Returned values: -1 for failure, else numerical value. | 232 * Returned values: -1 for failure, else numerical value. |
237 */ | 233 */ |
238 | 234 |
239 int | 235 int |
240 tgetnum(id) | 236 tgetnum(char *id) |
241 char *id; | |
242 { | 237 { |
243 char *ptr, buf[256]; | 238 char *ptr, buf[256]; |
244 ptr = buf; | 239 ptr = buf; |
245 | 240 |
246 if (tgetstr(id, &ptr)) | 241 if (tgetstr(id, &ptr)) |
275 * :. | 270 * :. |
276 * | 271 * |
277 */ | 272 */ |
278 | 273 |
279 char * | 274 char * |
280 tgetstr(id, buf) | 275 tgetstr(char *id, char **buf) |
281 char *id, **buf; | |
282 { | 276 { |
283 int len = strlen(id); | 277 int len = strlen(id); |
284 char *tmp=tent; | 278 char *tmp=tent; |
285 char *hold; | 279 char *hold; |
286 int i; | 280 int i; |
385 * %B BCD, no output. | 379 * %B BCD, no output. |
386 * %D reverse coding (x-2*(x%16)), no output. | 380 * %D reverse coding (x-2*(x%16)), no output. |
387 */ | 381 */ |
388 | 382 |
389 char * | 383 char * |
390 tgoto(cm, col, line) | 384 tgoto( |
391 char *cm; /* cm string, from termcap */ | 385 char *cm, /* cm string, from termcap */ |
392 int col, /* column, x position */ | 386 int col, /* column, x position */ |
393 line; /* line, y position */ | 387 int line) /* line, y position */ |
394 { | 388 { |
395 char gx, gy, /* x, y */ | 389 char gx, gy, /* x, y */ |
396 *ptr, /* pointer in 'cm' */ | 390 *ptr, /* pointer in 'cm' */ |
397 reverse = 0, /* reverse flag */ | 391 reverse = 0, /* reverse flag */ |
398 *bufp, /* pointer in returned string */ | 392 *bufp, /* pointer in returned string */ |
531 134, 150, 200, 300, | 525 134, 150, 200, 300, |
532 600, 1200, 1800, 2400, | 526 600, 1200, 1800, 2400, |
533 4800, 9600, 19200, 19200 }; | 527 4800, 9600, 19200, 19200 }; |
534 | 528 |
535 int | 529 int |
536 tputs(cp, affcnt, outc) | 530 tputs( |
537 char *cp; /* string to print */ | 531 char *cp, /* string to print */ |
538 int affcnt; /* Number of lines affected */ | 532 int affcnt, /* Number of lines affected */ |
539 void (*outc)(unsigned int);/* routine to output 1 character */ | 533 void (*outc)(unsigned int)) /* routine to output 1 character */ |
540 { | 534 { |
541 long frac, /* 10^(#digits after decimal point) */ | 535 long frac, /* 10^(#digits after decimal point) */ |
542 counter, /* digits */ | 536 counter, /* digits */ |
543 atol(const char *); | 537 atol(const char *); |
544 | 538 |
576 | 570 |
577 /* | 571 /* |
578 * Module: tutil.c | 572 * Module: tutil.c |
579 * | 573 * |
580 * Purpose: Utility routines for TERMLIB functions. | 574 * Purpose: Utility routines for TERMLIB functions. |
581 * | 575 * Returns length of text common to s1 and s2. |
582 */ | 576 */ |
583 static int | 577 static int |
584 _match(s1, s2) /* returns length of text common to s1 and s2 */ | 578 _match(char *s1, char *s2) |
585 char *s1, *s2; | |
586 { | 579 { |
587 int i = 0; | 580 int i = 0; |
588 | 581 |
589 while (s1[i] && s1[i] == s2[i]) | 582 while (s1[i] && s1[i] == s2[i]) |
590 i++; | 583 i++; |
594 | 587 |
595 /* | 588 /* |
596 * finds next c in s that's a member of set, returns pointer | 589 * finds next c in s that's a member of set, returns pointer |
597 */ | 590 */ |
598 static char * | 591 static char * |
599 _find(s, set) | 592 _find(char *s, char *set) |
600 char *s, *set; | |
601 { | 593 { |
602 for(; *s; s++) | 594 for(; *s; s++) |
603 { | 595 { |
604 char *ptr = set; | 596 char *ptr = set; |
605 | 597 |
615 | 607 |
616 /* | 608 /* |
617 * add val to buf according to format fmt | 609 * add val to buf according to format fmt |
618 */ | 610 */ |
619 static char * | 611 static char * |
620 _addfmt(buf, fmt, val) | 612 _addfmt(char *buf, char *fmt, int val) |
621 char *buf, *fmt; | |
622 int val; | |
623 { | 613 { |
624 sprintf(buf, fmt, val); | 614 sprintf(buf, fmt, val); |
625 while (*buf) | 615 while (*buf) |
626 buf++; | 616 buf++; |
627 return buf; | 617 return buf; |