+ arg_Source = get_string_resource(XSUBLIM_ARG_FILE,"Filename");
+ if (arg_Source != NULL)
+ {
+ FILE* file_Fs;
+ struct stat file_Stat;
+
+ file_Fs = fopen(arg_Source,"rb");
+ if (file_Fs == NULL)
+ {
+ fprintf(stderr,"%s: Could not open '%s'\n",progname,
+ arg_Source);
+ exit(-1);
+ }
+ if (fstat(fileno(file_Fs),&file_Stat) != 0)
+ {
+ fprintf(stderr,"%s: Could not stat '%s'\n",progname,
+ arg_Source);
+ exit(-1);
+ }
+ arg_Text = calloc(1,file_Stat.st_size+1);
+ if (arg_Text != NULL)
+ {
+ if (fread(arg_Text,file_Stat.st_size,1,file_Fs) != 1)
+ {
+ fprintf(stderr,"%s: Could not read '%s'\n",
+ progname,arg_Source);
+ exit(-1);
+ }
+ }
+ fclose(file_Fs);
+ }
+ else
+ {
+ arg_Source = get_string_resource(XSUBLIM_ARG_PROGRAM,
+ "Executable");
+ if (arg_Source != NULL)
+ {
+ char* exe_Command = calloc(1,strlen(arg_Source)+10);
+ FILE* exe_Fs;
+
+ if (exe_Command == NULL)
+ {
+ fprintf(stderr,
+ "%s: Could not allocate space for '%s'\n",
+ progname,arg_Source);
+ exit(-1);
+ }
+ sprintf(exe_Command,"( %s ) 2>&1",arg_Source);
+
+ exe_Fs = popen(exe_Command,"r");
+ if (exe_Fs == NULL)
+ {
+ fprintf(stderr,"%s: Could not run '%s'\n",
+ progname,arg_Source);
+ exit(-1);
+ }
+ arg_Text = calloc(1,XSUBLIM_PROGRAM_SIZE);
+ if (arg_Text != NULL)
+ {
+ if (fread(arg_Text,1,XSUBLIM_PROGRAM_SIZE,
+ exe_Fs) <= 0)
+ {
+ fprintf(stderr,
+ "%s: Could not read output of '%s'\n",
+ progname,arg_Source);
+ exit(-1);
+ }
+ if (
+ strstr(arg_Text,": not found") ||
+ strstr(arg_Text,": Not found") ||
+ strstr(arg_Text,": command not found") ||
+ strstr(arg_Text,": Command not found"))
+ {
+ fprintf(stderr,
+ "%s: Could not find '%s'\n",
+ progname,arg_Source);
+ exit(-1);
+ }
+ }
+ fclose(exe_Fs);
+ }
+ else
+ {
+ arg_Text =
+ get_string_resource(XSUBLIM_ARG_PHRASES,"Phrases");
+ if (arg_Text != NULL)
+ {
+ arg_Text = strdup(arg_Text);
+ }
+ }
+ }