/*
- * Copyright (c) 1995-2001, Index Data
+ * Copyright (c) 1995-2002, Index Data
* See the file LICENSE for details.
*
- * $Id: client.c,v 1.132 2001-11-21 11:13:13 adam Exp $
+ * $Id: client.c,v 1.134 2002-01-11 20:17:03 adam Exp $
*/
#include <stdio.h>
/* set this one to 1, to avoid decode of unknown MARCs */
-#define AVOID_MARC_DECODE 0
+#define AVOID_MARC_DECODE 1
void process_cmd_line(char* line);
if (
#if AVOID_MARC_DECODE
/* primitive check for a marc OID 5.1-29 */
- ent->oidsuffix[0] == 5 && ent->oidsuffix[1] < 30 &&
+ ent->oidsuffix[0] == 5 && ent->oidsuffix[1] < 30
+#else
+ 1
#endif
- marc_display_exl (octet_buf, NULL, 0 /* debug */,
- p->u.octet_aligned->len) <= 0)
+ )
+ {
+ if (marc_display_exl (octet_buf, NULL, 0 /* debug */,
+ p->u.octet_aligned->len) <= 0)
+ {
+ printf ("bad MARC. Dumping as it is:\n");
+ print_record((const unsigned char*) octet_buf,
+ p->u.octet_aligned->len);
+ }
+ }
+ else
{
- printf ("Hmm.. doesn't look like a MARC.\n");
print_record((const unsigned char*) octet_buf,
p->u.octet_aligned->len);
- } else {
- print_record((const unsigned char*) octet_buf,
- p->u.octet_aligned->len);
}
}
if (marcdump)
{
char *prog = *argv;
char *open_command = 0;
+ char *auth_command = 0;
char *arg;
int ret;
- while ((ret = options("c:a:m:v:p:", argv, argc, &arg)) != -2)
+ while ((ret = options("c:a:m:v:p:u:", argv, argc, &arg)) != -2)
{
switch (ret)
{
case 'p':
yazProxy=strdup(arg);
break;
+ case 'u':
+ if (!auth_command)
+ {
+ auth_command = xmalloc (strlen(arg)+6);
+ strcpy (auth_command, "auth ");
+ strcat (auth_command, arg);
+ }
+ break;
case 'v':
yaz_log_init (yaz_log_mask_str(arg), "", NULL);
break;
default:
fprintf (stderr, "Usage: %s [-m <marclog>] [ -a <apdulog>] "
- "[-c cclfields] [-p <proxy-addr>] [<server-addr>]\n",
+ "[-c cclfields]\n [-p <proxy-addr>] [-u <auth>] "
+ "[<server-addr>]\n",
prog);
exit (1);
}
}
initialize();
+ if (auth_command)
+ {
+#ifdef HAVE_GETTIMEOFDAY
+ gettimeofday (&tv_start, 0);
+#endif
+ process_cmd_line (auth_command);
+#if HAVE_READLINE_HISTORY_H
+ add_history(auth_command);
+#endif
+ xfree(auth_command);
+ }
if (open_command)
{
#ifdef HAVE_GETTIMEOFDAY