disklabel.c (1574) | disklabel.c (11659) |
---|---|
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 --- 32 unchanged lines hidden (view full) --- 41#include <ufs/ffs/fs.h> 42 43#include <errno.h> 44#include <fcntl.h> 45#include <stdio.h> 46#include <stdlib.h> 47#include <string.h> 48#include <unistd.h> | 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 --- 32 unchanged lines hidden (view full) --- 41#include <ufs/ffs/fs.h> 42 43#include <errno.h> 44#include <fcntl.h> 45#include <stdio.h> 46#include <stdlib.h> 47#include <string.h> 48#include <unistd.h> |
49#include <ctype.h> |
|
49 | 50 |
50static int error __P((int)); | |
51static int gettype __P((char *, char **)); 52 53struct disklabel * 54getdiskbyname(name) 55 const char *name; 56{ 57 static struct disklabel disk; 58 register struct disklabel *dp = &disk; --- 103 unchanged lines hidden (view full) --- 162 163 for (nm = names; *nm; nm++) 164 if (strcasecmp(t, *nm) == 0) 165 return (nm - names); 166 if (isdigit(*t)) 167 return (atoi(t)); 168 return (0); 169} | 51static int gettype __P((char *, char **)); 52 53struct disklabel * 54getdiskbyname(name) 55 const char *name; 56{ 57 static struct disklabel disk; 58 register struct disklabel *dp = &disk; --- 103 unchanged lines hidden (view full) --- 162 163 for (nm = names; *nm; nm++) 164 if (strcasecmp(t, *nm) == 0) 165 return (nm - names); 166 if (isdigit(*t)) 167 return (atoi(t)); 168 return (0); 169} |
170 171static int 172error(err) 173 int err; 174{ 175 char *p; 176 177 (void)write(STDERR_FILENO, "disktab: ", 9); 178 (void)write(STDERR_FILENO, _PATH_DISKTAB, sizeof(_PATH_DISKTAB) - 1); 179 (void)write(STDERR_FILENO, ": ", 2); 180 p = strerror(err); 181 (void)write(STDERR_FILENO, p, strlen(p)); 182 (void)write(STDERR_FILENO, "\n", 1); 183} | |