err(1, tracefile);
err(1, "%s", tracefile);
main(argc, argv)	int argc;	char **argv;{	enum { NOTSET, CLEAR, CLEARALL } clear;	int append, ch, fd, inherit, ops, pid, pidset, trpoints;	char *tracefile;	mode_t omask;	struct stat sb;	clear = NOTSET;	append = ops = pidset = inherit = 0;	trpoints = DEF_POINTS;	tracefile = DEF_TRACEFILE;	while ((ch = getopt(argc,argv,"aCcdf:g:ip:t:")) != -1)		switch((char)ch) {		case 'a':			append = 1;			break;		case 'C':			clear = CLEARALL;			pidset = 1;			break;		case 'c':			clear = CLEAR;			break;		case 'd':			ops |= KTRFLAG_DESCEND;			break;		case 'f':			tracefile = optarg;			break;		case 'g':			pid = -rpid(optarg);			pidset = 1;			break;		case 'i':			inherit = 1;			break;		case 'p':			pid = rpid(optarg);			pidset = 1;			break;		case 't':			trpoints = getpoints(optarg);			if (trpoints < 0) {				warnx("unknown facility in %s", optarg);				usage();			}			break;		default:			usage();		}	argv += optind;	argc -= optind;		if (pidset && *argv || !pidset && !*argv)		usage();				if (inherit)		trpoints |= KTRFAC_INHERIT;	(void)signal(SIGSYS, no_ktrace);	if (clear != NOTSET) {		if (clear == CLEARALL) {			ops = KTROP_CLEAR | KTRFLAG_DESCEND;			trpoints = ALL_POINTS;			pid = 1;		} else			ops |= pid ? KTROP_CLEAR : KTROP_CLEARFILE;		if (ktrace(tracefile, ops, trpoints, pid) < 0)			err(1, tracefile);		exit(0);	}	omask = umask(S_IRWXG|S_IRWXO);	if (append) {		if ((fd = open(tracefile, O_CREAT | O_WRONLY, DEFFILEMODE)) < 0)			err(1, tracefile);		if (fstat(fd, &sb) != 0 || sb.st_uid != getuid())			errx(1, "Refuse to append to %s: not owned by you.",			    tracefile);	} else {		if (unlink(tracefile) == -1 && errno != ENOENT)			err(1, "unlink %s", tracefile);		if ((fd = open(tracefile, O_CREAT | O_EXCL | O_WRONLY,		    DEFFILEMODE)) < 0)			err(1, tracefile);	}	(void)umask(omask);	(void)close(fd);	if (*argv) { 		if (ktrace(tracefile, ops, trpoints, getpid()) < 0)			err(1, tracefile);		execvp(argv[0], &argv[0]);		err(1, "exec of '%s' failed", argv[0]);	}	else if (ktrace(tracefile, ops, trpoints, pid) < 0)		err(1, tracefile);	exit(0);}