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

Diff for /OpenXM_contrib2/asir2000/builtin/file.c between version 1.12 and 1.13

version 1.12, 2000/12/06 00:54:09 version 1.13, 2001/03/21 23:49:34
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/builtin/file.c,v 1.11 2000/12/05 01:24:50 noro Exp $   * $OpenXM: OpenXM_contrib2/asir2000/builtin/file.c,v 1.12 2000/12/06 00:54:09 noro Exp $
 */  */
 #include "ca.h"  #include "ca.h"
 #include "parse.h"  #include "parse.h"
Line 71  void Pload(), Pwhich(), Ploadfiles(), Poutput();
Line 71  void Pload(), Pwhich(), Ploadfiles(), Poutput();
 void Pbsave(), Pbload(), Pbload27();  void Pbsave(), Pbload(), Pbload27();
 void Pbsave_compat(), Pbload_compat();  void Pbsave_compat(), Pbload_compat();
 void Pbsave_cmo(), Pbload_cmo();  void Pbsave_cmo(), Pbload_cmo();
 void Popen_file(), Pclose_file(), Pget_line(), Pget_byte();  void Popen_file(), Pclose_file(), Pget_line(), Pget_byte(), Pput_byte();
 void Ppurge_stdin();  void Ppurge_stdin();
   
 extern int des_encryption;  extern int des_encryption;
Line 79  extern char *asir_libdir;
Line 79  extern char *asir_libdir;
   
 struct ftab file_tab[] = {  struct ftab file_tab[] = {
         {"purge_stdin",Ppurge_stdin,0},          {"purge_stdin",Ppurge_stdin,0},
         {"open_file",Popen_file,1},          {"open_file",Popen_file,-2},
         {"close_file",Pclose_file,1},          {"close_file",Pclose_file,1},
         {"get_byte",Pget_byte,1},          {"get_byte",Pget_byte,1},
           {"put_byte",Pput_byte,2},
         {"get_line",Pget_line,-1},          {"get_line",Pget_line,-1},
         {"remove_file",Premove_file,1},          {"remove_file",Premove_file,1},
         {"access",Paccess,1},          {"access",Paccess,1},
Line 127  Q *rp;
Line 128  Q *rp;
         if ( i == BUFSIZ )          if ( i == BUFSIZ )
                 error("open_file : too many open files");                  error("open_file : too many open files");
         name = BDY((STRING)ARG0(arg));          name = BDY((STRING)ARG0(arg));
         fp = fopen(name,"r");          if ( argc(arg) == 2 ) {
                   asir_assert(ARG1(arg),O_STR,"open_file");
                   fp = fopen(name,BDY((STRING)ARG1(arg)));
           } else
                   fp = fopen(name,"r");
         if ( !fp ) {          if ( !fp ) {
                 sprintf(errbuf,"open_file : \"%s\" not found",name);                  sprintf(errbuf,"open_file : cannot open \"%s\"",name);
                 error(errbuf);                  error(errbuf);
         }          }
         file_ptrs[i] = fp;          file_ptrs[i] = fp;
Line 223  Q *rp;
Line 228  Q *rp;
                 STOQ(c,*rp);                  STOQ(c,*rp);
         } else          } else
                 error("get_byte : invalid argument");                  error("get_byte : invalid argument");
   }
   
   void Pput_byte(arg,rp)
   NODE arg;
   Q *rp;
   {
           int i,c;
           FILE *fp;
   
           asir_assert(ARG0(arg),O_N,"put_byte");
           asir_assert(ARG1(arg),O_N,"put_byte");
           i = QTOS((Q)ARG0(arg));
           c = QTOS((Q)ARG1(arg));
           if ( fp = file_ptrs[i] ) {
                   putc(c,fp);
                   STOQ(c,*rp);
           } else
                   error("put_byte : invalid argument");
 }  }
   
 void Pload(arg,rp)  void Pload(arg,rp)

Legend:
Removed from v.1.12  
changed lines
  Added in v.1.13

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