1 # SPDX-License-Identifier: BSD-3-Clause
2 # Copyright 2018, Olivier MATZ <zer0@droids-corp.org>
4 # Source this file from a shell script to add libecoli helpers.
6 # use a safer version of echo (no option)
17 # $1: node sequence number (ex: ec_node4)
18 ec_pnode_get_first_child()
20 local first_child=${1}_first_child
21 ec_echo $(eval 'ec_echo ${'$first_child'}')
24 # $1: node sequence number (ex: ec_node4)
28 ec_echo $(eval 'ec_echo ${'$next'}')
31 # $1: node sequence number (ex: ec_node4)
34 local seq=${1#ec_node}
36 local next=ec_node${seq}
37 if [ "$(ec_pnode_get_id $next)" != "" ]; then
42 # $1: node sequence number (ex: ec_node4)
46 ec_echo $(eval 'ec_echo ${'$id'}')
49 # $1: node sequence number (ex: ec_node4)
50 ec_pnode_get_strvec_len()
52 local strvec_len=${1}_strvec_len
53 ec_echo $(eval 'ec_echo ${'$strvec_len'}')
56 # $1: node sequence number (ex: ec_node4)
63 local str=${1}_str${2}
64 ec_echo $(eval 'ec_echo ${'$str'}')
67 # $1: node sequence number (ex: ec_node4)
68 # $2: node id (string)
75 while [ "$node_seq" != "" ]; do
76 local id=$(ec_pnode_get_id $node_seq)
77 if [ "$id" = "$2" ]; then
81 node_seq=$(ec_pnode_iter_next $node_seq)