NeoMutt  2018-07-16 +1783-b00bd9
Teaching an old dog new tricks
DOXYGEN
edit.c File Reference

GUI basic built-in text editor. More...

#include "config.h"
#include <ctype.h>
#include <errno.h>
#include <locale.h>
#include <stdbool.h>
#include <stdio.h>
#include <string.h>
#include <sys/stat.h>
#include "mutt/mutt.h"
#include "address/lib.h"
#include "email/lib.h"
#include "alias.h"
#include "context.h"
#include "curs_lib.h"
#include "globals.h"
#include "hdrline.h"
#include "mailbox.h"
#include "mutt_curses.h"
#include "mutt_header.h"
#include "mutt_window.h"
#include "muttlib.h"
#include "protos.h"
+ Include dependency graph for edit.c:

Go to the source code of this file.

Functions

static char ** be_snarf_data (FILE *fp, char **buf, int *bufmax, int *buflen, LOFF_T offset, int bytes, int prefix)
 Read data from a file into a buffer. More...
 
static char ** be_snarf_file (const char *path, char **buf, int *max, int *len, bool verbose)
 Read a file into a buffer. More...
 
static int be_barf_file (const char *path, char **buf, int buflen)
 Write a buffer to a file. More...
 
static void be_free_memory (char **buf, int buflen)
 Free an array of buffers. More...
 
static char ** be_include_messages (char *msg, char **buf, int *bufmax, int *buflen, int pfx, int inc_hdrs)
 Gather the contents of some messages. More...
 
static void be_print_header (struct Envelope *env)
 Print a message Header. More...
 
static void be_edit_header (struct Envelope *e, bool force)
 Edit the message headers. More...
 
int mutt_builtin_editor (const char *path, struct Email *msg, struct Email *cur)
 Show the user the built-in editor. More...
 

Variables

char * C_Escape
 Config: Escape character to use for functions in the built-in editor. More...
 
static char * EditorHelp1
 
static char * EditorHelp2
 

Detailed Description

GUI basic built-in text editor.

Authors
  • Michael R. Elkins

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.

Definition in file edit.c.

Function Documentation

static char** be_snarf_data ( FILE *  fp,
char **  buf,
int *  bufmax,
int *  buflen,
LOFF_T  offset,
int  bytes,
int  prefix 
)
static

Read data from a file into a buffer.

Parameters
[in]fpFile to read from
[out]bufBuffer allocated to save data
[out]bufmaxAllocated size of buffer
[out]buflenBytes of buffer used
[in]offsetStart reading at this file offset
[in]bytesRead this many bytes
[in]prefixIf true, prefix the lines with the C_IndentString
Return values
ptrPointer to allocated buffer

Definition at line 93 of file edit.c.

95 {
96  char tmp[8192];
97  char *p = tmp;
98  int tmplen = sizeof(tmp);
99 
100  tmp[sizeof(tmp) - 1] = '\0';
101  if (prefix)
102  {
103  mutt_str_strfcpy(tmp, C_IndentString, sizeof(tmp));
104  tmplen = mutt_str_strlen(tmp);
105  p = tmp + tmplen;
106  tmplen = sizeof(tmp) - tmplen;
107  }
108 
109  fseeko(fp, offset, SEEK_SET);
110  while (bytes > 0)
111  {
112  if (!fgets(p, tmplen - 1, fp))
113  break;
114  bytes -= mutt_str_strlen(p);
115  if (*bufmax == *buflen)
116  mutt_mem_realloc(&buf, sizeof(char *) * (*bufmax += 25));
117  buf[(*buflen)++] = mutt_str_strdup(tmp);
118  }
119  if (buf && (*bufmax == *buflen))
120  { /* Do not smash memory past buf */
121  mutt_mem_realloc(&buf, sizeof(char *) * (++*bufmax));
122  }
123  if (buf)
124  buf[*buflen] = NULL;
125  return buf;
126 }
WHERE char * C_IndentString
Config: String used to indent &#39;reply&#39; text.
Definition: globals.h:133
size_t mutt_str_strlen(const char *a)
Calculate the length of a string, safely.
Definition: string.c:669
void mutt_mem_realloc(void *ptr, size_t size)
Resize a block of memory on the heap.
Definition: memory.c:121
size_t mutt_str_strfcpy(char *dest, const char *src, size_t dsize)
Copy a string into a buffer (guaranteeing NUL-termination)
Definition: string.c:753
char * mutt_str_strdup(const char *str)
Copy a string, safely.
Definition: string.c:380

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static char** be_snarf_file ( const char *  path,
char **  buf,
int *  max,
int *  len,
bool  verbose 
)
static

