Developing lightweight computation at the DSG edge
Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Quick Mesh Project
qMp packages
Commits
d2b46e91
Commit
d2b46e91
authored
Jun 26, 2012
by
p4u
Browse files
Added new function: qmpinfo links
parent
e24454e5
Changes
2
Hide whitespace changes
Inline
Side-by-side
packages/qmp-small-node/files/etc/qmp/qmpinfo
View file @
d2b46e91
...
...
@@ -101,6 +101,15 @@ function nodes()
end
end
function
links
()
for
_
,
n
in
ipairs
(
qmpinfo
.
links
())
do
if
#
n
==
2
then
print
(
n
[
1
]
..
" "
..
n
[
2
])
end
end
end
function
key
()
print
(
qmpinfo
.
get_key
())
end
...
...
@@ -129,6 +138,8 @@ elseif question == "nodes" then
nodes
()
elseif
question
==
"key"
then
key
()
elseif
question
==
"links"
then
links
()
else
print_help
()
end
...
...
packages/qmp-small-node/files/etc/qmp/qmpinfo.lua
View file @
d2b46e91
...
...
@@ -207,6 +207,21 @@ function qmpinfo.nodes()
return
result
end
function
qmpinfo
.
links
()
local
nodes
=
util
.
split
(
util
.
exec
(
'bmx6 -c --links | awk \'
{
print
$
1
"|"
$
2
}
\
' | grep -e ".*:.*:"'
))
local
ni
result
=
{}
for
_
,
n
in
ipairs
(
nodes
)
do
if
n
~=
""
then
ni
=
util
.
split
(
n
,
"|"
)
ni
[
1
]
=
util
.
split
(
ni
[
1
],
"."
)[
1
]
table.insert
(
result
,
ni
)
end
end
return
result
end
function
qmpinfo
.
get_key
()
local
keyf
=
util
.
exec
(
"uci get qmp.node.key"
)
if
#
keyf
<
2
then
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment