while ((ch = getopt(argc, argv, "BEFf:NRWb:cdenrs:tvw")) != -1)
while ((ch = getopt(argc, argv, "BEFf:NRWb:cdenp:rs:tvw")) != -1)
main(argc, argv)	int argc;	char *argv[];{	int ch, f, writeable, error = 0;	char *fstabfile = NULL;	struct disklabel *lp;	FILE *t;	while ((ch = getopt(argc, argv, "BEFf:NRWb:cdenrs:tvw")) != -1)		switch (ch) {#if NUMBOOT > 0		case 'B':			++installboot;			break;		case 'b':			xxboot = optarg;			break;#if NUMBOOT > 1		case 's':			bootxx = optarg;			break;#endif#endif		case 'N':			if (op != UNSPEC)				usage();			writeable = 0;			op = SETWRITEABLE;			break;		case 'R':			if (op != UNSPEC)				usage();			op = RESTORE;			break;		case 'W':			if (op != UNSPEC)				usage();			writeable = 1;			op = SETWRITEABLE;			break;		case 'c':			++cflag;			break;		case 'd':			++dflag;			break;		case 'e':			if (op != UNSPEC)				usage();			op = EDIT;			break;		case 'E':			if (op != UNSPEC)				usage();			op = EDITOR;			break;		case 'f':			fstabfile = optarg;			break;		case 'r':			++rflag;			break;		case 't':			++tflag;			break;		case 'w':			if (op != UNSPEC)				usage();			op = WRITE;			break;		case 'n':			donothing++;			break;		case 'v':			verbose++;			break;		case '?':		default:			usage();	}	argc -= optind;	argv += optind;#if NUMBOOT > 0	if (installboot) {		rflag++;		if (op == UNSPEC)			op = WRITEBOOT;	} else {		if (op == UNSPEC)			op = READ;	}#else	if (op == UNSPEC)		op = READ;#endif	if (argc < 1 || (rflag && cflag + dflag > 0) ||	    (fstabfile && op != EDITOR))		usage();	dkname = argv[0];	f = opendev(dkname, (op == READ ? O_RDONLY : O_RDWR), OPENDEV_PART,	    &specname);	if (f < 0)		err(4, "%s", specname);#ifdef DOSLABEL	/*	 * Check for presence of DOS partition table in	 * master boot record. Return pointer to OpenBSD	 * partition, if present. If no valid partition table,	 * return 0. If valid partition table present, but no	 * partition to use, return a pointer to a non-386bsd	 * partition.	 */	dosdp = readmbr(f);#endif	switch (op) {	case EDIT:		if (argc != 1)			usage();		if ((lp = readlabel(f)) == NULL)			exit(1);		error = edit(lp, f);		break;	case EDITOR:		if (argc != 1)			usage();		if ((lp = readlabel(f)) == NULL)			exit(1);		error = editor(lp, f, specname, fstabfile);		break;	case READ:		if (argc != 1)			usage();		if ((lp = readlabel(f)) == NULL)			exit(1);		if (tflag)			makedisktab(stdout, lp);		else			display(stdout, lp);		error = checklabel(lp);		break;	case RESTORE:		if (argc < 2 || argc > 3)			usage();#if NUMBOOT > 0		if (installboot && argc == 3)			makelabel(argv[2], NULL, &lab);#endif		lp = makebootarea(bootarea, &lab, f);		if (!(t = fopen(argv[1], "r")))			err(4, "%s", argv[1]);		if (getasciilabel(t, lp))			error = writelabel(f, bootarea, lp);		break;	case SETWRITEABLE:		if (!donothing) {			if (ioctl(f, DIOCWLABEL, (char *)&writeable) < 0)				err(4, "ioctl DIOCWLABEL");		}		break;	case WRITE:		if (argc < 2 || argc > 3)			usage();		makelabel(argv[1], argc == 3 ? argv[2] : NULL, &lab);		lp = makebootarea(bootarea, &lab, f);		*lp = lab;		if (checklabel(lp) == 0)			error = writelabel(f, bootarea, lp);		break;#if NUMBOOT > 0	case WRITEBOOT:	{		struct disklabel tlab;		if ((lp = readlabel(f)) == NULL)			exit(1);		tlab = *lp;		if (argc == 2)			makelabel(argv[1], NULL, &lab);		lp = makebootarea(bootarea, &lab, f);		*lp = tlab;		if (checklabel(lp) == 0)			error = writelabel(f, bootarea, lp);		break;	}#endif	default:		break;	}	exit(error);}