Author: kjs
Date: Thu Apr 12 04:01:32 2007
New Revision: 18164

Modified:
   trunk/compilers/pirc/src/pirlexer.c
   trunk/compilers/pirc/src/pirutil.c
   trunk/compilers/pirc/src/pirutil.h

Log:
compilers/pirc:
* lexer now uses utility function to open file.out
* changed parameters to open_file to const char *.

Modified: trunk/compilers/pirc/src/pirlexer.c
==============================================================================
--- trunk/compilers/pirc/src/pirlexer.c (original)
+++ trunk/compilers/pirc/src/pirlexer.c Thu Apr 12 04:01:32 2007
@@ -620,12 +620,7 @@
     filebuff->filename = clone_string(filename);
     /*fprintf(stderr, "Opening file '%s'\n", filebuff->filename); */
 
-    fileptr = fopen(filename, "r");
-
-    if (fileptr == NULL) {
-        fprintf(stderr, "Error in read_file(): failed to open file '%s'\n", 
filename);
-        exit(1);
-    }
+    fileptr = open_file(filename, "r");
 
     /* allocate memory for this file. Reserve 1 more byte to store the EOF 
marker */
     stat(filename, &filestatus);

Modified: trunk/compilers/pirc/src/pirutil.c
==============================================================================
--- trunk/compilers/pirc/src/pirutil.c  (original)
+++ trunk/compilers/pirc/src/pirutil.c  Thu Apr 12 04:01:32 2007
@@ -56,7 +56,7 @@
 
 */
 FILE *
-open_file(char *filename, char *mode) {
+open_file(char const *filename, char const *mode) {
     FILE *file = fopen(filename, mode);
 
     if (file == NULL) {

Modified: trunk/compilers/pirc/src/pirutil.h
==============================================================================
--- trunk/compilers/pirc/src/pirutil.h  (original)
+++ trunk/compilers/pirc/src/pirutil.h  Thu Apr 12 04:01:32 2007
@@ -20,7 +20,7 @@
 
 extern int is_op(char *id);
 
-extern FILE *open_file(char *filename, char *mode);
+extern FILE *open_file(char const *filename, char const *mode);
 
 
 /* where do we leave the flags?

Reply via email to