Project

General

Profile

0005-disklabel64-8-Make-the-auto-disk-type-argument-optio.patch

liweitianux, 11/08/2017 07:07 AM

Download (2.25 KB)

View differences:

sbin/disklabel64/disklabel64.c
162 162
	FILE *t;
163 163
	int ch, f = 0, flag, error = 0;
164 164
	char *name = NULL;
165
	const char *dtype = NULL;
165 166

  
166 167
	while ((ch = getopt(argc, argv, OPTIONS)) != -1)
167 168
		switch (ch) {
......
295 296
			name = argv[2];
296 297
			argc--;
297 298
		}
298
		if (argc != 2)
299
		if (argc == 2)
300
			dtype = argv[1];
301
		else if (argc == 1)
302
			dtype = "auto";
303
		else
299 304
			usage();
300
		makelabel(argv[1], name, &lab);
305
		makelabel(dtype, name, &lab);
301 306
		lp = makebootarea(f);
302 307
		bcopy(&lab.d_magic, &lp->d_magic,
303 308
		      sizeof(lab) - offsetof(struct disklabel64, d_magic));
......
1497 1502
	fprintf(stderr, "%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n",
1498 1503
		"usage: disklabel64 [-r] disk",
1499 1504
		"\t\t(to read label)",
1500
		"       disklabel64 -w [-r] [-n] disk type [packid]",
1505
		"       disklabel64 -w [-r] [-n] disk [type [packid]]",
1501 1506
		"\t\t(to write label with existing boot program)",
1502 1507
		"       disklabel64 -e [-r] [-n] disk",
1503 1508
		"\t\t(to edit label)",
......
1505 1510
		"\t\t(to restore label with existing boot program)",
1506 1511
		"       disklabel64 -B [-n] [-b boot1 -s boot2] disk [type]",
1507 1512
		"\t\t(to install boot program with existing label)",
1508
		"       disklabel64 -w -B [-n] [-b boot1 -s boot2] disk type [packid]",
1513
		"       disklabel64 -w -B [-n] [-b boot1 -s boot2] disk [type [packid]]",
1509 1514
		"\t\t(to write label and boot program)",
1510 1515
		"       disklabel64 -R -B [-n] [-b boot1 -s boot2] disk protofile [type]",
1511 1516
		"\t\t(to restore label and boot program)",
1512
-