By Philipp John - changed the application cal. It does not crash anymore, when the month and year parameter is invalid.
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@5175 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
+6
-2
@@ -153,12 +153,16 @@ main(argc, argv)
|
|||||||
year = 0;
|
year = 0;
|
||||||
switch(argc) {
|
switch(argc) {
|
||||||
case 2:
|
case 2:
|
||||||
if ((month = atoi(*argv++)) < 1 || month > 12)
|
if ((month = atoi(*argv++)) < 1 || month > 12) {
|
||||||
(void)fprintf(stderr,"illegal month value: use 1-12\n");
|
(void)fprintf(stderr,"illegal month value: use 1-12\n");
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
/* FALLTHROUGH */
|
/* FALLTHROUGH */
|
||||||
case 1:
|
case 1:
|
||||||
if ((year = atoi(*argv)) < 1 || year > 9999)
|
if ((year = atoi(*argv)) < 1 || year > 9999) {
|
||||||
(void)fprintf(stderr,"illegal year value: use 1-9999\n");
|
(void)fprintf(stderr,"illegal year value: use 1-9999\n");
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case 0:
|
case 0:
|
||||||
(void)time(&now);
|
(void)time(&now);
|
||||||
|
|||||||
Reference in New Issue
Block a user