disklabel.c (7e546392b5fe3a496acff53ac7aadd1c57b2a4cf) disklabel.c (662909a7800d5634772b89ca1509765dda837508)
1/*
2 * Copyright (c) 1983, 1987, 1993
3 * The Regents of the University of California. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 18 unchanged lines hidden (view full) ---

27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31 * SUCH DAMAGE.
32 */
33
34#ifndef lint
1/*
2 * Copyright (c) 1983, 1987, 1993
3 * The Regents of the University of California. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 18 unchanged lines hidden (view full) ---

27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31 * SUCH DAMAGE.
32 */
33
34#ifndef lint
35#if 0
36static char sccsid[] = "@(#)disklabel.c 8.2 (Berkeley) 5/3/95";
35static char sccsid[] = "@(#)disklabel.c 8.2 (Berkeley) 5/3/95";
37#endif
38static const char rcsid[] =
39 "$Id$";
40#endif /* not lint */
41
42#include <sys/param.h>
43#define DKTYPENAMES
44#include <sys/disklabel.h>
36#endif /* not lint */
37
38#include <sys/param.h>
39#define DKTYPENAMES
40#include <sys/disklabel.h>
41#include <ufs/ufs/dinode.h>
45#include <ufs/ffs/fs.h>
46
47#include <errno.h>
48#include <fcntl.h>
49#include <stdio.h>
50#include <stdlib.h>
51#include <string.h>
52#include <unistd.h>
42#include <ufs/ffs/fs.h>
43
44#include <errno.h>
45#include <fcntl.h>
46#include <stdio.h>
47#include <stdlib.h>
48#include <string.h>
49#include <unistd.h>
53#include <ctype.h>
54
50
51static int error __P((int));
55static int gettype __P((char *, char **));
56
57struct disklabel *
58getdiskbyname(name)
59 const char *name;
60{
61 static struct disklabel disk;
62 register struct disklabel *dp = &disk;

--- 103 unchanged lines hidden (view full) ---

166
167 for (nm = names; *nm; nm++)
168 if (strcasecmp(t, *nm) == 0)
169 return (nm - names);
170 if (isdigit(*t))
171 return (atoi(t));
172 return (0);
173}
52static int gettype __P((char *, char **));
53
54struct disklabel *
55getdiskbyname(name)
56 const char *name;
57{
58 static struct disklabel disk;
59 register struct disklabel *dp = &disk;

--- 103 unchanged lines hidden (view full) ---

163
164 for (nm = names; *nm; nm++)
165 if (strcasecmp(t, *nm) == 0)
166 return (nm - names);
167 if (isdigit(*t))
168 return (atoi(t));
169 return (0);
170}
171
172static int
173error(err)
174 int err;
175{
176 char *p;
177
178 (void)write(STDERR_FILENO, "disktab: ", 9);
179 (void)write(STDERR_FILENO, _PATH_DISKTAB, sizeof(_PATH_DISKTAB) - 1);
180 (void)write(STDERR_FILENO, ": ", 2);
181 p = strerror(err);
182 (void)write(STDERR_FILENO, p, strlen(p));
183 (void)write(STDERR_FILENO, "\n", 1);
184}