Subversion Repositories mdb

Rev

Rev 32 | Rev 55 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 32 Rev 49
Line 19... Line 19...
19
#include <stdlib.h>
19
#include <stdlib.h>
20
#include <syslog.h>
20
#include <syslog.h>
21
#include <errno.h>
21
#include <errno.h>
22
#include <ctype.h>
22
#include <ctype.h>
23
#include <iconv.h>
23
#include <iconv.h>
-
 
24
#include <pthread.h>
24
#include "helplib.h"
25
#include "helplib.h"
25
#include "lookup3.h"
26
#include "lookup3.h"
26
 
27
 
27
iconv_t initialize (void);
28
iconv_t initialize (void);
28
char *conv2utf8 (iconv_t conv_desc, const char *euc);
29
char *conv2utf8 (iconv_t conv_desc, const char *euc);
29
void finalize (iconv_t conv_desc);
30
void finalize (iconv_t conv_desc);
30
 
31
 
-
 
32
static pthread_t pthr_wait;
-
 
33
 
31
char *urlencode(char *str)
34
char *urlencode(char *str)
32
{
35
{
33
	char *p, *buf;
36
	char *p, *buf;
34
	unsigned int size;
37
	unsigned int size;
35
 
38
 
Line 531... Line 534...
531
		return NULL;
534
		return NULL;
532
 
535
 
533
	ret = p1 + 1;
536
	ret = p1 + 1;
534
	return ret;
537
	return ret;
535
}
538
}
-
 
539
 
-
 
540
void delay (useconds_t ms)
-
 
541
{
-
 
542
	if (ms != 0)
-
 
543
		usleep(ms);
-
 
544
}
-
 
545
 
-
 
546
void waiting(useconds_t ms, waitcall callback, void *data)
-
 
547
{
-
 
548
	if (ms == 0 || callback == NULL)
-
 
549
		return;
-
 
550
 
-
 
551
	/* Start a thread and call the callback function after the waiting time
-
 
552
	 * is over.
-
 
553
	 */
-
 
554
	usleep(ms);
-
 
555
 
-
 
556
	if (pthread_create(&pthr_wait, NULL, callback, data) != 0)
-
 
557
	{
-
 
558
		 syslog (LOG_DAEMON,"Creation of thread \"pthr_wait\" failed!");
-
 
559
		 return;
-
 
560
	}
-
 
561
}