blob: 040591ff4b7a8c7b331bdb82bfa7bcb46745e8d9 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
#!/bin/sh
# Reference: https://openwrt.org/docs/techref/rpcd
. /usr/share/libubox/jshn.sh
get_compile_time_options() {
# Extract all options that begins with '--' as a comma-separated string
source="$(squid -v)"
options="$(echo $source | grep -o "'--[^']*'" | sed "s/'//g")"
json_init
json_add_array 'options'
# For each option, add it to the array
set -- $options
for option; do
json_add_string '' "$option"
done
json_close_array
json_dump
json_cleanup
}
case "$1" in
list)
json_init
json_add_object 'getCompileTimeOptions'
json_close_object
json_dump
json_cleanup
;;
call)
case "$2" in
getCompileTimeOptions)
get_compile_time_options
;;
esac
;;
esac
|