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
|
Fix lots of compiler warnings that indicated some real problems
on modern 64 bit systems.
--- a/crc/makecrc.c
+++ b/crc/makecrc.c
@@ -31,13 +31,13 @@
/* ZIP used by COMPACTOR */
#include <stdio.h>
-
-extern void exit();
-extern char *strcat();
+#include <string.h>
+#include <stdlib.h>
+#include <stdio.h>
static void initcrctab();
-main()
+int main(int argc, char *argv[])
{
initcrctab("ccitt", 0x1021, 0xffff, 0, 16);
initcrctab("kermit", 0x8408, 0, 1, 16);
--- a/fileio/rdfile.c
+++ b/fileio/rdfile.c
@@ -42,18 +42,15 @@
#define RSRC_FORMAT 2
#define UNIX_FORMAT 3
-extern char *malloc();
-extern char *realloc();
-extern char *strcpy();
-extern char *strncpy();
-extern char *strcat();
-extern void exit();
-
-static void check_files();
-static void read_file();
-static void enter_dir();
-static void exit_dir();
-static int get_stdin_file();
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+static void check_files(int);
+static void read_file(void);
+static void enter_dir(void);
+static void exit_dir(void);
+static int get_stdin_file(void);
char file_info[INFOBYTES];
char *data_fork, *rsrc_fork;
@@ -987,9 +984,9 @@
no_recurse = 1;
}
-char *get_rdfileopt()
+const char *get_rdfileopt()
{
- static char options[] = "rduUc:t:";
+ static const char options[] = "rduUc:t:";
return options;
}
--- a/fileio/wrfile.c
+++ b/fileio/wrfile.c
@@ -35,16 +35,9 @@
#define MACI 9
#endif /* SCAN */
-extern char *malloc();
-extern char *realloc();
-extern char *strcpy();
-extern char *strncpy();
-extern char *strcat();
-extern void exit();
-
-#ifdef UNDEF /* Do not declare sprintf; not portable (but lint will complain) */
-char *sprintf();
-#endif /* UNDEF */
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
#ifdef AUFS
static void check_aufs();
@@ -802,12 +795,12 @@
#endif /* APPLESHARE */
}
-void set_wrfileopt(restricted)
+void set_wrfileopt(int restricted)
{
mode_restricted = restricted;
}
-void set_s_wrfileopt(restricted)
+void set_s_wrfileopt(int restricted)
{
mode_s_restricted = restricted;
}
--- a/fileio/wrfileopt.h
+++ b/fileio/wrfileopt.h
@@ -1,6 +1,6 @@
-extern int wrfileopt();
-extern void give_wrfileopt();
-extern void set_wrfileopt();
-extern void set_s_wrfileopt();
-extern char *get_wrfileopt();
+extern int wrfileopt(char);
+extern void give_wrfileopt(void);
+extern void set_wrfileopt(int);
+extern void set_s_wrfileopt(int);
+extern char *get_wrfileopt(void);
--- a/hexbin/hexbin.c
+++ b/hexbin/hexbin.c
@@ -17,8 +17,10 @@
#define LOCALOPT "ilvcn:qVH"
-extern void exit();
-extern void backtrans();
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
#ifdef DL
extern void dl();
#endif /* DL */
--- a/util/transname.c
+++ b/util/transname.c
@@ -1,7 +1,6 @@
#include <sys/types.h>
#include <sys/dir.h>
-
-char *strncpy();
+#include <string.h>
#ifdef MAXNAMLEN /* 4.2 BSD */
#define FNAMELEN MAXNAMLEN
--- a/util/util.c
+++ b/util/util.c
@@ -1,4 +1,5 @@
#include <stdio.h>
+#include <unistd.h>
#include "../fileio/fileglob.h"
#include "masks.h"
#include "util.h"
--- a/util/util.h
+++ b/util/util.h
@@ -16,8 +16,11 @@
extern int do_query();
extern void put4();
extern void put2();
-extern void do_indent();
+extern void do_indent(int);
extern real_time set_time();
extern unsigned long tomactime();
extern real_time frommactime();
+extern void transname(char *, char *, int);
+
+extern void backtrans(char *, char *);
--- a/comm/tty.c
+++ b/comm/tty.c
@@ -1,4 +1,6 @@
#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
#include <signal.h>
#ifndef TERMIOS_H
#include <sgtty.h>
@@ -10,7 +12,7 @@
#include "protocol.h"
#include "globals.h"
-void cleanup();
+void cleanup(int);
void timedout();
int tgetc();
void tputc();
@@ -101,7 +103,7 @@
}
}
-tgetrec(buf, count, timeout)
+int tgetrec(buf, count, timeout)
char *buf;
int count, timeout;
{
--- a/comm/xm_from.c
+++ b/comm/xm_from.c
@@ -4,11 +4,14 @@
#include "../fileio/machdr.h"
#include "../fileio/wrfile.h"
#include "../util/masks.h"
+#include "../util/util.h"
#include "globals.h"
#include "protocol.h"
+extern void cleanup(int);
+
extern int tgetc();
-extern int tgetrec();
+extern int tgetrec(char *, int, int);
extern void tputc();
static void receive_part();
@@ -89,7 +92,7 @@
case ESC:
break;
case CAN:
- cleanup();
+ cleanup(-1);
break;
case EOT:
case TMO:
--- a/comm/xm_to.c
+++ b/comm/xm_to.c
@@ -6,6 +6,8 @@
#include "globals.h"
#include "protocol.h"
+extern void cleanup(int);
+
extern int tgetc();
extern void tputc();
extern void tputrec();
--- a/comm/frommac.c
+++ b/comm/frommac.c
@@ -1,16 +1,21 @@
#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <string.h>
#include "comm.h"
+#include "../util/util.h"
#include "../util/patchlevel.h"
#include "../fileio/machdr.h"
#include "globals.h"
#include "../fileio/fileglob.h"
#include "../fileio/wrfile.h"
+#include "../fileio/wrfileopt.h"
#define LOCALOPT "lmxyzoTVH"
-extern void exit();
extern void setup_tty();
extern void reset_tty();
+extern void xm_from(void);
extern char info[];
--- a/comm/tomac.c
+++ b/comm/tomac.c
@@ -1,19 +1,20 @@
#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <string.h>
#include "comm.h"
#include "../fileio/machdr.h"
#include "../fileio/rdfile.h"
+#include "../fileio/rdfileopt.h"
#include "../util/patchlevel.h"
+#include "../util/util.h"
#include "globals.h"
-extern char *malloc();
-extern char *realloc();
-extern char *strcat();
-extern void exit();
-extern void transname();
extern void do_indent();
extern void dofile();
extern void setup_tty();
extern void reset_tty();
+extern void xm_to(void);
#define LOCALOPT "ilqxyzoTVH"
--- a/fileio/rdfileopt.h
+++ b/fileio/rdfileopt.h
@@ -1,5 +1,5 @@
extern int rdfileopt();
extern void give_rdfileopt();
extern void set_norecurse();
-extern char *get_rdfileopt();
+extern const char *get_rdfileopt(void);
--- a/binhex/binhex.c
+++ b/binhex/binhex.c
@@ -1,15 +1,14 @@
#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <string.h>
#include "../fileio/machdr.h"
#include "../fileio/rdfile.h"
+#include "../fileio/rdfileopt.h"
#include "../util/patchlevel.h"
+#include "../util/util.h"
-extern char *malloc();
-extern char *realloc();
-extern char *strcat();
-extern void exit();
-extern void transname();
-extern void do_indent();
-extern void dofile();
+extern void dofile(void);
#define LOCALOPT "RilqVH"
--- a/binhex/dofile.c
+++ b/binhex/dofile.c
@@ -1,3 +1,6 @@
+#include<stdio.h>
+#include<stdlib.h>
+#include<unistd.h>
#include "../fileio/machdr.h"
#include "../fileio/rdfile.h"
@@ -15,13 +18,13 @@
static int rep_char;
static int rep_count;
-void doheader();
-void dofork();
-void outbyte();
-void finish();
-void outbyte1();
-void out6bit();
-void outchar();
+void doheader(void);
+void dofork(char *, int);
+void outbyte(int);
+void finish(void);
+void outbyte1(int);
+void out6bit(char);
+void outchar(char);
void dofile()
{
--- a/hexbin/globals.h
+++ b/hexbin/globals.h
@@ -13,7 +13,7 @@
extern char info[];
extern char trname[];
-typedef struct macheader {
+struct macheader {
char m_name[128];
char m_type[4];
char m_author[4];
--- a/hexbin/hqx.c
+++ b/hexbin/hqx.c
@@ -1,3 +1,5 @@
+#include<stdlib.h>
+#include<unistd.h>
#include "hexbin.h"
#ifdef HQX
#include "globals.h"
@@ -9,14 +11,12 @@
#include "../util/util.h"
#include "printhdr.h"
-extern void exit();
-
-static void get_header();
-static void oflush();
-static int getq();
-static long get2q();
-static long get4q();
-static getqbuf();
+static void get_header(void);
+static void oflush(void);
+static int getq(void);
+static long get2q(void);
+static long get4q(void);
+static int getqbuf(char *, int);
static char *g_macname;
@@ -380,7 +380,7 @@
}
/* getqbuf(); q format -- read n characters from input into buf */
-static getqbuf(buf, n)
+static int getqbuf(buf, n)
char *buf;
int n;
{
--- a/hexbin/printhdr.c
+++ b/hexbin/printhdr.c
@@ -34,6 +34,7 @@
/* print out header information in human-readable format */
void print_header2(skip)
+int skip;
{
if(listmode) {
if(skip) {
--- a/hexbin/readline.h
+++ b/hexbin/readline.h
@@ -1,2 +1,4 @@
extern char line[];
+extern int readline(void);
+
--- a/macunpack/bin.c
+++ b/macunpack/bin.c
@@ -1,3 +1,4 @@
+#include <string.h>
#include "macunpack.h"
#ifdef BIN
#include "globals.h"
--- a/macunpack/cpt.c
+++ b/macunpack/cpt.c
@@ -1,3 +1,4 @@
+#include <stdlib.h>
#include "macunpack.h"
#ifdef DD
#ifndef CPT
@@ -21,10 +22,6 @@
#define ESC1SEEN 1
#define ESC2SEEN 2
-extern char *malloc();
-extern char *realloc();
-extern int free();
-
static void cpt_uncompact();
static unsigned char *cpt_data;
static unsigned long cpt_datamax;
--- a/macunpack/cpt.h
+++ b/macunpack/cpt.h
@@ -31,7 +31,7 @@
typedef long OSType;
-typedef struct cptHdr { /* 8 bytes */
+struct cptHdr { /* 8 bytes */
unsigned char signature; /* = 1 -- for verification */
unsigned char volume; /* for multi-file archives */
unsigned short xmagic; /* verification multi-file consistency*/
@@ -42,7 +42,7 @@
unsigned char commentsize; /* number of bytes comment that follow*/
};
-typedef struct fileHdr { /* 78 bytes */
+struct fileHdr { /* 78 bytes */
unsigned char fName[32]; /* a STR32 */
unsigned char folder; /* set to 1 if a folder */
unsigned short foldersize; /* number of entries in folder */
--- a/macunpack/dd.c
+++ b/macunpack/dd.c
@@ -1,3 +1,5 @@
+#include <stdlib.h>
+#include <string.h>
#include "macunpack.h"
#ifdef DD
#include "globals.h"
@@ -9,10 +11,6 @@
#include "../util/masks.h"
#include "../util/util.h"
-extern char *malloc();
-extern char *realloc();
-extern char *strcpy();
-extern char *strncpy();
extern void cpt_wrfile1();
extern void core_compress();
extern void de_compress();
@@ -45,7 +43,7 @@
#endif /* UNTESTED */
static void dd_cpt_compat();
-typedef struct methodinfo {
+struct methodinfo {
char *name;
int number;
};
--- a/macunpack/dd.h
+++ b/macunpack/dd.h
@@ -52,7 +52,7 @@
typedef long OSType;
-typedef struct fileHdr { /* 124 bytes */
+struct fileHdr { /* 124 bytes */
unsigned char magic[4]; /* "DDAR" */
unsigned char fill1[4]; /* ??? */
unsigned char fName[64]; /* a STR63 */
@@ -73,7 +73,7 @@
unsigned short hdrcrc; /* true crc */
};
-typedef struct fileCHdr { /* 84 bytes */
+struct fileCHdr { /* 84 bytes */
unsigned char magic[4]; /* "\253\315\000\124" */
unsigned long dataLength; /* lengths */
unsigned long dataCLength;
@@ -121,5 +121,5 @@
#define cpt_compat 8
#define method9 9
-#define ESC 0x144 /* Repeat packing escape */
+#define ESC (char)0x144 /* Repeat packing escape */
--- a/macunpack/dia.c
+++ b/macunpack/dia.c
@@ -1,3 +1,5 @@
+#include <stdlib.h>
+#include <string.h>
#include "macunpack.h"
#ifdef DIA
#include "globals.h"
@@ -9,9 +11,6 @@
#include "../fileio/kind.h"
#include "../util/util.h"
-extern char *malloc();
-extern char *realloc();
-
static unsigned char *dia_archive;
static int dia_archive_size;
static int dia_max_archive_size;
--- a/macunpack/dir.c
+++ b/macunpack/dir.c
@@ -1,12 +1,10 @@
+#include <stdlib.h>
#include "globals.h"
#include "../fileio/machdr.h"
#include "../fileio/wrfile.h"
#include "../util/util.h"
#include "../util/masks.h"
-extern char *malloc();
-extern char *realloc();
-
static char *dir_stack;
static int dir_ptr = -64;
static int dir_max;
--- a/macunpack/huffman.h
+++ b/macunpack/huffman.h
@@ -12,3 +12,4 @@
extern struct node nodelist[];
extern int bytesread;
+extern int gethuffbyte(node *);
--- a/macunpack/jdw.h
+++ b/macunpack/jdw.h
@@ -8,7 +8,7 @@
#define J_MTIME 34
#define J_FLENGTH 38
-typedef struct fileHdr {
+struct fileHdr {
char magic[6];
unsigned long type;
unsigned long auth;
--- a/macunpack/lzc.c
+++ b/macunpack/lzc.c
@@ -1,3 +1,4 @@
+#include <string.h>
#include "macunpack.h"
#ifdef LZC
#include "globals.h"
--- a/macunpack/lzc.h
+++ b/macunpack/lzc.h
@@ -12,7 +12,7 @@
#define C_AUTHOFF 36
#define C_FLAGOFF 40
-typedef struct fileHdr {
+struct fileHdr {
unsigned long magic1;
unsigned long dataLength;
unsigned long dataCLength;
--- a/macunpack/lzh.c
+++ b/macunpack/lzh.c
@@ -1,3 +1,5 @@
+#include <stdlib.h>
+#include <string.h>
#include "macunpack.h"
#ifdef LZH
#include "globals.h"
@@ -17,13 +19,11 @@
#define LZSMASK 4095
#define LZBUFFSIZE 8192 /* Max of above buffsizes */
-extern char *malloc();
-extern char *realloc();
extern void de_lzah();
extern unsigned char (*lzah_getbyte)();
extern void de_lzh();
-typedef struct methodinfo {
+struct methodinfo {
char *name;
int number;
};
--- a/macunpack/lzh.h
+++ b/macunpack/lzh.h
@@ -30,7 +30,7 @@
#define L_EEXTENDSZ 0
#define L_EEXTEND 1
-typedef struct fileHdr { /* 58 bytes */
+struct fileHdr { /* 58 bytes */
unsigned char hsize;
unsigned char hcrc;
char method[5];
--- a/macunpack/macbinary.c
+++ b/macunpack/macbinary.c
@@ -1,3 +1,5 @@
+#include <stdlib.h>
+#include <string.h>
#include "macunpack.h"
#include "globals.h"
#include "../fileio/machdr.h"
--- a/macunpack/macunpack.c
+++ b/macunpack/macunpack.c
@@ -1,3 +1,6 @@
+#include <stdlib.h>
+#include <unistd.h>
+#include <string.h>
#include "macunpack.h"
#include "globals.h"
#include "../util/patchlevel.h"
@@ -8,7 +11,6 @@
#define LOCALOPT "ilvqVH"
-extern char *strcat();
#ifdef STF
extern void stf();
#endif /* STF */
--- a/macunpack/pit.c
+++ b/macunpack/pit.c
@@ -1,3 +1,4 @@
+#include <string.h>
#include "macunpack.h"
#ifdef PIT
#include "../fileio/wrfile.h"
@@ -14,6 +15,7 @@
extern void read_tree();
extern void de_huffman();
extern void set_huffman();
+extern int getihuffbyte(void);
static int pit_filehdr();
static void pit_wrfile();
--- a/macunpack/sit.c
+++ b/macunpack/sit.c
@@ -1,3 +1,4 @@
+#include <string.h>
#include "macunpack.h"
#ifdef SIT
#include "globals.h"
@@ -19,7 +20,7 @@
extern void de_lzah();
extern unsigned char (*lzah_getbyte)();
-typedef struct methodinfo {
+struct methodinfo {
char *name;
int number;
};
--- a/macunpack/sit.h
+++ b/macunpack/sit.h
@@ -24,7 +24,7 @@
typedef long OSType;
-typedef struct sitHdr { /* 22 bytes */
+struct sitHdr { /* 22 bytes */
OSType signature; /* = 'SIT!' -- for verification */
unsigned short numFiles; /* number of files in archive */
unsigned long arcLength; /* length of entire archive incl.
@@ -34,7 +34,7 @@
char reserved[7];
};
-typedef struct fileHdr { /* 112 bytes */
+struct fileHdr { /* 112 bytes */
unsigned char compRMethod; /* rsrc fork compression method */
unsigned char compDMethod; /* data fork compression method */
unsigned char fName[64]; /* a STR63 */
--- a/macunpack/stf.c
+++ b/macunpack/stf.c
@@ -1,3 +1,4 @@
+#include <string.h>
#include "macunpack.h"
#ifdef STF
#include "stf.h"
--- a/macunpack/stf.h
+++ b/macunpack/stf.h
@@ -5,7 +5,7 @@
#define S_RSRCLNGTH 3 /* + NAMELENGTH */
#define S_DATALNGTH 7 /* + NAMELENGTH */
-typedef struct fileHdr {
+struct fileHdr {
char magic[3];
char flength;
char fname[32]; /* actually flength */
--- a/macunpack/zma.c
+++ b/macunpack/zma.c
@@ -1,3 +1,6 @@
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
#include "macunpack.h"
#ifdef ZMA
#include "globals.h"
@@ -9,8 +12,6 @@
#include "../util/masks.h"
#include "../util/util.h"
-extern char *malloc();
-extern char *realloc();
extern void de_lzh();
/* We do allow for possible backpointing, so we allocate the archive in core */
--- a/macunpack/zma.h
+++ b/macunpack/zma.h
@@ -20,7 +20,7 @@
#define Z_RCRC 44 /* Resource crc */
#define Z_FNAME 46 /* File name length and name */
-typedef struct fileHdr { /* 78 bytes */
+struct fileHdr { /* 78 bytes */
char deleted; /* Not in original, split off from: */
char what; /* What kind? Negative if deleted */
unsigned char hlen ; /* Header length */
--- a/mixed/dir.c
+++ b/mixed/dir.c
@@ -1,12 +1,11 @@
+#include <stdlib.h>
+#include <unistd.h>
#include "globals.h"
#include "../fileio/machdr.h"
#include "../fileio/wrfile.h"
#include "../util/util.h"
#include "../util/masks.h"
-extern char *malloc();
-extern char *realloc();
-
static char *dir_stack;
static int dir_ptr = -64;
static int dir_max;
--- a/mixed/macsave.c
+++ b/mixed/macsave.c
@@ -1,3 +1,4 @@
+#include <unistd.h>
#include "globals.h"
#include "../util/patchlevel.h"
#include "../fileio/wrfile.h"
--- a/mixed/macstream.c
+++ b/mixed/macstream.c
@@ -1,15 +1,12 @@
#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <string.h>
#include "../fileio/machdr.h"
#include "../fileio/rdfile.h"
#include "../fileio/rdfileopt.h"
#include "../util/patchlevel.h"
-
-extern char *malloc();
-extern char *realloc();
-extern char *strcat();
-extern void exit();
-extern void transname();
-extern void do_indent();
+#include "../util/util.h"
#define LOCALOPT "ilqVH"
|