1 /*
   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 2004 Sun Microsystems, Inc. All rights reserved.
  23  * Use is subject to license terms.
  24  */
  25 
  26 
  27 /*
  28  *      globals.cc
  29  *
  30  *      This declares all global variables
  31  */
  32 
  33 /*
  34  * Included files
  35  */
  36 #include <mksh/globals.h>
  37 
  38 /*
  39  * Defined macros
  40  */
  41 
  42 /*
  43  * typedefs & structs
  44  */
  45 
  46 /*
  47  * Global variables
  48  */
  49 char            char_semantics[CHAR_SEMANTICS_ENTRIES];
  50 wchar_t         char_semantics_char[] = {
  51         ampersand_char,
  52         asterisk_char,
  53         at_char,
  54         backquote_char,
  55         backslash_char,
  56         bar_char,
  57         bracketleft_char,
  58         bracketright_char,
  59         colon_char,
  60         dollar_char,
  61         doublequote_char,
  62         equal_char,
  63         exclam_char,
  64         greater_char,
  65         hat_char,
  66         hyphen_char,
  67         less_char,
  68         newline_char,
  69         numbersign_char,
  70         parenleft_char,
  71         parenright_char,
  72         percent_char,
  73         plus_char,
  74         question_char,
  75         quote_char,
  76         semicolon_char,
  77 #ifdef SGE_SUPPORT
  78         space_char,
  79         tab_char,
  80 #endif
  81         nul_char
  82 };
  83 Macro_list      cond_macro_list;
  84 Boolean         conditional_macro_used;
  85 Boolean         do_not_exec_rule;               /* `-n' */
  86 Boolean         dollarget_seen;
  87 Boolean         dollarless_flag;
  88 Name            dollarless_value;
  89 Envvar          envvar;
  90 #ifdef lint
  91 char            **environ;
  92 #endif
  93 #ifdef SUN5_0
  94 int             exit_status;
  95 #endif
  96 wchar_t         *file_being_read;
  97 /* Variable gnu_style=true if env. var. SUN_MAKE_COMPAT_MODE=GNU (RFE 4866328) */
  98 Boolean         gnu_style = false;
  99 Name_set        hashtab;
 100 Name            host_arch;
 101 Name            host_mach;
 102 int             line_number;
 103 char            *make_state_lockfile;
 104 Boolean         make_word_mentioned;
 105 Makefile_type   makefile_type = reading_nothing;
 106 char            mbs_buffer[(MAXPATHLEN * MB_LEN_MAX)];
 107 Name            path_name;
 108 Boolean         posix = true;
 109 Name            hat;
 110 Name            query;
 111 Boolean         query_mentioned;
 112 Boolean         reading_environment;
 113 Name            shell_name;
 114 Boolean         svr4 = false;
 115 Name            target_arch;
 116 Name            target_mach;
 117 Boolean         tilde_rule;
 118 Name            virtual_root;
 119 Boolean         vpath_defined;
 120 Name            vpath_name;
 121 wchar_t         wcs_buffer[MAXPATHLEN];
 122 Boolean         working_on_targets;
 123 #if defined (TEAMWARE_MAKE_CMN) && defined(REDIRECT_ERR)
 124 Boolean         out_err_same;
 125 #endif
 126 pid_t           childPid = -1;  // This variable is used for killing child's process
 127                                 // Such as qrsh, running command, etc.
 128 
 129 /*
 130  * timestamps defined in defs.h
 131  */
 132 const timestruc_t file_no_time          = { -1, 0 };
 133 const timestruc_t file_doesnt_exist     = { 0, 0 };
 134 const timestruc_t file_is_dir           = { 1, 0 };
 135 const timestruc_t file_min_time         = { 2, 0 };
 136 const timestruc_t file_max_time         = { INT_MAX, 0 };