=================================================================== RCS file: /home/cvs/OpenXM/src/kan96xx/plugin/file2.hh,v retrieving revision 1.1.1.1 retrieving revision 1.5 diff -u -p -r1.1.1.1 -r1.5 --- OpenXM/src/kan96xx/plugin/file2.hh 1999/10/08 02:12:05 1.1.1.1 +++ OpenXM/src/kan96xx/plugin/file2.hh 2003/11/23 13:16:30 1.5 @@ -1,5 +1,7 @@ +/* $OpenXM: OpenXM/src/kan96xx/plugin/file2.hh,v 1.4 2001/08/12 03:13:36 takayama Exp $ */ else if (strcmp(key,"fp2fdopen") == 0) { if (size != 2) errorKan1("%s\n","[(fp2fdopen) obj] extension obj-fp2."); + if (SecureMode) errorKan1("%s\n","Security violation for fp2fdopen."); obj1 = getoa(obj,1); if (obj1.tag != Sinteger) { errorKan1("%s\n","[(fp2fdopen) file-descriptor-integer] extension obj-fp2."); @@ -71,6 +73,7 @@ else if (strcmp(key,"fp2dumpBuffer") == 0) { } else if (strcmp(key,"fp2openForRead") == 0) { if (size != 2) errorKan1("%s\n","[(fp2openForRead) name] extension c."); + if (SecureMode) errorKan1("%s\n","Security violation for fp2openForRead."); obj1= getoa(obj,1); if (obj1.tag != Sdollar) { errorKan1("%s\n","[(fp2openForRead) name-string] extension c."); @@ -79,6 +82,7 @@ else if (strcmp(key,"fp2openForRead") == 0) { } else if (strcmp(key,"fp2openForWrite") == 0) { if (size != 2) errorKan1("%s\n","[(fp2openForWrite) name] extension c."); + if (SecureMode) errorKan1("%s\n","Security violation for fp2openForWrite."); obj1= getoa(obj,1); if (obj1.tag != Sdollar) { errorKan1("%s\n","[(fp2openForWrite) name-string] extension c."); @@ -104,6 +108,45 @@ else if (strcmp(key,"fp2clearReadBuf") == 0) { } rob = KpoInteger(fp2dumpBuffer((FILE2 *) obj1.rc.voidp)); rob = KpoInteger(fp2clearReadBuf((FILE2 *)obj1.rc.voidp)); +} +else if (strcmp(key,"fp2fcloseInString") == 0) { + if (size != 2) errorKan1("%s\n","[(fp2closeInString) obj-fp2] extension s."); + obj1= getoa(obj,1); + if (obj1.tag != Sfile) { + errorKan1("%s\n","[(fp2fcloseInString) obj-fp2] extension s."); + } + if (strcmp(obj1.lc.str,MAGIC2) != 0) { + errorKan1("%s\n","[(fp2fcloseInString) obj-fp2] extension s. obj-fp2 is not Sfile (FILE2)."); + } + { + int mysize; + rob = KpoString(fp2fcloseInString((FILE2 *) obj1.rc.voidp,&mysize)); + } +} +else if (strcmp(key,"fp2pushfile") == 0) { + if (size != 2) errorKan1("%s\n","[(fp2pushfile) name] extension array-of-int."); + if (SecureMode) errorKan1("%s\n","Security violation for fp2pushfile."); + obj1= getoa(obj,1); + if (obj1.tag != Sdollar) { + errorKan1("%s\n","[(fp2pushfile) name] extension array-of-int."); + } + { + FILE *fp; + int n,i,c; + fp = fopen(obj1.lc.str,"r"); + if (fp == NULL) errorKan1("%s\n","fp2pushfile : file not found."); + n = 0; + while ((c = fgetc(fp)) != EOF) n++; + fclose(fp); + fp = fopen(obj1.lc.str,"r"); + rob = newObjectArray(n); + i = 0; + while ((c = fgetc(fp)) != EOF) { + putoa(rob,i,KpoInteger(c)); + i++; + } + fclose(fp); + } }