Blame view

mail/visual.c 1.25 KB
1
/* GNU Mailutils -- a suite of utilities for electronic mail
2 3
   Copyright (C) 1999, 2001, 2005, 2007, 2010 Free Software Foundation,
   Inc.
4

5
   GNU Mailutils is free software; you can redistribute it and/or modify
6
   it under the terms of the GNU General Public License as published by
7
   the Free Software Foundation; either version 3, or (at your option)
8 9
   any later version.

10
   GNU Mailutils is distributed in the hope that it will be useful,
11 12 13 14 15
   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
16
   along with GNU Mailutils.  If not, see <http://www.gnu.org/licenses/>. */
17 18 19 20 21 22 23

#include "mail.h"

/*
 * v[isual] [msglist]
 */

24
static int
25
visual0 (msgset_t *mspec, mu_message_t msg, void *data)
26 27 28 29 30 31 32 33 34 35
{
  char *file = mu_tempname (NULL);

  util_do_command ("copy %s", file); 
  util_do_command ("shell %s %s", getenv("VISUAL"), file);

  remove (file);
  free (file);

  /* Mark as read */
36
  util_mark_read (msg);
37

38
  set_cursor (mspec->msg_part[0]);
39 40 41 42
  
  return 0;
}

43 44 45
int
mail_visual (int argc, char **argv)
{
46
  return util_foreach_msg (argc, argv, MSG_NODELETED, visual0, NULL);
47
}
48