/* dsaconfig.c - build a database directory for a Level-1 DSA */
static char *rcsid
= "$Header: /f/osi/others/quipu/tools/dsaconfig/RCS/dsaconfig.c,v 7.10 91/03/09 11:54:38 mrose Exp $";
* $Header: /f/osi/others/quipu/tools/dsaconfig/RCS/dsaconfig.c,v 7.10 91/03/09 11:54:38 mrose Exp $
* Revision 7.10 91/03/09 11:54:38 mrose
* Revision 7.9 91/02/22 09:29:42 mrose
* Revision 7.8 91/02/14 14:13:45 mrose
* Revision 7.7 91/01/11 15:37:51 mrose
* Revision 7.6 90/12/11 10:55:08 mrose
* Revision 7.5 90/10/18 11:33:37 mrose
* Revision 7.4 90/07/27 08:44:58 mrose
* Revision 7.3 90/03/22 08:38:31 mrose
* Revision 7.2 90/01/11 18:36:09 mrose
* Revision 7.1 89/12/06 17:30:24 mrose
* Revision 7.0 89/11/23 22:02:38 mrose
* Acquisition, use, and distribution of this module and related
* materials are subject to the restrictions of a license agreement.
* Consult the Preface in the User's Manual for the full terms of
struct group
*getgrnam ();
struct passwd
*getpwnam (), *getpwuid ();
static char *myname
= "dsaconfig";
static char *wildlife
= NULL
;
static char sedfil
[BUFSIZ
];
void adios (), advise ();
extern char *quipuversion
;
if (access (wildlife
, 0x00) != NOTOK
)
adios (NULLCP
, "%s already exists, choose a different name", wildlife
);
(void) sprintf (buffer
, "find %s -exec /etc/chown %d {} \\;",
(void) sprintf (buffer
, "find %s -exec chown %d {} \\;", wildlife
, uid
);
fprintf (stderr
, "%s\n", buffer
);
(void) sprintf (buffer
, "find %s -exec chgrp %d {} \\;",
fprintf (stderr
, "%s\n", buffer
);
struct country
*read_country ();
static struct pair pairs
[] = {
"dsa", NULL
, /* Spectacled Bear */
"country", NULL
, /* US */
"organization", NULL
, /* Performance Systems International */
"domain", NULL
, /* psi.com */
"unit", NULL
, /* Development */
"street", NULL
, /* 11800 Sunrise Valley Drive */
"town", NULL
, /* Reston */
"state", NULL
, /* Virginia */
"zipcode", NULL
, /* 22091 */
"locality", NULL
, /* Reston, VA */
"postaladdress", NULL
, /* org $ address */
"telephone", NULL
, /* +1 703-620-6651 */
"fax", NULL
, /* +1 703-620-4586 */
"description", NULL
, /* value-added ... */
"ipaddr", NULL
, /* 127.0.0.1 */
"port", NULL
, /* 17003 */
"firstname", NULL
, /* Wengyik */
"lastname", NULL
, /* Yeong */
"middleinitial", NULL
, /* */
"middlename", NULL
, /* */
"mailbox", NULL
, /* yeong@psi.com */
"title", NULL
, /* Staff Scientist */
"userid", NULL
, /* yeongw */
"groupid", NULL
, /* whitepages */
"password", NULL
, /* secret */
"extension", NULL
, /* x1234 */
"wildlife", NULL
, /* spectacled-bear */
"bindir", NULL
, /* /usr/local/bin/ */
"sbindir", NULL
, /* /usr/etc/ */
"etcdir", NULL
, /* /usr/etc/ */
"quipuversion", NULL
, /* from -lquipu */
"rootDSA", NULL
, /* root upstream */
"countryDSA", NULL
, /* country upstream */
"otherDSA", NULL
, /* hack... */
"rootDSAaddress", NULL
, /* PSAP of root upstream */
"countryDSAaddress", NULL
, /* PSAP of country upstream */
"otherDSAaddress", NULL
, /* PSAP of hack... */
register struct country
*c
;
register struct hostent
*hp
;
struct sockaddr_in in_socket
;
register struct sockaddr_in
*isock
= &in_socket
;
(void) sprintf (file
, "%s.dsa", wildlife
);
if ((fp
= fopen (file
, "r")) == NULL
)
adios (file
, "unable to read");
for (lineno
= 1; fgets (buffer
, sizeof buffer
, fp
); lineno
++) {
if (cp
= index (buffer
, '\n'))
(void) strcpy (line
, buffer
);
bzero ((char *) vec
, sizeof vec
);
switch (str2vec (buffer
, vec
)) {
for (p
= pairs
; p
-> p_name
; p
++)
if (strcmp (p
-> p_name
, vec
[0]) == 0)
if (!p
-> p_name
|| (p
-> p_flags
& P_XXX
))
adios (NULLCP
, "unknown variable \"%s\"", vec
[0]);
adios (NULLCP
, "syntax error on line %d:\n%s", lineno
, line
);
for (p
= pairs
; p
-> p_name
; p
++)
if (strcmp (p
-> p_name
, vec
[0]) == 0)
if (!p
-> p_name
|| (p
-> p_flags
& P_XXX
))
adios (NULLCP
, "unknown variable \"%s\"", vec
[0]);
adios (NULLCP
, "multiple values for \"%s\" starting at line %d",
if (p
-> p_flags
& P_MBOX
) {
for (cp
= vec
[1]; *cp
; cp
++)
if (!isascii (*cp
) || *cp
== '$' || *cp
== '&') {
"illegal character %c (0%o) in value for \"%s\"",
*cp
, *cp
& 0xff, p
-> p_name
);
for (cp
= vec
[1]; *cp
; cp
++) {
if (isalpha (*cp
) || isdigit (*cp
))
if ((p
-> p_flags
& P_POST
) && *cp
== '$')
p
-> p_value
= strdup (vec
[1]);
if (ferror (fp
) && !feof (fp
))
adios (file
, "error reading");
for (p
= pairs
; p
-> p_name
; p
++)
if (!p
-> p_value
&& !(p
-> p_flags
& (P_OPT
| P_XXX
)))
adios (NULLCP
, "missing value for \"%s\"", p
-> p_name
);
if (n2p ("country", 0) == NULL
)
n2p ("country", 1) -> p_value
= strdup ("US");
if ((c
= read_country (cp
= n2p ("country", 1) -> p_value
)) == NULL
)
adios (NULLCP
, "unknown country code \"%s\"", cp
);
n2p ("rootDSA", 1) -> p_value
=
strdup (c
-> c_root
? c
-> c_root
: c
-> c_master
);
read_psap (c
-> c_root
, &(n2p ("rootDSAaddress", 1) -> p_value
));
n2p ("countryDSA", 1) -> p_value
= strdup (c
-> c_master
);
read_psap (c
-> c_master
, &(n2p ("countryDSAaddress", 1) -> p_value
));
n2p ("otherDSA", 1) -> p_value
= strdup (c
-> c_other
);
read_psap (c
-> c_other
, &(n2p ("otherDSAaddress", 1) -> p_value
));
if (n2p ("postaladdress", 0) == NULL
&& n2p ("street", 0) == NULL
&& n2p ("pob", 0) == NULL
)
adios (NULLCP
, "must specify either \"street\" or \"pob\"");
if ((p
= n2p ("locality", 1)) -> p_value
== NULL
) {
(void) sprintf (buffer
, "%s, %s", n2p ("town", 1) -> p_value
,
n2p ("state", 1) -> p_value
);
p
-> p_value
= strdup (buffer
);
printf ("setting locality to \"%s\"\n", p
-> p_value
);
if (*(p
= n2p ("telephone", 1)) -> p_value
!= '+') {
(void) sprintf (buffer
, "+%s %s", c
-> c_phone
, p
-> p_value
);
p
-> p_value
= strdup (buffer
);
printf ("setting telephone number to \"%s\"\n", p
-> p_value
);
if ((p
= n2p ("fax", 0)) && *p
-> p_value
!= '+') {
(void) sprintf (buffer
, "+%s %s", c
-> c_phone
, p
-> p_value
);
p
-> p_value
= strdup (buffer
);
printf ("setting fax number to \"%s\"\n", p
-> p_value
);
if ((p
= n2p ("ipaddr", 1)) -> p_value
== NULL
) {
if ((hp
= gethostbyname (cp
= getlocalhost ())) == NULL
)
adios (NULLCP
, "%s: unknown host", cp
);
if ((hp
= gethostbystring (p
-> p_value
)) == NULL
)
adios (NULLCP
, "%s: unknown host", p
-> p_value
);
bzero ((char *) isock
, sizeof *isock
);
isock
-> sin_family
= hp
-> h_addrtype
;
p
-> p_value
= strdup (inet_ntoa (isock
-> sin_addr
));
printf ("setting IP address of DSA to \"%s\"\n", p
-> p_value
);
if ((p
= n2p ("port", 1)) -> p_value
== NULL
) {
p
-> p_value
= strdup ("17003");
printf ("setting TCP port of DSA to \"%s\"\n", p
-> p_value
);
if ((p
= n2p ("middlename", 1)) -> p_value
&& (q
= n2p ("middleinitial", 1)) -> p_value
== NULL
) {
(void) sprintf (buffer
, "%c", *p
-> p_value
);
p
-> p_value
= strdup (buffer
);
printf ("setting MiddleInitial to \"%s\"\n", p
-> p_value
);
uid
= getuid (), gid
= getgid ();
if ((p
= n2p ("userid", 1)) -> p_value
) {
register struct passwd
*pw
= getpwnam (p
-> p_value
);
adios (NULLCP
, "unknown user name \"%s\"", p
-> p_value
);
uid
= pw
-> pw_uid
, gid
= pw
-> pw_gid
;
register struct passwd
*pw
= getpwuid (uid
);
adios (NULLCP
, "unknown user name \"%s\"", p
-> p_value
);
p
-> p_value
= strdup (pw
-> pw_name
);
printf ("setting userid to \"%s\"\n", p
-> p_value
);
if (p
= n2p ("groupid", 0)) {
register struct group
*gr
= getgrnam (p
-> p_value
);
adios (NULLCP
, "unknown group name \"%s\"", p
-> p_value
);
p
= n2p ("extension", 1), q
= n2p ("telephone", 1);
if (*cp
== 'X' || *cp
== 'x') {
(void) sprintf (buffer
, "%s x%s", q
-> p_value
, p
-> p_value
);
p
-> p_value
= strdup (buffer
);
printf ("setting user's telephone number to \"%s\"\n",
p
-> p_value
= strdup (q
-> p_value
);
printf ("setting user telephone number to \"%s\"\n", p
-> p_value
);
n2p ("wildlife", 1) -> p_value
= strdup (wildlife
);
n2p ("bindir", 1) -> p_value
= strdup (isodebinpath
);
n2p ("sbindir", 1) -> p_value
= strdup (isodesbinpath
);
n2p ("etcdir", 1) -> p_value
= strdup (isodetcpath
);
n2p ("quipuversion", 1) -> p_value
= strdup (quipuversion
);
if (dp
= (p
= n2p ("postaladdress", 1)) -> p_value
) {
for (i
= 1; cp
= index (dp
, '$'); dp
= cp
+ 1, i
++) {
"item %d is too long (30 characters maximum): \"%s\"", i
,
adios (NULLCP
, "too many items (%d) in postalAddress, 6 maximum",
(void) sprintf (cp
, "%s $ ", n2p ("organization", 1) -> p_value
);
if ((i
= strlen (cp
)) > 30 + 3) {
"your organization name is longer than 30 characters!");
"You must explicitly define the postalAddress attribute in the\n\
configuration file for your Level-1 DSA.\n\
postaladdress \"item1 $ item2 $ ... $ itemN\"\n\
where each item is <= 30 characters in length and there are no\n\
more than six items. Refer to the Administrator's Guide for more\n\
if (q
= n2p ("pob", 0)) {
(void) sprintf (cp
, "POB %s $ ", q
-> p_value
);
if ((i
= strlen (cp
)) > 30 + 3) {
advise (NULLCP
, "your POB is longer than 26 characters!");
if (q
= n2p ("street", 0)) {
(void) sprintf (cp
, "%s $ ", q
-> p_value
);
if ((i
= strlen (cp
)) > 30 + 3) {
"your street address is longer than 30 characters!");
(void) sprintf (cp
, "%s, %s %s $ ",
n2p ("town", 1) -> p_value
,
n2p ("state", 1) -> p_value
,
n2p ("zipcode", 1) -> p_value
);
if ((i
= strlen (cp
)) > 30 + 3) {
"your town/state/zipcode is longer than 30 characters!");
if ((c
-> c_flags
& C_SHORT
) || (i
= strlen (dp
= c
-> c_name
)) > 30)
i
= strlen (dp
= c
-> c_code
);
p
-> p_value
= strdup (buffer
);
static struct country
*read_country (code
)
static struct country cs
;
register struct country
*c
= NULL
;
(void) strcpy (file
, "iso3166");
if ((fp
= fopen (file
, "r")) == NULL
)
adios (file
, "unable to open");
ep
= (dp
= buffer
) + sizeof buffer
;
while (fgets (dp
, ep
- dp
, fp
)) {
if (cp
= index (buffer
, '\n')) {
if ((d
= getc (fp
)) != EOF
)
if ((dp
= cp
) + 1 >= ep
) {
"virtual line too long in %s: \"%s\"",
switch (vecp
= str2vec (buffer
, vec
)) {
case 7: /* standard entry */
if (strcmp (vec
[0], code
))
bzero ((char *) c
, sizeof *c
);
c
-> c_code
= strdup (vec
[0]);
if (sscanf (vec
[1], "%d", &c
-> c_number
) != 1)
"malformed ISO3166 number for country %s in %s",
c
-> c_number
= atoi (vec
[1]);
c
-> c_name
= strdup (vec
[2]);
if (strcmp (vec
[3], "NULL"))
c
-> c_root
= strdup (vec
[3]);
if (strcmp (vec
[4], "NULL"))
c
-> c_master
= strdup (vec
[4]);
adios (NULLCP
, "no masterDSA known for country %s in %s",
if (strcmp (vec
[5], "NULL"))
c
-> c_other
= strdup (vec
[5]);
c
-> c_phone
= strdup (vec
[6]);
if (strncmp (cp
= vec
[7], "0x", 2) == 0)
if (sscanf (cp
, bp
, &c
-> c_flags
) != 1)
"malformed entry for country %s in %s",
static read_psap (dsa
, addr
)
if ((fp
= fopen (cp
= isodefile ("dsaptailor", 0), "r")) == NULL
)
adios (cp
, "unable to open");
while (fgets (buffer
, sizeof buffer
, fp
)) {
if (lexnequ (buffer
, "dsa_address", sizeof "dsa_address" - 1)
|| (cp
= index (buffer
, '"')) == NULL
|| lexnequ (++cp
, dsa
+ 3, i
= strlen (dsa
+ 3))
for (cp
++; isspace (*cp
); cp
++)
adios (NULLCP
, "malformed entry in dsaptailor for DSA %s", dsa
);
for (dp
= stuff
; *cp
; *dp
++ = *cp
++) {
adios (NULLCP
, "unable to find presentationAddress for DSA %s", dsa
);
(void) sprintf (sedfil
, "/tmp/%sXXXXXX", myname
);
(void) unlink (mktemp (sedfil
));
if ((fp
= fopen (sedfil
, "w")) == NULL
)
adios (sedfil
, "unable to create");
for (p
= pairs
; p
-> p_name
; p
++)
if (!(p
-> p_flags
& P_MBOX
) && p
-> p_value
)
fprintf (fp
, "s!@(%s)!%s!\n", p
-> p_name
, p
-> p_value
);
adios (sedfil
, "error writing");
static struct pair
*n2p (name
, any
)
for (p
= pairs
; p
-> p_name
; p
++)
if (strcmp (p
-> p_name
, name
) == 0)
return (any
|| (p
-> p_value
&& !(p
-> p_flags
& P_ZAP
)) ? p
adios (NULLCP
, "internal error -- unable to find \"%s\"", name
);
static munge (fp
, entries
)
for (pp
= entries
; cp
= *pp
; pp
++) {
if (c
!= '@' || *cp
!= '(') {
if ((dp
= index (++cp
, ')')) == NULL
)
adios (NULLCP
, "internal error -- you lose big");
if ((p
= n2p (cp
, 0)) == NULL
) {
(void) strcpy (bp
, p
-> p_value
);
fprintf (fp
, "%s\n", buffer
);
fprintf (stderr
, "mkdir %s\n", wildlife
);
if (mkdir (wildlife
, 0700) == NOTOK
)
adios (wildlife
, "unable to create directory");
make_file ("root.edb", "EDB", 0600, 0);
"masterDSA= c=@(country)@cn=@(dsa)#",
"acl= group # c=@(country)@o=@(organization)@cn=Manager # write # entry",
"acl= others # read # entry",
"acl= group # c=@(country)@o=@(organization)@cn=Manager # write # default",
"acl= others # read # default",
"acl= group # c=@(country)@o=@(organization)@cn=Manager # write # attributes # userPassword",
"acl= others # compare # attributes # userPassword",
"streetAddress= @(street)",
"physicalDeliveryOfficeName= @(town)",
"stateOrProvinceName= @(state)",
"postalCode= @(zipcode)",
"postalAddress= @(postaladdress)",
"telephoneNumber= @(telephone)",
"facsimileTelephoneNumber= @(fax)",
"localityName= @(locality)",
"description= @(description)",
"associatedDomain= @(domain)",
"objectClass= top & quipuObject & quipuNonLeafObject",
"objectClass= domainRelatedObject",
"objectClass= organization",
"acl= group # c=@(country)@o=@(organization)@cn=Manager # write # entry",
"acl= others # read # entry",
"acl= group # c=@(country)@o=@(organization)@cn=Manager # write # default",
"acl= others # read # default",
"eDBinfo= # @(rootDSA) #",
"eDBinfo= c=@(country) # @(countryDSA) #",
"eDBinfo= c=@(country)@o=@(organization) # # @(countryDSA)",
"eDBinfo= c=@(country)@o=@(organization) # # @(rootDSA)",
"eDBinfo= c=@(country)@o=@(organization) # # @(otherDSA)",
"presentationAddress= '0101'H/Internet=@(ipaddr)+@(port)",
"manager= c=@(country)@o=@(organization)@cn=Manager#",
"manager= c=@(country)@cn=Manager#",
"userPassword= @(wildlife)",
"quipuVersion= @(quipuversion)",
"localityName= @(locality)",
"description= The Endangered @(dsa)",
"description= Master DSA for @(organization) in the @(country)",
"objectClass= top & quipuObject",
"objectClass= applicationEntity & dSA & quipuDSA",
"supportedApplicationContext= x500DSP & x500DAP & quipuDSP",
(void) sprintf (buffer
, "%s/c=%s", wildlife
,
n2p ("country", 1) -> p_value
);
make_edb (buffer
, "SLAVE", "0000000000Z", c_TLC
);
"aliasedObjectName= c=@(country)@o=@(organization)@ou=@(unit)@cn=@(firstname) @(lastname)#",
"objectClass= top & quipuObject",
"aliasedObjectName= c=@(country)@o=@(organization)@ou=@(unit)@cn=@(firstname) @(lastname)#",
"objectClass= top & quipuObject",
"masterDSA= c=@(country)@cn=@(dsa)#",
"acl= others # read # entry",
"acl= others # read # default",
"acl= others # compare # attributes # userPassword",
"objectClass= top & quipuObject & quipuNonLeafObject",
"objectClass= organizationalUnit",
static build_organization () {
(void) sprintf (buffer
, "%s/c=%s/o=%s", wildlife
,
n2p ("country", 1) -> p_value
,
n2p ("organization", 1) -> p_value
);
make_edb (buffer
, "MASTER", version (), o_I
);
"cn=@(firstname) @(lastname)",
"acl= self # write # entry",
"acl= others # read # entry",
"acl= self # write # default",
"acl= others # read # default",
"acl= self # write # attributes # userPassword",
"acl= others # compare # attributes # userPassword",
"rfc822Mailbox= @(mailbox)",
"otherMailbox = internet $ @(mailbox)",
"userPassword= @(password)",
"telephoneNumber= @(extension)",
"cn= @(firstname) @(lastname)",
"cn= @(firstname) @(middleinitial). @(lastname)",
"cn= @(firstname) @(middlename) @(lastname)",
"objectClass= top & quipuObject",
"objectClass= person & thornPerson & pilotPerson",
(void) sprintf (buffer
, "%s/c=%s/o=%s/ou=%s", wildlife
,
n2p ("country", 1) -> p_value
,
n2p ("organization", 1) -> p_value
,
n2p ("unit", 1) -> p_value
);
make_edb (buffer
, "MASTER", version (), u_J
);
static make_edb (dir
, type
, date
, entries
)
fprintf (stderr
, "mkdir %s\n", dir
);
if (mkdir (dir
, 0700) == NOTOK
)
adios (dir
, "unable to create directory");
(void) sprintf (edb
, "%s/EDB", dir
);
fprintf (stderr
, "create %s\n", edb
);
if ((fp
= fopen (edb
, "w")) == NULL
)
adios (edb
, "unable to create");
fprintf (fp
, "%s\n%s\n", type
, date
);
adios (edb
, "error writing");
(void) chmod (edb
, 0600);
static char *version () {
static char buffer
[BUFSIZ
];
tm2ut (gmtime (&clock
), &ut
);
(void) strcpy (buffer
, gent2str (&ut
));
static build_tailor () { make_file ("quiputailor", "quiputailor", 0644, 1); }
static build_startup () { make_file ("startup.sh", "startup.sh", 0755, 1); }
static build_nightly () { make_file ("nightly.sh", "nightly.sh", 0755, 1); }
static make_file (infile
, outfile
, mode
, dosed
)
(void) sprintf (buffer
, "sed -f %s < templates/%s > %s/%s",
sedfil
, infile
, wildlife
, outfile
);
(void) sprintf (buffer
, "cp templates/%s %s/%s", infile
, wildlife
,
fprintf (stderr
, "%s\n", buffer
);
if (system (buffer
) != 0)
adios (NULLCP
, "%s of %s failed", dosed
? "sed" : "cp", infile
);
(void) sprintf (buffer
, "%s/%s", wildlife
, outfile
);
(void) chmod (buffer
, mode
);
static build_dsap () { fudge_file ("dsaptailor"); }
static build_fred () { fudge_file ("fredrc"); fudge_file ("ufnrc"); }
(void) strcpy (file
, isodefile (name
, 0));
(void) sprintf (buffer
, "%sXXXXXX", myname
);
(void) strcpy (tmpfil
, isodefile (buffer
, 0));
(void) unlink (mktemp (tmpfil
));
(void) sprintf (buffer
, "sed -f %s < %s > %s", sedfil
, file
, tmpfil
);
fprintf (stderr
, "%s\n", buffer
);
if (system (buffer
) != 0) {
adios (NULLCP
, "sed failed");
(void) sprintf (oldfil
, "%s.old", file
);
if (access (oldfil
, 0x00) == NOTOK
)
(void) rename (file
, oldfil
);
if (rename (tmpfil
, file
) == NOTOK
)
adios (file
, "unable to rename %s to", tmpfil
);
if (myname
= rindex (*vec
, '/'))
if (myname
== NULL
|| *myname
== NULL
)
for (vec
++; ap
= *vec
; vec
++) {
adios (NULLCP
, "unknown switch -%c", *ap
);
adios (NULLCP
, "usage: %s config-file", myname
);
unsigned char *bits_3166
;
(void) strcpy (file
, isodefile ("quipu/iso3166", 0));
if ((fp
= fopen (file
, "r")) == NULL
)
adios (file
, "unable to open");
bits_size
= ((26 * 26) >> 3) + 1;
if ((bits_3166
= (unsigned char *) calloc (bits_size
, sizeof *bits_3166
))
adios (NULLCP
, "out of memory");
ep
= (dp
= buffer
) + sizeof buffer
;
while (fgets (dp
, ep
- dp
, fp
)) {
if (cp
= index (buffer
, '\n')) {
if ((d
= getc (fp
)) != EOF
)
if ((dp
= cp
) + 1 >= ep
) {
"virtual line too long in %s: \"%s\"",
switch (str2vec (buffer
, vec
)) {
case 3: /* basic entry */
case 7: /* standard entry */
bitno
= (((*cp
- 'A') & 0xff) * 26) + ((cp
[1] - 'A') & 0xff);
bits_3166
[bitno
>> 3] |= 1 << (bitno
% 8);
register unsigned char *bp
;
printf ("static unsigned char bits_3166[%u] = {\n", bits_size
);
for (xp
= (bp
= bits_3166
) + bits_size
; bp
< xp
; bp
++)
printf (" 0x%02x,\n", *bp
& 0xff);
(void) strcpy (file
, isodefile ("quipu/iso3166", 0));
if ((fp
= fopen (file
, "r")) == NULL
)
adios (file
, "unable to open");
ep
= (dp
= buffer
) + sizeof buffer
;
while (fgets (dp
, ep
- dp
, fp
)) {
if (cp
= index (buffer
, '\n')) {
if ((d
= getc (fp
)) != EOF
)
if ((dp
= cp
) + 1 >= ep
) {
"virtual line too long in %s: \"%s\"",
switch (str2vec (buffer
, vec
)) {
case 3: /* basic entry */
case 7: /* standard entry */
printf ("%s&\t%s&\t%s\\\\\n", vec
[0], vec
[1], vec
[2]);
static void adios (va_alist
)
static void adios (what
, fmt
)
static void advise (va_alist
)
fprintf (stderr
, "%s: ", myname
);
(void) fputs (buffer
, stderr
);
(void) fputc ('\n', stderr
);
static void advise (what
, fmt
)
if ((p
= malloc((unsigned) (strlen (s
) + 1))) == NULL
)
adios (NULLCP
, "out of memory");