1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305
|
--- a/blk.c
+++ b/blk.c
@@ -19,7 +19,7 @@
# define NBUFS 5 /* must be at least 3 -- more is better */
#endif
-extern long lseek();
+#include <unistd.h>
/*------------------------------------------------------------------------*/
@@ -37,7 +37,8 @@ static struct _blkbuf
*newtoo, /* another buffer which should be recycled */
*recycle = blk; /* next block to be recycled */
-
+/* This function writes a block out to the temporary file */
+void blkflush(REG struct _blkbuf *this);
@@ -58,8 +59,8 @@ void blkinit()
}
/* This function allocates a buffer and fills it with a given block's text */
-BLK *blkget(logical)
- int logical; /* logical block number to fetch */
+BLK *blkget(int logical)
+/* int logical; logical block number to fetch */
{
REG struct _blkbuf *this; /* used to step through blk[] */
REG int i;
@@ -132,8 +133,8 @@ BLK *blkget(logical)
/* This function writes a block out to the temporary file */
-void blkflush(this)
- REG struct _blkbuf *this; /* the buffer to flush */
+void blkflush(REG struct _blkbuf *this)
+/* REG struct _blkbuf *this; the buffer to flush */
{
long seekpos; /* seek position of the new block */
unsigned short physical; /* physical block number */
@@ -172,8 +173,8 @@ void blkflush(this)
/* This function sets a block's "dirty" flag or deletes empty blocks */
-void blkdirty(bp)
- BLK *bp; /* buffer returned by blkget() */
+void blkdirty(BLK *bp)
+/* BLK *bp; /* buffer returned by blkget() */
{
REG int i, j;
REG char *scan;
@@ -266,8 +267,8 @@ void blkdirty(bp)
/* insert a new block into hdr, and adjust the cache */
-BLK *blkadd(logical)
- int logical; /* where to insert the new block */
+BLK *blkadd(int logical)
+/* int logical; where to insert the new block */
{
REG int i;
@@ -320,8 +321,8 @@ static long oldlnum[MAXBLKS];
/* This function should be called before each command that changes the text.
* It defines the state that undo() will reset the file to.
*/
-void beforedo(forundo)
- int forundo; /* boolean: is this for an undo? */
+void beforedo(int forundo)
+/* int forundo; boolean: is this for an undo? */
{
REG int i;
REG long l;
--- a/vi.h
+++ b/vi.h
@@ -72,8 +72,8 @@ typedef union
/* These are used manipulate BLK buffers. */
extern BLK hdr; /* buffer for the header block */
-extern BLK *blkget(); /* given index into hdr.c[], reads block */
-extern BLK *blkadd(); /* inserts a new block into hdr.c[] */
+extern BLK *blkget(int); /* given index into hdr.c[], reads block */
+extern BLK *blkadd(int); /* inserts a new block into hdr.c[] */
/*------------------------------------------------------------------------*/
/* These are used to keep track of various flags */
@@ -218,47 +218,47 @@ extern int doingdot; /* boolean: are we
extern int doingglobal; /* boolean: are doing a ":g" command? */
extern long rptlines; /* number of lines affected by a command */
extern char *rptlabel; /* description of how lines were affected */
-extern char *fetchline(); /* read a given line from tmp file */
-extern char *parseptrn(); /* isolate a regexp in a line */
-extern MARK paste(); /* paste from cut buffer to a given point */
+extern char *fetchline(long); /* read a given line from tmp file */
+extern char *parseptrn(REG char *ptrn); /* isolate a regexp in a line */
+extern MARK paste(MARK at, int after, int retend); /* paste from cut buffer to a given point */
extern char *wildcard(); /* expand wildcards in filenames */
extern MARK input(); /* inserts characters from keyboard */
-extern char *linespec(); /* finds the end of a /regexp/ string */
+extern char *linespec(REG char *s, MARK *markptr); /* finds the end of a /regexp/ string */
#define ctrl(ch) ((ch)&037)
#ifndef NO_RECYCLE
extern long allocate(); /* allocate a free block of the tmp file */
#endif
-extern int trapint(); /* trap handler for SIGINT */
-extern void blkdirty(); /* marks a block as being "dirty" */
-extern void blkflush(); /* writes a single dirty block to the disk */
+extern void trapint(int); /* trap handler for SIGINT */
+extern void blkdirty(BLK *bp); /* marks a block as being "dirty" */
+/* extern void blkflush(REG struct _blkbuf *this); writes a single dirty block to the disk */
extern void blksync(); /* forces all "dirty" blocks to disk */
extern void blkinit(); /* resets the block cache to "empty" state */
extern void beep(); /* rings the terminal's bell */
extern void exrefresh(); /* writes text to the screen */
-extern void msg(); /* writes a printf-style message to the screen */
+extern void msg(char *fmt, ...); /* writes a printf-style message to the screen */
extern void reset_msg(); /* resets the "manymsgs" flag */
extern void endmsgs(); /* if "manymsgs" is set, then scroll up 1 line */
extern void garbage(); /* reclaims any garbage blocks */
-extern void redraw(); /* updates the screen after a change */
-extern void resume_curses();/* puts the terminal in "cbreak" mode */
-extern void beforedo(); /* saves current revision before a new change */
+extern void redraw(MARK curs, int inputting); /* updates the screen after a change */
+extern void resume_curses(int);/* puts the terminal in "cbreak" mode */
+extern void beforedo(int); /* saves current revision before a new change */
extern void afterdo(); /* marks end of a beforedo() change */
extern void abortdo(); /* like "afterdo()" followed by "undo()" */
extern int undo(); /* restores file to previous undo() */
-extern void dumpkey(); /* lists key mappings to the screen */
-extern void mapkey(); /* defines a new key mapping */
+extern void dumpkey(int); /* lists key mappings to the screen */
+extern void mapkey(char *rawin, char *cooked, short when, char *name); /* defines a new key mapping */
extern void savekeys(); /* lists key mappings to a file */
-extern void redrawrange(); /* records clues from modify.c */
-extern void cut(); /* saves text in a cut buffer */
-extern void delete(); /* deletes text */
-extern void add(); /* adds text */
-extern void change(); /* deletes text, and then adds other text */
+extern void redrawrange(long, long, long); /* records clues from modify.c */
+extern void cut(MARK from, MARK to); /* saves text in a cut buffer */
+extern void delete(MARK frommark, MARK tomark); /* deletes text */
+extern void add(MARK atmark, char *newtext); /* adds text */
+extern void change(MARK frommark, MARK tomark, char *newtext); /* deletes text, and then adds other text */
extern void cutswitch(); /* updates cut buffers when we switch files */
extern void do_abbr(); /* defines or lists abbreviations */
extern void do_digraph(); /* defines or lists digraphs */
extern void exstring(); /* execute a string as EX commands */
-extern void dumpopts();
-extern void setopts();
+extern void dumpopts(int);
+extern void setopts(char *);
extern void saveopts();
#ifndef NO_DIGRAPH
extern void savedigs();
@@ -266,11 +266,19 @@ extern void savedigs();
#ifndef NO_ABBR
extern void saveabbr();
#endif
-extern void cutname();
-extern void cutname();
+extern void cutname(int);
extern void initopts();
extern void cutend();
+extern int doexrc(char *filename);
+extern int elvis_access(char *file, int mode);
+extern int filter(MARK from, MARK to, char *cmd);
+extern int tmpabort(int bang);
+extern int tmpend(int bang);
+extern int tmpsave(char *filename, int bang);
+extern int tmpstart(char *filename);
+extern int vgets(char prompt, char *buf, int bsize);
+
/*------------------------------------------------------------------------*/
/* macros that are used as control structures */
@@ -408,7 +416,7 @@ typedef int CMD;
extern void ex();
extern void vi();
-extern void doexcmd();
+extern void doexcmd(char *cmd);
#ifndef elvis_system
extern int elvis_system(char *cmd);
#endif
@@ -416,47 +424,48 @@ extern int elvis_system(char *cmd);
#ifndef NO_ABBR
extern void cmd_abbr();
#endif
-extern void cmd_append();
-extern void cmd_args();
+extern void cmd_append(MARK frommark, MARK tomark, CMD cmd, int bang, char *extra);
+extern void cmd_args(MARK frommark, MARK tomark, CMD cmd, int bang, char *extra);
#ifndef NO_AT
-extern void cmd_at();
+extern void cmd_at(MARK frommark, MARK tomark, CMD cmd, int bang, char *extra);
#endif
-extern void cmd_cd();
-extern void cmd_delete();
+extern void cmd_cd(MARK frommark, MARK tomark, CMD cmd, int bang, char *extra);
+extern void cmd_delete(MARK frommark, MARK tomark, CMD cmd, int bang, char *extra);
#ifndef NO_DIGRAPH
extern void cmd_digraph();
#endif
-extern void cmd_edit();
+extern void cmd_edit(MARK frommark, MARK tomark, CMD cmd, int bang, char *extra);
#ifndef NO_ERRLIST
extern void cmd_errlist();
#endif
-extern void cmd_file();
-extern void cmd_global();
-extern void cmd_join();
-extern void cmd_mark();
+extern void cmd_file(MARK frommark, MARK tomark, CMD cmd, int bang, char *extra);
+extern void cmd_global(MARK frommark, MARK tomark, CMD cmd, int bang, char *extra);
+extern void cmd_join(MARK frommark, MARK tomark, CMD cmd, int bang, char *extra);
+extern void cmd_mark(MARK frommark, MARK tomark, CMD cmd, int bang, char *extra);
+
#ifndef NO_ERRLIST
extern void cmd_make();
#endif
-extern void cmd_map();
+extern void cmd_map(MARK frommark, MARK tomark, CMD cmd, int bang, char *extra);
#ifndef NO_MKEXRC
extern void cmd_mkexrc();
#endif
-extern void cmd_next();
-extern void cmd_print();
-extern void cmd_put();
-extern void cmd_read();
-extern void cmd_set();
-extern void cmd_shell();
-extern void cmd_shift();
-extern void cmd_source();
-extern void cmd_substitute();
-extern void cmd_tag();
-extern void cmd_undo();
-extern void cmd_version();
-extern void cmd_visual();
-extern void cmd_write();
-extern void cmd_xit();
-extern void cmd_move();
+extern void cmd_next(MARK frommark, MARK tomark, CMD cmd, int bang, char *extra);
+extern void cmd_print(MARK frommark, MARK tomark, CMD cmd, int bang, char *extra);
+extern void cmd_put(MARK frommark, MARK tomark, CMD cmd, int bang, char *extra);
+extern void cmd_read(MARK frommark, MARK tomark, CMD cmd, int bang, char *extra);
+extern void cmd_set(MARK frommark, MARK tomark, CMD cmd, int bang, char *extra);
+extern void cmd_shell(MARK frommark, MARK tomark, CMD cmd, int bang, char *extra);
+extern void cmd_shift(MARK frommark, MARK tomark, CMD cmd, int bang, char *extra);
+extern void cmd_source(MARK frommark, MARK tomark, CMD cmd, int bang, char *extra);
+extern void cmd_substitute(MARK frommark, MARK tomark, CMD cmd, int bang, char *extra);
+extern void cmd_tag(MARK frommark, MARK tomark, CMD cmd, int bang, char *extra);
+extern void cmd_undo(MARK frommark, MARK tomark, CMD cmd, int bang, char *extra);
+extern void cmd_version(MARK frommark, MARK tomark, CMD cmd, int bang, char *extra);
+extern void cmd_visual(MARK frommark, MARK tomark, CMD cmd, int bang, char *extra);
+extern void cmd_write(MARK frommark, MARK tomark, CMD cmd, int bang, char *extra);
+extern void cmd_xit(MARK frommark, MARK tomark, CMD cmd, int bang, char *extra);
+extern void cmd_move(MARK frommark, MARK tomark, CMD cmd, int bang, char *extra);
#ifdef DEBUG
extern void cmd_debug();
extern void cmd_validate();
--- a/recycle.c
+++ b/recycle.c
@@ -18,7 +18,7 @@
#ifndef NO_RECYCLE
/* this whole file would have be skipped if NO_RECYCLE is defined */
-extern long lseek();
+#include <unistd.h>
#define BTST(bitno, byte) ((byte) & (1 << (bitno)))
#define BSET(bitno, byte) ((byte) |= (1 << (bitno)))
--- a/tio.c
+++ b/tio.c
@@ -22,10 +22,10 @@
/* This function reads in a line from the terminal. */
-int vgets(prompt, buf, bsize)
- char prompt; /* the prompt character, or '\0' for none */
- char *buf; /* buffer into which the string is read */
- int bsize; /* size of the buffer */
+int vgets(char prompt, char *buf, int bsize)
+/* char prompt; the prompt character, or '\0' for none */
+/* char *buf; buffer into which the string is read */
+/* int bsize; size of the buffer */
{
int len; /* how much we've read so far */
int ch; /* a character from the user */
@@ -232,32 +232,30 @@ void endmsgs()
* msg("%s %d", ...) - does a printf onto the message line
*/
/*VARARGS1*/
-void msg(fmt, arg1, arg2, arg3, arg4, arg5, arg6, arg7)
- char *fmt;
- long arg1, arg2, arg3, arg4, arg5, arg6, arg7;
-{
- if (mode != MODE_VI)
- {
- sprintf(pmsg, fmt, arg1, arg2, arg3, arg4, arg5, arg6, arg7);
- qaddstr(pmsg);
- addch('\n');
- exrefresh();
- }
- else
- {
- /* wait for keypress between consecutive msgs */
- if (manymsgs)
- {
- getkey(WHEN_MSG);
- }
+void msg(char *fmt, ...) {
+ va_list args;
+ va_start(args, fmt);
+
+ if (mode != MODE_VI) {
+ /* Format the message into pmsg */
+ vsprintf(pmsg, fmt, args);
+ qaddstr(pmsg);
+ addch('\n');
+ exrefresh();
+ } else {
+ /* Wait for keypress between consecutive msgs */
+ if (manymsgs) {
+ getkey(WHEN_MSG);
+ }
+
+ /* Format the real message */
+ vsprintf(pmsg, fmt, args);
+ manymsgs = TRUE;
+ }
- /* real message */
- sprintf(pmsg, fmt, arg1, arg2, arg3, arg4, arg5, arg6, arg7);
- manymsgs = TRUE;
- }
+ va_end(args);
}
-
/* This function calls refresh() if the option exrefresh is set */
void exrefresh()
{
@@ -646,11 +644,11 @@ int getkey(when)
/* This function maps or unmaps a key */
-void mapkey(rawin, cooked, when, name)
- char *rawin; /* the input key sequence, before mapping */
- char *cooked;/* after mapping */
- short when; /* bitmap of when mapping should happen */
- char *name; /* name of the key, if any */
+void mapkey(char *rawin, char *cooked, short when, char *name)
+/* char *rawin; the input key sequence, before mapping */
+/* char *cooked; after mapping */
+/* short when; bitmap of when mapping should happen */
+/* char *name; name of the key, if any */
{
int i, j;
@@ -714,8 +712,8 @@ void mapkey(rawin, cooked, when, name)
/* Dump keys of a given type - WHEN_VICMD dumps the ":map" keys, and
* WHEN_VIINP|WHEN_VIREP dumps the ":map!" keys
*/
-void dumpkey(when)
- int when; /* WHEN_XXXX of mappings to be dumped */
+void dumpkey(int when)
+/* int when; WHEN_XXXX of mappings to be dumped */
{
int i, len, mlen;
char *scan;
--- a/redraw.c
+++ b/redraw.c
@@ -29,10 +29,10 @@ static long smartlno;
static long redrawafter; /* line# of first line that must be redrawn */
static long preredraw; /* line# of last line changed, before change */
static long postredraw; /* line# of last line changed, after change */
-void redrawrange(after, pre, post)
- long after; /* lower bound of redrawafter */
- long pre; /* upper bound of preredraw */
- long post; /* upper bound of postredraw */
+void redrawrange(long after, long pre, long post)
+/* long after; lower bound of redrawafter */
+/* long pre; upper bound of preredraw */
+/* long post; upper bound of postredraw */
{
if (after == redrawafter)
{
@@ -722,9 +722,9 @@ static void smartdrawtext(text, lno)
* of the screen, if that's all thats needed). It also takes care of
* scrolling.
*/
-void redraw(curs, inputting)
- MARK curs; /* where to leave the screen's cursor */
- int inputting; /* boolean: being called from input() ? */
+void redraw(MARK curs, int inputting)
+/* MARK curs; where to leave the screen's cursor */
+/* int inputting; boolean: being called from input() ? */
{
char *text; /* a line of text to display */
static long chgs; /* previous changes level */
--- a/cmd1.c
+++ b/cmd1.c
@@ -14,8 +14,10 @@
#include "config.h"
#include <ctype.h>
+#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <unistd.h>
#include "vi.h"
#include "regexp.h"
@@ -143,12 +145,7 @@ void cmd_validate(frommark, tomark, cmd,
/*ARGSUSED*/
-void cmd_mark(frommark, tomark, cmd, bang, extra)
- MARK frommark;
- MARK tomark;
- CMD cmd;
- int bang;
- char *extra;
+void cmd_mark(MARK frommark, MARK tomark, CMD cmd, int bang, char *extra)
{
/* validate the name of the mark */
if (!extra || *extra < 'a' || *extra > 'z' || extra[1])
@@ -163,12 +160,7 @@ void cmd_mark(frommark, tomark, cmd, ban
void cmd_write2(MARK frommark, MARK tomark, int fd);
/*ARGSUSED*/
-void cmd_write(frommark, tomark, cmd, bang, extra)
- MARK frommark;
- MARK tomark;
- CMD cmd;
- int bang;
- char *extra;
+void cmd_write(MARK frommark, MARK tomark, CMD cmd, int bang, char *extra)
{
int fd;
int append; /* boolean: write in "append" mode? */
@@ -189,7 +181,7 @@ void cmd_write(frommark, tomark, cmd, ba
}
/* either the file must not exist, or we must have a ! or be appending */
- if (access(extra, 0) == 0 && !bang && !append)
+ if (elvis_access(extra, 0) == 0 && !bang && !append)
{
msg("File already exists - Use :w! to overwrite");
return;
@@ -246,11 +238,7 @@ void cmd_write2(MARK frommark, MARK toma
/*ARGSUSED*/
-void cmd_shell(frommark, tomark, cmd, bang, extra)
- MARK frommark, tomark;
- CMD cmd;
- int bang;
- char *extra;
+void cmd_shell(MARK frommark, MARK tomark, CMD cmd, int bang, char *extra)
{
static char prevextra[80];
@@ -293,11 +281,8 @@ void cmd_shell(frommark, tomark, cmd, ba
/*ARGSUSED*/
-void cmd_global(frommark, tomark, cmd, bang, extra)
- MARK frommark, tomark;
- CMD cmd;
- int bang;
- char *extra; /* rest of the command line */
+void cmd_global(MARK frommark, MARK tomark, CMD cmd, int bang, char *extra)
+/* char *extra; rest of the command line */
{
char *cmdptr; /* the command from the command line */
char cmdln[100]; /* copy of the command from the command line */
@@ -388,11 +373,7 @@ void cmd_global(frommark, tomark, cmd, b
/*ARGSUSED*/
-void cmd_file(frommark, tomark, cmd, bang, extra)
- MARK frommark, tomark;
- CMD cmd;
- int bang;
- char *extra;
+void cmd_file(MARK frommark, MARK tomark, CMD cmd, int bang, char *extra)
{
#ifndef CRUNCH
/* if we're given a new filename, use it as this file's name */
@@ -426,11 +407,7 @@ void cmd_file(frommark, tomark, cmd, ban
/*ARGSUSED*/
-void cmd_edit(frommark, tomark, cmd, bang, extra)
- MARK frommark, tomark;
- CMD cmd;
- int bang;
- char *extra;
+void cmd_edit(MARK frommark, MARK tomark, CMD cmd, int bang, char *extra)
{
long line = 1L; /* might be set to prevline */
@@ -478,11 +455,7 @@ void cmd_edit(frommark, tomark, cmd, ban
/* This code is also used for rewind -- GB */
/*ARGSUSED*/
-void cmd_next(frommark, tomark, cmd, bang, extra)
- MARK frommark, tomark;
- CMD cmd;
- int bang;
- char *extra;
+void cmd_next(MARK frommark, MARK tomark, CMD cmd, int bang, char *extra)
{
int i, j;
char *scan;
@@ -549,11 +522,7 @@ void cmd_next(frommark, tomark, cmd, ban
/* also called from :wq -- always writes back in this case */
/*ARGSUSED*/
-void cmd_xit(frommark, tomark, cmd, bang, extra)
- MARK frommark, tomark;
- CMD cmd;
- int bang;
- char *extra;
+void cmd_xit(MARK frommark, MARK tomark, CMD cmd, int bang, char *extra)
{
static long whenwarned; /* when the user was last warned of extra files */
int oldflag;
@@ -598,11 +567,7 @@ void cmd_xit(frommark, tomark, cmd, bang
/*ARGSUSED*/
-void cmd_args(frommark, tomark, cmd, bang, extra)
- MARK frommark, tomark;
- CMD cmd;
- int bang;
- char *extra;
+void cmd_args(MARK frommark, MARK tomark, CMD cmd, int bang, char *extra)
{
char *scan;
char *eow;
@@ -676,14 +641,8 @@ void cmd_args(frommark, tomark, cmd, ban
/*ARGSUSED*/
-void cmd_cd(frommark, tomark, cmd, bang, extra)
- MARK frommark, tomark;
- CMD cmd;
- int bang;
- char *extra;
+void cmd_cd(MARK frommark, MARK tomark, CMD cmd, int bang, char *extra)
{
- char *getenv();
-
/* default directory name is $HOME */
if (!*extra)
{
@@ -704,11 +663,7 @@ void cmd_cd(frommark, tomark, cmd, bang,
/*ARGSUSED*/
-void cmd_map(frommark, tomark, cmd, bang, extra)
- MARK frommark, tomark;
- CMD cmd;
- int bang;
- char *extra;
+void cmd_map(MARK frommark, MARK tomark, CMD cmd, int bang, char *extra)
{
char *mapto;
@@ -734,11 +689,7 @@ void cmd_map(frommark, tomark, cmd, bang
/*ARGSUSED*/
-void cmd_set(frommark, tomark, cmd, bang, extra)
- MARK frommark, tomark;
- CMD cmd;
- int bang;
- char *extra;
+void cmd_set(MARK frommark, MARK tomark, CMD cmd, int bang, char *extra)
{
if (!*extra)
{
@@ -758,11 +709,7 @@ void cmd_set(frommark, tomark, cmd, bang
}
/*ARGSUSED*/
-void cmd_tag(frommark, tomark, cmd, bang, extra)
- MARK frommark, tomark;
- CMD cmd;
- int bang;
- char *extra;
+void cmd_tag(MARK frommark, MARK tomark, CMD cmd, int bang, char *extra)
{
char *scan; /* used to scan through the tmpblk.c */
char *cmp; /* char of tag name we're comparing, or NULL */
@@ -890,11 +837,7 @@ void cmd_tag(frommark, tomark, cmd, bang
/*ARGSUSED*/
-void cmd_visual(frommark, tomark, cmd, bang, extra)
- MARK frommark, tomark;
- CMD cmd;
- int bang;
- char *extra;
+void cmd_visual(MARK frommark, MARK tomark, CMD cmd, int bang, char *extra)
{
mode = MODE_VI;
msg("");
@@ -906,12 +849,7 @@ void cmd_visual(frommark, tomark, cmd, b
/* describe this version of the program */
/*ARGSUSED*/
-void cmd_version(frommark, tomark, cmd, bang, extra)
- MARK frommark;
- MARK tomark;
- CMD cmd;
- int bang;
- char *extra;
+void cmd_version(MARK frommark, MARK tomark, CMD cmd, int bang, char *extra)
{
#ifndef DATE
msg("%s", VERSION);
@@ -1051,7 +989,7 @@ static char *parse_errmsg(text)
*cpy = '\0';
/* ignore the name "Error" and filenames that contain a '/' */
- if (*text == '/' || !strcmp(errfile + 1, "rror") || access(errfile, 0) < 0)
+ if (*text == '/' || !strcmp(errfile + 1, "rror") || elvis_access(errfile, 0) < 0)
{
return (char *)0;
}
--- a/tmp.c
+++ b/tmp.c
@@ -87,8 +87,8 @@ static char tmpname[80];
/* This function creates the temp file and copies the original file into it.
* Returns if successful, or stops execution if it fails.
*/
-int tmpstart(filename)
- char *filename; /* name of the original file */
+int tmpstart(char *filename)
+/* char *filename; name of the original file */
{
int origfd; /* fd used for reading the original file */
struct stat statb; /* stat buffer, used to examine inode */
@@ -206,7 +206,7 @@ int tmpstart(filename)
#endif
/* make sure nobody else is editing the same file */
- if (access(tmpname, 0) == 0)
+ if (elvis_access(tmpname, 0) == 0)
{
if (*origname)
{
@@ -446,9 +446,9 @@ FoundEOF:
/* This function copies the temp file back onto an original file.
* Returns TRUE if successful, or FALSE if the file could NOT be saved.
*/
-int tmpsave(filename, bang)
- char *filename; /* the name to save it to */
- int bang; /* forced write? */
+int tmpsave(char *filename, int bang)
+/* char *filename; the name to save it to */
+/* int bang; forced write? */
{
int fd; /* fd of the file we're writing to */
REG int len; /* length of a text block */
@@ -496,7 +496,7 @@ int tmpsave(filename, bang)
/* either the file must not exist, or it must be the original
* file, or we must have a bang
*/
- if (strcmp(filename, origname) && access(filename, 0) == 0 && !bang)
+ if (strcmp(filename, origname) && elvis_access(filename, 0) == 0 && !bang)
{
msg("File already exists - Use :w! to overwrite");
return FALSE;
@@ -547,8 +547,7 @@ int tmpsave(filename, bang)
* If the "autowrite" option is set, then instead of returning FALSE when
* the file has been modified and "bang" is false, it will call tmpend().
*/
-int tmpabort(bang)
- int bang;
+int tmpabort(int bang)
{
/* if there is no file, return successfully */
if (tmpfd < 0)
@@ -586,8 +585,7 @@ int tmpabort(bang)
* needs to be saved but can't be. When it returns FALSE, it will not have
* deleted the tmp file, either.
*/
-int tmpend(bang)
- int bang;
+int tmpend(int bang)
{
/* save the file if it has been modified */
if (tstflag(file, MODIFIED) && !tmpsave((char *)0, FALSE) && !bang)
--- a/atari.c
+++ b/atari.c
@@ -20,8 +20,7 @@
#include <osbind.h>
/* vi uses mode==0 only ... */
-int access(file, mode)
- char *file;
+int elvis_access(char *file, int mode)
{
int fd=Fopen(file, 0);
if (fd<0)
--- a/misc.c
+++ b/misc.c
@@ -16,8 +16,8 @@
/* find a particular line & return a pointer to a copy of its text */
-char *fetchline(line)
- long line; /* line number of the line to fetch */
+char *fetchline(long line)
+/* long line; line number of the line to fetch */
{
int i;
REG char *scan; /* used to search for the line in a BLK */
@@ -84,8 +84,8 @@ char *fetchline(line)
/* error message from the regexp code */
-void regerror(txt)
- char *txt; /* an error message */
+void regerror(char *txt)
+/* char *txt; an error message */
{
msg("RE error: %s", txt);
}
--- a/system.c
+++ b/system.c
@@ -330,9 +330,9 @@ char *wildcard(names)
* is MARK_UNSET, then it runs the filter program with stdin coming from
* /dev/null, and inserts any output lines.
*/
-int filter(from, to, cmd)
- MARK from, to; /* the range of lines to filter */
- char *cmd; /* the filter command */
+int filter(MARK from, MARK to, char *cmd)
+/* MARK from, to; the range of lines to filter */
+/* char *cmd; the filter command */
{
int scratch; /* fd of the scratch file */
int fd; /* fd of the pipe from the filter */
--- a/curses.c
+++ b/curses.c
@@ -42,7 +42,6 @@
#include <stdlib.h>
#include <string.h>
-extern char *getenv();
static void starttcap();
/* variables, publicly available & used in the macros */
@@ -237,8 +236,7 @@ void suspend_curses()
curses_active = FALSE;
}
-void resume_curses(quietly)
- int quietly;
+void resume_curses(int quietly)
{
if (!curses_active)
{
@@ -559,8 +557,7 @@ int faddch(ch)
/* These functions are equivelent to the macros of the same names... */
-void qaddstr(str)
- char *str;
+void qaddstr(char *str)
{
REG char *s_, *d_;
--- a/curses.h
+++ b/curses.h
@@ -11,9 +11,10 @@
/* This is the header file for a small, fast, fake curses package */
/* termcap stuff */
-extern char *tgoto();
-extern char *tgetstr();
-extern void tputs();
+extern char *tgoto(char *cm, int destcol, int destrow);
+extern char *tgetstr(char *id, char **bp);
+extern void tputs(char *cp, int affcnt, int (*outfn)());
+
#if MSDOS
/* BIOS interface used instead of termcap for MS-DOS */
@@ -225,10 +226,10 @@ extern char o_pcbios[1]; /* BAH! */
extern void initscr();
extern void endwin();
extern void suspend_curses();
-extern void resume_curses();
+extern void resume_curses(int);
extern void attrset();
extern void insch();
-extern void qaddstr();
+extern void qaddstr(char *);
#define addstr(str) {qaddstr(str); _addCR;}
#define move(y,x) VOIDBIOS(v_move(x,y), \
tputs(tgoto(CM, x, y), 1, faddch))
--- a/ex.c
+++ b/ex.c
@@ -146,8 +146,7 @@ static struct
* it replaces the ending / or ? with a \0, and returns a pointer to the
* stuff that came after the pattern.
*/
-char *parseptrn(ptrn)
- REG char *ptrn;
+char *parseptrn(REG char *ptrn)
{
REG char *scan;
@@ -171,9 +170,9 @@ char *parseptrn(ptrn)
/* This function parses a line specifier for ex commands */
-char *linespec(s, markptr)
- REG char *s; /* start of the line specifier */
- MARK *markptr; /* where to store the mark's value */
+char *linespec(REG char *s, MARK *markptr)
+/* REG char *s; start of the line specifier */
+/* MARK *markptr; where to store the mark's value */
{
long num;
REG char *t;
@@ -321,8 +320,8 @@ void ex()
}
}
-void doexcmd(cmdbuf)
- char *cmdbuf; /* string containing an ex command */
+void doexcmd(char *cmdbuf)
+/* char *cmdbuf; string containing an ex command */
{
REG char *scan; /* used to scan thru cmdbuf */
MARK frommark; /* first linespec */
@@ -637,8 +636,8 @@ void doexcmd(cmdbuf)
/* This function executes EX commands from a file. It returns 1 normally, or
* 0 if the file could not be opened for reading.
*/
-int doexrc(filename)
- char *filename; /* name of a ".exrc" file */
+int doexrc(char *filename)
+/* char *filename; name of a ".exrc" file */
{
int fd; /* file descriptor */
int len; /* length of the ".exrc" file */
--- a/regexp.c
+++ b/regexp.c
@@ -332,8 +332,7 @@ static unsigned calcsize(text)
/* This function compiles a regexp. */
-regexp *regcomp(text)
- char *text;
+regexp *regcomp(char *text)
{
int needfirst;
unsigned size;
@@ -623,10 +622,10 @@ int match(re, str, prog, here)
/* This function searches through a string for text that matches an RE. */
-int regexec(re, str, bol)
- regexp *re; /* the compiled regexp to search for */
- char *str; /* the string to search through */
- int bol; /* boolean: does str start at the beginning of a line? */
+int regexec(regexp *re, char *str, int bol)
+/* regexp *re; the compiled regexp to search for */
+/* char *str; the string to search through */
+/* int bol; boolean: does str start at the beginning of a line? */
{
char *prog; /* the entry point of re->program */
int len; /* length of the string */
--- a/regexp.h
+++ b/regexp.h
@@ -15,7 +15,7 @@ typedef struct regexp {
char program[1]; /* Unwarranted chumminess with compiler. */
} regexp;
-extern regexp *regcomp();
-extern int regexec();
-extern void regsub();
-extern void regerror();
+extern regexp *regcomp(char *);
+extern int regexec(regexp *re, char *str, int bol);
+extern void regsub(regexp *re, REG char *src, REG char *dst);
+extern void regerror(char *txt);
--- a/regsub.c
+++ b/regsub.c
@@ -14,10 +14,7 @@
static char *previous; /* a copy of the text from the previous substitution */
/* perform substitutions after a regexp match */
-void regsub(re, src, dst)
- regexp *re;
- REG char *src;
- REG char *dst;
+void regsub(regexp *re, REG char *src, REG char *dst)
{
REG char *cpy;
REG char *end;
--- a/opts.c
+++ b/opts.c
@@ -268,8 +268,8 @@ void initopts()
}
/* This function lists the current values of all options */
-void dumpopts(all)
- int all; /* boolean: dump all options, or just set ones? */
+void dumpopts(int all)
+/* int all; boolean: dump all options, or just set ones? */
{
#ifndef NO_OPTCOLS
int i, j, k;
@@ -532,8 +532,8 @@ void saveopts(fd)
/* This function changes the values of one or more options. */
-void setopts(assignments)
- char *assignments; /* a string containing option assignments */
+void setopts(char *assignments)
+/* char *assignments; a string containing option assignments */
{
char *name; /* name of variable in assignments */
char *value; /* value of the variable */
--- a/shell.c
+++ b/shell.c
@@ -33,7 +33,7 @@ struct
char *value;
} myenv[MAXENV];
-int cmd_set(), cmd_exit();
+int cmd_set(char *), cmd_exit();
struct buildins
{
@@ -168,8 +168,7 @@ cmd_exit()
exit(0);
}
-cmd_set(line)
- char *line;
+cmd_set(char *line)
{
char *value;
int i;
--- a/cmd2.c
+++ b/cmd2.c
@@ -29,12 +29,8 @@
#include <string.h>
/*ARGSUSED*/
-void cmd_substitute(frommark, tomark, cmd, bang, extra)
- MARK frommark;
- MARK tomark;
- CMD cmd;
- int bang;
- char *extra; /* rest of the command line */
+void cmd_substitute(MARK frommark, MARK tomark, CMD cmd, int bang, char *extra)
+/* char *extra; rest of the command line */
{
char *line; /* a line from the file */
regexp *re; /* the compiled search expression */
@@ -45,9 +41,9 @@ void cmd_substitute(frommark, tomark, cm
char *conf; /* used during confirmation */
long chline; /* # of lines changed */
long chsub; /* # of substitutions made */
- static optp; /* boolean option: print when done? */
- static optg; /* boolean option: substitute globally in line? */
- static optc; /* boolean option: confirm before subst? */
+ static int optp; /* boolean option: print when done? */
+ static int optg; /* boolean option: substitute globally in line? */
+ static int optc; /* boolean option: confirm before subst? */
/* for now, assume this will fail */
@@ -253,12 +249,7 @@ void cmd_substitute(frommark, tomark, cm
/*ARGSUSED*/
-void cmd_delete(frommark, tomark, cmd, bang, extra)
- MARK frommark;
- MARK tomark;
- CMD cmd;
- int bang;
- char *extra;
+void cmd_delete(MARK frommark, MARK tomark, CMD cmd, int bang, char *extra)
{
MARK curs2; /* an altered form of the cursor */
@@ -301,12 +292,7 @@ void cmd_delete(frommark, tomark, cmd, b
/*ARGSUSED*/
-void cmd_append(frommark, tomark, cmd, bang, extra)
- MARK frommark;
- MARK tomark;
- CMD cmd;
- int bang;
- char *extra;
+void cmd_append(MARK frommark, MARK tomark, CMD cmd, int bang, char *extra)
{
long l; /* line counter */
@@ -347,12 +333,7 @@ void cmd_append(frommark, tomark, cmd, b
/*ARGSUSED*/
-void cmd_put(frommark, tomark, cmd, bang, extra)
- MARK frommark;
- MARK tomark;
- CMD cmd;
- int bang;
- char *extra;
+void cmd_put(MARK frommark, MARK tomark, CMD cmd, int bang, char *extra)
{
/* choose your cut buffer */
if (*extra == '"')
@@ -373,12 +354,7 @@ void cmd_put(frommark, tomark, cmd, bang
/*ARGSUSED*/
-void cmd_join(frommark, tomark, cmd, bang, extra)
- MARK frommark;
- MARK tomark;
- CMD cmd;
- int bang;
- char *extra;
+void cmd_join(MARK frommark, MARK tomark, CMD cmd, int bang, char *extra)
{
long l;
char *scan;
@@ -451,12 +427,7 @@ void cmd_join(frommark, tomark, cmd, ban
/*ARGSUSED*/
-void cmd_shift(frommark, tomark, cmd, bang, extra)
- MARK frommark;
- MARK tomark;
- CMD cmd;
- int bang;
- char *extra;
+void cmd_shift(MARK frommark, MARK tomark, CMD cmd, int bang, char *extra)
{
long l; /* line number counter */
int oldidx; /* number of chars previously used for indent */
@@ -546,12 +517,7 @@ void cmd_shift(frommark, tomark, cmd, ba
/*ARGSUSED*/
-void cmd_read(frommark, tomark, cmd, bang, extra)
- MARK frommark;
- MARK tomark;
- CMD cmd;
- int bang;
- char *extra;
+void cmd_read(MARK frommark, MARK tomark, CMD cmd, int bang, char *extra)
{
int fd, rc; /* used while reading from the file */
char *scan; /* used for finding NUL characters */
@@ -682,12 +648,7 @@ void cmd_read(frommark, tomark, cmd, ban
/*ARGSUSED*/
-void cmd_undo(frommark, tomark, cmd, bang, extra)
- MARK frommark;
- MARK tomark;
- CMD cmd;
- int bang;
- char *extra;
+void cmd_undo(MARK frommark, MARK tomark, CMD cmd, int bang, char *extra)
{
undo();
}
@@ -695,12 +656,7 @@ void cmd_undo(frommark, tomark, cmd, ban
/* print the selected lines */
/*ARGSUSED*/
-void cmd_print(frommark, tomark, cmd, bang, extra)
- MARK frommark;
- MARK tomark;
- CMD cmd;
- int bang;
- char *extra;
+void cmd_print(MARK frommark, MARK tomark, CMD cmd, int bang, char *extra)
{
REG char *scan;
REG long l;
@@ -769,12 +725,7 @@ void cmd_print(frommark, tomark, cmd, ba
/* move or copy selected lines */
/*ARGSUSED*/
-void cmd_move(frommark, tomark, cmd, bang, extra)
- MARK frommark;
- MARK tomark;
- CMD cmd;
- int bang;
- char *extra;
+void cmd_move(MARK frommark, MARK tomark, CMD cmd, int bang, char *extra)
{
MARK destmark;
@@ -837,12 +788,7 @@ void cmd_move(frommark, tomark, cmd, ban
/* execute EX commands from a file */
/*ARGSUSED*/
-void cmd_source(frommark, tomark, cmd, bang, extra)
- MARK frommark;
- MARK tomark;
- CMD cmd;
- int bang;
- char *extra;
+void cmd_source(MARK frommark, MARK tomark, CMD cmd, int bang, char *extra)
{
/* must have a filename */
if (!*extra)
@@ -857,12 +803,7 @@ void cmd_source(frommark, tomark, cmd, b
#ifndef NO_AT
/*ARGSUSED*/
-void cmd_at(frommark, tomark, cmd, bang, extra)
- MARK frommark;
- MARK tomark;
- CMD cmd;
- int bang;
- char *extra;
+void cmd_at(MARK frommark, MARK tomark, CMD cmd, int bang, char *extra)
{
static nest = FALSE;
int result;
--- a/modify.c
+++ b/modify.c
@@ -28,9 +28,9 @@ debout(msg, arg1, arg2, arg3, arg4, arg5
#endif /* DEBUG */
/* delete a range of text from the file */
-void delete(frommark, tomark)
- MARK frommark; /* first char to be deleted */
- MARK tomark; /* AFTER last char to be deleted */
+void delete(MARK frommark, MARK tomark)
+/* MARK frommark; first char to be deleted */
+/* MARK tomark; AFTER last char to be deleted */
{
int i; /* used to move thru logical blocks */
REG char *scan; /* used to scan thru text of the blk */
@@ -178,9 +178,9 @@ void delete(frommark, tomark)
/* add some text at a specific place in the file */
-void add(atmark, newtext)
- MARK atmark; /* where to insert the new text */
- char *newtext; /* NUL-terminated string to insert */
+void add(MARK atmark, char *newtext)
+/* MARK atmark; where to insert the new text */
+/* char *newtext; NUL-terminated string to insert */
{
REG char *scan; /* used to move through string */
REG char *build; /* used while copying chars */
@@ -414,9 +414,7 @@ void add(atmark, newtext)
/* change the text of a file */
-void change(frommark, tomark, newtext)
- MARK frommark, tomark;
- char *newtext;
+void change(MARK frommark, MARK tomark, char *newtext)
{
int i;
long l;
--- a/cut.c
+++ b/cut.c
@@ -222,8 +222,8 @@ void cutend()
/* This function is used to select the cut buffer to be used next */
-void cutname(name)
- int name; /* a single character */
+void cutname(int name)
+/* int name; a single character */
{
cbname = name;
}
@@ -232,9 +232,9 @@ void cutname(name)
/* This function copies a selected segment of text to a cut buffer */
-void cut(from, to)
- MARK from; /* start of text to cut */
- MARK to; /* end of text to cut */
+void cut(MARK from, MARK to)
+/* MARK from; start of text to cut */
+/* MARK to; end of text to cut */
{
int first; /* logical number of first block in cut */
int last; /* logical number of last block used in cut */
@@ -453,10 +453,10 @@ static void readcutblk(cb, blkno)
/* This function inserts text from a cut buffer, and returns the MARK where
* insertion ended. Return MARK_UNSET on errors.
*/
-MARK paste(at, after, retend)
- MARK at; /* where to insert the text */
- int after; /* boolean: insert after mark? (rather than before) */
- int retend; /* boolean: return end of text? (rather than start) */
+MARK paste(MARK at, int after, int retend)
+/* MARK at; where to insert the text */
+/* int after; boolean: insert after mark? (rather than before) */
+/* int retend; boolean: return end of text? (rather than start) */
{
REG struct cutbuf *cb;
REG int i;
--- a/config.h
+++ b/config.h
@@ -134,6 +134,7 @@
/* Only MSDOS, TOS, and OS9 need a special function for reading from the
* keyboard. All others just read from file descriptor 0.
*/
+#include <unistd.h>
#if !MSDOS && !TOS && !OSK
# define ttyread(buf, len) read(0, buf, (unsigned)len) /* raw read */
#endif
--- a/tinytcap.c
+++ b/tinytcap.c
@@ -68,9 +68,8 @@ int tgetflag(id)
}
/*ARGSUSED*/
-char *tgetstr(id, bp)
- char *id;
- char **bp; /* pointer to pointer to buffer - ignored */
+char *tgetstr(char *id, char **bp)
+/* char **bp; pointer to pointer to buffer - ignored */
{
switch (CAP(id))
{
@@ -123,10 +122,10 @@ char *tgetstr(id, bp)
}
/*ARGSUSED*/
-char *tgoto(cm, destcol, destrow)
- char *cm; /* cursor movement string -- ignored */
- int destcol;/* destination column, 0 - 79 */
- int destrow;/* destination row, 0 - 24 */
+char *tgoto(char *cm, int destcol, int destrow)
+/* char *cm; cursor movement string -- ignored */
+/* int destcol; destination column, 0 - 79 */
+/* int destrow; destination row, 0 - 24 */
{
static char buf[30];
@@ -140,10 +139,10 @@ char *tgoto(cm, destcol, destrow)
}
/*ARGSUSED*/
-void tputs(cp, affcnt, outfn)
- char *cp; /* the string to output */
- int affcnt; /* number of affected lines -- ignored */
- int (*outfn)(); /* the output function */
+void tputs(char *cp, int affcnt, int (*outfn)())
+/* char *cp; the string to output */
+/* int affcnt; number of affected lines -- ignored */
+/* int (*outfn)(); the output function */
{
while (*cp)
{
--- a/main.c
+++ b/main.c
@@ -18,7 +18,7 @@
#include <stdio.h>
#include "vi.h"
-extern trapint(); /* defined below */
+extern void trapint(int); /* defined below */
extern char *getenv();
sigjmp_buf jmpenv;
@@ -358,8 +358,7 @@ int main(argc, argv)
/*ARGSUSED*/
-int trapint(signo)
- int signo;
+void trapint(int signo)
{
resume_curses(FALSE);
abortdo();
@@ -373,7 +372,6 @@ int trapint(signo)
#endif
siglongjmp(jmpenv, 1);
- return 0;
}
|