On Wed, 10 Jan 2007 08:38:13 +0100
Pavel Machek <[EMAIL PROTECTED]> wrote:


> > +        ret = !tcgetattr(0, oldtrm);
>  
> > +        if (ret) {
> > +                *newtrm = *oldtrm;
> > +                newtrm->c_cc[VMIN] = 0;
> > +                newtrm->c_cc[VTIME] = 1;
> > +                newtrm->c_iflag = IGNBRK | IGNPAR | ICRNL | IMAXBEL;
> > +                newtrm->c_lflag = 0;
> > +                ret = !tcsetattr(0, TCSANOW, newtrm);
> > +        }
> > +
> > +        return ret;
> > +}
> 
> Normal error convention is 0 for success, -ERRNO for a problem. This
> seems to use something different.

The return value of this function is put into `abort_possible' which 
is used as a boolean in the rest of the code.

        abort_possible = splash.prepare_abort(&savedtrm, &newtrm);

I could of course reverse the logic here in:

        prepare_abort {
                ret = tcgetattr(0, oldtrm)

                if (!ret) {
                        ....
                        ret = tcsetattr(0, TCSANOW, newtrm);
                }

                return ret;
        }

        ...

        abort_possible = !splash.prepare_abort(&savedtrm, &newtrm);


Would that be better?


> > +                                   printf(" aborted!\n");
> > +                                   return -EINTR;
> >                             }
> 
> Do we want to do something else than printf() in splash case here?

Mayb. For now all printf are hidden by the splash screen.
They only get a progress bar, that is what they asked for...


grts Tim

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Suspend-devel mailing list
Suspend-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/suspend-devel

Reply via email to