ed - y.tab.h <<EOF
v/# *define/d
1,\$s/# *define */"/
1,\$s/ .*/",/
1i
static
char *tokennames[] = {
.
\$a
0};

/*
 * Copyright (c) 1989 Brian Sturgill
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms are permitted
 * provided that the above copyright notice and this paragraph are
 * duplicated in all such forms and that any documentation,
 * advertising materials, and other materials related to such
 * distribution and use acknowledge that the software was developed
 * by Brian Sturgill and Raphael Finkel at the University of Kentucky,
 * Department of Computer Science.  The names of the University or the
 * authors may not be used to endorse or promote products derived
 * from this software without specific prior written permission.
 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
 * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
 */

#include <ctype.h>
#include "global.h"
char *
tokenname(t)
int t;
{
static char buf[256];

if(isprint(t) && t < '\\177')
	(void) sprintf(buf,"'%c'",t);
else if(t < 257)
	(void) sprintf(buf,"'\\\\%03o'",t);
else if(t >= 257 && t < 500)
	(void) strcpy(buf,tokennames[t-257]);
else
	(void) strcpy(buf,"Huh?");
return(buf);
}
.
w tokenname.c
q
EOF
