summaryrefslogtreecommitdiffstats
path: root/usr.bin/doscmd/dos.c
diff options
context:
space:
mode:
Diffstat (limited to 'usr.bin/doscmd/dos.c')
-rw-r--r--usr.bin/doscmd/dos.c63
1 files changed, 31 insertions, 32 deletions
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 <dirent.h>
#include <sys/ioctl.h>
#include <sys/param.h>
#include <sys/mount.h>
-#include <unistd.h>
-#include <time.h>
-#include <glob.h>
-#include <errno.h>
#include <ctype.h>
+#include <dirent.h>
+#include <errno.h>
+#include <glob.h>
#include <paths.h>
#include <stddef.h>
+#include <time.h>
+#include <unistd.h>
+#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(&REGS->sc, TTYF_BLOCKALL)) >= 0)
+ if ((n = tty_read((regcontext_t *)&REGS->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(&REGS->sc, TTYF_ECHO|TTYF_REDIRECT);
+ n = tty_read((regcontext_t *)&REGS->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(&REGS->sc, TTYF_BLOCK|TTYF_REDIRECT) & 0xff;
+ R_AL = tty_read((regcontext_t *)&REGS->sc,
+ TTYF_BLOCK|TTYF_REDIRECT) & 0xff;
return(0);
}
@@ -525,7 +520,8 @@ int21_08(regcontext_t *REGS)
{
int n;
- if ((n = tty_read(&REGS->sc, TTYF_BLOCK|TTYF_CTRL|TTYF_REDIRECT)) >= 0)
+ if ((n = tty_read((regcontext_t *)&REGS->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(&REGS->sc, TTYF_BLOCK|TTYF_CTRL|TTYF_REDIRECT);
+ n = tty_read((regcontext_t *)&REGS->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();
OpenPOWER on IntegriCloud