Deleted Added
full compact
ncal.c (191330) ncal.c (191364)
1/*-
2 * Copyright (c) 1997 Wolfgang Helbig
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 12 unchanged lines hidden (view full) ---

21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 * SUCH DAMAGE.
25 */
26
27#ifndef lint
28static const char rcsid[] =
1/*-
2 * Copyright (c) 1997 Wolfgang Helbig
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 12 unchanged lines hidden (view full) ---

21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 * SUCH DAMAGE.
25 */
26
27#ifndef lint
28static const char rcsid[] =
29 "$FreeBSD: head/usr.bin/ncal/ncal.c 191330 2009-04-20 18:19:38Z rdivacky $";
29 "$FreeBSD: head/usr.bin/ncal/ncal.c 191364 2009-04-21 17:44:46Z rdivacky $";
30#endif /* not lint */
31
32#include <calendar.h>
33#include <ctype.h>
34#include <err.h>
35#include <langinfo.h>
36#include <locale.h>
37#include <stdio.h>

--- 166 unchanged lines hidden (view full) ---

204 char *flag_month = NULL; /* requested month as string */
205 const char *locale; /* locale to get country code */
206 char tbuf[1024], cbuf[512], *b;
207 time_t t;
208 struct tm *tm1;
209
210 term_e = term_r = NULL;
211 today = 0;
30#endif /* not lint */
31
32#include <calendar.h>
33#include <ctype.h>
34#include <err.h>
35#include <langinfo.h>
36#include <locale.h>
37#include <stdio.h>

--- 166 unchanged lines hidden (view full) ---

204 char *flag_month = NULL; /* requested month as string */
205 const char *locale; /* locale to get country code */
206 char tbuf[1024], cbuf[512], *b;
207 time_t t;
208 struct tm *tm1;
209
210 term_e = term_r = NULL;
211 today = 0;
212 if (isatty(1) && tgetent(tbuf, getenv("TERM")) == 1) {
212 if (isatty(STDOUT_FILENO) && tgetent(tbuf, NULL) == 1) {
213 date dt; /* handy date */
214
215 b = cbuf;
213 date dt; /* handy date */
214
215 b = cbuf;
216 term_r = tgetstr("mr", &b);
217 term_e = tgetstr("me", &b);
216 term_r = tgetstr("so", &b);
217 term_e = tgetstr("se", &b);
218 t = time(NULL);
219 tm1 = localtime(&t);
220 dt.y = tm1->tm_year + 1900;
221 dt.m = tm1->tm_mon + 1;
222 dt.d = tm1->tm_mday;
223
224 today = sndaysb(&dt);
225 }

--- 32 unchanged lines hidden (view full) ---

258 cp = (cp == NULL) ? argv[0] : cp + 1;
259 if (strcmp("cal", cp) == 0)
260 flag_backward = 1;
261
262 /* Set the switch date to United Kingdom if backwards compatible */
263 if (flag_backward)
264 nswitchb = ndaysj(&ukswitch);
265
218 t = time(NULL);
219 tm1 = localtime(&t);
220 dt.y = tm1->tm_year + 1900;
221 dt.m = tm1->tm_mon + 1;
222 dt.d = tm1->tm_mday;
223
224 today = sndaysb(&dt);
225 }

--- 32 unchanged lines hidden (view full) ---

258 cp = (cp == NULL) ? argv[0] : cp + 1;
259 if (strcmp("cal", cp) == 0)
260 flag_backward = 1;
261
262 /* Set the switch date to United Kingdom if backwards compatible */
263 if (flag_backward)
264 nswitchb = ndaysj(&ukswitch);
265
266 while ((ch = getopt(argc, argv, "Jejm:ops:wy")) != -1)
266 while ((ch = getopt(argc, argv, "Jehjm:ops:wy")) != -1)
267 switch (ch) {
268 case 'J':
269 if (flag_backward)
270 usage();
271 nswitch = ndaysj(&never);
272 flag_julian_cal = 1;
273 break;
267 switch (ch) {
268 case 'J':
269 if (flag_backward)
270 usage();
271 nswitch = ndaysj(&never);
272 flag_julian_cal = 1;
273 break;
274 case 'h':
275 term_r = term_e = NULL;
276 break;
274 case 'e':
275 if (flag_backward)
276 usage();
277 flag_easter = 1;
278 break;
279 case 'j':
280 flag_julian_day = 1;
281 break;

--- 697 unchanged lines hidden ---
277 case 'e':
278 if (flag_backward)
279 usage();
280 flag_easter = 1;
281 break;
282 case 'j':
283 flag_julian_day = 1;
284 break;

--- 697 unchanged lines hidden ---