/***********************************************************************
* *
* This software is part of the ast package *
* Copyright (c) 1985-2011 AT&T Intellectual Property *
* and is licensed under the *
* Common Public License, Version 1.0 *
* by AT&T Intellectual Property *
* *
* A copy of the License is available at *
* (with md5 checksum 059e8cd6165cb4c31e351f2b69388fd9) *
* *
* Information and Software Systems Research *
* AT&T Research *
* Florham Park NJ *
* *
* Glenn Fowler <gsf@research.att.com> *
* David Korn <dgk@research.att.com> *
* Phong Vo <kpv@research.att.com> *
* *
***********************************************************************/
#pragma prototyped
/*
* return the record format string given a format descriptor
*/
#include <recfmt.h>
#include <ctype.h>
char*
{
char* b;
char* e;
char* s;
long n;
b = s = fmtbuf(n = 32);
e = b + n;
switch (RECTYPE(f))
{
case REC_delimited:
*s++ = 'd';
{
del[1] = 0;
if (fs)
else
}
else
*s = 0;
break;
case REC_fixed:
if (!fs)
*s++ = 'f';
break;
case REC_variable:
*s++ = 'v';
if (n = REC_V_SIZE(f))
s += sfsprintf(s, e - s, "%lu", n);
if (REC_V_HEADER(f) != 4)
if (REC_V_OFFSET(f) != 0)
if (REC_V_LENGTH(f) != 2)
if (REC_V_LITTLE(f) != 0)
*s++ = 'l';
if (REC_V_INCLUSIVE(f) == 0)
*s++ = 'n';
*s = 0;
break;
case REC_method:
*s++ = 'm';
switch (n = REC_M_INDEX(f))
{
case REC_M_data:
sfsprintf(s, e - s, "data");
break;
case REC_M_path:
sfsprintf(s, e - s, "path");
break;
default:
sfsprintf(s, e - s, "%lu", n);
break;
}
break;
case REC_none:
*s++ = 'n';
*s = 0;
break;
default:
break;
}
return b;
}