#include <stdio.h>

#include "arg.h"

int
usage(void) {
	fprintf(stderr,
		"usage: sample [-c config] [-p port] service [path]\n");
	return(1);
}

int
main(int argc, char *argv[]) {
	char *service = "default.service";
	int serverport = 999;
	int debug = 0;
	char *csrvfile = "cserv.conf";
	char *path = 0;

	ARGBEGIN {
	case 'c': csrvfile = ARGF();		break;
	case 'd': debug++;			break;
	case 'p': serverport = atoi(ARGF());	break;
	default:
		exit(usage());
	} ARGEND;

	if (argc < 1)
		exit(usage());

	service = *argv++;
	argc--;

	if (argc > 0)
		path = *argv++, argc--;
	if (argc != 0)
		exit(usage());

	printf("cservfile=%s debug=%d service=%s path=%s\n",
		csrvfile, debug, service, path);
	return 0;
}

