@@ -3,8 +3,6 @@ local Log = require("log")
33local PDU = require (" pdu" )
44local CMD_PDU = require (" cmd_pdu" )
55
6- local LOG_TAG = " rd_server"
7-
86local function get_note_cus_cmd (suffix )
97 local cmd = nil
108
@@ -22,31 +20,7 @@ local function get_note_cus_cmd (suffix)
2220end
2321
2422local function get_note_sys_cmd (suffix )
25- local file_type , file_cmd
26-
27- local type_file = io.popen (" assoc ." .. suffix , " r" )
28- if (type_file ~= nil ) then
29- local msg = type_file :read (" *l" )
30-
31- file_type = msg and string.match (msg , " =%a+" )
32- type_file :close ()
33- end
34-
35- if (file_type ~= nil ) then
36- local cmd_file = io.popen (" ftype " .. string.sub (file_type , 2 ), " r" )
37- if (cmd_file ~= nil ) then
38- local msg = cmd_file :read (" *l" )
39-
40- file_cmd = msg and string.match (msg , " =%a+" )
41- cmd_file :close ()
42- end
43- end
44-
45- if (file_cmd ~= nil ) then
46- return string.sub (file_cmd , 2 )
47- else
48- return nil
49- end
23+ return nil
5024end
5125
5226local custom_remote_command = {
@@ -71,17 +45,18 @@ local custom_remote_command = {
7145}
7246
7347local function get_mapped_cmd (cmd , cmd_args , cmd_path )
74- local remote_cmd = cmd
48+ local remote_cmd = nil
7549
7650 if (custom_remote_command [cmd ] ~= nil ) then
7751 remote_cmd = custom_remote_command [cmd ](cmd , cmd_args , cmd_path )
78- else
79- for cmd , cmd_proc in pairs (server_cfg .remote_cmd_map ) do
80- if (remote_cmd == cmd ) then
81- remote_cmd = cmd_proc
82- break
83- end
84- end
52+ end
53+
54+ if remote_cmd == nil then
55+ remote_cmd = server_cfg .remote_cmd_map [cmd ]
56+ end
57+
58+ if remote_cmd == nil then
59+ remote_cmd = cmd
8560 end
8661
8762 return remote_cmd
@@ -108,11 +83,7 @@ local function get_local_command (cmd, cmd_args, cmd_path)
10883
10984 cmd_args = string.gsub (cmd_args , " \\ " , " /" )
11085 cmd_path = string.gsub (cmd_path , " \\ " , " /" )
111- ext_command = " & "
112-
113- target_cmd = server_cfg .remote_cmd_map [cmd ]
114- target_cmd = target_cmd or cmd
115- target_cmd = target_cmd .. " " .. cmd_args
86+ target_cmd = cmd .. " " .. cmd_args
11687
11788 if (cmd_path and # cmd_path > 0 ) then
11889 target_cmd = " cd " .. cmd_path .. " ;" .. target_cmd .. " & "
@@ -159,7 +130,7 @@ local function handle_client (socket)
159130 end
160131 end
161132 else
162- Log .e (LOG_TAG , " rd_server receive illegal message" )
133+ Log .e (" rd_server receive illegal message" )
163134 end
164135end
165136
@@ -169,7 +140,7 @@ dofile(cur_path .. "/core/config.lua")
169140
170141local server_socket = Socket .server (GLOBAL_CONFIG .server_ip , GLOBAL_CONFIG .server_port )
171142if (server_socket == nil ) then
172- Log .e (LOG_TAG , " rd_server create failed" )
143+ Log .e (" rd_server create failed" )
173144 return
174145end
175146
0 commit comments