38 |
|
|
39 |
/* function macros blind minargs maxargs */ |
/* function macros blind minargs maxargs */ |
40 |
#define builtin_functions \ |
#define builtin_functions \ |
41 |
BUILTIN (getcwd, FALSE, FALSE, 1, 1 ) \ |
BUILTIN (getcwd, false, false, 1, 1 ) \ |
42 |
BUILTIN (getenv, FALSE, TRUE, 2, 2 ) \ |
BUILTIN (getenv, false, true, 2, 2 ) \ |
43 |
BUILTIN (getlogin, FALSE, FALSE, 1, 1 ) \ |
BUILTIN (getlogin, false, false, 1, 1 ) \ |
44 |
BUILTIN (getpid, FALSE, FALSE, 1, 1 ) \ |
BUILTIN (getpid, false, false, 1, 1 ) \ |
45 |
BUILTIN (getppid, FALSE, FALSE, 1, 1 ) \ |
BUILTIN (getppid, false, false, 1, 1 ) \ |
46 |
BUILTIN (getuid, FALSE, FALSE, 1, 1 ) \ |
BUILTIN (getuid, false, false, 1, 1 ) \ |
47 |
BUILTIN (getpwnam, FALSE, TRUE, 2, 2 ) \ |
BUILTIN (getpwnam, false, true, 2, 2 ) \ |
48 |
BUILTIN (getpwuid, FALSE, TRUE, 2, 2 ) \ |
BUILTIN (getpwuid, false, true, 2, 2 ) \ |
49 |
BUILTIN (hostname, FALSE, FALSE, 1, 1 ) \ |
BUILTIN (hostname, false, false, 1, 1 ) \ |
50 |
BUILTIN (rand, FALSE, FALSE, 1, 1 ) \ |
BUILTIN (rand, false, false, 1, 1 ) \ |
51 |
BUILTIN (srand, FALSE, FALSE, 1, 2 ) \ |
BUILTIN (srand, false, false, 1, 2 ) \ |
52 |
BUILTIN (setenv, FALSE, TRUE, 3, 4 ) \ |
BUILTIN (setenv, false, true, 3, 4 ) \ |
53 |
BUILTIN (unsetenv, FALSE, TRUE, 2, 2 ) \ |
BUILTIN (unsetenv, false, true, 2, 2 ) \ |
54 |
BUILTIN (uname, FALSE, FALSE, 1, 1 ) \ |
BUILTIN (uname, false, false, 1, 1 ) \ |
55 |
|
|
56 |
|
|
57 |
#define BUILTIN(handler, macros, blind, min, max) M4BUILTIN(handler); |
#define BUILTIN(handler, macros, blind, min, max) M4BUILTIN(handler); |
66 |
builtin_functions |
builtin_functions |
67 |
#undef BUILTIN |
#undef BUILTIN |
68 |
|
|
69 |
{ 0, 0, FALSE, FALSE, 0, 0 }, |
{ 0, 0, false, false, 0, 0 }, |
70 |
}; |
}; |
71 |
|
|
72 |
/** |
/** |
80 |
bp = getcwd (buf, sizeof buf); |
bp = getcwd (buf, sizeof buf); |
81 |
|
|
82 |
if (bp != NULL) /* in case of error return null string */ |
if (bp != NULL) /* in case of error return null string */ |
83 |
m4_shipout_string (context, obs, buf, 0, FALSE); |
m4_shipout_string (context, obs, buf, 0, false); |
84 |
} |
} |
85 |
|
|
86 |
/** |
/** |
93 |
env = getenv (M4ARG (1)); |
env = getenv (M4ARG (1)); |
94 |
|
|
95 |
if (env != NULL) |
if (env != NULL) |
96 |
m4_shipout_string (context, obs, env, 0, FALSE); |
m4_shipout_string (context, obs, env, 0, false); |
97 |
} |
} |
98 |
|
|
99 |
/** |
/** |
148 |
login = getlogin (); |
login = getlogin (); |
149 |
|
|
150 |
if (login != NULL) |
if (login != NULL) |
151 |
m4_shipout_string (context, obs, login, 0, FALSE); |
m4_shipout_string (context, obs, login, 0, false); |
152 |
} |
} |
153 |
|
|
154 |
/** |
/** |
178 |
|
|
179 |
if (pw != NULL) |
if (pw != NULL) |
180 |
{ |
{ |
181 |
m4_shipout_string (context, obs, pw->pw_name, 0, TRUE); |
m4_shipout_string (context, obs, pw->pw_name, 0, true); |
182 |
obstack_1grow (obs, ','); |
obstack_1grow (obs, ','); |
183 |
m4_shipout_string (context, obs, pw->pw_passwd, 0, TRUE); |
m4_shipout_string (context, obs, pw->pw_passwd, 0, true); |
184 |
obstack_1grow (obs, ','); |
obstack_1grow (obs, ','); |
185 |
m4_shipout_int (obs, pw->pw_uid); |
m4_shipout_int (obs, pw->pw_uid); |
186 |
obstack_1grow (obs, ','); |
obstack_1grow (obs, ','); |
187 |
m4_shipout_int (obs, pw->pw_gid); |
m4_shipout_int (obs, pw->pw_gid); |
188 |
obstack_1grow (obs, ','); |
obstack_1grow (obs, ','); |
189 |
m4_shipout_string (context, obs, pw->pw_gecos, 0, TRUE); |
m4_shipout_string (context, obs, pw->pw_gecos, 0, true); |
190 |
obstack_1grow (obs, ','); |
obstack_1grow (obs, ','); |
191 |
m4_shipout_string (context, obs, pw->pw_dir, 0, TRUE); |
m4_shipout_string (context, obs, pw->pw_dir, 0, true); |
192 |
obstack_1grow (obs, ','); |
obstack_1grow (obs, ','); |
193 |
m4_shipout_string (context, obs, pw->pw_shell, 0, TRUE); |
m4_shipout_string (context, obs, pw->pw_shell, 0, true); |
194 |
} |
} |
195 |
} |
} |
196 |
|
|
209 |
|
|
210 |
if (pw != NULL) |
if (pw != NULL) |
211 |
{ |
{ |
212 |
m4_shipout_string (context, obs, pw->pw_name, 0, TRUE); |
m4_shipout_string (context, obs, pw->pw_name, 0, true); |
213 |
obstack_1grow (obs, ','); |
obstack_1grow (obs, ','); |
214 |
m4_shipout_string (context, obs, pw->pw_passwd, 0, TRUE); |
m4_shipout_string (context, obs, pw->pw_passwd, 0, true); |
215 |
obstack_1grow (obs, ','); |
obstack_1grow (obs, ','); |
216 |
m4_shipout_int (obs, pw->pw_uid); |
m4_shipout_int (obs, pw->pw_uid); |
217 |
obstack_1grow (obs, ','); |
obstack_1grow (obs, ','); |
218 |
m4_shipout_int (obs, pw->pw_gid); |
m4_shipout_int (obs, pw->pw_gid); |
219 |
obstack_1grow (obs, ','); |
obstack_1grow (obs, ','); |
220 |
m4_shipout_string (context, obs, pw->pw_gecos, 0, TRUE); |
m4_shipout_string (context, obs, pw->pw_gecos, 0, true); |
221 |
obstack_1grow (obs, ','); |
obstack_1grow (obs, ','); |
222 |
m4_shipout_string (context, obs, pw->pw_dir, 0, TRUE); |
m4_shipout_string (context, obs, pw->pw_dir, 0, true); |
223 |
obstack_1grow (obs, ','); |
obstack_1grow (obs, ','); |
224 |
m4_shipout_string (context, obs, pw->pw_shell, 0, TRUE); |
m4_shipout_string (context, obs, pw->pw_shell, 0, true); |
225 |
} |
} |
226 |
} |
} |
227 |
|
|
235 |
if (gethostname (buf, sizeof buf) < 0) |
if (gethostname (buf, sizeof buf) < 0) |
236 |
return; |
return; |
237 |
|
|
238 |
m4_shipout_string (context, obs, buf, 0, FALSE); |
m4_shipout_string (context, obs, buf, 0, false); |
239 |
} |
} |
240 |
|
|
241 |
/** |
/** |
273 |
|
|
274 |
if (uname (&ut) == 0) |
if (uname (&ut) == 0) |
275 |
{ |
{ |
276 |
m4_shipout_string (context, obs, ut.sysname, 0, TRUE); |
m4_shipout_string (context, obs, ut.sysname, 0, true); |
277 |
obstack_1grow (obs, ','); |
obstack_1grow (obs, ','); |
278 |
m4_shipout_string (context, obs, ut.nodename, 0, TRUE); |
m4_shipout_string (context, obs, ut.nodename, 0, true); |
279 |
obstack_1grow (obs, ','); |
obstack_1grow (obs, ','); |
280 |
m4_shipout_string (context, obs, ut.release, 0, TRUE); |
m4_shipout_string (context, obs, ut.release, 0, true); |
281 |
obstack_1grow (obs, ','); |
obstack_1grow (obs, ','); |
282 |
m4_shipout_string (context, obs, ut.version, 0, TRUE); |
m4_shipout_string (context, obs, ut.version, 0, true); |
283 |
obstack_1grow (obs, ','); |
obstack_1grow (obs, ','); |
284 |
m4_shipout_string (context, obs, ut.machine, 0, TRUE); |
m4_shipout_string (context, obs, ut.machine, 0, true); |
285 |
} |
} |
286 |
} |
} |
287 |
|
|