Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sbin/fdisk convert to ANSI KNF
details: https://anonhg.NetBSD.org/src/rev/d84b7bf640ee
branches: trunk
changeset: 500852:d84b7bf640ee
user: lukem <lukem%NetBSD.org@localhost>
date: Tue Dec 19 15:44:27 2000 +0000
description:
convert to ANSI KNF
diffstat:
sbin/fdisk/fdisk.c | 183 ++++++++++++++++++++++------------------------------
1 files changed, 77 insertions(+), 106 deletions(-)
diffs (truncated from 429 to 300 lines):
diff -r b7d737526f38 -r d84b7bf640ee sbin/fdisk/fdisk.c
--- a/sbin/fdisk/fdisk.c Tue Dec 19 15:43:07 2000 +0000
+++ b/sbin/fdisk/fdisk.c Tue Dec 19 15:44:27 2000 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: fdisk.c,v 1.42 2000/07/06 17:22:43 thorpej Exp $ */
+/* $NetBSD: fdisk.c,v 1.43 2000/12/19 15:44:27 lukem Exp $ */
/*
* Mach Operating System
@@ -29,7 +29,7 @@
#include <sys/cdefs.h>
#ifndef lint
-__RCSID("$NetBSD: fdisk.c,v 1.42 2000/07/06 17:22:43 thorpej Exp $");
+__RCSID("$NetBSD: fdisk.c,v 1.43 2000/12/19 15:44:27 lukem Exp $");
#endif /* not lint */
#include <sys/types.h>
@@ -138,7 +138,7 @@
unsigned char tempcode[8192];
int bootsize; /* actual size of bootcode */
-
+
static char reserved[] = "reserved";
struct part_type {
@@ -259,49 +259,47 @@
{0xFF, "Xenix Bad Block Table"},
};
-void usage __P((void));
-void print_s0 __P((int));
-void print_part __P((int));
-int read_boot __P((char *, char *, size_t));
-void init_sector0 __P((int, int));
-void intuit_translated_geometry __P((void));
-void get_geometry __P((void));
-void get_diskname __P((char *, char *, size_t));
-int try_heads __P((quad_t, quad_t, quad_t, quad_t, quad_t, quad_t, quad_t,
- quad_t));
-int try_sectors __P((quad_t, quad_t, quad_t, quad_t, quad_t));
-void change_part __P((int, int, int, int));
-void print_params __P((void));
-void change_active __P((int));
-void get_params_to_use __P((void));
-void dos __P((int, unsigned char *, unsigned char *, unsigned char *));
-int open_disk __P((int));
-int read_disk __P((int, void *));
-int write_disk __P((int, void *));
-int get_params __P((void));
-int read_s0 __P((void));
-int write_s0 __P((void));
-int yesno __P((char *));
-void decimal __P((char *, int *));
-int type_match __P((const void *, const void *));
-char *get_type __P((int));
-int get_mapping __P((int, int *, int *, int *, long *));
+void usage(void);
+void print_s0(int);
+void print_part(int);
+int read_boot(const char *, void *, size_t);
+void init_sector0(int, int);
+void intuit_translated_geometry(void);
+void get_geometry(void);
+void get_diskname(char *, char *, size_t);
+int try_heads(quad_t, quad_t, quad_t, quad_t, quad_t, quad_t, quad_t,
+ quad_t);
+int try_sectors(quad_t, quad_t, quad_t, quad_t, quad_t);
+void change_part(int, int, int, int);
+void print_params(void);
+void change_active(int);
+void get_params_to_use(void);
+void dos(int, unsigned char *, unsigned char *, unsigned char *);
+int open_disk(int);
+int read_disk(int, void *);
+int write_disk(int, void *);
+int get_params(void);
+int read_s0(void);
+int write_s0(void);
+int yesno(const char *);
+void decimal(const char *, int *);
+int type_match(const void *, const void *);
+const char *get_type(int);
+int get_mapping(int, int *, int *, int *, unsigned long *);
#ifdef __i386__
-void configure_bootsel __P((void));
+void configure_bootsel(void);
#endif
-static inline unsigned short getshort __P((void *));
-static inline void putshort __P((void *p, unsigned short));
-static inline unsigned long getlong __P((void *));
-static inline void putlong __P((void *, unsigned long));
+static unsigned short getshort(void *);
+static void putshort(void *p, unsigned short);
+static unsigned long getlong(void *);
+static void putlong(void *, unsigned long);
-int main __P((int, char **));
+int main(int, char *[]);
int
-main(argc, argv)
- int argc;
- char *argv[];
+main(int argc, char *argv[])
{
int ch;
int part;
@@ -448,8 +446,9 @@
}
void
-usage()
+usage(void)
{
+
(void)fprintf(stderr, "usage: fdisk [-aiufBS] [-0|-1|-2|-3] "
"[-b cylinders/heads/sectors]\n"
" [-s id/start/size] [-c bootcode] "
@@ -458,8 +457,7 @@
}
void
-print_s0(which)
- int which;
+print_s0(int which)
{
int part;
@@ -476,19 +474,16 @@
print_part(which);
}
-static inline unsigned short
-getshort(p)
- void *p;
+static unsigned short
+getshort(void *p)
{
unsigned char *cp = p;
return cp[0] | (cp[1] << 8);
}
-static inline void
-putshort(p, l)
- void *p;
- unsigned short l;
+static void
+putshort(void *p, unsigned short l)
{
unsigned char *cp = p;
@@ -496,19 +491,16 @@
*cp++ = l >> 8;
}
-static inline unsigned long
-getlong(p)
- void *p;
+static unsigned long
+getlong(void *p)
{
unsigned char *cp = p;
return cp[0] | (cp[1] << 8) | (cp[2] << 16) | (cp[3] << 24);
}
-static inline void
-putlong(p, l)
- void *p;
- unsigned long l;
+static void
+putlong(void *p, unsigned long l)
{
unsigned char *cp = p;
@@ -519,8 +511,7 @@
}
void
-print_part(part)
- int part;
+print_part(int part)
{
struct mbr_partition *partp;
int empty;
@@ -567,10 +558,7 @@
}
int
-read_boot(name, buf, len)
- char *name;
- char *buf;
- size_t len;
+read_boot(const char *name, void *buf, size_t len)
{
int bfd, ret;
struct stat st;
@@ -599,8 +587,7 @@
}
void
-init_sector0(start, dopart)
- int start, dopart;
+init_sector0(int start, int dopart)
{
int i;
@@ -622,10 +609,7 @@
#ifdef __i386__
void
-get_diskname(fullname, diskname, size)
- char *fullname;
- char *diskname;
- size_t size;
+get_diskname(char *fullname, char *diskname, size_t size)
{
char *p;
char *p2;
@@ -671,7 +655,7 @@
}
void
-get_geometry()
+get_geometry(void)
{
int mib[2], i;
size_t len;
@@ -714,7 +698,7 @@
}
void
-configure_bootsel()
+configure_bootsel(void)
{
struct mbr_bootsel *mbs =
(struct mbr_bootsel *)&mboot.bootinst[MBR_BOOTSELOFF];
@@ -909,7 +893,7 @@
* the BIOS geometry (which in turn requires modifications to the i386
* boot loader to pass in the BIOS geometry for each disk). */
void
-intuit_translated_geometry()
+intuit_translated_geometry(void)
{
int cylinders = -1, heads = -1, sectors = -1, i, j;
@@ -982,9 +966,8 @@
* absolute sectors for a given entry, or return -1 if it isn't present.
* Note: for simplicity, the returned sector is 0-based. */
int
-get_mapping(i, cylinder, head, sector, absolute)
- int i, *cylinder, *head, *sector;
- long *absolute;
+get_mapping(int i, int *cylinder, int *head, int *sector,
+ unsigned long *absolute)
{
struct mbr_partition *part = &mboot.parts[i / 2];
@@ -1006,8 +989,7 @@
}
void
-change_part(part, csysid, cstart, csize)
- int part, csysid, cstart, csize;
+change_part(int part, int csysid, int cstart, int csize)
{
struct mbr_partition *partp;
@@ -1103,7 +1085,7 @@
}
void
-print_params()
+print_params(void)
{
if (sh_flag) {
@@ -1124,8 +1106,7 @@
}
void
-change_active(which)
- int which;
+change_active(int which)
{
struct mbr_partition *partp;
int part;
@@ -1159,8 +1140,9 @@
}
void
-get_params_to_use()
+get_params_to_use(void)
{
+
Home |
Main Index |
Thread Index |
Old Index