Re: [fw-wiz] Code reviews [Was: FWTK and smap/smapd]

From: Joseph S D Yao (jsdy@center.osis.gov)
Date: 07/23/02


From: Joseph S D Yao <jsdy@center.osis.gov>
To: Carson Gaspar <carson@taltos.org>
Date: Tue Jul 23 12:07:01 2002

Oh, geez, shouldn't everyone have written [something like] this?

register char *cp = buf;
register int i, count = n;

for (;;) {
        i = write(fd, cp, count);
        if (i < 0) {
                perror("...");
                fprintf(stderr, ...);
                break;
        }
        count -= i;
        if (count <= 0) /* yes, should never be <, optionally fuss */
                break;
        cp += i;
        if (i == 0 {
                sleep(1);
                /* should probably count and break if too many */
        }
}

-- 
Joe Yao				jsdy@center.osis.gov - Joseph S. D. Yao
OSIS Center Systems Support					EMT-B
-----------------------------------------------------------------------
   This message is not an official statement of OSIS Center policies.


Relevant Pages