From a23f413dfb0319cdac7baa2112738796da9e02c5 Mon Sep 17 00:00:00 2001 From: Santurysim Date: Wed, 31 Mar 2021 15:51:13 +0300 Subject: [PATCH] Cleanup: convert function definitions to ANSI style in minix/commands Task from minix wishlist. No functional changes intended. --- minix/commands/dhrystone/dhrystone.c | 54 +++----- minix/commands/dosread/dosread.c | 86 ++++--------- minix/commands/fsck.mfs/fsck.c | 149 +++++++---------------- minix/commands/ifdef/ifdef.c | 68 ++--------- minix/commands/isoread/isoread.c | 67 ++++------ minix/commands/mail/mail.c | 48 +++----- minix/commands/mount/mount.c | 10 +- minix/commands/playwave/playwave.c | 2 +- minix/commands/prep/prep.c | 10 +- minix/commands/printroot/printroot.c | 8 +- minix/commands/profile/profile.c | 8 +- minix/commands/progressbar/progressbar.c | 4 +- minix/commands/recwave/recwave.c | 4 +- minix/commands/svrctl/svrctl.c | 2 +- minix/commands/swifi/db_access.c | 10 +- minix/commands/swifi/db_disasm.c | 6 +- minix/commands/swifi/extra.c | 5 +- minix/commands/synctree/synctree.c | 32 ++--- minix/commands/term/term.c | 21 +--- minix/commands/termcap/termcap.c | 8 +- minix/commands/umount/umount.c | 9 +- minix/commands/update/update.c | 2 +- minix/commands/vol/vol.c | 22 +--- minix/commands/zmodem/rbsb.c | 11 +- minix/commands/zmodem/rz.c | 23 ++-- minix/commands/zmodem/sz.c | 20 +-- 26 files changed, 218 insertions(+), 471 deletions(-) diff --git a/minix/commands/dhrystone/dhrystone.c b/minix/commands/dhrystone/dhrystone.c index 857d1ddc8..de3bf9e4e 100644 --- a/minix/commands/dhrystone/dhrystone.c +++ b/minix/commands/dhrystone/dhrystone.c @@ -211,7 +211,7 @@ boolean Func3(Enumeration EnumParIn); Enumeration Func1(int CharPar1, int CharPar2); -int main() +int main(void) { Proc0(); return(0); @@ -224,14 +224,13 @@ volatile int done; int done; #endif -void prep_timer() +void prep_timer(void) { signal(SIGALRM, timeout); done = 0; } -void timeout(sig) -int sig; +void timeout(int sig) { done = 1; } @@ -247,7 +246,7 @@ RecordPtr PtrGlb; RecordPtr PtrGlbNext; -void Proc0() +void Proc0(void) { OneToFifty IntLoc1; REG OneToFifty IntLoc2; @@ -383,8 +382,7 @@ void Proc0() } -void Proc1(PtrParIn) -REG RecordPtr PtrParIn; +void Proc1(REG RecordPtr PtrParIn) { #define NextRecord (*(PtrParIn->PtrComp)) @@ -407,8 +405,7 @@ REG RecordPtr PtrParIn; } -void Proc2(IntParIO) -OneToFifty *IntParIO; +void Proc2(OneToFifty *IntParIO) { REG OneToFifty IntLoc; REG Enumeration EnumLoc; @@ -426,8 +423,7 @@ OneToFifty *IntParIO; } -void Proc3(PtrParOut) -RecordPtr *PtrParOut; +void Proc3(RecordPtr *PtrParOut) { if (PtrGlb != NULL) *PtrParOut = PtrGlb->PtrComp; @@ -437,7 +433,7 @@ RecordPtr *PtrParOut; } -void Proc4() +void Proc4(void) { REG boolean BoolLoc; @@ -448,16 +444,14 @@ void Proc4() } -void Proc5() +void Proc5(void) { Char1Glob = 'A'; BoolGlob = FALSE; } -void Proc6(EnumParIn, EnumParOut) -REG Enumeration EnumParIn; -REG Enumeration *EnumParOut; +void Proc6(REG Enumeration EnumParIn, REG Enumeration *EnumParOut) { *EnumParOut = EnumParIn; if (!Func3(EnumParIn)) *EnumParOut = Ident4; @@ -477,10 +471,7 @@ REG Enumeration *EnumParOut; } -void Proc7(IntParI1, IntParI2, IntParOut) -OneToFifty IntParI1; -OneToFifty IntParI2; -OneToFifty *IntParOut; +void Proc7(OneToFifty IntParI1, OneToFifty IntParI2, OneToFifty *IntParOut) { REG OneToFifty IntLoc; @@ -490,11 +481,8 @@ OneToFifty *IntParOut; } -void Proc8(Array1Par, Array2Par, IntParI1, IntParI2) -Array1Dim Array1Par; -Array2Dim Array2Par; -OneToFifty IntParI1; -OneToFifty IntParI2; +void Proc8(Array1Dim Array1Par, Array2Dim Array2Par, + OneToFifty IntParI1, OneToFifty IntParI2) { REG OneToFifty IntLoc; REG OneToFifty IntIndex; @@ -512,9 +500,7 @@ OneToFifty IntParI2; } -Enumeration Func1(CharPar1, CharPar2) -CapitalLetter CharPar1; -CapitalLetter CharPar2; +Enumeration Func1(CapitalLetter CharPar1, CapitalLetter CharPar2) { REG CapitalLetter CharLoc1; REG CapitalLetter CharLoc2; @@ -529,9 +515,7 @@ CapitalLetter CharPar2; } -boolean Func2(StrParI1, StrParI2) -String30 StrParI1; -String30 StrParI2; +boolean Func2(String30 StrParI1, String30 StrParI2) { REG OneToThirty IntLoc; REG CapitalLetter CharLoc; @@ -556,8 +540,7 @@ String30 StrParI2; } -boolean Func3(EnumParIn) -REG Enumeration EnumParIn; +boolean Func3(REG Enumeration EnumParIn) { REG Enumeration EnumLoc; @@ -569,10 +552,7 @@ REG Enumeration EnumParIn; #ifdef NOSTRUCTASSIGN -memcpy(d, s, l) -register char *d; -register char *s; -register int l; +memcpy(register char *d, register char *s, register int l) { while (l--) *d++ = *s++; } diff --git a/minix/commands/dosread/dosread.c b/minix/commands/dosread/dosread.c index 1757d7a00..b3aebb5a2 100644 --- a/minix/commands/dosread/dosread.c +++ b/minix/commands/dosread/dosread.c @@ -146,29 +146,26 @@ BOOL free_range(unsigned short *first, unsigned short *last); long lmin(long a, long b); -void usage(prog_name) -register char *prog_name; +void usage(register char *prog_name) { fprintf (stderr, "Usage: %s [%s\n", prog_name, (dos_dir ? "-lr] drive [dir]" : "-a] drive file")); exit(1); } -unsigned c2u2(ucarray) -unsigned char *ucarray; +unsigned c2u2(unsigned char *ucarray) { return ucarray[0] + (ucarray[1] << 8); /* parens vital */ } -unsigned long c4u4(ucarray) -unsigned char *ucarray; +unsigned long c4u4(unsigned char *ucarray) { return ucarray[0] + ((unsigned long) ucarray[1] << 8) + ((unsigned long) ucarray[2] << 16) + ((unsigned long) ucarray[3] << 24); } -void determine() +void determine(void) { struct dosboot { unsigned char cjump[2]; /* unsigneds avoid bugs */ @@ -292,9 +289,7 @@ void determine() } } -int main(argc, argv) -int argc; -register char *argv[]; +int main(int argc, register char *argv[]) { register char *arg_ptr = slash(argv[0]); DIRECTORY *entry; @@ -438,11 +433,7 @@ register char *argv[]; * separated by slashes, but can be longer than than * 8+3 characters (The rest is ignored). */ -DIRECTORY *directory(dir, entries, function, pathname) -DIRECTORY *dir; -int entries; -int function; -register char *pathname; +DIRECTORY *directory(DIRECTORY *dir, int entries, int function, register char *pathname) { register DIRECTORY *dir_ptr = dir; DIRECTORY *mem = NULL; @@ -564,8 +555,7 @@ register char *pathname; return NULL; } -void extract(entry) -register DIRECTORY *entry; +void extract(register DIRECTORY *entry) { register unsigned short cl_no = entry->d_cluster; char buffer[MAX_CLUSTER_SIZE]; @@ -614,18 +604,14 @@ register DIRECTORY *entry; /* Minimum of two long values */ -long lmin (a, b) -long a, b; +long lmin (long a, long b) { if (a < b) return a; else return b; } -void make_file(dir_ptr, entries, name) -DIRECTORY *dir_ptr; -int entries; -char *name; +void make_file(DIRECTORY *dir_ptr, int entries, char *name) { register DIRECTORY *entry = new_entry(dir_ptr, entries); register char *ptr; @@ -693,8 +679,7 @@ done: unsigned short mon_len[] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}; -void fill_date(entry) -DIRECTORY *entry; +void fill_date(DIRECTORY *entry) { register long cur_time = time(NULL) - DOS_TIME; unsigned short year = 0, month = 1, day, hour, minutes, seconds; @@ -733,9 +718,7 @@ DIRECTORY *entry; entry->d_time = (hour << 11) | (minutes << 5) | seconds; } -char *make_name(dir_ptr, dir_fl) -register DIRECTORY *dir_ptr; -short dir_fl; +char *make_name(register DIRECTORY *dir_ptr, short dir_fl) { static char name_buf[14]; register char *ptr = name_buf; @@ -760,9 +743,7 @@ short dir_fl; } -int fill(buffer, size) -register char *buffer; -size_t size; +int fill(register char *buffer, size_t size) { static BOOL nl_mark = FALSE; char *last = &buffer[size]; @@ -799,17 +780,14 @@ char *month[] = { "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" }; -void xmodes(mode) -int mode; +void xmodes(int mode) { printf ( "\t%c%c%c%c%c", (mode & SUB_DIR) ? 'd' : '-', (mode & 02) ? 'h' : '-', (mode & 04) ? 's' : '-', (mode & 01) ? '-' : 'w', (mode & 0x20) ? 'a' : '-'); } -void show(dir_ptr, name) -DIRECTORY *dir_ptr; -char *name; +void show(DIRECTORY *dir_ptr, char *name) { register unsigned short e_date = dir_ptr->d_date; register unsigned short e_time = dir_ptr->d_time; @@ -837,7 +815,7 @@ char *name; month[((e_date & MONTH) >> 5) - 1], ((e_date & YEAR) >> 9) + 1980); } -void free_blocks() +void free_blocks(void) { register unsigned short cl_no; long nr_free = 0; @@ -856,8 +834,7 @@ void free_blocks() } -DIRECTORY *read_cluster(cluster) -register unsigned int cluster; +DIRECTORY *read_cluster(register unsigned int cluster) { register DIRECTORY *sub_dir; @@ -879,8 +856,7 @@ static unsigned short cl_index = 2; * Warning: Assumes that all of the range is used before the next call * to free_range or free_cluster. */ -BOOL free_range (first, last) -unsigned short *first, *last; +BOOL free_range (unsigned short *first, unsigned short *last) { while (cl_index < total_clusters && next_cluster(cl_index) != FREE) cl_index++; @@ -902,8 +878,7 @@ unsigned short *first, *last; * Warning: Assumes that the cluster is used before the next call * to free_range or free_cluster. */ -unsigned short free_cluster(leave_fl) -BOOL leave_fl; +unsigned short free_cluster(BOOL leave_fl) { while (cl_index < total_clusters && next_cluster(cl_index) != FREE) cl_index++; @@ -918,8 +893,7 @@ BOOL leave_fl; /* read a portion of the fat containing |cl_no| into the cache */ -void read_fat (cl_no) - unsigned int cl_no; +void read_fat (unsigned int cl_no) { if (!cooked_fat) { @@ -999,7 +973,7 @@ void read_fat (cl_no) /* flush the fat cache out to disk */ -void flush_fat () +void flush_fat (void) { if (fat_16) { if (big_endian) { @@ -1037,9 +1011,7 @@ void flush_fat () /* make cl_2 the successor of cl_1 */ -void link_fat(cl_1, cl_2) -unsigned int cl_1; -unsigned int cl_2; +void link_fat(unsigned int cl_1, unsigned int cl_2) { if (cl_1 < fat_low || cl_1 > fat_high) { if (fat_dirty) flush_fat (); @@ -1050,8 +1022,7 @@ unsigned int cl_2; } -unsigned short next_cluster(cl_no) -register unsigned int cl_no; +unsigned short next_cluster(register unsigned int cl_no) { if (cl_no < fat_low || cl_no > fat_high) { if (fat_dirty) flush_fat (); @@ -1060,8 +1031,7 @@ register unsigned int cl_no; return cooked_fat [cl_no - fat_low]; } -char *slash(str) -register char *str; +char *slash(register char *str) { register char *result = str; @@ -1071,9 +1041,7 @@ register char *str; return result; } -void add_path(file, slash_fl) -char *file; -BOOL slash_fl; +void add_path(char *file, BOOL slash_fl) { register char *ptr = path; @@ -1091,11 +1059,7 @@ BOOL slash_fl; } -void disk_io(op, seek, address, bytes) -register BOOL op; -unsigned long seek; -void *address; -register unsigned bytes; +void disk_io(register BOOL op, unsigned long seek, void *address, register unsigned bytes) { unsigned int r; diff --git a/minix/commands/fsck.mfs/fsck.c b/minix/commands/fsck.mfs/fsck.c index fbffc8314..afa533119 100644 --- a/minix/commands/fsck.mfs/fsck.c +++ b/minix/commands/fsck.mfs/fsck.c @@ -224,7 +224,7 @@ void printtotal(void); void chkdev(char *f, char **clist, char **ilist, char **zlist); /* Initialize the variables used by this program. */ -void initvars() +void initvars(void) { register int level; @@ -238,23 +238,20 @@ void initvars() } /* Print the string `s' and exit. */ -void fatal(s) -char *s; +void fatal(char *s) { printf("%s\nfatal\n", s); exit(FSCK_EXIT_CHECK_FAILED); } /* Test for end of line. */ -int eoln(c) -int c; +int eoln(int c) { return(c == EOF || c == '\n' || c == '\r'); } /* Ask a question and get the answer unless automatic is set. */ -int yes(question) -char *question; +int yes(char *question) { register int c, answerchar; static int note = 0; @@ -280,8 +277,7 @@ char *question; } /* Convert string to integer. Representation is octal. */ -int atoo(s) -register char *s; +int atoo(register char *s) { register int n = 0; @@ -293,9 +289,7 @@ register char *s; } /* If repairing the file system, print a prompt and get a string from user. */ -int input(buf, size) -char *buf; -int size; +int input(char *buf, int size) { register char *p = buf; @@ -319,8 +313,7 @@ int size; } /* Allocate some memory and zero it. */ -char *alloc(nelem, elsize) -unsigned nelem, elsize; +char *alloc(unsigned nelem, unsigned elsize) { char *p; @@ -334,8 +327,7 @@ unsigned nelem, elsize; } /* Print the name in a directory entry. */ -void printname(s) -char *s; +void printname(char *s) { register int n = MFS_NAME_MAX; int c; @@ -361,9 +353,7 @@ void printrec(struct stack *sp) } /* Print the current pathname. */ -void printpath(mode, nlcr) -int mode; -int nlcr; +void printpath(int mode, int nlcr) { if (ftop->st_next == 0) putchar('/'); @@ -381,7 +371,7 @@ int nlcr; } /* Open the device. */ -void devopen() +void devopen(void) { if ((dev = open(fsck_device, (repair || markdirty) ? O_RDWR : O_RDONLY)) < 0) { @@ -391,7 +381,7 @@ void devopen() } /* Close the device. */ -void devclose() +void devclose(void) { if (close(dev) != 0) { perror("close"); @@ -400,9 +390,7 @@ void devclose() } /* Read or write a block. */ -void devio(bno, dir) -block_nr bno; -int dir; +void devio(block_nr bno, int dir) { off_t r; @@ -437,11 +425,7 @@ printf("%s at block %5d\n", dir == READING ? "reading " : "writing", bno); /* Read `size' bytes from the disk starting at block 'block' and * byte `offset'. */ -void devread(block, offset, buf, size) -long block; -long offset; -char *buf; -int size; +void devread(long block, long offset, char *buf, int size) { if(!block_size) fatal("devread() with unknown block size"); if (offset >= block_size) @@ -456,11 +440,7 @@ int size; /* Write `size' bytes to the disk starting at block 'block' and * byte `offset'. */ -void devwrite(block, offset, buf, size) -long block; -long offset; -char *buf; -int size; +void devwrite(long block, long offset, char *buf, int size) { if(!block_size) fatal("devwrite() with unknown block size"); if (!repair) fatal("internal error (devwrite)"); @@ -476,24 +456,19 @@ int size; } /* Print a string with either a singular or a plural pronoun. */ -void pr(fmt, cnt, s, p) -char *fmt, *s, *p; -int cnt; +void pr(char *fmt, int cnt, char *s, char *p) { printf(fmt, cnt, cnt == 1 ? s : p); } /* Same as above, but with a long argument */ -void lpr(fmt, cnt, s, p) -char *fmt, *s, *p; -long cnt; +void lpr(char *fmt, long cnt, char *s, char *p) { printf(fmt, cnt, cnt == 1 ? s : p); } /* Convert string to number. */ -bit_nr getnumber(s) -register char *s; +bit_nr getnumber(register char *s) { register bit_nr n = 0; @@ -505,8 +480,7 @@ register char *s; } /* See if the list pointed to by `argv' contains numbers. */ -char **getlist(argv, type) -char ***argv, *type; +char **getlist(char ***argv, char *type) { register char **list = *argv; register int empty = 1; @@ -525,7 +499,7 @@ char ***argv, *type; /* Make a listing of the super block. If `repair' is set, ask the user * for changes. */ -void lsuper() +void lsuper(void) { char buf[80]; @@ -599,7 +573,7 @@ void rw_super(int put) } /* Check the super block for reasonable contents. */ -void chksuper() +void chksuper(void) { register int n; register off_t maxsize; @@ -667,8 +641,7 @@ int inooff(int inn) /* Make a listing of the inodes given by `clist'. If `repair' is set, ask * the user for changes. */ -void lsi(clist) -char **clist; +void lsi(char **clist) { register bit_nr bit; register ino_t ino; @@ -698,8 +671,7 @@ char **clist; } /* Allocate `nblk' blocks worth of bitmap. */ -bitchunk_t *allocbitmap(nblk) -int nblk; +bitchunk_t *allocbitmap(int nblk) { register bitchunk_t *bitmap; @@ -709,10 +681,7 @@ int nblk; } /* Load the bitmap starting at block `bno' from disk. */ -void loadbitmap(bitmap, bno, nblk) -bitchunk_t *bitmap; -block_nr bno; -int nblk; +void loadbitmap(bitchunk_t *bitmap, block_nr bno, int nblk) { register int i; register bitchunk_t *p; @@ -724,10 +693,7 @@ int nblk; } /* Write the bitmap starting at block `bno' to disk. */ -void dumpbitmap(bitmap, bno, nblk) -bitchunk_t *bitmap; -block_nr bno; -int nblk; +void dumpbitmap(bitchunk_t *bitmap, block_nr bno, int nblk) { register int i; register bitchunk_t *p = bitmap; @@ -737,10 +703,7 @@ int nblk; } /* Set the bits given by `list' in the bitmap. */ -void fillbitmap(bitmap, lwb, upb, list) -bitchunk_t *bitmap; -bit_nr lwb, upb; -char **list; +void fillbitmap(bitchunk_t *bitmap, bit_nr lwb, bit_nr upb, char **list) { register bit_nr bit; @@ -757,14 +720,13 @@ char **list; } /* Deallocate the bitmap `p'. */ -void freebitmap(p) -bitchunk_t *p; +void freebitmap(bitchunk_t *p) { free((char *) p); } /* Get all the bitmaps used by this program. */ -void getbitmaps() +void getbitmaps(void) { imap = allocbitmap(N_IMAP); zmap = allocbitmap(N_ZMAP); @@ -774,7 +736,7 @@ void getbitmaps() } /* Release all the space taken by the bitmaps. */ -void putbitmaps() +void putbitmaps(void) { freebitmap(imap); freebitmap(zmap); @@ -786,12 +748,7 @@ void putbitmaps() /* `w1' and `w2' are differing words from two bitmaps that should be * identical. Print what's the matter with them. */ -void chkword(w1, w2, bit, type, n, report, phys) -unsigned w1, w2; -char *type; -bit_nr bit; -int *n, *report; -bit_nr phys; +void chkword(unsigned w1, unsigned w2, bit_nr bit, char *type, int *n, int *report, bit_nr phys) { for (; (w1 | w2); w1 >>= 1, w2 >>= 1, bit++, phys++) if ((w1 ^ w2) & 1 && ++(*n) % MAXPRINT == 0 && *report && @@ -810,12 +767,7 @@ bit_nr phys; /* Check if the given (correct) bitmap is identical with the one that is * on the disk. If not, ask if the disk should be repaired. */ -void chkmap(cmap, dmap, bit, blkno, nblk, type) -bitchunk_t *cmap, *dmap; -bit_nr bit; -block_nr blkno; -int nblk; -char *type; +void chkmap(bitchunk_t *cmap, bitchunk_t *dmap, bit_nr bit, block_nr blkno, int nblk, char *type) { register bitchunk_t *p = dmap, *q = cmap; int report = 1, nerr = 0; @@ -841,7 +793,7 @@ char *type; } /* See if the inodes that aren't allocated are cleared. */ -void chkilist() +void chkilist(void) { register ino_t ino = 1; mode_t mode; @@ -864,7 +816,7 @@ void chkilist() } /* Allocate an array to maintain the inode reference counts in. */ -void getcount() +void getcount(void) { count = (nlink_t *) alloc((unsigned) (sb.s_ninodes + 1), sizeof(nlink_t)); } @@ -898,7 +850,7 @@ void counterror(ino_t ino) * Thus, when the whole file system has been traversed, all the entries * should be zero. */ -void chkcount() +void chkcount(void) { register ino_t ino; @@ -908,7 +860,7 @@ void chkcount() } /* Deallocate the `count' array. */ -void freecount() +void freecount(void) { free((char *) count); } @@ -983,10 +935,7 @@ int Remove(dir_struct *dp) } /* Convert string so that embedded control characters are printable. */ -void make_printable_name(dst, src, n) -register char *dst; -register char *src; -register int n; +void make_printable_name(register char *dst, register char *src, register int n) { register int c; @@ -1194,11 +1143,7 @@ int chksymlinkzone(ino_t ino, d_inode *ip, off_t pos, zone_nr zno) } /* There is something wrong with the given zone. Print some details. */ -void errzone(mess, zno, level, pos) -char *mess; -zone_nr zno; -int level; -off_t pos; +void errzone(char *mess, zone_nr zno, int level, off_t pos) { printf("%s zone in ", mess); printpath(1, 0); @@ -1215,10 +1160,7 @@ off_t pos; /* Found the given zone in the given inode. Check it, and if ok, mark it * in the zone bitmap. */ -int markzone(zno, level, pos) -zone_nr zno; -int level; -off_t pos; +int markzone(zone_nr zno, int level, off_t pos) { register bit_nr bit = (bit_nr) zno - FIRST + 1; @@ -1259,8 +1201,7 @@ int chkindzone(ino_t ino, d_inode *ip, off_t *pos, zone_nr zno, int level) /* Return the size of a gap in the file, represented by a null zone number * at some level of indirection. */ -off_t jump(level) -int level; +off_t jump(int level) { off_t power = ZONE_SIZE; @@ -1451,8 +1392,7 @@ int chkinode(ino_t ino, d_inode *ip) } /* Check the directory entry pointed to by dp, by checking the inode. */ -int descendtree(dp) -dir_struct *dp; +int descendtree(dir_struct *dp) { d_inode inode; register ino_t ino = dp->d_inum; @@ -1488,7 +1428,7 @@ dir_struct *dp; } /* Check the file system tree. */ -void chktree() +void chktree(void) { dir_struct dir; @@ -1501,7 +1441,7 @@ void chktree() } /* Print the totals of all the objects found. */ -void printtotal() +void printtotal(void) { if(preen) { printf("%d files, %d directories, %d free inodes, %ld free zones\n", @@ -1535,8 +1475,7 @@ void printtotal() * listed by `zlist' should be watched for while checking the file system. */ -void chkdev(f, clist, ilist, zlist) -char *f, **clist, **ilist, **zlist; +void chkdev(char *f, char **clist, char **ilist, char **zlist) { if (automatic) repair = 1; fsck_device = f; @@ -1613,9 +1552,7 @@ char *f, **clist, **ilist, **zlist; devclose(); } -int main(argc, argv) -int argc; -char **argv; +int main(int argc, char **argv) { register char **clist = 0, **ilist = 0, **zlist = 0; int badflag = 0; diff --git a/minix/commands/ifdef/ifdef.c b/minix/commands/ifdef/ifdef.c index 1c39d21a9..8a54844dc 100644 --- a/minix/commands/ifdef/ifdef.c +++ b/minix/commands/ifdef/ifdef.c @@ -66,13 +66,11 @@ void gettable(void); void parse(void); void usage(void); -#ifdef __STDC__ + +/* Get next arg from file into cbuf, */ +/* returning the character that */ +/* terminated it. Cbuf returns 0 */ char fgetarg ( FILE *stream , char *cbuf ) -#else -char fgetarg(stream, cbuf) /* Get next arg from file into cbuf, */ -FILE *stream; /* returning the character that */ -char *cbuf; /* terminated it. Cbuf returns 0 */ -#endif { /* if no arg. EOF is returned if no */ int ch; /* args left in file. */ int i; @@ -95,12 +93,7 @@ char *cbuf; /* terminated it. Cbuf returns 0 */ } -#ifdef __STDC__ int find ( char *sym ) -#else -int find(sym) -char *sym; -#endif { /* Return DEF if defined else UNDEF */ deftemp = defptr; @@ -118,14 +111,10 @@ char *sym; #define Undefine(x,y) defit(x,y,UNDEF) #define Ignore(x,y) defit(x,y,IGN) -#ifdef __STDC__ +/* Add symbol to the define list */ +/* Mode: MUTABLE etc */ +/* Type: DEF, UNDEF, IGN */ void defit ( char *sym , int redef , int type ) -#else -void defit(sym, redef, type) /* Add symbol to the define list */ -char *sym; -char redef; /* Mode: MUTABLE etc */ -char type; /* Type: DEF, UNDEF, IGN */ -#endif { struct DEFINE *temp; char c; @@ -167,11 +156,7 @@ char type; /* Type: DEF, UNDEF, IGN */ -#ifdef __STDC__ void stop ( void ) -#else -void stop() -#endif { /* Stop: Tidy up at EOF */ if (table) printtable(); (void)fclose(zin); @@ -181,23 +166,16 @@ void stop() #define Goto { line++; if (ch!='\n') gotoeoln(); } #define Print { line++; if (ch!='\n') prteoln(); } -#ifdef __STDC__ +/* Go to the end of the line */ void gotoeoln ( void ) -#else -void gotoeoln() /* Go to the end of the line */ -#endif { int ch; while ((ch = fgetc(zin)) != '\n') if (ch == EOF) stop(); } - -#ifdef __STDC__ +/* Print to the end of the line */ void prteoln ( void ) -#else -void prteoln() /* Print to the end of the line */ -#endif { int ch; while ((ch = fgetc(zin)) != '\n') @@ -209,11 +187,8 @@ void prteoln() /* Print to the end of the line */ } -#ifdef __STDC__ +/* Print the defines in the SLL */ void printtable ( void ) -#else -void printtable() /* Print the defines in the SLL */ -#endif { struct DEFINE *temp; @@ -234,11 +209,7 @@ void printtable() /* Print the defines in the SLL */ } } -#ifdef __STDC__ char getendif ( void ) -#else -char getendif() -#endif { /* Find matching endif when ignoring */ char word[80]; /* Buffer for symbols */ int ch; @@ -268,11 +239,8 @@ char getendif() } -#ifdef __STDC__ +/* Get & print a table of defines etc. */ void gettable ( void ) -#else -void gettable() /* Get & print a table of defines etc. */ -#endif { char word[80]; /* Buffer for symbols */ @@ -313,11 +281,7 @@ void gettable() /* Get & print a table of defines etc. */ -#ifdef __STDC__ void parse ( void ) -#else -void parse() -#endif { /* Parse & remove ifdefs from C source */ char word[80]; /* Buffer for symbols */ int ch; @@ -435,24 +399,14 @@ void parse() } -#ifdef __STDC__ void usage ( void ) -#else -void usage() -#endif { (void)fprintf(stderr, "Usage: ifdef [-t] [-Dsymbol] [-dsymbol] [-Usymbol] [-Isymbol] \n"); exit(0); } -#ifdef __STDC__ int main(int argc , char *argv []) -#else -int main(argc, argv) -int argc; -char *argv[]; -#endif { char sym[80]; /* Temp symbol storage */ int c; diff --git a/minix/commands/isoread/isoread.c b/minix/commands/isoread/isoread.c index a2e863b1a..4a635468c 100644 --- a/minix/commands/isoread/isoread.c +++ b/minix/commands/isoread/isoread.c @@ -184,10 +184,7 @@ int Verbose = 0; /* 1 = Print all info on directories */ int ByteOffset = 0; /* 1 = Print byte offset and length of files */ int Aflag = 0; /* 1 = Suppress output of \r */ -int iso_cmp(name, dir_ptr, dir_flag) -char *name; -struct dir_entry *dir_ptr; -int dir_flag; +int iso_cmp(char *name, struct dir_entry *dir_ptr, int dir_flag) { /* Compare name with directory entries, looking for match with a dirname. * An iso9660 filename is terminated by ";n", where n will probably @@ -215,7 +212,7 @@ int dir_flag; } -void usage() +void usage(void) { if (Read_Dir) fprintf (STDERR, "Usage: isodir [-lrB] inputfile [dir]\n"); @@ -227,9 +224,7 @@ void usage() } -int main(argc, argv) -int argc; -char **argv; +int main(int argc, char **argv) { struct dir_entry *entry; char path[MAX_PATH_LENGTH]; @@ -352,8 +347,7 @@ char **argv; } -struct dir_entry *look_up(path) -char *path; +struct dir_entry *look_up(char *path) { /* Lookup a file name */ @@ -428,9 +422,7 @@ char *path; } -void recurse_dir(path, dir_ptr) -char *path; -struct dir_entry *dir_ptr; +void recurse_dir(char *path, struct dir_entry *dir_ptr) { /* Recursively descend all directories starting with dir_ptr */ @@ -503,8 +495,7 @@ struct dir_entry *dir_ptr; } -void list_dir(dir_ptr) -struct dir_entry *dir_ptr; +void list_dir(struct dir_entry *dir_ptr) { /* List all entries in a directory */ int tty; @@ -601,8 +592,7 @@ struct dir_entry *dir_ptr; } -void print_dir_date(date) -char *date; +void print_dir_date(char *date) { /* Print date in a directory entry */ @@ -623,8 +613,7 @@ char *date; } -void list_file(dir_ptr) -struct dir_entry *dir_ptr; +void list_file(struct dir_entry *dir_ptr) { /* List contents of a file */ @@ -658,8 +647,7 @@ struct dir_entry *dir_ptr; } -void print_date(date) -char *date; +void print_date(char *date) { /* Print the date in a volume descriptor */ @@ -680,8 +668,7 @@ char *date; date[13]); } -void iso_info(vol_desc) -struct iso9660_descriptor *vol_desc; +void iso_info(struct iso9660_descriptor *vol_desc) { int i; @@ -711,8 +698,7 @@ struct iso9660_descriptor *vol_desc; } -void hs_info(vol_desc) -struct high_sierra_descriptor *vol_desc; +void hs_info(struct high_sierra_descriptor *vol_desc) { int i; @@ -730,7 +716,7 @@ struct high_sierra_descriptor *vol_desc; } -int valid_fs() +int valid_fs(void) { int i; @@ -764,10 +750,7 @@ int valid_fs() } -void read_device(offset, nr_of_bytes, buffer) -long offset; -int nr_of_bytes; -char *buffer; +void read_device(long offset, int nr_of_bytes, char *buffer) { int bytes_read; @@ -790,15 +773,13 @@ char *buffer; /* The ISO9660 functions */ -int iso_711 (c) -char *c; +int iso_711 (char *c) { return (*c & 0xff); } -int iso_712 (c) -char *c; +int iso_712 (char *c) { int n; @@ -807,20 +788,17 @@ char *c; return n; } -int iso_721 (c) -char *c; +int iso_721 (char *c) { return ((c[0] & 0xff) | ((c[1] & 0xff) << 8)); } -int iso_722 (c) -char *c; +int iso_722 (char *c) { return (((c[0] & 0xff) << 8) | (c[1] & 0xff)); } -int iso_723 (c) -char *c; +int iso_723 (char *c) { if (c[0] != c[3] || c[1] != c[2]) { @@ -830,8 +808,7 @@ char *c; return (iso_721 (c)); } -long iso_731 (c) -char *c; +long iso_731 (char *c) { return ((long)(c[0] & 0xff) | ((long)(c[1] & 0xff) << 8) @@ -840,8 +817,7 @@ char *c; } -long iso_732 (c) -char *c; +long iso_732 (char *c) { return (((long)(c[0] & 0xff) << 24) | (((long)c[1] & 0xff) << 16) @@ -849,8 +825,7 @@ char *c; | ((long)c[3] & 0xff)); } -long iso_733 (c) -char *c; +long iso_733 (char *c) { int i; diff --git a/minix/commands/mail/mail.c b/minix/commands/mail/mail.c index e9a553fb9..5550c2694 100644 --- a/minix/commands/mail/mail.c +++ b/minix/commands/mail/mail.c @@ -91,9 +91,7 @@ char *whoami(void); void dohelp(void); int filesize(char *name); -int main(argc, argv) -int argc; -char *argv[]; +int main(int argc, char *argv[]) { int c; @@ -161,9 +159,7 @@ char *argv[]; return(0); } -int deliver(count, vec) -int count; -char *vec[]; +int deliver(int count, char *vec[]) { int i, j; int errs = 0; /* count of errors */ @@ -343,7 +339,7 @@ nobox: * for interactive mails, this might be the place to do it (though the * case where a MAILER is being used would also need to be handled). */ -FILE *makerewindable() +FILE *makerewindable(void) { FILE *tempfp; /* temp file used for copy */ int c; /* character being copied */ @@ -387,8 +383,7 @@ done: return tempfp; } -int copy(fromfp, tofp) -FILE *fromfp, *tofp; +int copy(FILE *fromfp, FILE *tofp) { int c; /* character being copied */ int state; /* ".\n" and postmark detection state */ @@ -455,7 +450,7 @@ done: return 0; } -void readbox() +void readbox(void) { char linebuf[512]; struct letter *let; @@ -496,7 +491,7 @@ void readbox() } } -void printall() +void printall(void) { struct letter *let; @@ -512,7 +507,7 @@ void printall() } } -void interact() +void interact(void) { char linebuf[512]; /* user input line */ struct letter *let, *next; /* current and next letter */ @@ -592,15 +587,13 @@ void interact() } } -void onint(dummy) -int dummy; /* to satisfy ANSI compilers */ +/* dummy to satisfy ANSI compilers */ +void onint(int dummy) { longjmp(printjump, 1); } -void savelet(let, savefile) -struct letter *let; -char *savefile; +void savelet(struct letter *let, char *savefile) { int waitstat, pid; FILE *savefp; @@ -628,7 +621,7 @@ char *savefile; exit(0); } -void updatebox() +void updatebox(void) { FILE *tempfp; /* fp for tempfile */ char lockname[PATHLEN]; /* maildrop lock */ @@ -683,9 +676,7 @@ void updatebox() if (usedrop) unlink(lockname); } -void printlet(let, tofp) -struct letter *let; -FILE *tofp; +void printlet(struct letter *let, FILE *tofp) { off_t current, limit; int c; @@ -699,8 +690,7 @@ FILE *tofp; } } -void doshell(command) -char *command; +void doshell(char *command) { int waitstat, pid; char *shell; @@ -725,14 +715,13 @@ char *command; exit(127); } -void usage() +void usage(void) { fprintf(stderr, "usage: mail [-epqr] [-f file]\n"); fprintf(stderr, " mail [-dtv] [-s subject] user [...]\n"); } -char *basename(name) -char *name; +char *basename(char *name) { char *p; @@ -742,7 +731,7 @@ char *name; return p + 1; } -char *whoami() +char *whoami(void) { struct passwd *pw; @@ -752,7 +741,7 @@ char *whoami() return "nobody"; } -void dohelp() +void dohelp(void) { FILE *fp; char buffer[80]; @@ -768,8 +757,7 @@ void dohelp() fclose(fp); } -int filesize(name) -char *name ; +int filesize(char *name) { struct stat buf; diff --git a/minix/commands/mount/mount.c b/minix/commands/mount/mount.c index eafa6681d..4166ee9e2 100644 --- a/minix/commands/mount/mount.c +++ b/minix/commands/mount/mount.c @@ -20,9 +20,7 @@ int mount_all(void); static int write_mtab = 1; -int main(argc, argv) -int argc; -char *argv[]; +int main(int argc, char *argv[]) { int all = 0, i, v = 0, mountflags, srvflags; char **ap, *opt, *err, *type, *args, *device; @@ -88,7 +86,7 @@ char *argv[]; return(EXIT_SUCCESS); } -void list() +void list(void) { int n; char dev[PATH_MAX], mountpoint[PATH_MAX], type[MNTNAMELEN], flags[MNTFLAGLEN]; @@ -121,7 +119,7 @@ has_opt(char *mntopts, char *option) int -mount_all() +mount_all(void) { struct fstab *fs; int ro, mountflags; @@ -165,7 +163,7 @@ mount_all() return(EXIT_SUCCESS); } -void usage() +void usage(void) { std_err("Usage: mount [-a] [-r] [-e] [-t type] [-o options] special name\n"); exit(1); diff --git a/minix/commands/playwave/playwave.c b/minix/commands/playwave/playwave.c index 3a59e780a..943d56998 100644 --- a/minix/commands/playwave/playwave.c +++ b/minix/commands/playwave/playwave.c @@ -60,7 +60,7 @@ DWORD data_len; /******** End of wave definitions *********/ -void usage() +void usage(void) { fprintf(stderr, "Usage: playwav [-i] file\n"); exit(-1); diff --git a/minix/commands/prep/prep.c b/minix/commands/prep/prep.c index acbded7ec..1551fe7e9 100644 --- a/minix/commands/prep/prep.c +++ b/minix/commands/prep/prep.c @@ -17,9 +17,7 @@ void skipline(void); int backslash(void); void usage(void); -int main(argc, argv) -int argc; -char *argv[]; +int main(int argc, char *argv[]) { int c; @@ -66,7 +64,7 @@ char *argv[]; } -void skipline() +void skipline(void) { char c; @@ -74,7 +72,7 @@ void skipline() } -int backslash() +int backslash(void) { /* A backslash has been seen. Eat troff stuff. */ @@ -129,7 +127,7 @@ int backslash() } } -void usage() +void usage(void) { printf("Usage: prep [file]\n"); exit(1); diff --git a/minix/commands/printroot/printroot.c b/minix/commands/printroot/printroot.c index c6afd4efc..b2278d50a 100644 --- a/minix/commands/printroot/printroot.c +++ b/minix/commands/printroot/printroot.c @@ -31,9 +31,7 @@ int rflag; int main(int argc, char **argv); void done(char *name, int status); -int main(argc, argv) -int argc; -char **argv; +int main(int argc, char **argv) { DIR *dp; struct dirent *entry; @@ -56,9 +54,7 @@ char **argv; return(0); /* not reached */ } -void done(name, status) -char *name; -int status; +void done(char *name, int status) { int v; diff --git a/minix/commands/profile/profile.c b/minix/commands/profile/profile.c index 43ec45547..f69a9e2dc 100644 --- a/minix/commands/profile/profile.c +++ b/minix/commands/profile/profile.c @@ -196,7 +196,7 @@ int handle_args(int argc, char *argv[]) } -int start() +int start(void) { /* This is the "starter process" for statistical profiling. * @@ -262,7 +262,7 @@ int start() } -int stop() +int stop(void) { /* This is the "stopper" process for statistical profiling. * @@ -296,7 +296,7 @@ int stop() } -int alloc_mem() +int alloc_mem(void) { if ((mem_ptr = malloc(mem_size)) == 0) { fprintf(stderr, "Unable to allocate memory.\n"); @@ -308,7 +308,7 @@ int alloc_mem() } -int init_outfile() +int init_outfile(void) { if ((outfile_fd = open(outfile, O_CREAT | O_TRUNC | O_WRONLY)) <= 0) { fprintf(stderr, "Unable to create outfile %s.\n", outfile); diff --git a/minix/commands/progressbar/progressbar.c b/minix/commands/progressbar/progressbar.c index 4065fa9e5..eb25bf375 100644 --- a/minix/commands/progressbar/progressbar.c +++ b/minix/commands/progressbar/progressbar.c @@ -44,9 +44,7 @@ prettyprogress(long b, long maxb, time_t starttime) return; } -int main(argc, argv) -int argc; -char *argv[]; +int main(int argc, char *argv[]) { long i = 0, count = 0; int l; diff --git a/minix/commands/recwave/recwave.c b/minix/commands/recwave/recwave.c index cef26fb29..f90c09b6c 100644 --- a/minix/commands/recwave/recwave.c +++ b/minix/commands/recwave/recwave.c @@ -74,7 +74,7 @@ int old_stdin; struct termios old_tty, new_tty; int audio, file; -void usage() +void usage(void) { fprintf(stderr, "Usage: recwav [-b -s -r] file_name\n"); exit(-1); @@ -90,7 +90,7 @@ void terminate(int s) exit(0); } -void write_wave_header() +void write_wave_header(void) { /* RIFF fields */ r_fields.RIFF_id = RIFF_ID; diff --git a/minix/commands/svrctl/svrctl.c b/minix/commands/svrctl/svrctl.c index e9c2280de..0cd64149f 100644 --- a/minix/commands/svrctl/svrctl.c +++ b/minix/commands/svrctl/svrctl.c @@ -104,7 +104,7 @@ int main (int argc, char *argv[]) return(EXIT_FAILURE); } -static void usage() +static void usage(void) { fprintf(stderr, "Usage:\n"); fprintf(stderr, " %s set \n", bin_name); diff --git a/minix/commands/swifi/db_access.c b/minix/commands/swifi/db_access.c index 2f8744534..bee593ae3 100644 --- a/minix/commands/swifi/db_access.c +++ b/minix/commands/swifi/db_access.c @@ -46,10 +46,7 @@ static unsigned db_extend[] = { /* table for sign-extending */ }; void -db_read_bytes(addr, size, data) - vm_offset_t addr; - register int size; - register char *data; +db_read_bytes(vm_offset_t addr, register int size, register char *data) { register char *src; @@ -60,10 +57,7 @@ db_read_bytes(addr, size, data) } db_expr_t -db_get_value(addr, size, is_signed) - db_addr_t addr; - register int size; - boolean_t is_signed; +db_get_value(db_addr_t addr, register int size, boolean_t is_signed) { char data[sizeof(int)]; register db_expr_t value; diff --git a/minix/commands/swifi/db_disasm.c b/minix/commands/swifi/db_disasm.c index 9d86ac3ad..fa4990ca0 100644 --- a/minix/commands/swifi/db_disasm.c +++ b/minix/commands/swifi/db_disasm.c @@ -866,11 +866,7 @@ static db_addr_t * Read address at location and return updated location. */ static db_addr_t -db_read_address(loc, short_addr, regmodrm, addrp) - db_addr_t loc; - int short_addr; - int regmodrm; - struct i_addr * addrp; /* out */ +db_read_address(db_addr_t loc, int short_addr, int regmodrm, struct i_addr *addrp /* out */) { int mod, rm, sib, index, disp; diff --git a/minix/commands/swifi/extra.c b/minix/commands/swifi/extra.c index b67461b14..2416cfcd4 100644 --- a/minix/commands/swifi/extra.c +++ b/minix/commands/swifi/extra.c @@ -137,10 +137,7 @@ void text_write_ub(void *addr, unsigned char value) } } -void load_nlist(exe_name, btextp, etextp) -char *exe_name; -unsigned long *btextp; -unsigned long *etextp; +void load_nlist(char *exe_name, unsigned long *btextp, unsigned long *etextp) { int i; unsigned long btext, etext; diff --git a/minix/commands/synctree/synctree.c b/minix/commands/synctree/synctree.c index e5fff703a..1a03e460b 100644 --- a/minix/commands/synctree/synctree.c +++ b/minix/commands/synctree/synctree.c @@ -126,7 +126,7 @@ struct mode { static char *arg0; /* basename(argv[0]) */ static int ex= 0; /* exit status. */ -static void because() +static void because(void) { fprintf(stderr, ": %s\n", strerror(errno)); ex= 1; @@ -255,7 +255,7 @@ static void sort(struct entry **ae) } } -static void enter() +static void enter(void) /* Collect directory entries of E. */ { struct entry **last= &E->con, *new; @@ -399,7 +399,7 @@ static char *link_islink(struct stat *stp, const char *file) #define cancellink() ((void) islink()) -static char *islink() +static char *islink(void) /* Returns the name of the file path is linked to. If no such link can be * found, then path is added to the list and nil is returned. If all the * links of a file have been seen, then it is removed from the list. @@ -464,7 +464,7 @@ static int getstat(char *name, struct stat *stp) return 0; } -static int advance() +static int advance(void) /* Determine next pathname, return true on success. */ { for (;;) { @@ -517,7 +517,7 @@ static int advance() return 1; } -static enum orders request() +static enum orders request(void) /* Slave reads command sent by master. */ { static char buf[64], *bp; @@ -547,7 +547,7 @@ static enum orders request() return (enum orders) req; } -static void report() +static void report(void) { int r; @@ -614,7 +614,7 @@ static void sendstat(struct stat *stp) static int ask(); -static void slave() +static void slave(void) /* Carry out orders from the master, such as transmitting path names. * Note that the slave uses path, not Spath, the master uses Spath. */ @@ -763,7 +763,7 @@ static void rread(char *buf, int n) } } -static enum answers answer() +static enum answers answer(void) /* Master reads slave's reply. */ { char c; @@ -777,7 +777,7 @@ static enum answers answer() return (enum answers) a; } -static long recnum() +static long recnum(void) /* Read number as pack of bytes from least to most significant. The data * is on the wire in little-endian format. (Mostly run on PC's). */ @@ -822,7 +822,7 @@ static void recstat(struct stat *stp) stp->st_mtime= recnum(); } -static int key() +static int key(void) { int c; static int tty= -1; @@ -1105,7 +1105,7 @@ static int delete(int update) return 1; } -static int different() +static int different(void) /* Return true iff path and Spath are different. */ { if (! ( (linkpath == nil && Slinkpath == nil) @@ -1136,7 +1136,7 @@ static int different() } } -static void compare() +static void compare(void) /* See if path and Spath are same. */ { if (different()) { @@ -1158,7 +1158,7 @@ static void compare() static int done= 0, Sdone= 0; -static enum action { ADD, COMPARE, DELETE } action() +static enum action { ADD, COMPARE, DELETE } action(void) /* Look at path's of master and slave, compare them alphabetically to see * who is ahead of who, then tell what is to be done. */ @@ -1178,7 +1178,7 @@ static enum action { ADD, COMPARE, DELETE } action() return (c= strcmp(Sp, p)) == 0 ? COMPARE : c < 0 ? ADD : DELETE; } -static void master() +static void master(void) /* Synchronise file tree to that of its slave. */ { enum action a= COMPARE; /* Trick first advances. */ @@ -1244,7 +1244,7 @@ static void master() order(ex == 0 ? DIE : DIE_BAD); } -static void mediator() +static void mediator(void) /* Sits at the local machine and passes orders from master to slave, both * on remote machines. Only diagnostics and questions are handled. */ @@ -1346,7 +1346,7 @@ void splitcolon(char *path, char **amach, char **adir) } } -static void Usage() +static void Usage(void) { fprintf(stderr, "Usage: %s [-iuf] [[user@]machine:]dir1 [[user@]machine:]dir2\n", diff --git a/minix/commands/term/term.c b/minix/commands/term/term.c index b1c2c7b2a..ed3d24f56 100644 --- a/minix/commands/term/term.c +++ b/minix/commands/term/term.c @@ -125,9 +125,7 @@ void set_uart(int argc, char *argv[], struct termios *tcp); void set_raw(struct termios *tcp); void quit(int code); -int main(argc, argv) -int argc; -char *argv[]; +int main(int argc, char *argv[]) { int i; unsigned char key; @@ -298,8 +296,7 @@ void tell(int fd, ...) } -void reader(on) -int on; +void reader(int on) { /* Start or end a process that copies from the modem to the screen. */ @@ -390,8 +387,7 @@ void shell(char *cmd) } -void lock_device(device) -char *device; +void lock_device(char *device) { /* Lock a device by creating a lock file using SYSV style locking. */ @@ -473,10 +469,7 @@ void setnum(char *s, int n) } -void set_uart(argc, argv, tcp) -int argc; -char *argv[]; -struct termios *tcp; +void set_uart(int argc, char *argv[], struct termios *tcp) { /* Set up the UART parameters. */ @@ -515,8 +508,7 @@ struct termios *tcp; } -void set_raw(tcp) -struct termios *tcp; +void set_raw(struct termios *tcp) { /* Set termios attributes for RAW mode. */ @@ -528,8 +520,7 @@ struct termios *tcp; } -void quit(code) -int code; +void quit(int code) { /* Stop the reader process, reset the terminal, and exit. */ reader(0); diff --git a/minix/commands/termcap/termcap.c b/minix/commands/termcap/termcap.c index 8873260e4..f0aaf471f 100644 --- a/minix/commands/termcap/termcap.c +++ b/minix/commands/termcap/termcap.c @@ -20,9 +20,7 @@ int main(int argc, char **argv); void Print(char *comment, char *name); void Error(char *message, char *arg); -int main(argc, argv) -int argc; -char *argv[]; +int main(int argc, char **argv) { char *term; @@ -154,9 +152,7 @@ void Print( comment, name ) /****************************************************************/ -void Error( message, arg ) - char *message; - char *arg; +void Error( char *message, char *arg ) { fprintf( stderr, message, arg ); diff --git a/minix/commands/umount/umount.c b/minix/commands/umount/umount.c index 411a9da5b..7b6a836f8 100644 --- a/minix/commands/umount/umount.c +++ b/minix/commands/umount/umount.c @@ -22,9 +22,7 @@ void usage(void); static char device[PATH_MAX], mount_point[PATH_MAX], type[MNTNAMELEN], flags[MNTFLAGLEN]; -int main(argc, argv) -int argc; -char *argv[]; +int main(int argc, char *argv[]) { int found; int umount_flags = 0UL; @@ -62,8 +60,7 @@ char *argv[]; return(0); } -int find_mtab_entry(name) -char *name; +int find_mtab_entry(char *name) { /* Find a matching mtab entry for 'name' which may be a special or a path, * and generate a new mtab file without this entry on the fly. Do not write @@ -97,7 +94,7 @@ char *name; return found; } -void usage() +void usage(void) { std_err("Usage: umount [-e] name\n"); exit(1); diff --git a/minix/commands/update/update.c b/minix/commands/update/update.c index 2c1d8783c..209f91680 100644 --- a/minix/commands/update/update.c +++ b/minix/commands/update/update.c @@ -6,7 +6,7 @@ int main(void); -int main() +int main(void) { /* Release all (?) open file descriptors. */ close(0); diff --git a/minix/commands/vol/vol.c b/minix/commands/vol/vol.c index 7036a77c2..08b3447b9 100644 --- a/minix/commands/vol/vol.c +++ b/minix/commands/vol/vol.c @@ -58,9 +58,7 @@ void tape_inquire(char *name, int fd); void allocate_buffer(void); void diskio(int fd1, int fd2, char *file1, char *file2); -int main(argc, argv) -int argc; -char *argv[]; +int main(int argc, char *argv[]) { int volume = 1, fd, tty, i, init, autovolsize; char *p, *name; @@ -208,18 +206,14 @@ char *argv[]; } } -void usage() +void usage(void) { fprintf(stderr, "Usage: vol [-rw1] [-b blocksize] [-m max] [size] block-special\n"); exit(1); } -long str2size(name, str, min, max, assume_kb) -char *name; -char *str; -long min, max; -int assume_kb; +long str2size(char *name, char *str, long min, long max, int assume_kb) { /* Convert a string to a size. The number may be followed by 'm', 'k', 'b' * or 'w' to multiply the size as shown below. If 'assume_kb' is set then @@ -259,9 +253,7 @@ int assume_kb; return size; } -void tape_inquire(name, fd) -char *name; -int fd; +void tape_inquire(char *name, int fd) { /* If the device happens to be a tape, then what is its block size? */ struct mtget mtget; @@ -288,7 +280,7 @@ int fd; } } -void allocate_buffer() +void allocate_buffer(void) { /* Set block size and maximum multiple. */ if (block_size == 0) block_size = variable ? 1 : FIX_BLKSIZ; @@ -313,9 +305,7 @@ void allocate_buffer() } } -void diskio(fd1, fd2, file1, file2) -int fd1, fd2; -char *file1, *file2; +void diskio(int fd1, int fd2, char *file1, char *file2) { /* Read 'volume_size' bytes from 'fd1' and write them on 'fd2'. Watch out for * the fact that reads on pipes can return less than the desired data. diff --git a/minix/commands/zmodem/rbsb.c b/minix/commands/zmodem/rbsb.c index c8f6fbcd0..810016ba3 100644 --- a/minix/commands/zmodem/rbsb.c +++ b/minix/commands/zmodem/rbsb.c @@ -62,7 +62,7 @@ Howmany must be 255 or less */ int Fromcu; /* Were called from cu or yam */ -void from_cu() +void from_cu(void) { struct stat a, b; @@ -71,7 +71,7 @@ void from_cu() return; } -void cucheck() +void cucheck(void) { if (Fromcu) fprintf(stderr,"Please read the manual page BUGS chapter!\r\n"); @@ -123,7 +123,7 @@ char checked = '\0' ; /* * Nonblocking I/O is a bit different in System V, Release 2 */ -int rdchk(f) +int rdchk(int f) { int lf, savestat; @@ -170,8 +170,7 @@ int iofd = 0; /* File descriptor for ioctls & reads */ * 1: save old tty stat, set raw mode * 0: restore original tty mode */ -int mode(n) -int n; +int mode(int n) { static int did0 = FALSE; @@ -397,7 +396,7 @@ int n; } } -void sendbrk() +void sendbrk(void) { #ifdef POSIX tcsendbreak(iofd, 1); diff --git a/minix/commands/zmodem/rz.c b/minix/commands/zmodem/rz.c index 946be48fb..a04582177 100644 --- a/minix/commands/zmodem/rz.c +++ b/minix/commands/zmodem/rz.c @@ -178,7 +178,7 @@ FILE *fout; * Routine to calculate the free bytes on the current file system * ~0 means many free bytes (unknown) */ -long getfree() +long getfree(void) { return(~0L); /* many free bytes ... */ } @@ -240,8 +240,7 @@ jmp_buf tohere; /* For the interrupt on RX timeout */ int tryzhdrtype=ZRINIT; /* Header type to send corresponding to Last rx close */ -void alrm(sig) -int sig; +void alrm(int sig) { longjmp(tohere, -1); } @@ -373,7 +372,7 @@ int main(int argc, char *argv[]) } -int usage() +int usage(void) { cucheck(); #ifdef vax11c @@ -513,7 +512,7 @@ et_tu: * Jack M. Wierda and Roderick W. Hart */ -int wcrx() +int wcrx(void) { register int sectnum, sectcurr; register char sendchar; @@ -711,7 +710,7 @@ int readline(int timeout) /* * Purge the modem input queue of all characters */ -void purgeline() +void purgeline(void) { Lleft = 0; #ifdef USG @@ -1032,7 +1031,7 @@ void zperr(char *s, char *p, char *u) } /* send cancel string to get the other end to shut up */ -void canit() +void canit(void) { static char canistr[] = { 24,24,24,24,24,24,24,24,24,24,8,8,8,8,8,8,8,8,8,8,0 @@ -1113,7 +1112,7 @@ void checkpath(char *name) * Return ZFILE if Zmodem filename received, -1 on error, * ZCOMPL if transaction finished, else 0 */ -int tryz() +int tryz(void) { register int c, n; register int cmdzack1flg; @@ -1209,7 +1208,7 @@ again: /* * Receive 1 or more files with ZMODEM protocol */ -int rzfiles() +int rzfiles(void) { register int c; @@ -1238,7 +1237,7 @@ int rzfiles() * Receive a file with ZMODEM protocol * Assumes file name frame is in secbuf */ -int rzfile() +int rzfile(void) { register int c, n; long rxbytes; @@ -1437,7 +1436,7 @@ void zmputs(char *s) /* * Close the receive dataset, return OK or ERROR */ -int closeit() +int closeit(void) { time_t q; @@ -1468,7 +1467,7 @@ int closeit() /* * Ack a ZFIN packet, let byegones be byegones */ -void ackbibi() +void ackbibi(void) { register int n; diff --git a/minix/commands/zmodem/sz.c b/minix/commands/zmodem/sz.c index cc256d6f1..9edc03745 100644 --- a/minix/commands/zmodem/sz.c +++ b/minix/commands/zmodem/sz.c @@ -652,7 +652,7 @@ int wctxpn(char *name) return OK; } -int getnak() +int getnak(void) { register int firstch; @@ -850,7 +850,7 @@ int filbuf(char *buf, int count) } /* Fill buffer with blklen chars */ -int zfilbuf() +int zfilbuf(void) { int n; @@ -984,13 +984,13 @@ int readline(int timeout) return (byt[0]&0377); } -void flushmo() +void flushmo(void) { fflush(stdout); } -void purgeline() +void purgeline(void) { #ifdef USG ioctl(iofd, TCFLSH, 0); @@ -1001,7 +1001,7 @@ void purgeline() #endif /* send cancel string to get the other end to shut up */ -void canit() +void canit(void) { static char canistr[] = { 24,24,24,24,24,24,24,24,24,24,8,8,8,8,8,8,8,8,8,8,0 @@ -1099,7 +1099,7 @@ char *babble[] = { "" }; -int usage() +int usage(void) { char **pp; @@ -1115,7 +1115,7 @@ int usage() /* * Get the receiver's init parameters */ -int getzrxinit() +int getzrxinit(void) { register int n; struct stat f; @@ -1220,7 +1220,7 @@ int getzrxinit() } /* Send send-init information */ -int sendzsinit() +int sendzsinit(void) { register int c; @@ -1308,7 +1308,7 @@ again: } /* Send the data in the file */ -int zsendfdata() +int zsendfdata(void) { register int c, e, n; register int newcnt; @@ -1564,7 +1564,7 @@ int getinsync(int flag) /* Say "bibi" to the receiver, try to do it cleanly */ -void saybibi() +void saybibi(void) { for (;;) { stohdr(0L); /* CAF Was zsbhdr - minor change */