xref: /plan9/sys/src/cmd/venti/srv/readifile.c (revision 368c31ab13393dea083228fdd1c3445076f83a4b)
1 #include "stdinc.h"
2 #include "dat.h"
3 #include "fns.h"
4 
5 void
usage(void)6 usage(void)
7 {
8 	fprint(2, "usage: readifile file\n");
9 	threadexitsall("usage");
10 }
11 
12 void
threadmain(int argc,char * argv[])13 threadmain(int argc, char *argv[])
14 {
15 	IFile ifile;
16 
17 	ARGBEGIN{
18 	default:
19 		usage();
20 	}ARGEND
21 
22 	if(argc != 1)
23 		usage();
24 
25 	if(readifile(&ifile, argv[0]) < 0)
26 		sysfatal("readifile %s: %r", argv[0]);
27 	write(1, ifile.b->data, ifile.b->len);
28 	threadexitsall(nil);
29 }
30