On Tuesday 05 February 2008, Karel Zak wrote:
> On Tue, Feb 05, 2008 at 06:49:41PM -0500, Mike Frysinger wrote:
> > On Tuesday 05 February 2008, Tilman Schmidt wrote:
> > > +     fprintf(stderr, "%s: bad line discipline: %s\n", prog, optarg);
> > > +     exit(EXIT_FAILURE);
> > > ...
> > > + fprintf(stderr, "%s: cannot open %s: %s\n", prog, dev,
> > > strerror(errno)); +       exit(EXIT_FAILURE);
> > > ...
> > > + fprintf(stderr, "%s: %s is not a serial line\n", prog, dev);
> > > + exit(EXIT_FAILURE);
> > > ...
> > > + fprintf(stderr, "%s: cannot set %s to exclusive mode: %s\n",
> > > +         prog, dev, strerror(errno));
> > > + exit(EXIT_FAILURE);
> > > ...
> > > + fprintf(stderr, "%s: cannot get terminal attributes for %s: %s\n",
> > > +         prog, dev, strerror(errno));
> > > + exit(EXIT_FAILURE);
> > > ...
> > > <many more>
> >
> > could do with writing an error function and/or macro to make things
> > cleaner
>
>  #include <err.h> ... err()  -- very luxury function:
>
>     err("cannot get terminal attributes for %s", dev);
>
>  that's all...

hrm, that's a GNU-extension not in POSIX ... but if there's no other 
attractive alternatives, that's fine.  i bet gnulib has a local version for 
people to fall back on if the system libc does not provide it ...
-mike

Attachment: signature.asc
Description: This is a digitally signed message part.

Reply via email to