Commit 746ee9e4 746ee9e48f5124fec880c01aedc915b08be78250 by Sergey Poznyakoff

Changed proto of mh_read_formfile()

1 parent 3d100a2d
1 2001-09-18 Sergey Poznyakoff 1 2001-09-18 Sergey Poznyakoff
2 2
3 * mh/mh.h: Changed proto of mh_read_formfile(). Thanks to Alain
4 for noticing.
5 * mh/inc.c: Likewise.
6 * mh/scan.c: Likewise.
7 * mh/mh_init.c: Likewise.
8
9 2001-09-18 Sergey Poznyakoff
10
3 * mailbox/mbx_mh.c: Optimized for speed. 11 * mailbox/mbx_mh.c: Optimized for speed.
4 _mh_message_save(): scan the message while saving it. If expunge==0, 12 _mh_message_save(): scan the message while saving it. If expunge==0,
5 do not create temporary, operate directly on the message file instead. 13 do not create temporary, operate directly on the message file instead.
......
...@@ -90,7 +90,7 @@ opt_handler (int key, char *arg, void *unused) ...@@ -90,7 +90,7 @@ opt_handler (int key, char *arg, void *unused)
90 break; 90 break;
91 91
92 case 'F': 92 case 'F':
93 format_str = mh_read_formfile (arg); 93 mh_read_formfile (arg, &format_str);
94 break; 94 break;
95 95
96 case 'i': 96 case 'i':
......
...@@ -135,7 +135,7 @@ extern char mh_list_format[]; ...@@ -135,7 +135,7 @@ extern char mh_list_format[];
135 135
136 void mh_init (void); 136 void mh_init (void);
137 int mh_read_context_file (char *path, header_t *header); 137 int mh_read_context_file (char *path, header_t *header);
138 char *mh_read_formfile (char *name); 138 int mh_read_formfile (char *name, char **pformat);
139 139
140 int mh_format (mh_format_t *fmt, message_t msg, size_t msgno, 140 int mh_format (mh_format_t *fmt, message_t msg, size_t msgno,
141 char *buffer, size_t bufsize); 141 char *buffer, size_t bufsize);
......
...@@ -116,8 +116,8 @@ mh_read_context_file (char *path, header_t *header) ...@@ -116,8 +116,8 @@ mh_read_context_file (char *path, header_t *header)
116 return status; 116 return status;
117 } 117 }
118 118
119 char * 119 int
120 mh_read_formfile (char *name) 120 mh_read_formfile (char *name, char **pformat)
121 { 121 {
122 FILE *fp; 122 FILE *fp;
123 struct stat st; 123 struct stat st;
...@@ -128,14 +128,14 @@ mh_read_formfile (char *name) ...@@ -128,14 +128,14 @@ mh_read_formfile (char *name)
128 if (stat (name, &st)) 128 if (stat (name, &st))
129 { 129 {
130 mh_error ("can't stat format file %s: %s", name, strerror (errno)); 130 mh_error ("can't stat format file %s: %s", name, strerror (errno));
131 return; 131 return -1;
132 } 132 }
133 133
134 fp = fopen (name, "r"); 134 fp = fopen (name, "r");
135 if (!fp) 135 if (!fp)
136 { 136 {
137 mh_error ("can't open format file %s: %s", name, strerror (errno)); 137 mh_error ("can't open format file %s: %s", name, strerror (errno));
138 return; 138 return -1;
139 } 139 }
140 140
141 format_str = xmalloc (st.st_size+1); 141 format_str = xmalloc (st.st_size+1);
...@@ -150,7 +150,8 @@ mh_read_formfile (char *name) ...@@ -150,7 +150,8 @@ mh_read_formfile (char *name)
150 } 150 }
151 format_str[off] = 0; 151 format_str[off] = 0;
152 fclose (fp); 152 fclose (fp);
153 return format_str; 153 *pformat = format_str;
154 return 0;
154 } 155 }
155 156
156 static char *my_name; 157 static char *my_name;
......
...@@ -87,7 +87,7 @@ opt_handler (int key, char *arg, void *unused) ...@@ -87,7 +87,7 @@ opt_handler (int key, char *arg, void *unused)
87 break; 87 break;
88 88
89 case 'F': 89 case 'F':
90 format_str = mh_read_formfile (arg); 90 mh_read_formfile (arg, &format_str);
91 break; 91 break;
92 92
93 case 't': 93 case 't':
......