NeoMutt  2018-07-16 +952-a2da0a
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 "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 *f, 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 * 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 *  f,
char **  buf,
int *  bufmax,
int *  buflen,
LOFF_T  offset,
int  bytes,
int  prefix 
)
static

Read data from a file into a buffer.

Parameters
[in]fFile 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 IndentString
Return values
ptrPointer to allocated buffer

Definition at line 92 of file edit.c.

94 {
95  char tmp[HUGE_STRING];
96  char *p = tmp;
97  int tmplen = sizeof(tmp);
98 
99  tmp[sizeof(tmp) - 1] = '\0';
100  if (prefix)
101  {
102  mutt_str_strfcpy(tmp, IndentString, sizeof(tmp));
103  tmplen = mutt_str_strlen(tmp);
104  p = tmp + tmplen;
105  tmplen = sizeof(tmp) - tmplen;
106  }
107 
108  fseeko(f, offset, SEEK_SET);
109  while (bytes > 0)
110  {
111  if (!fgets(p, tmplen - 1, f))
112  break;
113  bytes -= mutt_str_strlen(p);
114  if (*bufmax == *buflen)
115  mutt_mem_realloc(&buf, sizeof(char *) * (*bufmax += 25));
116  buf[(*buflen)++] = mutt_str_strdup(tmp);
117  }
118  if (buf && *bufmax == *buflen)
119  { /* Do not smash memory past buf */
120  mutt_mem_realloc(&buf, sizeof(char *) * (++*bufmax));
121  }
122  if (buf)
123  buf[*buflen] = NULL;
124  return buf;
125 }
size_t mutt_str_strlen(const char *a)
Calculate the length of a string, safely.
Definition: string.c:663
void mutt_mem_realloc(void *ptr, size_t size)
Resize a block of memory on the heap.
Definition: memory.c:124
#define HUGE_STRING
Definition: string2.h:37
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:742
char * mutt_str_strdup(const char *str)
Copy a string, safely.
Definition: string.c:384
WHERE char * IndentString
Config: String used to indent &#39;reply&#39; text.
Definition: globals.h:138

+ 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 136 of file edit.c.

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

+ 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
pathPath to write to
bufBuffer to read from
buflenLength of buffer
Return values
0Success
-1Error

Definition at line 169 of file edit.c.

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

+ Here is the caller graph for this function:

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

Free an array of buffers.

Parameters
bufBuffer to free
buflenNumber of buffers to free

Definition at line 191 of file edit.c.

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

