Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!wuarchive!usc!apple!voder!pyramid!ctnews!mitisft!dold From: dold@mitisft.Convergent.COM (Clarence Dold) Newsgroups: comp.unix.questions Subject: Re: errno Message-ID: <2157@mitisft.Convergent.COM> Date: 17 Jun 91 02:59:00 GMT References: <1991Jun15.151924.24619@thunder.mcrcim.mcgill.edu> Organization: Unisys Unix Systems Group, San Jose, CA Lines: 22 in article <1991Jun15.151924.24619@thunder.mcrcim.mcgill.edu>, mouse@thunder.mcrcim.mcgill.edu (der Mouse) says: ... > Third, you should check that errno is within the range [0..sys_nerr), > because the sys_errlist table may lag the system for new error codes. ... > printf("errno is %d\n",save_errno); > if ((save_errno >= 0) && (save_errno < sys_nerr)) > printf("%s\n",sys_errlist[save_errno]); > else > printf("Unknown error code %d\n",save_errno); > } printf("Errno %d: %s\n", want_err, want_err <= sys_nerr ? sys_errlist[want_err] : "Out of range" ); I like this one because it's one of the few places where the " ? : " construct looks correct to me. -- --- Clarence A Dold - dold@tsmiti.Convergent.COM ...pyramid!ctnews!tsmiti!dold