Commit 8563ad46 authored by deuce's avatar deuce

Fix format-related warnings.

This is *likely* to break the Win32 build and even when the macros are
specified in xpdev, I doubt Microsoft has added support for the 'z' size
specifier used in smblib/smbadd.c we'll likely need a SIZE_T_SIZE macro
that is "z" on C99 systems and "ll" or "64" or whatever it is on Win32.

Or maybe a whole slew of complete SIZE_T macros since the 32/64 but thing
and the max file size thing may actually need the full format specification
to be in the macro... "zu" on C99 platforms and whatever magic Microsoft
needs there.
parent 1f6789ed
......@@ -240,7 +240,7 @@ void addlist(char *inpath, file_t f, uint dskip, uint sskip)
f.desc[0]=0;
f.cdt=flength(filepath);
padfname(getfname(filepath),f.name);
printf("%s %10lu %s\n"
printf("%s %10"PRIu32" %s\n"
,f.name,f.cdt,unixtodstr(&scfg,(time32_t)fdate(filepath),str));
exist=findfile(&scfg,f.dir,f.name);
if(exist) {
......@@ -888,7 +888,7 @@ int main(int argc, char **argv)
prep_desc(f.desc);
if(mode&ASCII_ONLY)
strip_exascii(f.desc, f.desc);
printf("%s %7lu %s\n",f.name,f.cdt,f.desc);
printf("%s %7"PRIu32" %s\n",f.name,f.cdt,f.desc);
if(mode&FILE_ID) {
for(i=0;i<scfg.total_fextrs;i++)
if(!stricmp(scfg.fextr[i]->ext,f.name+9) && chk_ar(&scfg,scfg.fextr[i]->ar,/* user: */NULL, /* client: */NULL))
......
......@@ -334,11 +334,11 @@ void newvar(uchar* src, uchar *in)
return;
}
if((var_name=(uint32_t *)realloc(var_name,sizeof(int32_t)*(vars+1)))==NULL) {
printf("Too many (%lu) variables!\n",vars);
printf("Too many (%"PRIu32") variables!\n",vars);
bail(1); }
var_name[vars]=l;
if(display)
printf("newvar(%08lX)=%s\n",l,in);
printf("newvar(%08"PRIX32")=%s\n",l,in);
vars++;
}
......
......@@ -314,7 +314,7 @@ int main(int argc, char **argv)
SAFECOPY(from,msg.from);
truncsp(from);
strip_ctrl(from);
fprintf(stderr,"#%-5lu (%06lX) %-25.25s ",msg.hdr.number,l,from);
fprintf(stderr,"#%-5"PRIu32" (%06lX) %-25.25s ",msg.hdr.number,l,from);
if(msg.hdr.length!=smb_getmsghdrlen(&msg)) {
fprintf(stderr,"%sHeader length mismatch\n",beep);
......@@ -366,12 +366,12 @@ int main(int argc, char **argv)
#ifdef _DEBUG
printf("\n");
printf("%-10s: %s\n", "Source", smb_hashsourcetype(hashes[h]->source));
printf("%-10s: %lu\n", "Length", hashes[h]->length);
printf("%-10s: %"PRIu32"\n", "Length", hashes[h]->length);
printf("%-10s: %x\n", "Flags", hashes[h]->flags);
if(hashes[h]->flags&SMB_HASH_CRC16)
printf("%-10s: %04x\n", "CRC-16", hashes[h]->crc16);
if(hashes[h]->flags&SMB_HASH_CRC32)
printf("%-10s: %08lx\n","CRC-32", hashes[h]->crc32);
printf("%-10s: %08"PRIx32"\n","CRC-32", hashes[h]->crc32);
if(hashes[h]->flags&SMB_HASH_MD5)
printf("%-10s: %s\n", "MD5", MD5_hex(str,hashes[h]->md5));
......@@ -402,7 +402,7 @@ int main(int argc, char **argv)
fprintf(stderr,"%sOut-Of-Range message number\n",beep);
msgerr=TRUE;
if(extinfo)
printf("MSGERR: Header number (%lu) greater than last (%lu)\n"
printf("MSGERR: Header number (%"PRIu32") greater than last (%"PRIu32")\n"
,msg.hdr.number,smb.status.last_msg);
hdrnumerr++;
}
......@@ -410,7 +410,7 @@ int main(int argc, char **argv)
fprintf(stderr,"%sNot found in index\n",beep);
msgerr=TRUE;
if(extinfo)
printf("MSGERR: Header number (%lu) not found in index\n"
printf("MSGERR: Header number (%"PRIu32") not found in index\n"
,msg.hdr.number);
orphan++;
}
......@@ -511,7 +511,7 @@ int main(int argc, char **argv)
fprintf(stderr,"%sDuplicate message number\n",beep);
msgerr=TRUE;
if(extinfo)
printf("MSGERR: Header number (%lu) duplicated\n"
printf("MSGERR: Header number (%"PRIu32") duplicated\n"
,msg.hdr.number);
dupenumhdr++;
break;
......@@ -535,7 +535,7 @@ int main(int argc, char **argv)
msgerr=TRUE;
if(extinfo)
printf("MSGERR: Unsupported translation type (%04X) "
"in dfield[%u] (offset %ld)\n"
"in dfield[%u] (offset %"PRIu32")\n"
,xlat,i,msg.dfield[i].offset);
xlaterr++;
}
......@@ -566,11 +566,11 @@ int main(int argc, char **argv)
}
***/
if(!(msg.hdr.attr&MSG_DELETE) && (i=fgetc(smb.sha_fp))!=1) {
fprintf(stderr,"%sActive Header Block %lu marked %02X\n"
fprintf(stderr,"%sActive Header Block %"PRIu32" marked %02X\n"
,beep,m/SHD_BLOCK_LEN,i);
msgerr=TRUE;
if(extinfo)
printf("MSGERR: Active header block %lu marked %02X "
printf("MSGERR: Active header block %"PRIu32" marked %02X "
"instead of 01\n"
,m/SHD_BLOCK_LEN,i);
actalloc++;
......@@ -583,14 +583,14 @@ int main(int argc, char **argv)
if(msg.dfield[n].offset&0x80000000UL) {
msgerr=TRUE;
if(extinfo)
printf("MSGERR: Invalid Data Field [%lu] Offset: %lu\n"
printf("MSGERR: Invalid Data Field [%lu] Offset: %"PRIu32"\n"
,n,msg.dfield[n].offset);
dfieldoffset++;
}
if(msg.dfield[n].length&0x80000000UL) {
msgerr=TRUE;
if(extinfo)
printf("MSGERR: Invalid Data Field [%lu] Length: %lu\n"
printf("MSGERR: Invalid Data Field [%lu] Length: %"PRIu32"\n"
,n,msg.dfield[n].length);
dfieldlength++;
}
......@@ -602,11 +602,11 @@ int main(int argc, char **argv)
i=0;
if(!fread(&i,2,1,smb.sda_fp) || !i) {
fprintf(stderr
,"%sActive Data Block %lu.%lu marked free\n"
,"%sActive Data Block %lu.%"PRIu32" marked free\n"
,beep,n,m/SHD_BLOCK_LEN);
msgerr=TRUE;
if(extinfo)
printf("MSGERR: Active Data Block %lu.%lu "
printf("MSGERR: Active Data Block %lu.%"PRIu32" "
"marked free\n"
,n,m/SHD_BLOCK_LEN);
datactalloc++;
......@@ -687,7 +687,7 @@ int main(int argc, char **argv)
fprintf(stderr,"\r%2lu%% %5lu ",l ? (long)(100.0/((float)total/l)) : 0,l);
if(!fread(&idx,sizeof(idxrec_t),1,smb.sid_fp))
break;
fprintf(stderr,"#%-5lu (%06lX) 1st Pass ",idx.number,idx.offset);
fprintf(stderr,"#%-5"PRIu32" (%06"PRIX32") 1st Pass ",idx.number,idx.offset);
if(idx.attr&MSG_DELETE) {
/* Message Disabled... why? ToDo */
/* fprintf(stderr,"%sMarked for deletion\n",beep); */
......@@ -701,7 +701,7 @@ int main(int argc, char **argv)
}
for(m=0;m<l;m++)
if(offset[m]==idx.offset) {
fprintf(stderr,"%sDuplicate offset: %lu\n",beep,idx.offset);
fprintf(stderr,"%sDuplicate offset: %"PRIu32"\n",beep,idx.offset);
dupeoff++;
break;
}
......@@ -731,7 +731,7 @@ int main(int argc, char **argv)
else {
fprintf(stderr,"\r%79s\r","");
for(m=0;m<total;m++) {
fprintf(stderr,"\r%2lu%% %5lu ",m ? (long)(100.0/((float)total/m)) : 0,m);
fprintf(stderr,"\r%2lu%% %5"PRIu32" ",m ? (long)(100.0/((float)total/m)) : 0,m);
fprintf(stderr,"#%-5lu (%06lX) 2nd Pass ",number[m],offset[m]);
for(n=0;n<m;n++)
if(number[m] && number[n] && number[m]<number[n]) {
......@@ -764,9 +764,9 @@ int main(int argc, char **argv)
if(hash.number==0 || hash.number > smb.status.last_msg)
fprintf(stderr,"\r%sInvalid message number (%u)\n", beep, hash.number), badhash++;
else if(hash.time < 0x40000000 || hash.time > (ulong)now)
fprintf(stderr,"\r%sInvalid time (0x%08lX)\n", beep, hash.time), badhash++;
fprintf(stderr,"\r%sInvalid time (0x%08"PRIX32")\n", beep, hash.time), badhash++;
else if(hash.length < 1 || hash.length > 1024*1024)
fprintf(stderr,"\r%sInvalid length (%lu)\n", beep, hash.length), badhash++;
fprintf(stderr,"\r%sInvalid length (%"PRIu32")\n", beep, hash.length), badhash++;
else if(hash.source >= SMB_HASH_SOURCE_TYPES)
fprintf(stderr,"\r%sInvalid source type (%u)\n", beep, hash.source), badhash++;
}
......@@ -782,7 +782,7 @@ int main(int argc, char **argv)
totaldelmsgs+=deleted;
totallzhsaved+=lzhsaved;
printf("\n");
printf("%-35.35s (=): %lu\n"
printf("%-35.35s (=): %"PRIu32"\n"
,"Status Total"
,smb.status.total_msgs);
printf("%-35.35s (=): %lu\n"
......
......@@ -1187,7 +1187,7 @@ int main(int argc, char **argv)
fprintf(stream,"LOG NONE\n");
else
fprintf(stream,"LOG %08lX\n",cfg.log); }
fprintf(stream,"LOG_LEVEL %u\n",cfg.log_level);
fprintf(stream,"LOG_LEVEL %lu\n",cfg.log_level);
if(cfg.inbound[0])
fprintf(stream,"INBOUND %s\n",cfg.inbound);
if(cfg.secure[0])
......
......@@ -194,7 +194,7 @@ int fixsmb(char* sub)
continue;
}
size=smb_hdrblocks(smb_getmsghdrlen(&msg))*SHD_BLOCK_LEN;
printf("#%-5lu (%06lX) %-25.25s ",msg.hdr.number,l,msg.from);
printf("#%-5"PRIu32" (%06lX) %-25.25s ",msg.hdr.number,l,msg.from);
if(smb_undelete)
msg.hdr.attr&=~MSG_DELETE;
......
......@@ -3172,7 +3172,7 @@ static void ctrl_thread(void* arg)
t=fdate(g.gl_pathv[i]);
if(localtime_r(&t,&tm)==NULL)
memset(&tm,0,sizeof(tm));
fprintf(fp,"%crw-r--r-- 1 %-8s local %9ld %s %2d "
fprintf(fp,"%crw-r--r-- 1 %-8s local %9"PRId32" %s %2d "
,isdir(g.gl_pathv[i]) ? 'd':'-'
,scfg.sys_id
,f.size
......@@ -3674,7 +3674,7 @@ static void ctrl_thread(void* arg)
dotname(f.uler,str);
} else
SAFECOPY(str,scfg.sys_id);
fprintf(fp,"-r--r--r-- 1 %-*s %-8s %9ld %s %2d "
fprintf(fp,"-r--r--r-- 1 %-*s %-8s %9"PRId32" %s %2d "
,NAME_LEN
,str
,scfg.dir[dir]->code_suffix
......
......@@ -80,7 +80,7 @@ int sbbs_t::loadmsg(smbmsg_t *msg, ulong number)
return(0);
}
if((i=smb_getmsghdr(&smb,msg))!=SMB_SUCCESS) {
sprintf(str,"(%06lX) #%lu/%lu %s",msg->idx.offset,msg->idx.number
sprintf(str,"(%06"PRIX32") #%"PRIu32"/%lu %s",msg->idx.offset,msg->idx.number
,number,smb.file);
smb_unlockmsghdr(&smb,msg);
errormsg(WHERE,ERR_READ,str,i,smb.last_error);
......
......@@ -56,7 +56,7 @@ BOOL DLLCALL load_cfg(scfg_t* cfg, char* text[], BOOL prep, char* error)
#endif
if(cfg->size!=sizeof(scfg_t)) {
sprintf(error,"cfg->size (%ld) != sizeof(scfg_t) (%d)"
sprintf(error,"cfg->size (%"PRIu32") != sizeof(scfg_t) (%d)"
,cfg->size,sizeof(scfg_t));
return(FALSE);
}
......@@ -111,7 +111,7 @@ BOOL DLLCALL load_cfg(scfg_t* cfg, char* text[], BOOL prep, char* error)
fclose(instream);
if(i<TOTAL_TEXT) {
sprintf(error,"line %lu in %s: Less than TOTAL_TEXT (%u) strings defined in %s."
sprintf(error,"line %d in %s: Less than TOTAL_TEXT (%u) strings defined in %s."
,i,fname
,TOTAL_TEXT,fname);
return(FALSE);
......
......@@ -4848,22 +4848,22 @@ static void cleanup(int code)
status("Down");
if(terminate_server || code) {
char str[1024];
sprintf(str,"%u connections served", stats.connections_served);
sprintf(str,"%lu connections served", stats.connections_served);
if(stats.connections_refused)
sprintf(str+strlen(str),", %u refused", stats.connections_refused);
sprintf(str+strlen(str),", %lu refused", stats.connections_refused);
if(stats.connections_ignored)
sprintf(str+strlen(str),", %u ignored", stats.connections_refused);
sprintf(str+strlen(str),", %lu ignored", stats.connections_refused);
if(stats.sessions_refused)
sprintf(str+strlen(str),", %u sessions refused", stats.sessions_refused);
sprintf(str+strlen(str),", %u messages received", stats.msgs_received);
sprintf(str+strlen(str),", %lu sessions refused", stats.sessions_refused);
sprintf(str+strlen(str),", %lu messages received", stats.msgs_received);
if(stats.msgs_refused)
sprintf(str+strlen(str),", %u refused", stats.msgs_refused);
sprintf(str+strlen(str),", %lu refused", stats.msgs_refused);
if(stats.msgs_ignored)
sprintf(str+strlen(str),", %u ignored", stats.msgs_ignored);
sprintf(str+strlen(str),", %lu ignored", stats.msgs_ignored);
if(stats.errors)
sprintf(str+strlen(str),", %u errors", stats.errors);
sprintf(str+strlen(str),", %lu errors", stats.errors);
if(stats.crit_errors)
sprintf(str+strlen(str),", %u critcal", stats.crit_errors);
sprintf(str+strlen(str),", %lu critcal", stats.crit_errors);
lprintf(LOG_INFO,"#### Mail Server thread terminated (%s)",str);
}
......
......@@ -60,7 +60,7 @@ ulong sbbs_t::msgtoqwk(smbmsg_t* msg, FILE *qwk_fp, long mode, int subnum
offset=(long)ftell(qwk_fp);
if(hdrs!=NULL) {
fprintf(hdrs,"[%x]\n",offset);
fprintf(hdrs,"[%lx]\n",offset);
/* Message-IDs */
fprintf(hdrs,"Message-ID: %s\n",get_msgid(&cfg,subnum,msg,msgid,sizeof(msgid)));
......@@ -89,7 +89,7 @@ ulong sbbs_t::msgtoqwk(smbmsg_t* msg, FILE *qwk_fp, long mode, int subnum
,str,sizeof(str))
,sys_timezone(&cfg)
);
fprintf(hdrs,"ExportedFrom: %s %s %lu\n"
fprintf(hdrs,"ExportedFrom: %s %s %"PRIu32"\n"
,cfg.sys_id
,subnum==INVALID_SUB ? "mail":cfg.sub[subnum]->code
,msg->hdr.number
......
......@@ -628,7 +628,7 @@ int main(int argc, char **argv)
printf("conn=%u\n",node.connection);
printf("misc=%u\n",node.misc);
printf("aux=%u\n",node.aux);
printf("extaux=%lu\n",node.extaux);
printf("extaux=%"PRIu32"\n",node.extaux);
} /* debug */
if(pause) {
......
......@@ -304,7 +304,7 @@ int main(int argc, char **argv)
fseek(smb.sid_fp,msg.offset*sizeof(idxrec_t),SEEK_SET);
if(!fread(&msg.idx,1,sizeof(idxrec_t),smb.sid_fp))
break;
fprintf(stderr,"%-5lu\r",msg.offset+1);
fprintf(stderr,"%-5u\r",msg.offset+1);
if(msg.idx.to==smm || msg.idx.to==sbl)
continue;
if(max_age && now-msg.idx.time>((ulong)max_age*24UL*60UL*60UL))
......@@ -323,7 +323,7 @@ int main(int argc, char **argv)
if(msg.from_net.type!=NET_QWK)
msg.from_net.addr="";
if(cmd&USERS) {
sprintf(str,"%s%s",msg.from_net.addr,msg.from);
sprintf(str,"%s%s",(char *)msg.from_net.addr,(char *)msg.from);
curcrc=crc32(str,0);
}
else
......@@ -370,7 +370,7 @@ int main(int argc, char **argv)
if(msg.from_net.type!=NET_QWK)
strcpy(str,cfg.sys_id);
else if(mode&FEED)
sprintf(str,"%s/%s",cfg.sys_id,msg.from_net.addr);
sprintf(str,"%s/%s",cfg.sys_id,(char *)msg.from_net.addr);
else
strcpy(str,msg.from_net.addr);
p=strrchr(str,'/');
......@@ -388,7 +388,7 @@ int main(int argc, char **argv)
if(mode&TAGS)
gettag(msg,tag);
if(mode&FEED)
sprintf(str,"%s/%s",cfg.sys_id,msg.from_net.addr);
sprintf(str,"%s/%s",cfg.sys_id,(char *)msg.from_net.addr);
else
strcpy(str,msg.from_net.addr);
p=strrchr(str,'/');
......
......@@ -1401,16 +1401,16 @@ int main(int argc, char** argv)
printf("Telnet server port:\t%u\n",bbs_startup.telnet_port);
printf("Terminal first node:\t%u\n",bbs_startup.first_node);
printf("Terminal last node:\t%u\n",bbs_startup.last_node);
printf("Terminal server options:\t0x%08lX\n",bbs_startup.options);
printf("Terminal server options:\t0x%08"PRIX32"\n",bbs_startup.options);
printf("FTP server port:\t%u\n",ftp_startup.port);
printf("FTP server options:\t0x%08lX\n",ftp_startup.options);
printf("FTP server options:\t0x%08"PRIX32"\n",ftp_startup.options);
printf("Mail SMTP server port:\t%u\n",mail_startup.smtp_port);
printf("Mail SMTP relay port:\t%u\n",mail_startup.relay_port);
printf("Mail POP3 server port:\t%u\n",mail_startup.pop3_port);
printf("Mail server options:\t0x%08lX\n",mail_startup.options);
printf("Services options:\t0x%08lX\n",services_startup.options);
printf("Mail server options:\t0x%08"PRIX32"\n",mail_startup.options);
printf("Services options:\t0x%08"PRIX32"\n",services_startup.options);
printf("Web server port:\t%u\n",web_startup.port);
printf("Web server options:\t0x%08lX\n",web_startup.options);
printf("Web server options:\t0x%08"PRIX32"\n",web_startup.options);
return(0);
}
switch(toupper(*(arg++))) {
......@@ -2113,7 +2113,7 @@ int main(int argc, char** argv)
for(node=login_attempt_list.first; node!=NULL; node=node->next) {
login_attempt=node->data;
localtime32(&login_attempt->time,&tm);
printf("%u attempts (%u duplicate) from %s, last via %s on %u/%u %02u:%02u:%02u (user: %s, password: %s)\n"
printf("%lu attempts (%lu duplicate) from %s, last via %s on %u/%u %02u:%02u:%02u (user: %s, password: %s)\n"
,login_attempt->count
,login_attempt->dupes
,inet_ntoa(login_attempt->addr)
......@@ -2129,11 +2129,11 @@ int main(int argc, char** argv)
if(count)
printf("==\n");
printf("%u failed login attempters (potential password hackers)\n", count);
printf("%u total unique failed login attempts (potential password hack attempts)\n", total);
printf("%lu total unique failed login attempts (potential password hack attempts)\n", total);
}
break;
case 'A':
printf("\n%u login attempts cleared\n", loginAttemptListClear(&login_attempt_list));
printf("\n%lu login attempts cleared\n", loginAttemptListClear(&login_attempt_list));
break;
case 'c': /* Show connected clients: */
printf("\nConnected clients:\n\n");
......@@ -2147,7 +2147,7 @@ int main(int argc, char** argv)
for(node=client_list.first; node!=NULL; node=node->next) {
client=node->data;
localtime32(&client->time,&tm);
printf("%04d %s %s %s %s port %u since %u/%u %02u:%02u:%02u\n"
printf("%04ld %s %s %s %s port %u since %u/%u %02u:%02u:%02u\n"
,node->tag
,client->protocol
,client->user
......
......@@ -722,7 +722,7 @@ static void output_thread(void* arg)
}
if(total_sent)
sprintf(stats,"(sent %"PRIu64" bytes in %"PRIu64" blocks, %"PRIu64" average, %lu short, %lu errors)"
sprintf(stats,"(sent %"PRIu64" bytes in %"PRIu64" blocks, %"PRIu64" average, %lu short, %u errors)"
,total_sent, total_pkts, total_sent/total_pkts, short_sends, select_errors);
else
stats[0]=0;
......@@ -800,7 +800,7 @@ void xmodem_progress(void* unused, unsigned block_num, int64_t offset, int64_t f
if(l<0) l=0;
if(mode&SEND) {
total_blocks=num_blocks(block_num,offset,fsize,xm.block_size);
fprintf(statfp,"\rBlock (%lu%s): %lu/%"PRId64" Byte: %"PRId64" "
fprintf(statfp,"\rBlock (%lu%s): %u/%"PRId64" Byte: %"PRId64" "
"Time: %lu:%02lu/%lu:%02lu %u cps %lu%% "
,xm.block_size%1024L ? xm.block_size: xm.block_size/1024L
,xm.block_size%1024L ? "" : "K"
......@@ -815,7 +815,7 @@ void xmodem_progress(void* unused, unsigned block_num, int64_t offset, int64_t f
,fsize?(long)(((float)offset/(float)fsize)*100.0):100
);
} else if(mode&YMODEM) {
fprintf(statfp,"\rBlock (%lu%s): %lu Byte: %"PRId64" "
fprintf(statfp,"\rBlock (%lu%s): %u Byte: %"PRId64" "
"Time: %lu:%02lu/%lu:%02lu %u cps %lu%% "
,xm.block_size%1024L ? xm.block_size: xm.block_size/1024L
,xm.block_size%1024L ? "" : "K"
......@@ -829,7 +829,7 @@ void xmodem_progress(void* unused, unsigned block_num, int64_t offset, int64_t f
,fsize?(long)(((float)offset/(float)fsize)*100.0):100
);
} else { /* XModem receive */
fprintf(statfp,"\rBlock (%lu%s): %lu Byte: %"PRId64" "
fprintf(statfp,"\rBlock (%lu%s): %u Byte: %"PRId64" "
"Time: %lu:%02lu %u cps "
,xm.block_size%1024L ? xm.block_size: xm.block_size/1024L
,xm.block_size%1024L ? "" : "K"
......@@ -997,7 +997,7 @@ static int send_files(char** fname, uint fnames)
/* DSZLOG entry */
if(logfp) {
lprintf(LOG_DEBUG,"Updating DSZLOG: %s", dszlog);
fprintf(logfp,"%c %7"PRId64" %5u bps %6lu cps %3u errors %5u %4u "
fprintf(logfp,"%c %7"PRId64" %5u bps %6u cps %3u errors %5u %4u "
"%s -1\n"
,(mode&ZMODEM && zm.file_skipped) ? 's'
: success ? (mode&ZMODEM ? 'z':'S')
......@@ -1077,7 +1077,8 @@ static int receive_files(char** fname_list, int fnames)
int64_t file_bytes=0,file_bytes_left=0;
int64_t total_bytes=0;
FILE* fp;
time_t t,startfile,ftime;
time_t t,startfile;
uintmax_t ftime;
if(fnames>1)
lprintf(LOG_INFO,"Receiving %u files",fnames);
......@@ -1119,7 +1120,7 @@ static int receive_files(char** fname_list, int fnames)
}
ftime=total_files=0;
total_bytes=0;
i=sscanf(block+strlen(block)+1,"%"PRId64" %lo %lo %lo %u %"PRId64
i=sscanf(block+strlen(block)+1,"%"SCNd64" %"SCNoMAX" %lo %lo %u %"SCNd64
,&file_bytes /* file size (decimal) */
,&ftime /* file time (octal unix format) */
,&fmode /* file mode (not used) */
......@@ -1342,8 +1343,8 @@ static int receive_files(char** fname_list, int fnames)
if(logfp) {
lprintf(LOG_DEBUG,"Updating DSZLOG: %s", dszlog);
fprintf(logfp,"%c %6lu %5u bps %4lu cps %3u errors %5u %4u "
"%s %d\n"
fprintf(logfp,"%c %6"PRId64" %5u bps %4"PRId64" cps %3u errors %5u %4u "
"%s %ld\n"
,success ? (mode&ZMODEM ? 'Z' : 'R') : 'E'
,file_bytes
,115200 /* baud */
......@@ -1603,7 +1604,7 @@ int main(int argc, char **argv)
else if(outbuf_size > MAX_OUTBUF_SIZE)
outbuf_size = MAX_OUTBUF_SIZE;
fprintf(statfp,"Output buffer size: %u\n", outbuf_size);
fprintf(statfp,"Output buffer size: %lu\n", outbuf_size);
RingBufInit(&outbuf, outbuf_size);
#if !defined(RINGBUF_EVENT)
......
......@@ -362,11 +362,11 @@ void showstatus(void)
,beep,i,smb.last_error);
return;
}
printf("last_msg =%lu\n"
"total_msgs =%lu\n"
"header_offset =%lu\n"
"max_crcs =%lu\n"
"max_msgs =%lu\n"
printf("last_msg =%"PRIu32"\n"
"total_msgs =%"PRIu32"\n"
"header_offset =%"PRIu32"\n"
"max_crcs =%"PRIu32"\n"
"max_msgs =%"PRIu32"\n"
"max_age =%u\n"
"attr =%04Xh\n"
,smb.status.last_msg
......@@ -400,13 +400,13 @@ void config(void)
,beep,i,smb.last_error);
return;
}
printf("Header offset =%-5lu New value (CR=No Change): "
printf("Header offset =%-5"PRIu32" New value (CR=No Change): "
,smb.status.header_offset);
gets(header_offset);
printf("Max msgs =%-5lu New value (CR=No Change): "
printf("Max msgs =%-5"PRIu32" New value (CR=No Change): "
,smb.status.max_msgs);
gets(max_msgs);
printf("Max crcs =%-5lu New value (CR=No Change): "
printf("Max crcs =%-5"PRIu32" New value (CR=No Change): "
,smb.status.max_crcs);
gets(max_crcs);
printf("Max age =%-5u New value (CR=No Change): "
......@@ -475,7 +475,7 @@ void listmsgs(ulong start, ulong count)
,beep,i,smb.last_error);
break;
}
printf("%4lu %-25.25s %-25.25s %s\n"
printf("%4"PRIu32" %-25.25s %-25.25s %s\n"
,msg.hdr.number,msg.from,msg.to,msg.subj);
smb_freemsgmem(&msg);
l++;
......@@ -533,7 +533,7 @@ void dumpindex(ulong start, ulong count)
if(!fread(&idx,1,sizeof(idx),smb.sid_fp))
break;
printf("%4lu %04hX %04hX %04Xh %04Xh %06X %s\n"
printf("%4"PRIu32" %04hX %04hX %04Xh %04Xh %06X %s\n"
,idx.number,idx.from,idx.to,idx.subj,idx.attr
,idx.offset,my_timestr(idx.time));
l++;
......@@ -598,15 +598,15 @@ void dump_hashes(void)
if(smb_fread(&smb,&hash,sizeof(hash),smb.hash_fp)!=sizeof(hash))
break;
printf("\n");
printf("%-10s: %lu\n", "Number", hash.number);
printf("%-10s: %"PRIu32"\n","Number", hash.number);
printf("%-10s: %s\n", "Source", smb_hashsourcetype(hash.source));
printf("%-10s: %lu\n", "Length", hash.length);
printf("%-10s: %"PRIu32"\n","Length", hash.length);
printf("%-10s: %s\n", "Time", my_timestr(hash.time));
printf("%-10s: %02x\n", "Flags", hash.flags);
if(hash.flags&SMB_HASH_CRC16)
printf("%-10s: %04x\n", "CRC-16", hash.crc16);
if(hash.flags&SMB_HASH_CRC32)
printf("%-10s: %08lx\n","CRC-32", hash.crc32);
printf("%-10s: %08"PRIx32"\n","CRC-32", hash.crc32);
if(hash.flags&SMB_HASH_MD5)
printf("%-10s: %s\n", "MD5", MD5_hex(tmp,hash.md5));
}
......@@ -650,13 +650,13 @@ void maint(void)
if((idx=(idxrec_t *)malloc(sizeof(idxrec_t)*smb.status.total_msgs))
==NULL) {
smb_unlocksmbhdr(&smb);
fprintf(errfp,"\n%s!Error allocating %lu bytes of memory\n"
fprintf(errfp,"\n%s!Error allocating %u bytes of memory\n"
,beep,sizeof(idxrec_t)*smb.status.total_msgs);
return;
}
fseek(smb.sid_fp,0L,SEEK_SET);
for(l=0;l<smb.status.total_msgs;l++) {
printf("%lu of %lu\r"
printf("%lu of %"PRIu32"\r"
,l+1,smb.status.total_msgs);
if(!fread(&idx[l],1,sizeof(idxrec_t),smb.sid_fp))
break;
......@@ -1024,7 +1024,7 @@ void packmsgs(ulong packable)
fseek(smb.sid_fp,0L,SEEK_SET);
total=0;
for(l=0;l<smb.status.total_msgs;l++) {
printf("%lu of %lu\r",l+1,smb.status.total_msgs);
printf("%lu of %"PRIu32"\r",l+1,smb.status.total_msgs);
if(!fread(&msg.idx,1,sizeof(idxrec_t),smb.sid_fp))
break;
if(msg.idx.attr&MSG_DELETE) {
......@@ -1305,7 +1305,7 @@ void readmsgs(ulong start)
break;
}
printf("\n%lu (%lu)\n",msg.hdr.number,msg.offset+1);
printf("\n%"PRIu32" (%d)\n",msg.hdr.number,msg.offset+1);
printf("Subj : %s\n",msg.subj);
printf("To : %s",msg.to);
if(msg.to_net.type)
......
......@@ -210,7 +210,7 @@ void add_bruted(unsigned long name, char good, char *val, int save)
if(*val && save) {
cache=fopen("unbaja.brute","a");
if(cache!=NULL) {
fprintf(cache,"%08x,%hhd,%s\n",name,good,val);
fprintf(cache,"%08lx,%hhd,%s\n",name,good,val);
fclose(cache);
}
}
......@@ -258,7 +258,7 @@ char* bruteforce(unsigned long name)
}
memset(brute_buf,0,brute_len+1);
memset(brute_crc_buf,0,brute_len*sizeof(int32_t));
printf("Brute forcing var_%08x\n",name);
printf("Brute forcing var_%08lx\n",name);
this_crc=crc32((char *)brute_buf,0);
for(;;) {
pos=brute_buf+l;
......@@ -346,7 +346,7 @@ char *getvar(long name)
if(brute)
strcpy(varname,brute);
else
sprintf(varname,"var_%08x",name);
sprintf(varname,"var_%08lx",name);
}
return(varname);
......@@ -384,7 +384,7 @@ void write_lng(FILE *bin, char *src)
int32_t lng;
fread(&lng,4,1,bin);
sprintf(strchr(src,0),"%ld ",lng);
sprintf(strchr(src,0),"%"PRId32" ",lng);
}
void write_short(FILE *bin, char *src)
......@@ -1538,7 +1538,7 @@ void decompile(FILE *bin, FILE *srcfile)
sprintf(strchr(src,0),"%s ",getvar(var));
usevar=FALSE;
} else {
sprintf(strchr(src,0),"%ld ",lng);
sprintf(strchr(src,0),"%"PRId32" ",lng);