+ 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[LONG_STRING];
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 (Attribution)
227  {
228  setlocale(LC_TIME, NONULL(AttributionLocale));
229  mutt_make_string(tmp, sizeof(tmp) - 1, Attribution, Context,
230  Context->mailbox->hdrs[n]);
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->hdrs[n]->content->length;
243  if (inc_hdrs)
244  {
245  offset = Context->mailbox->hdrs[n]->offset;
246  bytes += Context->mailbox->hdrs[n]->content->offset - offset;
247  }
248  else
249  offset = Context->mailbox->hdrs[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 }
The "current" mailbox.
Definition: context.h:36
#define NONULL(x)
Definition: string2.h:39
int mutt_str_atoi(const char *str, int *dst)
Convert ASCII string to an integer.
Definition: string.c:262
struct Body * content
list of MIME parts
Definition: email.h:92
LOFF_T offset
offset where the actual data begins
Definition: body.h:45
#define _(a)
Definition: message.h:28
#define LONG_STRING
Definition: string2.h:36
struct Email ** hdrs
Definition: mailbox.h:93
struct Mailbox * mailbox
Definition: context.h:50
#define mutt_make_string(A, B, C, D, E)
Definition: hdrline.h:55
void mutt_mem_realloc(void *ptr, size_t size)
Resize a block of memory on the heap.
Definition: memory.c:124
LOFF_T length
length (in bytes) of attachment
Definition: body.h:46
LOFF_T offset
where in the stream does this message begin?
Definition: email.h:85
char * mutt_str_strdup(const char *str)
Copy a string, safely.
Definition: string.c:384
static char ** be_snarf_data(FILE *f, char **buf, int *bufmax, int *buflen, LOFF_T offset, int bytes, int prefix)
Read data from a file into a buffer.
Definition: edit.c:92
WHERE char * Attribution
Config: Message to start a reply, "On DATE, PERSON wrote:".
Definition: globals.h:103
WHERE char * AttributionLocale
Config: Locale for dates in the attribution message.
Definition: globals.h:104

+ 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[HUGE_STRING];
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:36
size_t mutt_addr_write(char *buf, size_t buflen, struct Address *addr, bool display)
Write an Address to a buffer.
Definition: address.c:1146
#define HUGE_STRING
Definition: string2.h:37
struct Address * bcc
Definition: envelope.h:38
char * subject
Definition: envelope.h:44
struct Address * cc
Definition: envelope.h:37

+ 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[HUGE_STRING];
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, 0) == 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, 0) == 0)
345  mutt_str_replace(&e->subject, tmp);
346  addch('\n');
347  }
348 
349  if ((!e->cc && 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, 0) == 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 (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, 0) == 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:630
struct Address * to
Definition: envelope.h:36
int mutt_addrlist_to_intl(struct Address *a, char **err)
Convert an Address list to Punycode.
Definition: address.c:1208
size_t mutt_addr_write(char *buf, size_t buflen, struct Address *addr, bool display)
Write an Address to a buffer.
Definition: address.c:1146
WHERE bool Askcc
Config: Ask the user for the carbon-copy recipients.
Definition: globals.h:202
#define HUGE_STRING
Definition: string2.h:37
int mutt_enter_string(char *buf, size_t buflen, int col, int flags)
Ask the user for a string.
Definition: enter.c:144
int mutt_addrlist_to_local(struct Address *a)
Convert an Address list from Punycode.
Definition: address.c:1249
struct Address * bcc
Definition: envelope.h:38
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:742
void mutt_str_replace(char **p, const char *s)
Replace one string with another.
Definition: string.c:460
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:44
struct Address * mutt_expand_aliases(struct Address *a)
Expand aliases in a List of Addresses.
Definition: alias.c:296
struct MuttWindow * MuttMessageWindow
Message Window.
Definition: mutt_window.c:41
WHERE bool Askbcc
Config: Ask the user for the blind-carbon-copy recipients.
Definition: globals.h:201
void mutt_addr_free(struct Address **p)
Free a list of Addresses.
Definition: address.c:446
struct Address * cc
Definition: envelope.h:37

+ 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
msgHeader of new message
curHeader of current message
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[LONG_STRING];
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, 0) == -1)
421  {
422  tmp[0] = '\0';
423  continue;
424  }
425  addch('\n');
426 
427  if (Escape && tmp[0] == Escape[0] && tmp[1] != Escape[0])
428  {
429  /* remove trailing whitespace from the line */
430  p = tmp + mutt_str_strlen(tmp) - 1;
431  while (p >= tmp && ISSPACE(*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:
480  This entry is shown AFTER the message content,
481  not IN the middle of the content.
482  So it doesn't mean "(message will continue)"
483  but means "(press any key to continue using neomutt)". */
484  addstr(_("(continue)\n"));
485  break;
486  case 'q':
487  done = true;
488  break;
489  case 'r':
490  if (*p)
491  {
492  mutt_str_strfcpy(tmp, p, sizeof(tmp));
493  mutt_expand_path(tmp, sizeof(tmp));
494  buf = be_snarf_file(tmp, buf, &bufmax, &buflen, true);
495  }
496  else
497  addstr(_("missing filename.\n"));
498  break;
499  case 's':
500  mutt_str_replace(&msg->env->subject, p);
501  break;
502  case 't':
503  msg->env->to = mutt_addr_parse_list(msg->env->to, p);
504  msg->env->to = mutt_expand_aliases(msg->env->to);
505  break;
506  case 'u':
507  if (buflen)
508  {
509  buflen--;
510  mutt_str_strfcpy(tmp, buf[buflen], sizeof(tmp));
511  tmp[mutt_str_strlen(tmp) - 1] = '\0';
512  FREE(&buf[buflen]);
513  buf[buflen] = NULL;
514  continue;
515  }
516  else
517  addstr(_("No lines in message.\n"));
518  break;
519 
520  case 'e':
521  case 'v':
522  if (be_barf_file(path, buf, buflen) == 0)
523  {
524  const char *tag = NULL;
525  char *err = NULL;
526  be_free_memory(buf, buflen);
527  buf = NULL;
528  bufmax = 0;
529  buflen = 0;
530 
531  if (EditHeaders)
532  {
533  mutt_env_to_local(msg->env);
534  mutt_edit_headers(NONULL(Visual), path, msg, NULL, 0);
535  if (mutt_env_to_intl(msg->env, &tag, &err))
536  printw(_("Bad IDN in '%s': '%s'"), tag, err);
537  /* tag is a statically allocated string and should not be freed */
538  FREE(&err);
539  }
540  else
541  mutt_edit_file(NONULL(Visual), path);
542 
543  buf = be_snarf_file(path, buf, &bufmax, &buflen, false);
544 
545  addstr(_("(continue)\n"));
546  }
547  break;
548  case 'w':
549  be_barf_file(*p ? p : path, buf, buflen);
550  break;
551  case 'x':
552  abort = true;
553  done = true;
554  break;
555  default:
556  printw(_("%s: unknown editor command (~? for help)\n"), tmp);
557  break;
558  }
559  }
560  else if (mutt_str_strcmp(".", tmp) == 0)
561  done = true;
562  else
563  {
564  mutt_str_strcat(tmp, sizeof(tmp), "\n");
565  if (buflen == bufmax)
566  mutt_mem_realloc(&buf, sizeof(char *) * (bufmax += 25));
567  buf[buflen++] = mutt_str_strdup(tmp[1] == '~' ? tmp + 1 : tmp);
568  }
569 
570  tmp[0] = '\0';
571  }
572 
573  if (!abort)
574  be_barf_file(path, buf, buflen);
575  be_free_memory(buf, buflen);
576 
577  return abort ? -1 : 0;
578 }
The "current" mailbox.
Definition: context.h:36
struct Address * mutt_addr_parse_list2(struct Address *p, const char *s)
Parse a list of email addresses.
Definition: address.c:630
#define NONULL(x)
Definition: string2.h:39
struct Address * to
Definition: envelope.h:36
#define _(a)
Definition: message.h:28
size_t mutt_str_strlen(const char *a)
Calculate the length of a string, safely.
Definition: string.c:663
#define LONG_STRING
Definition: string2.h:36
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:235
char * mutt_expand_path(char *buf, size_t buflen)
Create the canonical path.
Definition: muttlib.c:157
static void be_edit_header(struct Envelope *e, bool force)
Edit the message headers.
Definition: edit.c:310
struct Envelope * env
envelope information
Definition: email.h:91
#define ISSPACE(c)
Definition: string2.h:40
void mutt_mem_realloc(void *ptr, size_t size)
Resize a block of memory on the heap.
Definition: memory.c:124
int mutt_enter_string(char *buf, size_t buflen, int col, int flags)
Ask the user for a string.
Definition: enter.c:144
struct Address * bcc
Definition: envelope.h:38
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:136
struct Address * mutt_addr_parse_list(struct Address *top, const char *s)
Parse a list of email addresses.
Definition: address.c:465
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:742
void mutt_str_replace(char **p, const char *s)
Replace one string with another.
Definition: string.c:460
char * Escape
Config: Escape character to use for functions in the built-in editor.
Definition: edit.c:54
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
char * mutt_str_strcat(char *buf, size_t buflen, const char *s)
Concatenate two strings.
Definition: string.c:402
void mutt_env_to_local(struct Envelope *env)
Convert an Envelope&#39;s Address fields to local format.
Definition: envelope.c:200
WHERE char * Visual
Config: Editor to use when &#39;~v&#39; is given in the built-in editor.
Definition: globals.h:151
static char * EditorHelp2
Definition: edit.c:70
char * subject
Definition: envelope.h:44
struct Address * mutt_expand_aliases(struct Address *a)
Expand aliases in a List of Addresses.
Definition: alias.c:296
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:384
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:186
#define FREE(x)
Definition: memory.h:46
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:612
static int be_barf_file(const char *path, char **buf, int buflen)
Write a buffer to a file.
Definition: edit.c:169
WHERE bool EditHeaders
Config: Let the user edit the email headers whilst editing an email.
Definition: globals.h:212
struct Address * cc
Definition: envelope.h:37
int msgno
number displayed to the user
Definition: email.h:88
#define SKIPWS(c)
Definition: string2.h:49
static char * EditorHelp1
Definition: edit.c:59
static void be_free_memory(char **buf, int buflen)
Free an array of buffers.
Definition: edit.c:191

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Variable Documentation

char* Escape

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

Definition at line 54 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 59 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 70 of file edit.c.