main() { int dnum; dnum = dir_find("Starfleet","TELIX.FON"); if (dnum >= 0) dial(dir_find("Starfleet","TELIX.FON"),0,0); else return (-1); } ////////////////////////// dir_find () ///////////////////////////////// // This function will search the directory specified in for // the entry specified in . A dummy directory called BLANK.FON is // necessary to force Telix to close the current dialing directory. // // Returns: the entry number if found // -1 if not found // -2 if dummy directory not there // -3 if directory to search not there // -4 if couldn't restore directory to search // Author: Paul A. Billlings, Las Cruces, NM // NM BBS # (505) 523-4528 Freeflight (summers) // NC BBS # (919) 481-1864 Waterfront West str dir_find_num[5]; // Make global so can return it dir_find(str key,str fonlist) { int f, // Filehandle n, // Number of entries i; // Counter str build[64], // Used to build filenames buf[25]; // Holds input name build = _telix_dir; // Build dummy directory name strcat(build,"BLANK.FON"); if (!loadfon (build)) // Dummy file not there return ("-2"); f = fopen(fonlist, "r"); // File to search not there if (!f) return ("-3"); fseek (f,6,0); // Number of entries n = fgetc (f); // Low order byte n = n + 256*fgetc (f); // High order byte for (i = 0;i < n; i = i+1) { fseek (f,i*86+64,0); // Find next record location // Record len = 86 bytes // Header = 64 bytes fgets (buf,25,f); // Read name if (strposi (buf,key,0) >= 0) // Found it! break; } fclose (f); // Clean up build = _telix_dir; strcat(build,fonlist); // Build dummy directory name if (!loadfon (build)) // Can't restore directory return ("-4"); if (i==n) return (-1); // Return status (-1==not found) itos(i+1,dir_find_num); // Convert to character format return (dir_find_num); // for use by dial() }