diff options
author | Christian Neukirchen <chneukirchen@gmail.com> | 2015-05-01 01:29:18 +0200 |
---|---|---|
committer | Christian Neukirchen <chneukirchen@gmail.com> | 2015-05-01 01:29:18 +0200 |
commit | a958272d76178102b2f0666f53fac3359d1146bf (patch) | |
tree | 3372db02d7dca62feabb6dcf2a687b60878af1b6 /src/usr.bin/calendar/calendar.c | |
parent | de8276e8aa55ee4c0fdafe0aa739af45fa0f8387 (diff) | |
download | outils-a958272d76178102b2f0666f53fac3359d1146bf.tar.gz outils-a958272d76178102b2f0666f53fac3359d1146bf.tar.xz outils-a958272d76178102b2f0666f53fac3359d1146bf.zip |
cvs update
Diffstat (limited to 'src/usr.bin/calendar/calendar.c')
-rw-r--r-- | src/usr.bin/calendar/calendar.c | 13 |
1 files changed, 9 insertions, 4 deletions
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 <stdio.h> #include <stdlib.h> #include <string.h> +#include <limits.h> #include <time.h> -#include <tzfile.h> #include <unistd.h> #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: |