shithub: spread

ref: b16375893ad58a69c9797fb76c97631de0513eb0
dir: /spread.c/

View raw version
#include <u.h>
#include <libc.h>
#include "spread.h"

int debug = 0;

void
usage(void)
{
	fprint(2, "usage: %s [-di] file\n", argv0);
	exits("usage");
}

char *file = nil;
int interactive = 0;

void
main(int argc, char **argv)
{
	ARGBEGIN{
	case 'd':
		debug++;
		break;
	case 'i':
		interactive++;
		break;
	default:
		usage();
		break;
	}ARGEND;
	
	if (argc != 1)
		usage();
	
	fprint(2, "pid=%d\n", getpid());
	
	file = *argv;
	
	if (!inithoc())
		sysfatal("%r");
	
	if (!loadfile(file))
		sysfatal("%r");
	
//	dumpcells();
	
	if (interactive) {
		interactivehoc();
		exits(nil);
	}
	
	Response r = getvalue("a4");
	
	fprint(2, "value: A4='%s' (error=%d)\n", r.msg, r.error);
}