ref: 368477b5658d7c0a00b3261b212f97fd7deb4218
dir: /plan9/test.c/
#include <u.h> #include <libc.h> #include <bio.h> #include "otf.h" #include "test.h" static int otfseek(void *aux, int off, int whence) { return Bseek(aux, off, whence); } static int otfread(void *aux, void *dst, int sz) { return Bread(aux, dst, sz); } static int otfwrite(void *aux, void *dst, int sz) { return Bwrite(aux, dst, sz); } static void usage(Otfile *f) { printusage(f); exits("usage"); } void main(int argc, char **argv) { Otfile in, out; in.seek = otfseek; in.read = otfread; out.print = (void*)Bprint; out.write = otfwrite; out.aux = Bfdopen(1, OWRITE); parseoptions(); if((in.aux = Bopen(*argv, OREAD)) == nil || process(&in, &out) != 0) sysfatal("%r"); Bterm(out.aux); exits(nil); }