aboutsummaryrefslogtreecommitdiffstats
path: root/FICS/utils.c
diff options
context:
space:
mode:
authorMarkus Uhlin <markus@nifty-networks.net>2023-12-10 13:22:52 +0100
committerMarkus Uhlin <markus@nifty-networks.net>2023-12-10 13:22:52 +0100
commitb72c48f1da2c2e07bf89526e62099b3d34243d2c (patch)
treef65b314d56d8b50408fc0031922ee0406e283836 /FICS/utils.c
parent3c6f85f547181c005419dc1f78bfc506c5b641c5 (diff)
mail_file_to_address: fixed possibly unused variables
Diffstat (limited to 'FICS/utils.c')
-rw-r--r--FICS/utils.c49
1 files changed, 25 insertions, 24 deletions
diff --git a/FICS/utils.c b/FICS/utils.c
index f17ce06..3233c11 100644
--- a/FICS/utils.c
+++ b/FICS/utils.c
@@ -161,37 +161,38 @@ PUBLIC int mail_string_to_user(int p, char *subj, char *str)
}
}
-PUBLIC int mail_file_to_address(char *addr, char *subj, char *fname)
+PUBLIC int
+mail_file_to_address(char *addr, char *subj, char *fname)
{
- char com[1000];
- char tmp[MAX_LINE_SIZE];
- FILE *fp;
- FILE *file_fp;
+ FILE *fp1, *fp2;
+ char com[1000];
+ char tmp[MAX_LINE_SIZE];
+
+ /* maybe unused */
+ (void) fp2;
+ (void) tmp;
#ifdef SENDMAILPROG
- sprintf(com, "%s\n", SENDMAILPROG);
+ sprintf(com, "%s\n", SENDMAILPROG);
#else
- sprintf(com, "%s -s \"%s\" %s < %s&", MAILPROGRAM, subj, addr, fname);
+ sprintf(com, "%s -s \"%s\" %s < %s&", MAILPROGRAM, subj, addr, fname);
#endif
- fp = popen(com, "w");
- if (!fp)
- return -1;
+ if ((fp1 = popen(com, "w")) == NULL)
+ return -1;
#ifdef SENDMAILPROG
- fprintf(fp, "To: %s\nSubject: %s\n", addr, subj);
- file_fp = fopen(fname, "r");
- if (!file_fp)
- return -1;
- while (!feof(file_fp)) {
- fgets(tmp, MAX_LINE_SIZE - 1, file_fp);
- if (!feof(file_fp)) {
- fputs(tmp, fp);
- }
- }
- fclose(file_fp);
-
+ fprintf(fp1, "To: %s\nSubject: %s\n", addr, subj);
+ if ((fp2 = fopen(fname, "r")) == NULL)
+ return -1;
+ while (!feof(fp2)) {
+ fgets(tmp, MAX_LINE_SIZE - 1, fp2);
+ if (!feof(fp2)) {
+ fputs(tmp, fp1);
+ }
+ }
+ fclose(fp2);
#endif
- pclose(fp);
- return 0;
+ pclose(fp1);
+ return 0;
}
PUBLIC int mail_file_to_user(int p, char *subj, char *fname)