Read a file into a buffer.

Parameters
[in]pathFile to read
[out]bufBuffer allocated to save data
[out]maxAllocated size of buffer
[out]lenBytes of buffer used
[in]verboseIf true, report the file and bytes read
Return values
ptrPointer to allocated buffer

Definition at line 137 of file edit.c.

138 {
139  char tmp[1024];
140  struct stat sb;
141 
142  FILE *fp = fopen(path, "r");
143  if (fp)
144  {
145  fstat(fileno(fp), &sb);
146  buf = be_snarf_data(fp, buf, max, len, 0, sb.st_size, 0);
147  if (verbose)
148  {
149  snprintf(tmp, sizeof(tmp), "\"%s\" %lu bytes\n", path, (unsigned long) sb.st_size);
150  addstr(tmp);
151  }
152  mutt_file_fclose(&fp);
153  }
154  else
155  {
156  snprintf(tmp, sizeof(tmp), "%s: %s\n", path, strerror(errno));
157  addstr(tmp);
158  }
159  return buf;
160 }
static char ** be_snarf_data(FILE *fp, char **buf, int *bufmax, int *buflen, LOFF_T offset, int bytes, int prefix)
Read data from a file into a buffer.
Definition: edit.c:93
int mutt_file_fclose(FILE **fp)
Close a FILE handle (and NULL the pointer)
Definition: file.c:149

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static int be_barf_file ( const char *  path,
char **  buf,
int  buflen 
)
static

Write a buffer to a file.

Parameters
[in]pathPath to write to
[out]bufBuffer to read from
[in]buflenLength of buffer
Return values
0Success
-1Error

Definition at line 170 of file edit.c.

171 {
172  FILE *fp = fopen(path, "w");
173  if (!fp)
174  {
175  addstr(strerror(errno));
176  addch('\n');
177  return -1;
178  }
179  for (int i = 0; i < buflen; i++)
180  fputs(buf[i], fp);
181  if (fclose(fp) == 0)
182  return 0;
183  printw("fclose: %s\n", strerror(errno));
184  return -1;
185 }

+ Here is the caller graph for this function:

static void be_free_memory ( char **  buf,
int  buflen 
)
static

Free an array of buffers.

Parameters
[out]bufBuffer to free
[in]buflenNumber of buffers to free

Definition at line 192 of file edit.c.

193 {
194  while (buflen-- > 0)
195  FREE(&buf[buflen]);
196  FREE(&buf);
197 }
#define FREE(x)
Definition: memory.h:40

+ Here is the caller graph for this function:

static char** be_include_messages ( char *  msg,
char **  buf,
int *  bufmax,
int *  buflen,
int  pfx,
int  inc_hdrs 
)
static

Gather the contents of some messages.

Parameters
[in]msgList of message numbers (space or comma separated)
[out]bufBuffer allocated to save data
[out]bufmaxAllocated size of buffer
[out]buflenBytes of buffer used
[in]pfxPrefix
[in]inc_hdrsIf true, include the message headers
Return values
ptrPointer to allocated buffer

Definition at line 209 of file edit.c.

