@(#) LVM README file. $Revision: 72.1 $$Date: 94/05/23 10:35:40 $

This file is a kind of catchall which might be used to track general
changes in LVM commands philosophy and other tidbits of information.

------------------------------------------------------------------------------
For starters here is a script that mimics xmkcatdefs: should it go away
one day we will be prepared....
#
# mycatdefs - a script that mimics xmkcatdefs.
#	input - The name of the module.
#	        The OSF style message file. (macroname message)
#	output - The messages suitable to be used as input to gencat.
#
# 	example - mycatdefs lvm ../lvm.msg
#
# WARNING:	Error checking is minimum.
#

Usage="Usage: mycatdefs <module-name> <OSF-message-file>"

if [ $# -ne 2 ] ; then
	print $Usage;
	exit
fi

#
# Set the temporary message file
#
Tmpmsgfile=${TMPDIR}/msg.$$

#
# Set the Headerfile that is being generated.
#
Headerfile="${1}_msg.h"
rm $Headerfile

#
# Filter the message file; removing trailing blanks; joining split lines while
# preserving those metacharacters that are for later printfs. Note that we are
# substituting \n by \\\\n because it is stripped while reading and printing.
# Place the output in the temporary message file.
#
cat $2| 
sed -e 's/\\[  ]*$/\\/' -e 's/\(\\[tnb"]\)/\\\\\\\1/g' |
while read line; do print $line; done  > $Tmpmsgfile


#
# Get each line from the temp message file; split lines are already joined.
#
cat $Tmpmsgfile |
awk '
#
# Initial includes and comment.
#

BEGIN	{ 
	Headerfile = "'$Headerfile'"
	print "#include <limits.h>" >> Headerfile
	print "#include <nl_types.h>" >> Headerfile
	print "\n#define MF_" toupper("'$1'"), "\"" "'$1'" ".cat\"\n" >> Headerfile
	print "\n/* The following was generated from " "'$2'" ". */\n" >> Headerfile
}

#
# If a new set is starting, reset counters; print comments.
#
/^\$/ {
	if (match($1, "^\$set")) {
		set++;
		msgno = 0;
		print "\n\n/* definitions for set",$2,"*/" >> Headerfile
		print "#define", $2, set, "\n\n" >> Headerfile
		printf "%s %d\n", $1, set
	} else {
		print $0
	}
	next
}

#
# Count all the non-blank lines (which do not start with $) as messages.
#
!/^$/ {
	++msgno;
	print "#define", $1, msgno >> Headerfile
	printf "%d\t", msgno
	for (i = 2; i <= NF; i++) 
		printf "%s ", $i
	print "\n"
	}
' 

rm $Tmpmsgfile

------------------------------------------------------------------------------
