Files
mercury/tests/debugger/list_cmd.sh
Peter Wang 7fec2d28a7 Add test for mdb 'list' external command.
tests/debugger/list_cmd.m:
tests/debugger/list_cmd.inp:
tests/debugger/list_cmd.exp:
tests/debugger/list_cmd.exp2:
    Add new test case.

tests/debugger/list_cmd.sh:
    Add script to be set as the 'list_cmd'.

tests/debugger/Mmakefile:
    Enable the new test.
2020-10-06 13:42:39 +11:00

30 lines
863 B
Bash
Executable File

#!/bin/sh
#---------------------------------------------------------------------------#
# vim: ts=4 sw=4 expandtab ft=sh
#---------------------------------------------------------------------------#
# Copyright (C) 2020 The Mercury team.
# This file may only be copied under the terms of the GNU General
# Public License - see the file COPYING in the Mercury distribution.
#---------------------------------------------------------------------------#
#
# list_cmd.sh <source-file> <first-line> <last-line> <mark-line>
#
SCRIPT='
NR >= first_line && NR <= last_line {
if (NR == mark_line) {
print "*" NR, $0;
} else {
print " " NR, $0;
}
}'
exec awk \
-v first_line="$2" \
-v last_line="$3" \
-v mark_line="$4" \
"${SCRIPT}" \
"$1"
#-----------------------------------------------------------------------------#