home *** CD-ROM | disk | FTP | other *** search
/ Graphics Plus / Graphics Plus.iso / libs / gle / util / surf / turbo.c < prev    next >
Encoding:
C/C++ Source or Header  |  1992-11-29  |  2.0 KB  |  104 lines

  1. #include <stdlib.h>
  2. #include <stdio.h>
  3. #include "vaxconio.h"
  4. #define true (!false)
  5. #define false 0
  6. getch()
  7. {
  8.     return tt_inkey();
  9. }
  10. long coreleft(void)
  11. {
  12.     return 4000000l;
  13. }
  14. strlwr(char *s)
  15. {
  16.     char *ss=s;
  17.     while (*s!=0) {*s = tolower(*s); s++;}
  18.     return ss;
  19. }
  20. char *strupr(char *s)
  21. {
  22.     char *ss=s;
  23.     while (*s!=0) {*s = toupper(*s); s++;}
  24.     return ss;
  25. }
  26. unlink(char *filename)
  27. {
  28.     delete(filename);
  29. }
  30.  
  31. #include <descrip.h>
  32. int find_context;
  33. static char wildstr[200];
  34. static $DESCRIPTOR(str1,"");
  35. static $DESCRIPTOR(str2,"");
  36. static char rfile[200];
  37. findfirst(char *wild, struct ffblk *ffblk, int zz)
  38. {
  39.     int st;
  40.     char *s;
  41.     strcpy(wildstr,wild);
  42.     strcat(wildstr,";");
  43.     str1.dsc$a_pointer = wildstr;  str1.dsc$w_length = strlen(wildstr);
  44.     str2.dsc$a_pointer = &rfile[0];  str2.dsc$w_length = 132;
  45.     st = LIB$FIND_FILE(&str1,&str2,&find_context);
  46.     if ((st & 1) != 1) {
  47.         st = LIB$FIND_FILE_END(&find_context);
  48.         if ((st & 1) != 1) LIB$SIGNAL(st);
  49.         return true;
  50.     }
  51.     ffblk->ff_name = &rfile[0]; rfile[str2.dsc$w_length] = 0;
  52.     s = strchr(ffblk->ff_name,' ');
  53.     *s = 0;
  54.     trim_file(ffblk->ff_name);
  55.     return false;
  56. }
  57. findnext(struct ffblk *ffblk)
  58. {
  59.     int st;
  60.     char *s;
  61.     st = LIB$FIND_FILE(&str1,&str2,&find_context);
  62.     if ((st & 1) != 1) {
  63.         st = LIB$FIND_FILE_END(&find_context);
  64.         if ((st & 1) != 1) LIB$SIGNAL(st);
  65.         return true;
  66.     }
  67.     ffblk->ff_name = &rfile[0]; rfile[str2.dsc$w_length] = 0;
  68.     s = strchr(ffblk->ff_name,' ');
  69.     if (s!=NULL) *s = 0;
  70.     trim_file(ffblk->ff_name);
  71.     return false;
  72. }
  73. trim_file(char *s)
  74. {
  75.     char *t;
  76.     t = strchr(s,']');
  77.     if (t!=NULL) memcpy(s,t+1,strlen(t));
  78.     t = strchr(s,';');
  79.     if (s!=NULL) *t = 0;
  80. }
  81. char *getsymbol(char *sym)
  82. {
  83.     static char mystr[200],*s;
  84.     int r;
  85.     short teklen=80;
  86.     $DESCRIPTOR(symname,sym);
  87.     $DESCRIPTOR(tekval,mystr);
  88.     mystr[0] = 0;
  89.     symname.dsc$w_length = strlen(sym);
  90.     tekval.dsc$w_length = 80;
  91.     r = lib$get_symbol(&symname,&tekval,&teklen,&1);
  92.     mystr[teklen] = 0;
  93. loop1:    s = strchr(mystr,'^');
  94.     if (s!=NULL) {
  95.         *(s+1) = *(s+1) - 64;
  96.         memmove(s,s+1,strlen(s+1)+1);
  97.         goto loop1;
  98.     }
  99.     return mystr;
  100. }
  101.  
  102.  
  103.                                                           
  104.