Exemplo n.º 1
0
Arquivo: trascan.c Projeto: bazil/tra
void
threadmain(int argc, char **argv)
{
	int i;
	Path *p;

	fmtinstall('H', encodefmt);
	fmtinstall('P', pathfmt);
	fmtinstall('R', rpcfmt);
	fmtinstall('$', statfmt);
	fmtinstall('V', vtimefmt);

	ARGBEGIN{
	case 'D':
		debug |= dbglevel(EARGF(usage()));
		break;
	case 'V':
		traversion();
	default:
		usage();
	}ARGEND

	if(argc < 1)
		usage();

	startclient();
	repl = dialreplica(argv[0]);

	argc--;
	argv++;
	fprint(2, "scan...");
	if(argc == 0){
		fprint(2, "%P...", nil);
		if(rpcstat(repl, nil) == nil)
			sysfatal("rpcstat: %s", rpcerror());
	}else{
		for(i=0; i<argc; i++){
			p = strtopath(argv[i]);
			fprint(2, "%P...", p);
			if(rpcstat(repl, p) == nil)
				sysfatal("rpcstat: %s", rpcerror());
		}
	}
	fprint(2, "hangup...");
	rpchangup(repl);
	fprint(2, "close...");
	replclose(repl);
	fprint(2, "exit\n");
	threadexitsall(nil);
}
Exemplo n.º 2
0
char *
str_relpath(char *f,char *t)
/* This function is written in order to provide proper freeing of the 
 * auxiliary chains of structures
*/
{
	struct pathnode *p;
	struct pathnode *r;
	struct pathnode *q;
	char *w;

	p = strtopath(f);
	q = strtopath(t);
	r = relpath(strtopath(f),strtopath(t));

	w = pathtostr(r);

	freepath(p);
	freepath(q);
	freepath(r);

	return w;
}