ustring scriptfilename;
#ifdef kErrorLog
- close (2);
- open (cDataTop kErrorLog, O_WRONLY | O_APPEND | O_CREAT, 0666);
+// close (2);
+// open (kErrorLog, O_WRONLY | O_APPEND | O_CREAT, 0666);
+ aenv.setErrorLog (ustring (CharConst (kErrorLog)));
#endif
#ifdef UTF8JP
#include <string.h>
#include <iostream>
#include <stdlib.h>
+#include <fcntl.h>
static bool pcmp (char** a, const char* b, int n) {
int rc = strncmp (*a, b, n);
out << " dump\n";
#endif
}
+
+void AppEnv::setErrorLog (const ustring& path, bool fappend) {
+ int flag = O_WRONLY | O_CREAT;
+
+ if (fappend)
+ flag |= O_APPEND;
+ close (2);
+ open (path.c_str (), flag, 0666);
+}
virtual void setDefault ();
virtual ustring scriptName ();
virtual void dump (std::ostream& out);
+ virtual void setErrorLog (const ustring& path, bool fappend = false);
};
#endif /* APP_H */
#endif
MotorEnv env (&aenv, form, &motor, out);
+#ifdef kErrorLog
+ aenv.setErrorLog (ustring (CharConst (kErrorLog)));
+#endif
try {
aenv.readOption (argc, argv, &env);