[comp.os.minix] Diffs for df.c

vizard@dartvax.UUCP (Todd Krein) (05/04/87)

[munch]

	Here's a diff listing of changes I've made to 'df.c'. The changes
give an output more like that from BSD. The old format is still available
by using the '-i' flag.

diff df.c df.new

1a2
> /* modified 5/1/87 to give nice output		Todd Krein */
9a11
> int nice;			/* want a nice listing? */
17a20,21
>   nice = 1;			/* assume yes */
> 
38a43,56
>   if (name[0] == '-') {			/* an option, huh? */
> 	switch(name[1]) {
> 	case 'n':
> 		nice = 1;		/* make it nice */
> 		return;
> 	case 'i':			/* inode stuff */
> 		nice = 0;
> 		return;
> 	default:
> 		prints("Bad option '%c' : df\n",name[1]);
> 		return;
> 	}
>   }
> 
87c105
<   prints("%s ",name);
---
>   prints("%s ",name);			/* print name in field */
92,100c110,132
<   prints("i-nodes: ");
<   num3(i_count - 1);
<   prints(" used  ");
<   num3(sp->s_ninodes + 1 - i_count);
<   prints(" free      blocks: ");
<   num3(busyblocks);
<   prints(" used  ");
<   num3(totblocks - busyblocks);
<   prints(" free\n");
---
> 
>   if (nice == 0) {			/* wants inode info */
>  	 prints("i-nodes: ");
>  	 num3(i_count - 1);
>  	 prints(" used  ");
>  	 num3(sp->s_ninodes + 1 - i_count);
>  	 prints(" free      blocks: ");
>  	 num3(busyblocks);
>  	 prints(" used  ");
>  	 num3(totblocks - busyblocks);
> 	 prints(" free\n");
>   }
>   else {
> 	prints("Kbytes: ");
> 	num3((int)(((long)totblocks * (long)BLOCK_SIZE)/(long)1000));
> 	prints(" used ");
> 	num3((int)(((long)busyblocks * (long)BLOCK_SIZE)/(long)1000));
> 	prints(" avail ");
> 	num3((int)(((long)(totblocks - busyblocks) * (long)BLOCK_SIZE)/(long)1000));
> 	prints(" capacity ");
> 	num3((int)(((long)busyblocks*(long)100)/(long)totblocks));
> 	prints("%\n");
>   }


	Todd Krein
	vizard@dartvax