If only the year operand is given, cal shall produce a calendar for all twelve months in the given calendar year.
This commit is contained in:
		
							
								
								
									
										8
									
								
								cal.1
									
									
									
									
									
								
							
							
						
						
									
										8
									
								
								cal.1
									
									
									
									
									
								
							| @@ -28,7 +28,13 @@ of calendars side by side. Each row of calendars contains at most | |||||||
| .IR columns | .IR columns | ||||||
| number of calendars. The defaults are obtained using | number of calendars. The defaults are obtained using | ||||||
| .IR localtime (3). | .IR localtime (3). | ||||||
| The Julian calendar is used through Sep 2, 1752, and the Gregorian calendar is used starting the next day with Sep 14, 1752. | If | ||||||
|  | .IR year | ||||||
|  | is given without | ||||||
|  | .IR month | ||||||
|  | print the whole year, unless overridden by options.  The Julian calendar is used | ||||||
|  | through Sep 2, 1752, and the Gregorian calendar is used starting the next day | ||||||
|  | with Sep 14, 1752. | ||||||
| .SH OPTIONS | .SH OPTIONS | ||||||
| .TP | .TP | ||||||
| .B \-1 | .B \-1 | ||||||
|   | |||||||
							
								
								
									
										11
									
								
								cal.c
									
									
									
									
									
								
							
							
						
						
									
										11
									
								
								cal.c
									
									
									
									
									
								
							| @@ -146,7 +146,7 @@ main(int argc, char *argv[]) | |||||||
| 	fday = 0; | 	fday = 0; | ||||||
|  |  | ||||||
| 	ncols = 3; | 	ncols = 3; | ||||||
| 	nmons = 1; | 	nmons = 0; | ||||||
|  |  | ||||||
| 	ARGBEGIN { | 	ARGBEGIN { | ||||||
| 	case '1': | 	case '1': | ||||||
| @@ -183,6 +183,15 @@ main(int argc, char *argv[]) | |||||||
| 		usage(); | 		usage(); | ||||||
| 	} ARGEND; | 	} ARGEND; | ||||||
|  |  | ||||||
|  | 	if (nmons == 0) { | ||||||
|  | 		if (argc == 1) { | ||||||
|  | 			month = 1; | ||||||
|  | 			nmons = 12; | ||||||
|  | 		} else { | ||||||
|  | 			nmons = 1; | ||||||
|  | 		} | ||||||
|  | 	} | ||||||
|  |  | ||||||
| 	switch (argc) { | 	switch (argc) { | ||||||
| 	case 2: | 	case 2: | ||||||
| 		month = estrtol(argv[0], 0); | 		month = estrtol(argv[0], 0); | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user