lutils.c (9b16231032ddb40be282d76ec0d82b3a0ec96d60) lutils.c (9398a495eb305d5bf240bc998ee2f6128d75f4ca)
1/*-
2 * Copyright (c) 2014 Pedro Souza <pedrosouza@freebsd.org>
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

--- 96 unchanged lines hidden (view full) ---

105 free(argv);
106 }
107 lua_pushinteger(L, res);
108
109 return 1;
110}
111
112static int
1/*-
2 * Copyright (c) 2014 Pedro Souza <pedrosouza@freebsd.org>
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

--- 96 unchanged lines hidden (view full) ---

105 free(argv);
106 }
107 lua_pushinteger(L, res);
108
109 return 1;
110}
111
112static int
113lua_exit(lua_State *L)
114{
115 exit(luaL_checkinteger(L, 1));
116 return 0;
117}
118
119static int
113lua_command_error(lua_State *L)
114{
115
116 lua_pushstring(L, command_errbuf);
117 return 1;
118}
119
120/*

--- 254 unchanged lines hidden (view full) ---

375 w += wrsz;
376 }
377 lua_pushinteger(L, w);
378 return 1;
379}
380
381#define REG_SIMPLE(n) { #n, lua_ ## n }
382static const struct luaL_Reg loaderlib[] = {
120lua_command_error(lua_State *L)
121{
122
123 lua_pushstring(L, command_errbuf);
124 return 1;
125}
126
127/*

--- 254 unchanged lines hidden (view full) ---

382 w += wrsz;
383 }
384 lua_pushinteger(L, w);
385 return 1;
386}
387
388#define REG_SIMPLE(n) { #n, lua_ ## n }
389static const struct luaL_Reg loaderlib[] = {
383 REG_SIMPLE(delay),
384 REG_SIMPLE(command_error),
385 REG_SIMPLE(command),
390 REG_SIMPLE(command),
386 REG_SIMPLE(interpret),
387 REG_SIMPLE(parse),
391 REG_SIMPLE(command_error),
392 REG_SIMPLE(delay),
393 REG_SIMPLE(exit),
388 REG_SIMPLE(getenv),
389 REG_SIMPLE(has_command),
390 REG_SIMPLE(has_feature),
394 REG_SIMPLE(getenv),
395 REG_SIMPLE(has_command),
396 REG_SIMPLE(has_feature),
397 REG_SIMPLE(interpret),
398 REG_SIMPLE(parse),
391 REG_SIMPLE(perform),
392 REG_SIMPLE(printc), /* Also registered as the global 'printc' */
393 REG_SIMPLE(setenv),
394 REG_SIMPLE(time),
395 REG_SIMPLE(unsetenv),
396 { NULL, NULL },
397};
398

--- 74 unchanged lines hidden ---
399 REG_SIMPLE(perform),
400 REG_SIMPLE(printc), /* Also registered as the global 'printc' */
401 REG_SIMPLE(setenv),
402 REG_SIMPLE(time),
403 REG_SIMPLE(unsetenv),
404 { NULL, NULL },
405};
406

--- 74 unchanged lines hidden ---