Commit d207cb87 authored by rswindell's avatar rswindell
Browse files

Fixed strcasestr() to build on Win32.

Slight cosmetic improvements (this app still needs a lot of work).
parent c1d5bf41
......@@ -49,7 +49,6 @@
#endif
#include "genwrap.h"
#include "uifc.h"
#include "curs_fix.h"
#include "sbbsdefs.h"
#include "genwrap.h" /* stricmp */
#include "dirwrap.h" /* lock/unlock/sopen */
......@@ -78,8 +77,7 @@ char NoStr[]="No";
* From FreeBSD src/lib/libc/string/strcasestr.c
*/
char *
strcasestr(s, find)
const char *s, *find;
strcasestr(const char *s, const char *find)
{
char c, sc;
size_t len;
......@@ -92,7 +90,7 @@ strcasestr(s, find)
if ((sc = *s++) == 0)
return (NULL);
} while ((char)tolower((unsigned char)sc) != c);
} while (strncasecmp(s, find, len) != 0);
} while (strnicmp(s, find, len) != 0);
s--;
}
return ((char *)s);
......@@ -249,17 +247,17 @@ int edit_terminal(scfg_t *cfg, user_t *user)
while(1) {
getuserdat(cfg,user);
i=0;
sprintf(opt[i++],"Auto-detect: %s",user->misc & AUTOTERM?"Yes":"No");
sprintf(opt[i++],"Extended ASCII: %s",user->misc & NO_EXASCII?"No":"Yes");
sprintf(opt[i++],"ANSI: %s",user->misc & ANSI?"Yes":"No");
sprintf(opt[i++],"Colour: %s",user->misc & COLOR?"Yes":"No");
sprintf(opt[i++],"RIP: %s",user->misc & RIP?"Yes":"No");
sprintf(opt[i++],"WIP: %s",user->misc & WIP?"Yes":"No");
sprintf(opt[i++],"Pause: %s",user->misc & UPAUSE?"Yes":"No");
sprintf(opt[i++],"Hot Keys: %s",user->misc & COLDKEYS?"No":"Yes");
sprintf(opt[i++],"Spinning Cursor: %s",user->misc & SPIN?"Yes":"No");
sprintf(opt[i++],"Auto-detect %s",user->misc & AUTOTERM?"Yes":"No");
sprintf(opt[i++],"Extended ASCII %s",user->misc & NO_EXASCII?"No":"Yes");
sprintf(opt[i++],"ANSI %s",user->misc & ANSI?"Yes":"No");
sprintf(opt[i++],"Color %s",user->misc & COLOR?"Yes":"No");
sprintf(opt[i++],"RIP %s",user->misc & RIP?"Yes":"No");
sprintf(opt[i++],"WIP %s",user->misc & WIP?"Yes":"No");
sprintf(opt[i++],"Pause %s",user->misc & UPAUSE?"Yes":"No");
sprintf(opt[i++],"Hot Keys %s",user->misc & COLDKEYS?"No":"Yes");
sprintf(opt[i++],"Spinning Cursor %s",user->misc & SPIN?"Yes":"No");
sprintf(str,"%u",user->rows);
sprintf(opt[i++],"Number of Rows: %s",user->rows?str:"Auto");
sprintf(opt[i++],"Number of Rows %s",user->rows?str:"Auto");
opt[i][0]=0;
switch(uifc.list(WIN_MID|WIN_ACT|WIN_SAV,0,0,0,&j,0,"Terminal Settings",opt)) {
case -1:
......@@ -348,10 +346,10 @@ int edit_logon(scfg_t *cfg, user_t *user)
while(1) {
i=0;
getuserdat(cfg,user);
sprintf(opt[i++],"Ask for New Message Scan: %s",user->misc & ASK_NSCAN?"Yes":"No");
sprintf(opt[i++],"Ask for Your Message Scan: %s",user->misc & ASK_SSCAN?"Yes":"No");
sprintf(opt[i++],"Remember Current Sub: %s",user->misc & CURSUB?"Yes":"No");
sprintf(opt[i++],"Quiet Mode: (Q exempt) %s",user->misc & QUIET?"Yes":"No");
sprintf(opt[i++],"Ask for New Message Scan %s",user->misc & ASK_NSCAN?"Yes":"No");
sprintf(opt[i++],"Ask for Your Message Scan %s",user->misc & ASK_SSCAN?"Yes":"No");
sprintf(opt[i++],"Remember Current Sub %s",user->misc & CURSUB?"Yes":"No");
sprintf(opt[i++],"Quiet Mode (Q exempt) %s",user->misc & QUIET?"Yes":"No");
sprintf(opt[i++],"Auto-Login via IP (V exempt) %s",user->misc & AUTOLOGON?"Yes":"No");
opt[i][0]=0;
switch(uifc.list(WIN_MID|WIN_ACT|WIN_SAV,0,0,0,&j,0,"Logon Settings",opt)) {
......@@ -412,11 +410,11 @@ int edit_chat(scfg_t *cfg, user_t *user)
while(1) {
i=0;
getuserdat(cfg,user);
sprintf(opt[i++],"Chat Echo: %s",user->chat & CHAT_ECHO?"Yes":"No");
sprintf(opt[i++],"Chat Actions: %s",user->chat & CHAT_ACTION?"Yes":"No");
sprintf(opt[i++],"Available for Chat: %s",user->chat & CHAT_NOPAGE?"No":"Yes");
sprintf(opt[i++],"Chat Echo %s",user->chat & CHAT_ECHO?"Yes":"No");
sprintf(opt[i++],"Chat Actions %s",user->chat & CHAT_ACTION?"Yes":"No");
sprintf(opt[i++],"Available for Chat %s",user->chat & CHAT_NOPAGE?"No":"Yes");
sprintf(opt[i++],"Activity Alerts %s",user->chat & CHAT_NOACT?"No":"Yes");
sprintf(opt[i++],"Split-Screen Private Chat: %s",user->chat & CHAT_SPLITP?"Yes":"No");
sprintf(opt[i++],"Split-Screen Private Chat %s",user->chat & CHAT_SPLITP?"Yes":"No");
opt[i][0]=0;
switch(uifc.list(WIN_MID|WIN_ACT|WIN_SAV,0,0,0,&j,0,"Chat Settings",opt)) {
case -1:
......@@ -502,8 +500,8 @@ int edit_cmd(scfg_t *cfg, user_t *user)
while(1) {
i=0;
getuserdat(cfg,user);
sprintf(opt[i++],"Command Shell: %s",cfg->shell[user->shell]->name);
sprintf(opt[i++],"Expert Mode: %s",user->misc & EXPERT?"Yes":"No");
sprintf(opt[i++],"Command Shell %s",cfg->shell[user->shell]->name);
sprintf(opt[i++],"Expert Mode %s",user->misc & EXPERT?"Yes":"No");
opt[i][0]=0;
switch(uifc.list(WIN_MID|WIN_ACT|WIN_SAV,0,0,0,&j,0,"Command Shell",opt)) {
case -1:
......@@ -576,9 +574,9 @@ int edit_msgopts(scfg_t *cfg, user_t *user)
while(1) {
getuserdat(cfg,user);
i=0;
sprintf(opt[i++],"Forward Email to NetMail: %s",user->misc & NETMAIL?"Yes":"No");
sprintf(opt[i++],"Clear Screen Between Messages: %s",user->misc & CLRSCRN?"Yes":"No");
sprintf(opt[i++],"External Editor: %s",user->xedit?cfg->xedit[user->xedit-1]->name:"None");
sprintf(opt[i++],"Forward Email to NetMail %s",user->misc & NETMAIL?"Yes":"No");
sprintf(opt[i++],"Clear Screen Between Messages %s",user->misc & CLRSCRN?"Yes":"No");
sprintf(opt[i++],"External Editor %s",user->xedit?cfg->xedit[user->xedit-1]->name:"None");
opt[i][0]=0;
switch(uifc.list(WIN_MID|WIN_ACT|WIN_SAV,0,0,0,&j,0,"Message Options",opt)) {
case -1:
......@@ -664,21 +662,21 @@ int edit_qwk(scfg_t *cfg, user_t *user)
while(1) {
i=0;
getuserdat(cfg,user);
sprintf(opt[i++],"Include New Files List: %s",user->qwk & QWK_FILES?"Yes":"No");
sprintf(opt[i++],"Include Unread Email: %s",user->qwk & QWK_EMAIL?"Yes":"No");
sprintf(opt[i++],"Include ALL Email: %s",user->qwk & QWK_ALLMAIL?"Yes":"No");
sprintf(opt[i++],"Delete Email After Download: %s",user->qwk & QWK_DELMAIL?"Yes":"No");
sprintf(opt[i++],"Include Messages from Self: %s",user->qwk & QWK_BYSELF?"Yes":"No");
sprintf(opt[i++],"Expand CTRL-A to ANSI: %s",user->qwk & QWK_EXPCTLA?"Yes":"No");
sprintf(opt[i++],"Strip CTRL-A Codes: %s",user->qwk & QWK_RETCTLA?"No":"Yes");
sprintf(opt[i++],"Include File Attachments: %s",user->qwk & QWK_ATTACH?"Yes":"No");
sprintf(opt[i++],"Include Index Files: %s",user->qwk & QWK_NOINDEX?"No":"Yes");
sprintf(opt[i++],"Include Time Zone (@TZ): %s",user->qwk & QWK_TZ?"Yes":"No");
sprintf(opt[i++],"Include Seen-Bys (@VIA): %s",user->qwk & QWK_VIA?"Yes":"No");
sprintf(opt[i++],"Extraneous Control Files: %s",user->qwk & QWK_NOCTRL?"No":"Yes");
sprintf(opt[i++],"Extended (QWKE) Format: %s",user->qwk & QWK_EXT?"Yes":"No");
sprintf(opt[i++],"Include Message IDs (@MSGID): %s",user->qwk & QWK_MSGID?"Yes":"No");
sprintf(opt[i++],"Temp/QWK File Type: %s",user->tmpext);
sprintf(opt[i++],"Include New Files List %s",user->qwk & QWK_FILES?"Yes":"No");
sprintf(opt[i++],"Include Unread Email %s",user->qwk & QWK_EMAIL?"Yes":"No");
sprintf(opt[i++],"Include ALL Email %s",user->qwk & QWK_ALLMAIL?"Yes":"No");
sprintf(opt[i++],"Delete Email After Download %s",user->qwk & QWK_DELMAIL?"Yes":"No");
sprintf(opt[i++],"Include Messages from Self %s",user->qwk & QWK_BYSELF?"Yes":"No");
sprintf(opt[i++],"Expand CTRL-A to ANSI %s",user->qwk & QWK_EXPCTLA?"Yes":"No");
sprintf(opt[i++],"Strip CTRL-A Codes %s",user->qwk & QWK_RETCTLA?"No":"Yes");
sprintf(opt[i++],"Include File Attachments %s",user->qwk & QWK_ATTACH?"Yes":"No");
sprintf(opt[i++],"Include Index Files %s",user->qwk & QWK_NOINDEX?"No":"Yes");
sprintf(opt[i++],"Include Time Zone (@TZ) %s",user->qwk & QWK_TZ?"Yes":"No");
sprintf(opt[i++],"Include Seen-Bys (@VIA) %s",user->qwk & QWK_VIA?"Yes":"No");
sprintf(opt[i++],"Extraneous Control Files %s",user->qwk & QWK_NOCTRL?"No":"Yes");
sprintf(opt[i++],"Extended (QWKE) Format %s",user->qwk & QWK_EXT?"Yes":"No");
sprintf(opt[i++],"Include Message IDs (@MSGID) %s",user->qwk & QWK_MSGID?"Yes":"No");
sprintf(opt[i++],"Temp/QWK File Type %s",user->tmpext);
opt[i][0]=0;
switch(uifc.list(WIN_MID|WIN_ACT|WIN_SAV,0,0,0,&j,0,"Command Shell",opt)) {
case -1:
......@@ -826,16 +824,16 @@ int edit_fileopts(scfg_t *cfg, user_t *user)
while(1) {
getuserdat(cfg,user);
i=0;
sprintf(opt[i++],"Auto-New Scan: %s",user->misc & ANFSCAN?"Yes":"No");
sprintf(opt[i++],"Extended Descriptions: %s",user->misc & EXTDESC?"Yes":"No");
sprintf(opt[i++],"Batch Flagging: %s",user->misc & BATCHFLAG?"Yes":"No");
sprintf(opt[i++],"Auto Transfer Hangup: %s",user->misc & AUTOHANG?"Yes":"No");
sprintf(opt[i++],"Auto-New Scan %s",user->misc & ANFSCAN?"Yes":"No");
sprintf(opt[i++],"Extended Descriptions %s",user->misc & EXTDESC?"Yes":"No");
sprintf(opt[i++],"Batch Flagging %s",user->misc & BATCHFLAG?"Yes":"No");
sprintf(opt[i++],"Auto Transfer Hangup %s",user->misc & AUTOHANG?"Yes":"No");
strcpy(str,"None");
for(k=0;k<cfg->total_prots;k++)
if(cfg->prot[k]->mnemonic==user->prot)
strcpy(str,cfg->prot[k]->name);
sprintf(opt[i++],"Default Download Protocol: %s",str);
sprintf(opt[i++],"Temp/QWK File Type: %s",user->tmpext);
sprintf(opt[i++],"Default Download Protocol %s",str);
sprintf(opt[i++],"Temp/QWK File Type %s",user->tmpext);
opt[i][0]=0;
switch(uifc.list(WIN_MID|WIN_ACT|WIN_SAV,0,0,0,&j,0,"File Options",opt)) {
case -1:
......@@ -1000,26 +998,26 @@ int edit_stats(scfg_t *cfg, user_t *user)
while(1) {
getuserdat(cfg,user);
i=0;
sprintf(opt[i++],"First On: %s",user->firston?timestr(cfg, &user->firston, str):"Never");
sprintf(opt[i++],"Last On: %s",user->laston?timestr(cfg, &user->laston, str):"Never");
sprintf(opt[i++],"Logon Time: %s",user->laston?timestr(cfg, &user->logontime, str):"Not On");
sprintf(opt[i++],"Total Logons: %hu",user->logons);
sprintf(opt[i++],"Todays Logons: %hu",user->ltoday);
sprintf(opt[i++],"Total Posts: %hu",user->posts);
sprintf(opt[i++],"Todays Posts: %hu",user->ptoday);
sprintf(opt[i++],"Total Email: %hu",user->emails);
sprintf(opt[i++],"Todays Email: %hu",user->etoday);
sprintf(opt[i++],"Email To Sysop: %hu",user->fbacks);
sprintf(opt[i++],"Total Time On: %hu",user->timeon);
sprintf(opt[i++],"Time On Today: %hu",user->ttoday);
sprintf(opt[i++],"Time On Last Call: %hu",user->tlast);
sprintf(opt[i++],"Extra Time Today: %hu",user->textra);
sprintf(opt[i++],"Total Downloads: %hu",user->dls);
sprintf(opt[i++],"Downloaded Bytes: %lu",user->dlb);
sprintf(opt[i++],"Total Uploads: %hu",user->uls);
sprintf(opt[i++],"Uploaded Bytes: %lu",user->ulb);
sprintf(opt[i++],"Leech: %u",user->leech);
sprintf(opt[i++],"Password Modified: %s",user->pwmod?timestr(cfg, &user->pwmod, str):"Never");
sprintf(opt[i++],"First On %s",user->firston?timestr(cfg, &user->firston, str):"Never");
sprintf(opt[i++],"Last On %s",user->laston?timestr(cfg, &user->laston, str):"Never");
sprintf(opt[i++],"Logon Time %s",user->laston?timestr(cfg, &user->logontime, str):"Not On");
sprintf(opt[i++],"Total Logons %hu",user->logons);
sprintf(opt[i++],"Todays Logons %hu",user->ltoday);
sprintf(opt[i++],"Total Posts %hu",user->posts);
sprintf(opt[i++],"Todays Posts %hu",user->ptoday);
sprintf(opt[i++],"Total Email %hu",user->emails);
sprintf(opt[i++],"Todays Email %hu",user->etoday);
sprintf(opt[i++],"Email To Sysop %hu",user->fbacks);
sprintf(opt[i++],"Total Time On %hu",user->timeon);
sprintf(opt[i++],"Time On Today %hu",user->ttoday);
sprintf(opt[i++],"Time On Last Call %hu",user->tlast);
sprintf(opt[i++],"Extra Time Today %hu",user->textra);
sprintf(opt[i++],"Total Downloads %hu",user->dls);
sprintf(opt[i++],"Downloaded Bytes %lu",user->dlb);
sprintf(opt[i++],"Total Uploads %hu",user->uls);
sprintf(opt[i++],"Uploaded Bytes %lu",user->ulb);
sprintf(opt[i++],"Leech Downloads %u",user->leech);
sprintf(opt[i++],"Password Modified %s",user->pwmod?timestr(cfg, &user->pwmod, str):"Never");
opt[i][0]=0;
switch(uifc.list(WIN_MID|WIN_ACT,0,0,0,&j,0,"Statistics",opt)) {
case -1:
......@@ -1284,17 +1282,17 @@ int edit_security(scfg_t *cfg, user_t *user)
getuserdat(cfg,user);
while(1) {
i=0;
sprintf(opt[i++],"Level: %d",user->level);
sprintf(opt[i++],"Expiration: %s",user->expire?unixtodstr(cfg, user->expire, str):"Never");
sprintf(opt[i++],"Flag Set 1: %s",ltoaf(user->flags1,str));
sprintf(opt[i++],"Flag Set 2: %s",ltoaf(user->flags2,str));
sprintf(opt[i++],"Flag Set 3: %s",ltoaf(user->flags3,str));
sprintf(opt[i++],"Flag Set 4: %s",ltoaf(user->flags4,str));
sprintf(opt[i++],"Exemptions: %s",ltoaf(user->exempt,str));
sprintf(opt[i++],"Restrictions: %s",ltoaf(user->rest,str));
sprintf(opt[i++],"Credits: %lu",user->cdt);
sprintf(opt[i++],"Free Credits: %lu",user->freecdt);
sprintf(opt[i++],"Minutes: %lu",user->min);
sprintf(opt[i++],"Level %d",user->level);
sprintf(opt[i++],"Expiration %s",user->expire?unixtodstr(cfg, user->expire, str):"Never");
sprintf(opt[i++],"Flag Set 1 %s",ltoaf(user->flags1,str));
sprintf(opt[i++],"Flag Set 2 %s",ltoaf(user->flags2,str));
sprintf(opt[i++],"Flag Set 3 %s",ltoaf(user->flags3,str));
sprintf(opt[i++],"Flag Set 4 %s",ltoaf(user->flags4,str));
sprintf(opt[i++],"Exemptions %s",ltoaf(user->exempt,str));
sprintf(opt[i++],"Restrictions %s",ltoaf(user->rest,str));
sprintf(opt[i++],"Credits %lu",user->cdt);
sprintf(opt[i++],"Free Credits %lu",user->freecdt);
sprintf(opt[i++],"Minutes %lu",user->min);
opt[i][0]=0;
switch(uifc.list(WIN_MID|WIN_ACT,0,0,0,&j,0,"Security Settings",opt)) {
case -1:
......@@ -1450,19 +1448,19 @@ int edit_personal(scfg_t *cfg, user_t *user)
while(1) {
getuserdat(cfg,user);
i=0;
sprintf(opt[i++],"Real Name: %s",user->name);
sprintf(opt[i++],"Computer: %s",user->comp);
sprintf(opt[i++],"NetMail: %s",user->netmail);
sprintf(opt[i++],"Phone: %s",user->phone);
sprintf(opt[i++],"Note: %s",user->note);
sprintf(opt[i++],"Comment: %s",user->comment);
sprintf(opt[i++],"Gender: %c",user->sex);
sprintf(opt[i++],"Connection: %s",user->modem);
sprintf(opt[i++],"Handle: %s",user->alias);
sprintf(opt[i++],"Password: %s",user->pass);
sprintf(opt[i++],"Location: %s",user->location);
sprintf(opt[i++],"Address: %s",user->address);
sprintf(opt[i++],"Postal/Zip: %s",user->zipcode);
sprintf(opt[i++],"Real Name %s",user->name);
sprintf(opt[i++],"Computer %s",user->comp);
sprintf(opt[i++],"NetMail %s",user->netmail);
sprintf(opt[i++],"Phone %s",user->phone);
sprintf(opt[i++],"Note %s",user->note);
sprintf(opt[i++],"Comment %s",user->comment);
sprintf(opt[i++],"Gender %c",user->sex);
sprintf(opt[i++],"Connection %s",user->modem);
sprintf(opt[i++],"Handle %s",user->alias);
sprintf(opt[i++],"Password %s",user->pass);
sprintf(opt[i++],"Location %s",user->location);
sprintf(opt[i++],"Address %s",user->address);
sprintf(opt[i++],"Postal/Zip %s",user->zipcode);
opt[i][0]=0;
uifc.changes=FALSE;
switch(uifc.list(WIN_MID|WIN_ACT,0,0,0,&j,0,"Personal Settings",opt)) {
......@@ -1865,7 +1863,7 @@ int main(int argc, char** argv) {
"\nToDo: Add Help";
while(1) {
j=uifc.list(WIN_L2R|WIN_ESC|WIN_ACT|WIN_DYN|WIN_ORG,0,5,70,&main_dflt,&main_bar
j=uifc.list(WIN_L2R|WIN_ESC|WIN_ACT|WIN_DYN|WIN_ORG|WIN_EXTKEY,0,5,0,&main_dflt,&main_bar
,title,mopt);
if(j == -2)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment