#!/bin/ksh
# @(#) wstrings.ksh 1.0 94/05/22
# 93/10/05 john h. dubois iii (john@armory.com)
# 94/04/27 Give undocumented -a option to strings to tell it not to do
#          lame OMF-header-reading that makes it fail for pipes
# 94/05/22 Use ^A for sed sub. since / is quite likely to appear in paths

typeset -i narg=0
while [[ "$1" = -* ]]; do
    if [ "$1" = -h ]; then
	name=${0##*/}
	print \
"$name: invoke strings(C) and add filenames to its output.
Usage: $name [strings-options] [filename ...]"
	exit 0
    fi
    let narg+=1
    args[narg]=$1
    shift
done

if [ $# -gt 0 ]; then
    for file; do
	strings -a "${args[@]}" "$file" | sed "s^$file: "
    done
else
    strings -a | sed "s/^/stdin: /"
fi
