Category : Utilities for DOS and Windows Machines
Archive   : PATHHUNT.ZIP
Filename : PATHHUNT.C
Output of file : PATHHUNT.C contained in archive : PATHHUNT.ZIP
#include
#include
#include
char filespec[14]; /* used to hold \filespec */
char ss[64]; /* search string */
char path[256], *pathptr; /* pointer and buffer for path */
void PrintUsage()
{
puts("Usage: PathHunt filespec");
puts("");
puts("PathHunt will search each directory in the path");
puts("and print the names of any files that match the");
puts("filespec. The filespec should NOT contain any");
puts("path (subdirectory) specification.");
exit();
} /* PrintUsage */
void PrintMatches( char *s)
{ char msg[80] = "Now searching for ";
struct ffblk filedata;
strcat( msg, strlwr(s)); /* tell about the search string */
puts( msg);
if ( !findfirst( s, &filedata, FA_NORMAL)) /* at least one file */
{
putchar( '\t');
puts( filedata.ff_name);
while ( !findnext( &filedata))
{
putchar( '\t');
puts( filedata.ff_name);
}
}
} /* PrintMatches */
void main( int argc, char *argv[])
{
puts("PathHunt 1.0 -- Copyright (C) 1990, Bit Bucket Software");
if (argc == 1) /* if no argument, grumble */
PrintUsage();
else
{ /* otherwise init string to \filespec */
filespec[0] = '\\';
strcpy( &filespec[1], argv[1]);
}
if ((pathptr = getenv( "PATH")) == NULL)
{
puts("PathHunt: PATH variable not found in environment");
exit(1);
}
PrintMatches( argv[1]); /* get current directory first */
strcpy( path, pathptr); /* then go down the path. */
strcpy( ss, strtok( path, ";"));
while (ss[0])
{
if (strlen( ss) == 3) /* a root directory */
ss[2] = '\0'; /* strip off \, since already one on filespec */
strcat( ss, filespec); /* build complete search string */
PrintMatches( ss); /* do dir search and print results */
ss[0] = '\0'; /* change search string to empty */
strcpy( ss, strtok( NULL, ";")); /* check for another dir in path */
}
} /* end main PathHunt */
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/