[BACK]Return to emacs-gen.sh CVS log [TXT][DIR] Up to [local] / src / bin / ksh

File: [local] / src / bin / ksh / Attic / emacs-gen.sh (download)

Revision 1.1.1.1 (vendor branch), Wed Aug 14 06:19:10 1996 UTC (27 years, 9 months ago) by downsj
Branch: pdksh
CVS Tags: pdksh-527, OPENBSD_3_6_BASE, OPENBSD_3_6, OPENBSD_3_5_BASE, OPENBSD_3_5, OPENBSD_3_4_BASE, OPENBSD_3_4, OPENBSD_3_3_BASE, OPENBSD_3_3, OPENBSD_3_2_BASE, OPENBSD_3_2, OPENBSD_3_1_BASE, OPENBSD_3_1, OPENBSD_3_0_BASE, OPENBSD_3_0, OPENBSD_2_9_BASE, OPENBSD_2_9, OPENBSD_2_8_BASE, OPENBSD_2_8, OPENBSD_2_7_BASE, OPENBSD_2_7, OPENBSD_2_6_BASE, OPENBSD_2_6, OPENBSD_2_5_BASE, OPENBSD_2_5, OPENBSD_2_4_BASE, OPENBSD_2_4, OPENBSD_2_3_BASE, OPENBSD_2_3
Changes since 1.1: +0 -0 lines

Import pdksh 5.2.7.

#!/bin/sh
#	$OpenBSD: emacs-gen.sh,v 1.1.1.1 1996/08/14 06:19:10 downsj Exp $

case $# in
1)	file=$1;;
*)
	echo "$0: Usage: $0 path-to-emacs.c" 1>&2
	exit 1
esac;

if [ ! -r "$file" ] ;then
	echo "$0: can't read $file" 1>&2
	exit 1
fi

cat << E_O_F || exit 1
/*
 * NOTE: THIS FILE WAS GENERATED AUTOMATICALLY FROM $file
 *
 * DO NOT BOTHER EDITING THIS FILE
 */
E_O_F

# Pass 1: print out lines before @START-FUNC-TAB@
#	  and generate defines and function declarations,
sed -e '1,/@START-FUNC-TAB@/d' -e '/@END-FUNC-TAB@/,$d' < $file |
	awk 'BEGIN { nfunc = 0; }
	    /^[	 ]*#/ {
			    print $0;
			    next;
		    }
	    {
		fname = $2;
		c = substr(fname, length(fname), 1);
		if (c == ",")
			fname = substr(fname, 1, length(fname) - 1);
		if (fname != "0") {
			printf "#define XFUNC_%s %d\n", substr(fname, 3, length(fname) - 2), nfunc;
			printf "static int %s ARGS((int c));\n", fname;
			nfunc++;
		}
	    }' || exit 1

exit 0