Print this page
4337 eliminate /etc/TIMEZONE


   2  * CDDL HEADER START
   3  *
   4  * The contents of this file are subject to the terms of the
   5  * Common Development and Distribution License (the "License").
   6  * You may not use this file except in compliance with the License.
   7  *
   8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
   9  * or http://www.opensolaris.org/os/licensing.
  10  * See the License for the specific language governing permissions
  11  * and limitations under the License.
  12  *
  13  * When distributing Covered Code, include this CDDL HEADER in each
  14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15  * If applicable, add the following below this CDDL HEADER, with the
  16  * fields enclosed by brackets "[]" replaced with your own identifying
  17  * information: Portions Copyright [yyyy] [name of copyright owner]
  18  *
  19  * CDDL HEADER END
  20  */
  21 /*



  22  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
  23  * Use is subject to license terms.
  24  */
  25 
  26 /*      Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T     */
  27 /*        All Rights Reserved   */
  28 
  29 
  30 /*
  31 
  32  * uucp file transfer program:
  33  * to place a call to a remote machine, login, and
  34  * copy files between the two machines.
  35 
  36 */
  37 /*
  38  * Added check to limit the total number of uucicos as defined
  39  * in the Limits file.
  40  *
  41  * Added -f flag to "force execution", ignoring the limit on the


 900 
 901 /*
 902  *      setTZ()
 903  *
 904  *      if login "shell" is uucico (i.e., Role == SLAVE), must set
 905  *      timezone env variable TZ.  otherwise will default to EST.
 906  */
 907 
 908 #define LINELEN 81
 909 
 910 void
 911 setTZ()
 912 {
 913         static char     buf[LINELEN], *bp;
 914         extern char     *fgets();
 915         FILE            *tzfp;
 916         extern FILE     *fopen();
 917         int             i;
 918         extern int      fclose(), strncmp();
 919 
 920         if ( (tzfp = fopen("/etc/TIMEZONE","r")) == (FILE *)NULL )
 921                 return;
 922         while ( (bp = fgets(buf,LINELEN,tzfp)) != (char *)NULL ) {
 923                 while ( isspace(*bp) )
 924                         ++bp;
 925                 if ( strncmp(bp, "TZ=", 3) == 0 ) {
 926                         for ( i = strlen(bp) - 1; i > 0 && isspace(*(bp+i)); --i )
 927                                 *(bp+i) = '\0';
 928                         putenv(bp);
 929                         (void)fclose(tzfp);
 930                         return;
 931                 }
 932         }
 933         (void)fclose(tzfp);
 934         return;
 935 }
 936 #endif /* ATTSVR3 */
 937 
 938 #ifdef NOSTRANGERS
 939 /*
 940 * Function:     checkrmt




   2  * CDDL HEADER START
   3  *
   4  * The contents of this file are subject to the terms of the
   5  * Common Development and Distribution License (the "License").
   6  * You may not use this file except in compliance with the License.
   7  *
   8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
   9  * or http://www.opensolaris.org/os/licensing.
  10  * See the License for the specific language governing permissions
  11  * and limitations under the License.
  12  *
  13  * When distributing Covered Code, include this CDDL HEADER in each
  14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15  * If applicable, add the following below this CDDL HEADER, with the
  16  * fields enclosed by brackets "[]" replaced with your own identifying
  17  * information: Portions Copyright [yyyy] [name of copyright owner]
  18  *
  19  * CDDL HEADER END
  20  */
  21 /*
  22  * Copyright 2014 Garrett D'Amore
  23  */
  24 /*
  25  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
  26  * Use is subject to license terms.
  27  */
  28 
  29 /*      Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T     */
  30 /*        All Rights Reserved   */
  31 
  32 
  33 /*
  34 
  35  * uucp file transfer program:
  36  * to place a call to a remote machine, login, and
  37  * copy files between the two machines.
  38 
  39 */
  40 /*
  41  * Added check to limit the total number of uucicos as defined
  42  * in the Limits file.
  43  *
  44  * Added -f flag to "force execution", ignoring the limit on the


 903 
 904 /*
 905  *      setTZ()
 906  *
 907  *      if login "shell" is uucico (i.e., Role == SLAVE), must set
 908  *      timezone env variable TZ.  otherwise will default to EST.
 909  */
 910 
 911 #define LINELEN 81
 912 
 913 void
 914 setTZ()
 915 {
 916         static char     buf[LINELEN], *bp;
 917         extern char     *fgets();
 918         FILE            *tzfp;
 919         extern FILE     *fopen();
 920         int             i;
 921         extern int      fclose(), strncmp();
 922 
 923         if ( (tzfp = fopen("/etc/default/init","r")) == (FILE *)NULL )
 924                 return;
 925         while ( (bp = fgets(buf,LINELEN,tzfp)) != (char *)NULL ) {
 926                 while ( isspace(*bp) )
 927                         ++bp;
 928                 if ( strncmp(bp, "TZ=", 3) == 0 ) {
 929                         for ( i = strlen(bp) - 1; i > 0 && isspace(*(bp+i)); --i )
 930                                 *(bp+i) = '\0';
 931                         putenv(bp);
 932                         (void)fclose(tzfp);
 933                         return;
 934                 }
 935         }
 936         (void)fclose(tzfp);
 937         return;
 938 }
 939 #endif /* ATTSVR3 */
 940 
 941 #ifdef NOSTRANGERS
 942 /*
 943 * Function:     checkrmt