home *** CD-ROM | disk | FTP | other *** search
- #include <stdlib.h>
- #include <stdio.h>
- #include <string.h>
- #define true (!false)
- #define false 0
- long coreleft(void)
- {
- return 4000000l;
- }
- char *strlwr(char *s)
- {
- char *ss=s;
- while (*s!=0) {*s = tolower(*s); s++;}
- return ss;
- }
- char *strupr(char *s)
- {
- char *ss=s;
- while (*s!=0) {*s = toupper(*s); s++;}
- return ss;
- }
-
- trim_file(char *s)
- {
- char *t;
- t = strchr(s,']');
- if (t!=NULL) memcpy(s,t+1,strlen(t));
- t = strchr(s,';');
- if (s!=NULL) *t = 0;
- }
- char *getsymbol(char *sym)
- {
- static char mystr[200],*s;
- s = getenv(sym);
- if (s==NULL) s = "";
- strcpy(mystr,sym);
- return mystr;
- }
-
-
- #include <stdio.h>
- #include <stdlib.h>
- #include <sys/types.h>
- #include <sys/wait.h>
- #define false 0
- #define true (!false)
-
- FILE *wilddir;
- struct ffblk {char *ff_name;};
- findfirst(char *wild, struct ffblk *ffblk, int zz)
- {
- static char buff[200];
- int op;
- union wait *status;
- int p;
- p = fork();
- if (p==-1) {perror("Unable to fork ls command \n"); return true;}
- if (p==0) {
- strcpy(buff,"ls ");
- strcat(buff,wild);
- strcat(buff,">gledir.tmp");
- execlp("sh","sh","-c", buff,0);
- exit(1);
- }
- waitpid(p,status,op);
- wilddir = fopen("gledir.tmp","r");
- if (wilddir==NULL) {printf("Fork ls failed \n"); return true;}
- if feof(wilddir) { fclose(wilddir); return true;}
- fgets(buff,100,wilddir);
- trimcr(buff);
- ffblk->ff_name = buff;
- return false;
- }
- trimcr(char *s)
- {
- s = strchr(s,'\n');
- if (s!=NULL) *s = 0;
- }
- findnext(struct ffblk *ffblk)
- {
- static char buff[200];
- if feof(wilddir) { fclose(wilddir); return true;}
- fgets(buff,100,wilddir);
- trimcr(buff);
- ffblk->ff_name = buff;
- return false;
- }
-