=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/mail/cmd2.c,v retrieving revision 1.9 retrieving revision 1.10 diff -c -r1.9 -r1.10 *** src/usr.bin/mail/cmd2.c 2000/04/26 15:47:30 1.9 --- src/usr.bin/mail/cmd2.c 2001/11/21 15:26:39 1.10 *************** *** 1,4 **** ! /* $OpenBSD: cmd2.c,v 1.9 2000/04/26 15:47:30 millert Exp $ */ /* $NetBSD: cmd2.c,v 1.7 1997/05/17 19:55:10 pk Exp $ */ /* --- 1,4 ---- ! /* $OpenBSD: cmd2.c,v 1.10 2001/11/21 15:26:39 millert Exp $ */ /* $NetBSD: cmd2.c,v 1.7 1997/05/17 19:55:10 pk Exp $ */ /* *************** *** 36,44 **** #ifndef lint #if 0 ! static char sccsid[] = "@(#)cmd2.c 8.1 (Berkeley) 6/6/93"; #else ! static char rcsid[] = "$OpenBSD: cmd2.c,v 1.9 2000/04/26 15:47:30 millert Exp $"; #endif #endif /* not lint */ --- 36,44 ---- #ifndef lint #if 0 ! static const char sccsid[] = "@(#)cmd2.c 8.1 (Berkeley) 6/6/93"; #else ! static const char rcsid[] = "$OpenBSD: cmd2.c,v 1.10 2001/11/21 15:26:39 millert Exp $"; #endif #endif /* not lint */ *************** *** 51,57 **** * * More user commands. */ ! static int igcomp __P((const void *, const void *)); /* * If any arguments were given, go to the next applicable argument --- 51,57 ---- * * More user commands. */ ! static int igcomp(const void *, const void *); /* * If any arguments were given, go to the next applicable argument *************** *** 59,86 **** * If given as first command with no arguments, print first message. */ int ! next(v) ! void *v; { struct message *mp; int *msgvec = v; int *ip, *ip2, list[2], mdot; if (*msgvec != NULL) { - /* * If some messages were supplied, find the * first applicable one following dot using * wrap around. */ - mdot = dot - &message[0] + 1; /* * Find the first message in the supplied * message list which follows dot. */ - for (ip = msgvec; *ip != NULL; ip++) if (*ip > mdot) break; --- 59,82 ---- * If given as first command with no arguments, print first message. */ int ! next(void *v) { struct message *mp; int *msgvec = v; int *ip, *ip2, list[2], mdot; if (*msgvec != NULL) { /* * If some messages were supplied, find the * first applicable one following dot using * wrap around. */ mdot = dot - &message[0] + 1; /* * Find the first message in the supplied * message list which follows dot. */ for (ip = msgvec; *ip != NULL; ip++) if (*ip > mdot) break; *************** *** 106,112 **** * If this is the first command, select message 1. * Note that this must exist for us to get here at all. */ - if (!sawcom) goto hitit; --- 102,107 ---- *************** *** 114,120 **** * Just find the next good message after dot, no * wraparound. */ - for (mp = dot+1; mp < &message[msgCount]; mp++) if ((mp->m_flag & (MDELETED|MSAVED)) == 0) break; --- 109,114 ---- *************** *** 127,133 **** /* * Print dot. */ - list[0] = dot - &message[0] + 1; list[1] = NULL; return(type(list)); --- 121,126 ---- *************** *** 138,145 **** * so we can discard when the user quits. */ int ! save(v) ! void *v; { char *str = v; --- 131,137 ---- * so we can discard when the user quits. */ int ! save(void *v) { char *str = v; *************** *** 150,157 **** * Copy a message to a file without affected its saved-ness */ int ! copycmd(v) ! void *v; { char *str = v; --- 142,148 ---- * Copy a message to a file without affected its saved-ness */ int ! copycmd(void *v) { char *str = v; *************** *** 163,173 **** * If mark is true, mark the message "saved." */ int ! save1(str, mark, cmd, ignore) ! char str[]; ! int mark; ! char *cmd; ! struct ignoretab *ignore; { struct message *mp; char *file, *disp; --- 154,160 ---- * If mark is true, mark the message "saved." */ int ! save1(char *str, int mark, char *cmd, struct ignoretab *ignore) { struct message *mp; char *file, *disp; *************** *** 223,230 **** * file name, minus header and trailing blank line. */ int ! swrite(v) ! void *v; { char *str = v; --- 210,216 ---- * file name, minus header and trailing blank line. */ int ! swrite(void *v) { char *str = v; *************** *** 239,249 **** * unless the file name is the only thing on the line, in * which case, return 0 in the reference flag variable. */ - char * ! snarf(linebuf, flag) ! char linebuf[]; ! int *flag; { char *cp; --- 225,232 ---- * unless the file name is the only thing on the line, in * which case, return 0 in the reference flag variable. */ char * ! snarf(char *linebuf, int *flag) { char *cp; *************** *** 253,259 **** /* * Strip away trailing blanks. */ - while (cp > linebuf && isspace(*cp)) cp--; *++cp = 0; --- 236,241 ---- *************** *** 261,267 **** /* * Now search for the beginning of the file name. */ - while (cp > linebuf && !isspace(*cp)) cp--; if (*cp == '\0') { --- 243,248 ---- *************** *** 279,288 **** * Delete messages. */ int ! delete(v) ! void *v; { int *msgvec = v; delm(msgvec); return(0); } --- 260,269 ---- * Delete messages. */ int ! delete(void *v) { int *msgvec = v; + delm(msgvec); return(0); } *************** *** 291,298 **** * Delete messages, then type the new dot. */ int ! deltype(v) ! void *v; { int *msgvec = v; int list[2]; --- 272,278 ---- * Delete messages, then type the new dot. */ int ! deltype(void *v) { int *msgvec = v; int list[2]; *************** *** 318,325 **** * Internal interface. */ int ! delm(msgvec) ! int *msgvec; { struct message *mp; int *ip, last; --- 298,304 ---- * Internal interface. */ int ! delm(int *msgvec) { struct message *mp; int *ip, last; *************** *** 348,354 **** /* * Following can't happen -- it keeps lint happy */ - return(-1); } --- 327,332 ---- *************** *** 356,363 **** * Undelete the indicated messages. */ int ! undeletecmd(v) ! void *v; { int *msgvec = v; int *ip; --- 334,340 ---- * Undelete the indicated messages. */ int ! undeletecmd(void *v) { int *msgvec = v; int *ip; *************** *** 376,385 **** * Interactively dump core on "core" */ int ! core(v) ! void *v; { ! int pid; extern int wait_status; switch (pid = vfork()) { --- 353,361 ---- * Interactively dump core on "core" */ int ! core(void *v) { ! pid_t pid; extern int wait_status; switch (pid = vfork()) { *************** *** 404,411 **** * Clobber as many bytes of stack as the user requests. */ int ! clobber(v) ! void *v; { char **argv = v; int times; --- 380,386 ---- * Clobber as many bytes of stack as the user requests. */ int ! clobber(void *v) { char **argv = v; int times; *************** *** 440,447 **** * If no arguments, print the current list of retained fields. */ int ! retfield(v) ! void *v; { char **list = v; --- 415,421 ---- * If no arguments, print the current list of retained fields. */ int ! retfield(void *v) { char **list = v; *************** *** 453,460 **** * If no arguments, print the current list of ignored fields. */ int ! igfield(v) ! void *v; { char **list = v; --- 427,433 ---- * If no arguments, print the current list of ignored fields. */ int ! igfield(void *v) { char **list = v; *************** *** 462,469 **** } int ! saveretfield(v) ! void *v; { char **list = v; --- 435,441 ---- } int ! saveretfield(void *v) { char **list = v; *************** *** 471,478 **** } int ! saveigfield(v) ! void *v; { char **list = v; --- 443,449 ---- } int ! saveigfield(void *v) { char **list = v; *************** *** 480,489 **** } int ! ignore1(list, tab, which) ! char *list[]; ! struct ignoretab *tab; ! char *which; { char field[LINESIZE]; char **ap; --- 451,457 ---- } int ! ignore1(char **list, struct ignoretab *tab, char *which) { char field[LINESIZE]; char **ap; *************** *** 493,499 **** if (*list == NULL) return(igshow(tab, which)); for (ap = list; *ap != 0; ap++) { ! istrncpy(field, *ap, sizeof(field)); if (member(field, tab)) continue; h = hash(field); --- 461,467 ---- if (*list == NULL) return(igshow(tab, which)); for (ap = list; *ap != 0; ap++) { ! istrlcpy(field, *ap, sizeof(field)); if (member(field, tab)) continue; h = hash(field); *************** *** 511,519 **** * Print out all currently retained fields. */ int ! igshow(tab, which) ! struct ignoretab *tab; ! char *which; { int h; struct ignore *igp; --- 479,485 ---- * Print out all currently retained fields. */ int ! igshow(struct ignoretab *tab, char *which) { int h; struct ignore *igp; *************** *** 539,546 **** * Compare two names for sorting ignored field list. */ static int ! igcomp(l, r) ! const void *l, *r; { return(strcmp(*(char **)l, *(char **)r)); } --- 505,512 ---- * Compare two names for sorting ignored field list. */ static int ! igcomp(const void *l, const void *r) { + return(strcmp(*(char **)l, *(char **)r)); }