From 47c2c99b5115c72bc1c4ad5ba8e7d21169d982ae Mon Sep 17 00:00:00 2001 From: tg Date: Tue, 24 Jul 2001 11:50:23 +0000 Subject: Clean up the code a bit: - add $FreeBSD$; - remove unused variables; - add missing headers and prototypes; - -Wshadow. --- usr.bin/doscmd/AsyncIO.c | 17 +++++----- usr.bin/doscmd/AsyncIO.h | 2 ++ usr.bin/doscmd/Makefile.dos | 1 + usr.bin/doscmd/ParseBuffer.c | 1 + usr.bin/doscmd/README | 4 +-- usr.bin/doscmd/bios.c | 12 +------ usr.bin/doscmd/cmos.c | 1 - usr.bin/doscmd/config.c | 13 +++++--- usr.bin/doscmd/cwd.c | 73 ++++++++++++++++++++++--------------------- usr.bin/doscmd/cwd.h | 30 +++++++++--------- usr.bin/doscmd/debug.c | 2 +- usr.bin/doscmd/disktab.c | 2 ++ usr.bin/doscmd/dispatch.h | 12 +++---- usr.bin/doscmd/dos.c | 63 ++++++++++++++++++------------------- usr.bin/doscmd/ems.c | 6 ++-- usr.bin/doscmd/emsdriv.sys.uu | 2 ++ usr.bin/doscmd/exe.c | 14 +++------ usr.bin/doscmd/i386-pinsn.c | 21 ++++++++++--- usr.bin/doscmd/int13.c | 15 +++++---- usr.bin/doscmd/int14.c | 14 ++++----- usr.bin/doscmd/int16.c | 3 +- usr.bin/doscmd/int17.c | 12 +++---- usr.bin/doscmd/int2f.c | 10 +++--- usr.bin/doscmd/intff.c | 18 +++++------ usr.bin/doscmd/mem.c | 1 - usr.bin/doscmd/mouse.c | 7 ++--- usr.bin/doscmd/port.c | 8 ++--- usr.bin/doscmd/redir.com.uu | 2 ++ usr.bin/doscmd/signal.c | 1 + usr.bin/doscmd/trace.c | 2 +- usr.bin/doscmd/trap.h | 14 +++++++++ usr.bin/doscmd/xms.c | 3 -- 32 files changed, 205 insertions(+), 181 deletions(-) (limited to 'usr.bin/doscmd') diff --git a/usr.bin/doscmd/AsyncIO.c b/usr.bin/doscmd/AsyncIO.c index 992fee5..021b525 100644 --- a/usr.bin/doscmd/AsyncIO.c +++ b/usr.bin/doscmd/AsyncIO.c @@ -32,15 +32,18 @@ * $FreeBSD$ */ -#include #include #include -#include #include -#include #include +#include #include +#include +#include +#include + #include "doscmd.h" +#include "AsyncIO.h" #define FD_ISZERO(p) ((p)->fds_bits[0] == 0) @@ -55,11 +58,11 @@ * Request that ``func'' be called everytime data is available on ``fd'' */ -static fd_set fdset = { 0 }; /* File Descriptors to select on */ +static fd_set fdset; /* File Descriptors to select on */ typedef struct { void (*func)(void *, REGISTERS); - /* Function to call when data arrives */ + /* Function to call on data arrival */ void (*failure)(void *); /* Function to call on failure */ void *arg; /* Argument to above functions */ int lockcnt; /* Nested level of lock */ @@ -99,13 +102,11 @@ printf("%d: Invalid FD\n", fd); } if (firsttime) { - struct sigaction sa; - firsttime = 0; setsignal(SIGIO, HandleIO); } - if (handlers[fd].func = func) { + if ((handlers[fd].func = func) != 0) { as->lockcnt = 0; as->arg = arg; as->failure = failure; diff --git a/usr.bin/doscmd/AsyncIO.h b/usr.bin/doscmd/AsyncIO.h index b5bc9a7..745f32e 100644 --- a/usr.bin/doscmd/AsyncIO.h +++ b/usr.bin/doscmd/AsyncIO.h @@ -28,6 +28,8 @@ * SUCH DAMAGE. * * BSDI AsyncIO.h,v 2.2 1996/04/08 19:32:12 bostic Exp + * + * $FreeBSD$ */ #if defined(__cplusplus) diff --git a/usr.bin/doscmd/Makefile.dos b/usr.bin/doscmd/Makefile.dos index 5951bee..d454834 100644 --- a/usr.bin/doscmd/Makefile.dos +++ b/usr.bin/doscmd/Makefile.dos @@ -5,6 +5,7 @@ # use tools are included as uuencoded files. # To use this makefile you must have Bruce Evans bcc package installed # +# $FreeBSD$ AS86 = as86 LD86 = ld86 diff --git a/usr.bin/doscmd/ParseBuffer.c b/usr.bin/doscmd/ParseBuffer.c index 2eeaeed..cd6b2d6 100644 --- a/usr.bin/doscmd/ParseBuffer.c +++ b/usr.bin/doscmd/ParseBuffer.c @@ -33,6 +33,7 @@ */ #include +#include int ParseBuffer(obuf, av, mac) diff --git a/usr.bin/doscmd/README b/usr.bin/doscmd/README index 6f404d4..a90946c 100644 --- a/usr.bin/doscmd/README +++ b/usr.bin/doscmd/README @@ -1,17 +1,17 @@ /* BSDI README,v 2.2 1996/04/08 19:32:16 bostic Exp*/ +/* $FreeBSD$ */ This is the merged doscmd/rundos project. Please read the man page for help on configuring doscmd. Things known not to work: * No mouse support (yet) - * No ems support (yet) * No raw VGA support (yet) * Printer support (yet) * COM ports (being worked on) * redirected file system only supported for DOS 4.0 and above (3.3 will be supported in a future version) - * Graphics in an X window (not planned to work) + * Graphics in an X window (only 16 colors, very few programs) Even with this, I think it is actually a much better product. There have been problems reported with the ibmpc font and the distributed X server. diff --git a/usr.bin/doscmd/bios.c b/usr.bin/doscmd/bios.c index 1af6ccf..21c78cd 100644 --- a/usr.bin/doscmd/bios.c +++ b/usr.bin/doscmd/bios.c @@ -64,13 +64,6 @@ #define BIOS_date_stamp 0xffff5 #define BIOS_hardware_id 0xffffe -static u_char video_parms[] = { - 0x38, 40, 0x2d, 10, 0x1f, 6, 0x19, 0x1c, 2, 7, 6, 7, 0, 0, 0, 0, - 0x71, 80, 0x5a, 10, 0x1f, 6, 0x19, 0x1c, 2, 7, 6, 7, 0, 0, 0, 0, - 0x38, 40, 0x2d, 10, 0x7f, 6, 0x64, 0x70, 2, 1, 6, 7, 0, 0, 0, 0, - 0x61, 80, 0x52, 15, 0x19, 6, 0x19, 0x19, 2, 13, 11, 12, 0, 0, 0, 0, -}; - static u_char disk_params[] = { 0xdf, 2, 0x25, 2, 0x0f, 0x1b, 0xff, 0x54, 0xf6, 0x0f, 8, }; @@ -116,9 +109,6 @@ int12(regcontext_t *REGS) static void int15(regcontext_t *REGS) { - int cond; - int count; - R_FLAGS &= ~PSL_C; switch (R_AH) { @@ -277,7 +267,7 @@ bios_init(void) (1 << 1) | /* Math co-processor */ (nmice << 2) | /* No pointing device */ (2 << 4) | /* Initial video (80 x 25 C) */ - (nfloppies - 1 << 6) | /* Number of floppies - 1 */ + ((nfloppies - 1) << 6) | /* Number of floppies - 1 */ (nserial << 9) | /* Number of serial devices */ (nparallel << 14); /* Number of parallel devices */ diff --git a/usr.bin/doscmd/cmos.c b/usr.bin/doscmd/cmos.c index 1486c6f..75907ad 100644 --- a/usr.bin/doscmd/cmos.c +++ b/usr.bin/doscmd/cmos.c @@ -91,7 +91,6 @@ int day_in_year [12] = { time_t delta_clock = 0; /* locals */ -static int fast_delta_uclock; static struct timeval fast_clock; static int fast_tick; diff --git a/usr.bin/doscmd/config.c b/usr.bin/doscmd/config.c index dd1316f..fd2332b 100644 --- a/usr.bin/doscmd/config.c +++ b/usr.bin/doscmd/config.c @@ -32,12 +32,18 @@ * $FreeBSD$ */ -#include +#include +#include #include +#include #include -#include +#include #include "doscmd.h" +#include "com.h" +#include "cwd.h" +#include "tty.h" +#include "video.h" /* ** doscmdrc parser @@ -52,7 +58,7 @@ read_config(FILE *fp) int ac; int bootdrive = -1; - while (buffer = fgets(_buffer, sizeof(_buffer), fp)) { + while ((buffer = fgets(_buffer, sizeof(_buffer), fp)) != 0) { char *comment = strchr(buffer, '#'); char *equal; @@ -195,7 +201,6 @@ init_hard: int port; int addr; unsigned char irq; - int i; if ((ac != 5) || (!isdigit(av[1][3]))) { fprintf(stderr, "Usage: assign com[1-4] path addr irq\n"); diff --git a/usr.bin/doscmd/cwd.c b/usr.bin/doscmd/cwd.c index f7fea8e..97cbcbd 100644 --- a/usr.bin/doscmd/cwd.c +++ b/usr.bin/doscmd/cwd.c @@ -42,7 +42,9 @@ #include #include #include + #include "doscmd.h" +#include "cwd.h" #define D_REDIR 0x0080000 /* XXX - ack */ #define D_TRAPS3 0x0200000 @@ -65,7 +67,7 @@ typedef struct Name_t { #define MAX_DRIVE 26 -static Path_t paths[MAX_DRIVE] = { 0, }; +static Path_t paths[MAX_DRIVE]; static Name_t *names; extern int diskdrive; @@ -269,8 +271,8 @@ dos_makepath(u_char *where, u_char *newpath) int dos_setcwd(u_char *where) { - u_char newpath[1024]; - u_char realpath[1024]; + u_char new_path[1024]; + u_char real_path[1024]; int drive; struct stat sb; Path_t *d; @@ -278,21 +280,21 @@ dos_setcwd(u_char *where) debug(D_REDIR, "dos_setcwd(%s)\n", where); - error = dos_makepath(where, newpath); + error = dos_makepath(where, new_path); if (error) return (error); - error = dos_to_real_path(newpath, realpath, &drive); + error = dos_to_real_path(new_path, real_path, &drive); if (error) return (error); - if (ustat(realpath, &sb) < 0 || !S_ISDIR(sb.st_mode)) + if (ustat(real_path, &sb) < 0 || !S_ISDIR(sb.st_mode)) return (PATH_NOT_FOUND); - if (uaccess(realpath, R_OK | X_OK)) + if (uaccess(real_path, R_OK | X_OK)) return (PATH_NOT_FOUND); d = &paths[drive]; - d->len = ustrlen(newpath + 2); + d->len = ustrlen(new_path + 2); if (d->len + 1 > d->maxlen) { free(d->cwd); @@ -300,34 +302,33 @@ dos_setcwd(u_char *where) d->cwd = (u_char *)malloc(d->maxlen); if (d->cwd == NULL) fatal("malloc in dos_setcwd for %c:%s: %s", drntol(drive), - newpath, strerror(errno)); + new_path, strerror(errno)); } - ustrcpy(d->cwd, newpath + 2); + ustrncpy(d->cwd, new_path + 2, d->maxlen - d->len); return (0); } /* - * Given a DOS path dospath and a drive, convert it to a BSD pathname - * and store the result in realpath. + * Given a DOS path dos_path and a drive, convert it to a BSD pathname + * and store the result in real_path. * Return DOS errno on failure. */ int -dos_to_real_path(u_char *dospath, u_char *realpath, int *drivep) +dos_to_real_path(u_char *dos_path, u_char *real_path, int *drivep) { Path_t *d; - u_char newpath[1024]; + u_char new_path[1024]; u_char *rp; - int error; u_char **dirs; u_char *dir; int drive; - debug(D_REDIR, "dos_to_real_path(%s)\n", dospath); + debug(D_REDIR, "dos_to_real_path(%s)\n", dos_path); - if (dospath[0] != '\0' && dospath[1] == ':') { - drive = drlton(*dospath); - dospath++; - dospath++; + if (dos_path[0] != '\0' && dos_path[1] == ':') { + drive = drlton(*dos_path); + dos_path++; + dos_path++; } else { drive = diskdrive; } @@ -336,15 +337,15 @@ dos_to_real_path(u_char *dospath, u_char *realpath, int *drivep) if (d->cwd == NULL) return (DISK_DRIVE_INVALID); - ustrcpy(realpath, d->path); + ustrcpy(real_path, d->path); - rp = realpath; + rp = real_path; while (*rp) ++rp; - ustrcpy(newpath, dospath); + ustrncpy(new_path, dos_path, 1024 - ustrlen(new_path)); - dirs = get_entries(newpath); + dirs = get_entries(new_path); if (dirs == NULL) return (PATH_NOT_FOUND); @@ -353,7 +354,7 @@ dos_to_real_path(u_char *dospath, u_char *realpath, int *drivep) * There are no . or .. entries to worry about either */ - while (dir = *++dirs) { + while ((dir = *++dirs) != 0) { *rp++ = '/'; dos_to_real(dir, rp); while (*rp) @@ -398,19 +399,19 @@ u_char cattr[256] = { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, }; -inline +inline int isvalid(unsigned c) { return (cattr[c & 0xff] == 1); } -inline +inline int isdot(unsigned c) { return (cattr[c & 0xff] == 3); } -inline +inline int isslash(unsigned c) { return (cattr[c & 0xff] == 4); @@ -693,6 +694,7 @@ get_entries(u_char *path) * Return file system statistics for drive. * Return the DOS errno on failure. */ +int get_space(int drive, fsstat_t *fs) { Path_t *d; @@ -838,9 +840,10 @@ static search_t dir_search = {dp : NULL}; * The DTA is populated as required by DOS, but the state area is ignored. * Returns DOS errno on failure. */ +int find_first(u_char *path, int attr, dosdir_t *dir, find_block_t *dta) { - u_char newpath[1024], realpath[1024]; + u_char new_path[1024], real_path[1024]; u_char *expr, *slash; int drive; int error; @@ -848,11 +851,11 @@ find_first(u_char *path, int attr, dosdir_t *dir, find_block_t *dta) debug(D_REDIR, "find_first(%s, %x, %x)\n", path, attr, dta); - error = dos_makepath(path, newpath); + error = dos_makepath(path, new_path); if (error) return (error); - expr = newpath; + expr = new_path; slash = 0; while (*expr != '\0') { if (*expr == '\\' || *expr == '/') @@ -861,7 +864,7 @@ find_first(u_char *path, int attr, dosdir_t *dir, find_block_t *dta) } *slash++ = '\0'; - error = dos_to_real_path(newpath, realpath, &drive); + error = dos_to_real_path(new_path, real_path, &drive); if (error) return (error); @@ -871,11 +874,11 @@ find_first(u_char *path, int attr, dosdir_t *dir, find_block_t *dta) if (search->dp) /* stale search? */ closedir(search->dp); - search->dp = opendir(realpath); + search->dp = opendir(real_path); if (search->dp == NULL) return (PATH_NOT_FOUND); - ustrcpy(search->searchdir, realpath); + ustrncpy(search->searchdir, real_path, 1024 - ustrlen(real_path)); search->searchend = search->searchdir; while (*search->searchend) ++search->searchend; @@ -910,7 +913,7 @@ find_next(dosdir_t *dir, find_block_t *dta) debug(D_REDIR, "find_next()\n"); #endif - while (d = readdir(search->dp)) { + while ((d = readdir(search->dp)) != 0) { real_to_dos((u_char *)d->d_name, name); to_dos_fcb(dir->name, name); #if 0 diff --git a/usr.bin/doscmd/cwd.h b/usr.bin/doscmd/cwd.h index 10d97bf..4e61558 100644 --- a/usr.bin/doscmd/cwd.h +++ b/usr.bin/doscmd/cwd.h @@ -98,18 +98,18 @@ uaccess(u_char *s, int mode) return(access((char *)s, mode)); } -extern void init_path(int drive, u_char *base, u_char *where); -extern void dos_makereadonly(int drive); -extern int dos_readonly(int drive); -extern u_char *dos_getcwd(int drive); -extern u_char *dos_getpath(int drive); -extern int dos_makepath(u_char *where, u_char *newpath); -extern int dos_setcwd(u_char *where); -extern int dos_to_real_path(u_char *dospath, u_char *realpath, int *); -extern void real_to_dos(u_char *real, u_char *dos); -extern void dos_to_real(u_char *dos, u_char *real); -extern u_char **get_entries(u_char *path); -extern int get_space(int drive, fsstat_t *fs); -extern int find_first(u_char *path, int attr, - dosdir_t *dir, find_block_t *dta); -extern int find_next(dosdir_t *dir, find_block_t *dta); +extern void init_path(int, u_char *, u_char *); +extern void dos_makereadonly(int); +extern int dos_readonly(int); +extern u_char *dos_getcwd(int); +extern u_char *dos_getpath(int); +extern int dos_makepath(u_char *, u_char *); +extern int dos_match(u_char *, u_char *); +extern int dos_setcwd(u_char *); +extern int dos_to_real_path(u_char *, u_char *, int *); +extern void real_to_dos(u_char *, u_char *); +extern void dos_to_real(u_char *, u_char *); +extern u_char **get_entries(u_char *); +extern int get_space(int, fsstat_t *); +extern int find_first(u_char *, int, dosdir_t *, find_block_t *); +extern int find_next(dosdir_t *, find_block_t *); diff --git a/usr.bin/doscmd/debug.c b/usr.bin/doscmd/debug.c index bc3524a..20c7fed 100644 --- a/usr.bin/doscmd/debug.c +++ b/usr.bin/doscmd/debug.c @@ -38,6 +38,7 @@ #include #include "doscmd.h" +#include "tty.h" /* debug output goes here */ FILE *debugf = stderr; @@ -107,7 +108,6 @@ fatal (char *fmt, ...) if (xmode) { char buf[1024]; - char buf2[1024]; char *m; va_start (args, fmt); diff --git a/usr.bin/doscmd/disktab.c b/usr.bin/doscmd/disktab.c index a9b0861..a467a02 100644 --- a/usr.bin/doscmd/disktab.c +++ b/usr.bin/doscmd/disktab.c @@ -28,6 +28,8 @@ * SUCH DAMAGE. * * BSDI disktab.c,v 2.2 1996/04/08 19:32:27 bostic Exp + * + * $FreeBSD$ */ /* XXX goaway (requires change to config.c) */ diff --git a/usr.bin/doscmd/dispatch.h b/usr.bin/doscmd/dispatch.h index 7506c53..b1932af 100644 --- a/usr.bin/doscmd/dispatch.h +++ b/usr.bin/doscmd/dispatch.h @@ -56,16 +56,16 @@ struct intfunc_table ** that the handler listed with IFT_NOSUBFUNC should be last. */ static inline void -intfunc_init(struct intfunc_table table[], int index[]) +intfunc_init(struct intfunc_table table[], int idx[]) { int hn; for (hn = 0; hn < 256; hn++) /* initialise all no-handler state */ - index[hn] = -1; /* default to no handler */ + idx[hn] = -1; /* default to no handler */ for (hn = 0; table[hn].func >= 0; hn++) /* walk list of handlers and add references */ - if (index[table[hn].func] == -1 ) /* reference first handler */ - index[table[hn].func] = hn; + if (idx[table[hn].func] == -1 ) /* reference first handler */ + idx[table[hn].func] = hn; } /* @@ -73,9 +73,9 @@ intfunc_init(struct intfunc_table table[], int index[]) ** described by (sc), or -1 if none exist */ static inline int -intfunc_find(struct intfunc_table table[], int index[], int func, int subfunc) +intfunc_find(struct intfunc_table table[], int idx[], int func, int subfunc) { - int ent = index[func]; /* look for handler */ + int ent = idx[func]; /* look for handler */ while ((ent >= 0) && /* scan entries for function */ (table[ent].func == func)) { diff --git a/usr.bin/doscmd/dos.c b/usr.bin/doscmd/dos.c index 43a290b..9b6954e5 100644 --- a/usr.bin/doscmd/dos.c +++ b/usr.bin/doscmd/dos.c @@ -34,20 +34,22 @@ * $FreeBSD$ */ -#include "doscmd.h" -#include #include #include #include -#include -#include -#include -#include #include +#include +#include +#include #include #include +#include +#include +#include "doscmd.h" +#include "cwd.h" #include "dispatch.h" +#include "tty.h" static u_long upcase_vector; @@ -143,8 +145,6 @@ upcase(u_char c) static void upcase_entry(regcontext_t *REGS) { - u_char c; - R_AL = upcase(R_AL); } @@ -156,13 +156,7 @@ static int int21_free(regcontext_t *REGS) { fsstat_t fs; - struct statfs fsstat; - char fspath[PATH_MAX]; - int junk; - int spc,fclus,bps,nclus; - long nsec; int error; - int dd_save; int drive; /* work out drive */ @@ -223,8 +217,6 @@ pack_name(u_char *p, u_char *q) static void dosdir_to_dta(dosdir_t *dosdir, find_block_t *dta) { - u_char *p, *q; - dta->attr = dosdir->attr; dta->time = dosdir->time; dta->date = dosdir->date; @@ -444,6 +436,8 @@ static int int21_00(regcontext_t *REGS) { done(REGS,0); + /* keep `gcc -Wall' happy */ + return(0); } /* @@ -456,7 +450,7 @@ int21_01(regcontext_t *REGS) { int n; - if ((n = tty_read(®S->sc, TTYF_BLOCKALL)) >= 0) + if ((n = tty_read((regcontext_t *)®S->sc, TTYF_BLOCKALL)) >= 0) R_AL = n; return(0); } @@ -487,7 +481,7 @@ int21_06(regcontext_t *REGS) /* XXX - should be able to read a file */ if (R_DL == 0xff) { - n = tty_read(®S->sc, TTYF_ECHO|TTYF_REDIRECT); + n = tty_read((regcontext_t *)®S->sc, TTYF_ECHO|TTYF_REDIRECT); if (n < 0) { R_FLAGS |= PSL_Z; /* nothing available */ R_AL = 0; @@ -511,7 +505,8 @@ int21_06(regcontext_t *REGS) static int int21_07(regcontext_t *REGS) { - R_AL = tty_read(®S->sc, TTYF_BLOCK|TTYF_REDIRECT) & 0xff; + R_AL = tty_read((regcontext_t *)®S->sc, + TTYF_BLOCK|TTYF_REDIRECT) & 0xff; return(0); } @@ -525,7 +520,8 @@ int21_08(regcontext_t *REGS) { int n; - if ((n = tty_read(®S->sc, TTYF_BLOCK|TTYF_CTRL|TTYF_REDIRECT)) >= 0) + if ((n = tty_read((regcontext_t *)®S->sc, + TTYF_BLOCK|TTYF_CTRL|TTYF_REDIRECT)) >= 0) R_AL = n; return(0); } @@ -579,7 +575,8 @@ int21_0a(regcontext_t *REGS) /* read loop */ while (1) { - n = tty_read(®S->sc, TTYF_BLOCK|TTYF_CTRL|TTYF_REDIRECT); + n = tty_read((regcontext_t *)®S->sc, + TTYF_BLOCK|TTYF_CTRL|TTYF_REDIRECT); if (n < 0) /* end of input */ n = '\r'; /* make like CR */ @@ -1271,9 +1268,8 @@ int21_3e(regcontext_t *REGS) static int int21_3f(regcontext_t *REGS) { - int fd; char *addr; - int nbytes,n; + int n; int avail; addr = (char *)MAKEPTR(R_DS, R_DX); @@ -1540,6 +1536,7 @@ static int int21_44_9(regcontext_t *REGS) { R_DX = 0x1200; /* disk is remote, direct I/O not allowed */ + return (0); } /* @@ -1789,12 +1786,12 @@ static int int21_57_0(regcontext_t *REGS) { struct stat sb; - u_short date,time; + u_short date, mtime; if (fstat(R_BX, &sb) < 0) return (HANDLE_INVALID); - encode_dos_file_time(sb.st_mtime, &date, &time); - R_CX = time; + encode_dos_file_time(sb.st_mtime, &date, &mtime); + R_CX = mtime; R_DX = date; return(0); } @@ -1951,6 +1948,7 @@ static int int21_62(regcontext_t *REGS) { R_BX = pspseg; + return(0); } /* @@ -2052,6 +2050,8 @@ setfcb_rec(struct fcb *fcbp, int n) fcbp->fcbRandomRecNo = total; fcbp->fcbCurRecNo = total % 128; fcbp->fcbCurBlockNo = total / 128; + + return(0); } void @@ -2491,12 +2491,12 @@ static void int21(regcontext_t *REGS) { int error; - int index; + int idx; /* look for a handler */ - index = intfunc_find(int21_table, int21_fastlookup, R_AH, R_AL); + idx = intfunc_find(int21_table, int21_fastlookup, R_AH, R_AL); - if (index == -1) { /* no matching functions */ + if (idx == -1) { /* no matching functions */ unknown_int3(0x21, R_AH, R_AL, REGS); R_FLAGS |= PSL_C; /* Flag an error */ R_AX = 0xff; @@ -2504,9 +2504,9 @@ int21(regcontext_t *REGS) } /* call the handler */ - error = int21_table[index].handler(REGS); + error = int21_table[idx].handler(REGS); debug(D_DOSCALL, "msdos call %02x (%s) returns %d (%s)\n", - int21_table[index].func, int21_table[index].desc, error, + int21_table[idx].func, int21_table[idx].desc, error, ((error >= 0) && (error <= dos_ret_size)) ? dos_return[error] : "unknown"); if (error) { @@ -2542,7 +2542,6 @@ void dos_init(void) { u_long vec; - int hn; /* hook vectors */ vec = insert_softint_trampoline(); diff --git a/usr.bin/doscmd/ems.c b/usr.bin/doscmd/ems.c index 14bbd94..c341a74 100644 --- a/usr.bin/doscmd/ems.c +++ b/usr.bin/doscmd/ems.c @@ -441,7 +441,6 @@ ems_entry(regcontext_t *REGS) */ case PAGE_MAP_PARTIAL: { - u_long addr; int subfunction; EMScontext *src, *dest; @@ -1077,7 +1076,6 @@ ems_entry(regcontext_t *REGS) R_AH = EMS_FUNCTION_DISABLED; break; -unknown: default: debug(D_ALWAYS, "EMS: Unknown function called: %02x\n", R_AH); R_AH = EMS_FUNC_NOSUP; @@ -1095,7 +1093,7 @@ init_mapfile() /* Sanity */ if (ems_max_size == 0) - return; + return 0; strcpy(path, EMS_MAP_PATH); strcat(path, EMS_MAP_FILE); @@ -1251,6 +1249,8 @@ find_next_free_handle() return (i); } fatal("EMS handle count garbled, should not happen\n"); + /* quiet 'gcc -Wall' */ + return (-1); } /* Look for a named handle, returns 0 if not found, else handle */ diff --git a/usr.bin/doscmd/emsdriv.sys.uu b/usr.bin/doscmd/emsdriv.sys.uu index fae517e..a896efd 100644 --- a/usr.bin/doscmd/emsdriv.sys.uu +++ b/usr.bin/doscmd/emsdriv.sys.uu @@ -1,3 +1,5 @@ +$FreeBSD$ + begin 644 emsdriv.sys M_____P#`.`!#`$5-35A86%@P````````M`"``(``@`"``(``@`"``(``@`"` M`(``@`"``(``@``NB1X2`"Z,!A0`RU!345(>!E=650X?Q#X2`":*70(P_X/[ diff --git a/usr.bin/doscmd/exe.c b/usr.bin/doscmd/exe.c index ce9a8f0..083a95d 100644 --- a/usr.bin/doscmd/exe.c +++ b/usr.bin/doscmd/exe.c @@ -31,10 +31,13 @@ * $FreeBSD$ */ -#include #include -#include +#include #include +#include +#include +#include + #include "doscmd.h" /* exports */ @@ -45,7 +48,6 @@ int curpsp = 0; static int psp_s[10] = { 0 }; static int env_s[10]; static regcontext_t frames[10]; -static char *env_block; static int make_environment (char *cmdname, char **env) @@ -363,12 +365,6 @@ load_overlay(int fd, int start_segment, int reloc_segment) load_exe(fd, start_segment, reloc_segment, &hdr, text_size); } -static int -get_psp(void) -{ - return(psp_s[curpsp]); -} - int get_env(void) { diff --git a/usr.bin/doscmd/i386-pinsn.c b/usr.bin/doscmd/i386-pinsn.c index 53e9e6c..f4037b5 100644 --- a/usr.bin/doscmd/i386-pinsn.c +++ b/usr.bin/doscmd/i386-pinsn.c @@ -19,6 +19,8 @@ You should have received a copy of the GNU General Public License along with GDB; see the file COPYING. If not, write to the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ +/* $FreeBSD$ */ + /* * 80386 instruction printer by Pace Willisson (pace@prep.ai.mit.edu) * July 1988 @@ -36,6 +38,12 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ #include #include +#include "doscmd.h" + +static void dofloat(void); +static void oappend(char *); +static void putop(char *); + #define Eb OP_E, b_mode #define indirEb OP_indirE, b_mode #define Gb OP_G, b_mode @@ -845,7 +853,8 @@ struct dis386 grps[][8] = { static int prefixes; -ckprefix () +static void +ckprefix(void) { prefixes = 0; while (1) @@ -914,6 +923,7 @@ static unsigned long start_pc; * 100 bytes is certainly enough, unless symbol printing is added later * The function returns the length of this instruction in bytes. */ +int i386dis (ucs, uip, inbuf, outbuf, mode) unsigned short ucs; unsigned short uip; @@ -921,7 +931,6 @@ i386dis (ucs, uip, inbuf, outbuf, mode) char *outbuf; { struct dis386 *dp; - char *p; int i; int enter_instruction; char *first, *second, *third; @@ -1287,6 +1296,7 @@ char *fgrps[][8] = { }; +static void dofloat () { struct dis386 *dp; @@ -1338,8 +1348,9 @@ OP_STi (ignore) /* capital letters in template are macros */ +static void putop (template) - char *template; + char *template; { char *p; @@ -1370,8 +1381,8 @@ putop (template) *obufp = 0; } -oappend (s) -char *s; +static void +oappend(char *s) { strcpy (obufp, s); obufp += strlen (s); diff --git a/usr.bin/doscmd/int13.c b/usr.bin/doscmd/int13.c index 7873b0c..a58782c 100644 --- a/usr.bin/doscmd/int13.c +++ b/usr.bin/doscmd/int13.c @@ -32,9 +32,12 @@ * $FreeBSD$ */ -#include "doscmd.h" - #include +#include +#include +#include + +#include "doscmd.h" #define FDCHANGED _IOR('F', 64, int) @@ -108,7 +111,7 @@ cylsize(struct diskinfo *di) static u_long ftable = 0xF1000; /* Floppy table */ static u_long htable = 0xF1020; /* Hard disk table */ -static struct diskinfo diskinfo[26] = { 0 }; +static struct diskinfo diskinfo[26]; static struct diskinfo floppyinfo[] = { { 0, 9, 40, 1, 512, -1, 0, 0, }, /* Probably not correct */ @@ -324,7 +327,7 @@ init_hdisk(int drive, int cyl, int head, int tracksize, char *file, char *fake_p return(drive); } -static inline +static inline int bps(int size) { switch (size) { @@ -336,6 +339,8 @@ bps(int size) fprintf(stderr, "Invalid sector size: %d\n", size); quit(1); } + /* keep `gcc -Wall' happy */ + return(0); } int @@ -441,8 +446,6 @@ search_floppy(int i) return(i < nfloppies ? diskinfo[i].type : 0); } -static int icnt = 0; - #define seterror(err) { \ if (drive & 0x80) \ hd_status = err; \ diff --git a/usr.bin/doscmd/int14.c b/usr.bin/doscmd/int14.c index 4d367eb..0fc0fea 100644 --- a/usr.bin/doscmd/int14.c +++ b/usr.bin/doscmd/int14.c @@ -35,9 +35,13 @@ * $FreeBSD$ */ -#include "doscmd.h" #include +#include +#include #include +#include + +#include "doscmd.h" #include "com.h" struct com_data_struct com_data[N_COMS_MAX]; @@ -53,9 +57,7 @@ int write_div_latches() {} void int14(regcontext_t *REGS) { - int reg_num; struct com_data_struct *cdsp; - int i; int nbytes; char c; @@ -142,12 +144,8 @@ int14(regcontext_t *REGS) void com_set_line(struct com_data_struct *cdsp, unsigned char port, unsigned char param) { - struct termios tty; struct stat stat_buf; - int mode = 0; /* read|write */ - int speed; int reg_num; - int ret_val; debug (D_PORT, "com_set_line: cdsp = 0x%08X, port = 0x%04x," "param = 0x%04X.\n", cdsp, port, param); @@ -409,7 +407,7 @@ com_port_out(int port, unsigned char val) write_div_latches(cdsp); } else { errno = 0; - nbytes = write(cdsp->fd, val, 1); + nbytes = write(cdsp->fd, &val, 1); debug (D_PORT, "write of 0x%02x to fd %d on '%s' returned %d errno %d\n", val, cdsp->fd, cdsp->path, nbytes, errno); if (nbytes != 1) diff --git a/usr.bin/doscmd/int16.c b/usr.bin/doscmd/int16.c index 517e131..cdd0ccee 100644 --- a/usr.bin/doscmd/int16.c +++ b/usr.bin/doscmd/int16.c @@ -33,6 +33,7 @@ */ #include "doscmd.h" +#include "tty.h" #define K_NEXT *(u_short *)0x41a #define K_FREE *(u_short *)0x41c @@ -77,8 +78,6 @@ sleep_poll(void) void int16(regcontext_t *REGS) { - int c; - if (!xmode && !raw_kbd) { if (vflag) dump_regs(REGS); fatal ("int16 func 0x%x only supported in X mode\n", R_AH); diff --git a/usr.bin/doscmd/int17.c b/usr.bin/doscmd/int17.c index 0cb162b..ee693a8 100644 --- a/usr.bin/doscmd/int17.c +++ b/usr.bin/doscmd/int17.c @@ -32,9 +32,13 @@ * $FreeBSD$ */ -#include "doscmd.h" +#include +#include #include #include +#include + +#include "doscmd.h" static int lpt_fd[4] = { -1, -1, -1, -1, }; static FILE *lpt_file[4] = { 0, 0, 0, 0}; @@ -44,17 +48,13 @@ static int timeout[4] = { 30, 30, 30, 30 }; static int last_poll[4] = { 0, 0, 0, 0}; static int last_count[4] = { 0, 0, 0, 0}; static int current_count[4] = { 0, 0, 0, 0}; -static int alarm_active[4] = { 0, 0, 0, 0}; -static int alarm_set = 0; static void open_printer(int printer); void int17(regcontext_t *REGS) { - char printer_name[20]; int fd; - int p; u_char c; switch (R_AH) { @@ -133,7 +133,7 @@ open_printer(int printer) * if printer is direct then open output device. */ if (direct[printer]) { - if (p = queue[printer]) { + if ((p = queue[printer]) != 0) { if ((fd = open(p, O_WRONLY|O_APPEND|O_CREAT, 0666)) < 0) { perror(p); return; diff --git a/usr.bin/doscmd/int2f.c b/usr.bin/doscmd/int2f.c index 8bfe3d8..e4ab619 100644 --- a/usr.bin/doscmd/int2f.c +++ b/usr.bin/doscmd/int2f.c @@ -34,6 +34,7 @@ #include "doscmd.h" #include "dispatch.h" +#include "tty.h" /* ** Multiplex interrupt. @@ -52,6 +53,7 @@ int2f_printer(regcontext_t *REGS) { debug (D_FILE_OPS, "Called printer function 0x%02x", R_AH); R_AL = FUNC_NUM_IVALID; + return(0); } /* @@ -155,13 +157,13 @@ static struct intfunc_table int2f_table[] = { void int2f(regcontext_t *REGS) { - int index; + int idx; /* look up the handler for the current function */ - index = intfunc_search(int2f_table, R_AH, R_AL); + idx = intfunc_search(int2f_table, R_AH, R_AL); - if (index >= 0) { /* respond on multiplex chain */ - int2f_table[index].handler(REGS); + if (idx >= 0) { /* respond on multiplex chain */ + int2f_table[idx].handler(REGS); } else { unknown_int2(0x2f, R_AH, REGS); } diff --git a/usr.bin/doscmd/intff.c b/usr.bin/doscmd/intff.c index 7955f81..bb18cc0 100644 --- a/usr.bin/doscmd/intff.c +++ b/usr.bin/doscmd/intff.c @@ -32,10 +32,12 @@ * $FreeBSD$ */ -#include "doscmd.h" #include #include +#include +#include "doscmd.h" +#include "cwd.h" #include "dispatch.h" static LOL *lol = 0; /* DOS list-of-lists */ @@ -695,17 +697,15 @@ int2f11_validate(regcontext_t *REGS) int int2f_11(regcontext_t *REGS) { - int index; + int idx; int error; - char *fname; - if (!sda) { /* not initialised yet */ error = FUNC_NUM_IVALID; } else { - index = intfunc_find(int2f11_table, int2f11_fastlookup, R_AL, 0); - if (index == -1) { + idx = intfunc_find(int2f11_table, int2f11_fastlookup, R_AL, 0); + if (idx == -1) { debug(D_ALWAYS,"no handler for int2f:11:%x\n", R_AL); return(0); } @@ -716,9 +716,9 @@ int2f_11(regcontext_t *REGS) error = -1; /* not handled by us */ } else { debug(D_REDIR, "REDIR: %02x (%s)\n", - int2f11_table[index].func, int2f11_table[index].desc); + int2f11_table[idx].func, int2f11_table[idx].desc); /* call the handler */ - error = int2f11_table[index].handler(REGS); + error = int2f11_table[idx].handler(REGS); if (error != -1) debug(D_REDIR, "REDIR: returns %d (%s)\n", error, ((error >= 0) && (error <= dos_ret_size)) ? dos_return[error] : "unknown"); @@ -782,7 +782,7 @@ init_drives(void) /* for all possible drives */ for (drive = 0; drive < 26; ++drive) { - if (path = dos_getpath(drive)) /* assigned to a path? */ + if ((path = dos_getpath(drive)) != 0) /* assigned to a path? */ install_drive(drive, path); /* make it visible to DOS */ } } diff --git a/usr.bin/doscmd/mem.c b/usr.bin/doscmd/mem.c index bae413f..959ea8f 100644 --- a/usr.bin/doscmd/mem.c +++ b/usr.bin/doscmd/mem.c @@ -224,7 +224,6 @@ int mem_adjust(int addr, int size, int *availp) { char *mp; - int delta, nxtsiz; debug(D_MEMORY, "%04x: adjust(%05x)\n", addr, size); addr <<= 4; diff --git a/usr.bin/doscmd/mouse.c b/usr.bin/doscmd/mouse.c index 93416b8..1aa4ae0 100644 --- a/usr.bin/doscmd/mouse.c +++ b/usr.bin/doscmd/mouse.c @@ -37,7 +37,7 @@ mouse_t mouse_status; u_char *mouse_area = 0; -int nmice = 0; +int nmice = 1; static void mouse_probe(void) @@ -49,7 +49,6 @@ int33(regcontext_t *REGS) { u_long vec; u_short mask; - void *addr; int i; if (!nmice) { @@ -145,8 +144,6 @@ int33(regcontext_t *REGS) mouse_probe(); R_CX = mouse_status.x - mouse_status.lastx; R_DX = mouse_status.y - mouse_status.lasty; - mouse_status.lastx - mouse_status.x; - mouse_status.lasty - mouse_status.y; break; case 0x0c: /* Set event handler */ @@ -231,7 +228,7 @@ int33(regcontext_t *REGS) mouse_status.doubling = R_DX; break; - case 0x1b: /* set mouse sensitivity */ + case 0x1b: /* get mouse sensitivity */ R_BX = mouse_status.hmickey; R_CX = mouse_status.vmickey; R_DX = mouse_status.doubling; diff --git a/usr.bin/doscmd/port.c b/usr.bin/doscmd/port.c index fe5b5a8..5fcd3a10 100644 --- a/usr.bin/doscmd/port.c +++ b/usr.bin/doscmd/port.c @@ -32,15 +32,15 @@ * $FreeBSD$ */ +#include +#include + #include "doscmd.h" +#include "tty.h" #define MINPORT 0x000 #define MAXPORT_MASK (MAXPORT - 1) -#include -#include -static int consfd = -1; - #define in(port) \ ({ \ register int _inb_result; \ diff --git a/usr.bin/doscmd/redir.com.uu b/usr.bin/doscmd/redir.com.uu index 0bdf492..58af948 100644 --- a/usr.bin/doscmd/redir.com.uu +++ b/usr.bin/doscmd/redir.com.uu @@ -1,3 +1,5 @@ +$FreeBSD$ + begin 644 redir.com MM%+-(7(TB1Y*`8S`HTP!'K@&73`&+ M-DX!BSY0`