version 1.120, 2001/07/04 12:36:22
|
version 1.121, 2001/07/06 14:31:40
|
Line 36
|
Line 36
|
#include <stdarg.h> |
#include <stdarg.h> |
#include <sys/wait.h> |
#include <sys/wait.h> |
|
|
void fnord(char*x,...) { |
#include <errno.h> |
int i; |
#include <syslog.h> |
va_list v; |
#include <sys/un.h> |
va_start(v,x); |
#include <fcntl.h> |
for (i=0; i<10; ++i) { |
|
char *tmp=va_arg(v,char*); |
#if 0 |
if (!tmp) break; |
static const char* Ident; |
write(1,tmp,strlen(tmp)); |
static int Option; |
|
static int Facility; |
|
static struct sockaddr_un sock; |
|
static int fd=-1; |
|
|
|
static void syslogconnect(void) { |
|
sock.sun_family=AF_UNIX; |
|
strcpy(sock.sun_path,"/dev/log"); |
|
if ((fd=socket(AF_UNIX,SOCK_STREAM,0))==-1) return; |
|
if (connect(fd,(struct sockaddr*)&sock,sizeof(sock))==-1) { |
|
int save=errno; |
|
close(fd); |
|
fd=-1; |
} |
} |
|
fcntl(fd,F_SETFL,FD_CLOEXEC); /* doesn't work? too bad */ |
} |
} |
|
|
char *strlcpy2(char *dest, const char *src, size_t n) |
void openlog(const char *ident, int option, int facility) { |
{ |
Ident=ident; |
memccpy(dest,src,0,n-1); |
Option=option; |
return dest; |
Facility=facility; |
|
syslogconnect(); |
} |
} |
|
|
|
void syslog(int priority, const char *format, ...) { |
|
/* write(fd,"<13>Jun 29 19:21:32 leitner: fnord",...) */ |
|
} |
|
|
|
void closelog(void) { |
|
} |
|
#endif |
|
|
int main(int argc,char *argv[]) { |
int main(int argc,char *argv[]) { |
#if 0 |
#if 0 |
|
struct addrinfo *ai; |
|
getaddrinfo("ftp.fu-berlin.de","ftp",0,&ai); |
|
#endif |
|
struct hostent host,*res; |
|
char buf[4096]; |
|
int fnord; |
|
|
|
gethostbyname2_r("knuth",AF_INET,&host,buf,4096,&res,&fnord); |
|
#if 0 |
char buf[128]; |
char buf[128]; |
strcpy(buf,"/tmp/fnord/foo.XXXXXXX"); |
strcpy(buf,"/tmp/fnord/foo.XXXXXXX"); |
printf("%d\n",mkdtemp(buf)); |
printf("%d\n",mkdtemp(buf)); |
Line 326 int main(int argc,char *argv[]) {
|
Line 357 int main(int argc,char *argv[]) {
|
if (foo) |
if (foo) |
printf("found service %s on port %d\n",foo->s_name,foo->s_port); |
printf("found service %s on port %d\n",foo->s_name,foo->s_port); |
#endif |
#endif |
#if 1 |
#if 0 |
char buf[128]; |
char buf[128]; |
strcpy(buf,"/tmp/blub/foo.XXXXXXX"); |
strcpy(buf,"/tmp/blub/foo.XXXXXXX"); |
printf("%d\n",mkstemp(buf)); |
printf("%d\n",mkstemp(buf)); |