+static void strip_crs(const gchar *file)
+{
+ FILE *fp = NULL, *outfp = NULL;
+ gchar buf[4096];
+ gchar *out = get_tmp_file();
+ if (file == NULL)
+ return;
+
+ fp = fopen(file, "rb");
+ if (!fp)
+ return;
+
+ outfp = fopen(out, "wb");
+ if (!outfp)
+ return;
+
+ while (fgets(buf, sizeof (buf), fp) != NULL) {
+ while (strstr(buf, "\r")) {
+ gchar *cr = strstr(buf, "\r") ;
+ *cr = '\n';
+ cr++;
+ *cr = '\0';
+ }
+ fputs(buf, outfp);
+ }
+
+ fclose(fp);
+ fclose(outfp);
+ rename_force(out, file);
+}
+