summaryrefslogtreecommitdiffstats
path: root/usr.bin/doscmd
diff options
context:
space:
mode:
authortg <tg@FreeBSD.org>2001-08-03 10:47:56 +0000
committertg <tg@FreeBSD.org>2001-08-03 10:47:56 +0000
commit35c464f8db5c9063cd84d117cfee4f41f3a34d7d (patch)
treedbd198ff9f3b1109120093a7b905cdf730a13435 /usr.bin/doscmd
parent0f2b8ea245e81d2c129d6319196108b8586bed63 (diff)
downloadFreeBSD-src-35c464f8db5c9063cd84d117cfee4f41f3a34d7d.zip
FreeBSD-src-35c464f8db5c9063cd84d117cfee4f41f3a34d7d.tar.gz
Fix warnings from `-Wmissing-prototypes'. Staticize.
Diffstat (limited to 'usr.bin/doscmd')
-rw-r--r--usr.bin/doscmd/AsyncIO.c4
-rw-r--r--usr.bin/doscmd/ParseBuffer.c1
-rw-r--r--usr.bin/doscmd/bios.c5
-rw-r--r--usr.bin/doscmd/cwd.c14
-rw-r--r--usr.bin/doscmd/disktab.c2
-rw-r--r--usr.bin/doscmd/dos.c8
-rw-r--r--usr.bin/doscmd/doscmd.h112
-rw-r--r--usr.bin/doscmd/ems.c45
-rw-r--r--usr.bin/doscmd/i386-pinsn.c113
-rw-r--r--usr.bin/doscmd/int14.c32
-rw-r--r--usr.bin/doscmd/int16.c1
-rw-r--r--usr.bin/doscmd/trace.c6
-rw-r--r--usr.bin/doscmd/trap.c2
-rw-r--r--usr.bin/doscmd/tty.c135
-rw-r--r--usr.bin/doscmd/tty.h25
-rw-r--r--usr.bin/doscmd/xms.c2
16 files changed, 231 insertions, 276 deletions
diff --git a/usr.bin/doscmd/AsyncIO.c b/usr.bin/doscmd/AsyncIO.c
index 021b525..6b75baf 100644
--- a/usr.bin/doscmd/AsyncIO.c
+++ b/usr.bin/doscmd/AsyncIO.c
@@ -132,7 +132,7 @@ static void
CleanIO()
{
int x;
- static struct timeval tv = { 0 };
+ static struct timeval tv;
/*
* For every file des in fd_set, we check to see if it
@@ -173,7 +173,7 @@ HandleIO(struct sigframe *sf)
++in_handler;
for (;;) {
- static struct timeval tv = { 0 };
+ static struct timeval tv;
fd_set readset;
int x;
int fd;
diff --git a/usr.bin/doscmd/ParseBuffer.c b/usr.bin/doscmd/ParseBuffer.c
index cd6b2d6..1618048 100644
--- a/usr.bin/doscmd/ParseBuffer.c
+++ b/usr.bin/doscmd/ParseBuffer.c
@@ -35,6 +35,7 @@
#include <stdlib.h>
#include <string.h>
+#include "doscmd.h"
int
ParseBuffer(obuf, av, mac)
char *obuf;
diff --git a/usr.bin/doscmd/bios.c b/usr.bin/doscmd/bios.c
index 21c78cd..5feb086 100644
--- a/usr.bin/doscmd/bios.c
+++ b/usr.bin/doscmd/bios.c
@@ -147,11 +147,6 @@ int15(regcontext_t *REGS)
}
}
-
-extern void int16(regcontext_t *REGS);
-extern void int17(regcontext_t *REGS);
-extern void int1a(regcontext_t *REGS);
-
void
bios_init(void)
{
diff --git a/usr.bin/doscmd/cwd.c b/usr.bin/doscmd/cwd.c
index 17b381e..82d8a82 100644
--- a/usr.bin/doscmd/cwd.c
+++ b/usr.bin/doscmd/cwd.c
@@ -46,6 +46,12 @@
#include "doscmd.h"
#include "cwd.h"
+/* Local functions */
+static inline int isvalid(unsigned);
+static inline int isdot(unsigned);
+static inline int isslash(unsigned);
+static void to_dos_fcb(u_char *, u_char *);
+
#define D_REDIR 0x0080000 /* XXX - ack */
#define D_TRAPS3 0x0200000
@@ -399,19 +405,19 @@ u_char cattr[256] = {
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
};
-inline int
+static inline int
isvalid(unsigned c)
{
return (cattr[c & 0xff] == 1);
}
-inline int
+static inline int
isdot(unsigned c)
{
return (cattr[c & 0xff] == 3);
}
-inline int
+static inline int
isslash(unsigned c)
{
return (cattr[c & 0xff] == 4);
@@ -752,7 +758,7 @@ u_char *searchend;
/*
* Convert a dos filename into normal form (8.3 format, space padded)
*/
-void
+static void
to_dos_fcb(u_char *p, u_char *expr)
{
int i;
diff --git a/usr.bin/doscmd/disktab.c b/usr.bin/doscmd/disktab.c
index a467a02..0fa9d07 100644
--- a/usr.bin/doscmd/disktab.c
+++ b/usr.bin/doscmd/disktab.c
@@ -34,6 +34,8 @@
/* XXX goaway (requires change to config.c) */
+#include "doscmd.h"
+
static struct {
int cylinders;
int heads;
diff --git a/usr.bin/doscmd/dos.c b/usr.bin/doscmd/dos.c
index 68d5bd1..fd8356d 100644
--- a/usr.bin/doscmd/dos.c
+++ b/usr.bin/doscmd/dos.c
@@ -51,8 +51,6 @@
#include "dispatch.h"
#include "tty.h"
-static u_long upcase_vector;
-
/* Country Info */
struct {
ushort ciDateFormat;
@@ -100,11 +98,13 @@ char *InDOS;
unsigned long disk_transfer_addr;
/* locals */
+static void fcb_to_string(struct fcb *, u_char *);
+
static int ctrl_c_flag = 0;
static int return_status = 0;
static int doserrno = 0;
static int memory_strategy = 0; /* first fit (we ignore this) */
-
+static u_long upcase_vector;
static u_char upc_table[0x80] = {
0x80, 0x9a, 'E', 'A', 0x8e, 'A', 0x8f, 0x80,
@@ -2054,7 +2054,7 @@ setfcb_rec(struct fcb *fcbp, int n)
return(0);
}
-void
+static void
fcb_to_string(fcbp, buf)
struct fcb *fcbp;
u_char *buf;
diff --git a/usr.bin/doscmd/doscmd.h b/usr.bin/doscmd/doscmd.h
index 31f687b..57bae84 100644
--- a/usr.bin/doscmd/doscmd.h
+++ b/usr.bin/doscmd/doscmd.h
@@ -88,7 +88,7 @@ extern struct vconnect_area vconnect_area;
#define IntState vconnect_area.int_state
/* ParseBuffer.c */
-extern int ParseBuffer(char *, char **, int);
+int ParseBuffer(char *, char **, int);
/* bios.c */
#define BIOSDATA ((u_char *)0x400)
@@ -99,22 +99,26 @@ extern int nserial;
extern int nparallel;
extern volatile int poll_cnt;
-extern void bios_init(void);
-extern void wakeup_poll(void);
-extern void reset_poll(void);
-extern void sleep_poll(void);
+void bios_init(void);
+void wakeup_poll(void);
+void reset_poll(void);
+void sleep_poll(void);
/* cmos.c */
extern time_t delta_clock;
-extern void cmos_init(void);
+void cmos_init(void);
/* config.c */
-extern int read_config(FILE *fp);
+int read_config(FILE *fp);
/* cpu.c */
-extern void cpu_init(void);
-extern int emu_instr(regcontext_t *);
+void cpu_init(void);
+int emu_instr(regcontext_t *);
+void int00(regcontext_t *);
+void int01(regcontext_t *);
+void int03(regcontext_t *);
+void int0d(regcontext_t *);
/* debug.c */
extern int vflag;
@@ -153,22 +157,20 @@ extern int debug_flags;
#define TTYF_ALL (TTYF_ECHO | TTYF_CTRL | TTYF_REDIRECT)
#define TTYF_BLOCKALL (TTYF_ECHO | TTYF_CTRL | TTYF_REDIRECT | TTYF_BLOCK)
-extern void unknown_int2(int, int, regcontext_t *REGS);
-extern void unknown_int3(int, int, int, regcontext_t *REGS);
-extern void unknown_int4(int, int, int, int, regcontext_t *REGS);
-extern void fatal(char *fmt, ...) __printflike(1, 2);
-extern void debug(int flags, char *fmt, ...) __printflike(2, 3);
-extern void dump_regs(regcontext_t *REGS);
-extern void debug_set(int x);
-extern void debug_unset(int x);
-extern u_long debug_isset(int x);
+void unknown_int2(int, int, regcontext_t *);
+void unknown_int3(int, int, int, regcontext_t *);
+void unknown_int4(int, int, int, int, regcontext_t *);
+void fatal(char *, ...) __printflike(1, 2);
+void debug(int, char *, ...) __printflike(2, 3);
+void dump_regs(regcontext_t *);
+void debug_set(int);
+void debug_unset(int);
+u_long debug_isset(int);
/* disktab.c */
-extern int map_type(int, int *, int *, int *);
+int map_type(int, int *, int *, int *);
/* doscmd.c */
-extern int squirrel_fd(int);
-
extern int capture_fd;
extern int dead;
extern int xmode;
@@ -179,16 +181,18 @@ extern char cmdname[];
extern struct timeval boot_time;
extern unsigned long *ivec;
-extern int open_prog(char *name);
-extern void done(regcontext_t *REGS, int val);
-extern void quit(int);
-extern void call_on_quit(void (*)(void *), void *);
-extern void iomap_port(int port, int count);
+int _prog(char *);
+void call_on_quit(void (*)(void *), void *);
+void done(regcontext_t *, int);
+void iomap_port(int, int);
+int open_prog(char *);
+void quit(int);
+int squirrel_fd(int);
/* ems.c */
-extern int ems_init();
-extern void ems_entry(regcontext_t *REGS);
-extern u_long ems_frame_addr;
+int ems_init(void);
+void ems_entry(regcontext_t *);
+u_long ems_frame_addr;
/* emuint.c */
extern void emuint(regcontext_t *REGS);
@@ -216,11 +220,18 @@ extern void make_readonly(int drive);
extern int search_floppy(int i);
extern void disk_bios_init(void);
+/* int16.c */
+void int16(regcontext_t *);
+
/* int17.c */
-extern void lpt_poll(void);
-extern void printer_direct(int printer);
-extern void printer_spool(int printer, char *print_queue);
-extern void printer_timeout(int printer, char *time_out);
+void int17(regcontext_t *);
+void lpt_poll(void);
+void printer_direct(int printer);
+void printer_spool(int printer, char *print_queue);
+void printer_timeout(int printer, char *time_out);
+
+/* int1a.c */
+void int1a(regcontext_t *);
/* int2f.c */
extern void int2f(regcontext_t *);
@@ -239,24 +250,31 @@ extern void mem_free_owner(int owner);
extern void mem_change_owner(int addr, int owner);
/* mouse.c */
-extern void mouse_init(void);
+void int33(regcontext_t *);
+void mouse_init(void);
/* net.c */
-extern void net_init(void);
+void net_init(void);
/* port.c */
-extern void define_input_port_handler(int, unsigned char (*)(int));
-extern void define_output_port_handler(int, void (*)(int, unsigned char));
-extern void inb(regcontext_t *, int);
-extern void init_io_port_handlers(void);
-extern void inx(regcontext_t *, int);
-extern void outb(regcontext_t *, int);
-extern void outx(regcontext_t *, int);
-extern void speaker_init(void);
-extern void outb_traceport(int, unsigned char);
-extern unsigned char inb_traceport(int);
-extern void outb_port(int, unsigned char);
-extern unsigned char inb_port(int);
+void define_input_port_handler(int, unsigned char (*)(int));
+void define_output_port_handler(int, void (*)(int, unsigned char));
+void inb(regcontext_t *, int);
+unsigned char inb_port(int);
+unsigned char inb_speaker(int);
+unsigned char inb_traceport(int);
+void init_io_port_handlers(void);
+void insb(regcontext_t *, int);
+void insx(regcontext_t *, int);
+void inx(regcontext_t *, int);
+void outb(regcontext_t *, int);
+void outb_port(int, unsigned char);
+void outb_speaker(int, unsigned char);
+void outb_traceport(int, unsigned char);
+void outsb(regcontext_t *, int);
+void outsx(regcontext_t *, int);
+void outx(regcontext_t *, int);
+void speaker_init(void);
/* setver.c */
extern void setver(char *, short);
diff --git a/usr.bin/doscmd/ems.c b/usr.bin/doscmd/ems.c
index 92723ff..db16bc6 100644
--- a/usr.bin/doscmd/ems.c
+++ b/usr.bin/doscmd/ems.c
@@ -64,7 +64,7 @@
#include "ems.h"
/* Will be configurable */
-u_long ems_max_size = EMS_MAXSIZE * 1024;
+u_long ems_max_size = EMS_MAXSIZE * 1024;
u_long ems_frame_addr = EMS_FRAME_ADDR;
/*
@@ -113,30 +113,25 @@ struct copydesc {
/* Local prototypes */
-static int init_mapfile();
-static void map_page(u_long pagenum, u_char position, short handle,
- int unmaponly);
-static EMS_handle *get_new_handle(long npages);
-static void context_to_handle(short handle);
-static long find_next_free_handle();
-static short lookup_handle(Hname *hp);
-static void allocate_pages_to_handle(u_short handle, long npages);
-static void allocate_handle(short handle, long npages);
-static void reallocate_pages_to_handle(u_short handle, long npages);
-static void free_handle(short handle);
-static void free_pages_of_handle(short handle);
-static void restore_context(EMS_mapping_context *emc);
-static void save_context_to_dos(EMScontext *emp);
-static int check_saved_context(EMScontext *emp);
-static void *get_valid_pointer(u_short seg, u_short offs, u_long size);
-static u_long move_ems_to_conv(short handle, u_short src_seg,
- u_short src_offset, u_long dst_addr, u_long length);
-static u_long move_conv_to_ems(u_long src_addr, u_short dst_handle,
- u_short dst_seg, u_short dst_offset, u_long length);
-static u_long move_ems_to_ems(u_short src_hande, u_short src_seg,
- u_short src_offset, u_short dst_handle,
- u_short dst_seg, u_short dst_offset, u_long length);
-
+static int init_mapfile(void);
+static void map_page(u_long, u_char, short, int);
+static EMS_handle *get_new_handle(long);
+static void context_to_handle(short);
+static long find_next_free_handle(void);
+static short lookup_handle(Hname *hp);
+static void allocate_pages_to_handle(u_short, long);
+static void allocate_handle(short, long);
+static void reallocate_pages_to_handle(u_short, long);
+static void free_handle(short);
+static void free_pages_of_handle(short);
+static void restore_context(EMS_mapping_context *);
+static void save_context_to_dos(EMScontext *);
+static int check_saved_context(EMScontext *);
+static void *get_valid_pointer(u_short, u_short, u_long);
+static u_long move_ems_to_conv(short, u_short, u_short, u_long, u_long);
+static u_long move_conv_to_ems(u_long, u_short, u_short, u_short, u_long);
+static u_long move_ems_to_ems(u_short, u_short, u_short, u_short,
+ u_short, u_short, u_long);
/*
* EMS initialization routine: Return 1, if successful, return 0 if
diff --git a/usr.bin/doscmd/i386-pinsn.c b/usr.bin/doscmd/i386-pinsn.c
index f4037b5..4525d2a 100644
--- a/usr.bin/doscmd/i386-pinsn.c
+++ b/usr.bin/doscmd/i386-pinsn.c
@@ -40,7 +40,16 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
#include "doscmd.h"
+static void OP_E(int), OP_indirE(int), OP_G(int);
+static void OP_I(int), OP_sI(int), OP_REG(int), OP_J(int), OP_SEG(int);
+static void OP_DIR(int), OP_OFF(int), OP_DSSI(int), OP_ESDI(int);
+static void OP_C(int), OP_D(int), OP_T(int), OP_rm(int);
+static void OP_ST(void), OP_STi(void);
+static void append_pc(unsigned long);
+static void append_prefix(void);
static void dofloat(void);
+static int get16(void);
+static int get32(void);
static void oappend(char *);
static void putop(char *);
@@ -63,7 +72,6 @@ static void putop(char *);
#define Iw OP_I, w_mode
#define Jb OP_J, b_mode
#define Jv OP_J, v_mode
-#define ONE OP_ONE, 0
#define Cd OP_C, d_mode
#define Dd OP_D, d_mode
#define Td OP_T, d_mode
@@ -105,12 +113,6 @@ static void putop(char *);
#define fs OP_REG, fs_reg
#define gs OP_REG, gs_reg
-int OP_E(), OP_indirE(), OP_G(), OP_I(), OP_sI(), OP_REG();
-int OP_J(), OP_SEG();
-int OP_DIR(), OP_OFF(), OP_DSSI(), OP_ESDI(), OP_ONE(), OP_C();
-int OP_D(), OP_T(), OP_rm();
-
-
#define b_mode 1
#define v_mode 2
#define w_mode 3
@@ -175,11 +177,11 @@ int OP_D(), OP_T(), OP_rm();
struct dis386 {
char *name;
- int (*op1)();
+ void (*op1)();
int bytemode1;
- int (*op2)();
+ void (*op2)();
int bytemode2;
- int (*op3)();
+ void (*op3)();
int bytemode3;
};
@@ -1143,7 +1145,6 @@ char *float_mem[] = {
#define ST OP_ST, 0
#define STi OP_STi, 0
-int OP_ST(), OP_STi();
#define FGRPd9_2 NULL, NULL, 0
#define FGRPd9_4 NULL, NULL, 1
@@ -1333,14 +1334,14 @@ dofloat ()
}
}
-/* ARGSUSED */
-OP_ST (ignore)
+static void
+OP_ST()
{
oappend ("%st");
}
-/* ARGSUSED */
-OP_STi (ignore)
+static void
+OP_STi()
{
sprintf (scratchbuf, "%%st(%d)", rm);
oappend (scratchbuf);
@@ -1389,7 +1390,8 @@ oappend(char *s)
*obufp = 0;
}
-append_prefix ()
+static void
+append_prefix()
{
if (prefixes & PREFIX_CS)
oappend ("%cs:");
@@ -1405,19 +1407,20 @@ append_prefix ()
oappend ("%gs:");
}
-OP_indirE (bytemode)
+static void
+OP_indirE(int bytemode)
{
oappend ("*");
OP_E (bytemode);
}
-OP_E (bytemode)
+static void
+OP_E(int bytemode)
{
int disp;
int havesib;
- int didoutput = 0;
int base;
- int index;
+ int idx;
int scale;
int havebase;
@@ -1455,7 +1458,7 @@ OP_E (bytemode)
havesib = 1;
havebase = 1;
scale = (*codep >> 6) & 3;
- index = (*codep >> 3) & 7;
+ idx = (*codep >> 3) & 7;
base = *codep & 7;
codep++;
}
@@ -1519,8 +1522,8 @@ OP_E (bytemode)
if (havebase)
oappend (aflag ? names32[base] : names16_pairs[base]);
if (havesib) {
- if (index != 4) {
- sprintf (scratchbuf, ",%s", names32[index]);
+ if (idx != 4) {
+ sprintf (scratchbuf, ",%s", names32[idx]);
oappend (scratchbuf);
}
sprintf (scratchbuf, ",%d", 1 << scale);
@@ -1530,7 +1533,8 @@ OP_E (bytemode)
}
}
-OP_G (bytemode)
+static void
+OP_G(int bytemode)
{
switch (bytemode)
{
@@ -1555,7 +1559,8 @@ OP_G (bytemode)
}
}
-get32 ()
+static int
+get32()
{
int x = 0;
@@ -1566,7 +1571,8 @@ get32 ()
return (x);
}
-get16 ()
+static int
+get16()
{
int x = 0;
@@ -1575,7 +1581,8 @@ get16 ()
return (x);
}
-OP_REG (code)
+static void
+OP_REG(int code)
{
char *s;
@@ -1608,7 +1615,8 @@ OP_REG (code)
oappend (s);
}
-OP_I (bytemode)
+static void
+OP_I(int bytemode)
{
int op;
@@ -1634,7 +1642,8 @@ OP_I (bytemode)
oappend (scratchbuf);
}
-OP_sI (bytemode)
+static void
+OP_sI(int bytemode)
{
int op;
@@ -1660,7 +1669,8 @@ OP_sI (bytemode)
oappend (scratchbuf);
}
-OP_J (bytemode)
+static void
+OP_J(int bytemode)
{
int disp;
@@ -1688,13 +1698,14 @@ OP_J (bytemode)
oappend (scratchbuf);
}
+static void
append_pc(unsigned long pc)
{
- sprintf(scratchbuf, "%04x:%04x", pc >> 16, pc & 0xffff);
+ sprintf(scratchbuf, "%04lx:%04lx", pc >> 16, pc & 0xffff);
}
-/* ARGSUSED */
-OP_SEG (dummy)
+static void
+OP_SEG(int dummy)
{
static char *sreg[] = {
"%es","%cs","%ss","%ds","%fs","%gs","%?","%?",
@@ -1703,7 +1714,8 @@ OP_SEG (dummy)
oappend (sreg[reg]);
}
-OP_DIR (size)
+static void
+OP_DIR(int size)
{
int seg, offset;
@@ -1738,8 +1750,8 @@ OP_DIR (size)
}
}
-/* ARGSUSED */
-OP_OFF (bytemode)
+static void
+OP_OFF(int bytemode)
{
int off;
@@ -1752,53 +1764,48 @@ OP_OFF (bytemode)
oappend (scratchbuf);
}
-/* ARGSUSED */
-OP_ESDI (dummy)
+static void
+OP_ESDI(int dummy)
{
oappend ("%es:(");
oappend (aflag ? "%edi" : "%di");
oappend (")");
}
-/* ARGSUSED */
-OP_DSSI (dummy)
+static void
+OP_DSSI(int dummy)
{
oappend ("%ds:(");
oappend (aflag ? "%esi" : "%si");
oappend (")");
}
-/* ARGSUSED */
-OP_ONE (dummy)
-{
- oappend ("1");
-}
-
-/* ARGSUSED */
-OP_C (dummy)
+static void
+OP_C(int dummy)
{
codep++; /* skip mod/rm */
sprintf (scratchbuf, "%%cr%d", reg);
oappend (scratchbuf);
}
-/* ARGSUSED */
-OP_D (dummy)
+static void
+OP_D(int dummy)
{
codep++; /* skip mod/rm */
sprintf (scratchbuf, "%%db%d", reg);
oappend (scratchbuf);
}
-/* ARGSUSED */
-OP_T (dummy)
+static void
+OP_T(int dummy)
{
codep++; /* skip mod/rm */
sprintf (scratchbuf, "%%tr%d", reg);
oappend (scratchbuf);
}
-OP_rm (bytemode)
+static void
+OP_rm(int bytemode)
{
switch (bytemode)
{
diff --git a/usr.bin/doscmd/int14.c b/usr.bin/doscmd/int14.c
index 4b8e312..409c88f 100644
--- a/usr.bin/doscmd/int14.c
+++ b/usr.bin/doscmd/int14.c
@@ -46,13 +46,31 @@
struct com_data_struct com_data[N_COMS_MAX];
-struct queue *create_queue() { return(0); }
-int get_char_q() {}
-int queue_not_empty() {}
-int reset_irq_request() {}
-int set_irq_request() {}
-int test_irq_request() {}
-int write_div_latches() {}
+/* XXX where does struct queue come from? */
+static struct queue *create_queue(unsigned char);
+static int queue_not_empty(struct queue *);
+static int reset_irq_request(unsigned char);
+static int set_irq_request(unsigned char);
+static int test_irq_request(unsigned char);
+static int write_div_latches(struct com_data_struct *);
+
+static struct queue *
+create_queue(unsigned char irq) { return NULL; }
+
+static int
+queue_not_empty(struct queue *qp) {return 0;}
+
+static int
+reset_irq_request(unsigned char irq) {return 0;}
+
+static int
+set_irq_request(unsigned char irq) {return 0;}
+
+static int
+test_irq_request(unsigned char irq) {return 0;}
+
+static int
+write_div_latches(struct com_data_struct *cdsp) {return 0;}
void
int14(regcontext_t *REGS)
diff --git a/usr.bin/doscmd/int16.c b/usr.bin/doscmd/int16.c
index bdd1d52..60ea83e 100644
--- a/usr.bin/doscmd/int16.c
+++ b/usr.bin/doscmd/int16.c
@@ -37,7 +37,6 @@
#define K_NEXT *(u_short *)0x41a
#define K_FREE *(u_short *)0x41c
-#define KbdEmpty() (K_NEXT == K_FREE)
#define HWM 16
volatile int poll_cnt = 0;
diff --git a/usr.bin/doscmd/trace.c b/usr.bin/doscmd/trace.c
index a5108a0..dbc7118 100644
--- a/usr.bin/doscmd/trace.c
+++ b/usr.bin/doscmd/trace.c
@@ -42,8 +42,8 @@ static u_short *saddr;
static u_char *iaddr, ibyte;
/* locals */
-static void printtrace(regcontext_t *REGS, char *buf);
-
+static void printtrace(regcontext_t *REGS, char *buf);
+static inline void showstate(long, long, char);
/*
* Before exiting to VM86 mode:
@@ -183,7 +183,7 @@ tracetrap(regcontext_t *REGS)
}
}
-inline void
+static inline void
showstate(long flags, long flag, char f)
{
putc((flags & flag) ? f : ' ', debugf);
diff --git a/usr.bin/doscmd/trap.c b/usr.bin/doscmd/trap.c
index dcdfcd4..678d22d 100644
--- a/usr.bin/doscmd/trap.c
+++ b/usr.bin/doscmd/trap.c
@@ -77,7 +77,7 @@ fake_int(regcontext_t *REGS, int intnum)
}
/* user_int: */
- debug(D_TRAPS,
+ debug(D_TRAPS | intnum,
"INT %02x:%02x [%04lx:%04lx] %04x %04x %04x %04x from %04x:%04x\n",
intnum, R_AH, ivec[intnum] >> 16, ivec[intnum] & 0xffff,
R_AX, R_BX, R_CX, R_DX, R_CS, R_IP);
diff --git a/usr.bin/doscmd/tty.c b/usr.bin/doscmd/tty.c
index ceab613..6657f8b 100644
--- a/usr.bin/doscmd/tty.c
+++ b/usr.bin/doscmd/tty.c
@@ -125,29 +125,24 @@ static struct termios tty_cook, tty_raw;
#define row (CursRow0)
#define col (CursCol0)
-inline void
-SetVREGCur()
-{
- int cp = row * width + col;
- VGA_CRTC[CRTC_CurLocHi] = cp >> 8;
- VGA_CRTC[CRTC_CurLocLo] = cp & 0xff;
-}
-
+/* Local functions */
void _kbd_event(void *);
-void debug_event(void *);
-int video_event();
-void video_async_event(void *);
-void tty_cooked();
-unsigned char inb_port60(int);
-void kbd_event(int);
-u_short read_raw_kbd(int, u_short *);
+static void Failure(void);
+static void SetVREGCur(void);
+static void debug_event(void *);
+static unsigned char inb_port60(int);
+static int inrange(int, int, int);
+static void kbd_event(int);
+static u_short read_raw_kbd(int, u_short *);
+static void setgc(u_short);
+static void video_async_event(void *);
-/* Local functions */
#ifndef NO_X
static void dac2rgb(XColor *, int);
static void prepare_lut(void);
static void putchar_graphics(int, int, int);
static void tty_rwrite_graphics(int, int, int);
+static int video_event(XEvent *ev);
static void video_update_graphics(void);
static void video_update_text(void);
static void vram2ximage(void);
@@ -209,7 +204,7 @@ void KbdRepl(u_short code);
u_short KbdRead();
u_short KbdPeek();
-void
+static void
Failure()
{
fprintf(stderr, "X Connection shutdown\n");
@@ -217,6 +212,14 @@ Failure()
}
static void
+SetVREGCur()
+{
+ int cp = row * width + col;
+ VGA_CRTC[CRTC_CurLocHi] = cp >> 8;
+ VGA_CRTC[CRTC_CurLocLo] = cp & 0xff;
+}
+
+static void
console_denit(void *arg)
{
int fd = *(int *)arg;
@@ -342,7 +345,7 @@ video_blink(int mode)
blink = mode;
}
-void
+static void
setgc(u_short attr)
{
#ifndef NO_X
@@ -1041,100 +1044,8 @@ video_async_event(void *pfd)
#endif
}
-void
-kbd_async_event(int fd)
-{
- unsigned char c;
-
- while (read(fd, &c, 1) == 1) {
- switch (c) {
- case 29: /* Control */
- K1_STATUS |= K1_CTRL;
- K2_STATUS |= K2_LCTRL;
- break;
- case 29 | 0x80: /* Control */
- K1_STATUS &= ~K1_CTRL;
- K2_STATUS &= ~K2_LCTRL;
- break;
-
- case 42: /* left shift */
- K1_STATUS |= K1_LSHIFT;
- break;
- case 42 | 0x80: /* left shift */
- K1_STATUS &= ~K1_LSHIFT;
- break;
-
- case 54: /* right shift */
- K1_STATUS |= K1_RSHIFT;
- break;
- case 54 | 0x80: /* right shift */
- K1_STATUS &= ~K1_RSHIFT;
- break;
-
- case 56: /* Alt */
- K1_STATUS |= K1_ALT;
- K2_STATUS |= K2_LALT;
- break;
- case 56 | 0x80: /* Alt */
- K1_STATUS &= ~K1_ALT;
- K2_STATUS &= ~K2_LALT;
- break;
-
- case 58: /* caps-lock */
- if (K1_STATUS ^= K1_CLOCK)
- K4_STATUS &= ~K4_CLOCK_LED;
- else
- K4_STATUS |= K4_CLOCK_LED;
- K2_STATUS |= K2_CLOCK;
- break;
- case 58 | 0x80: /* caps-lock */
- K2_STATUS &= ~K2_CLOCK;
- break;
-
- case 69: /* num-lock */
- if (K1_STATUS ^= K1_CLOCK)
- K4_STATUS &= ~K4_NLOCK_LED;
- else
- K4_STATUS |= K4_NLOCK_LED;
- K2_STATUS |= K2_NLOCK;
- break;
- case 69 | 0x80: /* num-lock */
- K2_STATUS &= ~K2_NLOCK;
- break;
-
- case 70: /* scroll-lock */
- if (K1_STATUS ^= K1_SLOCK)
- K4_STATUS &= ~K4_SLOCK_LED;
- else
- K4_STATUS |= K4_SLOCK_LED;
- K2_STATUS |= K2_SLOCK;
- break;
- case 70 | 0x80: /* scroll-lock */
- K2_STATUS &= ~K2_SLOCK;
- break;
-
- case 82: /* insert */
- K1_STATUS ^= K1_INSERT;
- K2_STATUS |= K2_INSERT;
- break;
- case 82 | 0x80: /* insert */
- K2_STATUS &= ~K2_INSERT;
- break;
-
- }
-
- }
-
-#if 0 /*XXXXX*/
- if ((K4_STATUS & 0x07) != oldled) {
- oldled = K4_STATUS & 0x07;
- ioctl (fd, PCCONIOCSETLED, &oldled);
- }
-#endif
-}
-
#ifndef NO_X
-int
+static int
video_event(XEvent *ev)
{
switch (ev->type) {
@@ -1840,7 +1751,7 @@ tty_estate()
return(state);
}
-inline int
+static int
inrange(int a, int n, int x)
{
return(a < n ? n : a > x ? x : a);
diff --git a/usr.bin/doscmd/tty.h b/usr.bin/doscmd/tty.h
index 2c4b4c1..07ce0a9 100644
--- a/usr.bin/doscmd/tty.h
+++ b/usr.bin/doscmd/tty.h
@@ -33,36 +33,39 @@ int redirect2;
extern int kbd_fd;
extern char *xfont;
-u_short KbdRead(void);
+int KbdEmpty(void);
u_short KbdPeek(void);
+u_short KbdRead(void);
void KbdWrite(u_short);
-void Failure();
+void console_init(void);
void get_lines(void);
void get_ximage(void);
void init_window(void);
void init_ximage(int, int);
+void int09(regcontext_t *);
+void kbd_bios_init(void);
+void kbd_init(void);
void load_font(void);
void resize_window(void);
+int tty_char(int, int);
int tty_eread(REGISTERS, int, int);
int tty_estate(void);
-void tty_write(int, int);
-void tty_rwrite(int, int, int);
+void tty_flush(void);
+void tty_index(void);
void tty_move(int, int);
int tty_read(regcontext_t *, int);
void tty_report(int *, int *);
void tty_flush();
void tty_index();
-void tty_pause();
+void tty_pause(void);
int tty_peek(REGISTERS, int);
-int tty_state();
+void tty_rwrite(int, int, int);
+int tty_state(void);
void tty_scroll(int, int, int, int, int, int);
void tty_rscroll(int, int, int, int, int, int);
-int tty_char(int, int);
+void tty_write(int, int);
+void update_pixels(void);
void video_blink(int);
void video_setborder(int);
void video_update(regcontext_t *);
-void console_init(void);
-void kbd_init(void);
-void kbd_bios_init(void);
-void update_pixels(void);
diff --git a/usr.bin/doscmd/xms.c b/usr.bin/doscmd/xms.c
index 24a4257..7cd2649 100644
--- a/usr.bin/doscmd/xms.c
+++ b/usr.bin/doscmd/xms.c
@@ -92,7 +92,7 @@ static u_char xms_trampoline[] = {
static void xms_entry(regcontext_t *REGS);
static UMB_block *create_block(u_long addr, u_long size);
static void add_block(UMB_block **listp, UMB_block *blk);
-static void merge_blocks();
+static void merge_blocks(void);
/* Init the entire module */
void
OpenPOWER on IntegriCloud