#include <locale.h>
#include <time.h>
#include <inttypes.h>
+#include <sys/stat.h>
#include "window.h"
#include "main.h"
static Display *display;
static Widget toplevel_window;
+static char *open_file_arg;
+
static int event_pipe[2];
static String fallback[] = {
display = XtOpenDisplay(app, NULL, APP_NAME, APP_CLASS, NULL, 0, &argc, argv);
+ if(argc > 1) {
+ struct stat s;
+ if(stat(argv[1], &s)) {
+ fprintf(stderr, "Cannot open file: %s\n", argv[1]);
+ perror("");
+ return 1;
+ }
+ open_file_arg = argv[1];
+ }
+
XtAppAddInput(
app,
event_pipe[0],
cb.data = data;
write(event_pipe[1], &cb, sizeof(cb));
}
+
+char* GetOpenFileArg(void) {
+ return open_file_arg;
+}
+
+void CleanOpenFileArg(void) {
+ open_file_arg = NULL;
+}