#!/bin/sh

#
#    Copyright (c) 1992 Minnesota Supercomputer Center, Inc.
#    Copyright (c) 1992 Army High Performance Computing Research Center
#        (AHPCRC), University of Minnesota
#    Copyright (c) 1995-1999 Laboratory for Computational Science and
#        Engineering (LCSE), University of Minnesota
#
#    This is free software released under the GNU General Public License.
#    There is no warranty for this software.  See the file COPYING for
#    details.
#
#    See the file CONTRIBUTORS for a list of contributors.
#
#    Orignal author(s):
#      Ken Chin-Purcell <ken@ahpcrc.umn.edu> 
#
#    This file is maintained by:
#      Ken Chin-Purcell <ken@ahpcrc.umn.edu> 
#
#    Module name: mkfallback
#
#    Description:
#      Converts application defaults to C string table
#

printf "/*\n * This file is generated automatically by mkfallback. "
printf "Do not edit!\n */\n\n"

awk 'BEGIN	{ cont = 0 }
/^[ 	]*#/ 	{ next }
/^[ 	]*!/	{ next }
/^[ 	]*$/	{ next }
/\\$/		{ if (cont)
			printf "%s", substr($0,1,length($0)-1);
		  else
			printf "\"%s", substr($0,1,length($0)-1);
		  cont = 1;
		  next;
		}
		{ if (cont)
			print $0 "\",";
		  else
			print "\"" $0 "\",";
		  cont = 0;
		}
' $1 | sed -e 's/:[	 ]*/: /' -e 's/\\/\\\\/g'
