Lines Matching +defs:tmpdir +defs:c +defs:a
1 /* $NetBSD: main.c,v 1.59 2025/01/19 04:37:15 tsutsui Exp $ */
4 * Copyright (c) 2006 The NetBSD Foundation, Inc.
33 * Copyright (c) 1987, 1993
70 __COPYRIGHT("@(#) Copyright (c) 1987, 1993\
76 static char sccsid[] = "@(#)disklabel.c 8.4 (Berkeley) 5/4/95";
77 /* from static char sccsid[] = "@(#)disklabel.c 1.2 (Symmetric) 11/28/85"; */
79 __RCSID("$NetBSD: main.c,v 1.59 2025/01/19 04:37:15 tsutsui Exp $");
125 * Many machines also place a bootstrap in the same area,
136 /* To delete a label, we just invert the magic numbers */
182 #define GETNUM32(a, v) getulong(a, '\0', NULL, v, UINT32_MAX)
183 #define GETNUM16(a, v) getulong(a, '\0', NULL, v, UINT16_MAX)
184 #define GETNUM8(a, v) getulong(a, '\0', NULL, v, UINT8_MAX)
361 * Except, maybe, the size of a physical sector.
362 * This value is used if we have to write a label to the start of an mbr ptn.
532 case 'F': /* Treat 'disk' as a regular file */
609 case 't': /* Format output as a disktab entry */
779 * Construct a prototype disklabel from /etc/disktab.
812 * then write a label to the raw disk.
838 * Now issue a DIOCWDINFO. This will let the kernel convert the
907 warnx("%s: Labeled partition or 'a' partition must start"
1031 * a filecore boot block on the disk. If a boot block is validated then
1046 * expression may or may not yield a faster checksum function,
1049 * Note that if you have a block filled with bytes of a single
1052 * end up with a checksum of X. (Do the math; that can be derived
1055 * always checksum properly. That's a _very_ unlikely occurrence
1056 * (probably impossible, actually) for a valid filecore boot block,
1083 * are the same except the checksum, a checksum compare
1096 * Check for the presence of a RiscOS filecore boot block
1167 * so do not trash ! If the user really wants to put a
1191 * as a basis for initialisation.
1210 * Reading the label from the disk is largely a case of 'hunt the label'.
1289 /* Remember we've found a label */
1306 * <sys/bootblock.h> provides a macro to do it.
1378 /* Don't add a label to sector 0, but update one if there */
1476 char c = 'a' + i;
1478 (void) fprintf(f, "p%c#%" PRIu32 ":", c, pp->p_size);
1479 (void) fprintf(f, "o%c#%" PRIu32 ":", c, pp->p_offset);
1482 (void) fprintf(f, "t%c=%s:", c,
1486 "t%c=unknown%" PRIu8 ":",
1487 c, pp->p_fstype);
1499 (void) fprintf(f, "b%c#%" PRIu64 ":", c,
1501 (void) fprintf(f, "f%c#%" PRIu32 ":", c,
1516 const char *tmpdir;
1522 if ((tmpdir = getenv("TMPDIR")) == NULL)
1523 tmpdir = _PATH_TMP;
1524 (void)snprintf(tmpfil, sizeof(tmpfil), "%s/%s", tmpdir, TMPFILE);
1591 * Jump through a few extra hoops in case someone's editor
1597 retval = execlp(_PATH_BSHELL, _PATH_BSHELL, "-c", buf, NULL);
1728 tp = strchr(cp, ':'); /* everything has a colon in it */
1908 if ('a' > *cp || *cp > 'z' || cp[1] != '\0') {
1914 /* We have a partition entry */
1915 part = *cp - 'a';
2075 part = 'a' + i;
2078 warnx("warning, partition %c increased "
2087 part = 'a' + i;
2090 warnx("warning, partition %c: size 0, but "
2095 warnx("warning, partition %c:"
2102 warnx("partition %c: offset past end of unit", part);
2106 warnx("partition %c: partition extends"
2118 warnx("partitions %c and %c overlap",
2119 part, 'a' + j);
2136 { "-i [-BDFMIrv] disk", "(to create a label interactively)" },
2178 * This is a wrapper over the standard strcmp function to be used with
2191 * Prints all know file system types for a partition.