mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-14 02:27:26 -07:00
changing {} style to match majority of previous style
This commit is contained in:
parent
da6cdf014b
commit
961d929f4d
320 changed files with 5502 additions and 10485 deletions
72
liblua/lua.c
72
liblua/lua.c
|
@ -91,24 +91,21 @@ static const char *progname = LUA_PROGNAME;
|
|||
|
||||
|
||||
|
||||
static void lstop(lua_State *L, lua_Debug *ar)
|
||||
{
|
||||
static void lstop(lua_State *L, lua_Debug *ar) {
|
||||
(void)ar; /* unused arg. */
|
||||
lua_sethook(L, NULL, 0, 0);
|
||||
luaL_error(L, "interrupted!");
|
||||
}
|
||||
|
||||
|
||||
static void laction(int i)
|
||||
{
|
||||
static void laction(int i) {
|
||||
signal(i, SIG_DFL); /* if another SIGINT happens before lstop,
|
||||
terminate process (default action) */
|
||||
lua_sethook(globalL, lstop, LUA_MASKCALL | LUA_MASKRET | LUA_MASKCOUNT, 1);
|
||||
}
|
||||
|
||||
|
||||
static void print_usage(const char *badoption)
|
||||
{
|
||||
static void print_usage(const char *badoption) {
|
||||
luai_writestringerror("%s: ", progname);
|
||||
if (badoption[1] == 'e' || badoption[1] == 'l')
|
||||
luai_writestringerror("'%s' needs argument\n", badoption);
|
||||
|
@ -129,15 +126,13 @@ static void print_usage(const char *badoption)
|
|||
}
|
||||
|
||||
|
||||
static void l_message(const char *pname, const char *msg)
|
||||
{
|
||||
static void l_message(const char *pname, const char *msg) {
|
||||
if (pname) luai_writestringerror("%s: ", pname);
|
||||
luai_writestringerror("%s\n", msg);
|
||||
}
|
||||
|
||||
|
||||
static int report(lua_State *L, int status)
|
||||
{
|
||||
static int report(lua_State *L, int status) {
|
||||
if (status != LUA_OK && !lua_isnil(L, -1)) {
|
||||
const char *msg = lua_tostring(L, -1);
|
||||
if (msg == NULL) msg = "(error object is not a string)";
|
||||
|
@ -151,8 +146,7 @@ static int report(lua_State *L, int status)
|
|||
|
||||
|
||||
/* the next function is called unprotected, so it must avoid errors */
|
||||
static void finalreport(lua_State *L, int status)
|
||||
{
|
||||
static void finalreport(lua_State *L, int status) {
|
||||
if (status != LUA_OK) {
|
||||
const char *msg = (lua_type(L, -1) == LUA_TSTRING) ? lua_tostring(L, -1)
|
||||
: NULL;
|
||||
|
@ -163,8 +157,7 @@ static void finalreport(lua_State *L, int status)
|
|||
}
|
||||
|
||||
|
||||
static int traceback(lua_State *L)
|
||||
{
|
||||
static int traceback(lua_State *L) {
|
||||
const char *msg = lua_tostring(L, 1);
|
||||
if (msg)
|
||||
luaL_traceback(L, L, msg, 1);
|
||||
|
@ -176,8 +169,7 @@ static int traceback(lua_State *L)
|
|||
}
|
||||
|
||||
|
||||
static int docall(lua_State *L, int narg, int nres)
|
||||
{
|
||||
static int docall(lua_State *L, int narg, int nres) {
|
||||
int status;
|
||||
int base = lua_gettop(L) - narg; /* function index */
|
||||
lua_pushcfunction(L, traceback); /* push traceback function */
|
||||
|
@ -191,15 +183,13 @@ static int docall(lua_State *L, int narg, int nres)
|
|||
}
|
||||
|
||||
|
||||
static void print_version(void)
|
||||
{
|
||||
static void print_version(void) {
|
||||
luai_writestring(LUA_COPYRIGHT, strlen(LUA_COPYRIGHT));
|
||||
luai_writeline();
|
||||
}
|
||||
|
||||
|
||||
static int getargs(lua_State *L, char **argv, int n)
|
||||
{
|
||||
static int getargs(lua_State *L, char **argv, int n) {
|
||||
int narg;
|
||||
int i;
|
||||
int argc = 0;
|
||||
|
@ -217,24 +207,21 @@ static int getargs(lua_State *L, char **argv, int n)
|
|||
}
|
||||
|
||||
|
||||
static int dofile(lua_State *L, const char *name)
|
||||
{
|
||||
static int dofile(lua_State *L, const char *name) {
|
||||
int status = luaL_loadfile(L, name);
|
||||
if (status == LUA_OK) status = docall(L, 0, 0);
|
||||
return report(L, status);
|
||||
}
|
||||
|
||||
|
||||
static int dostring(lua_State *L, const char *s, const char *name)
|
||||
{
|
||||
static int dostring(lua_State *L, const char *s, const char *name) {
|
||||
int status = luaL_loadbuffer(L, s, strlen(s), name);
|
||||
if (status == LUA_OK) status = docall(L, 0, 0);
|
||||
return report(L, status);
|
||||
}
|
||||
|
||||
|
||||
static int dolibrary(lua_State *L, const char *name)
|
||||
{
|
||||
static int dolibrary(lua_State *L, const char *name) {
|
||||
int status;
|
||||
lua_getglobal(L, "require");
|
||||
lua_pushstring(L, name);
|
||||
|
@ -245,8 +232,7 @@ static int dolibrary(lua_State *L, const char *name)
|
|||
}
|
||||
|
||||
|
||||
static const char *get_prompt(lua_State *L, int firstline)
|
||||
{
|
||||
static const char *get_prompt(lua_State *L, int firstline) {
|
||||
const char *p;
|
||||
lua_getglobal(L, firstline ? "_PROMPT" : "_PROMPT2");
|
||||
p = lua_tostring(L, -1);
|
||||
|
@ -258,8 +244,7 @@ static const char *get_prompt(lua_State *L, int firstline)
|
|||
#define EOFMARK "<eof>"
|
||||
#define marklen (sizeof(EOFMARK)/sizeof(char) - 1)
|
||||
|
||||
static int incomplete(lua_State *L, int status)
|
||||
{
|
||||
static int incomplete(lua_State *L, int status) {
|
||||
if (status == LUA_ERRSYNTAX) {
|
||||
size_t lmsg;
|
||||
const char *msg = lua_tolstring(L, -1, &lmsg);
|
||||
|
@ -272,8 +257,7 @@ static int incomplete(lua_State *L, int status)
|
|||
}
|
||||
|
||||
|
||||
static int pushline(lua_State *L, int firstline)
|
||||
{
|
||||
static int pushline(lua_State *L, int firstline) {
|
||||
char buffer[LUA_MAXINPUT];
|
||||
char *b = buffer;
|
||||
size_t l;
|
||||
|
@ -294,8 +278,7 @@ static int pushline(lua_State *L, int firstline)
|
|||
}
|
||||
|
||||
|
||||
static int loadline(lua_State *L)
|
||||
{
|
||||
static int loadline(lua_State *L) {
|
||||
int status;
|
||||
lua_settop(L, 0);
|
||||
if (!pushline(L, 1))
|
||||
|
@ -317,8 +300,7 @@ static int loadline(lua_State *L)
|
|||
}
|
||||
|
||||
|
||||
static void dotty(lua_State *L)
|
||||
{
|
||||
static void dotty(lua_State *L) {
|
||||
int status;
|
||||
const char *oldprogname = progname;
|
||||
progname = NULL;
|
||||
|
@ -341,8 +323,7 @@ static void dotty(lua_State *L)
|
|||
}
|
||||
|
||||
|
||||
static int handle_script(lua_State *L, char **argv, int n)
|
||||
{
|
||||
static int handle_script(lua_State *L, char **argv, int n) {
|
||||
int status;
|
||||
const char *fname;
|
||||
int narg = getargs(L, argv, n); /* collect arguments */
|
||||
|
@ -373,8 +354,7 @@ static int handle_script(lua_State *L, char **argv, int n)
|
|||
#define num_has 4 /* number of 'has_*' */
|
||||
|
||||
|
||||
static int collectargs(char **argv, int *args)
|
||||
{
|
||||
static int collectargs(char **argv, int *args) {
|
||||
int i;
|
||||
for (i = 1; argv[i] != NULL; i++) {
|
||||
if (argv[i][0] != '-') /* not an option? */
|
||||
|
@ -412,8 +392,7 @@ static int collectargs(char **argv, int *args)
|
|||
}
|
||||
|
||||
|
||||
static int runargs(lua_State *L, char **argv, int n)
|
||||
{
|
||||
static int runargs(lua_State *L, char **argv, int n) {
|
||||
int i;
|
||||
for (i = 1; i < n; i++) {
|
||||
lua_assert(argv[i][0] == '-');
|
||||
|
@ -442,8 +421,7 @@ static int runargs(lua_State *L, char **argv, int n)
|
|||
}
|
||||
|
||||
|
||||
static int handle_luainit(lua_State *L)
|
||||
{
|
||||
static int handle_luainit(lua_State *L) {
|
||||
const char *name = "=" LUA_INITVERSION;
|
||||
const char *init = getenv(name + 1);
|
||||
if (init == NULL) {
|
||||
|
@ -458,8 +436,7 @@ static int handle_luainit(lua_State *L)
|
|||
}
|
||||
|
||||
|
||||
static int pmain(lua_State *L)
|
||||
{
|
||||
static int pmain(lua_State *L) {
|
||||
int argc = (int)lua_tointeger(L, 1);
|
||||
char **argv = (char **)lua_touserdata(L, 2);
|
||||
int script;
|
||||
|
@ -500,8 +477,7 @@ static int pmain(lua_State *L)
|
|||
}
|
||||
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
int main(int argc, char **argv) {
|
||||
int status, result;
|
||||
lua_State *L = luaL_newstate(); /* create state */
|
||||
if (L == NULL) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue