Path: utzoo!dciem!nrcaer!scs!spl1!laidbak!att!pacbell!lll-tis!helios.ee.lbl.gov!pasteur!ucbvax!decwrl!sun!pitstop!sundc!seismo!uunet!mcvax!ukc!eag From: lmjm@doc.ic.ac.uk (Lee McLoughlin) Newsgroups: comp.os.minix Subject: fix to libupack for pipes Message-ID: <307@gould.doc.ic.ac.uk> Date: 1 Jun 88 14:55:13 GMT Article-I.D.: gould.307 References: <2584@louie.udel.EDU> Reply-To: lmjm@doc.ic.ac.uk Organization: Dept. of Computing, Imperial College, London, UK. Lines: 32 In reply to the problems with lorder. I found that it was going wrong because libupack was trying to send it too much data down a pipe. Any more than 7K and the write will fail. Libupack also ignores failed writes - I did not fix this. Most programs are not effected by the write-to-pipe limit because they use stdio which doesn't belt out so much data in one chunk. Here is the necessary fix. Basically it ouputs in 7K chunks. 0a1,3 > /* Limit on bytes that can be writen to a pipe */ > #define OUTMAX (7*1024) > 130a134 > char *o; 137c141,145 < n = write(1, output, count); --- > for( o = output; count > 0; o += OUTMAX ){ > int out = (count > OUTMAX) ? OUTMAX : count; > n = write(1, o, out); > count -= out; > } -- UKUUCP SUPPORT Lee McLoughlin "What you once thought was only a nightmare is now a reality!" Janet: lmjm@uk.ac.ic.doc, lmcl@uk.ac.ukc DARPA: lmjm@doc.ic.ac.uk (or lmjm%uk.ac.ic.doc@nss.cs.ucl.ac.uk) Uucp: lmjm@icdoc.UUCP, ukc!icdoc!lmjm