[comp.os.minix] correction for Turbo C diff's

aiv@euraiv1.UUCP (Eelco van Asperen) (08/20/87)

I just found out that I made an error in the creation of the diff's
for Minix I posted a few weeks ago; apparently, something went wrong
with the diff-file for fsck.c. So here it is again;

[I've just incorporated the 1.2 changes; should I repost the Turbo C
diff's ?]

Eelco van Asperen.

-----------------------------------------+------------------------------
Erasmus University Rotterdam             |uucp:mcvax!eurifb!euraiv1!evas
Fac. of Economics, Computer Science Dept.|earn:asperen@hroeur5
PO.box  1738 / 3000 DR  Rotterdam        |       
T H E    N E T H E R L A N D S           |Yet Another Silly Signature.
-----------------------------------------+------------------------------

----------file: fsck.dif--------------------------------------------

6,9c6,10
< #include "../fs/type.h"
< 
< /* #define DOS			/* compile to run under MS-DOS */
< #define STANDALONE		/* compile for the boot-diskette */
---
> 
> #undef printf /* ../fs/const.h redefines printf as printk !! */
> 
> #include "../fs/type.h"
> 
90a92,93
> 
> #ifndef TURBO
94a98
> #endif
176c180,182
< #define atol(s) atoi(s)		/* kludge for C86 (no atol(s) in library) */
---
> # ifdef C86
> #  define atol(s) atoi(s)	/* kludge for C86 (no atol(s) in library) */
> # endif
199a206,207
> #ifndef TURBO
> 
208,210c216,240
< #ifndef STANDALONE
< # ifdef DOS
< #  include "/lib/c86/stdio.h"
---
> #endif
> 
> #ifndef STANDALONE
> # ifdef DOS
> #  ifdef TURBO
> 
>      /* Print the given character. */
>      putchar(c){
>      	if (c == '\n')
>      		putc('\r');
>      	putc(c);
>      }
> 
>      /* Get a character from the user and echo it. */
>      getchar(){
>      	register c;
> 
>      	if ((c = getc() & 0xFF) == '\r')
>      		c = '\n';
>      	putchar(c);
>      	return(c);
>      }
> #  else
> #   include <stdio.h>
> #  endif
214,215c244,248
< /* Print the given character. */
< putchar(c){
---
> extern void putc(char);
> extern int getc(void);
> 
> /* Print the given character. */
> putchar(int c){
222,223c255,256
< getchar(){
< 	register c;
---
> int getchar(void){
> 	register int c;
235,238c268
< printnum(n, base, sign, width, pad)
< long n;
< int base, sign;
< int width, pad;
---
> printnum(long n, int base, int sign, int width, int pad)
276c306,307
< printchar(c, mode){
---
> printchar(int c, int mode)
> {
297a329,330
> #ifndef TURBO
> 
357,372c390,452
< 
< /* Initialize the variables used by this program.
<  */
< initvars(){
< 	register level;
< 
< #ifdef STANDALONE
< 	  brk = &end;
< #endif
< 	nregular = ndirectory = nblkspec = ncharspec = nbadinode = 0;
< 	for (level = 0; level < NLEVEL; level++)
< 		ztype[level] = 0;
< 	changed = 0;
< 	firstlist = 1;
< 	firstcnterr = 1;
< 	thisblk = NO_BLOCK;
---
> #else /*TURBO*/
> 
> /* we have to use an explicit path since we use Turbo C to
> * do Minix development and normally only want to use the Minix
> * header files;
> */
> #include "\tc\include\stdarg.h"
> 
> #define prn(t,b,s)	{ printnum((long)va_arg(argptr,t),b,s,width,pad); width = 0; }
> #define prc(c)		{ width -= printchar(c, mode); }
> 
> 
> /* Print the arguments according to format.
>  */
> printf(char *format, ...)
> {
> 	register char *fmt, *s;
> 	register short width, pad, mode;
> 	va_list argptr;
> 
> 	va_start(argptr,format);
> 
> 	for (fmt = format; *fmt != 0; fmt++)
> 		switch(*fmt) {
> 		case '\n': putchar('\r');
> 		default:   putchar(*fmt);
> 			   break;
> 		case '%':
> 			if (*++fmt == '-')
> 				fmt++;
> 			pad = *fmt == '0' ? '0' : ' ';
> 			width = 0;
> 			while (isdigit(*fmt)) {
> 				width *= 10;
> 				width += *fmt++ - '0';
> 			}
> 			if (*fmt == 'l' && islower(*++fmt))
> 				*fmt = toupper(*fmt);
> 			mode = isupper(*fmt);
> 			switch (*fmt) {
> 			case 'c':
> 			case 'C':  prc(va_arg(argptr,char));	break;
> 			case 'b':  prn(unsigned,  2, 0);	break;
> 			case 'B':  prn(long,      2, 0);	break;
> 			case 'o':  prn(unsigned,  8, 0);	break;
> 			case 'O':  prn(long,      8, 0);	break;
> 			case 'd':  prn(int,      10, 1);	break;
> 			case 'D':  prn(long,     10, 1);	break;
> 			case 'u':  prn(unsigned, 10, 0);	break;
> 			case 'U':  prn(long,     10, 0);	break;
> 			case 'x':  prn(unsigned, 16, 0);	break;
> 			case 'X':  prn(long,     16, 0);	break;
> 			case 's':
> 			case 'S':  s = va_arg(argptr,char *);
> 				   while (*s) prc(*s++);	break;
> 			case '\0': break;
> 			default:   putchar(*fmt);
> 			}
> 			while (width-- > 0)
> 				putchar(pad);
> 		}
> 
> 	va_end(argptr);
376,385c456,473
< 
< /* Copy n bytes.
<  */
< copy(p, q, n)
< register char *p, *q;
< register int n;
< {
< 	do
< 		*q++ = *p++;
< 	while (--n);
---
> #endif
> 
> /* Initialize the variables used by this program.
>  */
> initvars(void)
> {
> 	register level;
> 
> #ifdef STANDALONE
> 	  brk = &end;
> #endif
> 	nregular = ndirectory = nblkspec = ncharspec = nbadinode = 0;
> 	for (level = 0; level < NLEVEL; level++)
> 		ztype[level] = 0;
> 	changed = 0;
> 	firstlist = 1;
> 	firstcnterr = 1;
> 	thisblk = NO_BLOCK;
389,396c477,484
< /* Print the string `s' and exit.
<  */
< fatal(s)
< char *s;
< {
< 	printf("%s\n", s);
< 	printf("fatal\n");
< 	exit(-1);
---
> 
> /* Copy n bytes.
>  */
> copy(register char *p, register char *q, register int n)
> {
> 	do
> 		*q++ = *p++;
> 	while (--n);
400,404c488,494
< /* Test for end of line.
<  */
< eoln(c)
< {
< 	return(c < 0 || c == '\n' || c == '\r');
---
> /* Print the string `s' and exit.
>  */
> fatal(char *s)
> {
> 	printf("%s\n", s);
> 	printf("fatal\n");
> 	exit(-1);
407a498,505
> /* Test for end of line.
>  */
> eoln(c)
> {
> 	return(c < 0 || c == '\n' || c == '\r');
> }
> 
> 
411,412c509
< yes(question)
< char *question;
---
> yes(char *question)
434,435c531
< atoo(s)
< char *s;
---
> atoo(char *s)
448,449c544
< input(buf, size)
< char *buf;
---
> input(char *buf, int size)
474,475c569
< char *alloc(nelem, elsize)
< unsigned nelem, elsize;
---
> char *alloc(unsigned int nelem, unsigned int elsize)
479c573
< 	register *r;
---
> 	register int *r;
509,510c603
< printname(s)
< char *s;
---
> printname(char *s)
525,526c618
< printrec(sp)
< struct stack *sp;
---
> printrec(struct stack *sp)
537c629,630
< printpath(mode, nlcr){
---
> printpath(int mode, int nlcr)
> {
584,585c677,679
< #ifdef STANDALONE
< disktype()
---
> 
> #ifdef STANDALONE
> disktype(void)
621,622c715
< devio(bno, dir)
< block_nr bno;
---
> devio(block_nr bno, int dir)
684,686c777
< devread(offset, buf, size)
< long offset;
< char *buf;
---
> devread(long offset, char *buf, int size)
695,697c786
< devwrite(offset, buf, size)
< long offset;
< char *buf;
---
> devwrite(long offset, char *buf, int size)
710,711c799
< pr(fmt, cnt, s, p)
< char *fmt, *s, *p;
---
> pr(char *fmt, int cnt, char *s, char *p)
761c849,850
< lsuper(){
---
> lsuper(void)
> {
798c887,888
< makedev(){
---
> makedev(void)
> {
827c917,918
< mkfs(){
---
> mkfs(void)
> {
866c957,958
< getsuper(){
---
> getsuper(void)
> {
894c986,987
< chksuper(){
---
> chksuper(void)
> {
941,942c1034
< lsi(clist)
< char **clist;
---
> lsi(char **clist)
980c1072,1073
< unsigned *allocbitmap(nblk){
---
> unsigned *allocbitmap(int nblk)
> {
991,993c1084
< loadbitmap(bitmap, bno, nblk)
< unsigned *bitmap;
< block_nr bno;
---
> loadbitmap(unsigned int *bitmap, block_nr bno, int nblk)
1007,1009c1098
< dumpbitmap(bitmap, bno, nblk)
< unsigned *bitmap;
< block_nr bno;
---
> dumpbitmap(unsigned *bitmap, block_nr bno, int nblk)
1021,1023c1110
< initbitmap(bitmap, bit, nblk)
< unsigned *bitmap;
< bit_nr bit;
---
> initbitmap(unsigned *bitmap, bit_nr bit, int nblk)
1077c1164,1165
< getbitmaps(){
---
> getbitmaps(void)
> {
1082c1170
< 	dirmap = allocbitmap(N_IMAP);
---
> 	dirmap = allocbitmap(N_IMAP); 
1100,1104c1188,1189
< chkword(w1, w2, bit, type, n, report)
< unsigned w1, w2;
< char *type;
< bit_nr bit;
< int *n, *report;
---
> chkword(unsigned int w1, unsigned int w2, bit_nr bit, 
> 	char *type, int *n, int *report)
1121,1125c1206,1207
< chkmap(cmap, dmap, bit, blkno, nblk, nbit, type)
< unsigned *cmap, *dmap;
< bit_nr bit, nbit;
< block_nr blkno;
< char *type;
---
> chkmap(unsigned int *cmap, unsigned int *dmap, bit_nr bit, block_nr blkno, 
> 	int nblk, bit_nr nbit, char *type)
1153c1235,1236
< chkilist(){
---
> chkilist(void)
> {
1177c1260,1261
< getcount(){
---
> getcount(void)
> {
1184,1185c1268
< counterror(ino)
< inode_nr ino;
---
> counterror(inode_nr ino)
1215c1298,1299
< chkcount(){
---
> chkcount(void)
> {
1238,1239c1322
< printperm(mode, shift, special, overlay)
< mask_bits mode;
---
> printperm(mask_bits mode, int shift, int special, int overlay)
1251,1253c1334
< list(ino, ip)
< inode_nr ino;
< d_inode *ip;
---
> list(inode_nr ino, d_inode *ip)
1286,1287c1367
< remove(dp)
< dir_struct *dp;
---
> remove(dir_struct *dp)
1306,1309c1386
< chkdots(ino, pos, dp, exp)
< inode_nr ino, exp;
< file_pos pos;
< dir_struct *dp;
---
> chkdots(inode_nr ino, file_pos pos, dir_struct *dp, inode_nr exp)
1339,1341c1416
< chkname(ino, dp)
< inode_nr ino;
< dir_struct *dp;
---
> chkname(inode_nr ino, dir_struct *dp)
1371,1374c1446
< chkentry(ino, pos, dp)
< inode_nr ino;
< file_pos pos;
< dir_struct *dp;
---
> chkentry(inode_nr ino, file_pos pos, dir_struct *dp)
1429,1433c1501
< chkdirzone(ino, ip, pos, zno)
< inode_nr ino;
< d_inode *ip;
< file_pos pos;
< zone_nr zno;
---
> chkdirzone(inode_nr ino, d_inode *ip, file_pos pos, zone_nr zno)
1469,1472c1537
< errzone(mess, zno, level, pos)
< char *mess;
< zone_nr zno;
< file_pos pos;
---
> errzone(char *mess, zone_nr zno, int level, file_pos pos)
1489,1492c1554
< markzone(ino, zno, level, pos)
< inode_nr ino;
< zone_nr zno;
< file_pos pos;
---
> markzone(inode_nr ino, zone_nr zno, int level, file_pos pos)
1508c1570,1571
< 		errzone("found", ino, zno, level, pos, bit);
---
> 		errzone("found", /*ino,*/ zno, level, pos /*, bit*/);
> 		/* the ino and bit-parameters should not be there I think */
1516,1520c1579
< chkindzone(ino, ip, pos, zno, level)
< inode_nr ino;
< d_inode *ip;
< file_pos *pos;
< zone_nr zno;
---
> chkindzone(inode_nr ino, d_inode *ip, file_pos *pos, zone_nr zno, int level)
1538c1597,1598
< file_pos jump(level){
---
> file_pos jump(int level)
> {
1551,1555c1611
< zonechk(ino, ip, pos, zno, level)
< inode_nr ino;
< d_inode *ip;
< file_pos *pos;
< zone_nr zno;
---
> zonechk(inode_nr ino, d_inode *ip, file_pos *pos, zone_nr zno, int level)
1570,1574c1626,1627
< chkzones(ino, ip, pos, zlist, len, level)
< inode_nr ino;
< d_inode *ip;
< file_pos *pos;
< zone_nr *zlist;
---
> chkzones(inode_nr ino, d_inode *ip, file_pos *pos, zone_nr *zlist, 
> 	int len, int level)
1592,1594c1645
< chkfile(ino, ip)
< inode_nr ino;
< d_inode *ip;
---
> chkfile(inode_nr ino, d_inode *ip)
1608,1610c1659
< chkdirectory(ino, ip)
< inode_nr ino;
< d_inode *ip;
---
> chkdirectory(inode_nr ino, d_inode *ip)
1636,1638c1685
< chkmode(ino, ip)
< inode_nr ino;
< d_inode *ip;
---
> chkmode(inode_nr ino, d_inode *ip)
1665,1667c1712
< chkinode(ino, ip)
< inode_nr ino;
< d_inode *ip;
---
> chkinode(inode_nr ino, d_inode *ip)
1695,1696c1740
< descendtree(dp)
< dir_struct *dp;
---
> descendtree(dir_struct *dp)
1738c1782,1783
< chktree(){
---
> chktree(void)
> {
1753c1798,1799
< printtotal(){
---
> printtotal(void)
> {
1777,1778c1823
< chkdev(f, clist, ilist, zlist)
< char *f, **clist, **ilist, **zlist;
---
> chkdev(char *f, char **clist, char **ilist, char **zlist)
1819,1820c1864,1869
< main(argc, argv)
< char **argv;
---
> #ifdef STANDALONE
> main()
> #else
> main(argc, argv)
> char **argv;
> #endif
1900c1949
< 	disktype()	/* init tracksiz & cylsize for disk in A: */
---
> 	disktype();	/* init tracksiz & cylsize for disk in A: */
1933c1982
< get_partition()
---
> get_partition(void)
1957,1959c2006,2009
< /* This define tells where to find things in partition table. */
< #define P1 0x1C6
< int read_partition()
---
> 
> /* This define tells where to find things in partition table. */
> #define P1 0x1C6
> int read_partition(void)