Blame view

mail/folders.c 1.41 KB
1
/* GNU Mailutils -- a suite of utilities for electronic mail
2 3
   Copyright (C) 1999, 2001, 2002, 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, write to the Free Software
17 18
   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
   MA 02110-1301 USA */
19 20 21 22 23 24 25 26

#include "mail.h"

/*
 * folders
 */

int
27
mail_folders (int argc MU_ARG_UNUSED, char **argv MU_ARG_UNUSED)
28
{
29 30
  char *path;

31
  if (mailvar_get (&path, "folder", mailvar_type_string, 1))
Sergey Poznyakoff authored
32
    return 1;
33

34 35 36 37 38
  if (path[0] != '/' && path[0] != '~')
    {
      char *tmp = alloca (strlen (path) + 3);
      if (!tmp)
	{
39
	  util_error (_("Not enough memory"));
40 41 42 43 44 45 46 47 48 49 50
	  return 1;
	} 

      tmp[0] = '~';
      tmp[1] = '/';
      strcpy (tmp + 2, path);
      path = tmp;
    }
  
  path = util_fullpath (path);
  
51
  util_do_command("! %s '%s'", getenv ("LISTER"), path);
52
  free (path);
53

54
  return 0;
55
}