ncal.c (78016) | ncal.c (78027) |
---|---|
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 78016 2001-06-10 21:06:01Z ache $"; | 29 "$FreeBSD: head/usr.bin/ncal/ncal.c 78027 2001-06-10 23:26:47Z ache $"; |
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> --- 162 unchanged lines hidden (view full) --- 200 * and use the country code to determine the default 201 * switchdate and date format from the switches table. 202 */ 203 if (setlocale(LC_ALL, "") == NULL) 204 warn("setlocale"); 205 locale = setlocale(LC_TIME, NULL); 206 if (locale == NULL || 207 strcmp(locale, "C") == 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> --- 162 unchanged lines hidden (view full) --- 200 * and use the country code to determine the default 201 * switchdate and date format from the switches table. 202 */ 203 if (setlocale(LC_ALL, "") == NULL) 204 warn("setlocale"); 205 locale = setlocale(LC_TIME, NULL); 206 if (locale == NULL || 207 strcmp(locale, "C") == 0 || |
208 strcmp(locale, "POSIX") == 0) | 208 strcmp(locale, "POSIX") == 0 || 209 strcmp(locale, "ASCII") == 0 || 210 strcmp(locale, "US-ASCII") == 0) |
209 locale = "_US"; 210 q = switches + sizeof(switches) / sizeof(struct djswitch); 211 for (p = switches; p != q; p++) 212 if ((cp = strstr(locale, p->cc)) != NULL && *(cp - 1) == '_') 213 break; 214 if (p == q) { 215 nswitch = ndaysj(&dftswitch->dt); 216 } else { --- 632 unchanged lines hidden --- | 211 locale = "_US"; 212 q = switches + sizeof(switches) / sizeof(struct djswitch); 213 for (p = switches; p != q; p++) 214 if ((cp = strstr(locale, p->cc)) != NULL && *(cp - 1) == '_') 215 break; 216 if (p == q) { 217 nswitch = ndaysj(&dftswitch->dt); 218 } else { --- 632 unchanged lines hidden --- |