Browse Source

【主线待合】增加tail命令

paint_robot_new-v1.5
Lizongdi 1 week ago
parent
commit
d2681152f0
  1. 6
      lua/lua.c

6
lua/lua.c

@ -485,8 +485,8 @@ static int l_cat(lua_State *L)
static int l_tail(lua_State *L) static int l_tail(lua_State *L)
{ {
const char *path = luaL_optstring(L, 1, "C:rd.log"); long n = luaL_optinteger(L, 1, 15);
long n = luaL_optinteger(L, 2, 15); const char *path = luaL_optstring(L, 2, "C:rd.log");
long start_off = 0; /* 实际输出的起始偏移 */ long start_off = 0; /* 实际输出的起始偏移 */
long lines = 0; /* 文件总行数 */ long lines = 0; /* 文件总行数 */
@ -667,7 +667,7 @@ static int luaopen_default(lua_State *L)
lua_register_help(L, "name", l_name, "Show build time"); lua_register_help(L, "name", l_name, "Show build time");
lua_register_help(L, "echo", l_echo, "eg: echo(\"Hello\", \"C:a.txt\")"); lua_register_help(L, "echo", l_echo, "eg: echo(\"Hello\", \"C:a.txt\")");
lua_register_help(L, "cat", l_cat, "eg: cat(\"C:a.txt\")"); lua_register_help(L, "cat", l_cat, "eg: cat(\"C:a.txt\")");
lua_register_help(L, "tail", l_tail, "eg: tail(\"C:rd.log\") tail(\"C:rd.log\", 30)"); lua_register_help(L, "tail", l_tail, "eg: tail(30) tail(30, \"C:rd.log\")");
lua_register_help(L, "mv", l_mv, "eg: mv(\"C:a.txt\", \"C:b.txt\")"); lua_register_help(L, "mv", l_mv, "eg: mv(\"C:a.txt\", \"C:b.txt\")");
lua_register_help(L, "rm", l_rm, "eg: rm(\"C:a.txt\")"); lua_register_help(L, "rm", l_rm, "eg: rm(\"C:a.txt\")");
lua_register_help(L, "ls", l_ls, "eg: ls()"); lua_register_help(L, "ls", l_ls, "eg: ls()");

Loading…
Cancel
Save