[BACK]Return to load.c CVS log [TXT][DIR] Up to [local] / OpenXM_contrib2 / asir2000 / parse

Diff for /OpenXM_contrib2/asir2000/parse/load.c between version 1.4 and 1.33

version 1.4, 2000/08/22 05:04:27 version 1.33, 2018/03/29 01:32:54
Line 45 
Line 45 
  * DEVELOPER SHALL HAVE NO LIABILITY IN CONNECTION WITH THE USE,   * DEVELOPER SHALL HAVE NO LIABILITY IN CONNECTION WITH THE USE,
  * PERFORMANCE OR NON-PERFORMANCE OF THE SOFTWARE.   * PERFORMANCE OR NON-PERFORMANCE OF THE SOFTWARE.
  *   *
  * $OpenXM: OpenXM_contrib2/asir2000/parse/load.c,v 1.3 2000/08/21 08:31:47 noro Exp $   * $OpenXM: OpenXM_contrib2/asir2000/parse/load.c,v 1.32 2017/02/07 08:30:31 noro Exp $
 */  */
 #include "ca.h"  #include "ca.h"
 #include "parse.h"  #include "parse.h"
 #if defined(THINK_C)  
   #if defined(VISUAL) || defined(__MINGW32__)
 #include <string.h>  #include <string.h>
 #include        <StandardFile.h>  
 #include        <Windows.h>  
 #include        <OSUtils.h>  
 #include        <ToolUtils.h>  
 #else  
 #if defined(VISUAL)  
 #include <string.h>  
 #include <fcntl.h>  #include <fcntl.h>
 #if defined(GO32)  
 #include <unistd.h>  
 #endif  
 #include <sys/stat.h>  #include <sys/stat.h>
 #else  #else /* VISUAL */
 #if defined(_PA_RISC1_1) || defined(SYSV) || defined(__SVR4)  #if defined(_PA_RISC1_1) || defined(SYSV) || defined(__SVR4)
 #include <unistd.h>  #include <unistd.h>
 #include <string.h>  #include <string.h>
Line 74 
Line 65 
 #include <sys/file.h>  #include <sys/file.h>
 #include <sys/stat.h>  #include <sys/stat.h>
 #endif  #endif
 #endif  
   
 #if defined(linux)  #if defined(linux)
 #include <unistd.h>  #include <unistd.h>
 #endif  #endif
   
 #if defined(VISUAL)  #if defined(VISUAL) || defined(__MINGW32__)
 #include <io.h>  #include <io.h>
 #endif  #endif
   
   #ifdef MALLOC
 #undef MALLOC  #undef MALLOC
 #define MALLOC(x) GC_malloc((x)+4)  #define MALLOC(x) Risa_GC_malloc((x)+4)
   
 char *ASIRLOADPATH[32];  
   
 void encrypt_file(char *,char *);  
 void decrypt_file(char *,char *);  
   
 #if defined(THINK_C)  
 void searchasirpath(char *,char **);  
 void loadasirfile(char *);  
   
 short initvol;  
   
 void initVol();  
 short getVol();  
 void setDir(short);  
 void resetDir();  
   
 void initVol() {  
         char buf[BUFSIZ];  
   
         GetVol((StringPtr)buf,&initvol);  
 }  
   
 short getVol() {  
         short vol;  
         char buf[BUFSIZ];  
   
         GetVol((StringPtr)buf,&vol);  
         return vol;  
 }  
   
 void setDir(short vol)  
 {  
         SetVol(0,vol);  
 }  
   
 void resetDir() {  
         SetVol(0,initvol);  
 }  
 #endif  #endif
   
 #if defined(VISUAL)  char **ASIRLOADPATH;
   int ASIRLOADPATH_LEN;
   
   #if defined(VISUAL) || defined(__MINGW32__)
 #define ENVDELIM ';'  #define ENVDELIM ';'
 #define MORE "more < "  #define MORE "more < "
 #else  #else
