Category : OS/2 Files
Archive   : LJ2UP2.ZIP
Filename : FSEARCH.C

 
Output of file : FSEARCH.C contained in archive : LJ2UP2.ZIP
/*
** File functions FSEARCH and FNEXT.
**
**
** Joe Barnhart, 21-July-86
** Steve Coles, 19-October-87 changed for OS/2
** Steve Coles, 12-July-88 changed to MSC 1.1 headers
*/

/* Prototypes */

char *fsearch(char *fname);
char *fnext(void );
char *fpath(char *fname);

#define INCL_NOCOMMON /* These three lines define how much */
#define INCL_DOSFILEMGR /* of the OS/2 API is defined. In this */
#include /* only file functions. */

/* Standard C includes */
#include


HDIR dhand; /* search handle */
FILEFINDBUF wbuf; /* OS/2 places directory info */
USHORT nwbuf = 1; /* number of directories */


char *fsearch( fname )
char *fname;
{
unsigned rc;

dhand = 0xffff; /* let OS assign handle */
rc = DosFindFirst(fname,
&dhand,
0,
&wbuf,
sizeof(wbuf),
&nwbuf,
0L);
if (rc == 0)
return(strlwr(wbuf.achName));
return(0);
}


char *fnext()
{
unsigned rc;

rc = DosFindNext(dhand,
&wbuf,
sizeof(wbuf),
&nwbuf);
if (rc == 0)
return(strlwr(wbuf.achName));
return(0);
}


char *fpath( fname )
char *fname;
{
static char path[32];
register int plen;
register char *p;
char *endp;

for( p=fname, endp=fname; *p!='\0'; p++ )
if( *p==':' || *p=='\\' )
endp = p+1;

plen = endp - fname;
if( plen == 0 )
path[0] = '\0';
else {
strncpy( path, fname, plen );
path[ plen+1 ] = '\0';
strlwr( path );
}
return( path );
}



  3 Responses to “Category : OS/2 Files
Archive   : LJ2UP2.ZIP
Filename : FSEARCH.C

  1. Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!

  2. This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.

  3. 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/