2 // EXECUTE_ARGS: runnable/wc.d
6 extern(C) int printf(const char*, ...);
8 int main (string[] args)
14 printf (" lines words bytes file\n");
15 foreach (arg; args[1 .. args.length])
18 int w_cnt, l_cnt, c_cnt;
21 input = cast(string)std.file.read(arg);
23 foreach (char c; input)
39 printf ("%8lu%8lu%8lu %.*s\n", l_cnt, w_cnt, c_cnt, arg.length, arg.ptr);
46 printf ("--------------------------------------\n%8lu%8lu%8lu total",
47 l_total, w_total, c_total);