char *cp = "";
cp = "";
main(argc, argv)	int argc;	char **argv;{	int i, mask = 0, npcbs = 0;	char *system, *core;	system = _PATH_UNIX;	core = _PATH_KMEM;	argc--, argv++;again:	if (argc > 0 && !strcmp(*argv, "-a")) {		aflag++, argc--, argv++;		goto again;	}	if (argc > 0 && !strcmp(*argv, "-z")) {		zflag++, argc--, argv++;		goto again;	}	if (argc > 0 && !strcmp(*argv, "-s")) {		sflag++, argc--, argv++;		goto again;	}	if (argc > 0 && !strcmp(*argv, "-t")) {		tflag++, argc--, argv++;		goto again;	}	if (argc > 0 && !strcmp(*argv, "-j")) {		jflag++, argc--, argv++;		goto again;	}	if (argc > 0 && !strcmp(*argv, "-p")) {		argc--, argv++;		if (argc < 1) {			fprintf(stderr, "-p: missing sppcb address\n");			exit(1);		}		if (npcbs >= SPP_NDEBUG) {			fprintf(stderr, "-p: too many pcb's specified\n");			exit(1);		}		sscanf(*argv, "%x", &spp_pcbs[npcbs++]);		argc--, argv++;		goto again;	}	if (argc > 0) {		system = *argv;		argc--, argv++;		mask++;	}	if (argc > 0) {		core = *argv;		argc--, argv++;		mask++;	}	/*	 * Discard setgid privileges if not the running kernel so that bad	 * guys can't print interesting stuff from kernel memory.	 */	if (!strcmp(system, _PATH_UNIX) || !strcmp(core, _PATH_KMEM)) {		setegid(getgid());		setgid(getgid());	}	(void) nlist(system, nl);	if (nl[0].n_value == 0) {		fprintf(stderr, "trsp: %s: no namelist\n", system);		exit(1);	}	(void) close(0);	if (open(core, 0) < 0) {		fprintf(stderr, "trsp: "); perror(core);		exit(2);	}	if (mask) {		nl[0].n_value &= 0x7fffffff;		nl[1].n_value &= 0x7fffffff;	}	(void) lseek(0, nl[1].n_value, 0);	if (read(0, &spp_debx, sizeof (spp_debx)) != sizeof (spp_debx)) {		fprintf(stderr, "trsp: "); perror("spp_debx");		exit(3);	}	printf("spp_debx=%d\n", spp_debx);	(void) lseek(0, nl[0].n_value, 0);	if (read(0, spp_debug, sizeof (spp_debug)) != sizeof (spp_debug)) {		fprintf(stderr, "trsp: "); perror("spp_debug");		exit(3);	}	/*	 * Here, we just want to clear out the old trace data and start over.	 */	if (zflag) {		char *cp = (char *) spp_debug,		     *cplim = cp + sizeof(spp_debug);		(void) close(0);		if (open(core, 2) < 0) {			fprintf(stderr, "trsp: "); perror(core);			exit(2);		}		while(cp < cplim) *cp++ = 0;		(void) lseek(0, nl[0].n_value, 0);		if (write(0, spp_debug, sizeof (spp_debug)) != sizeof (spp_debug)) {			fprintf(stderr, "trsp: "); perror("spp_debug");			exit(3);		}		(void) lseek(0, nl[1].n_value, 0);		spp_debx = 0;		if (write(0, &spp_debx, sizeof (spp_debx)) != sizeof (spp_debx)) {			fprintf(stderr, "trsp: "); perror("spp_debx");			exit(3);		}		exit(0);	}	/*	 * If no control blocks have been specified, figure	 * out how many distinct one we have and summarize	 * them in spp_pcbs for sorting the trace records	 * below.	 */	if (npcbs == 0) {		for (i = 0; i < SPP_NDEBUG; i++) {			register int j;			register struct spp_debug *sd = &spp_debug[i];			if (sd->sd_cb == 0)				continue;			for (j = 0; j < npcbs; j++)				if (spp_pcbs[j] == sd->sd_cb)					break;			if (j >= npcbs)				spp_pcbs[npcbs++] = sd->sd_cb;		}	}	qsort(spp_pcbs, npcbs, sizeof (caddr_t), numeric);	if (jflag) {		char *cp = "";		for (i = 0; i < npcbs; i++) {			printf("%s%x", cp, spp_pcbs[i]);			cp = ", ";		}		if (*cp)			putchar('\n');		exit(0);	}	for (i = 0; i < npcbs; i++) {		printf("\n%x:\n", spp_pcbs[i]);		dotrace(spp_pcbs[i]);	}	exit(0);}