From d2d9ec230847c012eeccc5542e089674180e996d Mon Sep 17 00:00:00 2001 From: zrj Date: Wed, 31 Jan 2018 13:04:08 +0200 Subject: [PATCH] at(1): Add missing fallthrough. While there, constify struct. --- usr.bin/at/at.c | 3 +-- usr.bin/at/parsetime.c | 10 +++++++--- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/usr.bin/at/at.c b/usr.bin/at/at.c index cd29b33cf0..15ae6fae03 100644 --- a/usr.bin/at/at.c +++ b/usr.bin/at/at.c @@ -26,7 +26,6 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * $FreeBSD: src/usr.bin/at/at.c,v 1.30 2007/09/21 01:55:11 kevlo Exp $ - * $DragonFly: src/usr.bin/at/at.c,v 1.9 2007/09/22 20:22:51 pavalos Exp $ */ #define _USE_BSD 1 @@ -804,7 +803,7 @@ main(int argc, char **argv) case 'd': warnx("-d is deprecated; use -r instead"); - /* fall through to 'r' */ + /* FALLTHROUGH */ case 'r': if (program != AT) diff --git a/usr.bin/at/parsetime.c b/usr.bin/at/parsetime.c index 1c56f12d77..56ca4a2b85 100644 --- a/usr.bin/at/parsetime.c +++ b/usr.bin/at/parsetime.c @@ -33,7 +33,6 @@ * \PLUS NUMBER MINUTES|HOURS|DAYS|WEEKS/ * * $FreeBSD: src/usr.bin/at/parsetime.c,v 1.27 2005/08/18 08:18:02 stefanf Exp $ - * $DragonFly: src/usr.bin/at/parsetime.c,v 1.6 2007/08/26 16:12:27 pavalos Exp $ */ /* System Headers */ @@ -69,7 +68,7 @@ enum { /* symbols */ /* parse translation table - table driven parsers can be your FRIEND! */ -struct { +static const struct { const char *name; /* token name */ int value; /* token id */ int plural; /* is this plural? */ @@ -300,6 +299,7 @@ plus(struct tm *tm) break; case WEEKS: delay *= 7; + /* FALLTHROUGH */ case DAYS: tm->tm_mday += delay; break; @@ -458,6 +458,7 @@ month(struct tm *tm) /* do something tomorrow */ tm->tm_mday ++; tm->tm_wday ++; + /* FALLTHROUGH */ case TODAY: /* force ourselves to stay in today - no further processing */ token(); break; @@ -581,6 +582,7 @@ parsetime(int argc, char **argv) } /* now is optional prefix for PLUS tree */ expect(PLUS); + /* FALLTHROUGH */ case PLUS: plus(&runtime); break; @@ -599,8 +601,10 @@ parsetime(int argc, char **argv) */ case TEATIME: hr += 4; + /* FALLTHROUGH */ case NOON: hr += 12; + /* FALLTHROUGH */ case MIDNIGHT: if (runtime.tm_hour >= hr) { runtime.tm_mday++; @@ -609,7 +613,7 @@ parsetime(int argc, char **argv) runtime.tm_hour = hr; runtime.tm_min = 0; token(); - /* FALLTHROUGH to month setting */ + /* FALLTHROUGH */ default: month(&runtime); break; -- 2.41.0