File: make_util_pages.sh

package info (click to toggle)
libiio 0.26-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,832 kB
  • sloc: ansic: 21,880; python: 1,844; cs: 1,232; sh: 1,062; cpp: 688; yacc: 441; xml: 192; lex: 172; makefile: 40
file content (21 lines) | stat: -rwxr-xr-x 798 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#!/bin/sh

dir=$1
if [ -z "${dir}" -o ! -f "${dir}/iio_common_cmds.1" -o ! -f "${dir}/iio_common_opts.1" -o ! -f "${dir}/iio_common_footer.1" ] ; then
	echo "not pointing to src directory ${dir}" 1>&2
	exit
fi
file=$2
if [ -z "${file}" -o ! -f "${file}" ] ; then
	echo "missing 2nd argument file to manipulate ${file}" 1>&2
	exit
fi

app=$(grep "^.TH" "${file}" | head -1 | awk '{print $2}')

sed '/##COMMON_COMMANDS_START##/Q' "${file}"
sed "s/##APP_NAME##/${app}/g" "${dir}/iio_common_cmds.1"
sed -n '/^##COMMON_COMMANDS_STOP##/,${p;/^##COMMON_OPTION_START##/q}' "${file}" |  grep -v "##COMMON_"
sed "s/##APP_NAME##/${app}/g" "${dir}/iio_common_opts.1"
sed -ne '/^##COMMON_OPTION_STOP#/,$ p' "${file}" | grep -v "##COMMON_OPTION_STOP##"
sed "s/##APP_NAME##/${app}/g" "${dir}/iio_common_footer.1"