Blame view

mail/eq.c 1.45 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 35 36
      n = get_cursor ();
      if (n == 0)
        util_error (_("No applicable message"));
      else
37
        fprintf (ofile, "%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
	      fprintf (ofile, "%lu\n", (unsigned long) list->msg_part[0]);
47 48 49 50 51 52 53 54 55 56 57
	    }
	  else
	    util_error_range (list->msg_part[0]);
	  msgset_free (list);
	}
      break;

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