Category : C Source Code
Archive   : DLPHONE.ZIP
Filename : UTIL.C
list that holds the list of names. */
/* Copyright (C) 1988 Michael Draganza */
#include
#include
#include "dll.h"
BOOL far pascal addlist(LPSTR);
BOOL far pascal dellist(LPSTR);
LPSTR far pascal getstring();
extern LPSTR far pascal lstrcpy(LPSTR, LPSTR);
extern pnm_hold currpt;
extern int numnames;
BOOL far pascal addlist(LPSTR fn)
{
static char fnme[NAMLEN];
pnm_hold savept;
/* Use lstrcpy because fn is FAR */
/* Put the passed string into local storage because there is no lstrupr */
lstrcpy((LPSTR)fnme, (LPSTR)fn);
strupr(fnme); /* Convert string to uppercase */
if (strcmp(fnme, hList->fname) < 0 || (hList == NULL)) {
savept = hList;
hList = currpt = (pnm_hold)LocalAlloc(LPTR, sizeof(struct nm_hold));
hList->fname = (NPSTR)LocalAlloc(LPTR, strlen(fnme)+1);
strcpy(hList->fname, fnme);
hList->next = savept;
}
else {
currpt = hList;
while ((strcmp(fnme, currpt->next->fname) > 0) && (currpt->next))
currpt = currpt->next;
savept = currpt->next;
currpt->next = (pnm_hold)LocalAlloc(LPTR, sizeof(struct nm_hold));
currpt->next->fname = (NPSTR)LocalAlloc(LPTR, strlen(fnme)+1);
strcpy(currpt->next->fname, fnme);
currpt->next->next = savept;
currpt = currpt->next;
}
numnames++;
return TRUE;
}
/* Delete the passed string from the list of filenames */
BOOL far pascal dellist(LPSTR fn)
{
static char fnme[NAMLEN];
static pnm_hold pt;
pnm_hold savept;
lstrcpy((LPSTR)fnme, (LPSTR)fn);
strupr(fnme); /* Convert string to uppercase */
pt = hList;
if (strcmp(fnme, hList->fname) == 0) {
hList = currpt = hList->next;
LocalFree((LOCALHANDLE) pt->fname);
LocalFree((LOCALHANDLE) pt);
}
else
for(;;) {
if (strcmp(fnme, pt->next->fname) == 0) {
savept = pt->next;
pt->next = pt->next->next;
currpt = pt->next;
LocalFree((LOCALHANDLE) savept->fname);
LocalFree((LOCALHANDLE) savept);
break;
}
else if (pt->next == NULL)
return FALSE; /* Name not found in list */
else
pt = pt->next;
}
return TRUE;
}
/* Return currently selected name to application */
LPSTR far pascal getstring()
{
return((LPSTR)currpt->fname);
}
Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!
This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.
But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/