Commit 73895a52 73895a52221e74ddc2f5130eb6798ed7b24b250a by Alain Magloire

The exercise is to crank up the warnings from gcc and cleanup

	the code based on the hints generated by the compiler.  The usual
	errors:
	- signed vs unsigned, signedness or unsignedness problems.
	- printf() wrong formats
	- wrong prototypes declarations
	- and different buglets
	- "const char *" vs "char *"
	- unused variables
	- unused arguments.  Tell the compiler by typecasting to void
	 (void)var.
	- Some variable when shadowed, meaning in another block variable
	of the same name where reused.
	- atoi() is not an ANSI C function, we should use strtol().

	Changes to comply to GNU coding standards, and nuke trailing spaces.

	* mail/alias.c (alia_lookup): No prototypes and scope static.
	(hash_num, max_rehash, aliases): Scope static and unsigned.
	(hash): unsigned.
	(alias_rehash): i unsigned.
	(alias_lookup_or_install): slot variable unused.
	(alias_destroy): unsigned.
	* mail/copy.c (mail_copy0): fprintf wrong format.
	* mail/decode.c: dislay_message change prototype.
	(mail_decode): Cast when calling util_msgset_iterate().
	(display_message): Prototype change.
	(display_headers): unsigned issues.
	* mail/delete.c: Buglet was caling mail_delete0() instead of
	mail_delete.
	* mail/eq.c: Unused arguments.
	* mail/exit.c: Unused arguments.
	* mail/folders.c: Unused arguments.
	* mail/followup.c: Unused variables.
	* mail/from.c (mail_from): variable buffer was shadowing use variable
	name instead. snprintf() formatting issues.
* mail/headers.c: Unsigned issues.
	* mail/if.c: Unused arguments.
	* mail/inc.c: Unused arguments.
	* mail/list.c: Use const char *.
	* mail/mail.c: options[], argp[] initialised all elements.
	(mail_cmdline): Unused arguments.
	(main): Unsigned issues.
	(mail_warranty): Unused arguments.
	* mail/mail.h: function_t with complete prototype this necessary
	to let the compiler do proper checks.
	struct mail_command_entry rearrange the fields and a new field
	int (*escfunc) __P ((int, char **, struct send_environ *));
	Indentation rearrangements.
	* mail/mailline.c (ml_getc): Scope is static now.
	typecast for const char *.
	(ml_reread): Typecast.
	* mail/msgset.y: Declare yyerror() and yylex().
	(msgset_select): Change of prototpe to let the compiler do checks.
	(selec_sender): Unsused arguments.
	* mail/pipe.c: Rename variable pipe to tube.
	* mail/print.c: Unsigness and some shadow variables.
	* mail/quit.c: Shadow variables.
	* mail/send.c: Typecast when necessary. Use the second (escfunc)
	field now. Some shadow variables.
	* mail/shell.c: Unsigned.
	* mail/table.c: Readjust the table to correspond to the signature
	change in mail.h.
	* mail/tag.c: Prototype change.
	* mail/util.c (util_msglist_esccmd): New function.
	(util_find_entry): Prototype change.  And check return value
	of getenv().
	(util_screen_lines): Change atoi() to strtoul().
	(util_screen_columns): Change atoi() to strtoul().
	(util_find_env): Signedness.
	(util_fullpath): Prototype changed(const).
	(util_slist_to_string):Protorype changed (const).
	(util_strcat) :Protorype changed (const).
	(util_tempfile): const.
	* mail/var.c: Unsignedness, Unused arguments.
	(var_quote):  Use new function util_msglist_esccmd().
	* mail/version.c: Unused arguments.
	* mail/write.c: printf formats.
	* mail/z.c: Signedness.
