projects
/
yaz-moved-to-github.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fix rpn2cql fails for Bib-1 set in qry+conf YAZ-865
[yaz-moved-to-github.git]
/
src
/
comstack.c
diff --git
a/src/comstack.c
b/src/comstack.c
index
3948cc5
..
306ec6d
100644
(file)
--- a/
src/comstack.c
+++ b/
src/comstack.c
@@
-35,16
+35,8
@@
static const char *cs_errlist[] =
const char *cs_errmsg(int n)
{
const char *cs_errmsg(int n)
{
- static char buf[250];
-
- if (n < CSNONE || n > CSLASTERROR) {
- sprintf(buf, "unknown comstack error %d", n);
- return buf;
- }
- if (n == CSYSERR) {
- sprintf(buf, "%s: %s", cs_errlist[n], strerror(errno));
- return buf;
- }
+ if (n < CSNONE || n > CSLASTERROR)
+ n = CSNONE;
return cs_errlist[n];
}
return cs_errlist[n];
}
@@
-55,27
+47,29
@@
const char *cs_strerror(COMSTACK h)
void cs_get_host_args(const char *type_and_host, const char **args)
{
void cs_get_host_args(const char *type_and_host, const char **args)
{
-
*args = "";
if (!strncmp(type_and_host, "unix:", 5))
{
const char *cp = strchr(type_and_host + 5, ':');
*args = "";
if (!strncmp(type_and_host, "unix:", 5))
{
const char *cp = strchr(type_and_host + 5, ':');
- if (cp)
- type_and_host = cp + 1;
- else
- type_and_host += strlen(type_and_host); /* empty string */
+ if (!cp)
+ return;
+ type_and_host = cp + 1;
+ if (!strchr(type_and_host, ':'))
+ {
+ *args = type_and_host; /* unix:path:args */
+ return;
+ }
}
if (*type_and_host)
{
}
if (*type_and_host)
{
- const char *cp;
- cp = strstr(type_and_host, "://");
+ const char *cp = strchr(type_and_host, '/');
if (cp)
if (cp)
- cp = cp+3;
- else
- cp = type_and_host;
- cp = strchr(cp, '/');
+ {
+ if (cp > type_and_host && !memcmp(cp - 1, "://", 3))
+ cp = strchr(cp + 2, '/');
+ }
if (cp)
if (cp)
- *args = cp+1;
+ *args = cp + 1;
}
}
}
}