- moved DoubleTime to nserver.c

- skip ascii nuls in standard handler
This commit is contained in:
zolliker
2010-01-27 13:33:46 +00:00
parent be13da8a03
commit 3f75ed617b
2 changed files with 4 additions and 15 deletions

14
ascon.c
View File

@ -53,16 +53,6 @@ static int CreateSocketAdress(struct sockaddr_in *sockaddrPtr, /* Socket addres
return 1;
}
double DoubleTime(void)
{
struct timeval now;
/* the resolution of this function is usec, if the machine supports this
and the mantissa of a double is 51 bits or more (31 for sec and 20 for micro)
*/
gettimeofday(&now, NULL);
return now.tv_sec + now.tv_usec / 1e6;
}
void AsconError(Ascon *a, char *msg, int errorno)
{
static char *stateText[]={
@ -455,6 +445,10 @@ int AsconStdHandler(Ascon * a)
if (result == 0)
return 0;
chr = a->lastChar;
if (chr == '\0') { /* skip NUL characters */
DynStringBackspace(a->rdBuffer); /* remove NUL */
return 1;
}
if (a->replyTerminator != NULL) {
if (strchr(a->replyTerminator, chr) != NULL) {
a->state = AsconReadDone;

View File

@ -79,11 +79,6 @@ char *AsconGetError(Ascon *a);
*/
char *ConcatArgs(int argc, char *argv[]);
/** \brief function for dealing with times with microsec resolution
* \return absolute time as double value
*/
double DoubleTime(void);
/** \brief emit an error message. The state switches to AsconFailed.
* \param a the connection
* \param msg, a message to be emitted