TIP: Click on subject to list as thread! ANSI
echo: os2prog
to: All
from: Dan Larson
date: 1994-12-13 19:19:42
subject: DOSFINDFIRST HELP (Cont`d

home dir */
            ParsePtr = strtok(HomeDir, "$");               /*
parse the home di

string */
            while (*ParsePtr != '\\') ParsePtr++;
            while (*ParsePtr == '\\') ParsePtr++;
            sprintf(ServerResource, "\\\\%s$", ParsePtr);
            ServerDrive = ParsePtr[strlen(ParsePtr) - 1];   /* get the drive
lettr on   */
            strcpy(HomeServer, ServerResource);             /* extract name of
home dir */
            ParsePtr = HomeServer + strlen(HomeServer) - 1; /* server          
       
*/
            while (*ParsePtr != '\\') ParsePtr--;
            *ParsePtr = '\0';
            ParsePtr = strtok(NULL, "$");                   /* extract the
actual path  */
            strcpy(ServerPath, ParsePtr);                   /* of the home
directory    */
            UIBuff = (PUCHAR)UserInfo2->usri2_usr_comment;  /* extract user
comment     */
            strcpy(UserComment, UIBuff);                    /* (usually user
name)      */

            /* set up net use for the user's home directory     */
            /* skipping if the last user was on the same server */

            rc = NO_ERROR;
            if (stricmp(ServerResource, LastServer) != 0) {
               if (LastServer[0] != '\0') {   /* if there was one,    */
                  rc = DestroyUse(UseDrive);  /* destroy previous use */
               }
               LastServer[0] = 0;         /* invalidate LastServer variable */
               if (stricmp(HomeServer, Here) != 0) {
                  rc = CreateUse(ServerName, ServerResource, UseDrive);
                  if (rc == NO_ERROR) {
                     strcpy(LastServer, ServerResource); /* save server path fo

check next cycle */
                     strcpy(ScanDrive, UseDrive);
                  }
               }
               else {
                  sprintf(ScanDrive, "%c:", ServerDrive);
               }
            }
            sprintf(temp, "%c:%s", ServerDrive, ServerPath);
            if (rc == NO_ERROR) {
               AllocBytes = 0;
               /* recurse through the user's directtory tree */
               rc = RecurseHDDirectory(ScanDrive, ServerPath, &AllocBytes);
               if (rc == NO_ERROR) {
                  OutputHomeDirInfo(HomeServer, temp, UserName, UserComment,
                                   (double)AllocBytes / 1048576.0);
               }
               else {
                  sprintf(temp, "Home directory defined but not found for %s on
%s.\n",
                          UserName, HomeServer);
                  DoError(temp);
               }
            }
         }
      }
      free(UserInfo2);
   }
}

static APIRET RecurseHDDirectory(PUCHAR Drive, PUCHAR Dir, PULONG AllocBytes)
{
   UCHAR SearchPattern[PATHLEN+1], NewSearchDir[PATHLEN+1];
   HDIR FindHandle;
   ULONG Attribute, SearchCount;
   APIRET rc;
   ULONG FindBuffSize;
   FILEFINDBUF4 *FindBuff, *File;
   PUCHAR FilePtr;
   int idx;
 
   strcpy(SearchPattern, Drive);
   strcat(SearchPattern, Dir);
   strcat(SearchPattern, "\\*");
   FindHandle = 0xffffffff;         /* system allocates search handle */
   Attribute = FILE_ARCHIVED | FILE_DIRECTORY | FILE_SYSTEM | FILE_HIDDEN |
FILE_READONLY;
   SearchCount = FINDBUFENTRIES;

   /* allocate a buffer for the file search */
   FindBuffSize = sizeof(FILEFINDBUF4) * FINDBUFENTRIES;
   FindBuff = (FILEFINDBUF4 *)malloc(FindBuffSize);
   if (FindBuff == NULL) {
      DoFatalError("Memory Allocation Error : FindBuff Buffer");
   }

..

--- WILDMAIL!/WC v4.11 

* Origin: Freezing Point BBS - WDNet HQ - Mpls MN: (1:282/85.0)
SEEN-BY: 12/2442 54/54 620/243 624/50 632/348 640/820 690/660 711/409 410 413
SEEN-BY: 711/430 807 808 809 934 942 949 712/353 623 713/888 800/1
@PATH: 282/85 1 270/101 396/1 3615/50 229/2 12/2442 711/409 54/54 711/808 809
@PATH: 711/934

SOURCE: echomail via fidonet.ozzmosis.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.