From bed81d66d3941d12addffa6990e7d449a075932e Mon Sep 17 00:00:00 2001 From: William S Fulton Date: Thu, 8 Sep 2005 22:31:21 +0000 Subject: [PATCH] Better error message displayed when file cannot be opened git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@7416 626c5289-ae23-0410-ae9c-e8d60b6d4f22 --- Source/DOH/doh.h | 3 +++ Source/DOH/file.c | 14 ++++++++++++++ Source/Modules/allegrocl.cxx | 4 ++-- Source/Modules/chicken.cxx | 4 ++-- Source/Modules/clisp.cxx | 2 +- Source/Modules/csharp.cxx | 12 ++++++------ Source/Modules/guile.cxx | 10 +++++++--- Source/Modules/java.cxx | 16 ++++++++-------- Source/Modules/lua.cxx | 2 +- Source/Modules/main.cxx | 14 +++++++++++--- Source/Modules/modula3.cxx | 12 ++++++++---- Source/Modules/mzscheme.cxx | 2 +- Source/Modules/ocaml.cxx | 6 +++--- Source/Modules/perl5.cxx | 4 ++-- Source/Modules/php4.cxx | 12 ++++++------ Source/Modules/pike.cxx | 2 +- Source/Modules/python.cxx | 6 +++--- Source/Modules/ruby.cxx | 4 ++-- Source/Modules/s-exp.cxx | 2 +- Source/Modules/tcl8.cxx | 4 ++-- Source/Modules/uffi.cxx | 4 ++-- Source/Modules/xml.cxx | 6 +++--- 22 files changed, 89 insertions(+), 56 deletions(-) diff --git a/Source/DOH/doh.h b/Source/DOH/doh.h index 96ed12667..15c2f9486 100644 --- a/Source/DOH/doh.h +++ b/Source/DOH/doh.h @@ -93,6 +93,7 @@ #define DohNewFile DOH_NAMESPACE(NewFile) #define DohNewFileFromFile DOH_NAMESPACE(NewFileFromFile) #define DohNewFileFromFd DOH_NAMESPACE(NewFileFromFd) +#define DohFileErrorDisplay DOH_NAMESPACE(FileErrorDisplay) #define DohClose DOH_NAMESPACE(Close) #define DohCopyto DOH_NAMESPACE(Copyto) #define DohNewList DOH_NAMESPACE(NewList) @@ -283,6 +284,7 @@ extern char *DohStrchr(const DOHString_or_char *s1, int ch); extern DOHFile *DohNewFile(DOH *file, const char *mode); extern DOHFile *DohNewFileFromFile(FILE *f); extern DOHFile *DohNewFileFromFd(int fd); +extern void DohFileErrorDisplay(DOHString *filename); extern int DohClose(DOH *file); extern int DohCopyto(DOHFile *input, DOHFile *output); @@ -372,6 +374,7 @@ extern void DohMemoryDebug(void); #define NewFile DohNewFile #define NewFileFromFile DohNewFileFromFile #define NewFileFromFd DohNewFileFromFd +#define FileErrorDisplay DohFileErrorDisplay #define Close DohClose #define NewVoid DohNewVoid #define Keys DohKeys diff --git a/Source/DOH/file.c b/Source/DOH/file.c index 11b8911aa..69cb2aa97 100644 --- a/Source/DOH/file.c +++ b/Source/DOH/file.c @@ -17,6 +17,7 @@ char cvsroot_file_c[] = "$Header$"; #ifdef DOH_INTFILE #include #endif +#include typedef struct { FILE *filep; @@ -291,3 +292,16 @@ DohNewFileFromFd(int fd) f->closeondel = 0; return DohObjMalloc(&DohFileType,f); } + +/* ----------------------------------------------------------------------------- + * FileErrorDisplay() + * + * Display cause of one the NewFile functions failing. + * ----------------------------------------------------------------------------- */ + +void +DohFileErrorDisplay(DOHString *filename) +{ + Printf(stderr, "Unable to open file %s: %s\n", filename, strerror(errno)); +} + diff --git a/Source/Modules/allegrocl.cxx b/Source/Modules/allegrocl.cxx index dea66eab4..c68a44049 100644 --- a/Source/Modules/allegrocl.cxx +++ b/Source/Modules/allegrocl.cxx @@ -255,7 +255,7 @@ int ALLEGROCL :: top(Node *n) { f_null=NewFile(devnull, "w+"); if (!f_null) { - perror("Failed to open /dev/null"); + FileErrorDisplay(devnull); SWIG_exit(EXIT_FAILURE); } Delete(devnull); @@ -266,7 +266,7 @@ int ALLEGROCL :: top(Node *n) { f_cl=NewFile(output_filename, "w"); if (!f_cl) { - Printf(stderr, "Unable to open %s for writing\n", output_filename); + FileErrorDisplay(output_filename); SWIG_exit(EXIT_FAILURE); } diff --git a/Source/Modules/chicken.cxx b/Source/Modules/chicken.cxx index eb2243cc7..2735e6058 100644 --- a/Source/Modules/chicken.cxx +++ b/Source/Modules/chicken.cxx @@ -207,7 +207,7 @@ CHICKEN::top(Node *n) f_runtime = NewFile(outfile,"w"); if (!f_runtime) { - Printf(stderr,"*** Can't open '%s'\n", outfile); + FileErrorDisplay(outfile); SWIG_exit(EXIT_FAILURE); } f_init = NewString(""); @@ -268,7 +268,7 @@ CHICKEN::top(Node *n) Printf(chicken_filename,"%s%s.scm", SWIG_output_directory(), module); if ((f_scm = NewFile(chicken_filename,"w")) == 0) { - Printf(stderr,"Unable to open %s\n", chicken_filename); + FileErrorDisplay(chicken_filename); SWIG_exit(EXIT_FAILURE); } diff --git a/Source/Modules/clisp.cxx b/Source/Modules/clisp.cxx index 24d4a4c98..b70a6aeeb 100644 --- a/Source/Modules/clisp.cxx +++ b/Source/Modules/clisp.cxx @@ -86,7 +86,7 @@ int CLISP :: top(Node *n) { f_cl=NewFile(output_filename, "w+"); if (!f_cl) { - Printf(stderr, "Unable to open %s for writing\n", output_filename); + FileErrorDisplay(output_filename); SWIG_exit(EXIT_FAILURE); } diff --git a/Source/Modules/csharp.cxx b/Source/Modules/csharp.cxx index e7238ebff..4fdd64988 100644 --- a/Source/Modules/csharp.cxx +++ b/Source/Modules/csharp.cxx @@ -210,7 +210,7 @@ class CSHARP : public Language { f_runtime = NewFile(outfile,"w"); if (!f_runtime) { - Printf(stderr,"Unable to open %s\n", outfile); + FileErrorDisplay(outfile); SWIG_exit(EXIT_FAILURE); } f_init = NewString(""); @@ -280,7 +280,7 @@ class CSHARP : public Language { String *filen = NewStringf("%s%s.cs", SWIG_output_directory(), imclass_name); File *f_im = NewFile(filen,"w"); if(!f_im) { - Printf(stderr,"Unable to open %s\n", filen); + FileErrorDisplay(filen); SWIG_exit(EXIT_FAILURE); } Delete(filen); filen = NULL; @@ -321,7 +321,7 @@ class CSHARP : public Language { String *filen = NewStringf("%s%s.cs", SWIG_output_directory(), module_class_name); File *f_module = NewFile(filen,"w"); if(!f_module) { - Printf(stderr,"Unable to open %s\n", filen); + FileErrorDisplay(filen); SWIG_exit(EXIT_FAILURE); } Delete(filen); filen = NULL; @@ -922,7 +922,7 @@ class CSHARP : public Language { String *filen = NewStringf("%s%s.cs", SWIG_output_directory(), symname); File *f_enum = NewFile(filen,"w"); if(!f_enum) { - Printf(stderr,"Unable to open %s\n", filen); + FileErrorDisplay(filen); SWIG_exit(EXIT_FAILURE); } Delete(filen); filen = NULL; @@ -1412,7 +1412,7 @@ class CSHARP : public Language { String *filen = NewStringf("%s%s.cs", SWIG_output_directory(), proxy_class_name); f_proxy = NewFile(filen,"w"); if(!f_proxy) { - Printf(stderr, "Unable to create proxy class file: %s\n", filen); + FileErrorDisplay(filen); SWIG_exit(EXIT_FAILURE); } Delete(filen); filen = NULL; @@ -2359,7 +2359,7 @@ class CSHARP : public Language { String *filen = NewStringf("%s%s.cs", SWIG_output_directory(), classname); File *f_swigtype = NewFile(filen,"w"); if(!f_swigtype) { - Printf(stderr,"Unable to open %s\n", filen); + FileErrorDisplay(filen); SWIG_exit(EXIT_FAILURE); } Delete(filen); filen = NULL; diff --git a/Source/Modules/guile.cxx b/Source/Modules/guile.cxx index 6f1ea89a3..8a2f7af82 100644 --- a/Source/Modules/guile.cxx +++ b/Source/Modules/guile.cxx @@ -200,6 +200,10 @@ public: else if (strcmp (argv[i], "-procdoc") == 0) { if (argv[i + 1]) { procdoc = NewFile(argv[i + 1], (char *) "w"); + if (!procdoc) { + FileErrorDisplay(argv[i + 1]); + SWIG_exit(EXIT_FAILURE); + } Swig_mark_arg (i); Swig_mark_arg (i + 1); i++; @@ -338,7 +342,7 @@ public: f_runtime = NewFile(outfile,"w"); if (!f_runtime) { - Printf(stderr,"*** Can't open '%s'\n", outfile); + FileErrorDisplay(outfile); SWIG_exit(EXIT_FAILURE); } f_init = NewString(""); @@ -543,7 +547,7 @@ public: Delete(primitive_name); File *scmstubfile = NewFile(fname, (char *) "w"); if (!scmstubfile) { - Printf(stderr,"*** Can't open '%s' for writing\n", fname); + FileErrorDisplay(fname); SWIG_exit(EXIT_FAILURE); } Delete(fname); @@ -575,7 +579,7 @@ public: module_name); File *goopsfile = NewFile(fname, (char *)"w"); if (!goopsfile) { - Printf(stderr,"*** Can't open '%s' for writing\n", fname); + FileErrorDisplay(fname); SWIG_exit(EXIT_FAILURE); } Delete(fname); diff --git a/Source/Modules/java.cxx b/Source/Modules/java.cxx index cd76bfcb5..fdc29a7e9 100644 --- a/Source/Modules/java.cxx +++ b/Source/Modules/java.cxx @@ -283,14 +283,14 @@ class JAVA : public Language { f_runtime = NewFile(outfile,"w"); if (!f_runtime) { - Printf(stderr,"Unable to open %s\n", outfile); + FileErrorDisplay(outfile); SWIG_exit(EXIT_FAILURE); } if (directorsEnabled()) { f_runtime_h = NewFile(outfile_h,"w"); if (!f_runtime_h) { - Printf(stderr,"Unable to open %s\n", outfile_h); + FileErrorDisplay(outfile_h); SWIG_exit(EXIT_FAILURE); } } @@ -404,7 +404,7 @@ class JAVA : public Language { String *filen = NewStringf("%s%s.java", SWIG_output_directory(), imclass_name); File *f_im = NewFile(filen,"w"); if(!f_im) { - Printf(stderr,"Unable to open %s\n", filen); + FileErrorDisplay(filen); SWIG_exit(EXIT_FAILURE); } Delete(filen); filen = NULL; @@ -455,7 +455,7 @@ class JAVA : public Language { String *filen = NewStringf("%s%s.java", SWIG_output_directory(), module_class_name); File *f_module = NewFile(filen,"w"); if(!f_module) { - Printf(stderr,"Unable to open %s\n", filen); + FileErrorDisplay(filen); SWIG_exit(EXIT_FAILURE); } Delete(filen); filen = NULL; @@ -502,7 +502,7 @@ class JAVA : public Language { String *filen = NewStringf("%s%sConstants.java", SWIG_output_directory(), module_class_name); File *f_module = NewFile(filen,"w"); if(!f_module) { - Printf(stderr,"Unable to open %s\n", filen); + FileErrorDisplay(filen); SWIG_exit(EXIT_FAILURE); } Delete(filen); filen = NULL; @@ -1133,7 +1133,7 @@ class JAVA : public Language { String *filen = NewStringf("%s%s.java", SWIG_output_directory(), symname); File *f_enum = NewFile(filen,"w"); if(!f_enum) { - Printf(stderr,"Unable to open %s\n", filen); + FileErrorDisplay(filen); SWIG_exit(EXIT_FAILURE); } Delete(filen); filen = NULL; @@ -1672,7 +1672,7 @@ class JAVA : public Language { String *filen = NewStringf("%s%s.java", SWIG_output_directory(), proxy_class_name); f_proxy = NewFile(filen,"w"); if(!f_proxy) { - Printf(stderr, "Unable to create proxy class file: %s\n", filen); + FileErrorDisplay(filen); SWIG_exit(EXIT_FAILURE); } Delete(filen); filen = NULL; @@ -2510,7 +2510,7 @@ class JAVA : public Language { String *filen = NewStringf("%s%s.java", SWIG_output_directory(), classname); File *f_swigtype = NewFile(filen,"w"); if(!f_swigtype) { - Printf(stderr,"Unable to open %s\n", filen); + FileErrorDisplay(filen); SWIG_exit(EXIT_FAILURE); } Delete(filen); filen = NULL; diff --git a/Source/Modules/lua.cxx b/Source/Modules/lua.cxx index e9926919e..fda267f5d 100644 --- a/Source/Modules/lua.cxx +++ b/Source/Modules/lua.cxx @@ -179,7 +179,7 @@ NEW LANGUAGE NOTE:END ************************************************/ /* Open the output file */ f_runtime = NewFile(outfile, "w"); if (!f_runtime) { - Printf(stderr, "*** Can't open '%s'\n", outfile); + FileErrorDisplay(outfile); SWIG_exit(EXIT_FAILURE); } f_init = NewString(""); diff --git a/Source/Modules/main.cxx b/Source/Modules/main.cxx index dfddc8fe4..65c6949e8 100644 --- a/Source/Modules/main.cxx +++ b/Source/Modules/main.cxx @@ -290,7 +290,7 @@ static void SWIG_dump_runtime() { runtime = NewFile(outfile, "w"); if (!runtime) { - Printf(stderr, "*** Unable to open '%s'\n", outfile); + FileErrorDisplay(outfile); SWIG_exit(EXIT_FAILURE); } @@ -841,11 +841,19 @@ int SWIG_main(int argc, char *argv[], Language *l) { } else { outfile = NewString(outfile_name); } - if (dependencies_file && Len(dependencies_file) != 0) + if (dependencies_file && Len(dependencies_file) != 0) { f_dependencies_file = NewFile(dependencies_file,"w"); - else if (!depend_only) { + if (!f_dependencies_file) { + FileErrorDisplay(dependencies_file); + SWIG_exit(EXIT_FAILURE); + } + } else if (!depend_only) { String *filename = NewStringf("%s_wrap.%s", Swig_file_basename(input_file), depends_extension); f_dependencies_file = NewFile(filename,"w"); + if (!f_dependencies_file) { + FileErrorDisplay(filename); + SWIG_exit(EXIT_FAILURE); + } } else f_dependencies_file = stdout; diff --git a/Source/Modules/modula3.cxx b/Source/Modules/modula3.cxx index c59f6eeb7..6b770e44a 100644 --- a/Source/Modules/modula3.cxx +++ b/Source/Modules/modula3.cxx @@ -575,8 +575,8 @@ MODULA3 (): File *openWriteFile (String * name) { File *file = NewFile (name, "w"); - if (file == NIL) { - Printf (stderr, "Unable to open <%s> for writing.\n", name); + if (!file) { + FileErrorDisplay (name); SWIG_exit (EXIT_FAILURE); } Delete (name); @@ -967,7 +967,7 @@ MODULA3 (): f_runtime = NewFile (outfile, "w"); if (!f_runtime) { - Printf (stderr, "Unable to open %s\n", outfile); + FileErrorDisplay (outfile); SWIG_exit (EXIT_FAILURE); } f_init = NewString (""); @@ -2575,7 +2575,7 @@ MODULA3 (): NewStringf ("%s%s.m3", Swig_file_dirname (outfile), proxy_class_name); f_proxy = NewFile (filen, "w"); if (!f_proxy) { - Printf (stderr, "Unable to create proxy class file: %s\n", filen); + FileErrorDisplay (filen); SWIG_exit (EXIT_FAILURE); } Delete (filen); @@ -4012,6 +4012,10 @@ MODULA3 (): String *filen = NewStringf ("%s%s.m3", Swig_file_dirname (outfile), classname); File *f_swigtype = NewFile (filen, "w"); + if (!f_swigtype) { + FileErrorDisplay(filen); + SWIG_exit(EXIT_FAILURE); + } String *swigtype = NewString (""); // Emit banner name diff --git a/Source/Modules/mzscheme.cxx b/Source/Modules/mzscheme.cxx index b5abe0037..c5e7ebea9 100644 --- a/Source/Modules/mzscheme.cxx +++ b/Source/Modules/mzscheme.cxx @@ -131,7 +131,7 @@ public: f_runtime = NewFile(outfile,"w"); if (!f_runtime) { - Printf(stderr,"*** Can't open '%s'\n", outfile); + FileErrorDisplay(outfile); SWIG_exit(EXIT_FAILURE); } f_init = NewString(""); diff --git a/Source/Modules/ocaml.cxx b/Source/Modules/ocaml.cxx index 6177557f5..68dd10c0a 100755 --- a/Source/Modules/ocaml.cxx +++ b/Source/Modules/ocaml.cxx @@ -233,7 +233,7 @@ public: f_runtime = NewFile(outfile,"w"); if (!f_runtime) { - Printf(stderr,"*** Can't open '%s'\n", outfile); + FileErrorDisplay(outfile); SWIG_exit(EXIT_FAILURE); } f_init = NewString(""); @@ -320,12 +320,12 @@ public: String *mlfilen = NewStringf("%s%s", SWIG_output_directory(),mlfile); if ((f_mlout = NewFile(mlfilen,"w")) == 0) { - Printf(stderr,"Unable to open %s\n", mlfilen); + FileErrorDisplay(mlfilen); SWIG_exit (EXIT_FAILURE); } String *mlifilen = NewStringf("%s%s", SWIG_output_directory(),mlifile); if ((f_mliout = NewFile(mlifilen,"w")) == 0) { - Printf(stderr,"Unable to open %s\n", mlifilen); + FileErrorDisplay(mlifilen); SWIG_exit (EXIT_FAILURE); } diff --git a/Source/Modules/perl5.cxx b/Source/Modules/perl5.cxx index 8bd9603ef..466e021c5 100644 --- a/Source/Modules/perl5.cxx +++ b/Source/Modules/perl5.cxx @@ -184,7 +184,7 @@ public: f_runtime = NewFile(outfile,"w"); if (!f_runtime) { - Printf(stderr,"*** Can't open '%s'\n", outfile); + FileErrorDisplay(outfile); SWIG_exit(EXIT_FAILURE); } f_init = NewString(""); @@ -245,7 +245,7 @@ public: } String *filen = NewStringf("%s%s", SWIG_output_directory(),pmfile); if ((f_pm = NewFile(filen,"w")) == 0) { - Printf(stderr,"Unable to open %s\n", filen); + FileErrorDisplay(filen); SWIG_exit (EXIT_FAILURE); } Delete(filen); filen = NULL; diff --git a/Source/Modules/php4.cxx b/Source/Modules/php4.cxx index e4f8923cc..501ecafa6 100644 --- a/Source/Modules/php4.cxx +++ b/Source/Modules/php4.cxx @@ -334,7 +334,7 @@ public: /* Write out Makefile.in */ f_extra = NewFile(makefilein, "w"); if (!f_extra) { - Printf(stderr,"Unable to open %s\n",makefilein); + FileErrorDisplay(makefilein); SWIG_exit(EXIT_FAILURE); } @@ -385,7 +385,7 @@ public: // the php folk! f_extra = NewFile(configm4, "w"); if (!f_extra) { - Printf(stderr, "Unable to open %s\n",configm4); + FileErrorDisplay(configm4); SWIG_exit(EXIT_FAILURE); } @@ -504,7 +504,7 @@ public: /* CREDITS */ f_extra = NewFile(credits, "w"); if (!f_extra) { - Printf(stderr,"Unable to open %s\n",credits); + FileErrorDisplay(credits); SWIG_exit(EXIT_FAILURE); } Printf(f_extra, "%s\n", module); @@ -526,7 +526,7 @@ public: /* main output file */ f_runtime = NewFile(outfile,"w"); if (!f_runtime) { - Printf(stderr,"*** Can't open '%s'\n", outfile); + FileErrorDisplay(outfile); SWIG_exit(EXIT_FAILURE); } @@ -576,7 +576,7 @@ public: f_phpcode = NewFile(filen, "w"); if (!f_phpcode) { - Printf(stderr, "*** Can't open '%s'\n", filen); + FileErrorDisplay(filen); SWIG_exit(EXIT_FAILURE); } @@ -650,7 +650,7 @@ public: Printv(filen, SWIG_output_directory(), "php_", module, ".h", NIL); f_h = NewFile(filen, "w"); if (!f_h) { - Printf(stderr,"Unable to open %s\n", filen); + FileErrorDisplay(filen); SWIG_exit(EXIT_FAILURE); } diff --git a/Source/Modules/pike.cxx b/Source/Modules/pike.cxx index d17773f49..e666e63d5 100644 --- a/Source/Modules/pike.cxx +++ b/Source/Modules/pike.cxx @@ -118,7 +118,7 @@ public: /* Open the output file */ f_runtime = NewFile(outfile, "w"); if (!f_runtime) { - Printf(stderr, "*** Can't open '%s'\n", outfile); + FileErrorDisplay(outfile); SWIG_exit(EXIT_FAILURE); } f_init = NewString(""); diff --git a/Source/Modules/python.cxx b/Source/Modules/python.cxx index b7b18de9e..05e5dfa17 100644 --- a/Source/Modules/python.cxx +++ b/Source/Modules/python.cxx @@ -232,7 +232,7 @@ public: f_runtime = NewFile(outfile,"w"); if (!f_runtime) { - Printf(stderr,"*** Can't open '%s'\n", outfile); + FileErrorDisplay(outfile); SWIG_exit(EXIT_FAILURE); } @@ -240,7 +240,7 @@ public: if (!no_header_file) { f_runtime_h = NewFile(outfile_h,"w"); if (!f_runtime_h) { - Printf(stderr,"*** Can't open '%s'\n", outfile_h); + FileErrorDisplay(outfile_h); SWIG_exit(EXIT_FAILURE); } } else { @@ -305,7 +305,7 @@ public: if (interface) module = interface; else Insert(module,0,"_"); if ((f_shadow_py = NewFile(filen,"w")) == 0) { - Printf(stderr,"Unable to open %s\n", filen); + FileErrorDisplay(filen); SWIG_exit (EXIT_FAILURE); } Delete(filen); filen = NULL; diff --git a/Source/Modules/ruby.cxx b/Source/Modules/ruby.cxx index 2046942ee..e6768f6e4 100644 --- a/Source/Modules/ruby.cxx +++ b/Source/Modules/ruby.cxx @@ -373,14 +373,14 @@ public: f_runtime = NewFile(outfile,"w"); if (!f_runtime) { - Printf(stderr,"*** Can't open '%s'\n", outfile); + FileErrorDisplay(outfile); SWIG_exit(EXIT_FAILURE); } if (directorsEnabled()) { f_runtime_h = NewFile(outfile_h,"w"); if (!f_runtime_h) { - Printf(stderr,"*** Can't open '%s'\n", outfile_h); + FileErrorDisplay(outfile_h); SWIG_exit(EXIT_FAILURE); } } diff --git a/Source/Modules/s-exp.cxx b/Source/Modules/s-exp.cxx index 30364a59e..c762a2312 100644 --- a/Source/Modules/s-exp.cxx +++ b/Source/Modules/s-exp.cxx @@ -66,7 +66,7 @@ public: out = NewFile(outfile,"w"); if (!out) { - Printf(stderr,"*** Can't open '%s'\n", outfile); + FileErrorDisplay(outfile); SWIG_exit(EXIT_FAILURE); } } diff --git a/Source/Modules/tcl8.cxx b/Source/Modules/tcl8.cxx index 8e39d8d5b..1a70d7a97 100644 --- a/Source/Modules/tcl8.cxx +++ b/Source/Modules/tcl8.cxx @@ -136,7 +136,7 @@ public: f_runtime = NewFile(outfile,"w"); if (!f_runtime) { - Printf(stderr,"*** Can't open '%s'\n", outfile); + FileErrorDisplay(outfile); SWIG_exit(EXIT_FAILURE); } f_init = NewString(""); @@ -175,7 +175,7 @@ public: Insert( module,0,"_" ); if ((f_shadow = NewFile(filen,"w")) == 0) { - Printf(stderr,"Unable to open %s\n", filen); + FileErrorDisplay(filen); SWIG_exit (EXIT_FAILURE); } f_shadow_stubs = NewString(""); diff --git a/Source/Modules/uffi.cxx b/Source/Modules/uffi.cxx index cbdb2209e..b4b0196f5 100644 --- a/Source/Modules/uffi.cxx +++ b/Source/Modules/uffi.cxx @@ -233,7 +233,7 @@ int UFFI :: top(Node *n) { f_null=NewFile(devnull, "w+"); if (!f_null) { - perror("Failed to open /dev/null"); + FileErrorDisplay(devnull); SWIG_exit(EXIT_FAILURE); } Delete(devnull); @@ -244,7 +244,7 @@ int UFFI :: top(Node *n) { f_cl=NewFile(output_filename, "w"); if (!f_cl) { - Printf(stderr, "Unable to open %s for writing\n", output_filename); + FileErrorDisplay(output_filename); SWIG_exit(EXIT_FAILURE); } diff --git a/Source/Modules/xml.cxx b/Source/Modules/xml.cxx index cddbc3aed..4be1c099e 100644 --- a/Source/Modules/xml.cxx +++ b/Source/Modules/xml.cxx @@ -65,7 +65,7 @@ public: out = NewFile(outfile,"w"); if (!out) { - Printf(stderr,"*** Can't open '%s'\n", outfile); + FileErrorDisplay(outfile); SWIG_exit(EXIT_FAILURE); } continue; @@ -106,7 +106,7 @@ public: out = NewFile(outfile,"w"); if (!out) { - Printf(stderr,"*** Can't open '%s'\n", outfile); + FileErrorDisplay(outfile); SWIG_exit(EXIT_FAILURE); } } @@ -367,7 +367,7 @@ void Swig_print_xml(DOH *obj, String* filename) else { out = NewFile(filename, "w"); if (!out) { - Printf(stderr,"*** Can't open '%s'\n", filename); + FileErrorDisplay(filename); SWIG_exit(EXIT_FAILURE); } }