Line 136  void resetDir() {
Line 91  void resetDir() {
 #endif  #endif
   
 #ifndef ASIR_LIBDIR  #ifndef ASIR_LIBDIR
 #define ASIR_LIBDIR "."  #define ASIR_LIBDIR "/usr/local/lib/asir"
 #endif  #endif
   #ifndef ASIR_CONTRIB_DIR
   #define ASIR_CONTRIB_DIR "/usr/local/lib/asir-contrib"
   #endif
   
 char *getenv();  char *getenv();
   void Pget_rootdir();
   char *search_executable(char *name);
   
 extern char *asir_libdir;  extern char *asir_libdir;
   extern char *asir_contrib_dir;
   extern char *asir_private_dir;
 extern char *asir_pager;  extern char *asir_pager;
 extern int read_exec_file;  
 extern int main_parser;  extern int main_parser;
   extern JMP_BUF exec_env;
   
 void env_init() {  char *search_executable(char *name)
         char *e,*p,*q;  {
         int i,l;    char *c,*s,*ret;
         char *getenv();    int len,nlen;
         char *oxhome;    char dir[BUFSIZ],path[BUFSIZ];
         char rootname[BUFSIZ];    struct stat buf;
   
         if ( !(asir_libdir = getenv("ASIR_LIBDIR")) ) {    nlen = strlen(name);
                 if ( oxhome = getenv("OpenXM_HOME") ) {    for ( s = (char *)getenv("PATH"); s; ) {
                         asir_libdir = (char *)malloc(strlen(oxhome)+strlen("/lib/asir")+1);      c = (char *)index(s,':');
                         sprintf(asir_libdir,"%s/lib/asir",oxhome);      len = c ? c-s : strlen(s);
                 } else {      if ( len >= BUFSIZ ) continue;
 #if defined(VISUAL)      strncpy(dir,s,len); dir[len] = 0;
                         get_rootdir(rootname,sizeof(rootname));      if ( c ) s = c+1;
                         asir_libdir = (char *)malloc(strlen(rootname)+strlen("/lib")+1);      else s = 0;
                         sprintf(asir_libdir,"%s/lib",rootname);      if ( len+nlen+1 >= BUFSIZ ) continue;
 #else      sprintf(path,"%s/%s",dir,name);
                         asir_libdir = (char *)malloc(strlen(ASIR_LIBDIR)+1);      if ( !stat(path,&buf) && !(buf.st_mode & S_IFDIR)
                         strcpy(asir_libdir,ASIR_LIBDIR);  #if !defined(VISUAL) && !defined(__MINGW32__)
         && !access(path,X_OK)
 #endif  #endif
                 }                  ) {
         }        len = strlen(path)+1;
         if ( !(asir_pager = getenv("PAGER")) ) {        ret = (char *)MALLOC(len);
                 asir_pager = (char *)malloc(strlen(MORE)+1);        strcpy(ret,path);
                 strcpy(asir_pager,MORE);        return ret;
         }      }
         if ( e = getenv("ASIRLOADPATH" ) )    }
                 for ( i = 0; ; i++, e = p+1 ) {    return 0;
                         p = (char *)index(e,ENVDELIM);  
                         l = p ? p-e : strlen(e); q = (char *)MALLOC(l+1);  
                         if ( l ) {  
                                 strncpy(q,e,l); q[l] = 0; ASIRLOADPATH[i] = q;  
                         }  
                         if ( !p )  
                                 break;  
                 }  
         for ( i = 0; ASIRLOADPATH[i]; i++ );  
         ASIRLOADPATH[i] = asir_libdir;  
 }  }
   
 void searchasirpath(name,pathp)  void env_init() {
 char *name;    char *e,*p,*q;
 char **pathp;    int i,l,japanese;
 {    char *getenv();
         char **p;    char *oxhome;
         char *q;    char rootname[BUFSIZ];
         int l;      size_t len;
 #if !defined(THINK_C) && !defined(VISUAL)  
         struct stat sbuf;    if ( oxhome = getenv("OpenXM_HOME") ) {
       len = strlen(oxhome);
         if ( (name[0] == '/') || ( name[0] == '.') || strchr(name,':')    }else {
                 || !ASIRLOADPATH[0] ) {  #if defined(VISUAL) || defined(__MINGW32__)
                 if ( access(name,R_OK) >= 0 ) {      get_rootdir(rootname,sizeof(rootname));
                         stat(name,&sbuf);      len = strlen(rootname);
                         if ( (sbuf.st_mode & S_IFMT) != S_IFDIR )      oxhome = rootname;
                                 *pathp = name;  
                         else  
                                 *pathp = 0;  
                 } else  
                         *pathp = 0;  
         } else {  
                 for ( p = ASIRLOADPATH; *p; p++ ) {  
                         l = strlen(*p)+strlen(name)+2;  
                         q = (char *)ALLOCA(l); sprintf(q,"%s/%s",*p,name);  
                         if ( access(q,R_OK) >= 0 ) {  
                                 stat(q,&sbuf);  
                                 if ( (sbuf.st_mode & S_IFMT) != S_IFDIR ) {  
                                         *pathp = (char *)MALLOC(l); strcpy(*pathp,q);  
                                         return;  
                                 }  
                         }  
                 }  
                 *pathp = 0;  
         }  
 #elif defined(VISUAL)  
         if ( (name[0] == '/') || ( name[0] == '.') || strchr(name,':')  
                 || !ASIRLOADPATH[0] )  
                 *pathp = name;  
         else {  
                 for ( p = ASIRLOADPATH; *p; p++ ) {  
                         l = strlen(*p)+strlen(name)+2;  
                         q = (char *)ALLOCA(l); sprintf(q,"%s/%s",*p,name);  
                         if ( access(q,04) >= 0 ) {  
                                 *pathp = (char *)MALLOC(l); strcpy(*pathp,q);  
                                 return;  
                         }  
                 }  
                 *pathp = 0;  
         }  
 #else  
         if ( (name[0] == '/') || ( name[0] == '.') || !ASIRLOADPATH[0] )  
                 *pathp = name;  
         else {  
                 for ( p = ASIRLOADPATH; *p; p++ ) {  
                         l = strlen(*p)+strlen(name)+2;  
                         q = (char *)ALLOCA(l); sprintf(q,"%s/%s",*p,name);  
                         *pathp = (char *)MALLOC(l); strcpy(*pathp,q);  
                         return;  
                 }  
                 *pathp = 0;  
         }  
 #endif  #endif
     }
   
     if ( !(asir_libdir = getenv("ASIR_LIBDIR")) ) {
       if ( oxhome ) {
         asir_libdir = (char *)malloc(len+strlen("/lib/asir")+1);
         sprintf(asir_libdir,"%s/lib/asir",oxhome);
       } else {
         asir_libdir = (char *)malloc(strlen(ASIR_LIBDIR)+1);
         strcpy(asir_libdir,ASIR_LIBDIR);
       }
     }
   
     if ( !(asir_contrib_dir = getenv("ASIR_CONTRIB_DIR")) ) {
       if ( oxhome ) {
         asir_contrib_dir = (char *)malloc(len+strlen("/lib/asir-contrib")+1);
         sprintf(asir_contrib_dir,"%s/lib/asir-contrib",oxhome);
       } else {
         asir_contrib_dir = (char *)malloc(strlen(ASIR_CONTRIB_DIR)+1);
         strcpy(asir_contrib_dir,ASIR_CONTRIB_DIR);
       }
     }
   
       asir_private_dir = NULL;
   #if defined(VISUAL) || defined(__MINGW32__)
       if ( e = getenv("APPDATA") ) {
           asir_private_dir = (char *)malloc(strlen(e)+strlen("/OpenXM/lib/asir-contrib")+1);
           sprintf(asir_private_dir,"%s/OpenXM/lib/asir-contrib",e);
       }
   #endif
   
     if ( !(asir_pager = getenv("PAGER")) ) {
   #if 0
       japanese = 0;
       if ( (e = getenv("LANGUAGE")) &&
         (!strncmp(e,"japan",5) || !strncmp(e,"ja_JP",5)) ) japanese = 1;
       else if ( (e = getenv("LC_ALL")) &&
         (!strncmp(e,"japan",5) || !strncmp(e,"ja_JP",5)) ) japanese = 1;
       else if ( (e = getenv("LC_CTYPE")) &&
         (!strncmp(e,"japan",5) || !strncmp(e,"ja_JP",5)) ) japanese = 1;
       else if ( (e = getenv("LANG")) &&
         (!strncmp(e,"japan",5) || !strncmp(e,"ja_JP",5)) ) japanese = 1;
       if ( japanese )
         asir_pager = search_executable("jless");
   #endif
       asir_pager = search_executable("less");
       if ( !asir_pager ) {
         /* default: more */
         asir_pager = (char *)malloc(strlen(MORE)+1);
         strcpy(asir_pager,MORE);
       }
     }
     if ( e = getenv("ASIRLOADPATH" ) ) {
       for ( i = 0; ; i++, e = p+1 ) {
         p = (char *)index(e,ENVDELIM);
         if ( !p )
           break;
       }
       i += 5;
       ASIRLOADPATH_LEN=i;
           ASIRLOADPATH=(char **)MALLOC(sizeof(char *)*i);
       for ( l = 0; l<i; l++) ASIRLOADPATH[l] = NULL;
       e = getenv("ASIRLOADPATH");
       for ( i = 0; ; i++, e = p+1 ) {
         p = (char *)index(e,ENVDELIM);
         l = p ? p-e : strlen(e); q = (char *)MALLOC(l+1);
         if ( l ) {
           strncpy(q,e,l); q[l] = 0; ASIRLOADPATH[i] = q;
         }
         if ( !p )
           break;
       }
       }else{
       ASIRLOADPATH=(char **)MALLOC(sizeof(char *)*3);
       ASIRLOADPATH[0] = NULL;
     }
   
     for ( i = 0; ASIRLOADPATH[i]; i++ );
     if (asir_private_dir) ASIRLOADPATH[i++] = asir_private_dir;
     if (asir_contrib_dir) ASIRLOADPATH[i++] = asir_contrib_dir;
     if (asir_libdir) ASIRLOADPATH[i++] = asir_libdir;
     ASIRLOADPATH[i++] = ".";
     ASIRLOADPATH[i] = NULL;
 }  }
   
 #if defined(THINK_C)  #if defined(VISUAL) || defined(__MINGW32__)
 #define DELIM ':'  #define R_OK 4
 #elif defined(VISUAL)  
 #define DELIM '/'  
 #endif  #endif
   
 void Eungetc(int,FILE *);  void searchasirpath(char *name,char **pathp)
   {
     char **p;
     char *q;
     size_t l;
     int ret;
     struct stat sbuf;
   
     if ( (name[0] == '/') || ( name[0] == '.') || strchr(name,':')
       || !ASIRLOADPATH[0] ) {
       if ( access(name,R_OK) >= 0 ) {
         ret = stat(name,&sbuf);
         if ( ret == 0 && (sbuf.st_mode & S_IFMT) != S_IFDIR )
           *pathp = name;
         else
           *pathp = 0;
       } else
         *pathp = 0;
     } else {
       for ( p = ASIRLOADPATH; *p; p++ ) {
         l = strlen(*p)+strlen(name)+2;
         q = (char *)ALLOCA(l); sprintf(q,"%s/%s",*p,name);
         if ( access(q,R_OK) >= 0 ) {
           ret = stat(q,&sbuf);
           if ( ret == 0 && (sbuf.st_mode & S_IFMT) != S_IFDIR ) {
             *pathp = (char *)MALLOC(l); strcpy(*pathp,q);
             return;
           }
         }
       }
       *pathp = 0;
     }
   }
   
 void loadasirfile(name0)  #define DELIM '/'
 char *name0;  
   void loadasirfile(char *name0)
 {  {
         FILE *in;    FILE *in;
         IN t;    INFILE t;
         extern char cppname[];    extern char cppname[];
 #if defined(THINK_C) || defined(VISUAL)  #if defined(VISUAL) || defined(__MINGW32__)
         char tname[BUFSIZ],dname[BUFSIZ],ibuf1[BUFSIZ],ibuf2[BUFSIZ];    char ibuf1[BUFSIZ],ibuf2[BUFSIZ];
         int ac;    int ac;
 #if defined(__MWERKS__)    char *av[BUFSIZ];
         char *av[64];    char *p;
 #else    FILE *fp;
         char *av[BUFSIZ];    char dname[BUFSIZ],tname0[BUFSIZ];
 #endif    char *name,*tname;
         char *p,*c;    int encoded;
         FILE *fp;    static char prefix[BUFSIZ];
         char name[BUFSIZ],tname0[BUFSIZ];    int process_id();
         int encoded;    char CppExe[BUFSIZ];
     char nbuf[BUFSIZ],tnbuf[BUFSIZ];
     STRING rootdir;
     void call_exe(char *,char **);
   
 #if defined(VISUAL)    /* create the unique prefix */
         fp = fopen(name0,"rb");    if ( !prefix[0] )
         if ( getc(fp) == 0xff ) {      sprintf(prefix,"asir%d",process_id());
                 /* encoded file */  
                 fclose(fp);  
                 sprintf(name,"%s.$$$",name0);  
                 decrypt_file(name0,name);  
                 encoded = 1;  
         } else {  
                 fclose(fp);  
                 strcpy(name,name0);  
                 encoded = 0;  
         }  
 #else  
         strcpy(name,name0);  
 #endif  
   
         strcpy(dname,name);    fp = fopen(name0,"rb");
         p = strrchr(dname,DELIM);    if ( getc(fp) == 0xff ) {
         av[0] = "cpp"; av[1] = name; av[2] = tname;      /* encoded file */
         sprintf(ibuf1,"-I%s",asir_libdir); av[3] = ibuf1; av[4] = "-DWINDOWS";      fclose(fp);
         if ( !p ) {      name = tempnam(NULL,prefix);
                 sprintf(tname,"%s.___",name); av[5] = 0; ac = 5;      decrypt_file(name0,name);
         } else {      /* the file 'name' created */
                 *p++ = 0;      encoded = 1;
 #if defined(VISUAL)    } else {
                 if ( c = strchr(dname,':') ) {      fclose(fp);
                         *c = 0;      name = name0;
                         sprintf(tname,"%s:%s%c%s.___",dname,c+1,DELIM,p);      encoded = 0;
                         *c = ':';    }
                 } else  
     strcpy(dname,name);
 #endif    av[0] = "cpp";
                 sprintf(tname,"%s%c%s.___",dname,DELIM,p);    sprintf(nbuf,"\"%s\"",name);
                 sprintf(ibuf2,"-I%s",dname); av[5] = ibuf2; av[6] = 0; ac = 6;    av[1] = nbuf;
         }    tname = tempnam(NULL,prefix);
         cpp_main(ac,av);    sprintf(tnbuf,"\"%s\"",tname);
         if ( encoded ) {    av[2] = tnbuf;
                 unlink(name);    sprintf(ibuf1,"-I\"%s\"",asir_libdir);
                 strcpy(tname0,tname);    av[3] = ibuf1;
                 sprintf(tname,"%s.###",tname0);    av[4] = "-DWINDOWS";
                 encrypt_file(tname0,tname);  
                 unlink(tname0);    /* set the include directory */
                 in = fopen(tname,"rb");    p = strrchr(dname,DELIM);
         } else    if ( !p ) {
                 in = fopen(tname,"r");      av[5] = 0; ac = 5;
         if ( !in ) {    } else {
                 perror("fopen");      *p = 0;
                 error("load : failed");      sprintf(ibuf2,"-I\"%s\"",dname);
         }      av[5] = ibuf2;
         t = (IN)MALLOC(sizeof(struct oIN));      av[6] = 0; ac = 6;
         t->name = (char *)MALLOC(strlen(name)+1); strcpy(t->name,name);    }
         t->tname = (char *)MALLOC(strlen(tname)+1); strcpy(t->tname,tname);  //  cpp_main(ac,av);
         t->encoded = encoded;    Pget_rootdir(&rootdir);
 #if defined(THINK_C)    sprintf(CppExe,"%s\\bin\\cpp.exe",BDY(rootdir));
         t->vol = getVol();    call_exe(CppExe,av);
 #endif  
     /* the file tname created */
     if ( encoded ) {
       unlink(name); free(name);
   
       strcpy(tname0,tname); free(tname);
       tname = tempnam(NULL,prefix);
   
       encrypt_file(tname0,tname);
       /* the file tname created */
       unlink(tname0);
   
       in = fopen(tname,"rb");
     } else
       in = fopen(tname,"r");
     if ( !in ) {
       perror("fopen");
       error("load : failed");
     }
     t = (INFILE)MALLOC(sizeof(struct oINFILE));
     t->name = (char *)MALLOC(strlen(name0)+1); strcpy(t->name,name0);
     t->tname = (char *)MALLOC(strlen(tname)+1); strcpy(t->tname,tname); free(tname);
     t->encoded = encoded;
 #else  #else
         char com[BUFSIZ];    char com[BUFSIZ];
   
         sprintf(com,"%s -I%s %s",cppname,asir_libdir,name0); in = popen(com,"r");    sprintf(com,"%s -I%s -D__FILE__=%s %s",cppname,asir_libdir,name0,name0); in = popen(com,"r");
         if ( !in ) {    if ( !in ) {
                 perror("popen");      perror("popen");
                 error("load : failed");      error("load : failed");
         }    }
         t = (IN)MALLOC(sizeof(struct oIN));    t = (INFILE)MALLOC(sizeof(struct oINFILE));
         t->name = (char *)MALLOC(strlen(name0)+1); strcpy(t->name,name0);    t->name = (char *)MALLOC(strlen(name0)+1); strcpy(t->name,name0);
 #endif  #endif
         t->fp = in; t->ln = 1; t->next = asir_infile; asir_infile = t;    t->fp = in; t->ln = 1; t->next = asir_infile; asir_infile = t;
         main_parser = 1; /* XXX */    main_parser = 1; /* XXX */
         Eungetc(afternl(),asir_infile->fp);    Eungetc(afternl(),asir_infile->fp);
         if ( !EPVS->va )    if ( !EPVS->va )
                 reallocarray((char **)&EPVS->va,(int *)&EPVS->asize,(int *)&EPVS->n,(int)sizeof(struct oPV));      asir_reallocarray((char **)&EPVS->va,(int *)&EPVS->asize,(int *)&EPVS->n,(int)sizeof(struct oPV));
 }  }
   
 void execasirfile(name)  void execasirfile(char *name)
 char *name;  
 {  {
         loadasirfile(name);    loadasirfile(name);
         read_exec_file = 1;    if ( !SETJMP(asir_infile->jmpbuf) ) {
         read_eval_loop();      asir_infile->ready_for_longjmp = 1;
         read_exec_file = 0;      read_eval_loop();
     }
     closecurrentinput();
 }  }
   
 static NODE objfile = 0;  static NODE objfile = 0;
   
 int loadfile(s)  int loadfile(char *s)
 char *s;  
 {  {
         FILE *in;    FILE *in;
   
         if ( in = fopen(s,"r") ) {    if ( in = fopen(s,"r") ) {
                 fclose(in);      fclose(in);
                 loadasirfile(s);      loadasirfile(s);
                 return 1;      return 1;
         } else    } else
                 return 0;      return 0;
 }  }
   
 int loadfiles(node) NODE node; { return 0; }  int loadfiles(NODE node) { return 0; }
   
 static unsigned char encrypt_tab[128][2] = {  static unsigned char encrypt_tab[128][2] = {
 {137,40},{1,194},{133,79},{48,20},{254,76},{98,17},{110,233},{19,231},  {137,40},{1,194},{133,79},{48,20},{254,76},{98,17},{110,233},{19,231},
Line 417  static unsigned char decrypt_tab[] = {
Line 450  static unsigned char decrypt_tab[] = {
   
 unsigned char encrypt_char(unsigned char c)  unsigned char encrypt_char(unsigned char c)
 {  {
         return encrypt_tab[c][mt_genrand()&1];    return encrypt_tab[c][mt_genrand()&1];
 }  }
   
 unsigned char decrypt_char(unsigned char c)  unsigned char decrypt_char(unsigned char c)
 {  {
         return decrypt_tab[c];    return decrypt_tab[c];
 }  }
   
 void encrypt_file(in,out)  void encrypt_file(char *in,char *out)
 char *in,*out;  
 {  {
         FILE *infp,*outfp;    FILE *infp,*outfp;
         int c;    int c;
   
         infp = fopen(in,"r");    infp = fopen(in,"r");
         outfp = fopen(out,"wb");    outfp = fopen(out,"wb");
         while ( 1 ) {    while ( 1 ) {
                 c = getc(infp);      c = getc(infp);
                 if ( c == EOF )      if ( c == EOF )
                         break;        break;
                 putc(encrypt_char(c),outfp);      putc(encrypt_char((unsigned char)c),outfp);
         }    }
         fclose(infp); fclose(outfp);    fclose(infp); fclose(outfp);
 }  }
   
 void decrypt_file(in,out)  void decrypt_file(char *in,char *out)
 char *in,*out;  
 {  {
         FILE *infp,*outfp;    FILE *infp,*outfp;
         int c;    int c;
   
         infp = fopen(in,"rb");    infp = fopen(in,"rb");
         outfp = fopen(out,"w");    outfp = fopen(out,"w");
         /* skip the magic number (=0xff) */    /* skip the magic number (=0xff) */
         getc(infp);    getc(infp);
         while ( 1 ) {    while ( 1 ) {
                 c = getc(infp);      c = getc(infp);
                 if ( c == EOF )      if ( c == EOF )
                         break;        break;
                 putc(decrypt_char(c),outfp);      putc(decrypt_char((unsigned char)c),outfp);
         }    }
         fclose(infp); fclose(outfp);    fclose(infp); fclose(outfp);
 }  }

Legend:
Removed from v.1.4  
changed lines
  Added in v.1.33

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>