int badbases;
int badsizes;
int badorders;
-char *devname;
+char *dev_name;
int nhead;
int nsec;
int ncyl = 1024;
}
if (argn == argc)
- devname = DEFAULT_DEV;
+ dev_name = DEFAULT_DEV;
else if (argn == argc - 1)
- devname = argv[argn];
+ dev_name = argv[argn];
else
usage();
if (override) return;
- if ((fd= open(devname, O_RDONLY)) < 0) return;
+ if ((fd= open(dev_name, O_RDONLY)) < 0) return;
r = ioctl(fd, DIOCGETP, &geom);
close(fd);
nsec = geom.sectors;
ncyl = geom.cylinders;
- printf("Geometry of %s: %dx%dx%d\n", devname, ncyl, nhead, nsec);
+ printf("Geometry of %s: %dx%dx%d\n", dev_name, ncyl, nhead, nsec);
}
static int devfd;
void getboot(char *buffer)
{
- devfd = open(devname, 2);
+ devfd = open(dev_name, 2);
if (devfd < 0) {
- printf("No write permission on %s\n", devname);
+ printf("No write permission on %s\n", dev_name);
readonly = 1;
- devfd = open(devname, 0);
+ devfd = open(dev_name, 0);
}
if (devfd < 0) {
- printf("Cannot open device %s\n", devname);
+ printf("Cannot open device %s\n", dev_name);
exit(1);
}
if (read(devfd, buffer, SECSIZE) != SECSIZE) {
exit(1);
}
if (* (unsigned short *) &buffer[510] != 0xAA55) {
- printf("Invalid boot sector on %s.\n", devname);
+ printf("Invalid boot sector on %s.\n", dev_name);
printf("Partition table reset and boot code installed.\n");
memset(buffer, 0, 512);
memcpy(buffer, bootstrap, sizeof(bootstrap));
printf(
"Disk appears to have mis-specified number of heads or sectors.\n");
printf("Try fdisk -h%d -s%d %s instead of\n",
- maxhead + 1, maxsec, devname);
- printf(" fdisk -h%d -s%d %s\n", nhead, nsec, devname);
+ maxhead + 1, maxsec, dev_name);
+ printf(" fdisk -h%d -s%d %s\n", nhead, nsec, dev_name);
seenpart = 0;
}
} else {
segread(&sregs); /* get ds */
- if (devname[1] != ':') {
- printf("Invalid drive %s\n", devname);
+ if (dev_name[1] != ':') {
+ printf("Invalid drive %s\n", dev_name);
exit(1);
}
- if (*devname >= 'a') *devname += 'A' - 'a';
- drivenum = (*devname - 'C') & 0xff;
+ if (*dev_name >= 'a') *dev_name += 'A' - 'a';
+ drivenum = (*dev_name - 'C') & 0xff;
if (drivenum < 0 || drivenum > 7) {
printf("Funny drive number %d\n", drivenum);
exit(1);
# closefrom.c confstr.c extattr.c getdevmajor.c \
# pthread_atfork.c setdomainname.c sethostname.c setproctitle.c \
# sysctl.c sysctlbyname.c sysctlgetmibinfo.c sysctlnametomib.c \
-# devname.c wait3.c
+# wait3.c
# To be ported
# nlist.c nlist_aout.c nlist_coff.c nlist_ecoff.c nlist_elf32.c nlist_elf64.c
SRCS+= _errno.c alarm.c alphasort.c arc4random.c assert.c basename.c clock.c \
closedir.c \
ctermid.c ctype_.c daemon.c \
- dehumanize_number.c dirname.c err.c errx.c \
+ dehumanize_number.c devname.c dirname.c err.c errx.c \
errlist.c errno.c execl.c execle.c execlp.c execv.c execvp.c \
fmtcheck.c fmtmsg.c fnmatch.c fstab.c ftok.c \
fts.c ftw.c getbsize.c getcap.c getcwd.c \