return s.st_size;
}
+off_t get_file_size_as_crlf(const gchar *file)
+{
+ FILE *fp;
+ off_t size = 0;
+ gchar buf[BUFFSIZE];
+
+ if ((fp = fopen(file, "r")) == NULL) {
+ FILE_OP_ERROR(file, "fopen");
+ return -1;
+ }
+
+ while (fgets(buf, sizeof(buf), fp) != NULL) {
+ strretchomp(buf);
+ size += strlen(buf) + 2;
+ }
+
+ if (ferror(fp)) {
+ FILE_OP_ERROR(file, "fgets");
+ size = -1;
+ }
+
+ fclose(fp);
+
+ return size;
+}
+
off_t get_left_file_size(FILE *fp)
{
glong pos;
return tmpfile();
}
+gchar *write_buffer_to_file(const gchar *buf, guint bufsize)
+{
+ FILE *fp;
+ gchar *tmp_file = NULL;
+
+ tmp_file = get_tmp_file();
+ fp = fopen(tmp_file, "w");
+ if (fp) {
+ fwrite(buf, 1, bufsize, fp);
+ fclose(fp);
+ }
+ else tmp_file = NULL;
+
+ return tmp_file;
+}
+
gint execute_async(gchar *const argv[])
{
pid_t pid;