1 parent 068a9ac3
......@@ -17,9 +17,10 @@
#include "mail.h"
static void alias_print __P((char *name));
static void alias_print_group __P((char *name, list_t list));
static int alias_create __P((char *name, list_t *plist));
static void alias_print __P ((char *name));
static void alias_print_group __P ((char *name, list_t list));
static int alias_create __P ((char *name, list_t *plist));
static int alias_lookup __P ((char *name, list_t *plist));
/*
* a[lias] [alias [address...]]
......@@ -36,7 +37,7 @@ mail_alias (int argc, char **argv)
else
{
list_t list;
if (alias_create(argv[1], &list))
return 1;
......@@ -60,16 +61,16 @@ struct _alias
pair of them grows exponentially, starting from 64.
Hopefully no one will need more than 32797 aliases, and even if
someone will, it is easy enough to add more numbers to the sequence. */
size_t hash_size[] =
static unsigned int hash_size[] =
{
37, 101, 229, 487, 1009, 2039, 4091, 8191, 16411, 32797,
};
/* Maximum number of re-hashes: */
int max_rehash = sizeof (hash_size) / sizeof (hash_size[0]);
alias_t *aliases; /* Table of aliases */
size_t hash_num; /* Index to hash_size table */
static unsigned int max_rehash = sizeof (hash_size) / sizeof (hash_size[0]);
static alias_t *aliases; /* Table of aliases */
static unsigned int hash_num; /* Index to hash_size table */
static unsigned hash __P((char *name));
static unsigned int hash __P((char *name));
static int alias_rehash __P((void));
static alias_t *alias_lookup_or_install __P((char *name, int install));
static void alias_print_group __P((char *name, list_t list));
......@@ -91,8 +92,8 @@ alias_rehash()
{
alias_t *old_aliases = aliases;
alias_t *ap;
int i;
unsigned int i;
if (++hash_num >= max_rehash)
{
util_error("alias hash table full");
......@@ -120,8 +121,7 @@ alias_t *
alias_lookup_or_install(char *name, int install)
{
unsigned i, pos;
alias_t *slot = NULL;
if (!aliases)
{
if (install)
......@@ -144,20 +144,20 @@ alias_lookup_or_install(char *name, int install)
if (i == pos)
break;
}
if (!install)
return NULL;
if (aliases[i].name == NULL)
return &aliases[i];
if (alias_rehash())
return NULL;
return alias_lookup_or_install(name, install);
}
int
static int
alias_lookup(char *name, list_t *plist)
{
alias_t *ap = alias_lookup_or_install(name, 0);
......@@ -174,11 +174,11 @@ alias_print(char *name)
{
if (!name)
{
int i;
unsigned int i;
if (!aliases)
return;
for (i = 0; i < hash_size[hash_num]; i++)
{
if (aliases[i].name)
......@@ -214,12 +214,12 @@ alias_create(char *name, list_t *plist)
if (!ap->name)
return 1;
}
*plist = ap->list;
return 0;
}
void
alias_print_group(char *name, list_t list)
{
......@@ -231,7 +231,7 @@ alias_print_group(char *name, list_t list)
void
alias_destroy(char *name)
{
int i, j, r;
unsigned int i, j, r;
alias_t *alias = alias_lookup_or_install(name, 0);
if (!alias)
return;
......@@ -260,9 +260,8 @@ char *
alias_expand(char *name)
{
list_t list;
if (!alias_lookup(name, &list))
return strdup (name);
return util_slist_to_string(list, ",");
}
......
......@@ -89,7 +89,7 @@ mail_copy0 (int argc, char **argv, int mark)
}
}
fprintf (ofile, "\"%s\" %3ld/%-5ld\n", filename, total_lines, total_size);
fprintf (ofile, "\"%s\" %3d/%-5d\n", filename, total_lines, total_size);
mailbox_close (mbx);
mailbox_destroy (&mbx);
......
......@@ -29,8 +29,7 @@ struct decode_closure
};
static int print_stream __P ((stream_t, FILE *));
static int display_message __P ((message_t, msgset_t *msgset,
struct decode_closure *closure));
static int display_message __P ((message_t, msgset_t *msgset, void *closure));
static int display_message0 __P ((FILE *, message_t, const msgset_t *, int));
static int mailcap_lookup __P ((const char *));
static int get_content_encoding __P ((header_t hdr, char **value));
......@@ -46,24 +45,24 @@ mail_decode (int argc, char **argv)
decode_closure.select_hdr = islower (argv[0][0]);
util_msgset_iterate (msgset, display_message, &decode_closure);
util_msgset_iterate (msgset, display_message, (void *)&decode_closure);
msgset_free (msgset);
return 0;
}
int
display_message (message_t mesg, msgset_t *msgset,
struct decode_closure *closure)
display_message (message_t mesg, msgset_t *msgset, void *arg)
{
FILE *out;
size_t lines = 0;
struct decode_closure *closure = arg;
if (util_isdeleted (msgset->msg_part[0]))
return 1;
message_lines (mesg, &lines);
if ((util_find_env("crt"))->set && lines > util_getlines ())
if ((util_find_env("crt"))->set && (int)lines > util_getlines ())
out = popen (getenv("PAGER"), "w");
else
out = ofile;
......@@ -88,6 +87,8 @@ display_headers (FILE *out, message_t mesg, const msgset_t *msgset,
int select_hdr)
{
header_t hdr = NULL;
(void)msgset;
/* Print the selected headers only. */
if (select_hdr)
{
......@@ -119,15 +120,15 @@ display_headers (FILE *out, message_t mesg, const msgset_t *msgset,
}
}
void
static void
display_part_header (FILE *out, const msgset_t *msgset,
char *type, char *encoding)
{
int size = util_screen_columns () - 3;
int i;
unsigned int i;
fputc ('+', out);
for (i = 0; i <= size; i++)
for (i = 0; (int)i <= size; i++)
fputc ('-', out);
fputc ('+', out);
fputc ('\n', out);
......@@ -141,7 +142,7 @@ display_part_header (FILE *out, const msgset_t *msgset,
fprintf (out, "| Type=%s\n", type);
fprintf (out, "| encoding=%s\n", encoding);
fputc ('+', out);
for (i = 0; i <= size; i++)
for (i = 0; (int)i <= size; i++)
fputc ('-', out);
fputc ('+', out);
fputc ('\n', out);
......@@ -164,7 +165,7 @@ display_message0 (FILE *out, message_t mesg, const msgset_t *msgset,
message_is_multipart (mesg, &ismime);
if (ismime)
{
int j;
unsigned int j;
message_get_num_parts (mesg, &nparts);
......
......@@ -21,8 +21,8 @@
* d[elete] [msglist]
*/
int
mail_delete0 ()
static int
mail_delete0 (void)
{
message_t msg;
attribute_t attr;
......@@ -39,13 +39,14 @@ mail_delete (int argc, char **argv)
int rc = 0;
if (argc > 1)
rc = util_msglist_command (mail_delete0, argc, argv, 0);
rc = util_msglist_command (mail_delete, argc, argv, 0);
else
rc = mail_delete0 ();
/* Reajust the realcursor to no point to the deleted messages. */
if (cursor == realcursor)
{
int here = realcursor;
unsigned int here = realcursor;
do
{
message_t msg;
......
......@@ -24,6 +24,7 @@
int
mail_eq (int argc, char **argv)
{
(void)argc; (void)argv;
fprintf (ofile, "%d\n", realcursor);
return 0;
}
......
......@@ -20,6 +20,7 @@
int
mail_exit (int argc, char **argv)
{
(void)argc; (void)argv;
mailbox_close (mbox);
exit (0);
}
......
......@@ -27,6 +27,8 @@ mail_folders (int argc, char **argv)
char *path;
struct mail_env_entry *env = util_find_env ("folder");
(void)argc; (void)argv;
if (!env->set)
{
util_error("No value set for \"folder\"");
......@@ -36,6 +38,6 @@ mail_folders (int argc, char **argv)
path = util_fullpath(env->value);
util_do_command("! %s %s", getenv("LISTER"), path);
free(path);
return 0;
}
......
......@@ -28,7 +28,6 @@ mail_followup (int argc, char **argv)
message_t msg;
header_t hdr;
char *str;
int i;
msgset_t *msglist, *mp;
struct send_environ env;
int status;
......
......@@ -54,13 +54,13 @@ mail_from (int argc, char **argv)
address_t address = NULL;
if (address_create (&address, from) == 0)
{
char p[128];
char name[128];
size_t len = strlen (from);
*p = '\0';
address_get_personal (address, 1, p, sizeof p, NULL);
if (*p && len)
*name = '\0';
address_get_personal (address, 1, name, sizeof name, NULL);
if (*name && len)
{
strncpy (from, p, len - 1);
strncpy (from, name, len - 1);
from[len - 1] = '\0';
}
else
......@@ -103,7 +103,7 @@ mail_from (int argc, char **argv)
message_size (msg, &m_size);
message_lines (msg, &m_lines);
snprintf (st, sizeof(st), "%3ld/%-5ld", m_lines, m_size);
snprintf (st, sizeof(st), "%3d/%-5d", m_lines, m_size);
/* The "From" field will take a third of the screen.
Subject will take the rest.
......
......@@ -45,13 +45,13 @@ mail_headers (int argc, char **argv)
if (lines < 0)
lines = util_screen_lines ();
if (lines < total)
if ((unsigned int)lines < total)
{
low = list->msg_part[0] - (lines / 2);
if (low < 1)
low = 1;
high = low + lines;
if (high > total)
if ((unsigned int)high > total)
{
high = total;
low = high - lines;
......
......@@ -49,7 +49,7 @@ _cond_push(int val)
_cond_stack = realloc(_cond_stack,
sizeof(_cond_stack[0])*_cond_stack_size);
}
if (!_cond_stack)
{
util_error("not enough memory");
......@@ -68,7 +68,7 @@ _cond_pop()
}
return _cond_stack[--_cond_level];
}
/*
* i[f] s|r|t
* mail-commands
......@@ -131,6 +131,7 @@ int
mail_else (int argc, char **argv)
{
int cond;
(void)argc; (void)argv;
if (_cond_level == 0)
{
util_error("else without matching if");
......@@ -146,6 +147,7 @@ mail_else (int argc, char **argv)
int
mail_endif (int argc, char **argv)
{
(void)argc; (void)argv;
if (_cond_level == 0)
{
util_error("endif without matching if");
......
......@@ -24,6 +24,7 @@
int
mail_inc (int argc, char **argv)
{
(void)argc; (void)argv;
if (!mailbox_is_updated (mbox))
{
mailbox_messages_count (mbox, &total);
......@@ -31,6 +32,6 @@ mail_inc (int argc, char **argv)
}
else
fprintf (ofile, "No new mail for %s\n", mail_whoami());
return 0;
}
......
......@@ -25,10 +25,12 @@
int
mail_list (int argc, char **argv)
{
char *cmd = NULL;
const char *cmd = NULL;
int i = 0, pos = 0, len = 0;
int cols = util_getcols ();
(void)argc; (void)argv;
for (i=0; mail_command_table[i].shortname != 0; i++)
{
len = strlen (mail_command_table[i].longname);
......
......@@ -31,21 +31,21 @@ static char doc[] = "GNU mail -- the standard /bin/mail interface";
static char args_doc[] = "[address...]";
static struct argp_option options[] = {
{"exist", 'e', 0, 0, "Return true if mail exists"},
{"exist", 'e', 0, 0, "Return true if mail exists", 0},
{"file", 'f', "FILE", OPTION_ARG_OPTIONAL,
"Operate on mailbox FILE (default ~/mbox)"},
{"byname", 'F', 0, 0, "Save messages according to sender"},
{"headers", 'H', 0, 0, "Write a header summary and exit"},
{"ignore", 'i', 0, 0, "Ignore interrupts"},
{"norc", 'n', 0, 0, "Do not read the system mailrc file"},
{"nosum", 'N', 0, 0, "Do not display initial header summary"},
{"print", 'p', 0, 0, "Print all mail to standard output"},
{"quit", 'q', 0, 0, "Cause interrupts to terminate program"},
{"read", 'r', 0, 0, "Same as -p"},
{"subject", 's', "SUBJ", 0, "Send a message with a Subject of SUBJ"},
{"to", 't', 0, 0, "Precede message by a list of addresses"},
{"user", 'u', "USER", 0, "Operate on USER's mailbox"},
{ 0 }
"Operate on mailbox FILE (default ~/mbox)", 0},
{"byname", 'F', 0, 0, "Save messages according to sender", 0},
{"headers", 'H', 0, 0, "Write a header summary and exit", 0},
{"ignore", 'i', 0, 0, "Ignore interrupts", 0},
{"norc", 'n', 0, 0, "Do not read the system mailrc file", 0},
{"nosum", 'N', 0, 0, "Do not display initial header summary", 0},
{"print", 'p', 0, 0, "Print all mail to standard output", 0},
{"quit", 'q', 0, 0, "Cause interrupts to terminate program", 0},
{"read", 'r', 0, 0, "Same as -p", 0},
{"subject", 's', "SUBJ", 0, "Send a message with a Subject of SUBJ", 0},
{"to", 't', 0, 0, "Precede message by a list of addresses", 0},
{"user", 'u', "USER", 0, "Operate on USER's mailbox", 0},
{ NULL, 0, NULL, 0, NULL, 0 }
};
struct arguments
......@@ -124,7 +124,7 @@ parse_opt (int key, char *arg, struct argp_state *state)
return 0;
}
static struct argp argp = { options, parse_opt, args_doc, doc };
static struct argp argp = { options, parse_opt, args_doc, doc, NULL, NULL, NULL };
static char *
mail_cmdline(void *closure, int cont)
......@@ -133,6 +133,8 @@ mail_cmdline(void *closure, int cont)
char *prompt = NULL;
char *rc;
(void)cont;
while (1)
{
if (util_find_env ("autoinc")->set && !mailbox_is_updated (mbox))
......@@ -142,7 +144,7 @@ mail_cmdline(void *closure, int cont)
}
if (interactive)
prompt = pev->set && pev->value != NULL ? pev->value : "? ";
prompt = pev->set && pev->value != NULL ? pev->value : (char *)"? ";
rc = readline (prompt);
......@@ -167,7 +169,7 @@ int
main (int argc, char **argv)
{
struct mail_env_entry *mode = NULL, *prompt = NULL;
int modelen = 0;
size_t modelen = 0;
struct arguments args;
ofile = stdout;
......@@ -445,8 +447,7 @@ Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc.\n\
int
mail_warranty(int argc, char **argv)
{
(void)argc; (void)argv;
fprintf (ofile, "%s", warranty_stmt);
return 0;
}
......
......@@ -58,7 +58,7 @@ ml_got_interrupt ()
return rc;
}
int
static int
ml_getc (FILE *stream)
{
unsigned char c;
......@@ -86,7 +86,7 @@ ml_readline_init ()
return;
#ifdef WITH_READLINE
rl_readline_name = "mail";
rl_readline_name = (char *)"mail";
rl_attempted_completion_function = (CPPFunction*)ml_command_completion;
rl_getc_function = ml_getc;
#endif
......@@ -114,7 +114,7 @@ ml_readline_init ()
static char *insert_text;
static int
ml_insert_hook ()
ml_insert_hook (void)
{
if (insert_text)
rl_insert_text (insert_text);
......@@ -122,14 +122,14 @@ ml_insert_hook ()
}
int
ml_reread (char *prompt, char **text)
ml_reread (const char *prompt, char **text)
{
char *s;
ml_clear_interrupt ();
insert_text = *text;
rl_startup_hook = ml_insert_hook;
s = readline (prompt);
s = readline ((char *)prompt);
if (!ml_got_interrupt ())
{
if (*text)
......@@ -150,6 +150,7 @@ ml_reread (char *prompt, char **text)
char **
ml_command_completion (char *cmd, int start, int end)
{
(void)end;
if (start == 0)
return completion_matches (cmd, ml_command_generator);
return NULL;
......@@ -162,7 +163,7 @@ char *
ml_command_generator (char *text, int state)
{
static int i, len;
char *name;
const char *name;
if (!state)
{
......
......@@ -29,13 +29,17 @@ struct header_data
char *expr;
};
static msgset_t *msgset_select (int (*sel)(), void *closure, int rev,
int max_matches);
static int select_header (message_t msg, void *closure);
static int select_body (message_t msg, void *closure);
static int select_type (message_t msg, void *closure);
static int select_sender (message_t msg, void *closure);
static int select_deleted (message_t msg, void *closure);
static msgset_t *msgset_select __P ((int (*sel) __P ((message_t, void *)),
void *closure, int rev,
unsigned int max_matches));
static int select_header __P ((message_t msg, void *closure));
static int select_body __P ((message_t msg, void *closure));
static int select_type __P ((message_t msg, void *closure));
static int select_sender __P ((message_t msg, void *closure));
static int select_deleted __P ((message_t msg, void *closure));
int yyerror __P ((const char *));
int yylex __P ((void));
static msgset_t *result;
%}
......@@ -170,7 +174,6 @@ range : number
}
else
{
msgset_t *mp;
$$ = msgset_range ($1, $3->msg_part[0]-1);
if (!$$)
YYERROR;
......@@ -209,7 +212,7 @@ static int cur_ind;
static char *cur_p;
int
yyerror (char *s)
yyerror (const char *s)
{
fprintf (stderr, "%s: ", xargv[0]);
fprintf (stderr, "%s", s);
......@@ -226,6 +229,7 @@ yyerror (char *s)
else
fprintf (stderr, " near %s", cur_p);
fprintf (stderr, "\n");
return 0;
}
int
......@@ -324,7 +328,6 @@ msgset_parse (const int argc, char **argv, msgset_t **mset)
void
msgset_free (msgset_t *msg_set)
{
int i;
msgset_t *next;
if (!msg_set)
......@@ -382,7 +385,7 @@ msgset_t *
msgset_range (int low, int high)
{
int i;
msgset_t *mp, *first = NULL, *last;
msgset_t *mp, *first = NULL, *last = NULL;
if (low == high)
return msgset_make_1 (low);
......@@ -409,7 +412,7 @@ msgset_t *
msgset_expand (msgset_t *set, msgset_t *expand_by)
{
msgset_t *i, *j;
msgset_t *first = NULL, *last, *mp;
msgset_t *first = NULL, *last = NULL, *mp;
for (i = set; i; i = i->next)
for (j = expand_by; j; j = j->next)
......@@ -432,10 +435,11 @@ msgset_expand (msgset_t *set, msgset_t *expand_by)
}
msgset_t *
msgset_select (int (*sel)(), void *closure, int rev, int max_matches)
msgset_select (int (*sel) __P ((message_t, void *)), void *closure, int rev,
unsigned int max_matches)
{
size_t i, match_count = 0;
msgset_t *first = NULL, *last, *mp;
msgset_t *first = NULL, *last = NULL, *mp;
message_t msg = NULL;
if (max_matches == 0)
......@@ -486,7 +490,7 @@ select_header (message_t msg, void *closure)
struct header_data *hd = (struct header_data *)closure;
header_t hdr;
char *contents;
char *header = hd->header ? hd->header : MU_HEADER_SUBJECT;
const char *header = hd->header ? hd->header : MU_HEADER_SUBJECT;
message_get_header (msg, &hdr);
if (header_aget_value (hdr, header, &contents) == 0)
......@@ -572,10 +576,11 @@ select_body (message_t msg, void *closure)
int
select_sender (message_t msg, void *closure)
{
char *sender = (char*) closure;
/* FIXME: all messages from sender argv[i] */
/* Annoying we can use address_create() for that
but to compare against what? The email ? */
/* char *sender = (char*) closure; */
/* FIXME: all messages from sender argv[i] */
/* Annoying we can use address_create() for that
but to compare against what? The email ? */
(void)msg; (void)closure;
return 0;
}
......@@ -613,6 +618,7 @@ select_deleted (message_t msg, void *closure)
attribute_t attr= NULL;
int rc;
(void)closure;
message_get_attribute (msg, &attr);
rc = attribute_is_deleted (attr);
return strcmp (xargv[0], "undelete") == 0 ? rc : !rc;
......@@ -636,7 +642,7 @@ int
main(int argc, char **argv)
{
msgset_t *mset = NULL;
int rc = parse_msgset (argc, argv, &mset);
int rc = msgset_parse (argc, argv, &mset);
for (; mset; mset = mset->next)
msgset_print (mset);
......
......@@ -28,7 +28,7 @@ mail_pipe (int argc, char **argv)
message_t msg;
stream_t stream;
char *cmd;
FILE *pipe;
FILE *tube;
msgset_t *list, *mp;
char buffer[512];
off_t off = 0;
......@@ -44,7 +44,7 @@ mail_pipe (int argc, char **argv)
if (msgset_parse (argc, argv, &list))
return 1;
pipe = popen (cmd, "w");
tube = popen (cmd, "w");
for (mp = list; mp; mp = mp->next)
{
......@@ -56,15 +56,15 @@ mail_pipe (int argc, char **argv)
&n) == 0 && n != 0)
{
buffer[n] = '\0';
fprintf (pipe, "%s", buffer);
fprintf (tube, "%s", buffer);
off += n;
}
if ((util_find_env("page"))->set && mp->next)
fprintf (pipe, "\f\n");
fprintf (tube, "\f\n");
}
}
msgset_free (list);
pclose (pipe);
pclose (tube);
return 0;
}
......
......@@ -49,26 +49,25 @@ mail_print (int argc, char **argv)
message_lines (mesg, &lines);
if ((util_find_env("crt"))->set && lines > util_getlines ())
if ((util_find_env("crt"))->set && lines > (size_t)util_getlines ())
out = popen (getenv("PAGER"), "w");
if (islower (argv[0][0]))
{
size_t i, num = 0;
char buffer[512];
char buf[512];
message_get_header (mesg, &hdr);
header_get_field_count (hdr, &num);
for (i = 1; i <= num; i++)
{
header_get_field_name (hdr, i, buffer, sizeof(buffer), NULL);
if (mail_header_is_visible (buffer))
header_get_field_name (hdr, i, buf, sizeof buf, NULL);
if (mail_header_is_visible (buf))
{
fprintf (out, "%s: ", buffer);
header_get_field_value (hdr, i, buffer, sizeof(buffer),
NULL);
fprintf (out, "%s\n", buffer);
fprintf (out, "%s: ", buf);
header_get_field_value (hdr, i, buf, sizeof buf, NULL);
fprintf (out, "%s\n", buf);
}
}
fprintf (out, "\n");
......@@ -78,7 +77,7 @@ mail_print (int argc, char **argv)
else
message_get_stream (mesg, &stream);
while (stream_read (stream, buffer, sizeof (buffer) - 1, off, &n) == 0
while (stream_read (stream, buffer, sizeof buffer - 1, off, &n) == 0
&& n != 0)
{
if (ml_got_interrupt())
......
......@@ -25,6 +25,7 @@
int
mail_quit (int argc, char **argv)
{
(void)argc; (void)argv;
if (mail_mbox_close ())
return 1;
exit (0);
......@@ -54,7 +55,7 @@ mail_mbox_close ()
int
mail_mbox_commit ()
{
int i;
unsigned int i;
mailbox_t dest_mbox = NULL;
int saved_count = 0;
message_t msg;
......@@ -119,11 +120,11 @@ mail_mbox_commit ()
if (saved_count)
{
url_t url = NULL;
url_t u = NULL;
mailbox_get_url (dest_mbox, &url);
mailbox_get_url (dest_mbox, &u);
fprintf(ofile, "Saved %d messages in %s\n", saved_count,
url_to_string (url));
url_to_string (u));
mailbox_close (dest_mbox);
mailbox_destroy (&dest_mbox);
}
......
......@@ -48,7 +48,7 @@ mail_send (int argc, char **argv)
env.outfiles = NULL; env.nfiles = 0;
if (argc < 2)
env.to = readline ("To: ");
env.to = readline ((char *)"To: ");
else
{
while (--argc)
......@@ -75,12 +75,12 @@ mail_send (int argc, char **argv)
}
if ((util_find_env ("askcc"))->set)
env.cc = readline ("Cc: ");
env.cc = readline ((char *)"Cc: ");
if ((util_find_env ("askbcc"))->set)
env.bcc = readline ("Bcc: ");
env.bcc = readline ((char *)"Bcc: ");
if ((util_find_env ("asksub"))->set)
env.subj = readline ("Subject: ");
env.subj = readline ((char *)"Subject: ");
else
env.subj = (util_find_env ("subject"))->value;
......@@ -155,7 +155,7 @@ mail_send0 (struct send_environ *env, int save_to)
while (!done)
{
char *buf;
buf = readline (" \b");
buf = readline ((char *)" \b");
if (ml_got_interrupt ())
{
......@@ -210,8 +210,10 @@ mail_send0 (struct send_environ *env, int save_to)
struct mail_command_entry entry;
entry = util_find_entry (mail_escape_table, argv[0]);
if (entry.func)
status = (*entry.func)(argc, argv, env);
if (entry.escfunc)
{
status = (*entry.escfunc)(argc, argv, env);
}
else
util_error ("Unknown escape %s", argv[0]);
}
......@@ -247,7 +249,7 @@ mail_send0 (struct send_environ *env, int save_to)
else
{
char *buf = NULL;
int n;
unsigned int n;
rewind (env->file);
while (getline (&buf, &n, env->file) > 0)
fputs (buf, fp);
......@@ -269,7 +271,6 @@ mail_send0 (struct send_environ *env, int save_to)
{
mailer_t mailer;
message_t msg = NULL;
int status;
message_create (&msg, NULL);
/* Fill the header. */
......@@ -366,7 +367,7 @@ mail_send0 (struct send_environ *env, int save_to)
if (util_find_env ("sendmail")->set)
{
char *sendmail = util_find_env ("sendmail")->value;
status = mailer_create (&mailer, sendmail);
int status = mailer_create (&mailer, sendmail);
if (status == 0)
{
if (util_find_env ("verbose")->set)
......@@ -422,9 +423,9 @@ msg_to_pipe (const char *cmd, message_t msg)
stream_t stream = NULL;
char buffer[512];
off_t off = 0;
int n = 0;
unsigned int n = 0;
message_get_stream (msg, &stream);
while (stream_read (stream, buffer, sizeof (buffer) - 1, off, &n) == 0
while (stream_read (stream, buffer, sizeof buffer - 1, off, &n) == 0
&& n != 0)
{
buffer[n] = '\0';
......
......@@ -53,7 +53,7 @@ mail_shell (int argc, char **argv)
argcv_string (argc-1, &argv[1], &buf);
argvec[0] = getenv("SHELL");
argvec[1] = "-c";
argvec[1] = (char *)"-c";
argvec[2] = buf;
argvec[3] = NULL;
......
......@@ -26,11 +26,12 @@ mail_summary (int argc, char **argv)
{
message_t msg;
attribute_t attr;
int msgno;
size_t msgno;
size_t count = 0;
int mseen = 0, mnew = 0, mdelete = 0;
int first_new = 0, first_unread = 0;
(void)argc; (void)argv;
mailbox_messages_count (mbox, &count);
for (msgno = 1; msgno <= count; msgno++)
{
......@@ -38,7 +39,7 @@ mail_summary (int argc, char **argv)
&& (message_get_attribute (msg, &attr) == 0))
{
int deleted = attribute_is_deleted (attr);
if (deleted)
mdelete++;
if (attribute_is_seen (attr) && ! attribute_is_read (attr))
......@@ -74,4 +75,5 @@ mail_summary (int argc, char **argv)
/* Set the cursor. */
cursor = realcursor = (first_new == 0) ? ((first_unread == 0) ?
1 : first_unread) : first_new ;
return 0;
}
......
......@@ -21,10 +21,12 @@
/* unt[ag] [msglist] */
static int
tag_message (message_t mesg, msgset_t *msgset, int *action)
tag_message (message_t mesg, msgset_t *msgset, void *arg)
{
attribute_t attr;
int *action = arg;
(void)msgset;
message_get_attribute (mesg, &attr);
if (*action)
attribute_set_userflag (attr, MAIL_ATTRIBUTE_TAGGED);
......@@ -42,7 +44,7 @@ mail_tag (int argc, char **argv)
if (msgset_parse (argc, argv, &msgset))
return 1;
util_msgset_iterate (msgset, tag_message, &action);
util_msgset_iterate (msgset, tag_message, (void *)&action);
msgset_free (msgset);
return 0;
......
......@@ -22,6 +22,7 @@
# include <termios.h>
#endif
#include <sys/ioctl.h>
#include <sys/stat.h>
#ifdef HAVE_FCNTL_H
# include <fcntl.h>
......@@ -104,7 +105,7 @@ util_do_command (const char *c, ...)
entry = util_find_entry (mail_command_table, argv[0]);
if (if_cond() == 0 && (entry.flags & EF_FLOW) == 0)
if (if_cond () == 0 && (entry.flags & EF_FLOW) == 0)
{
argcv_free (argc, argv);
return 0;
......@@ -166,11 +167,46 @@ util_msglist_command (function_t *func, int argc, char **argv, int set_cursor)
return status;
}
/* Same as util_msglis_command but the function comes from the escape
cmd table, so will have a different argument signature. */
int
util_msglist_esccmd (int (*escfunc)
__P ((int, char **, struct send_environ *)),
int argc, char **argv, struct send_environ *env,
int set_cursor)
{
msgset_t *list = NULL, *mp;
int status = 0;
if (msgset_parse (argc, argv, &list))
return 1;
realcursor = cursor;
for (mp = list; mp; mp = mp->next)
{
cursor = mp->msg_part[0];
/* NOTE: Should we bail on error also? */
if (escfunc (1, argv, env) != 0)
status = 1;
/* Bail out if we receive an interrupt. */
if (ml_got_interrupt () != 0)
break;
}
msgset_free (list);
if (set_cursor)
realcursor = cursor;
else
cursor = realcursor;
return status;
}
/*
* returns the function to run for command
*/
function_t *
util_command_get (char *cmd)
util_command_get (const char *cmd)
{
struct mail_command_entry entry = util_find_entry (mail_command_table, cmd);
return entry.func;
......@@ -180,7 +216,7 @@ util_command_get (char *cmd)
* returns the mail_command_entry structure for the command matching cmd
*/
struct mail_command_entry
util_find_entry (const struct mail_command_entry *table, char *cmd)
util_find_entry (const struct mail_command_entry *table, const char *cmd)
{
int i = 0, ll = 0, sl = 0;
int len = strlen (cmd);
......@@ -228,9 +264,12 @@ util_getcols (void)
struct winsize ws;
ws.ws_col = ws.ws_row = 0;
if ((ioctl(1, TIOCGWINSZ, (char *) &ws) < 0)
|| ws.ws_row == 0)
ws.ws_col = strtol (getenv("COLUMNS"), NULL, 10);
if ((ioctl(1, TIOCGWINSZ, (char *) &ws) < 0) || ws.ws_row == 0)
{
const char *columns = getenv ("COLUMNS");
if (columns)
ws.ws_col = strtol (columns, NULL, 10);
}
/* FIXME: Should we exit()/abort() if col <= 0 ? */
return ws.ws_col;
......@@ -246,9 +285,12 @@ util_getlines (void)
struct winsize ws;
ws.ws_col = ws.ws_row = 0;
if ((ioctl(1, TIOCGWINSZ, (char *) &ws) < 0)
|| ws.ws_row == 0)
ws.ws_row = strtol (getenv("LINES"), NULL, 10);
if ((ioctl(1, TIOCGWINSZ, (char *) &ws) < 0) || ws.ws_row == 0)
{
const char *lines = getenv ("LINES");
if (lines)
ws.ws_row = strtol (lines, NULL, 10);
}
/* FIXME: Should we exit()/abort() if row <= 0 ? */
......@@ -257,12 +299,12 @@ util_getlines (void)
}
int
util_screen_lines()
util_screen_lines ()
{
struct mail_env_entry *ep = util_find_env("screen");
struct mail_env_entry *ep = util_find_env ("screen");
size_t n;
if (ep && ep->set && (n = atoi(ep->value)) != 0)
if (ep && ep->set && (n = strtoul (ep->value, NULL, 10)) != 0)
return n;
n = util_getlines();
util_do_command ("set screen=%d", n);
......@@ -270,12 +312,12 @@ util_screen_lines()
}
int
util_screen_columns()
util_screen_columns ()
{
struct mail_env_entry *ep = util_find_env("columns");
size_t n;
if (ep && ep->set && (n = atoi(ep->value)) != 0)
if (ep && ep->set && (n = strtoul (ep->value, NULL, 10)) != 0)
return n;
n = util_getcols();
util_do_command ("set columns=%d", n);
......@@ -295,7 +337,7 @@ util_find_env (const char *variable)
/* Annoying, variable "ask" is equivalent to "asksub". */
static const char *asksub = "asksub";
const char *var = variable;
int len = strlen (var);
size_t len = strlen (var);
node *t;
if (len < 1)
......@@ -425,7 +467,7 @@ util_get_homedir()
}
char *
util_fullpath(char *inpath)
util_fullpath(const char *inpath)
{
return mu_tilde_expansion(inpath, "/", NULL);
}
......@@ -548,7 +590,7 @@ util_slist_destroy (list_t *list)
}
char *
util_slist_to_string (list_t list, char *delim)
util_slist_to_string (list_t list, const char *delim)
{
iterator_t itr;
char *name;
......@@ -569,7 +611,7 @@ util_slist_to_string (list_t list, char *delim)
}
void
util_strcat(char **dest, char *str)
util_strcat(char **dest, const char *str)
{
if (!*dest)
*dest = strdup (str);
......@@ -593,10 +635,10 @@ util_strupper (char *s)
{
if (s)
{
int i;
int len = strlen (s);
size_t i;
size_t len = strlen (s);
for (i = 0; i < len; i++)
s[i] = toupper ((int)s[i]);
s[i] = toupper ((unsigned int)(s[i]));
}
}
......@@ -623,7 +665,7 @@ util_escape_percent (char **str)
/* and escape percent signs */
p = newstr;
q = *str;
while (*p = *q++)
while ((*p = *q++))
{
if (*p == '%')
*++p = '%';
......@@ -679,7 +721,7 @@ util_save_outgoing (message_t msg, char *savefile)
}
else
{
char *buf;
char *buf = NULL;
size_t bsize = 0;
message_size (msg, &bsize);
......@@ -786,7 +828,7 @@ int
util_tempfile(char **namep)
{
char *filename;
char *tmpdir;
const char *tmpdir;
int fd;
/* We have to be extra careful about opening temporary files, since we
......@@ -829,15 +871,15 @@ util_tempfile(char **namep)
return fd;
}
int
static int
util_descend_subparts (message_t mesg, msgset_t *msgset, message_t *part)
{
int i;
unsigned int i;
for (i = 1; i < msgset->npart; i++)
{
message_t submsg = NULL;
int nparts = 0;
unsigned int nparts = 0;
char *type = NULL;
header_t hdr = NULL;
......@@ -876,7 +918,9 @@ util_descend_subparts (message_t mesg, msgset_t *msgset, message_t *part)
}
void
util_msgset_iterate (msgset_t *msgset, int (*fun)(), void *closure)
util_msgset_iterate (msgset_t *msgset,
int (*fun) __P ((message_t, msgset_t *, void *)),
void *closure)
{
for (; msgset; msgset = msgset->next)
{
......
......@@ -21,7 +21,7 @@
#include <sys/stat.h>
static void
var_continue()
var_continue (void)
{
fprintf(stdout, "(continue)\n");
}
......@@ -30,7 +30,7 @@ static int var_check_args (int argc, char **argv)
{
if (argc == 1)
{
util_error ("%c%s requires an argument",
util_error ("%c%s requires an argument",
util_find_env ("escape")->value[0], argv[0]);
return 1;
}
......@@ -82,6 +82,7 @@ var_command(int argc, char **argv, struct send_environ *env)
int
var_help(int argc, char **argv, struct send_environ *env)
{
(void)env;
if (argc < 2)
return util_help(mail_escape_table, NULL);
else
......@@ -102,6 +103,9 @@ int
var_sign(int argc, char **argv, struct send_environ *env)
{
struct mail_env_entry *p;
(void)argc; (void)env;
if (isupper(argv[0][0]))
p = util_find_env("Sign");
else
......@@ -114,7 +118,7 @@ var_sign(int argc, char **argv, struct send_environ *env)
FILE *fp = fopen(name, "r");
char *buf = NULL;
size_t n = 0;
if (!fp)
{
util_error("can't open %s: %s", name, strerror(errno));
......@@ -124,7 +128,7 @@ var_sign(int argc, char **argv, struct send_environ *env)
fprintf(stdout, "Reading %s\n", name);
while (getline(&buf, &n, fp) > 0)
fprintf(ofile, "%s", buf);
fclose(fp);
free(buf);
free(name);
......@@ -162,7 +166,9 @@ var_deadletter(int argc, char **argv, struct send_environ *env)
{
FILE *dead = fopen(getenv("DEAD"), "r");
int c;
(void)argc; (void)argv; (void)env;
while ((c = fgetc(dead)) != EOF)
fputc(c, ofile);
fclose(dead);
......@@ -172,6 +178,7 @@ var_deadletter(int argc, char **argv, struct send_environ *env)
static int
var_run_editor(char *ed, int argc, char **argv, struct send_environ *env)
{
(void)argc; (void)argv;
fclose(env->file);
ofile = env->ofile;
util_do_command("!%s %s", ed, env->filename);
......@@ -200,6 +207,7 @@ var_visual(int argc, char **argv, struct send_environ *env)
int
var_print(int argc, char **argv, struct send_environ *env)
{
(void)env;
return mail_print(argc, argv);
}
......@@ -207,6 +215,7 @@ var_print(int argc, char **argv, struct send_environ *env)
int
var_headers(int argc, char **argv, struct send_environ *env)
{
(void)argc; (void)argv;
ml_reread("To: ", &env->to);
ml_reread("Cc: ", &env->cc);
ml_reread("Bcc: ", &env->bcc);
......@@ -219,6 +228,7 @@ var_headers(int argc, char **argv, struct send_environ *env)
int
var_insert(int argc, char **argv, struct send_environ *env)
{
(void)env;
if (var_check_args (argc, argv))
return 1;
fprintf(ofile, "%s", util_find_env(argv[1])->value);
......@@ -231,7 +241,7 @@ int
var_quote(int argc, char **argv, struct send_environ *env)
{
if (argc > 1)
return util_msglist_command(var_quote, argc, argv, 0);
return util_msglist_esccmd (var_quote, argc, argv, env, 0);
else
{
message_t mesg;
......@@ -242,29 +252,28 @@ var_quote(int argc, char **argv, struct send_environ *env)
off_t off = 0;
size_t n = 0;
char *prefix = util_find_env("indentprefix")->value;
if (mailbox_get_message(mbox, cursor, &mesg) != 0)
return 1;
fprintf(stdout, "Interpolating: %d\n", cursor);
if (islower(argv[0][0]))
{
size_t i, num = 0;
char buffer[512];
char buf[512];
message_get_header(mesg, &hdr);
header_get_field_count(hdr, &num);
for (i = 1; i <= num; i++)
{
header_get_field_name(hdr, i, buffer, sizeof(buffer), NULL);
if (mail_header_is_visible(buffer))
header_get_field_name(hdr, i, buf, sizeof buf, NULL);
if (mail_header_is_visible(buf))
{
fprintf(ofile, "%s%s: ", prefix, buffer);
header_get_field_value(hdr, i, buffer, sizeof(buffer),
NULL);
fprintf(ofile, "%s\n", buffer);
fprintf(ofile, "%s%s: ", prefix, buf);
header_get_field_value(hdr, i, buf, sizeof buf, NULL);
fprintf(ofile, "%s\n", buf);
}
}
fprintf(ofile, "\n");
......@@ -274,7 +283,7 @@ var_quote(int argc, char **argv, struct send_environ *env)
else
message_get_stream(mesg, &stream);
while (stream_readline(stream, buffer, sizeof(buffer) - 1, off, &n) == 0
while (stream_readline(stream, buffer, sizeof buffer - 1, off, &n) == 0
&& n != 0)
{
buffer[n] = '\0';
......@@ -292,8 +301,10 @@ var_type_input(int argc, char **argv, struct send_environ *env)
{
char buf[512];
(void)argc; (void)argv;
fprintf(env->ofile, "Message contains:\n");
if (env->to)
fprintf(env->ofile, "To: %s\n", env->to);
if (env->cc)
......@@ -302,7 +313,7 @@ var_type_input(int argc, char **argv, struct send_environ *env)
fprintf(env->ofile, "Bcc: %s\n", env->bcc);
if (env->subj)
fprintf(env->ofile, "Subject: %s\n\n", env->subj);
rewind(env->file);
while (fgets(buf, sizeof(buf), env->file))
fputs(buf, env->ofile);
......@@ -320,7 +331,9 @@ var_read(int argc, char **argv, struct send_environ *env)
FILE *inf;
size_t size, lines;
char buf[512];
(void)env;
if (var_check_args (argc, argv))
return 1;
filename = util_fullpath(argv[1]);
......@@ -373,13 +386,13 @@ var_write(int argc, char **argv, struct send_environ *env)
FILE *fp;
size_t size, lines;
char buf[512];
if (var_check_args (argc, argv))
return 1;
filename = util_fullpath(argv[1]);
fp = fopen(filename, "w"); /*FIXME: check for the existence first */
if (!fp)
{
util_error("can't open %s: %s\n", filename, strerror(errno));
......@@ -405,6 +418,7 @@ var_write(int argc, char **argv, struct send_environ *env)
int
var_exit(int argc, char **argv, struct send_environ *env)
{
(void)argc; (void)argv; (void)env;
return util_do_command("quit");
}
......@@ -421,7 +435,7 @@ var_pipe(int argc, char **argv, struct send_environ *env)
util_error("pipe: no command specified");
return 1;
}
if (pipe(p))
{
util_error("pipe: %s", strerror(errno));
......@@ -445,17 +459,17 @@ var_pipe(int argc, char **argv, struct send_environ *env)
/* Child */
int i;
char **xargv;
/* Attache the pipes */
close(0);
dup(p[0]);
close(p[0]);
close(p[1]);
close(1);
dup(fd);
close(fd);
/* Execute the process */
xargv = xcalloc(argc, sizeof(xargv[0]));
for (i = 0; i < argc-1; i++)
......@@ -473,15 +487,15 @@ var_pipe(int argc, char **argv, struct send_environ *env)
size_t lines, size;
int rc = 1;
int status;
close(p[0]);
/* Parent */
fp = fdopen(p[1], "w");
fclose(env->file);
env->file = fopen(env->filename, "r");
env->file = fopen(env->filename, "r");
lines = size = 0;
while (getline(&buf, &n, env->file) > 0)
{
......@@ -491,7 +505,7 @@ var_pipe(int argc, char **argv, struct send_environ *env)
}
fclose(env->file);
fclose(fp); /* Closes p[1] */
waitpid(pid, &status, 0);
if (!WIFEXITED(status))
{
......@@ -508,7 +522,7 @@ var_pipe(int argc, char **argv, struct send_environ *env)
rc = 0;
}
fprintf(stdout, "\"|%s\" in: %d/%d ", argv[1], lines, size);
fprintf(stdout, "\"|%s\" in: %d/%d ", argv[1], lines, size);
if (rc)
{
fprintf(stdout, "no lines out\n");
......@@ -520,7 +534,7 @@ var_pipe(int argc, char **argv, struct send_environ *env)
rewind(fp);
env->file = fopen(env->filename, "w+");
lines = size = 0;
while (getline(&buf, &n, fp) > 0)
{
......@@ -530,7 +544,7 @@ var_pipe(int argc, char **argv, struct send_environ *env)
}
fclose(env->file);
fprintf(stdout, "out: %d/%d\n", lines, size);
fprintf(stdout, "out: %d/%d\n", lines, size);
}
/* Clean up the things */
......@@ -542,6 +556,6 @@ var_pipe(int argc, char **argv, struct send_environ *env)
}
close(fd);
return 0;
}
......
......@@ -21,7 +21,7 @@
* ve[rsion]
*/
static char *with_defs[] =
static const char *with_defs[] =
{
#ifdef WITH_PTHREAD
"PTHREAD",
......@@ -39,6 +39,7 @@ static char *with_defs[] =
int
mail_version (int argc, char **argv)
{
(void)argc; (void)argv;
fprintf (ofile, "%s", argp_program_version);
if (with_defs[0] != NULL)
{
......
......@@ -102,7 +102,7 @@ mail_write (int argc, char **argv)
attribute_set_userflag (attr, MAIL_ATTRIBUTE_SAVED);
}
fprintf (ofile, "\"%s\" %3ld/%-5ld\n", filename, total_lines, total_size);
fprintf (ofile, "\"%s\" %3d/%-5d\n", filename, total_lines, total_size);
free (filename);
fclose (output);
......
......@@ -31,7 +31,7 @@
*/
static int
z_parse_args(int argc, char **argv, int *return_count, int *return_dir)
z_parse_args(int argc, char **argv, unsigned int *return_count, int *return_dir)
{
int count = 1;
int mul = 1;
......@@ -87,7 +87,7 @@ z_parse_args(int argc, char **argv, int *return_count, int *return_dir)
return 1;
}
if ((mul = atoi(argp)) == 0)
if ((mul = strtoul (argp, NULL, 10)) == 0)
{
util_error("Bad number of pages");
return 1;
......@@ -107,7 +107,7 @@ mail_z (int argc, char **argv)
{
unsigned int i, nlines;
unsigned int pagelines = util_screen_lines();
int count;
unsigned int count;
int dir;
if (z_parse_args(argc, argv, &count, &dir))
......@@ -148,7 +148,7 @@ mail_z (int argc, char **argv)
return 0;
}
break;
case D_NONE:
{
/* z. is a GNU extension, so it will be more useful
......@@ -161,7 +161,7 @@ mail_z (int argc, char **argv)
int lastpage = total - pagelines + 1;
if (lastpage <= 0)
lastpage = 1;
if (cursor > lastpage)
if (cursor > (unsigned int)lastpage)
{
realcursor = cursor;
cursor = lastpage;
......@@ -185,7 +185,7 @@ mail_z (int argc, char **argv)
i++;
cursor++;
}
cursor = realcursor;
return 1;
......