timezone.c (200150) | timezone.c (229403) |
---|---|
1/* 2 * Copyright (c) 1987, 1993 3 * The Regents of the University of California. 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 --- 17 unchanged lines hidden (view full) --- 26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 27 * SUCH DAMAGE. 28 */ 29 30#if defined(LIBC_SCCS) && !defined(lint) 31static char sccsid[] = "@(#)timezone.c 8.1 (Berkeley) 6/4/93"; 32#endif /* LIBC_SCCS and not lint */ 33#include <sys/cdefs.h> | 1/* 2 * Copyright (c) 1987, 1993 3 * The Regents of the University of California. 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 --- 17 unchanged lines hidden (view full) --- 26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 27 * SUCH DAMAGE. 28 */ 29 30#if defined(LIBC_SCCS) && !defined(lint) 31static char sccsid[] = "@(#)timezone.c 8.1 (Berkeley) 6/4/93"; 32#endif /* LIBC_SCCS and not lint */ 33#include <sys/cdefs.h> |
34__FBSDID("$FreeBSD: head/lib/libc/gen/timezone.c 200150 2009-12-05 19:31:38Z ed $"); | 34__FBSDID("$FreeBSD: head/lib/libc/gen/timezone.c 229403 2012-01-03 18:51:58Z ed $"); |
35 36#include <sys/types.h> 37#include <sys/time.h> 38#include <stdio.h> 39#include <stdlib.h> 40#include <string.h> 41#define TZ_MAX_CHARS 255 42 --- 11 unchanged lines hidden (view full) --- 54 55char * 56timezone(int zone, int dst) 57{ 58 char *beg, 59 *end; 60 61 if ( (beg = getenv("TZNAME")) ) { /* set in environment */ | 35 36#include <sys/types.h> 37#include <sys/time.h> 38#include <stdio.h> 39#include <stdlib.h> 40#include <string.h> 41#define TZ_MAX_CHARS 255 42 --- 11 unchanged lines hidden (view full) --- 54 55char * 56timezone(int zone, int dst) 57{ 58 char *beg, 59 *end; 60 61 if ( (beg = getenv("TZNAME")) ) { /* set in environment */ |
62 if ( (end = index(beg, ',')) ) {/* "PST,PDT" */ | 62 if ((end = strchr(beg, ','))) { /* "PST,PDT" */ |
63 if (dst) 64 return(++end); 65 *end = '\0'; 66 (void)strncpy(czone,beg,sizeof(czone) - 1); 67 czone[sizeof(czone) - 1] = '\0'; 68 *end = ','; 69 return(czone); 70 } --- 59 unchanged lines hidden --- | 63 if (dst) 64 return(++end); 65 *end = '\0'; 66 (void)strncpy(czone,beg,sizeof(czone) - 1); 67 czone[sizeof(czone) - 1] = '\0'; 68 *end = ','; 69 return(czone); 70 } --- 59 unchanged lines hidden --- |