211 {
212  int n;
213  // int offset, bytes;
214  char tmp[1024];
215 
216  if (!msg || !buf || !bufmax || !buflen)
217  return buf;
218 
219  while ((msg = strtok(msg, " ,")))
220  {
221  if ((mutt_str_atoi(msg, &n) == 0) && (n > 0) && (n <= Context->mailbox->msg_count))
222  {
223  n--;
224 
225  /* add the attribution */
226  if (C_Attribution)
227  {
228  setlocale(LC_TIME, NONULL(C_AttributionLocale));
229  mutt_make_string(tmp, sizeof(tmp) - 1, C_Attribution, Context,
231  setlocale(LC_TIME, "");
232  strcat(tmp, "\n");
233  }
234 
235  if (*bufmax == *buflen)
236  mutt_mem_realloc(&buf, sizeof(char *) * (*bufmax += 25));
237  buf[(*buflen)++] = mutt_str_strdup(tmp);
238 
239 #if 0
240  /* This only worked for mbox Mailboxes because they had Context->fp set.
241  * As that no longer exists, the code is now completely broken. */
242  bytes = Context->mailbox->emails[n]->content->length;
243  if (inc_hdrs)
244  {
245  offset = Context->mailbox->emails[n]->offset;
246  bytes += Context->mailbox->emails[n]->content->offset - offset;
247  }
248  else
249  offset = Context->mailbox->emails[n]->content->offset;
250  buf = be_snarf_data(Context->fp, buf, bufmax, buflen, offset, bytes, pfx);
251 #endif
252 
253  if (*bufmax == *buflen)
254  mutt_mem_realloc(&buf, sizeof(char *) * (*bufmax += 25));
255  buf[(*buflen)++] = mutt_str_strdup("\n");
256  }
257  else
258  printw(_("%d: invalid message number.\n"), n);
259  msg = NULL;
260  }
261  return buf;
262 }
struct Email ** emails
Definition: mailbox.h:99
The "current" mailbox.
Definition: context.h:38
#define NONULL(x)
Definition: string2.h:36
int mutt_str_atoi(const char *str, int *dst)
Convert ASCII string to an integer.
Definition: string.c:262
WHERE char * C_AttributionLocale
Config: Locale for dates in the attribution message.
Definition: globals.h:97
struct Body * content
list of MIME parts
Definition: email.h:93
LOFF_T offset
offset where the actual data begins
Definition: body.h:46
#define _(a)
Definition: message.h:28
static char ** be_snarf_data(FILE *fp, char **buf, int *bufmax, int *buflen, LOFF_T offset, int bytes, int prefix)
Read data from a file into a buffer.
Definition: edit.c:93
struct Mailbox * mailbox
Definition: context.h:52
void mutt_mem_realloc(void *ptr, size_t size)
Resize a block of memory on the heap.
Definition: memory.c:121
LOFF_T length
length (in bytes) of attachment
Definition: body.h:47
LOFF_T offset
where in the stream does this message begin?
Definition: email.h:86
char * mutt_str_strdup(const char *str)
Copy a string, safely.
Definition: string.c:380
#define mutt_make_string(BUF, BUFLEN, S, CTX, M, E)
Definition: hdrline.h:59
WHERE char * C_Attribution
Config: Message to start a reply, "On DATE, PERSON wrote:".
Definition: globals.h:96

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void be_print_header ( struct Envelope env)
static

Print a message Header.

Parameters
envEnvelope to print

Definition at line 268 of file edit.c.

269 {
270  char tmp[8192];
271 
272  if (env->to)
273  {
274  addstr("To: ");
275  tmp[0] = '\0';
276  mutt_addr_write(tmp, sizeof(tmp), env->to, true);
277  addstr(tmp);
278  addch('\n');
279  }
280  if (env->cc)
281  {
282  addstr("Cc: ");
283  tmp[0] = '\0';
284  mutt_addr_write(tmp, sizeof(tmp), env->cc, true);
285  addstr(tmp);
286  addch('\n');
287  }
288  if (env->bcc)
289  {
290  addstr("Bcc: ");
291  tmp[0] = '\0';
292  mutt_addr_write(tmp, sizeof(tmp), env->bcc, true);
293  addstr(tmp);
294  addch('\n');
295  }
296  if (env->subject)
297  {
298  addstr("Subject: ");
299  addstr(env->subject);
300  addch('\n');
301  }
302  addch('\n');
303 }
struct Address * to
Definition: envelope.h:42
size_t mutt_addr_write(char *buf, size_t buflen, struct Address *addr, bool display)
Write an Address to a buffer.
Definition: address.c:1184
struct Address * bcc
Definition: envelope.h:44
char * subject
Definition: envelope.h:50
struct Address * cc
Definition: envelope.h:43

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void be_edit_header ( struct Envelope e,
bool  force 
)
static

Edit the message headers.

Parameters
eEmail
forceoverride the $ask* vars (used for the ~h command)

Definition at line 310 of file edit.c.

311 {
312  char tmp[8192];
313 
315 
316  addstr("To: ");
317  tmp[0] = '\0';
319  mutt_addr_write(tmp, sizeof(tmp), e->to, false);
320  if (!e->to || force)
321  {
322  if (mutt_enter_string(tmp, sizeof(tmp), 4, MUTT_COMP_NO_FLAGS) == 0)
323  {
324  mutt_addr_free(&e->to);
325  e->to = mutt_addr_parse_list2(e->to, tmp);
326  e->to = mutt_expand_aliases(e->to);
327  mutt_addrlist_to_intl(e->to, NULL); /* XXX - IDNA error reporting? */
328  tmp[0] = '\0';
329  mutt_addr_write(tmp, sizeof(tmp), e->to, true);
331  }
332  }
333  else
334  {
335  mutt_addrlist_to_intl(e->to, NULL); /* XXX - IDNA error reporting? */
336  addstr(tmp);
337  }
338  addch('\n');
339 
340  if (!e->subject || force)
341  {
342  addstr("Subject: ");
343  mutt_str_strfcpy(tmp, e->subject ? e->subject : "", sizeof(tmp));
344  if (mutt_enter_string(tmp, sizeof(tmp), 9, MUTT_COMP_NO_FLAGS) == 0)
345  mutt_str_replace(&e->subject, tmp);
346  addch('\n');
347  }
348 
349  if ((!e->cc && C_Askcc) || force)
350  {
351  addstr("Cc: ");
352  tmp[0] = '\0';
354  mutt_addr_write(tmp, sizeof(tmp), e->cc, false);
355  if (mutt_enter_string(tmp, sizeof(tmp), 4, MUTT_COMP_NO_FLAGS) == 0)
356  {
357  mutt_addr_free(&e->cc);
358  e->cc = mutt_addr_parse_list2(e->cc, tmp);
359  e->cc = mutt_expand_aliases(e->cc);
360  tmp[0] = '\0';
361  mutt_addrlist_to_intl(e->cc, NULL);
362  mutt_addr_write(tmp, sizeof(tmp), e->cc, true);
364  }
365  else
366  mutt_addrlist_to_intl(e->cc, NULL);
367  addch('\n');
368  }
369 
370  if (C_Askbcc || force)
371  {
372  addstr("Bcc: ");
373  tmp[0] = '\0';
375  mutt_addr_write(tmp, sizeof(tmp), e->bcc, false);
376  if (mutt_enter_string(tmp, sizeof(tmp), 5, MUTT_COMP_NO_FLAGS) == 0)
377  {
378  mutt_addr_free(&e->bcc);
379  e->bcc = mutt_addr_parse_list2(e->bcc, tmp);
380  e->bcc = mutt_expand_aliases(e->bcc);
381  mutt_addrlist_to_intl(e->bcc, NULL);
382  tmp[0] = '\0';
383  mutt_addr_write(tmp, sizeof(tmp), e->bcc, true);
385  }
386  else
387  mutt_addrlist_to_intl(e->bcc, NULL);
388  addch('\n');
389  }
390 }
struct Address * mutt_addr_parse_list2(struct Address *p, const char *s)
Parse a list of email addresses.
Definition: address.c:641
struct Address * to
Definition: envelope.h:42
int mutt_addrlist_to_local(struct Address *a)
Convert an Address list from Punycode.
Definition: address.c:1290
#define MUTT_COMP_NO_FLAGS
No flags are set.
Definition: mutt.h:61
size_t mutt_addr_write(char *buf, size_t buflen, struct Address *addr, bool display)
Write an Address to a buffer.
Definition: address.c:1184
struct Address * bcc
Definition: envelope.h:44
int mutt_addrlist_to_intl(struct Address *a, char **err)
Convert an Address list to Punycode.
Definition: address.c:1249
size_t mutt_str_strfcpy(char *dest, const char *src, size_t dsize)
Copy a string into a buffer (guaranteeing NUL-termination)
Definition: string.c:753
void mutt_str_replace(char **p, const char *s)
Replace one string with another.
Definition: string.c:456
int mutt_window_mvaddstr(struct MuttWindow *win, int row, int col, const char *str)
Move the cursor and write a fixed string to a Window.
Definition: mutt_window.c:190
int mutt_window_move(struct MuttWindow *win, int row, int col)
Move the cursor in a Window.
Definition: mutt_window.c:162
char * subject
Definition: envelope.h:50
struct Address * mutt_expand_aliases(struct Address *a)
Expand aliases in a List of Addresses.
Definition: alias.c:298
int mutt_enter_string(char *buf, size_t buflen, int col, CompletionFlags flags)
Ask the user for a string.
Definition: enter.c:145
void mutt_addr_free(struct Address **p)
Free a list of Addresses.
Definition: address.c:451
struct MuttWindow * MuttMessageWindow
Message Window.
Definition: mutt_window.c:41
WHERE bool C_Askbcc
Config: Ask the user for the blind-carbon-copy recipients.
Definition: globals.h:197
WHERE bool C_Askcc
Config: Ask the user for the carbon-copy recipients.
Definition: globals.h:198
struct Address * cc
Definition: envelope.h:43

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int mutt_builtin_editor ( const char *  path,
struct Email msg,
struct Email cur 
)

Show the user the built-in editor.

Parameters
pathFile to read
msgNew Email
curCurrent Email
Return values
0Success
-1Error

Definition at line 400 of file edit.c.

401 {
402  char **buf = NULL;
403  int bufmax = 0, buflen = 0;
404  char tmp[1024];
405  bool abort = false;
406  bool done = false;
407  char *p = NULL;
408 
409  scrollok(stdscr, true);
410 
411  be_edit_header(msg->env, false);
412 
413  addstr(_("(End message with a . on a line by itself)\n"));
414 
415  buf = be_snarf_file(path, buf, &bufmax, &buflen, false);
416 
417  tmp[0] = '\0';
418  while (!done)
419  {
420  if (mutt_enter_string(tmp, sizeof(tmp), 0, MUTT_COMP_NO_FLAGS) == -1)
421  {
422  tmp[0] = '\0';
423  continue;
424  }
425  addch('\n');
426 
427  if (C_Escape && (tmp[0] == C_Escape[0]) && (tmp[1] != C_Escape[0]))
428  {
429  /* remove trailing whitespace from the line */
430  p = tmp + mutt_str_strlen(tmp) - 1;
431  while ((p >= tmp) && IS_SPACE(*p))
432  *p-- = '\0';
433 
434  p = tmp + 2;
435  SKIPWS(p);
436 
437  switch (tmp[1])
438  {
439  case '?':
440  addstr(_(EditorHelp1));
441  addstr(_(EditorHelp2));
442  break;
443  case 'b':
444  msg->env->bcc = mutt_addr_parse_list2(msg->env->bcc, p);
445  msg->env->bcc = mutt_expand_aliases(msg->env->bcc);
446  break;
447  case 'c':
448  msg->env->cc = mutt_addr_parse_list2(msg->env->cc, p);
449  msg->env->cc = mutt_expand_aliases(msg->env->cc);
450  break;
451  case 'h':
452  be_edit_header(msg->env, true);
453  break;
454  case 'F':
455  case 'f':
456  case 'm':
457  case 'M':
458  if (Context)
459  {
460  if (!*p && cur)
461  {
462  /* include the current message */
463  p = tmp + mutt_str_strlen(tmp) + 1;
464  snprintf(tmp + mutt_str_strlen(tmp),
465  sizeof(tmp) - mutt_str_strlen(tmp), " %d", cur->msgno + 1);
466  }
467  buf = be_include_messages(p, buf, &bufmax, &buflen, (tolower(tmp[1]) == 'm'),
468  (isupper((unsigned char) tmp[1])));
469  }
470  else
471  addstr(_("No mailbox.\n"));
472  break;
473  case 'p':
474  addstr("-----\n");
475  addstr(_("Message contains:\n"));
476  be_print_header(msg->env);
477  for (int i = 0; i < buflen; i++)
478  addstr(buf[i]);
479  /* L10N: This entry is shown AFTER the message content,
480  not IN the middle of the content.
481  So it doesn't mean "(message will continue)"
482  but means "(press any key to continue using neomutt)". */
483  addstr(_("(continue)\n"));
484  break;
485  case 'q':
486  done = true;
487  break;
488  case 'r':
489  if (*p)
490  {
491  mutt_str_strfcpy(tmp, p, sizeof(tmp));
492  mutt_expand_path(tmp, sizeof(tmp));
493  buf = be_snarf_file(tmp, buf, &bufmax, &buflen, true);
494  }
495  else
496  addstr(_("missing filename.\n"));
497  break;
498  case 's':
499  mutt_str_replace(&msg->env->subject, p);
500  break;
501  case 't':
502  msg->env->to = mutt_addr_parse_list(msg->env->to, p);
503  msg->env->to = mutt_expand_aliases(msg->env->to);
504  break;
505  case 'u':
506  if (buflen)
507  {
508  buflen--;
509  mutt_str_strfcpy(tmp, buf[buflen], sizeof(tmp));
510  tmp[mutt_str_strlen(tmp) - 1] = '\0';
511  FREE(&buf[buflen]);
512  buf[buflen] = NULL;
513  continue;
514  }
515  else
516  addstr(_("No lines in message.\n"));
517  break;
518 
519  case 'e':
520  case 'v':
521  if (be_barf_file(path, buf, buflen) == 0)
522  {
523  const char *tag = NULL;
524  char *err = NULL;
525  be_free_memory(buf, buflen);
526  buf = NULL;
527  bufmax = 0;
528  buflen = 0;
529 
530  if (C_EditHeaders)
531  {
532  mutt_env_to_local(msg->env);
533  mutt_edit_headers(NONULL(C_Visual), path, msg, NULL, 0);
534  if (mutt_env_to_intl(msg->env, &tag, &err))
535  printw(_("Bad IDN in '%s': '%s'"), tag, err);
536  /* tag is a statically allocated string and should not be freed */
537  FREE(&err);
538  }
539  else
541 
542  buf = be_snarf_file(path, buf, &bufmax, &buflen, false);
543 
544  addstr(_("(continue)\n"));
545  }
546  break;
547  case 'w':
548  be_barf_file(*p ? p : path, buf, buflen);
549  break;
550  case 'x':
551  abort = true;
552  done = true;
553  break;
554  default:
555  printw(_("%s: unknown editor command (~? for help)\n"), tmp);
556  break;
557  }
558  }
559  else if (mutt_str_strcmp(".", tmp) == 0)
560  done = true;
561  else
562  {
563  mutt_str_strcat(tmp, sizeof(tmp), "\n");
564  if (buflen == bufmax)
565  mutt_mem_realloc(&buf, sizeof(char *) * (bufmax += 25));
566  buf[buflen++] = mutt_str_strdup(tmp[1] == '~' ? tmp + 1 : tmp);
567  }
568 
569  tmp[0] = '\0';
570  }
571 
572  if (!abort)
573  be_barf_file(path, buf, buflen);
574  be_free_memory(buf, buflen);
575 
576  return abort ? -1 : 0;
577 }
The "current" mailbox.
Definition: context.h:38
#define NONULL(x)
Definition: string2.h:36
struct Address * mutt_addr_parse_list2(struct Address *p, const char *s)
Parse a list of email addresses.
Definition: address.c:641
struct Address * to
Definition: envelope.h:42
#define _(a)
Definition: message.h:28
size_t mutt_str_strlen(const char *a)
Calculate the length of a string, safely.
Definition: string.c:669
int mutt_env_to_intl(struct Envelope *env, const char **tag, char **err)
Convert an Envelope&#39;s Address fields to Punycode format.
Definition: envelope.c:244
char * mutt_expand_path(char *buf, size_t buflen)
Create the canonical path.
Definition: muttlib.c:127
static void be_edit_header(struct Envelope *e, bool force)
Edit the message headers.
Definition: edit.c:310
WHERE bool C_EditHeaders
Config: Let the user edit the email headers whilst editing an email.
Definition: globals.h:208
#define MUTT_COMP_NO_FLAGS
No flags are set.
Definition: mutt.h:61
struct Envelope * env
envelope information
Definition: email.h:92
#define SKIPWS(ch)
Definition: string2.h:46
void mutt_mem_realloc(void *ptr, size_t size)
Resize a block of memory on the heap.
Definition: memory.c:121
struct Address * bcc
Definition: envelope.h:44
static char ** be_snarf_file(const char *path, char **buf, int *max, int *len, bool verbose)
Read a file into a buffer.
Definition: edit.c:137
size_t mutt_str_strfcpy(char *dest, const char *src, size_t dsize)
Copy a string into a buffer (guaranteeing NUL-termination)
Definition: string.c:753
void mutt_str_replace(char **p, const char *s)
Replace one string with another.
Definition: string.c:456
static char ** be_include_messages(char *msg, char **buf, int *bufmax, int *buflen, int pfx, int inc_hdrs)
Gather the contents of some messages.
Definition: edit.c:209
#define IS_SPACE(ch)
Definition: string2.h:37
char * mutt_str_strcat(char *buf, size_t buflen, const char *s)
Concatenate two strings.
Definition: string.c:398
void mutt_env_to_local(struct Envelope *env)
Convert an Envelope&#39;s Address fields to local format.
Definition: envelope.c:206
static char * EditorHelp2
Definition: edit.c:71
char * C_Escape
Config: Escape character to use for functions in the built-in editor.
Definition: edit.c:55
char * subject
Definition: envelope.h:50
struct Address * mutt_expand_aliases(struct Address *a)
Expand aliases in a List of Addresses.
Definition: alias.c:298
static void be_print_header(struct Envelope *env)
Print a message Header.
Definition: edit.c:268
char * mutt_str_strdup(const char *str)
Copy a string, safely.
Definition: string.c:380
void mutt_edit_headers(const char *editor, const char *body, struct Email *msg, char *fcc, size_t fcclen)
Let the user edit the message header and body.
Definition: mutt_header.c:171
int mutt_enter_string(char *buf, size_t buflen, int col, CompletionFlags flags)
Ask the user for a string.
Definition: enter.c:145
#define FREE(x)
Definition: memory.h:40
struct Address * mutt_addr_parse_list(struct Address *top, const char *s)
Parse a list of email addresses.
Definition: address.c:473
void mutt_edit_file(const char *editor, const char *file)
Let the user edit a file.
Definition: curs_lib.c:308
int mutt_str_strcmp(const char *a, const char *b)
Compare two strings, safely.
Definition: string.c:618
static int be_barf_file(const char *path, char **buf, int buflen)
Write a buffer to a file.
Definition: edit.c:170
struct Address * cc
Definition: envelope.h:43
int msgno
number displayed to the user
Definition: email.h:89
WHERE char * C_Visual
Config: Editor to use when &#39;~v&#39; is given in the built-in editor.
Definition: globals.h:146
static char * EditorHelp1
Definition: edit.c:60
static void be_free_memory(char **buf, int buflen)
Free an array of buffers.
Definition: edit.c:192

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Variable Documentation

char* C_Escape

Config: Escape character to use for functions in the built-in editor.

Definition at line 55 of file edit.c.

char* EditorHelp1
static
Initial value:
=
N_("~~ insert a line beginning with a single ~\n"
"~b users add users to the Bcc: field\n"
"~c users add users to the Cc: field\n"
"~f messages include messages\n"
"~F messages same as ~f, except also include headers\n"
"~h edit the message header\n"
"~m messages include and quote messages\n"
"~M messages same as ~m, except include headers\n"
"~p print the message\n")
#define N_(a)
Definition: message.h:32

Definition at line 60 of file edit.c.

char* EditorHelp2
static
Initial value:
=
N_("~q write file and quit editor\n"
"~r file read a file into the editor\n"
"~t users add users to the To: field\n"
"~u recall the previous line\n"
"~v edit message with the $visual editor\n"
"~w file write message to file\n"
"~x abort changes and quit editor\n"
"~? this message\n"
". on a line by itself ends input\n")
#define N_(a)
Definition: message.h:32

Definition at line 71 of file edit.c.