Mark debug() and fatal() as __printflike() and fix resulting warnings.

This commit is contained in:
Thomas Gellekum 2001-07-31 11:27:48 +00:00
parent ddda86e60f
commit 008969f3d3
14 changed files with 42 additions and 42 deletions

View File

@ -849,7 +849,7 @@ find_first(u_char *path, int attr, dosdir_t *dir, find_block_t *dta)
int error;
search_t *search = &dir_search;
debug(D_REDIR, "find_first(%s, %x, %x)\n", path, attr, dta);
debug(D_REDIR, "find_first(%s, %x, %x)\n", path, attr, (int)dta);
error = dos_makepath(path, new_path);
if (error)

View File

@ -148,7 +148,7 @@ dump_regs(regcontext_t *REGS)
debug (D_ALWAYS, "ax=%04x bx=%04x cx=%04x dx=%04x\n", R_AX, R_BX, R_CX, R_DX);
debug (D_ALWAYS, "si=%04x di=%04x sp=%04x bp=%04x\n", R_SI, R_DI, R_SP, R_BP);
debug (D_ALWAYS, "cs=%04x ss=%04x ds=%04x es=%04x\n", R_CS, R_SS, R_DS, R_ES);
debug (D_ALWAYS, "ip=%x eflags=%x\n", R_IP, R_EFLAGS);
debug (D_ALWAYS, "ip=%x eflags=%lx\n", R_IP, R_EFLAGS);
addr = (u_char *)MAKEPTR(R_CS, R_IP);

View File

@ -1672,13 +1672,13 @@ static int
int21_4b(regcontext_t *REGS)
{
int fd;
char *fname[PATH_MAX];
u_short *param;
debug(D_EXEC, "exec(%s)\n",(u_char *)MAKEPTR(R_DS, R_DX));
if ((fd = open_prog((u_char *)MAKEPTR(R_DS, R_DX))) < 0) {
debug(D_EXEC, "%s: command not found\n", fname);
debug(D_EXEC, "%s: command not found\n",
(u_char *)MAKEPTR(R_DS, R_DX));
return (FILE_NOT_FOUND);
}
@ -2224,9 +2224,9 @@ int21_fcb(regcontext_t *REGS)
&nbytes);
debug(D_FILE_OPS, "%d %s, FCB: %d, %.11s\n",
nbytes,
MAKEPTR(R_DS, R_SI),
(char *)MAKEPTR(R_DS, R_SI),
*(int *)MAKEPTR(R_ES, R_DI),
MAKEPTR(R_ES, R_DI) + 1);
(char *)MAKEPTR(R_ES, R_DI) + 1);
R_SI += nbytes;
break;

View File

@ -156,8 +156,8 @@ extern int debug_flags;
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, ...);
extern void debug (int flags, char *fmt, ...);
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);

View File

