shithub: riscv

ref: 57f8b3d1acf273a88568c49d0b83b6863485b9e0
dir: /sys/src/cmd/upas/fs/extra/paw.c/

View raw version
#include<u.h>
#include<libc.h>
#include<bio.h>

void
main(void)
{
	char *f[10], *s;
	vlong sum;
	Biobuf b;

	sum = 0;
	Binit(&b, 0, OREAD);

	while(s = Brdstr(&b, '\n', 1)){
		if(getfields(s, f, nelem(f), 1, " ") > 2)
			sum += strtoul(f[2], 0, 0);
		free(s);
	}
	Bterm(&b);
	print("%lld\n", sum);
	exits("");
}