[BusyBox] [PATCH] Read-only option for losetup.c

Jason Schoon floydpink at gmail.com
Sun Apr 10 19:38:23 UTC 2005


You would prefer he set a variable, broke out of the switch, then
checked that variable to determine that he should break out of the
while?

All of this in code meant to be as compact as possible?

I know GOTO's have a horrible rep, and I use them very sparingly
myself.  However, don't banish them just out of principle.

On Apr 10, 2005 11:24 AM, Bastian Blank <waldi at debian.org> wrote:
> On Sun, Apr 10, 2005 at 09:33:50AM -0400, Rob Landley wrote:
> > -  while ((opt = getopt (argc, argv, "do:")) != -1)
> > -    switch (opt)
> > -      {
> > +  for(;;) {
> > +    switch (getopt(argc, argv, "do:r")) {
> >        case 'd':
> >       delete = 1;
> >       break;
> > @@ -41,19 +40,26 @@
> >        case 'o':
> >       offset = bb_xparse_number (optarg, NULL);
> >       break;
> > -
> > +
> > +      case 'r':
> > +     readonly=1;
> > +     break;
> > +
> > +      case -1:
> > +     goto done;
> > +
> >        default:
> >       bb_show_usage();
> >        }
> > -
> > +  }
> > +done:
> 
> WAH. Don't use goto if not necesary. And no, it is not.
> 
> Bastian
> 
> --
> Conquest is easy. Control is not.
>                 -- Kirk, "Mirror, Mirror", stardate unknown
> 
> 
> _______________________________________________
> busybox mailing list
> busybox at mail.busybox.net 
> http://busybox.net/mailman/listinfo/busybox
> 
> 
> 
>



More information about the busybox mailing list