/*Copyright (C) 1992, 1995 by Thomas Glen Smith. All Rights Reserved.*/ /* apllib APL2 V1.0.0 ************************************************** * Called from aplwksp to do )LIB. * ***********************************************************************/ #include #define INCLUDES APLCB+APLDOS+STDIO+STRING #include "includes.h" #if ! APL_DOS #include #include #include #endif void apllib(rite,cp,cpend) Aplcb rite; /* aplcb for command text */ char *cp; /* Pointer to char immediately after right parenthesis */ char *cpend; /* Pointer to end of command text */ { Execmsg; #if ! APL_DOS DIR *dirp; struct dirent *dp; extern int errno; #endif char path[256]; /* DOS path */ char *ch,lib[20]; struct FIND *p; int i; #if APL_DOS if (cpend-cp) { strcpy(path, cp); strcpy(path+strlen(path),"\\*.apl"); } else strcpy(path,"*.apl"); p = findfirst(path, 0); /* Find first item in subdirectory. */ while(p) { for(i = 0, ch = p->name; /* translate to lower case */ '\0' != (lib[i] = tolower(*ch++)); i++); execmsg(lib, i, 0, NULL); p = findnext(); /* Get next item in this subdirectory. */ } #else if (cpend-cp) strcpy(path, cp); else strcpy(path,"."); dirp = opendir(path); /* open current directory */ while ((dp = readdir(dirp)) != NULL) if (0 == strcmp(".apl",dp->d_name+strlen(dp->d_name)-4)) execmsg(dp->d_name, strlen(dp->d_name), 0, NULL); (void) closedir(dirp); #endif errno = 0; /* reset error indicator */ }