#!/bin/sh

# third character of IFS is a tab-stop, not just a space
IFS=' :	'
read addr type name original_filename line_number < out/entry_point/nm
my_filename="/usr/src/redhat/SOURCES/${original_filename#*BUILD/}"

# If the file is not in the place I'm used to on my machine
# we fall back to the copy shipped with this document.
# Forcing my usage of SRPMs gains nothing.
[ -e "$my_filename" ] || exit 0

sed -n "/^ *int\>/,$line_number p" \
< $my_filename \
> src/entry_point/__libc_start_main
