/* docstore.c - documentStore syntax */
static char *rcsid
= "$Header: /f/osi/dsap/common/RCS/docstore.c,v 7.1 91/02/22 09:19:03 mrose Interim $";
* $Header: /f/osi/dsap/common/RCS/docstore.c,v 7.1 91/02/22 09:19:03 mrose Interim $
* Revision 7.1 91/02/22 09:19:03 mrose
* Revision 7.0 91/02/19 09:19:17 mrose
* *** empty log message ***
* 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
documentStoreSyntax ATRIBUTE-SYNTAX
INTEGER { ftp(0), ftam(1) },
documentStore ::= [ "ftp" | "ftam" ]
ftp $ nic.ddn.mil $ rfc: $ %s.txt
#include "quipu/syntaxes.h"
static documentStore_free (a
)
static struct documentStore
*documentStore_cpy (a
)
b
= (struct documentStore
*) smalloc (sizeof *b
);
bzero ((char *) b
, sizeof *b
);
b
-> ds_method
= a
-> ds_method
;
b
-> ds_host
= strdup (a
-> ds_host
);
b
-> ds_dir
= strdup (a
-> ds_dir
);
b
-> ds_file
= strdup (a
-> ds_file
);
static documentStore_cmp (a
, b
)
if (res
= a
-> ds_method
- b
-> ds_method
)
return lexequ (a
-> ds_host
, b
-> ds_host
);
static documentStore_print (ps
, a
, format
)
ps_printf (ps
, "use %s to %s and get %s",
a
-> ds_method
? "ftam" : "ftp", a
-> ds_host
,
ps_printf (ps
, " (look under %s)", a
-> ds_dir
);
ps_printf (ps
, "%s $ %s $ %s $ %s",
a
-> ds_method
? "ftam" : "ftp", a
-> ds_host
,
a
-> ds_dir
? a
-> ds_dir
: "", a
-> ds_file
);
static struct documentStore
*str2documentStore (str
)
if ((d1
= index (str
, '$')) == NULL
|| (d2
= index (d1
+ 1, '$')) == NULL
) {
parse_error ("seperator missing in documentStore '%s'",str
);
for (ptr
= str
+ strlen (str
) - 1; ptr
>= str
&& isspace (*ptr
); ptr
--)
if (lexequ (str
, "ftp") == 0)
if (lexequ (str
, "ftam") == 0)
parse_error ("unknown method in documentStore '%s'",str
);
a
= (struct documentStore
*) smalloc (sizeof *a
);
bzero ((char *) a
, sizeof *a
);
a
-> ds_host
= strdup (SkipSpace (d1
+ 1));
if (d3
= index (d2
+ 1, '$')) {
a
-> ds_dir
= strdup (SkipSpace (d2
+ 1));
a
-> ds_file
= strdup (SkipSpace (d3
+ 1));
a
-> ds_file
= strdup (SkipSpace (d2
+ 1));
for (ptr
= d1
+ strlen (d1
) - 1; ptr
>= d1
&& isspace (*ptr
); ptr
--)
for (ptr
= d1
+ strlen (d1
) - 1; ptr
>= d1
&& isspace (*ptr
); ptr
--)
for (ptr
= d1
+ strlen (d1
) - 1; ptr
>= d1
&& isspace (*ptr
); ptr
--)
static PE
documentStore_enc (a
)
(void) encode_Thorn_DocumentStoreSyntax (&pe
, 0, 0, NULLCP
, a
);
static struct documentStore
*documentStore_dec (pe
)
if (decode_Thorn_DocumentStoreSyntax (pe
, 1, NULLIP
, NULLVP
, &a
) == NOTOK
)
(void) add_attribute_syntax ("documentStoreSyntax",