projects
/
citadel.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
4a0cdfc
)
* if the token extractor fails to do its work, rather return '0' than some random...
author
Wilfried Göesgens
<willi@citadel.org>
Wed, 16 Jan 2008 22:10:55 +0000
(22:10 +0000)
committer
Wilfried Göesgens
<willi@citadel.org>
Wed, 16 Jan 2008 22:10:55 +0000
(22:10 +0000)
libcitadel/lib/tools.c
patch
|
blob
|
history
diff --git
a/libcitadel/lib/tools.c
b/libcitadel/lib/tools.c
index 8298d9d48c044b90a4816451a5a5e65d262a922e..e07b60fee39c58afdfc1778fb9665c966fdb3086 100644
(file)
--- a/
libcitadel/lib/tools.c
+++ b/
libcitadel/lib/tools.c
@@
-228,8
+228,10
@@
int extract_int(const char *source, int parmnum)
{
char buf[32];
{
char buf[32];
- extract_token(buf, source, parmnum, '|', sizeof buf);
- return(atoi(buf));
+ if (extract_token(buf, source, parmnum, '|', sizeof buf) > 0)
+ return(atoi(buf));
+ else
+ return 0;
}
/*
}
/*
@@
-239,8
+241,10
@@
long extract_long(const char *source, int parmnum)
{
char buf[32];
{
char buf[32];
- extract_token(buf, source, parmnum, '|', sizeof buf);
- return(atol(buf));
+ if (extract_token(buf, source, parmnum, '|', sizeof buf) > 0)
+ return(atol(buf));
+ else
+ return 0;
}
}
@@
-251,8
+255,10
@@
unsigned long extract_unsigned_long(const char *source, int parmnum)
{
char buf[32];
{
char buf[32];
- extract_token(buf, source, parmnum, '|', sizeof buf);
- return strtoul(buf, NULL, 10);
+ if (extract_token(buf, source, parmnum, '|', sizeof buf) > 0)
+ return strtoul(buf, NULL, 10);
+ else
+ return 0;
}
}