-.\" $OpenBSD: disklabel.8,v 1.151 2023/01/09 00:56:36 jsg Exp $
+.\" $OpenBSD: disklabel.8,v 1.152 2023/02/07 14:30:48 krw Exp $
.\" $NetBSD: disklabel.8,v 1.9 1995/03/18 14:54:38 cgd Exp $
.\"
.\" Copyright (c) 1987, 1988, 1991, 1993
.\"
.\" @(#)disklabel.8 8.2 (Berkeley) 4/19/94
.\"
-.Dd $Mdocdate: January 9 2023 $
+.Dd $Mdocdate: February 7 2023 $
.Dt DISKLABEL 8
.Os
.Sh NAME
See
.Sx AUTOMATIC DISK ALLOCATION
below for the format.
+If
+.Ar file
+is a single dash
+.Pq Sq - ,
+the template is read from the standard input.
.It Fl t
Format the label as a
.Xr disktab 5
option.
The template consists of one line per partition, each giving partition type or
mount point, min-max size range, and percentage of disk, space-separated.
-Max can be unlimited by specifying '*'.
+Max can be unlimited by specifying
+.Sq * .
If max size and percentage of disk are omitted, the partition is
-created with the exact min size.
+created with the exact min size or unlimited if min is
+.Sq * .
.Bd -literal -offset indent
/ 250M
swap 80M-256M 10%
-/* $OpenBSD: editor.c,v 1.401 2023/02/02 14:33:38 krw Exp $ */
+/* $OpenBSD: editor.c,v 1.402 2023/02/07 14:30:48 krw Exp $ */
/*
* Copyright (c) 1997-2000 Todd C. Miller <millert@openbsd.org>
uint idx = 0, pctsum = 0;
struct space_allocation *sa;
- if ((cfile = fopen(filename, "r")) == NULL)
+ if (strcmp(filename, "-") == 0)
+ cfile = stdin;
+ else if ((cfile = fopen(filename, "r")) == NULL)
err(1, "%s", filename);
if ((alloc_table = calloc(1, sizeof(struct alloc_table))) == NULL)
err(1, NULL);
char *p, *unit1 = NULL, *unit2 = NULL;
double val1 = 0, val2 = 0;
+ if (strcmp(buf, "*") == 0) {
+ *min = 0;
+ *max = UINT64_MAX;
+ goto done;
+ }
+
if ((p = strchr(buf, '-')) != NULL) {
p[0] = '\0';
p++;
} else
if (*max == 0)
*max = *min;
+ done:
free(buf);
return (0);
}