Blob
- Date:
- Message:
- Various fixes. B - fixed usage, DISPLAY :0 vs :0.0 9term - fixed various terminal things rc - notice traps in Read _p9dir - only run disk code for disks dirread - getdirentries on FreeBSD and Linux are different w.r.t. meaning of off. notify - set up so signals interrupt system calls bprint - use bfmt.
- Actions:
- History | Blame | Raw File
1 #include <fmt.h>2 #include "bio.h"4 Biobuf bout;6 void7 bcat(Biobuf *b, char *name)8 {9 char buf[1000];10 int n;12 while((n = Bread(b, buf, sizeof buf)) > 0){13 if(Bwrite(&bout, buf, n) < 0)14 fprint(2, "writing during %s: %r\n", name);15 }16 if(n < 0)17 fprint(2, "reading %s: %r\n", name);18 }20 int21 main(int argc, char **argv)22 {23 int i;24 Biobuf b, *bp;25 Fmt fmt;27 Binit(&bout, 1, O_WRONLY);28 Bfmtinit(&fmt, &bout);29 fmtprint(&fmt, "hello, world\n");30 Bfmtflush(&fmt);32 if(argc == 1){33 Binit(&b, 0, O_RDONLY);34 bcat(&b, "<stdin>");35 }else{36 for(i=1; i<argc; i++){37 if((bp = Bopen(argv[i], O_RDONLY)) == 0){38 fprint(2, "Bopen %s: %r\n", argv[i]);39 continue;40 }41 bcat(bp, argv[i]);42 Bterm(bp);43 }44 }45 exit(0);46 }