11666Smckusick /* Copyright (c) 1979 Regents of the University of California */ 21666Smckusick 3*3867Smckusic static char sccsid[] = "@(#)NAM.c 1.3 06/10/81"; 41666Smckusick 51666Smckusick #include "h00vars.h" 61666Smckusick 71666Smckusick char * 83013Smckusic NAM(val, name) 91666Smckusick 103013Smckusic long val; /* internal enumerated type value */ 111666Smckusick char *name; /* ptr to enumerated type name descriptor */ 121666Smckusick { 133013Smckusic register int value = val; 141666Smckusick register short *sptr; 151666Smckusick 161666Smckusick sptr = (short *)name; 171666Smckusick if (value < 0 || value >= *sptr) { 18*3867Smckusic ERROR("Enumerated type value of %D is out of range on output\n", 19*3867Smckusic val); 201666Smckusick return; 211666Smckusick } 221666Smckusick sptr++; 231666Smckusick return name + 2 + sptr[value]; 241666Smckusick } 25