140865Sbostic /*- 2*62092Sbostic * Copyright (c) 1979, 1993 3*62092Sbostic * The Regents of the University of California. All rights reserved. 440865Sbostic * 540865Sbostic * %sccs.include.redist.c% 640865Sbostic */ 71666Smckusick 840865Sbostic #ifndef lint 9*62092Sbostic static char sccsid[] = "@(#)NAM.c 8.1 (Berkeley) 06/06/93"; 1040865Sbostic #endif /* not lint */ 111666Smckusick 121666Smckusick #include "h00vars.h" 131666Smckusick 141666Smckusick char * NAM(val,name)153013SmckusicNAM(val, name) 161666Smckusick 173013Smckusic long val; /* internal enumerated type value */ 181666Smckusick char *name; /* ptr to enumerated type name descriptor */ 191666Smckusick { 203013Smckusic register int value = val; 211666Smckusick register short *sptr; 221666Smckusick 231666Smckusick sptr = (short *)name; 241666Smckusick if (value < 0 || value >= *sptr) { 253867Smckusic ERROR("Enumerated type value of %D is out of range on output\n", 263867Smckusic val); 271666Smckusick } 281666Smckusick sptr++; 291666Smckusick return name + 2 + sptr[value]; 301666Smckusick } 31