mutt stable branch with some hacks
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Convert main() to use buffers for paths.

Convert fpath (used for checking and creating $folder.

Convert expanded_infile and tempfile which are used for the -i,-H, and
-E options. We allocate buffers, rather than use the pool, because
they are used for the duration of the compose/send operation.

+35 -34
+33 -32
main.c
··· 613 613 int main (int argc, char **argv, char **environ) 614 614 { 615 615 BUFFER *folder = NULL; 616 + BUFFER *expanded_infile = NULL; 617 + BUFFER *tempfile = NULL; 616 618 char *subject = NULL; 617 619 char *includeFile = NULL; 618 620 char *draftFile = NULL; ··· 929 931 if (!option (OPTNOCURSES) && Maildir) 930 932 { 931 933 struct stat sb; 932 - char fpath[_POSIX_PATH_MAX]; 934 + BUFFER *fpath; 933 935 char msg[STRING]; 934 936 935 - strfcpy (fpath, Maildir, sizeof (fpath)); 936 - mutt_expand_path (fpath, sizeof (fpath)); 937 + fpath = mutt_buffer_pool_get (); 938 + mutt_buffer_strcpy (fpath, Maildir); 939 + mutt_buffer_expand_path (fpath); 937 940 #ifdef USE_IMAP 938 941 /* we're not connected yet - skip mail folder creation */ 939 - if (!mx_is_imap (fpath)) 942 + if (!mx_is_imap (mutt_b2s (fpath))) 940 943 #endif 941 - if (stat (fpath, &sb) == -1 && errno == ENOENT) 944 + if (stat (mutt_b2s (fpath), &sb) == -1 && errno == ENOENT) 942 945 { 943 946 snprintf (msg, sizeof (msg), _("%s does not exist. Create it?"), Maildir); 944 947 if (mutt_yesorno (msg, MUTT_YES) == MUTT_YES) 945 948 { 946 - if (mkdir (fpath, 0700) == -1 && errno != EEXIST) 949 + if (mkdir (mutt_b2s (fpath), 0700) == -1 && errno != EEXIST) 947 950 mutt_error ( _("Can't create %s: %s."), Maildir, strerror (errno)); 948 951 } 949 952 } 953 + mutt_buffer_pool_release (&fpath); 950 954 } 951 955 952 956 if (sendflags & SENDPOSTPONED) ··· 960 964 { 961 965 FILE *fin = NULL; 962 966 FILE *fout = NULL; 963 - char buf[LONG_STRING]; 964 - char *tempfile = NULL, *infile = NULL; 965 - char *bodytext = NULL, *bodyfile = NULL; 967 + char *infile = NULL; 968 + char *bodytext = NULL; 969 + const char *bodyfile = NULL; 966 970 int rv = 0; 967 - char expanded_infile[_POSIX_PATH_MAX]; 968 971 969 972 if (!option (OPTNOCURSES)) 970 973 mutt_flushinp (); ··· 1033 1036 } 1034 1037 else 1035 1038 { 1036 - strfcpy (expanded_infile, infile, sizeof (expanded_infile)); 1037 - mutt_expand_path (expanded_infile, sizeof (expanded_infile)); 1038 - if ((fin = fopen (expanded_infile, "r")) == NULL) 1039 + expanded_infile = mutt_buffer_new (); 1040 + mutt_buffer_strcpy (expanded_infile, infile); 1041 + mutt_buffer_expand_path (expanded_infile); 1042 + if ((fin = fopen (mutt_b2s (expanded_infile), "r")) == NULL) 1039 1043 { 1040 1044 if (!option (OPTNOCURSES)) 1041 1045 { 1042 1046 mutt_endwin (NULL); 1043 1047 set_option (OPTNOCURSES); 1044 1048 } 1045 - perror (expanded_infile); 1049 + perror (mutt_b2s (expanded_infile)); 1046 1050 goto cleanup_and_exit; 1047 1051 } 1048 1052 } ··· 1054 1058 */ 1055 1059 if (!edit_infile) 1056 1060 { 1057 - mutt_mktemp (buf, sizeof (buf)); 1058 - tempfile = safe_strdup (buf); 1061 + tempfile = mutt_buffer_new (); 1062 + mutt_buffer_mktemp (tempfile); 1059 1063 1060 - if ((fout = safe_fopen (tempfile, "w")) == NULL) 1064 + if ((fout = safe_fopen (mutt_b2s (tempfile), "w")) == NULL) 1061 1065 { 1062 1066 if (!option (OPTNOCURSES)) 1063 1067 { 1064 1068 mutt_endwin (NULL); 1065 1069 set_option (OPTNOCURSES); 1066 1070 } 1067 - perror (tempfile); 1071 + perror (mutt_b2s (tempfile)); 1068 1072 safe_fclose (&fin); 1069 - FREE (&tempfile); 1070 1073 goto cleanup_and_exit; 1071 1074 } 1072 1075 if (fin) ··· 1079 1082 fputs (bodytext, fout); 1080 1083 safe_fclose (&fout); 1081 1084 1082 - if ((fin = fopen (tempfile, "r")) == NULL) 1085 + if ((fin = fopen (mutt_b2s (tempfile), "r")) == NULL) 1083 1086 { 1084 1087 if (!option (OPTNOCURSES)) 1085 1088 { 1086 1089 mutt_endwin (NULL); 1087 1090 set_option (OPTNOCURSES); 1088 1091 } 1089 - perror (tempfile); 1090 - FREE (&tempfile); 1092 + perror (mutt_b2s (tempfile)); 1091 1093 goto cleanup_and_exit; 1092 1094 } 1093 1095 } ··· 1155 1157 * Note that SENDNOFREEHEADER is set above so it isn't unlinked. 1156 1158 */ 1157 1159 else if (edit_infile) 1158 - bodyfile = expanded_infile; 1160 + bodyfile = mutt_b2s (expanded_infile); 1159 1161 /* For bodytext and unedited includeFile: use the tempfile. 1160 1162 */ 1161 1163 else 1162 - bodyfile = tempfile; 1164 + bodyfile = mutt_b2s (tempfile); 1163 1165 1164 1166 if (fin) 1165 1167 safe_fclose (&fin); ··· 1208 1210 msg->content->unlink = 0; 1209 1211 else if (draftFile) 1210 1212 { 1211 - if (truncate (expanded_infile, 0) == -1) 1213 + if (truncate (mutt_b2s (expanded_infile), 0) == -1) 1212 1214 { 1213 1215 if (!option (OPTNOCURSES)) 1214 1216 { 1215 1217 mutt_endwin (NULL); 1216 1218 set_option (OPTNOCURSES); 1217 1219 } 1218 - perror (expanded_infile); 1220 + perror (mutt_b2s (expanded_infile)); 1219 1221 goto cleanup_and_exit; 1220 1222 } 1221 - if ((fout = safe_fopen (expanded_infile, "a")) == NULL) 1223 + if ((fout = safe_fopen (mutt_b2s (expanded_infile), "a")) == NULL) 1222 1224 { 1223 1225 if (!option (OPTNOCURSES)) 1224 1226 { 1225 1227 mutt_endwin (NULL); 1226 1228 set_option (OPTNOCURSES); 1227 1229 } 1228 - perror (expanded_infile); 1230 + perror (mutt_b2s (expanded_infile)); 1229 1231 goto cleanup_and_exit; 1230 1232 } 1231 1233 ··· 1261 1263 1262 1264 /* !edit_infile && draftFile will leave the tempfile around */ 1263 1265 if (tempfile) 1264 - { 1265 - unlink (tempfile); 1266 - FREE (&tempfile); 1267 - } 1266 + unlink (mutt_b2s (tempfile)); 1268 1267 1269 1268 if (rv) 1270 1269 goto cleanup_and_exit; ··· 1354 1353 1355 1354 cleanup_and_exit: 1356 1355 mutt_buffer_free (&folder); 1356 + mutt_buffer_free (&expanded_infile); 1357 + mutt_buffer_free (&tempfile); 1357 1358 #ifdef USE_IMAP 1358 1359 imap_logout_all (); 1359 1360 #endif
+1 -1
protos.h
··· 578 578 579 579 /* unsorted */ 580 580 void ci_bounce_message (HEADER *); 581 - int ci_send_message (int, HEADER *, char *, CONTEXT *, HEADER *); 581 + int ci_send_message (int, HEADER *, const char *, CONTEXT *, HEADER *); 582 582 583 583 /* prototypes for compatibility functions */ 584 584
+1 -1
send.c
··· 1554 1554 int 1555 1555 ci_send_message (int flags, /* send mode */ 1556 1556 HEADER *msg, /* template to use for new message */ 1557 - char *tempfile, /* file specified by -i or -H */ 1557 + const char *tempfile, /* file specified by -i or -H */ 1558 1558 CONTEXT *ctx, /* current mailbox */ 1559 1559 HEADER *cur) /* current message */ 1560 1560 {