#include "tags.h"
#include "folder_item_prefs.h"
#include "procmsg.h"
+#include "claws_io.h"
/*!
*\brief Keyword lookup element
if (!outfp)
return FALSE;
- while (fgets(buf, sizeof(buf), outfp) != NULL) {
+ while (claws_fgets(buf, sizeof(buf), outfp) != NULL) {
strretchomp(buf);
for (l = matchers->matchers ; l != NULL ; l = g_slist_next(l)) {
* no need to check the others. */
if (matcher->result && matcher->done) {
if (!matchers->bool_and) {
- fclose(outfp);
+ claws_fclose(outfp);
return TRUE;
}
}
}
}
- fclose(outfp);
+ claws_fclose(outfp);
return FALSE;
}
if (file == NULL)
return FALSE;
- if ((fp = g_fopen(file, "rb")) == NULL) {
- FILE_OP_ERROR(file, "fopen");
+ if ((fp = claws_fopen(file, "rb")) == NULL) {
+ FILE_OP_ERROR(file, "claws_fopen");
g_free(file);
return result;
}
g_free(file);
- fclose(fp);
+ claws_fclose(fp);
return result;
}
continue;
if (prop->enabled) {
- if (fputs("enabled ", fp) == EOF) {
- FILE_OP_ERROR("filtering config", "fputs");
+ if (claws_fputs("enabled ", fp) == EOF) {
+ FILE_OP_ERROR("filtering config", "claws_fputs");
return -1;
}
} else {
- if (fputs("disabled ", fp) == EOF) {
- FILE_OP_ERROR("filtering config", "fputs");
+ if (claws_fputs("disabled ", fp) == EOF) {
+ FILE_OP_ERROR("filtering config", "claws_fputs");
return -1;
}
}
- if (fputs("rulename \"", fp) == EOF) {
- FILE_OP_ERROR("filtering config", "fputs");
+ if (claws_fputs("rulename \"", fp) == EOF) {
+ FILE_OP_ERROR("filtering config", "claws_fputs");
g_free(filtering_str);
return -1;
}
tmp_name = prop->name;
while (tmp_name && *tmp_name != '\0') {
if (*tmp_name != '"') {
- if (fputc(*tmp_name, fp) == EOF) {
- FILE_OP_ERROR("filtering config", "fputs || fputc");
+ if (claws_fputc(*tmp_name, fp) == EOF) {
+ FILE_OP_ERROR("filtering config", "claws_fputs || claws_fputc");
g_free(filtering_str);
return -1;
}
} else if (*tmp_name == '"') {
- if (fputc('\\', fp) == EOF ||
- fputc('"', fp) == EOF) {
- FILE_OP_ERROR("filtering config", "fputs || fputc");
+ if (claws_fputc('\\', fp) == EOF ||
+ claws_fputc('"', fp) == EOF) {
+ FILE_OP_ERROR("filtering config", "claws_fputs || claws_fputc");
g_free(filtering_str);
return -1;
}
}
tmp_name ++;
}
- if (fputs("\" ", fp) == EOF) {
- FILE_OP_ERROR("filtering config", "fputs");
+ if (claws_fputs("\" ", fp) == EOF) {
+ FILE_OP_ERROR("filtering config", "claws_fputs");
g_free(filtering_str);
return -1;
}
gchar *tmp = NULL;
tmp = g_strdup_printf("account %d ", prop->account_id);
- if (fputs(tmp, fp) == EOF) {
- FILE_OP_ERROR("filtering config", "fputs");
+ if (claws_fputs(tmp, fp) == EOF) {
+ FILE_OP_ERROR("filtering config", "claws_fputs");
g_free(tmp);
return -1;
}
g_free(tmp);
}
- if(fputs(filtering_str, fp) == EOF ||
- fputc('\n', fp) == EOF) {
- FILE_OP_ERROR("filtering config", "fputs || fputc");
+ if(claws_fputs(filtering_str, fp) == EOF ||
+ claws_fputc('\n', fp) == EOF) {
+ FILE_OP_ERROR("filtering config", "claws_fputs || claws_fputc");
g_free(filtering_str);
return -1;
}
data->error = TRUE;
goto fail;
}
- if (fputc('\n', data->fp) == EOF) {
+ if (claws_fputc('\n', data->fp) == EOF) {
data->error = TRUE;
goto fail;
}
/* pre global rules */
if (fprintf(fp, "[preglobal]\n") < 0 ||
prefs_filtering_write(fp, pre_global_processing) < 0 ||
- fputc('\n', fp) == EOF)
+ claws_fputc('\n', fp) == EOF)
return -1;
/* post global rules */
if (fprintf(fp, "[postglobal]\n") < 0 ||
prefs_filtering_write(fp, post_global_processing) < 0 ||
- fputc('\n', fp) == EOF)
+ claws_fputc('\n', fp) == EOF)
return -1;
/* filtering rules */
if (fprintf(fp, "[filtering]\n") < 0 ||
prefs_filtering_write(fp, filtering_rules) < 0 ||
- fputc('\n', fp) == EOF)
+ claws_fputc('\n', fp) == EOF)
return -1;
return 0;
rcpath = g_strconcat(get_rc_dir(), G_DIR_SEPARATOR_S, MATCHER_RC, NULL);
- f = g_fopen(rcpath, "rb");
+ f = claws_fopen(rcpath, "rb");
g_free(rcpath);
if (f != NULL) {
matcher_parser_start_parsing(f);
- fclose(matcher_parserin);
+ claws_fclose(matcher_parserin);
}
}