Blame view

mail/eq.c 1.44 KB
1
/* GNU Mailutils -- a suite of utilities for electronic mail
2 3
   Copyright (C) 1999, 2001, 2002, 2003, 2005, 2007, 2009, 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 24 25 26

#include "mail.h"

/*
 * =
 */

int
mail_eq (int argc, char **argv)
{
27
  msgset_t *list = NULL;
28 29
  size_t n;

30 31 32
  switch (argc)
    {
    case 1:
33 34
      n = get_cursor ();
      if (n == 0)
35
        mu_error (_("No applicable message"));
36
      else
37
        mu_printf ("%lu\n", (unsigned long) n);
38 39 40
      break;

    case 2:
41
      if (msgset_parse (argc, argv, MSG_NODELETED, &list) == 0)
42 43 44
	{
	  if (list->msg_part[0] <= total)
	    {
45
	      set_cursor (list->msg_part[0]);
46
	      mu_printf ("%lu\n",
47
				(unsigned long) list->msg_part[0]);
48 49 50 51 52 53 54 55 56 57 58
	    }
	  else
	    util_error_range (list->msg_part[0]);
	  msgset_free (list);
	}
      break;

    default:
      return 1;
    }
  
59 60
  return 0;
}