@ -621,7 +621,7 @@ ems_entry(regcontext_t *REGS)
break;
}
newpages = R_BX;
debug(D_EMS, "changed from %d to %d pages\n",
debug(D_EMS, "changed from %ld to %ld pages\n",
ems_handle[handle]->npages, newpages);
/* Case 1: Realloc to zero pages */

View File

@ -50,7 +50,7 @@ static int env_s[10];
static regcontext_t frames[10];
static int
make_environment (char *cmdname, char **env)
make_environment(char *cmd_name, char **env)
{
int i;
int total;
@ -62,7 +62,7 @@ make_environment (char *cmdname, char **env)
total = 0;
for (i = 0; env[i]; i++) {
debug (D_EXEC,"env: %s\n", env[i]);
len = strlen (env[i]);
len = strlen(env[i]);
if (total + len >= 32 * 1024)
break;
total += len + 1;
@ -70,7 +70,7 @@ make_environment (char *cmdname, char **env)
total++; /* terminating null */
total += 2; /* word count */
total += strlen (cmdname) + 1;
total += strlen(cmd_name) + 1;
total += 4; /* some more zeros, just in case */
if ((envseg = mem_alloc(total/16 + 1, 1, NULL)) == 0)
@ -82,17 +82,17 @@ make_environment (char *cmdname, char **env)
p = env_block;
total = 0;
for (i = 0; env[i]; i++) {
len = strlen (env[i]);
len = strlen(env[i]);
if (total + len >= 32 * 1024)
break;
total += len + 1;
strcpy (p, env[i]);
p += strlen (p) + 1;
p += strlen(p) + 1;
}
*p++ = 0;
*(short *)p = strlen(cmdname);
*(short *)p = strlen(cmd_name);
p += 2;
strcpy (p, cmdname);
strcpy (p, cmd_name);
while(*p) {
if (*p == '/')
*p = '\\';
@ -155,7 +155,7 @@ load_exe(int fd, int start_segment, int reloc_segment, struct exehdr *hdr, int t
}
void
load_command(regcontext_t *REGS, int run, int fd, char *cmdname,
load_command(regcontext_t *REGS, int run, int fd, char *cmd_name,
u_short *param, char **argv, char **envs)
{
struct exehdr hdr;
@ -174,7 +174,7 @@ load_command(regcontext_t *REGS, int run, int fd, char *cmdname,
u_short init_cs, init_ip, init_ss, init_sp, init_ds, init_es;
if (envs)
envseg = make_environment(cmdname, envs);
envseg = make_environment(cmd_name, envs);
else
envseg = env_s[curpsp];
@ -373,7 +373,7 @@ get_env(void)
void
exec_command(regcontext_t *REGS, int run,
int fd, char *cmdname, u_short *param)
int fd, char *cmd_name, u_short *param)
{
char *arg;
char *env;
@ -392,9 +392,9 @@ exec_command(regcontext_t *REGS, int run,
argv[0] = arg;
argv[1] = NULL;
debug (D_EXEC, "exec_command: cmdname = %s\n"
debug (D_EXEC, "exec_command: cmd_name = %s\n"
"env = 0x0%x, arg = %04x:%04x(%s)\n",
cmdname, param[0], param[2], param[1], arg);
cmd_name, param[0], param[2], param[1], arg);
if (env) {
int i;
@ -403,9 +403,9 @@ exec_command(regcontext_t *REGS, int run,
env += strlen(env)+1;
}
envs[i] = NULL;
load_command(REGS, run, fd, cmdname, param, argv, envs);
load_command(REGS, run, fd, cmd_name, param, argv, envs);
} else
load_command(REGS, run, fd, cmdname, param, argv, NULL);
load_command(REGS, run, fd, cmd_name, param, argv, NULL);
}
void

View File

@ -39,7 +39,7 @@ softint(int intnum)
}
#endif
debug(D_TRAPS|intnum, "Int%x [%04x:%04x]\n",
debug(D_TRAPS|intnum, "INT%x [%04lx:%04lx]\n",
intnum, vec >> 16, vec & 0xffff);
PUSH((R_FLAGS & ~PSL_I) | (R_EFLAGS & PSL_VIF ? PSL_I : 0), REGS);
@ -87,7 +87,7 @@ hardint(int intnum)
return;
}
debug(D_TRAPS|intnum, "Int%x [%04x:%04x]\n",
debug(D_TRAPS|intnum, "INT%x [%04lx:%04lx]\n",
intnum, vec >> 16, vec & 0xffff);
PUSH((R_FLAGS & ~PSL_I) | (R_EFLAGS & PSL_VIF ? PSL_I : 0), REGS);

View File

@ -758,8 +758,7 @@ int13(regcontext_t *REGS)
start -= di->offset;
}
debug(D_DISK, "Verify %2d sectors from %d\n",
sectors, start);
debug(D_DISK, "Verify %2d sectors from %qd\n", sectors, start);
if (lseek(di->fd, start * di->secsize, 0) < 0) {
debug(D_DISK, "Seek error\n");
seterror(INT13_ERR_SEEK);

View File

@ -147,7 +147,7 @@ com_set_line(struct com_data_struct *cdsp, unsigned char port, unsigned char par
struct stat stat_buf;
int reg_num;
debug (D_PORT, "com_set_line: cdsp = 0x%08X, port = 0x%04x,"
debug (D_PORT, "com_set_line: cdsp = %8p, port = 0x%04x,"
"param = 0x%04X.\n", cdsp, port, param);
if (cdsp->fd > 0) {
debug (D_PORT, "Re-initialize serial port com%d\n", port);

View File

@ -197,7 +197,7 @@ int2f11_rdwr(regcontext_t *REGS)
r_sft->offset += n;
if (r_sft->offset > r_sft->size)
r_sft->size = r_sft->offset;
debug(D_REDIR, "offset now %d\n", r_sft->offset);
debug(D_REDIR, "offset now %ld\n", r_sft->offset);
return(0);
}

View File

@ -92,7 +92,7 @@ mem_print(void)
char *mp;
for (mp = dosmem; ; mp = Next(mp)) {
debug(D_ALWAYS, "%05x: mark %c owner %04x size %04x\n",
debug(D_ALWAYS, "%8p: mark %c owner %04x size %04x\n",
mp, Mark(mp), Owner(mp), Size(mp));
if (Mark(mp) != 'M')
@ -140,7 +140,7 @@ mem_init(void)
dosmem_size = avail_memory / 16;
debug(D_MEMORY, "dosmem = 0x%x base = 0x%x avail = 0x%x (%dK)\n",
debug(D_MEMORY, "dosmem = %p base = 0x%x avail = 0x%x (%dK)\n",
dosmem, base, dosmem_size, avail_memory / 1024);
Mark(dosmem) = 'Z';

View File

@ -194,7 +194,9 @@ printtrace(regcontext_t *REGS, char *buf)
{
static int first = 1;
#if BIG_DEBUG
u_char *addr = (u_char *)MAKEPTR(R_CS, R_IP);
#endif
char *bigfmt = "%04x:%04x "
#if BIG_DEBUG
"%02x %02x %02x %02x %02x %02x "

View File

@ -60,8 +60,8 @@ fake_int(regcontext_t *REGS, int intnum)
if (R_CS == 0xF000 || (ivec[intnum] >> 16) == 0xF000) {
if (R_CS != 0xF000)
intnum = ((u_char *)VECPTR(ivec[intnum]))[1];
debug (D_ITRAPS|intnum, "int %02x:%02x %04x:%04x/%08x\n",
intnum, R_AH, R_CS, R_IP, ivec[intnum]);
debug(D_ITRAPS | intnum, "INT %02x:%02x %04x:%04x/%08lx\n",
intnum, R_AH, R_CS, R_IP, ivec[intnum]);
switch (intnum) {
case 0x2f: /* multiplex interrupt */
int2f((regcontext_t *)&REGS->sc);
@ -73,15 +73,14 @@ fake_int(regcontext_t *REGS, int intnum)
if (vflag) dump_regs(REGS);
fatal("no interrupt set up for 0x%02x\n", intnum);
}
debug (D_ITRAPS|intnum, "\n");
return;
}
/* user_int: */
debug (D_TRAPS|intnum,
"INT %02x:%02x [%04x:%04x] %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);
debug(D_TRAPS,
"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);
#if 0
if ((intnum == 0x13) && (*(u_char *)VECPTR(ivec[intnum]) != 0xf4)) {
@ -306,7 +305,7 @@ sigbus(struct sigframe *sf)
/* nothing but accesses to video memory can fault for now */
if (vmem_pageflt(sf) == 0)
goto out;
/* FALLTHRU */
/* FALLTHROUGH */
default:
dump_regs(REGS);
fatal("SIGBUS code %d, trapno: %d, err: %d\n",
@ -366,7 +365,7 @@ sigbus(struct sigframe *sf)
break;
case PUSHF:
debug (D_TRAPS2, "pushf <- 0x%x\n", R_EFLAGS);
debug (D_TRAPS2, "pushf <- 0x%lx\n", R_EFLAGS);
R_IP++;
PUSH((R_FLAGS & ~PSL_I) | (R_EFLAGS & PSL_VIF ? PSL_I : 0),
REGS);
@ -395,7 +394,7 @@ sigbus(struct sigframe *sf)
/* restore pseudo PSL_I flag */
IntState = tempflags & PSL_I;
debug(D_TRAPS2, "popf -> 0x%x\n", R_EFLAGS);
debug(D_TRAPS2, "popf -> 0x%lx\n", R_EFLAGS);
break;
case TRACETRAP:

View File

@ -810,7 +810,7 @@ xms_entry(regcontext_t *REGS)
}
}
memmove((void *)dstptr, (void *)srcptr, n);
debug(D_XMS, "Moved from %08x to %08x, %04x bytes\n",
debug(D_XMS, "Moved from %08lx to %08lx, %04x bytes\n",
srcptr, dstptr, n);
R_AX = 0x1;
R_BL = XMS_SUCCESS;