Re: df(1): return from main() and simplify maxwidth

2016-03-01 Thread Theo Buehler
I agree that this is nicer.  ok tb@

On Tue, Mar 01, 2016 at 12:42:24PM +0100, Michal Mazurek wrote:
> Index: bin/df/df.c
> ===
> RCS file: /cvs/src/bin/df/df.c,v
> retrieving revision 1.55
> diff -u -p -r1.55 df.c
> --- bin/df/df.c   8 Feb 2016 16:23:54 -   1.55
> +++ bin/df/df.c   1 Mar 2016 11:40:40 -
> @@ -161,23 +161,20 @@ main(int argc, char *argv[])
>   }
>  
>   if (mntsize) {
> - maxwidth = 0;
> + maxwidth = 11;
>   for (i = 0; i < mntsize; i++) {
>   width = strlen(mntbuf[i].f_mntfromname);
>   if (width > maxwidth)
>   maxwidth = width;
>   }
>  
> - if (maxwidth < 11)
> - maxwidth = 11;
> -
>   if (Pflag)
>   posixprint(mntbuf, mntsize, maxwidth);
>   else
>   bsdprint(mntbuf, mntsize, maxwidth);
>   }
>  
> - exit(mntsize ? 0 : 1);
> + return (mntsize ? 0 : 1);
>  }
>  
>  char *
> 
> -- 
> Michal Mazurek
> 



df(1): return from main() and simplify maxwidth

2016-03-01 Thread Michal Mazurek
Index: bin/df/df.c
===
RCS file: /cvs/src/bin/df/df.c,v
retrieving revision 1.55
diff -u -p -r1.55 df.c
--- bin/df/df.c 8 Feb 2016 16:23:54 -   1.55
+++ bin/df/df.c 1 Mar 2016 11:40:40 -
@@ -161,23 +161,20 @@ main(int argc, char *argv[])
}
 
if (mntsize) {
-   maxwidth = 0;
+   maxwidth = 11;
for (i = 0; i < mntsize; i++) {
width = strlen(mntbuf[i].f_mntfromname);
if (width > maxwidth)
maxwidth = width;
}
 
-   if (maxwidth < 11)
-   maxwidth = 11;
-
if (Pflag)
posixprint(mntbuf, mntsize, maxwidth);
else
bsdprint(mntbuf, mntsize, maxwidth);
}
 
-   exit(mntsize ? 0 : 1);
+   return (mntsize ? 0 : 1);
 }
 
 char *

-- 
Michal Mazurek