From: Lionel Sambuc Date: Tue, 11 Dec 2012 17:42:21 +0000 (+0100) Subject: Fix warnings trivial warnings. X-Git-Tag: v3.2.1~104 X-Git-Url: http://zhaoyanbai.com/repos/cppcheck.log?a=commitdiff_plain;h=0ac803292ebf8b409d2c55654fc671cc998f47ce;p=minix.git Fix warnings trivial warnings. Fix warnings about: . Unused variables . format mismatch in printf/scanf format string and arguments . Missing parenthesis around assignment as truth values . Clang warnings anout unknown GCC pragma --- diff --git a/commands/ash/bltin/expr.c b/commands/ash/bltin/expr.c index 88d8c05cc..3c5ca51e8 100644 --- a/commands/ash/bltin/expr.c +++ b/commands/ash/bltin/expr.c @@ -70,7 +70,7 @@ static int lookup_op(); -exprcmd(argc, argv) char **argv; { +int exprcmd(argc, argv) int argc; char **argv; { char **ap; char *opname; char c; @@ -178,7 +178,7 @@ overflow: error("Expression too complex"); if (valsp->type == INTEGER) { p = stalloc(32); #ifdef SHELL - fmtstr(p, 32, "%d", valsp->u.num); + fmtstr(p, 32, "%ld", valsp->u.num); #else sprintf(p, "%d", valsp->u.num); #endif diff --git a/commands/ash/jobs.c b/commands/ash/jobs.c index 2f5e7f48d..8333f8b90 100644 --- a/commands/ash/jobs.c +++ b/commands/ash/jobs.c @@ -103,7 +103,9 @@ STATIC pid_t initialpgrp; /* pgrp of shell on invocation */ int in_waitcmd = 0; /* are we in waitcmd()? */ int in_dowait = 0; /* are we in dowait()? */ volatile sig_atomic_t breakwaitcmd = 0; /* should wait be terminated? */ +#if JOBS static int ttyfd = -1; +#endif #ifndef WCOREDUMP #define WCOREDUMP(s) ((s) & 0x80) @@ -328,7 +330,9 @@ showjob(struct job *jp, pid_t pid, int sformat, int lformat) { char s[64]; struct procstat *ps; +#if JOBS struct job *j; +#endif int col, curr, i, jobno, prev, procno; char c; diff --git a/commands/ash/miscbltin.c b/commands/ash/miscbltin.c index d55567828..2b289160e 100644 --- a/commands/ash/miscbltin.c +++ b/commands/ash/miscbltin.c @@ -90,11 +90,13 @@ readcmd(int argc __unused, char **argv __unused) int i; struct timeval tv; char *tvptr; +#ifndef __minix #ifndef __minix_vmd fd_set ifds; #endif struct termios told, tnew; int tsaved; +#endif rflag = 0; prompt = NULL; diff --git a/commands/ash/output.c b/commands/ash/output.c index a1e8f2d2f..5af44ae84 100644 --- a/commands/ash/output.c +++ b/commands/ash/output.c @@ -31,7 +31,9 @@ */ #ifndef lint +#if 0 static char sccsid[] = "@(#)output.c 8.1 (Berkeley) 5/31/93"; +#endif #endif /* not lint */ /* diff --git a/commands/backup/backup.c b/commands/backup/backup.c index 0e1c2f14d..f953c56ba 100644 --- a/commands/backup/backup.c +++ b/commands/backup/backup.c @@ -394,8 +394,8 @@ char *dir1, *cbuf2; } /* Both files are now open. Do the copying. */ - if (!rflag && strncmp((sp->namep + n - 2), ".Z", (size_t)2) || - rflag && !strncmp((sp->namep + n - 2), ".Z", (size_t)2)) { + if ((!rflag && strncmp((sp->namep + n - 2), ".Z", (size_t)2)) || + (rflag && !strncmp((sp->namep + n - 2), ".Z", (size_t)2))) { if (zflag && (rflag || (n <= (NAME_SIZE - 2)))) { close(fd1); close(fd2); diff --git a/commands/cmp/cmp.c b/commands/cmp/cmp.c index 88efac689..3492f2e42 100644 --- a/commands/cmp/cmp.c +++ b/commands/cmp/cmp.c @@ -100,12 +100,12 @@ int fd1, fd2; if (c1 != c2) { if (!loud) { if (!silent) { - printf("%s %s differ: char %ld, line %ld\n", + printf("%s %s differ: char %d, line %d\n", name1, name2, pos + i1, line); } return(1); } - printf("%10ld %3o %3o\n", pos + i1, c1 & 0xFF, c2 & 0xFF); + printf("%10d %3o %3o\n", pos + i1, c1 & 0xFF, c2 & 0xFF); differ = 1; } if (c1 == '\n') line++; diff --git a/commands/compress/compress.c b/commands/compress/compress.c index 8f271be74..6ae404b8d 100644 --- a/commands/compress/compress.c +++ b/commands/compress/compress.c @@ -1405,11 +1405,12 @@ char *ifname, *ofname; if (unlink(ifname)) perror(ifname); */ - if(!quiet) + if(!quiet) { if(do_decomp == 0) fprintf(stderr, " -- compressed to %s", ofname); else fprintf(stderr, " -- decompressed to %s", ofname); + } return; /* Successful return */ } diff --git a/commands/fdisk/fdisk.c b/commands/fdisk/fdisk.c index c703a800c..c8fcaaeaa 100644 --- a/commands/fdisk/fdisk.c +++ b/commands/fdisk/fdisk.c @@ -84,18 +84,18 @@ int override= 0; int main(int argc, char *argv []); void getgeom(void); -int getboot(char *buffer); -int putboot(char *buffer); +void getboot(char *buffer); +void putboot(char *buffer); void load_from_file(void); void save_to_file(void); -int dpl_partitions(int rawflag); +void dpl_partitions(int rawflag); int chk_table(void); -int sec_to_hst(long logsec, unsigned char *hd, unsigned char *sec, +void sec_to_hst(long logsec, unsigned char *hd, unsigned char *sec, unsigned char *cyl); -int mark_partition(struct part_entry *pe); +void mark_partition(struct part_entry *pe); void change_partition(struct part_entry *entry); -int get_a_char(void); -int print_menu(void); +char get_a_char(void); +void print_menu(void); void adj_base(struct part_entry *pe); void adj_size(struct part_entry *pe); struct part_entry *ask_partition(void); @@ -140,9 +140,7 @@ char bootstrap[] = { 0000,0000, }; -main(argc, argv) -int argc; -char *argv[]; +int main(int argc, char *argv[]) { int argn; char *argp; @@ -227,7 +225,7 @@ char *argv[]; #ifdef UNIX -void getgeom() +void getgeom(void) { struct partition geom; int fd, r; @@ -249,8 +247,7 @@ void getgeom() static int devfd; -getboot(buffer) -char *buffer; +void getboot(char *buffer) { devfd = open(devname, 2); if (devfd < 0) { @@ -275,8 +272,7 @@ char *buffer; } } -putboot(buffer) -char *buffer; +void putboot(char *buffer) { if (lseek(devfd, 0L, 0) < 0) { printf("Seek error during write\n"); @@ -292,7 +288,7 @@ char *buffer; #endif -void load_from_file() +void load_from_file(void) { /* Load buffer from file */ @@ -315,7 +311,7 @@ void load_from_file() } -void save_to_file() +void save_to_file(void) { /* Save to file */ @@ -343,8 +339,7 @@ void save_to_file() } -dpl_partitions(rawflag) -int rawflag; +void dpl_partitions(int rawflag) { /* Display partition table */ @@ -418,9 +413,9 @@ int rawflag; devnum = 1; for (i1 = 1, pe1 = (struct part_entry *) &secbuf[PART_TABLE_OFF]; i1 <= NR_PARTITIONS; ++i1, ++pe1) - if (pe1->lowsec == 0 && pe->lowsec == 0 && pe1 < pe || - pe1->lowsec != 0 && - (pe->lowsec == 0 || pe->lowsec > pe1->lowsec)) + if ((pe1->lowsec == 0 && pe->lowsec == 0 && pe1 < pe) || + (pe1->lowsec != 0 && + (pe->lowsec == 0 || pe->lowsec > pe1->lowsec))) ++devnum; /* pe1 contents < pe contents */ if (devnum != i) { orderfootnote = '#'; @@ -448,7 +443,7 @@ int rawflag; } -int chk_table() +int chk_table(void) { /* Check partition table */ @@ -492,10 +487,10 @@ int chk_table() if (pe->size == 0) continue; seenpart = 1; for (i1 = i + 1, pe1 = pe + 1; i1 <= NR_PARTITIONS; ++i1, ++pe1) { - if (pe->lowsec >= pe1->lowsec && - pe->lowsec < pe1->lowsec + pe1->size || - pe->lowsec + pe->size - 1 >= pe1->lowsec && - pe->lowsec + pe->size - 1 < pe1->lowsec + pe1->size) + if ((pe->lowsec >= pe1->lowsec && + pe->lowsec < pe1->lowsec + pe1->size) || + (pe->lowsec + pe->size - 1 >= pe1->lowsec && + pe->lowsec + pe->size - 1 < pe1->lowsec + pe1->size)) { printf("Overlap between partitions %d and %d\n", i, i1); @@ -536,9 +531,8 @@ int chk_table() return(status); } -sec_to_hst(logsec, hd, sec, cyl) -long logsec; -unsigned char *hd, *sec, *cyl; +void sec_to_hst(long logsec, unsigned char *hd, unsigned char *sec, + unsigned char *cyl) { /* Convert a logical sector number to head / sector / cylinder */ @@ -550,8 +544,7 @@ unsigned char *hd, *sec, *cyl; *hd = (logsec % (nhead * nsec)) / nsec; } -mark_partition(pe) -struct part_entry *pe; +void mark_partition(struct part_entry *pe) { /* Mark a partition as being of type MINIX. */ @@ -561,8 +554,7 @@ struct part_entry *pe; } } -void change_partition(entry) -struct part_entry *entry; +void change_partition(struct part_entry *entry) { /* Get partition info : first & last cylinder */ @@ -656,18 +648,17 @@ struct part_entry *entry; } } -get_a_char() +char get_a_char(void) { /* Read 1 character and discard rest of line */ char buf[80]; - int ch; if (!mygets(buf, (int) sizeof buf)) return(0); return(*buf); } -print_menu() +void print_menu(void) { printf("Type a command letter, then a carriage return:\n"); printf(" + - explain any footnotes (+, -, #)\n"); @@ -698,8 +689,7 @@ union REGS regs; struct SREGS sregs; int drivenum; -getboot(buffer) -char *buffer; +void getboot(char *buffer) { /* Read boot sector */ @@ -731,8 +721,7 @@ char *buffer; } -putboot(buffer) -char *buffer; +void putboot(char *buffer) { /* Write boot sector */ @@ -753,8 +742,7 @@ char *buffer; #endif -void adj_base(pe) -struct part_entry *pe; +void adj_base(struct part_entry *pe) { /* Adjust base sector of partition, usually to make it even. */ @@ -767,10 +755,10 @@ struct part_entry *pe; return; if (pe->lowsec + adj < 1) printf( - "\t\tThat would make the base %d and too small\n", pe->lowsec + adj); + "\t\tThat would make the base %lu and too small\n", pe->lowsec + adj); else if (pe->size - adj < 1) printf( - "\t\tThat would make the size %d and too small\n", pe->size - adj); + "\t\tThat would make the size %lu and too small\n", pe->size - adj); else break; } @@ -781,8 +769,7 @@ struct part_entry *pe; pe->lowsec, pe->size); } -void adj_size(pe) -struct part_entry *pe; +void adj_size(struct part_entry *pe) { /* Adjust size of partition by reducing high sector. */ @@ -793,7 +780,7 @@ struct part_entry *pe; if (!get_an_int("\tEnter adjustment to size (an integer): ", &adj)) return; if (pe->size + adj >= 1) break; - printf("\t\tThat would make the size %d and too small \n", + printf("\t\tThat would make the size %lu and too small \n", pe->size + adj); } pe->size += adj; @@ -819,7 +806,7 @@ struct part_entry *ask_partition() return((struct part_entry *) &secbuf[PART_TABLE_OFF] + (num - 1)); } -void footnotes() +void footnotes(void) { /* Explain the footnotes. */ @@ -861,9 +848,7 @@ void footnotes() } } -int get_an_int(prompt, intptr) -char *prompt; -int *intptr; +int get_an_int(char *prompt, int *intptr) { /* Read an int from the start of line of stdin, discard rest of line. */ @@ -877,7 +862,7 @@ int *intptr; } } -void list_part_types() +void list_part_types(void) { /* Print all known partition types. */ @@ -898,8 +883,7 @@ void list_part_types() if (column != 0) putchar('\n'); } -void mark_npartition(pe) -struct part_entry *pe; +void mark_npartition(struct part_entry *pe) { /* Mark a partition with arbitrary type. */ @@ -923,9 +907,7 @@ struct part_entry *pe; printf("Partition type changed to 0x%02x (%s)\n", type, systype(type)); } -int mygets(buf, length) -char *buf; -int length; /* as for fgets(), but must be >= 2 */ +int mygets(char *buf, int length) { /* Get a non-empty line of maximum length 'length'. */ @@ -942,8 +924,7 @@ int length; /* as for fgets(), but must be >= 2 */ } } -char *systype(type) -int type; +char *systype(int type) { /* Convert system indicator into system name. */ /* asw 01.03.95: added types based on info in kjb's part.c and output @@ -989,8 +970,7 @@ int type; } } -void toggle_active(pe) -struct part_entry *pe; +void toggle_active(struct part_entry *pe) { /* Toggle active flag of a partition. */ @@ -999,7 +979,7 @@ struct part_entry *pe; printf("Partition changed to %sactive\n", pe->bootind ? "" : "in"); } -void usage() +void usage(void) { /* Print usage message and exit. */ diff --git a/commands/fetch/fetch.c b/commands/fetch/fetch.c index e3c559fa2..03028da71 100644 --- a/commands/fetch/fetch.c +++ b/commands/fetch/fetch.c @@ -223,7 +223,9 @@ static void stat_display(struct xferstat *xs, int force) { struct timeval now; +#if !defined(__minix) int ctty_pgrp; +#endif /* !defined(__minix) */ /* Minix returns "Not a typewriter error" */ #if defined(TIOCGPGRP) && !defined(__minix) diff --git a/commands/format/format.c b/commands/format/format.c index 3c9ccaa5b..8cb8a4c93 100644 --- a/commands/format/format.c +++ b/commands/format/format.c @@ -122,7 +122,7 @@ void format_track(int ffd, unsigned type, unsigned cyl, unsigned head) track_pos= (off_t) (cyl * NR_HEADS + head) * nr_sectors * SECTOR_SIZE; if (lseek(ffd, track_pos, SEEK_SET) == -1) { fprintf(stderr, - "format: seeking to cyl %u, head %u (pos %ld) failed: %s\n", + "format: seeking to cyl %u, head %u (pos %d) failed: %s\n", cyl, head, track_pos, strerror(errno)); exit(1); } @@ -154,7 +154,7 @@ void verify_track(int vfd, unsigned type, unsigned cyl, unsigned head) track_pos= (off_t) (cyl * NR_HEADS + head) * nr_sectors * SECTOR_SIZE; if (lseek(vfd, track_pos, SEEK_SET) == -1) { fprintf(stderr, - "format: seeking to cyl %u, head %u (pos %ld) failed: %s\n", + "format: seeking to cyl %u, head %u (pos %d) failed: %s\n", cyl, head, track_pos, strerror(errno)); exit(1); } @@ -167,7 +167,7 @@ void verify_track(int vfd, unsigned type, unsigned cyl, unsigned head) for (sector= 0; sector < nr_sectors; sector++) { if (lseek(vfd, track_pos, SEEK_SET) == -1) { fprintf(stderr, - "format: seeking to cyl %u, head %u, sector %u (pos %ld) failed: %s\n", + "format: seeking to cyl %u, head %u, sector %u (pos %d) failed: %s\n", cyl, head, sector, track_pos, strerror(errno)); exit(1); } @@ -175,7 +175,7 @@ void verify_track(int vfd, unsigned type, unsigned cyl, unsigned head) switch (read(vfd, buf, SECTOR_SIZE)) { case -1: fprintf(stderr, - "format: bad sector at cyl %u, head %u, sector %u (pos %ld)\n", + "format: bad sector at cyl %u, head %u, sector %u (pos %d)\n", cyl, head, sector, track_pos); bad_count++; break; @@ -183,7 +183,7 @@ void verify_track(int vfd, unsigned type, unsigned cyl, unsigned head) /* Fine. */ break; default: - fprintf(stderr, "format: short read at pos %ld\n", + fprintf(stderr, "format: short read at pos %d\n", track_pos); bad_count++; } diff --git a/commands/fortune/fortune.c b/commands/fortune/fortune.c index d8d631b60..30aad409f 100644 --- a/commands/fortune/fortune.c +++ b/commands/fortune/fortune.c @@ -9,7 +9,9 @@ #define COOKIEJAR "/usr/lib/fortune.dat" +#if 0 static char *Copyright = "\0Copyright (c) 1990 Bert Reuling"; +#endif static unsigned long seed; int main(int argc, char **argv); diff --git a/commands/fsck.mfs/fsck.c b/commands/fsck.mfs/fsck.c index 8b1abd099..ed7698d3d 100644 --- a/commands/fsck.mfs/fsck.c +++ b/commands/fsck.mfs/fsck.c @@ -227,7 +227,7 @@ void chkdev(char *f, char **clist, char **ilist, char **zlist); /* Initialize the variables used by this program. */ void initvars() { - register level; + register int level; nregular = ndirectory = nblkspec = ncharspec = nbadinode = nsock = npipe = nsyml = 0; @@ -338,7 +338,7 @@ unsigned nelem, elsize; void printname(s) char *s; { - register n = MFS_NAME_MAX; + register int n = MFS_NAME_MAX; int c; do { @@ -510,7 +510,7 @@ char **getlist(argv, type) char ***argv, *type; { register char **list = *argv; - register empty = 1; + register int empty = 1; while (getnumber(**argv) != NO_BIT) { (*argv)++; @@ -534,7 +534,7 @@ void lsuper() /* Most of the following atol's enrage lint, for good reason. */ printf("ninodes = %u", sb.s_ninodes); if (input(buf, 80)) sb.s_ninodes = atol(buf); - printf("nzones = %ld", sb.s_zones); + printf("nzones = %d", sb.s_zones); if (input(buf, 80)) sb.s_zones = atol(buf); printf("imap_blocks = %u", sb.s_imap_blocks); if (input(buf, 80)) sb.s_imap_blocks = atol(buf); @@ -544,9 +544,9 @@ void lsuper() if (input(buf, 80)) sb.s_firstdatazone_old = atol(buf); printf("log_zone_size = %u", sb.s_log_zone_size); if (input(buf, 80)) sb.s_log_zone_size = atol(buf); - printf("maxsize = %ld", sb.s_max_size); + printf("maxsize = %d", sb.s_max_size); if (input(buf, 80)) sb.s_max_size = atol(buf); - printf("block size = %ld", sb.s_block_size); + printf("block size = %d", sb.s_block_size); if (input(buf, 80)) sb.s_block_size = atol(buf); if (yes("ok now")) { devwrite(0, OFFSET_SUPER_BLOCK, (char *) &sb, sizeof(sb)); @@ -594,7 +594,7 @@ void rw_super(int put) fatal("first data zone too small"); if (sb.s_log_zone_size < 0) fatal("zone size < block size"); if (sb.s_max_size <= 0) { - printf("warning: invalid max file size %ld\n", sb.s_max_size); + printf("warning: invalid max file size %d\n", sb.s_max_size); sb.s_max_size = LONG_MAX; } } @@ -602,7 +602,7 @@ void rw_super(int put) /* Check the super block for reasonable contents. */ void chksuper() { - register n; + register int n; register off_t maxsize; n = bitmapsize((bit_t) sb.s_ninodes + 1, block_size); @@ -646,8 +646,8 @@ void chksuper() if(maxsize <= 0) maxsize = LONG_MAX; if (sb.s_max_size != maxsize) { - printf("warning: expected max size to be %ld ", maxsize); - printf("instead of %ld\n", sb.s_max_size); + printf("warning: expected max size to be %d ", maxsize); + printf("instead of %d\n", sb.s_max_size); } if(sb.s_flags & MFSFLAG_MANDATORY_MASK) { @@ -715,7 +715,7 @@ bitchunk_t *bitmap; block_nr bno; int nblk; { - register i; + register int i; register bitchunk_t *p; p = bitmap; @@ -730,7 +730,7 @@ bitchunk_t *bitmap; block_nr bno; int nblk; { - register i; + register int i; register bitchunk_t *p = bitmap; for (i = 0; i < nblk; i++, bno++, p += WORDS_PER_BLOCK) @@ -749,9 +749,9 @@ char **list; while ((bit = getnumber(*list++)) != NO_BIT) if (bit < lwb || bit >= upb) { if (bitmap == spec_imap) - printf("inode number %ld ", bit); + printf("inode number %d ", bit); else - printf("zone number %ld ", bit); + printf("zone number %d ", bit); printf("out of range (ignored)\n"); } else setbit(bitmap, bit - lwb + 1); @@ -798,11 +798,13 @@ bit_nr phys; if ((w1 ^ w2) & 1 && ++(*n) % MAXPRINT == 0 && *report && (!repair || automatic || yes("stop this listing"))) *report = 0; - else if (*report) + else { + if (*report) if ((w1 & 1) && !(w2 & 1)) - printf("%s %ld is missing\n", type, bit); + printf("%s %d is missing\n", type, bit); else if (!(w1 & 1) && (w2 & 1)) - printf("%s %ld is not free\n", type, bit); + printf("%s %d is not free\n", type, bit); + } } /* Check if the given (correct) bitmap is identical with the one that is @@ -960,7 +962,7 @@ void list(ino_t ino, d_inode *ip) case I_BLOCK_SPECIAL: printf(" %2x,%2x ", major(ip->i_zone[0]), minor(ip->i_zone[0])); break; - default: printf("%7ld ", ip->i_size); + default: printf("%7d ", ip->i_size); } printpath(0, 1); } @@ -1038,7 +1040,7 @@ int chkdots(ino_t ino, off_t pos, dir_struct *dp, ino_t exp) } } else if (pos != (dp->mfs_d_name[1] ? DIR_ENTRY_SIZE : 0)) { make_printable_name(printable_name, dp->mfs_d_name, sizeof(dp->mfs_d_name)); - printf("warning: %s has offset %ld in ", printable_name, pos); + printf("warning: %s has offset %d in ", printable_name, pos); printpath(1, 0); printf("%s is linked to %u)\n", printable_name, dp->d_inum); setbit(spec_imap, (bit_nr) ino); @@ -1051,7 +1053,7 @@ int chkdots(ino_t ino, off_t pos, dir_struct *dp, ino_t exp) /* Check the name in a directory entry. */ int chkname(ino_t ino, dir_struct *dp) { - register n = MFS_NAME_MAX + 1; + register int n = MFS_NAME_MAX + 1; register char *p = dp->mfs_d_name; if (*p == '\0') { @@ -1129,7 +1131,7 @@ int chkdirzone(ino_t ino, d_inode *ip, off_t pos, zone_nr zno) { dir_struct dirblk[CDIRECT]; register dir_struct *dp; - register n, dirty; + register int n, dirty; long block= ztob(zno); register long offset = 0; register off_t size = 0; @@ -1198,14 +1200,14 @@ off_t pos; { printf("%s zone in ", mess); printpath(1, 0); - printf("zno = %ld, type = ", zno); + printf("zno = %d, type = ", zno); switch (level) { case 0: printf("DATA"); break; case 1: printf("SINGLE INDIRECT"); break; case 2: printf("DOUBLE INDIRECT"); break; default: printf("VERY INDIRECT"); } - printf(", pos = %ld)\n", pos); + printf(", pos = %d)\n", pos); } /* Found the given zone in the given inode. Check it, and if ok, mark it @@ -1240,7 +1242,7 @@ off_t pos; int chkindzone(ino_t ino, d_inode *ip, off_t *pos, zone_nr zno, int level) { zone_nr indirect[CINDIR]; - register n = NR_INDIRECTS / CINDIR; + register int n = NR_INDIRECTS / CINDIR; long block= ztob(zno); register long offset = 0; @@ -1288,7 +1290,7 @@ int zonechk(ino_t ino, d_inode *ip, off_t *pos, zone_nr zno, int level) int chkzones(ino_t ino, d_inode *ip, off_t *pos, zone_nr *zlist, int len, int level) { - register ok = 1, i; + register int ok = 1, i; /* The check on the position in the next loop is commented out, since FS * now requires valid zone numbers in each level that is necessary and FS @@ -1308,7 +1310,7 @@ int chkzones(ino_t ino, d_inode *ip, off_t *pos, zone_nr *zlist, /* Check a file or a directory. */ int chkfile(ino_t ino, d_inode *ip) { - register ok, i, level; + register int ok, i, level; off_t pos = 0; ok = chkzones(ino, ip, &pos, &ip->i_zone[0], NR_DZONE_NUM, 0); @@ -1320,7 +1322,7 @@ int chkfile(ino_t ino, d_inode *ip) /* Check a directory by checking the contents. Check if . and .. are present. */ int chkdirectory(ino_t ino, d_inode *ip) { - register ok; + register int ok; setbit(dirmap, (bit_nr) ino); ok = chkfile(ino, ip); @@ -1349,7 +1351,7 @@ int chklink(ino_t ino, d_inode *ip) if (ip->i_size == 0) printf("empty symbolic link "); else - printf("symbolic link too large (size %ld) ", ip->i_size); + printf("symbolic link too large (size %d) ", ip->i_size); printpath(2, 1); ok = 0; } @@ -1365,7 +1367,7 @@ int chkspecial(ino_t ino, d_inode *ip) ok = 1; if ((dev_t) ip->i_zone[0] == NO_DEV) { - printf("illegal device number %ld for special file ", ip->i_zone[0]); + printf("illegal device number %d for special file ", ip->i_zone[0]); printpath(2, 1); ok = 0; } @@ -1375,7 +1377,7 @@ int chkspecial(ino_t ino, d_inode *ip) */ for (i = 1; i < NR_ZONE_NUMS; i++) if (ip->i_zone[i] != NO_ZONE) { - printf("nonzero zone number %ld for special file ", + printf("nonzero zone number %d for special file ", ip->i_zone[i]); printpath(2, 1); ok = 0; @@ -1452,7 +1454,7 @@ dir_struct *dp; { d_inode inode; register ino_t ino = dp->d_inum; - register visited; + register int visited; struct stack stk; stk.st_dir = dp; @@ -1500,7 +1502,7 @@ void chktree() void printtotal() { if(preen) { - printf("%d files, %d directories, %d free inodes, %d free zones\n", + printf("%d files, %d directories, %d free inodes, %ld free zones\n", nregular, ndirectory, nfreeinode, nfreezone); return; } @@ -1616,7 +1618,7 @@ char **argv; register char **clist = 0, **ilist = 0, **zlist = 0; int badflag = 0; - register devgiven = 0; + register int devgiven = 0; register char *arg; if ((1 << BITSHIFT) != 8 * sizeof(bitchunk_t)) { diff --git a/commands/ftp101/file.c b/commands/ftp101/file.c index 9fda36423..3c53e9331 100644 --- a/commands/ftp101/file.c +++ b/commands/ftp101/file.c @@ -261,13 +261,14 @@ int DOstat() { char *file; - if(cmdargc < 2) + if(cmdargc < 2) { if(!linkopen) { printf("You must \"OPEN\" a connection first.\n"); return(0); - } else + } else { return(DOcommand("STAT", "")); - + } + } if(DOcmdcheck()) return(0); @@ -434,7 +435,7 @@ char restart[16]; } else filesize = lseek(fd, 0, SEEK_END); - sprintf(restart, "%lu", filesize); + sprintf(restart, "%u", filesize); s = DOcommand("REST", restart); @@ -509,7 +510,7 @@ unsigned short crc(char *fname); if((s / 100) != 2) return(-1); - sscanf(reply, "%*d %*s%u%lu", &ccrc, &csize); + sscanf(reply, "%*hu %*s%u%lu", &ccrc, &csize); if(ss < 0) return(-1); lcrc = crc(file); if(size != csize || size != st.st_size || ccrc != lcrc) @@ -521,7 +522,7 @@ unsigned short crc(char *fname); } else if((ss < 0) && (ft == 'b' || ft == 'c' || ft == 'p')) { s = mknod(file, fmode, maj << 8 | min); - printf("mknod %c %u %u\n", file, maj, min); + printf("mknod %s %lu %lu\n", file, maj, min); } else return(0); } @@ -530,11 +531,11 @@ unsigned short crc(char *fname); return(-1); if(st.st_uid != uid || st.st_gid != gid) { s = chown(file, uid, gid); - printf("chown %u:%u %s\n", uid, gid, file); + printf("chown %lu:%lu %s\n", uid, gid, file); } if(st.st_mode != fmode) { s = chmod(file, fmode); - printf("chmod %04o %s\n", fmode, file); + printf("chmod %04lo %s\n", fmode, file); } if(st.st_mtime != mtime) { ut.actime = mtime; @@ -727,7 +728,7 @@ char restart[16]; return(0); } - sprintf(restart, "%lu", rmtsize); + sprintf(restart, "%u", rmtsize); s = DOcommand("REST", restart); diff --git a/commands/ftp101/local.c b/commands/ftp101/local.c index c948e1df0..3a15fa2b9 100644 --- a/commands/ftp101/local.c +++ b/commands/ftp101/local.c @@ -34,7 +34,6 @@ int DOlpwd() int DOlcd() { char *path; -int s; path = cmdargv[1]; @@ -55,7 +54,6 @@ int s; int DOlmkdir() { char *path; -int s; path = cmdargv[1]; @@ -76,7 +74,6 @@ int s; int DOlrmdir() { char *path; -int s; path = cmdargv[1]; diff --git a/commands/ftp101/xfer.c b/commands/ftp101/xfer.c index 7edfd1dad..e7128142d 100644 --- a/commands/ftp101/xfer.c +++ b/commands/ftp101/xfer.c @@ -39,7 +39,7 @@ static int asciisend(fd, fdout) int fd; int fdout; { -int s, len; +int s; char c; char *p; char *op, *ope; @@ -164,7 +164,7 @@ static int asciirecv(fd, fdin) int fd; int fdin; { -int s, len; +int s; int gotcr; char c; char *p; @@ -235,7 +235,7 @@ unsigned short cnt; return(0); } -static binaryrecv(fd, fdin) +static int binaryrecv(fd, fdin) int fd; int fdin; { diff --git a/commands/host/host.c b/commands/host/host.c index 0a5fa787e..7a732364b 100644 --- a/commands/host/host.c +++ b/commands/host/host.c @@ -125,6 +125,7 @@ static int tcpip_writeall( int fd, char *buf, unsigned siz ); int main(c, v) + int c; char **v; { char *domain; @@ -135,8 +136,8 @@ main(c, v) #endif register struct hostent *hp; register char *s, *p; - register inverse = 0; - register waitmode = 0; + register int inverse = 0; + register int waitmode = 0; u8_t *oldcname; int ncnames; int isaddr; @@ -496,7 +497,6 @@ getinfo(name, domain, type) u8_t *eom, *bp, *cp; querybuf_t buf, answer; int n, n1, i, j, nmx, ancount, nscount, arcount, qdcount, buflen; - u_short pref, class; char host[2*MAXDNAME+2]; if (domain == NULL) @@ -532,8 +532,7 @@ printinfo(answer, eom, filter, isls) { HEADER *hp; u8_t *bp, *cp; - int n, n1, i, j, nmx, ancount, nscount, arcount, qdcount, buflen; - u_short pref, class; + int nmx, ancount, nscount, arcount, qdcount, buflen; /* * find first satisfactory answer @@ -702,8 +701,9 @@ pr_rr(cp, msg, file, filter) if (verbose) fprintf(file,"%s\t%d%s\t%s", name, ttl, pr_class(class), pr_type(type)); - else + else { fprintf(file,"%s%s %s",name, pr_class(class), pr_type(type)); + } if (verbose) punc = '\t'; else @@ -760,12 +760,12 @@ pr_rr(cp, msg, file, filter) break; case T_HINFO: - if (n = *cp++) { + if ((n = *cp++)) { if (doprint) fprintf(file,"%c%.*s", punc, n, cp); cp += n; } - if (n = *cp++) { + if ((n = *cp++)) { if (doprint) fprintf(file,"%c%.*s", punc, n, cp); cp += n; @@ -780,28 +780,29 @@ pr_rr(cp, msg, file, filter) if (doprint) fprintf(file," %s", name); if (doprint) - fprintf(file,"(\n\t\t\t%ld\t;serial (version)", _getlong(cp)); + fprintf(file,"(\n\t\t\t%d\t;serial (version)", _getlong(cp)); cp += sizeof(u_long); if (doprint) - fprintf(file,"\n\t\t\t%ld\t;refresh period", _getlong(cp)); + fprintf(file,"\n\t\t\t%d\t;refresh period", _getlong(cp)); cp += sizeof(u_long); if (doprint) - fprintf(file,"\n\t\t\t%ld\t;retry refresh this often", _getlong(cp)); + fprintf(file,"\n\t\t\t%d\t;retry refresh this often", _getlong(cp)); cp += sizeof(u_long); if (doprint) - fprintf(file,"\n\t\t\t%ld\t;expiration period", _getlong(cp)); + fprintf(file,"\n\t\t\t%d\t;expiration period", _getlong(cp)); cp += sizeof(u_long); if (doprint) - fprintf(file,"\n\t\t\t%ld\t;minimum TTL\n\t\t\t)", _getlong(cp)); + fprintf(file,"\n\t\t\t%d\t;minimum TTL\n\t\t\t)", _getlong(cp)); cp += sizeof(u_long); break; case T_MX: - if (doprint) + if (doprint) { if (verbose) fprintf(file,"\t%d ",_getshort(cp)); else fprintf(file," (pri=%d) by ",_getshort(cp)); + } cp += sizeof(u_short); cp = pr_cdname(cp, msg, name, sizeof(name)); if (doprint) @@ -819,7 +820,7 @@ pr_rr(cp, msg, file, filter) /* Roy start */ case T_TXT: - if (n = *cp++) { + if ((n = *cp++)) { if (doprint) fprintf(file,"%c%.*s", punc, n, cp); cp += n; diff --git a/commands/lpd/lpd.c b/commands/lpd/lpd.c index 750d79776..81d72f717 100644 --- a/commands/lpd/lpd.c +++ b/commands/lpd/lpd.c @@ -34,8 +34,6 @@ char tmpX[] = "tmpXXXXXX"; void spoolerr(char *file) { - int e= errno; - unlink(jobX); unlink(tmpX); fatal(file); @@ -172,7 +170,7 @@ int flush(void) count = 0; } -int put(int c) +void put(int c) /* Send characters to the output buffer to be printed and do so if the buffer * is full. Track the position of the write-head in `column' and `line'. */ diff --git a/commands/ls/ls.c b/commands/ls/ls.c index 67965aa59..dd404eb87 100644 --- a/commands/ls/ls.c +++ b/commands/ls/ls.c @@ -1002,7 +1002,7 @@ void listfiles(struct file *flist, enum depth depth, enum state state) sort(&flist); if (depth == SUBMERGED && (field & (L_BLOCKS | L_LONG))) { - printf("total %ld\n", nblk2k(countblocks(flist))); + printf("total %d\n", nblk2k(countblocks(flist))); } if (state == SINKING || depth == SURFACE1) { diff --git a/commands/mt/mt.c b/commands/mt/mt.c index 9ed73b73e..fd6dfcd5d 100644 --- a/commands/mt/mt.c +++ b/commands/mt/mt.c @@ -199,7 +199,7 @@ SCSI tape drive %s:\n\ (long) mtget.mt_fileno, (long) mtget.mt_blkno, (long) mtget.mt_resid); - printf(mtget.mt_blksize == 0 ? "variable\n" : "%ld\n", + printf(mtget.mt_blksize == 0 ? "variable\n" : "%d\n", mtget.mt_blksize); } } diff --git a/commands/partition/partition.c b/commands/partition/partition.c index 5b3a7b2fc..dac69cd71 100644 --- a/commands/partition/partition.c +++ b/commands/partition/partition.c @@ -334,7 +334,7 @@ void distribute(void) { struct part_entry *pe, *exp; long count; - unsigned long base, size, oldbase; + unsigned long base, oldbase; do { exp= nil; diff --git a/commands/ps/ps.c b/commands/ps/ps.c index 4d978213c..c421c7ab9 100644 --- a/commands/ps/ps.c +++ b/commands/ps/ps.c @@ -382,7 +382,7 @@ int pstat(struct pstat *ps, pid_t pid) exit(1); } - if (fscanf(fp, " %c %d %255s %c %d %*d %lu %lu %*u %*u", + if (fscanf(fp, " %c %d %255s %c %d %*d %u %u %*u %*u", &type, &ps->ps_endpt, name, &ps->ps_state, &ps->ps_recv, &ps->ps_utime, &ps->ps_stime) != 7) { diff --git a/commands/ramdisk/ramdisk.c b/commands/ramdisk/ramdisk.c index d46bbca88..9fe0bb5a6 100644 --- a/commands/ramdisk/ramdisk.c +++ b/commands/ramdisk/ramdisk.c @@ -38,7 +38,7 @@ main(int argc, char *argv[]) return 1; } - fprintf(stderr, "size on %s set to %dkB\n", d, size/KFACTOR); + fprintf(stderr, "size on %s set to %ldkB\n", d, size/KFACTOR); return 0; } diff --git a/commands/rawspeed/rawspeed.c b/commands/rawspeed/rawspeed.c index b0b9f11bc..256f536fa 100644 --- a/commands/rawspeed/rawspeed.c +++ b/commands/rawspeed/rawspeed.c @@ -220,7 +220,7 @@ int main(int argc, char **argv) if (nbytes > 0) { off_t kBpts; - fprintf(stderr, "%ld kB / %d.%d s = ", + fprintf(stderr, "%d kB / %ld.%ld s = ", (nbytes + 512) / 1024, tenthsec / 10, tenthsec % 10); if (tenthsec < 5) @@ -230,11 +230,11 @@ int main(int argc, char **argv) seconds = (tenthsec + 5) / 10; kBpts= (nbytes + 512L * seconds) / (1024L * seconds); - fprintf(stderr, "%ld kB/s\n", kBpts); + fprintf(stderr, "%d kB/s\n", kBpts); } else { kBpts= (100 * nbytes + 512L * tenthsec) / (1024L * tenthsec); - fprintf(stderr, "%ld.%ld kB/s\n", + fprintf(stderr, "%d.%d kB/s\n", kBpts/10, kBpts%10); } } @@ -246,7 +246,7 @@ int main(int argc, char **argv) tenthms= (tenthsec * 1000 + nseeks/2) / nseeks; fprintf(stderr, - "%ld seeks / %d.%d s = %ld seeks/s = %ld.%ld ms/seek\n", + "%d seeks / %ld.%ld s = %ld seeks/s = %d.%d ms/seek\n", nseeks, tenthsec / 10, tenthsec % 10, (nseeks * 10 + tenthsec/2) / tenthsec, tenthms / 10, tenthms % 10); @@ -263,7 +263,7 @@ int main(int argc, char **argv) } else { fprintf(stderr, ", "); } - fprintf(stderr, "%ld.%ld ms (%d rpm)", + fprintf(stderr, "%d.%d ms (%d rpm)", (tenthms - rotms) / 10, (tenthms - rotms) % 10, rpm); } diff --git a/commands/rcp/rcp.c b/commands/rcp/rcp.c index 933b2b719..baa3610c4 100644 --- a/commands/rcp/rcp.c +++ b/commands/rcp/rcp.c @@ -11,7 +11,9 @@ char copyright[] = #endif /* not lint */ #ifndef lint +#if 0 static char sccsid[] = "@(#)rcp.c 1.1 87/12/21 SMI"; /* from UCB 5.3 6/8/85"*/ +#endif #endif /* not lint */ /* @@ -84,7 +86,7 @@ struct buffer { #define ga() (void) write(rem, "", 1) -main(argc, argv) +int main(argc, argv) int argc; char **argv; { @@ -462,7 +464,7 @@ notreg: * Make it compatible with possible future * versions expecting microseconds. */ - (void) sprintf(buf, "T%ld 0 %ld 0\n", + (void) sprintf(buf, "T%d 0 %d 0\n", stb.st_mtime, stb.st_atime); (void) write(rem, buf, strlen(buf)); if (response() < 0) { @@ -470,7 +472,7 @@ notreg: continue; } } - (void) sprintf(buf, "C%04o %ld %s\n", + (void) sprintf(buf, "C%04o %lld %s\n", stb.st_mode&07777, stb.st_size, last); (void) write(rem, buf, strlen(buf)); if (response() < 0) { @@ -521,7 +523,7 @@ rsource(name, statp) else last++; if (pflag) { - (void) sprintf(buf, "T%ld 0 %ld 0\n", + (void) sprintf(buf, "T%d 0 %d 0\n", statp->st_mtime, statp->st_atime); (void) write(rem, buf, strlen(buf)); if (response() < 0) { @@ -535,7 +537,7 @@ rsource(name, statp) closedir(d); return; } - while (dp = readdir(d)) { + while ((dp = readdir(d))) { if (dp->d_ino == 0) continue; if (!strcmp(dp->d_name, ".") || !strcmp(dp->d_name, "..")) diff --git a/commands/remsync/remsync.c b/commands/remsync/remsync.c index 5dabada9a..5bfbe68d6 100644 --- a/commands/remsync/remsync.c +++ b/commands/remsync/remsync.c @@ -801,7 +801,7 @@ entry_t *readstate(void) static pathname_t path; static size_t *trunc; static size_t trunc_len; - static base_indent; + static int base_indent; char *line; char **argv; size_t argc; diff --git a/commands/rlogin/rlogin.c b/commands/rlogin/rlogin.c index e712b486d..116287db2 100644 --- a/commands/rlogin/rlogin.c +++ b/commands/rlogin/rlogin.c @@ -143,7 +143,7 @@ struct winsize winsize; #define get_window_size(fd, wp) ioctl(fd, TIOCGWINSZ, wp) extern int main( int argc, char **argv ); -static void usage( void ); +static void usage( void ) __attribute__((noreturn)); static u_char getescape( char *p ); static char *speeds2str( speed_t speed ); static void lostpeer( int sig ); @@ -201,7 +201,7 @@ int main(argc, argv) one = 1; host = user = NULL; - if (p = rindex(argv[0], '/')) + if ((p = rindex(argv[0], '/'))) ++p; else p = argv[0]; @@ -582,7 +582,7 @@ catch_child(sig) if (pid == 0) return; /* if the child (reader) dies, just quit */ - if (pid < 0 || pid == child && !WIFSTOPPED(status)) + if (pid < 0 || ((pid == child) && (!WIFSTOPPED(status)))) done(WTERMSIG(status) | WEXITSTATUS(status)); } /* NOTREACHED */ @@ -778,7 +778,6 @@ char rcvbuf[8 * 1024]; static int reader() { - int pid = -getpid(); int n, remaining; char *bufp = rcvbuf; diff --git a/commands/rsh/rsh.c b/commands/rsh/rsh.c index 8e906e03b..377eb8fc2 100644 --- a/commands/rsh/rsh.c +++ b/commands/rsh/rsh.c @@ -38,7 +38,9 @@ char copyright[] = #endif /* not lint */ #ifndef lint +#if 0 static char sccsid[] = "@(#)rsh.c 5.24 (Berkeley) 7/1/91"; +#endif #endif /* not lint */ /* @@ -126,7 +128,7 @@ main(argc, argv) host = user = NULL; /* if called as something other than "rsh", use it as the host name */ - if (p = rindex(argv[0], '/')) + if ((p = rindex(argv[0], '/'))) ++p; else p = argv[0]; @@ -359,7 +361,9 @@ talk(nflag, omask, pid, rem) { register int cc, wc; register char *bp; +#if !_MINIX int readfrom, ready, rembits; +#endif char buf[BUFSIZ]; #if _MINIX int pid1; diff --git a/commands/sleep/sleep.c b/commands/sleep/sleep.c index 289088f2f..b168de839 100644 --- a/commands/sleep/sleep.c +++ b/commands/sleep/sleep.c @@ -11,7 +11,7 @@ int main(argc, argv) int argc; char *argv[]; { - register seconds; + register int seconds; register char c; seconds = 0; @@ -20,7 +20,7 @@ char *argv[]; std_err("Usage: sleep time\n"); exit(1); } - while (c = *(argv[1])++) { + while ((c = *(argv[1])++)) { if (c < '0' || c > '9') { std_err("sleep: bad arg\n"); exit(1); diff --git a/commands/synctree/synctree.c b/commands/synctree/synctree.c index 908a5b0e7..b1a3aa8c4 100644 --- a/commands/synctree/synctree.c +++ b/commands/synctree/synctree.c @@ -1355,7 +1355,7 @@ static void Usage() exit(1); } -main(argc, argv) int argc; char **argv; +int main(argc, argv) int argc; char **argv; { char *s_mach, *s_dir; char *m_mach, *m_dir; diff --git a/commands/syslogd/syslogd.c b/commands/syslogd/syslogd.c index 44927a46b..49c9e2b44 100644 --- a/commands/syslogd/syslogd.c +++ b/commands/syslogd/syslogd.c @@ -275,7 +275,7 @@ void logmsg(int pri, char *msg, char *from, int flags) { struct filed *f; int fac, prilev; - int omask, msglen; + int /*omask,*/ msglen; char *timestamp; DEBUG(dprintf("logmsg: pri %o, flags %x, from %s, msg %s\n", pri, flags, from, msg);) @@ -639,8 +639,6 @@ void printline(char *hname, char *msg) void printkline(char *hname, char *msg) { char line[MAXLINE + 1]; - char *p = msg, *q = line; - int ch, pri = DEFUPRI; /* Copies message to local buffer, adding source program tag */ snprintf(line, sizeof(line), "kernel: %s", msg); @@ -656,7 +654,6 @@ void printkline(char *hname, char *msg) */ void init(int sig) { - int i; FILE *cf; struct filed *fLog, *next, **nextp; char *p; @@ -926,7 +923,7 @@ int main(int argc, char **argv) linebuf[len] = '\n'; linebuf[len + 1] = '\0'; p = linebuf; - while(eol = strchr(p, '\n')) { + while((eol = strchr(p, '\n'))) { *eol = '\0'; printkline(LocalHostName, p); p = eol+1; diff --git a/commands/tcpd/tcpd.c b/commands/tcpd/tcpd.c index e8f3948a7..2f86d4392 100644 --- a/commands/tcpd/tcpd.c +++ b/commands/tcpd/tcpd.c @@ -70,7 +70,7 @@ int main(int argc, char **argv) struct nwio_tcpopt tcpopt; char *tcp_device; struct servent *servent; - int tcp_fd, client_fd, count, r; + int tcp_fd, client_fd, r; int pfd[2]; unsigned stall= 0; struct sigaction sa; diff --git a/commands/tcpdp/tcpd.c b/commands/tcpdp/tcpd.c index e8f3948a7..2f86d4392 100644 --- a/commands/tcpdp/tcpd.c +++ b/commands/tcpdp/tcpd.c @@ -70,7 +70,7 @@ int main(int argc, char **argv) struct nwio_tcpopt tcpopt; char *tcp_device; struct servent *servent; - int tcp_fd, client_fd, count, r; + int tcp_fd, client_fd, r; int pfd[2]; unsigned stall= 0; struct sigaction sa; diff --git a/commands/tcpstat/tcpstat.c b/commands/tcpstat/tcpstat.c index e43f2c211..23591799f 100644 --- a/commands/tcpstat/tcpstat.c +++ b/commands/tcpstat/tcpstat.c @@ -48,7 +48,9 @@ int main(int argc, char*argv[]) int fd, i, r; char *query, *pval; size_t len; +#ifdef __minix_vmd struct timeval uptime; +#endif clock_t now; int fl; int a_flag, n_flag, v_flag; @@ -224,7 +226,7 @@ void print_conn(int i, clock_t now) case TCS_CLOSED: printf("CLOSED"); if (tcp_conn->tc_senddis >= now) { - printf("(time wait %ld s)", + printf("(time wait %d s)", (tcp_conn->tc_senddis-now)/system_hz); } no_verbose= 1; @@ -250,7 +252,7 @@ void print_conn(int i, clock_t now) tcp_conn->tc_state != TCS_LISTEN) { printf("\n\t"); - printf("RQ: %lu, SQ: %lu, RWnd: %u, SWnd: %lu, SWThresh: %lu", + printf("RQ: %u, SQ: %u, RWnd: %u, SWnd: %u, SWThresh: %u", tcp_conn->tc_RCV_NXT - tcp_conn->tc_RCV_LO, tcp_conn->tc_SND_NXT - tcp_conn->tc_SND_UNA, tcp_conn->tc_rcv_wnd, diff --git a/commands/telnet/ttn.c b/commands/telnet/ttn.c index 007a340c2..cabfb83e3 100644 --- a/commands/telnet/ttn.c +++ b/commands/telnet/ttn.c @@ -52,7 +52,7 @@ static void usage(void); #endif static char *prog_name; -static tcp_fd; +static int tcp_fd; static char *term_env; static int esc_char= '~'; static enum { LS_NORM, LS_BOL, LS_ESC } line_state= LS_BOL; diff --git a/commands/telnetd/main.c b/commands/telnetd/main.c index f0620c6c9..e0bdf4c94 100644 --- a/commands/telnetd/main.c +++ b/commands/telnetd/main.c @@ -37,7 +37,9 @@ #include #include "telnetd.h" +#if 0 static char *Version = "@(#) telnetd 1.00 (07/26/92)"; +#endif int opt_d = 0; /* debugging output flag */ @@ -105,7 +107,7 @@ char *hostname; lineno = 0; for (;;) { if ((ttyp = getttyent()) == NULL) { - sprintf(buff, "Can't find %s in the tty table\r\n"); + sprintf(buff, "Can't find the tty entry in the tty table\r\n"); (void) write(1, buff, strlen(buff)); } if (strcmp(ttyp->ty_name, tty_name+5) == 0) break; diff --git a/commands/telnetd/telnet.c b/commands/telnetd/telnet.c index 2974dda20..51dd67a71 100644 --- a/commands/telnetd/telnet.c +++ b/commands/telnetd/telnet.c @@ -96,7 +96,7 @@ int len; (void) write(fdout, buf, len); } -int set_winsize(int fd, unsigned int cols, unsigned int rows) +void set_winsize(int fd, unsigned int cols, unsigned int rows) { struct winsize w; memset(&w, 0, sizeof(w)); @@ -105,7 +105,7 @@ int set_winsize(int fd, unsigned int cols, unsigned int rows) ioctl(fd, TIOCSWINSZ, (char *) &w); } -int tel_in(fdout, telout, buffer, len) +void tel_in(fdout, telout, buffer, len) int fdout; int telout; char *buffer; @@ -227,7 +227,7 @@ int c; write(fdout, buffer, size); } -int tel_out(fdout, buf, size) +void tel_out(fdout, buf, size) int fdout; char *buf; int size; diff --git a/commands/telnetd/telnetd.h b/commands/telnetd/telnetd.h index 648db0859..b94c092a4 100644 --- a/commands/telnetd/telnetd.h +++ b/commands/telnetd/telnetd.h @@ -16,5 +16,5 @@ void term_init(void); void term_inout(int pty_fd); void tel_init(void); void telopt(int fdout, int what, int option); -int tel_in(int fdout, int telout, char *buffer, int len); -int tel_out(int fdout, char *buf, int size); +void tel_in(int fdout, int telout, char *buffer, int len); +void tel_out(int fdout, char *buf, int size); diff --git a/commands/telnetd/wtmp.c b/commands/telnetd/wtmp.c index 2fdba3d80..3585e2692 100644 --- a/commands/telnetd/wtmp.c +++ b/commands/telnetd/wtmp.c @@ -107,6 +107,6 @@ char *label; { char message[128]; - sprintf(message, "telnetd: %s: %s\r\n", strerror(errno)); + sprintf(message, "telnetd: %i: %s\r\n", errno, strerror(errno)); (void) write(1, message, strlen(message)); } diff --git a/commands/udpstat/udpstat.c b/commands/udpstat/udpstat.c index de26c1282..439b0197d 100644 --- a/commands/udpstat/udpstat.c +++ b/commands/udpstat/udpstat.c @@ -53,7 +53,9 @@ int main(int argc, char*argv[]) int fd, i, r; size_t psize; char *pval, *param; +#ifdef __minix_vmd struct timeval uptime; +#endif clock_t now; int fl; int a_flag, n_flag; diff --git a/commands/uud/uud.c b/commands/uud/uud.c index 5305d7153..3e4a970ff 100644 --- a/commands/uud/uud.c +++ b/commands/uud/uud.c @@ -259,7 +259,7 @@ again: if (fgets(buf, sizeof buf, in) == NULL) { cpt--; } cpt = buf; - while (c = *cpt) { + while ((c = *cpt)) { if (chtbl[c] != -1) { format("uud: Duplicate char in translation table.\n"); Error(7); @@ -300,7 +300,7 @@ void decode() /* * Get the binary line length. */ - n = trtbl[*buf]; + n = trtbl[(unsigned char)*buf]; if (n >= 0) goto decod; /* * end of uuencoded file ? @@ -334,7 +334,7 @@ decod: rlen = cdlen[n]; */ if (debug) { for (len = 0, bp = buf; len < rlen; len++) { - if (trtbl[*bp] < 0) { + if (trtbl[(unsigned char)*bp] < 0) { format( "Non uuencoded char <%c>, line %d in file: %s\n", *bp, numl, ifname); format("Bad line =%s\n",buf); @@ -387,15 +387,15 @@ decod: rlen = cdlen[n]; len = n; bp = &buf[1]; while (n > 0) { - *(ut++) = trtbl[*bp] << 2 | trtbl[bp[1]] >> 4; + *(ut++) = trtbl[(unsigned char)*bp] << 2 | trtbl[(unsigned char)bp[1]] >> 4; n--; if (n) { - *(ut++) = (trtbl[bp[1]] << 4) | - (trtbl[bp[2]] >> 2); + *(ut++) = (trtbl[(unsigned char)bp[1]] << 4) | + (trtbl[(unsigned char)bp[2]] >> 2); n--; } if (n) { - *(ut++) = trtbl[bp[2]] << 6 | trtbl[bp[3]]; + *(ut++) = trtbl[(unsigned char)bp[2]] << 6 | trtbl[(unsigned char)bp[3]]; n--; } bp += 4; diff --git a/commands/uue/uue.c b/commands/uue/uue.c index 6bcf3440d..e98a8dc1d 100644 --- a/commands/uue/uue.c +++ b/commands/uue/uue.c @@ -103,7 +103,7 @@ char *argv[]; if (lenofname > FILE_NAME) ofname[FILE_NAME] = '\0'; strcat(ofname, ".uue"); lenofname = strlen(ofname); - if (!split && (filter || (argc > 2) && (argv[2][0] == '-'))) { + if (!split && (filter || ((argc > 2) && (argv[2][0] == '-')))) { stdo = 1; outp = stdout; } else { diff --git a/commands/write/write.c b/commands/write/write.c index 5988bae70..335f49d68 100644 --- a/commands/write/write.c +++ b/commands/write/write.c @@ -27,7 +27,9 @@ #include #include +#if 0 static char *Version = "@(#) WRITE 1.6 (10/24/92)"; +#endif int otty; /* file desc of callee's terminal */ short int cbreak = 0; /* are we in CBREAK (-c) mode? */ @@ -129,7 +131,7 @@ void sayhello() { struct passwd *pw; char buff[128]; - long now; + time_t now; char *sp; time(&now); diff --git a/commands/writeisofs/writeisofs.c b/commands/writeisofs/writeisofs.c index 39c810dc8..55bdf53b9 100644 --- a/commands/writeisofs/writeisofs.c +++ b/commands/writeisofs/writeisofs.c @@ -857,7 +857,7 @@ writebootimage(char *bootimage, int bootfd, int fd, int *currentsector, exit(1); } - fprintf(stderr, " * appended sector info: 0x%lx len 0x%x\n", + fprintf(stderr, " * appended sector info: 0x%x len 0x%x\n", bap[0].sector, bap[0].length); addr = buf; diff --git a/commands/xargs/xargs.c b/commands/xargs/xargs.c index ac1a0eaa9..645ef6ce1 100644 --- a/commands/xargs/xargs.c +++ b/commands/xargs/xargs.c @@ -41,7 +41,9 @@ char copyright[] = #endif /* not lint */ #ifndef lint +#if 0 static char sccsid[] = "@(#)xargs.c 5.11 (Berkeley) 6/19/91"; +#endif #endif /* not lint */ #include diff --git a/commands/zmodem/rbsb.c b/commands/zmodem/rbsb.c index b9d8ab1ec..6c93bdd82 100644 --- a/commands/zmodem/rbsb.c +++ b/commands/zmodem/rbsb.c @@ -82,20 +82,20 @@ struct { unsigned baudr; int speedcode; } speeds[] = { - 110, B110, - 300, B300, + {110, B110, }, + {300, B300, }, #ifdef B600 - 600, B600, + {600, B600, }, #endif - 1200, B1200, - 2400, B2400, - 4800, B4800, - 9600, B9600, + {1200, B1200, }, + {2400, B2400, }, + {4800, B4800, }, + {9600, B9600, }, #ifdef EXTA - 19200, EXTA, - 38400, EXTB, + {19200, EXTA, }, + {38400, EXTB, }, #endif - 0, + {0}, }; int Twostop; /* Use two stop bits */ @@ -141,7 +141,7 @@ static unsigned getspeed(code) int code; { - register n; + register int n; for (n=0; speeds[n].baudr; ++n) if (speeds[n].speedcode == code) @@ -174,7 +174,7 @@ int iofd = 0; /* File descriptor for ioctls & reads */ int mode(n) int n; { - static did0 = FALSE; + static int did0 = FALSE; vfile("mode:%d", n); switch(n) { diff --git a/commands/zmodem/rz.c b/commands/zmodem/rz.c index 3cbb89ad9..9acbf6c39 100644 --- a/commands/zmodem/rz.c +++ b/commands/zmodem/rz.c @@ -258,7 +258,7 @@ int argc; char *argv[]; { register char *cp; - register npats; + register int npats; char *virgin, **patts; int exitcode = 0; @@ -419,13 +419,13 @@ int wcreceive(argc, argp) int argc; char **argp; { - register c; + register int c; if (Batch || argc==0) { Crcflg=1; if ( !Quiet) fprintf(stderr, rbmsg, Progname, Nozmodem?"sb":"sz"); - if (c=tryz()) { + if ((c=tryz())) { if (c == ZCOMPL) return OK; if (c == ERROR) @@ -483,7 +483,7 @@ fubar: int wcrxpn(rpn) char *rpn; /* receive a pathname */ { - register c; + register int c; #ifdef NFGVMIN readline(1); @@ -571,7 +571,7 @@ int wcgetsec(rxbuf, maxtime) char *rxbuf; int maxtime; { - register checksum, wcj, firstch; + register int checksum, wcj, firstch; register unsigned short oldcrc; register char *p; int sectcurr; @@ -671,7 +671,7 @@ humbug: int readline(timeout) int timeout; { - register n; + register int n; static char *cdq; /* pointer for removing chars from linbuf */ if (--Lleft >= 0) { @@ -1133,8 +1133,8 @@ char *name; */ int tryz() { - register c, n; - register cmdzack1flg; + register int c, n; + register int cmdzack1flg; if (Nozmodem) /* Check for "rb" program name */ return 0; @@ -1229,7 +1229,7 @@ again: */ int rzfiles() { - register c; + register int c; for (;;) { switch (c = rzfile()) { @@ -1258,7 +1258,7 @@ int rzfiles() */ int rzfile() { - register c, n; + register int c, n; long rxbytes; Eofseen=FALSE; @@ -1439,7 +1439,7 @@ moredata: void zmputs(s) char *s; { - register c; + register int c; while (*s) { switch (c = *s++) { @@ -1489,7 +1489,7 @@ int closeit() */ void ackbibi() { - register n; + register int n; vfile("ackbibi:"); Readnum = 1; diff --git a/commands/zmodem/sz.c b/commands/zmodem/sz.c index 160d10d66..167244ac9 100644 --- a/commands/zmodem/sz.c +++ b/commands/zmodem/sz.c @@ -284,7 +284,7 @@ int argc; char *argv[]; { register char *cp; - register npats; + register int npats; int dm; char **patts; static char xXbuf[BUFSIZ]; @@ -533,7 +533,7 @@ char *argp[]; int wcs(oname) char *oname; { - register c; + register int c; register char *p; struct stat f; char name[PATHLEN]; @@ -602,7 +602,7 @@ char *name; if (Modem2) { if ((in!=stdin) && *name && fstat(fileno(in), &f)!= -1) { - fprintf(stderr, "Sending %s, %ld blocks: ", + fprintf(stderr, "Sending %s, %lld blocks: ", name, f.st_size>>7); } fprintf(stderr, "Give your local XMODEM receive command now.\r\n"); @@ -637,7 +637,7 @@ char *name; while (q < (txbuf + 1024)) *q++ = 0; if (!Ascii && (in!=stdin) && *name && fstat(fileno(in), &f)!= -1) - sprintf(p, "%lu %lo %o 0 %d %ld", f.st_size, f.st_mtime, + sprintf(p, "%llu %o %o 0 %d %ld", f.st_size, f.st_mtime, f.st_mode, Filesleft, Totalleft); Totalleft -= f.st_size; if (--Filesleft <= 0) @@ -661,7 +661,7 @@ char *name; int getnak() { - register firstch; + register int firstch; Lastrx = 0; for (;;) { @@ -748,7 +748,7 @@ char *buf; int sectnum; int cseclen; /* data length of this sector to send */ { - register checksum, wcj; + register int checksum, wcj; register char *cp; unsigned oldcrc; int firstch; @@ -826,7 +826,7 @@ int filbuf(buf, count) register char *buf; int count; { - register c, m; + register int c, m; if ( !Ascii) { m = read(fileno(in), buf, count); @@ -1133,7 +1133,7 @@ int usage() */ int getzrxinit() { - register n; + register int n; struct stat f; for (n=10; --n>=0; ) { @@ -1238,7 +1238,7 @@ int getzrxinit() /* Send send-init information */ int sendzsinit() { - register c; + register int c; if (Myattn[0] == '\0' && (!Zctlesc || (Rxflags & TESCCTL))) return OK; @@ -1270,7 +1270,7 @@ int zsendfile(buf, blen) char *buf; int blen; { - register c; + register int c; register UNSL long crc; for (;;) { @@ -1328,7 +1328,7 @@ again: /* Send the data in the file */ int zsendfdata() { - register c, e, n; + register int c, e, n; register int newcnt; register long tcount = 0; int junkcount; /* Counts garbage chars received by TX */ @@ -1611,7 +1611,7 @@ int zsendcmd(buf, blen) char *buf; int blen; { - register c; + register int c; long cmdnum; cmdnum = getpid(); @@ -1694,7 +1694,7 @@ void countem(argc, argv) int argc; register char **argv; { - register c; + register int c; struct stat f; for (Totalleft = 0, Filesleft = 0; --argc >=0; ++argv) { @@ -1710,7 +1710,7 @@ register char **argv; } } if (Verbose>2) - fprintf(stderr, " %ld", f.st_size); + fprintf(stderr, " %lld", f.st_size); } if (Verbose>2) fprintf(stderr, "\ncountem: Total %d %ld\n", diff --git a/commands/zmodem/zm.c b/commands/zmodem/zm.c index 9e97b08e9..797e237eb 100644 --- a/commands/zmodem/zm.c +++ b/commands/zmodem/zm.c @@ -37,8 +37,8 @@ int Crc32; /* Display flag indicating 32 bit CRC being received */ int Znulls; /* Number of nulls to send at beginning of ZDATA hdr */ char Attn[ZATTNLEN+1]; /* Attention string rx sends to tx on err */ -static lastsent; /* Last char we sent */ -static Not8bit; /* Seven bits seen on header */ +static int lastsent; /* Last char we sent */ +static int Not8bit; /* Seven bits seen on header */ static char *frametypes[] = { "Carrier Lost", /* -3 */ @@ -87,7 +87,7 @@ register char *hdr; xsendline(ZPAD); xsendline(ZDLE); - if (Crc32t=Txfcs32) + if ((Crc32t=Txfcs32)) zsbh32(hdr, type); else { xsendline(ZBIN); zsendline(type); crc = updcrc(type, 0); @@ -240,7 +240,7 @@ crcfoo: case GOTCRCG: case GOTCRCQ: case GOTCRCW: - crc = updcrc((d=c)&0377, crc); + crc = updcrc((((d=c))&0377), crc); if ((c = zdlread()) & ~0377) goto crcfoo; crc = updcrc(c, crc); diff --git a/commands/zmodem/zmodem.h b/commands/zmodem/zmodem.h index 9ee40b838..35005fedc 100644 --- a/commands/zmodem/zmodem.h +++ b/commands/zmodem/zmodem.h @@ -103,19 +103,19 @@ #define ZCACK1 1 /* Acknowledge, then do command */ /* Globals used by ZMODEM functions */ -extern Rxframeind; /* ZBIN ZBIN32, or ZHEX type of frame received */ -extern Rxtype; /* Type of header received */ -extern Rxcount; /* Count of data bytes received */ -extern Zrwindow; /* RX window size (controls garbage count) */ -extern Rxtimeout; /* Tenths of seconds to wait for something */ +extern int Rxframeind; /* ZBIN ZBIN32, or ZHEX type of frame received */ +extern int Rxtype; /* Type of header received */ +extern int Rxcount; /* Count of data bytes received */ +extern int Zrwindow; /* RX window size (controls garbage count) */ +extern int Rxtimeout; /* Tenths of seconds to wait for something */ extern char Rxhdr[4]; /* Received header */ extern char Txhdr[4]; /* Transmitted header */ extern long Rxpos; /* Received file position */ extern long Txpos; /* Transmitted file position */ -extern Txfcs32; /* TURE means send binary frames with 32 bit FCS */ -extern Crc32t; /* Display flag indicating 32 bit CRC being sent */ -extern Crc32; /* Display flag indicating 32 bit CRC being received */ -extern Znulls; /* Number of nulls to send at beginning of ZDATA hdr */ +extern int Txfcs32; /* TURE means send binary frames with 32 bit FCS */ +extern int Crc32t; /* Display flag indicating 32 bit CRC being sent */ +extern int Crc32; /* Display flag indicating 32 bit CRC being received */ +extern int Znulls; /* Number of nulls to send at beginning of ZDATA hdr */ extern char Attn[ZATTNLEN+1]; /* Attention string rx sends to tx on err */ /* crctab.c */ diff --git a/lib/libc/gen/minix/times.c b/lib/libc/gen/minix/times.c index b8aa084b8..f424c9759 100644 --- a/lib/libc/gen/minix/times.c +++ b/lib/libc/gen/minix/times.c @@ -8,8 +8,7 @@ __weak_alias(times, _times) #endif -clock_t times(buf) -struct tms *buf; +clock_t times(struct tms *buf) { message m; diff --git a/lib/libc/gen/minix/uname.c b/lib/libc/gen/minix/uname.c index 70b807ab1..2759e66a2 100644 --- a/lib/libc/gen/minix/uname.c +++ b/lib/libc/gen/minix/uname.c @@ -20,8 +20,7 @@ __weak_alias(uname, _uname) return -1; \ name->string[sizeof(name->string)-1]= 0; -int uname(name) -struct utsname *name; +int uname(struct utsname *name) { int hf, n, err; char *nl; diff --git a/lib/libc/gen/minix/wait.c b/lib/libc/gen/minix/wait.c index 2d639c8c2..faf12a328 100644 --- a/lib/libc/gen/minix/wait.c +++ b/lib/libc/gen/minix/wait.c @@ -8,8 +8,7 @@ __weak_alias(wait, _wait) #endif -pid_t wait(status) -int * status; +pid_t wait(int * status) { message m; diff --git a/lib/libc/gen/minix/waitpid.c b/lib/libc/gen/minix/waitpid.c index 6972e6820..cd214f8de 100644 --- a/lib/libc/gen/minix/waitpid.c +++ b/lib/libc/gen/minix/waitpid.c @@ -8,10 +8,7 @@ __weak_alias(waitpid, _waitpid) #endif -pid_t waitpid(pid, status, options) -pid_t pid; -int *status; -int options; +pid_t waitpid(pid_t pid, int *status, int options) { message m; diff --git a/lib/libpuffs/puffs.c b/lib/libpuffs/puffs.c index e6eaea70c..d6690dec6 100644 --- a/lib/libpuffs/puffs.c +++ b/lib/libpuffs/puffs.c @@ -82,6 +82,7 @@ EXTERN char **env_argv; #define PUFFS_MAX_ARGS 20 int __real_main(int argc, char* argv[]); +int __wrap_main(int argc, char* argv[]); int __wrap_main(int argc, char *argv[]) { diff --git a/lib/librmt/rmtlib.c b/lib/librmt/rmtlib.c index cadeab398..8125d7432 100644 --- a/lib/librmt/rmtlib.c +++ b/lib/librmt/rmtlib.c @@ -626,12 +626,13 @@ remdev(const char *path) int rmtopen(const char *path, int oflag, ...) { - mode_t mode; + /* LSC: MINIX This works only for int mode flags, so use the expected type. */ + uint32_t mode; int fd; va_list ap; va_start(ap, oflag); - mode = va_arg(ap, mode_t); + mode = va_arg(ap, uint32_t); va_end(ap); _DIAGASSERT(path != NULL); diff --git a/sbin/fsck/preen.c b/sbin/fsck/preen.c index 0b8d1685a..c0c21ad74 100644 --- a/sbin/fsck/preen.c +++ b/sbin/fsck/preen.c @@ -271,11 +271,11 @@ finddisk(const char *name) const char *p; size_t len, dlen; struct diskentry *d; +#ifndef __minix char buf[MAXPATHLEN]; struct dkwedge_info dkw; int fd; -#ifndef __minix if ((fd = opendisk(name, O_RDONLY, buf, sizeof(buf), 0)) != -1) { if (ioctl(fd, DIOCGWEDGEINFO, &dkw) != -1) name = dkw.dkw_parent; diff --git a/servers/vm/alloc.c b/servers/vm/alloc.c index db3f8fddc..bc296b6a4 100644 --- a/servers/vm/alloc.c +++ b/servers/vm/alloc.c @@ -183,7 +183,8 @@ void memstats(int *nodes, int *pages, int *largest) static int findbit(int low, int startscan, int pages, int memflags, int *len) { - int run_length = 0, i, freerange_start; + int run_length = 0, i; + int freerange_start = startscan; for(i = startscan; i >= low; i--) { if(!page_isfree(i)) { diff --git a/sys/sys/cdefs.h b/sys/sys/cdefs.h index 1805b41c2..da138af2f 100644 --- a/sys/sys/cdefs.h +++ b/sys/sys/cdefs.h @@ -278,7 +278,9 @@ #define __static_cast(x,y) (x)y #endif -#if __GNUC_PREREQ__(4, 0) +/* LSC: Clang/llvm also defines GNUC_PREREQ, but it actually does not + * Support those pragma. Make sure it is not used then.*/ +#if __GNUC_PREREQ__(4, 0) && !defined(__clang__) # define __dso_public __attribute__((__visibility__("default"))) # define __dso_hidden __attribute__((__visibility__("hidden"))) # define __BEGIN_PUBLIC_DECLS \ diff --git a/usr.bin/gzip/gzip.c b/usr.bin/gzip/gzip.c index 00cbd82d2..fdbdbc537 100644 --- a/usr.bin/gzip/gzip.c +++ b/usr.bin/gzip/gzip.c @@ -66,7 +66,7 @@ __RCSID("$NetBSD: gzip.c,v 1.105 2011/08/30 23:06:00 joerg Exp $"); #include #ifndef PRIdOFF -#define PRIdOFF PRId64 +#define PRIdOFF PRId32 #endif /* what type of file are we dealing with */ diff --git a/usr.bin/top/top.c b/usr.bin/top/top.c index c31e02bfb..19cc643e4 100644 --- a/usr.bin/top/top.c +++ b/usr.bin/top/top.c @@ -84,7 +84,7 @@ struct proc { struct proc *proc = NULL, *prev_proc = NULL; -void parse_file(pid_t pid) +static void parse_file(pid_t pid) { char path[PATH_MAX], name[256], type, state; int version, endpt, effuid; @@ -132,7 +132,7 @@ void parse_file(pid_t pid) p->p_endpoint = endpt; p->p_pid = pid; - if (fscanf(fp, " %255s %c %d %d %lu %*u %lu %lu", + if (fscanf(fp, " %255s %c %d %d %u %*u %lu %lu", name, &state, &p->p_blocked, &p->p_priority, &p->p_user_time, &cycles_hi, &cycles_lo) != 7) { @@ -180,7 +180,7 @@ void parse_file(pid_t pid) fclose(fp); } -void parse_dir(void) +static void parse_dir(void) { DIR *p_dir; struct dirent *p_ent; @@ -202,7 +202,7 @@ void parse_dir(void) closedir(p_dir); } -void get_procs(void) +static void get_procs(void) { struct proc *p; int i; @@ -226,7 +226,7 @@ void get_procs(void) parse_dir(); } -int print_memory(void) +static int print_memory(void) { FILE *fp; unsigned int pagesize; @@ -251,7 +251,7 @@ int print_memory(void) return 1; } -int print_load(double *loads, int nloads) +static int print_load(double *loads, int nloads) { int i; printf("load averages: "); @@ -261,7 +261,7 @@ int print_load(double *loads, int nloads) return 1; } -int print_proc_summary(struct proc *proc) +static int print_proc_summary(struct proc *proc) { int p, alive, running, sleeping; @@ -288,7 +288,7 @@ struct tp { u64_t ticks; }; -int cmp_procs(const void *v1, const void *v2) +static int cmp_procs(const void *v1, const void *v2) { struct tp *p1 = (struct tp *) v1, *p2 = (struct tp *) v2; int p1blocked, p2blocked; @@ -324,7 +324,7 @@ int cmp_procs(const void *v1, const void *v2) return (int) (p1->p - p2->p); } -struct tp *lookup(endpoint_t who, struct tp *tptab, int np) +static struct tp *lookup(endpoint_t who, struct tp *tptab, int np) { int t; @@ -340,7 +340,7 @@ struct tp *lookup(endpoint_t who, struct tp *tptab, int np) double ktotal = 0; -void print_proc(struct tp *tp, u64_t total_ticks) +static void print_proc(struct tp *tp, u64_t total_ticks) { int euid = 0; static struct passwd *who = NULL; @@ -374,7 +374,7 @@ void print_proc(struct tp *tp, u64_t total_ticks) printf("%6.2f%% %s", 100.0 * tp->ticks / total_ticks, name); } -char *cputimemodename(int cputimemode) +static char *cputimemodename(int cputimemode) { static char name[100]; int i; @@ -393,7 +393,7 @@ char *cputimemodename(int cputimemode) return name; } -u64_t cputicks(struct proc *p1, struct proc *p2, int timemode) +static u64_t cputicks(struct proc *p1, struct proc *p2, int timemode) { int i; u64_t t = 0; @@ -410,7 +410,7 @@ u64_t cputicks(struct proc *p1, struct proc *p2, int timemode) return t; } -char *ordername(int orderno) +static char *ordername(int orderno) { switch(orderno) { case ORDER_CPU: return "cpu"; @@ -419,7 +419,7 @@ char *ordername(int orderno) return "invalid order"; } -void print_procs(int maxlines, +static void print_procs(int maxlines, struct proc *proc1, struct proc *proc2, int cputimemode) { int p, nprocs; @@ -538,7 +538,7 @@ void print_procs(int maxlines, } } -void showtop(int cputimemode, int r) +static void showtop(int cputimemode, int r) { #define NLOADS 3 double loads[NLOADS]; @@ -573,7 +573,7 @@ void showtop(int cputimemode, int r) fflush(NULL); } -void init(int *rows) +static void init(int *rows) { char *term; static char buffer[TC_BUFFER], strings[TC_STRINGS]; @@ -602,9 +602,9 @@ void init(int *rows) if(*rows < 1) *rows = 24; } -void sigwinch(int sig) { } +static void sigwinch(int sig) { } -void getkinfo(void) +static void getkinfo(void) { FILE *fp; diff --git a/usr.bin/xinstall/xinstall.c b/usr.bin/xinstall/xinstall.c index 630d9c545..1d479fd65 100644 --- a/usr.bin/xinstall/xinstall.c +++ b/usr.bin/xinstall/xinstall.c @@ -824,7 +824,9 @@ copy(int from_fd, char *from_name, int to_fd, char *to_name, off_t size) { ssize_t nr, nw; int serrno; +#ifndef __minix u_char *p; +#endif u_char buf[MAXBSIZE]; MD5_CTX ctxMD5; RMD160_CTX ctxRMD160; diff --git a/usr.sbin/mkproto/mkproto.c b/usr.sbin/mkproto/mkproto.c index 3f4cc99b1..8c6ab56e3 100644 --- a/usr.sbin/mkproto/mkproto.c +++ b/usr.sbin/mkproto/mkproto.c @@ -37,7 +37,7 @@ extern char *optarg; int main(int argc, char **argv); void descend(char *dirname); -void display_attrib(char *name, struct stat *st); +void display_attrib(const char *name, struct stat *st); void usage(char *binname); void open_outfile(void); @@ -45,7 +45,7 @@ int main(argc, argv) int argc; char *argv[]; { - char *dir; + char *dir = __UNCONST(""); struct stat st; int op; @@ -54,7 +54,7 @@ char *argv[]; prot = DEF_PROT; blocks = DEF_BLOCKS; inodes = DEF_INODES; - indentstr = DEF_INDENTSTR; + indentstr = __UNCONST(DEF_INDENTSTR); inode_given = 0; block_given = 0; top = 0; @@ -170,7 +170,7 @@ char *dirname; fprintf(outfile, "\n"); descend(temp); for (i = 0; i < tabs; i++) { - fprintf(outfile, indentstr); + fprintf(outfile, "%s", indentstr); } fprintf(outfile, "$\n"); continue; @@ -209,7 +209,7 @@ char *dirname; void display_attrib(name, st) -char *name; +const char *name; struct stat *st; { /* Output the specification for a single file */ @@ -220,7 +220,7 @@ struct stat *st; if (same_gid) gid = st->st_gid; if (same_prot) prot = st->st_mode & 0777; /***** This one is a bit shady *****/ - for (i = 0; i < tabs; i++) fprintf(outfile, indentstr); + for (i = 0; i < tabs; i++) fprintf(outfile, "%s", indentstr); fprintf(outfile, "%s%s%c%c%c%3o %d %d", name, *name == '\0' ? "" : indentstr, /* stop the tab for a null name */ diff --git a/usr.sbin/mtree/compare.c b/usr.sbin/mtree/compare.c index 8b66181ad..6090967f6 100644 --- a/usr.sbin/mtree/compare.c +++ b/usr.sbin/mtree/compare.c @@ -141,7 +141,7 @@ lchown(const char *path, uid_t owner, gid_t group) } #endif -int +static int utimes(const char *path, const struct timeval times[2]) { return -1; @@ -151,7 +151,11 @@ utimes(const char *path, const struct timeval times[2]) int compare(NODE *s, FTSENT *p) { +#if defined(__minix) + u_int32_t len, val; +#else u_int32_t len, val, flags; +#endif /* defined(__minix) */ int fd, label; const char *cp, *tab; #if !defined(NO_MD5) || !defined(NO_RMD160) || !defined(NO_SHA1) || !defined(NO_SHA2) diff --git a/usr.sbin/mtree/create.c b/usr.sbin/mtree/create.c index b9a3c44ee..264aa8b17 100644 --- a/usr.sbin/mtree/create.c +++ b/usr.sbin/mtree/create.c @@ -317,7 +317,9 @@ statd(FTS *t, FTSENT *parent, uid_t *puid, gid_t *pgid, mode_t *pmode, gid_t sgid; uid_t suid; mode_t smode; +#if !defined(__minix) u_long sflags = 0; +#endif /* !defined(__minix) */ const char *name = NULL; gid_t savegid; uid_t saveuid; diff --git a/usr.sbin/mtree/verify.c b/usr.sbin/mtree/verify.c index 54b704cbf..4b7e83d82 100644 --- a/usr.sbin/mtree/verify.c +++ b/usr.sbin/mtree/verify.c @@ -168,7 +168,9 @@ miss(NODE *p, char *tail) int create; char *tp; const char *type; +#if !defined(__minix) u_int32_t flags; +#endif /* !defined(__minix) */ for (; p; p = p->next) { if (p->flags & F_OPT && !(p->flags & F_VISIT))