version 1.57, 2001/05/10 13:08:16
|
version 1.58, 2001/05/10 13:55:35
|
Line 48 static int rand() {
|
Line 48 static int rand() {
|
|
|
extern double atof(const char *c); |
extern double atof(const char *c); |
|
|
FILE* logfile; |
|
|
|
void vlog_message(const char * s, va_list args) { |
|
fprintf(logfile, "* "); |
|
vfprintf(logfile, s, args); |
|
fprintf(logfile, "\n"); |
|
fflush(logfile); |
|
} |
|
|
|
|
|
void log_message(const char * s, ...) { |
|
va_list args; |
|
va_start(args, s); |
|
vlog_message(s, args); |
|
va_end(args); |
|
return; |
|
} |
|
|
|
int main(int argc,char *argv[]) { |
int main(int argc,char *argv[]) { |
char * p = "plop"; |
struct hostent * host; |
int i = 3; |
struct in_addr i; |
|
|
logfile = fopen("test-out", "w"); |
host = gethostbyname("ftp.ciril.fr"); |
|
|
log_message("Hi"); |
if (!host) |
log_message("the number is %d and the string %s", i, p); |
printf("host null\n"); |
|
|
|
if (host && host->h_name) { |
|
printf("name %s\n", host->h_name); |
|
} |
|
if (host && (host->h_addr_list)[0]) { |
|
struct in_addr address; |
|
address = *((struct in_addr *) (host->h_addr_list)[0]); |
|
printf("addr %s\n", inet_ntoa(address)); |
|
} |
#if 0 |
#if 0 |
struct msgbuf bla; |
struct msgbuf bla; |
bla.mtype=0; |
bla.mtype=0; |