|
|
DataMuseum.dkPresents historical artifacts from the history of: DKUUG/EUUG Conference tapes |
This is an automatic "excavation" of a thematic subset of
See our Wiki for more about DKUUG/EUUG Conference tapes Excavated with: AutoArchaeologist - Free & Open Source Software. |
top - metrics - downloadIndex: T o
Length: 1510 (0x5e6)
Types: TextFile
Names: »or_buildpn.c«
└─⟦2d1937cfd⟧ Bits:30007241 EUUGD22: P.P 5.0
└─⟦dc59850a2⟧ »EurOpenD22/pp5.0/pp-5.tar.Z«
└─⟦e5a54fb17⟧
└─⟦this⟧ »pp-5.0/Lib/or/or_buildpn.c«
/* or_buildpn: build a personal name from string */
# ifndef lint
static char Rcsid[] = "@(#)$Header: /cs/research/pp/hubris/pp-beta/Lib/or/RCS/or_buildpn.c,v 5.0 90/09/20 16:07:54 pp Exp Locker: pp $";
# endif
/*
* $Header: /cs/research/pp/hubris/pp-beta/Lib/or/RCS/or_buildpn.c,v 5.0 90/09/20 16:07:54 pp Exp Locker: pp $
*
* $Log: or_buildpn.c,v $
* Revision 5.0 90/09/20 16:07:54 pp
* rcsforce : 5.0 public release
*
*/
#include "or.h"
#include "util.h"
/*
Takes string and builds a tree
*/
OR_ptr or_buildpn (str)
char *str;
{
OR_ptr or,
tor,
tree;
char tbuf[LINESIZE],
*q,
*r;
PP_DBG (("or_util.c/or_buildpn (%s)", str));
tree = NULLOR;
if ((q = index (str, '.')) == NULLCP)
/*
Only a surname is specified
*/
q = str;
else {
if ((q - str) > 1) {
/*
A given name is specified
*/
*q++ = '\0';
tree = or_new (OR_G, NULLCP, str);
}
else
q = str;
/*
Do the initials from q
*/
r = tbuf;
while (TRUE) {
if (!isalpha (*q) || (*(q + 1) != '.'))
break;
*r++ = *q;
q = q + 2;
}
*r = '\0';
if (tbuf[0] != '\0') {
or = or_new (OR_I, NULLCP, tbuf);
if ((tor = or_add (tree, or, TRUE)) == NULLOR) {
or_free (or);
return NULLOR;
}
tree = tor;
}
}
/*
q now points to start of surname
*/
or = or_new (OR_S, NULLCP, q);
tor = or_add (tree, or, TRUE);
if (tor == NULLOR) {
or_free (tree);
return NULLOR;
}
tree = tor;
return tree;
}