46 #include "EST_types.h"
47 #include "EST_String.h"
48 #include "EST_Pathname.h"
49 #include "EST_io_aux.h"
50 #include "EST_string_aux.h"
51 #include "EST_cutils.h"
52 #include "EST_Token.h"
57 char *tname = cmake_tmp_filename();
63 int readable_file(
char *filename)
67 if (streq(filename,
"-"))
69 else if (access(filename,R_OK) == 0)
75 int writable_file(
char *filename)
83 if (streq(filename,
"-"))
85 else if (access(filename,W_OK) == 0)
87 else if ((access(filename,F_OK) == -1) &&
102 if ((fd = fopen(tmpname,
"wb")) == NULL)
104 cerr <<
"Write access failed for temporary file\n";
107 while ((n=fread(buff,1,1024,stdin)) > 0)
108 if (fwrite(buff,1,n,fd) != n)
110 cerr <<
"Write error on temporary file";
122 d = strtol(s, &a, 0);
123 success = (*a ==
'\0') ? 0: 1;
133 d = strtol(s, &a, 0);
142 sprintf(tmp,
"%d", n);
146 EST_String ftoString(
float n,
int pres,
int width,
int right_justify)
154 strcat(spec, itoString(width));
156 strcat(spec, itoString(pres));
159 sprintf(tmp, spec, n);
178 full = full.
before(
".", -1);
197 if (quote_char(0) == s(0))
199 if (quote_char(0) == s(s.
length()-1))
208 EST_String new_filename = make_tmp_filename();
209 EST_String sysstr = prog_name +
" " + filename +
" > " + new_filename;
212 int stat = system(sysstr);
216 (void)delete_file(new_filename);
223 int compress_file_in_place(
const EST_String &filename,
226 return system(prog_name +
" " + filename);
235 if(new_filename ==
"-")
236 sysstr = prog_name +
" " + filename;
238 sysstr = prog_name +
" " + filename +
" > " + new_filename;
239 return system(sysstr);