diff options
author | jhb <jhb@FreeBSD.org> | 2006-02-28 21:49:33 +0000 |
---|---|---|
committer | jhb <jhb@FreeBSD.org> | 2006-02-28 21:49:33 +0000 |
commit | 1ec49d602a80028377023a0fdc8f11d6281a3b18 (patch) | |
tree | 29ca37782709cff55cee2300ecd6319423660211 /usr.sbin/sysinstall | |
parent | 6dd5abcf92dd9a747d9ec038a372392b97daf728 (diff) | |
download | FreeBSD-src-1ec49d602a80028377023a0fdc8f11d6281a3b18.zip FreeBSD-src-1ec49d602a80028377023a0fdc8f11d6281a3b18.tar.gz |
Fix numerous warnings. Aside from menu items in system.c and menu.c
this now compiles on i386 with WARNS?= 3. Most of the fixes included
adding missing 'static' keywords to internal functions, using fully-defined
terminators in statically defined arrays of structs, and various
signed vs unsigned mismatches. Also G/C'd unused configSecurity()
function.
Diffstat (limited to 'usr.sbin/sysinstall')
-rw-r--r-- | usr.sbin/sysinstall/Makefile | 2 | ||||
-rw-r--r-- | usr.sbin/sysinstall/anonFTP.c | 2 | ||||
-rw-r--r-- | usr.sbin/sysinstall/config.c | 13 | ||||
-rw-r--r-- | usr.sbin/sysinstall/disks.c | 2 | ||||
-rw-r--r-- | usr.sbin/sysinstall/dist.c | 7 | ||||
-rw-r--r-- | usr.sbin/sysinstall/dmenu.c | 2 | ||||
-rw-r--r-- | usr.sbin/sysinstall/http.c | 2 | ||||
-rw-r--r-- | usr.sbin/sysinstall/index.c | 17 | ||||
-rw-r--r-- | usr.sbin/sysinstall/installUpgrade.c | 4 | ||||
-rw-r--r-- | usr.sbin/sysinstall/label.c | 1 | ||||
-rw-r--r-- | usr.sbin/sysinstall/media.c | 5 | ||||
-rw-r--r-- | usr.sbin/sysinstall/options.c | 20 | ||||
-rw-r--r-- | usr.sbin/sysinstall/package.c | 3 | ||||
-rw-r--r-- | usr.sbin/sysinstall/sysinstall.h | 5 | ||||
-rw-r--r-- | usr.sbin/sysinstall/tcpip.c | 9 | ||||
-rw-r--r-- | usr.sbin/sysinstall/user.c | 4 | ||||
-rw-r--r-- | usr.sbin/sysinstall/wizard.c | 4 |
17 files changed, 49 insertions, 53 deletions
diff --git a/usr.sbin/sysinstall/Makefile b/usr.sbin/sysinstall/Makefile index 5ce9b34..751d10c 100644 --- a/usr.sbin/sysinstall/Makefile +++ b/usr.sbin/sysinstall/Makefile @@ -96,7 +96,7 @@ keymap.h: echo -n ' { "'$$map'", ' >> keymap.tmp ; \ echo "&keymap_$$map }," | tr '[-.]' '_' >> keymap.tmp ; \ done - ( echo " { 0 }"; echo "};" ; echo "" ) >> keymap.tmp + ( echo " { NULL, NULL }"; echo "};" ; echo "" ) >> keymap.tmp mv keymap.tmp keymap.h countries.h: ${.CURDIR}/../../share/misc/iso3166 diff --git a/usr.sbin/sysinstall/anonFTP.c b/usr.sbin/sysinstall/anonFTP.c index 206b1b1..7427076 100644 --- a/usr.sbin/sysinstall/anonFTP.c +++ b/usr.sbin/sysinstall/anonFTP.c @@ -115,7 +115,7 @@ static Layout layout[] = { { 19, 35, 0, 0, "CANCEL", "Select this if you wish to cancel this screen", &cancelbutton, BUTTONOBJ, NULL }, - { 0 }, + LAYOUT_END, }; static int diff --git a/usr.sbin/sysinstall/config.c b/usr.sbin/sysinstall/config.c index 632c242..ba8e1cd 100644 --- a/usr.sbin/sysinstall/config.c +++ b/usr.sbin/sysinstall/config.c @@ -268,7 +268,7 @@ configFstab(dialogMenuItem *self) * returns number of lines read. line contents * are malloc'd and must be freed by the caller. */ -int +static int readConfig(char *config, char **lines, int max) { FILE *fp; @@ -606,17 +606,6 @@ configSecurelevelNetworkSecure(dialogMenuItem *self) } int -configSecurity(dialogMenuItem *self) -{ - WINDOW *w = savescr(); - - dialog_clear_norefresh(); - dmenuOpenSimple(&MenuSecurity, FALSE); - restorescr(w); - return DITEM_SUCCESS; -} - -int configResolv(dialogMenuItem *ditem) { FILE *fp; diff --git a/usr.sbin/sysinstall/disks.c b/usr.sbin/sysinstall/disks.c index b60012f..68dd987 100644 --- a/usr.sbin/sysinstall/disks.c +++ b/usr.sbin/sysinstall/disks.c @@ -180,7 +180,7 @@ print_chunks(Disk *d, int u) } static void -print_command_summary() +print_command_summary(void) { mvprintw(14, 0, "The following commands are supported (in upper or lower case):"); mvprintw(16, 0, "A = Use Entire Disk G = set Drive Geometry C = Create Slice F = `DD' mode"); diff --git a/usr.sbin/sysinstall/dist.c b/usr.sbin/sysinstall/dist.c index 649968d..ab3914c 100644 --- a/usr.sbin/sysinstall/dist.c +++ b/usr.sbin/sysinstall/dist.c @@ -68,6 +68,7 @@ static Distribution XOrgDistTable[]; { name, mask, DIST_ ## flag, DT_PACKAGE, { package } } #define DTE_SUBDIST(name, mask, flag, subdist) \ { name, mask, DIST_ ## flag, DT_SUBDIST, { .my_dist = subdist } } +#define DTE_END { NULL, NULL, 0, 0, { NULL } } #define BASE_DIST (&DistTable[0]) @@ -88,7 +89,7 @@ static Distribution DistTable[] = { DTE_TARBALL("ports", &Dists, PORTS, "/usr"), DTE_TARBALL("local", &Dists, LOCAL, "/"), DTE_SUBDIST("X.Org", &Dists, XORG, XOrgDistTable), - { NULL }, + DTE_END, }; /* The /usr/src distribution */ @@ -113,7 +114,7 @@ static Distribution SrcDistTable[] = { DTE_TARBALL("susbin", &SrcDists, SRC_USBIN, "/usr/src"), DTE_TARBALL("stools", &SrcDists, SRC_TOOLS, "/usr/src"), DTE_TARBALL("srescue", &SrcDists, SRC_RESCUE, "/usr/src"), - { NULL }, + DTE_END, }; /* The X.Org distribution */ @@ -136,7 +137,7 @@ static Distribution XOrgDistTable[] = { DTE_PACKAGE("Xft1", &XOrgDists, XORG_FONTS_T1, "xorg-fonts-type1"), DTE_PACKAGE("Xftt", &XOrgDists, XORG_FONTS_TT, "xorg-fonts-truetype"), DTE_PACKAGE("Xfs", &XOrgDists, XORG_FONTSERVER, "xorg-fontserver"), - { NULL }, + DTE_END, }; static int distMaybeSetPorts(dialogMenuItem *self); diff --git a/usr.sbin/sysinstall/dmenu.c b/usr.sbin/sysinstall/dmenu.c index aed89d8..a197188 100644 --- a/usr.sbin/sysinstall/dmenu.c +++ b/usr.sbin/sysinstall/dmenu.c @@ -261,7 +261,7 @@ dmenuVarsCheck(dialogMenuItem *item) int dmenuRadioCheck(dialogMenuItem *item) { - return (*((unsigned int *)item->data) == item->aux); + return (*((int *)item->data) == item->aux); } static int diff --git a/usr.sbin/sysinstall/http.c b/usr.sbin/sysinstall/http.c index 19c8264..1355f08 100644 --- a/usr.sbin/sysinstall/http.c +++ b/usr.sbin/sysinstall/http.c @@ -36,7 +36,7 @@ extern const char *ftp_dirs[]; /* defined in ftp.c */ -Boolean +static Boolean checkAccess(Boolean proxyCheckOnly) { /* diff --git a/usr.sbin/sysinstall/index.c b/usr.sbin/sysinstall/index.c index 338f939..a20dfb4 100644 --- a/usr.sbin/sysinstall/index.c +++ b/usr.sbin/sysinstall/index.c @@ -60,7 +60,7 @@ static void index_recorddeps(Boolean add, PkgNodePtr root, IndexEntryPtr ie); PkgNode Top, Plist; /* Smarter strdup */ -inline char * +static inline char * _strdup(char *ptr) { return ptr ? strdup(ptr) : NULL; @@ -289,7 +289,7 @@ readline(FILE *fp, char *buf, int max) * lines without a set number of '|' delimited fields. */ -int +static int index_parse(FILE *fp, char *name, char *pathto, char *prefix, char *comment, char *descr, char *maint, char *cats, char *rdeps, int *volume) { char line[10240 + 2048 * 7]; @@ -437,7 +437,7 @@ index_sort(PkgNodePtr top) } /* Delete an entry out of the list it's in (only the plist, at present) */ -void +static void index_delete(PkgNodePtr n) { if (n->next) { @@ -482,7 +482,7 @@ index_search(PkgNodePtr top, char *str, PkgNodePtr *tp) return p; } -int +static int pkg_checked(dialogMenuItem *self) { ListPtrsPtr lists = (ListPtrsPtr)self->aux; @@ -502,7 +502,7 @@ pkg_checked(dialogMenuItem *self) return FALSE; } -int +static int pkg_fire(dialogMenuItem *self) { int ret; @@ -561,7 +561,7 @@ pkg_fire(dialogMenuItem *self) return ret; } -void +static void pkg_selected(dialogMenuItem *self, int is_selected) { PkgNodePtr kp = self->data; @@ -575,7 +575,8 @@ int index_menu(PkgNodePtr root, PkgNodePtr top, PkgNodePtr plist, int *pos, int *scroll) { struct ListPtrs lists; - int n, rval, maxname; + size_t maxname; + int n, rval; int curr, max; PkgNodePtr kp; dialogMenuItem *nitems; @@ -592,7 +593,7 @@ index_menu(PkgNodePtr root, PkgNodePtr top, PkgNodePtr plist, int *pos, int *scr /* Figure out if this menu is full of "leaves" or "branches" */ for (kp = top->kids; kp && kp->name; kp = kp->next) { - int len; + size_t len; ++n; if (kp->type == PACKAGE && plist) { diff --git a/usr.sbin/sysinstall/installUpgrade.c b/usr.sbin/sysinstall/installUpgrade.c index b25a7da..faa6e3c 100644 --- a/usr.sbin/sysinstall/installUpgrade.c +++ b/usr.sbin/sysinstall/installUpgrade.c @@ -122,10 +122,10 @@ static HitList etc_files [] = { { JUST_COPY, "syslog.conf", TRUE, NULL }, { JUST_COPY, "ttys", TRUE, NULL }, { JUST_COPY, "uucp", TRUE, NULL }, - { 0 }, + { 0, NULL, FALSE, NULL }, }; -void +static void traverseHitlist(HitList *h) { system("rm -rf /etc/upgrade"); diff --git a/usr.sbin/sysinstall/label.c b/usr.sbin/sysinstall/label.c index 3b2cee2..2a432da 100644 --- a/usr.sbin/sysinstall/label.c +++ b/usr.sbin/sysinstall/label.c @@ -837,7 +837,6 @@ print_command_summary(void) static void clear_wins(void) { - extern void print_label_chunks(); clear(); print_label_chunks(); } diff --git a/usr.sbin/sysinstall/media.c b/usr.sbin/sysinstall/media.c index 8e61c5a..408a82a 100644 --- a/usr.sbin/sysinstall/media.c +++ b/usr.sbin/sysinstall/media.c @@ -325,7 +325,8 @@ mediaSetFTP(dialogMenuItem *self) static Device ftpDevice; char *cp, hbuf[MAXHOSTNAMELEN], *hostname, *dir; struct addrinfo hints, *res; - int af, urllen; + int af; + size_t urllen; extern int FtpPort; static Device *networkDev = NULL; @@ -554,7 +555,7 @@ mediaSetNFS(dialogMenuItem *self) static Device *networkDev = NULL; char *cp, *idx; char hostname[MAXPATHLEN]; - int pathlen; + size_t pathlen; mediaClose(); cp = variable_get_value(VAR_NFS_PATH, "Please enter the full NFS file specification for the remote\n" diff --git a/usr.sbin/sysinstall/options.c b/usr.sbin/sysinstall/options.c index 8e3a7d9..04876d6 100644 --- a/usr.sbin/sysinstall/options.c +++ b/usr.sbin/sysinstall/options.c @@ -42,12 +42,12 @@ int fixitTtyWhich(dialogMenuItem *); static char * -varCheck(Option opt) +varCheck(Option *opt) { char *cp = NULL; - if (opt.aux) - cp = variable_get((char *)opt.aux); + if (opt->aux) + cp = variable_get((char *)opt->aux); if (!cp) return "NO"; return cp; @@ -55,13 +55,13 @@ varCheck(Option opt) /* Show our little logo */ static char * -resetLogo(char *str) +resetLogo(Option *opt) { return "[RESET!]"; } static char * -mediaCheck(Option opt) +mediaCheck(Option *opt) { if (mediaDevice) { switch(mediaDevice->type) { @@ -155,10 +155,10 @@ static Option Options[] = { { "Fixit Console", "Which tty to use for the Fixit action.", OPT_IS_FUNC, fixitTtyWhich, VAR_FIXIT_TTY, varCheck }, { "Re-scan Devices", "Re-run sysinstall's initial device probe", - OPT_IS_FUNC, deviceRescan }, + OPT_IS_FUNC, deviceRescan, NULL, NULL }, { "Use Defaults", "Reset all values to startup defaults", - OPT_IS_FUNC, installVarDefaults, 0, resetLogo }, -{ NULL }, + OPT_IS_FUNC, installVarDefaults, NULL, resetLogo }, +{ NULL, NULL, 0, NULL, NULL, NULL }, }; #define OPT_START_ROW 4 @@ -183,7 +183,7 @@ value_of(Option opt) case OPT_IS_FUNC: case OPT_IS_VAR: if (opt.check) - return opt.check(opt); + return opt.check(&opt); else return "<*>"; } @@ -216,7 +216,7 @@ fire(Option opt) variable_set2(opt.aux, "YES", 0); } if (opt.check) - opt.check(opt); + opt.check(&opt); refresh(); return status; } diff --git a/usr.sbin/sysinstall/package.c b/usr.sbin/sysinstall/package.c index 7f23fc3..189906f 100644 --- a/usr.sbin/sysinstall/package.c +++ b/usr.sbin/sysinstall/package.c @@ -115,7 +115,8 @@ package_extract(Device *dev, char *name, Boolean depended) { char path[MAXPATHLEN]; const char *PkgExts[] = { "", ".tbz", ".tbz2", ".tgz" }; - int ext, last_msg, pathend, ret; + int last_msg, pathend, ret; + size_t ext; FILE *fp; last_msg = 0; diff --git a/usr.sbin/sysinstall/sysinstall.h b/usr.sbin/sysinstall/sysinstall.h index d3a24c0..9940392 100644 --- a/usr.sbin/sysinstall/sysinstall.h +++ b/usr.sbin/sysinstall/sysinstall.h @@ -268,6 +268,9 @@ typedef struct _layout { void *obj; /* The obj pointer returned by libdialog */ } Layout; +/* Layout array terminator. */ +#define LAYOUT_END { 0, 0, 0, 0, NULL, NULL, NULL, 0, NULL } + typedef enum { DEVICE_TYPE_NONE, DEVICE_TYPE_DISK, @@ -355,7 +358,7 @@ typedef struct _opt { enum { OPT_IS_STRING, OPT_IS_INT, OPT_IS_FUNC, OPT_IS_VAR } type; void *data; void *aux; - char *(*check)(); + char *(*check)(struct _opt *); } Option; /* Weird index nodey things we use for keeping track of package information */ diff --git a/usr.sbin/sysinstall/tcpip.c b/usr.sbin/sysinstall/tcpip.c index 4059b96..dd22539 100644 --- a/usr.sbin/sysinstall/tcpip.c +++ b/usr.sbin/sysinstall/tcpip.c @@ -104,7 +104,7 @@ static Layout layout[] = { { 19, 35, 0, 0, "CANCEL", "Select this if you wish to cancel this screen", &cancelbutton, BUTTONOBJ, NULL }, - { 0 }, + LAYOUT_END, }; #define _validByte(b) ((b) >= 0 && (b) <= 255) @@ -177,7 +177,7 @@ static int verifyNetmask(const char *netmask, unsigned long *out) { unsigned long mask; - unsigned long tmp; + long tmp; char *endptr; if (netmask[0] == '0' && (netmask[1] == 'x' || netmask[1] == 'X')) { @@ -187,9 +187,10 @@ verifyNetmask(const char *netmask, unsigned long *out) return 0; } else { /* Parse out quad decimal mask */ - mask = strtoul(netmask, &endptr, 10); - if (!_validByte(mask) || *endptr++ != '.') + tmp = strtoul(netmask, &endptr, 10); + if (!_validByte(tmp) || *endptr++ != '.') return 0; + mask = tmp; tmp = strtoul(endptr, &endptr, 10); if (!_validByte(tmp) || *endptr++ != '.') return 0; diff --git a/usr.sbin/sysinstall/user.c b/usr.sbin/sysinstall/user.c index ecee440..8bddc1f 100644 --- a/usr.sbin/sysinstall/user.c +++ b/usr.sbin/sysinstall/user.c @@ -102,7 +102,7 @@ static Layout groupLayout[] = { { 18, 35, 0, 0, "CANCEL", "Select this if you wish to cancel this screen", &cancelbutton, BUTTONOBJ, NULL }, - { 0 }, + LAYOUT_END, }; /* The user configuration menu. */ @@ -147,7 +147,7 @@ static Layout userLayout[] = { { 18, 35, 0, 0, "CANCEL", "Select this if you wish to cancel this screen", &cancelbutton, BUTTONOBJ, NULL }, - { 0 }, + LAYOUT_END, }; /* whine */ diff --git a/usr.sbin/sysinstall/wizard.c b/usr.sbin/sysinstall/wizard.c index 98e0a5c..c221e55 100644 --- a/usr.sbin/sysinstall/wizard.c +++ b/usr.sbin/sysinstall/wizard.c @@ -15,7 +15,7 @@ #include <err.h> #include <libdisk.h> -int +static int scan_block(int fd, daddr_t block) { u_char foo[512]; @@ -27,7 +27,7 @@ scan_block(int fd, daddr_t block) return 0; } -void +static void Scan_Disk(Disk *d) { char device[64]; |