* Copyright (C) 1995-2007, Index Data ApS
* See the file LICENSE for details.
*
- * $Id: client.c,v 1.342 2007-05-30 21:56:59 adam Exp $
+ * $Id: client.c,v 1.343 2007-06-03 08:06:31 adam Exp $
*/
/** \file client.c
* \brief yaz-client program
void source_rcfile(void)
{
- /* Look for a $HOME/.yazclientrc and source it if it exists */
+ /* Look for .yazclientrc and read it if it exists.
+ If it does not exist, read $HOME/.yazclientrc instead */
struct stat statbuf;
char fname[1000];
- char* homedir = getenv("HOME");
- sprintf(fname, "%.500s%s%s", homedir ? homedir : "",
- homedir ? "/" : "",
- ".yazclientrc");
-
- if (stat(fname,&statbuf)==0)
- cmd_source(fname, 0 );
+ strcpy(fname, ".yazclientrc");
+ if (stat(fname, &statbuf)==0)
+ {
+ cmd_source(fname, 0);
+ }
+ else
+ {
+ const char* homedir = getenv("HOME");
+ if (homedir)
+ {
+ sprintf(fname, "%.800s/%s", homedir, ".yazclientrc");
+ if (stat(fname, &statbuf)==0)
+ cmd_source(fname, 0);
+ }
+ }
}
void add_to_readline_history(void *client_data, const char *line)
<!ENTITY % idcommon SYSTEM "common/common.ent">
%idcommon;
]>
-<!-- $Id: yaz-client-man.xml,v 1.14 2007-05-22 11:10:08 adam Exp $ -->
+<!-- $Id: yaz-client-man.xml,v 1.15 2007-06-03 08:06:32 adam Exp $ -->
<refentry id="yaz-client">
<refentryinfo>
<productname>YAZ</productname>
a connection to the Z39.50/SRU target at the address given.
</para>
<para>
- When <command>yaz-client</command> is invoked it attemps to read the
- following files:
- <literal>$HOME/.yazclientrc</literal> (home directory, Unix only) and
- <literal>.yazclientrc</literal> (current directory - any platform)
+ When <command>yaz-client</command> is invoked it attemps to read
+ <filename>.yazclientrc</filename> from current working directory.
+ If <filename>.yazclientrc</filename> does not exist in current directory
+ YAZ client reads <filename>.yazclientrc</filename> from the
+ home directory, where the home directory is given by environment
+ variable <literal>HOME</literal>.
For those files that are readable, the YAZ client executes commands
in those files. See COMMANDS section for description of commands.
</para>