From a958272d76178102b2f0666f53fac3359d1146bf Mon Sep 17 00:00:00 2001 From: Christian Neukirchen Date: Fri, 1 May 2015 01:29:18 +0200 Subject: cvs update --- src/usr.bin/calendar/calendar.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'src/usr.bin/calendar/calendar.c') diff --git a/src/usr.bin/calendar/calendar.c b/src/usr.bin/calendar/calendar.c index b5da818..b4605b0 100644 --- a/src/usr.bin/calendar/calendar.c +++ b/src/usr.bin/calendar/calendar.c @@ -1,4 +1,4 @@ -/* $OpenBSD: calendar.c,v 1.29 2015/02/08 23:40:34 deraadt Exp $ */ +/* $OpenBSD: calendar.c,v 1.31 2015/04/18 18:28:37 deraadt Exp $ */ /* * Copyright (c) 1989, 1993, 1994 @@ -40,8 +40,8 @@ #include #include #include +#include #include -#include #include #include "pathnames.h" @@ -68,6 +68,7 @@ int main(int argc, char *argv[]) { int ch; + const char *errstr; char *caldir; (void)setlocale(LC_ALL, ""); @@ -95,12 +96,16 @@ main(int argc, char *argv[]) break; case 'A': /* days after current date */ - f_dayAfter = atoi(optarg); + f_dayAfter = strtonum(optarg, 0, INT_MAX, &errstr); + if (errstr) + errx(1, "-A %s: %s", optarg, errstr); f_SetdayAfter = 1; break; case 'B': /* days before current date */ - f_dayBefore = atoi(optarg); + f_dayBefore = strtonum(optarg, 0, INT_MAX, &errstr); + if (errstr) + errx(1, "-B %s: %s", optarg, errstr); break; default: -- cgit 1.4.1