From aa9e54ca73f9c91537b60a1f0b116cb30ccbef15 Mon Sep 17 00:00:00 2001 From: millert Date: Tue, 25 Apr 2000 16:42:22 +0000 Subject: [PATCH] When incorporating new messages, clear the "new" count before the inc so the count of new messages is useful afterwards. This makes mail behave more like the SunOS version in this respect. --- usr.bin/mail/aux.c | 17 +++++++++++++++-- usr.bin/mail/cmd1.c | 5 +++-- usr.bin/mail/cmd3.c | 5 +++-- usr.bin/mail/extern.h | 5 +++-- usr.bin/mail/lex.c | 5 +++-- 5 files changed, 27 insertions(+), 10 deletions(-) diff --git a/usr.bin/mail/aux.c b/usr.bin/mail/aux.c index 2cc229af5e5..f82bd763a69 100644 --- a/usr.bin/mail/aux.c +++ b/usr.bin/mail/aux.c @@ -1,4 +1,4 @@ -/* $OpenBSD: aux.c,v 1.13 1997/11/14 00:23:41 millert Exp $ */ +/* $OpenBSD: aux.c,v 1.14 2000/04/25 16:42:22 millert Exp $ */ /* $NetBSD: aux.c,v 1.5 1997/05/13 06:15:52 mikel Exp $ */ /* @@ -38,7 +38,7 @@ #if 0 static char sccsid[] = "@(#)aux.c 8.1 (Berkeley) 6/6/93"; #else -static char rcsid[] = "$OpenBSD: aux.c,v 1.13 1997/11/14 00:23:41 millert Exp $"; +static char rcsid[] = "$OpenBSD: aux.c,v 1.14 2000/04/25 16:42:22 millert Exp $"; #endif #endif /* not lint */ @@ -689,3 +689,16 @@ member(realfield, table) return(1); return(0); } + +void +clearnew() +{ + struct message *mp; + + for (mp = &message[0]; mp < &message[msgCount]; mp++) { + if (mp->m_flag & MNEW) { + mp->m_flag &= ~MNEW; + mp->m_flag |= MSTATUS; + } + } +} diff --git a/usr.bin/mail/cmd1.c b/usr.bin/mail/cmd1.c index 1d94af2cb06..039f1a557e5 100644 --- a/usr.bin/mail/cmd1.c +++ b/usr.bin/mail/cmd1.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd1.c,v 1.13 1998/05/11 04:15:24 millert Exp $ */ +/* $OpenBSD: cmd1.c,v 1.14 2000/04/25 16:42:22 millert Exp $ */ /* $NetBSD: cmd1.c,v 1.9 1997/07/09 05:29:48 mikel Exp $ */ /*- @@ -38,7 +38,7 @@ #if 0 static char sccsid[] = "@(#)cmd1.c 8.2 (Berkeley) 4/20/95"; #else -static char rcsid[] = "$OpenBSD: cmd1.c,v 1.13 1998/05/11 04:15:24 millert Exp $"; +static char rcsid[] = "$OpenBSD: cmd1.c,v 1.14 2000/04/25 16:42:22 millert Exp $"; #endif #endif /* not lint */ @@ -490,6 +490,7 @@ inc(v) } else if (nmsg > 0) { mdot = newfileinfo(msgCount - nmsg); dot = &message[mdot - 1]; + clearnew(); } else { puts("\"inc\" command failed..."); } diff --git a/usr.bin/mail/cmd3.c b/usr.bin/mail/cmd3.c index ae8256c3306..f02e27e3eb4 100644 --- a/usr.bin/mail/cmd3.c +++ b/usr.bin/mail/cmd3.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd3.c,v 1.10 1997/11/14 00:23:44 millert Exp $ */ +/* $OpenBSD: cmd3.c,v 1.11 2000/04/25 16:42:22 millert Exp $ */ /* $NetBSD: cmd3.c,v 1.8 1997/07/09 05:29:49 mikel Exp $ */ /* @@ -38,7 +38,7 @@ #if 0 static char sccsid[] = "@(#)cmd3.c 8.2 (Berkeley) 4/20/95"; #else -static char rcsid[] = "$OpenBSD: cmd3.c,v 1.10 1997/11/14 00:23:44 millert Exp $"; +static char rcsid[] = "$OpenBSD: cmd3.c,v 1.11 2000/04/25 16:42:22 millert Exp $"; #endif #endif /* not lint */ @@ -564,6 +564,7 @@ file(v) if (argv[0] == NULL) { newfileinfo(0); + clearnew(); return(0); } if (setfile(*argv) < 0) diff --git a/usr.bin/mail/extern.h b/usr.bin/mail/extern.h index df2c2ed7a0b..36b04e4acc3 100644 --- a/usr.bin/mail/extern.h +++ b/usr.bin/mail/extern.h @@ -1,4 +1,4 @@ -/* $OpenBSD: extern.h,v 1.12 1997/11/14 00:23:46 millert Exp $ */ +/* $OpenBSD: extern.h,v 1.13 2000/04/25 16:42:22 millert Exp $ */ /* $NetBSD: extern.h,v 1.7 1997/07/09 05:22:00 mikel Exp $ */ /*- @@ -34,7 +34,7 @@ * SUCH DAMAGE. * * @(#)extern.h 8.2 (Berkeley) 4/20/95 - * $OpenBSD: extern.h,v 1.12 1997/11/14 00:23:46 millert Exp $ + * $OpenBSD: extern.h,v 1.13 2000/04/25 16:42:22 millert Exp $ */ struct name; @@ -99,6 +99,7 @@ int blankline __P((char [])); void brokpipe __P((int)); int charcount __P((char *, int)); int check __P((int, int)); +void clearnew __P((void)); void clob1 __P((int)); int clobber __P((void *)); void close_all_files __P((void)); diff --git a/usr.bin/mail/lex.c b/usr.bin/mail/lex.c index 6e71b694a02..b1405843e5f 100644 --- a/usr.bin/mail/lex.c +++ b/usr.bin/mail/lex.c @@ -1,4 +1,4 @@ -/* $OpenBSD: lex.c,v 1.18 1998/09/08 14:59:12 millert Exp $ */ +/* $OpenBSD: lex.c,v 1.19 2000/04/25 16:42:22 millert Exp $ */ /* $NetBSD: lex.c,v 1.10 1997/05/17 19:55:13 pk Exp $ */ /* @@ -38,7 +38,7 @@ #if 0 static char sccsid[] = "@(#)lex.c 8.2 (Berkeley) 4/20/95"; #else -static char rcsid[] = "$OpenBSD: lex.c,v 1.18 1998/09/08 14:59:12 millert Exp $"; +static char rcsid[] = "$OpenBSD: lex.c,v 1.19 2000/04/25 16:42:22 millert Exp $"; #endif #endif /* not lint */ @@ -614,6 +614,7 @@ announce() int vec[2], mdot; mdot = newfileinfo(0); + clearnew(); vec[0] = mdot; vec[1] = 0; dot = &message[mdot - 1]; -- 2.20.1