From 4a322247f46cea327bea634791056e257c740e5d Mon Sep 17 00:00:00 2001 From: Sergey Dorofeev Date: Thu, 26 Jan 2012 22:54:26 +0400 Subject: [PATCH 01/29] configuration paramater for remote spool daemon --- source/include/confread.h | 1 + 1 file changed, 1 insertion(+) diff --git a/source/include/confread.h b/source/include/confread.h index a8bcf62..7f9e899 100644 --- a/source/include/confread.h +++ b/source/include/confread.h @@ -271,6 +271,7 @@ typedef enum { cf_debug_level, #endif cf_split_inbound, + cf_netspool, BFORCE_NUMBER_OF_KEYWORDS } bforce_config_keyword; From afa1f3e342fe934be033cf464e91d1d360ed5b52 Mon Sep 17 00:00:00 2001 From: Sergey Dorofeev Date: Sat, 28 Jan 2012 18:34:18 +0400 Subject: [PATCH 02/29] test utility --- source/bfutil/netspool.c | 180 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 180 insertions(+) create mode 100644 source/bfutil/netspool.c diff --git a/source/bfutil/netspool.c b/source/bfutil/netspool.c new file mode 100644 index 0000000..39e3504 --- /dev/null +++ b/source/bfutil/netspool.c @@ -0,0 +1,180 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include + +const char *RHOST = "::ffff:172.31.251.3"; +const char *RPORT = "24555"; + +#define STRBUF (1024) + +void readstr(int s, char *buf, int len) { + char c=0; + int r; + while(1) { + r=recv(s, &c, 1, 0); + if(r==0){ + puts("remote socket shutdown"); + exit(-3); + } + if(r==-1){ + puts("error reading string"); + printf("%d %s\n", errno, strerror(errno)); + exit(-3); + } + if(c=='\n') { + *buf=0; + return; + } + *buf++=c; + if(c=='\n') + return; + len--; + if(!len) { + puts("string buffer overflow"); + exit(-3); + } + } +} + +void sendstr(int s, const char *buf) { + int l = strlen(buf); + int c; + char nl='\n'; + while(l>0) { + c=send(s, buf, l, 0); + if(c==-1){ + puts("error sending string"); + printf("%d %s\n", errno, strerror(errno)); + exit(-3); + } + if(c==0){ + puts("zero send: may loop infinitely"); + exit(-3); + } + l-=c; + } + c=send(s, &nl, 1, 0); + if(c==-1){ + puts("error sending string"); + printf("%d %s\n", errno, strerror(errno)); + exit(-3); + } + if(c==0){ + puts("zero send: may loop infinitely"); + exit(-3); + } + +} + +void savefile(const char *fn, unsigned long long l, int s) +{ + char BUF[STRBUF]; + int n, n1; + int f; + f=open(fn, O_CREAT|O_EXCL|O_WRONLY, 0666); + if(f==-1) { + puts("error open file"); + printf("%d %s\n", errno, strerror(errno)); + exit(-3); + } + while(l) { + n=recv(s, BUF, l>STRBUF?STRBUF:l, 0); + if(n==0){ + puts("remote socket shutdown"); + exit(-3); + } + if(n==-1){ + puts("error reading data"); + printf("%d %s\n", errno, strerror(errno)); + exit(-3); + } + n1 = write(f, BUF, n); + if(n1!=n) { + puts("error writing file"); + printf("%d %s\n", errno, strerror(errno)); + exit(-3); + } + l-=n; + } + close(f); +} + +void main() { + int s, r; + struct addrinfo hint; + struct addrinfo *addrs, *a; + char strbuf[STRBUF]; + char filename[STRBUF]; + unsigned long long length; + + s = socket(AF_INET6, SOCK_STREAM, 0); + + memset(&hint, 0, sizeof(struct addrinfo)); + hint.ai_socktype = SOCK_STREAM; + r = getaddrinfo(RHOST, RPORT, &hint, &addrs); + if( r ) { + puts(gai_strerror(r)); + exit(-1); + } + + a=addrs; + r=-1; + while(a) { + r = connect(s, a->ai_addr, a->ai_addrlen); + if(r==-1) { + printf("%d %s\n", errno, strerror(errno)); + } else { + break; + } + a=a->ai_next; + } + if(r==-1) { + printf("could not connect\n"); + exit(-2); + } + freeaddrinfo(addrs); + + readstr(s, strbuf, STRBUF); + puts(strbuf); + sendstr(s, "ADDRESS 2:111/11"); + sendstr(s, "PASSWORD 123"); + sendstr(s, "GET ALL"); + + filename[0]=0; + while(1) { + readstr(s, strbuf, STRBUF); + puts(strbuf); + if(strcmp(strbuf, "QUEUE EMPTY")==0) break; + if(strncmp(strbuf, "FILENAME ", 9)==0) { + strcpy(filename, strbuf+9); + puts(filename); + continue; + } + if(strncmp(strbuf, "BINARY ", 7)==0) { + if(filename[0]==0) { + puts("no filename"); + exit(-5); + } + sscanf(strbuf+7, "%Lu", &length); + printf("length=%Lu\n", length); + savefile(filename, length, s); + sprintf(strbuf, "DONE %s", filename); + sendstr(s, strbuf); + filename[0]=0; + continue; + } + + puts("!!!"); + exit(-1); + } + + sendstr(s, "END satisfied"); + close(s); + +} From 0683dc37da64f7ee7b29e67deeac4fadf27a8ebd Mon Sep 17 00:00:00 2001 From: Sergey Dorofeev Date: Sat, 28 Jan 2012 20:16:59 +0400 Subject: [PATCH 03/29] TODO --- source/bforce/TODO_netspool | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 source/bforce/TODO_netspool diff --git a/source/bforce/TODO_netspool b/source/bforce/TODO_netspool new file mode 100644 index 0000000..cabee2b --- /dev/null +++ b/source/bforce/TODO_netspool @@ -0,0 +1,4 @@ +tx_zmodem +rx_zmodem +hydra +binkp_transfer From 9f87fcc37f85557e8f6d429e4f47dc5aa3f6064e Mon Sep 17 00:00:00 2001 From: Sergey Dorofeev Date: Sat, 4 Feb 2012 17:01:30 +0400 Subject: [PATCH 04/29] netspool init phase --- source/bforce/TODO_netspool | 4 + source/{bfutil => bforce}/netspool.c | 197 ++++++++++++++++++--------- source/bforce/prot_common.c | 46 ++++++- source/include/confread.h | 5 +- source/include/netspool.h | 20 +++ source/include/session.h | 9 +- 6 files changed, 212 insertions(+), 69 deletions(-) rename source/{bfutil => bforce}/netspool.c (52%) create mode 100644 source/include/netspool.h diff --git a/source/bforce/TODO_netspool b/source/bforce/TODO_netspool index cabee2b..01ad5bb 100644 --- a/source/bforce/TODO_netspool +++ b/source/bforce/TODO_netspool @@ -2,3 +2,7 @@ tx_zmodem rx_zmodem hydra binkp_transfer + + + all of then do use p_tx_readfile + \ No newline at end of file diff --git a/source/bfutil/netspool.c b/source/bforce/netspool.c similarity index 52% rename from source/bfutil/netspool.c rename to source/bforce/netspool.c index 39e3504..cf3a085 100644 --- a/source/bfutil/netspool.c +++ b/source/bforce/netspool.c @@ -8,41 +8,41 @@ #include #include -const char *RHOST = "::ffff:172.31.251.3"; +#include "netspool.h" + +const char *RHOST = "172.31.251.3"; const char *RPORT = "24555"; -#define STRBUF (1024) -void readstr(int s, char *buf, int len) { +int readstr(int s, char *buf, int len) { char c=0; int r; while(1) { r=recv(s, &c, 1, 0); if(r==0){ puts("remote socket shutdown"); - exit(-3); + return -3; } if(r==-1){ puts("error reading string"); printf("%d %s\n", errno, strerror(errno)); - exit(-3); + return -3; } if(c=='\n') { *buf=0; - return; + break; } *buf++=c; - if(c=='\n') - return; len--; if(!len) { puts("string buffer overflow"); - exit(-3); + return -3; } } + return 0; } -void sendstr(int s, const char *buf) { +int sendstr(int s, const char *buf) { int l = strlen(buf); int c; char nl='\n'; @@ -51,11 +51,11 @@ void sendstr(int s, const char *buf) { if(c==-1){ puts("error sending string"); printf("%d %s\n", errno, strerror(errno)); - exit(-3); + return -3; } if(c==0){ puts("zero send: may loop infinitely"); - exit(-3); + return -3; } l-=c; } @@ -63,15 +63,132 @@ void sendstr(int s, const char *buf) { if(c==-1){ puts("error sending string"); printf("%d %s\n", errno, strerror(errno)); - exit(-3); + return -3; } if(c==0){ puts("zero send: may loop infinitely"); - exit(-3); + return -3; } + return 0; +} + + + +void netspool_start(s_netspool_state *state, const char *host, const char *port, const char *address, const char *password) +{ + int s, r; + struct addrinfo hint; + struct addrinfo *addrs, *a; + char strbuf[STRBUF]; + + s = socket(AF_INET6, SOCK_STREAM, 0); + state->socket = s; + if( s==-1 ) + { + state->state = NS_ERROR; + state->error = "socket error"; + return; + } + + memset(&hint, 0, sizeof(struct addrinfo)); + hint.ai_socktype = SOCK_STREAM; + hint.ai_family = PF_INET6; + hint.ai_flags = AI_V4MAPPED; + + r = getaddrinfo(host, port!=NULL? port: "24555", &hint, &addrs); + + if( r ) { + state->state = NS_ERROR; + state->error = gai_error(r); + return; + } + + a=addrs; + r=-1; + while(a) { + r = connect(s, a->ai_addr, a->ai_addrlen); + if(r==-1) { + printf("%d %s\n", errno, strerror(errno)); + } else { + break; + } + a=a->ai_next; + } + freeaddrinfo(addrs); + + if(r==-1) { + state->state = NS_ERROR; + state->error = "could not connect\n" + return; + } + + r = readstr(s, strbuf, STRBUF); + if( r ) { state->state = NS_ERROR; state->error = "IO error"; } + puts(strbuf); + + snprintf(strbuf, STRBUF, "ADDRESS %s", address); + r = sendstr(s, strbuf); + if( r ) { state->state = NS_ERROR; state->error = "IO error"; } + + snprintf(strbuf, STRBUF, "PASSWORD %s", password); + r = sendstr(s, strbuf); + if( r ) { state->state = NS_ERROR; state->error = "IO error"; } + + state->state = NS_READY; +} + +void netspool_query(s_netspool_state *state, const char *what) +{ + int r = sendstr(state->socket, "GET ALL"); + if( r ) { + state->state = NS_ERROR; + state->error = "IO error"; + return; + } + state->state = NS_RECEIVING; +} + +void netspool_receive(s_netspool_state *state) +{ + char strbuf[STRBUF]; + int r; + + r = readstr(s, strbuf, STRBUF); + if( r ) { state->state = NS_ERROR; state->error = "IO error"; return; } + puts(strbuf); + if(strcmp(strbuf, "QUEUE EMPTY")==0) { + state->state = NS_READY; + return; + } + + if(strncmp(strbuf, "FILENAME ", 9)==0) { + strcpy(filename, strbuf+9); + puts(filename); + } else { + state->state = NS_ERROR; + state->error = "expected filename or queue empty" + return; + } + + r = readstr(s, strbuf, STRBUF); + if( r ) { state->state = NS_ERROR; state->error = "IO error"; return; } + if(strncmp(strbuf, "BINARY ", 7)==0) { + /*if(filename[0]==0) { + puts("no filename"); + exit(-5); + } */ + sscanf(strbuf+7, "%Lu", &state->length); + printf("length=%Lu\n", state->length); + state->state = NS_RECVFILE; + } else { + state->state = NS_ERROR; + state->error = "expected binary" + return; + } } +/* void savefile(const char *fn, unsigned long long l, int s) { char BUF[STRBUF]; @@ -105,64 +222,15 @@ void savefile(const char *fn, unsigned long long l, int s) close(f); } + void main() { - int s, r; - struct addrinfo hint; - struct addrinfo *addrs, *a; - char strbuf[STRBUF]; char filename[STRBUF]; unsigned long long length; - s = socket(AF_INET6, SOCK_STREAM, 0); - - memset(&hint, 0, sizeof(struct addrinfo)); - hint.ai_socktype = SOCK_STREAM; - r = getaddrinfo(RHOST, RPORT, &hint, &addrs); - if( r ) { - puts(gai_strerror(r)); - exit(-1); - } - - a=addrs; - r=-1; - while(a) { - r = connect(s, a->ai_addr, a->ai_addrlen); - if(r==-1) { - printf("%d %s\n", errno, strerror(errno)); - } else { - break; - } - a=a->ai_next; - } - if(r==-1) { - printf("could not connect\n"); - exit(-2); - } - freeaddrinfo(addrs); - readstr(s, strbuf, STRBUF); - puts(strbuf); - sendstr(s, "ADDRESS 2:111/11"); - sendstr(s, "PASSWORD 123"); - sendstr(s, "GET ALL"); filename[0]=0; while(1) { - readstr(s, strbuf, STRBUF); - puts(strbuf); - if(strcmp(strbuf, "QUEUE EMPTY")==0) break; - if(strncmp(strbuf, "FILENAME ", 9)==0) { - strcpy(filename, strbuf+9); - puts(filename); - continue; - } - if(strncmp(strbuf, "BINARY ", 7)==0) { - if(filename[0]==0) { - puts("no filename"); - exit(-5); - } - sscanf(strbuf+7, "%Lu", &length); - printf("length=%Lu\n", length); savefile(filename, length, s); sprintf(strbuf, "DONE %s", filename); sendstr(s, strbuf); @@ -178,3 +246,4 @@ void main() { close(s); } +*/ diff --git a/source/bforce/prot_common.c b/source/bforce/prot_common.c index fe36cb9..ba9237d 100644 --- a/source/bforce/prot_common.c +++ b/source/bforce/prot_common.c @@ -40,13 +40,15 @@ const char *Protocols[] = * Return value: * Zero value on success and non-zero if nothing to send */ -static int prot_get_next_file(s_filelist **dest, s_protinfo *pi, s_fsqueue *q) +static int prot_get_next_file(s_filelist **dest, s_protinfo *pi) { s_filelist *ptrl = NULL; s_filelist *best = NULL; + s_fsqueue *q = &state.queue; *dest = NULL; - + + /* local queue */ for( ptrl = q->fslist; ptrl; ptrl = ptrl->next ) if( ptrl->status == STATUS_WILLSEND ) { @@ -97,6 +99,44 @@ static int prot_get_next_file(s_filelist **dest, s_protinfo *pi, s_fsqueue *q) return 0; } + /* network queue */ +#ifdef NETSPOOL + + if(state.netspool.state == NS_NOTINIT) { + char password[9]; + char address[300]; + char *host = conf_string(cf_netspool_host); + char *port = conf_string(cf_netspool_port); + if(host==NULL) { + state.netspool.state = NS_UNCONF; + } else { + snprintf(address, 299, state.node.addr.point? "%d:%d/%d.%d": "%d.%d.%d", + state.node.addr.zone, state.node.addr.net, + state.node.addr.node, state.node.addr.point); + if(state.protected) { + session_get_password(state.node.addr, password, 8); + } else { + password[0] = 0; + } + netspool_start(&state.netspool, host, port, address, password); + } + } + + if(state.netspool_state == NS_READY) { + netspool_query(&state.netspool, "ALL"); + } + + if(state.netspool_state == NS_RECEIVING) { + netspool_receive(&state.netspool); + } + + if(state.netspool_state == NS_RECVFILE) { + *dest = NULL; + return 0; + } + +#endif + return 1; } @@ -159,7 +199,7 @@ int p_tx_fopen(s_protinfo *pi) return 1; get_next_file: - if( prot_get_next_file(&ptrl, pi, &state.queue) || !ptrl ) + if( prot_get_next_file(&ptrl, pi) || !ptrl ) return 1; /* Mark this file as "processed" */ diff --git a/source/include/confread.h b/source/include/confread.h index 7f9e899..547d89c 100644 --- a/source/include/confread.h +++ b/source/include/confread.h @@ -271,7 +271,10 @@ typedef enum { cf_debug_level, #endif cf_split_inbound, - cf_netspool, +#ifdef NETSPOOL + cf_netspool_host, + cf_netspool_port, +#endif BFORCE_NUMBER_OF_KEYWORDS } bforce_config_keyword; diff --git a/source/include/netspool.h b/source/include/netspool.h new file mode 100644 index 0000000..7c5be8d --- /dev/null +++ b/source/include/netspool.h @@ -0,0 +1,20 @@ + + +#define NS_NOTINIT (0) +#define NS_UNCONF (1) +#define NS_ERROR (2) +#define NS_READY (3) +#define NS_RECEIVING (4) +#define NS_RECVFILE (5) +#define NS_CLOSED (6) + +#define STRBUF (1024) + +typedef struct { + int state; + char *error; + int socket; + int filename[STRBUF]; + unsigned long long length; +} s_netspool_state; + diff --git a/source/include/session.h b/source/include/session.h index f67d1fb..f1ed013 100644 --- a/source/include/session.h +++ b/source/include/session.h @@ -22,6 +22,10 @@ #include "outbound.h" #include "prot_common.h" +#ifdef NETSPOOL +#include "netspool.h" +#endif + typedef enum session { SESSION_UNKNOWN, SESSION_FTSC, @@ -155,6 +159,9 @@ const s_modemport *modemport; s_falist *mailfor; /* Remote valid addresses */ s_fsqueue queue; /* Send files queue */ +#ifdef NETSPOOL + s_netspool_state netspool; +#endif }; typedef struct state s_state; @@ -194,7 +201,7 @@ int session_check_addr(s_faddr addr); int session_get_password(s_faddr addr, char *buffer, size_t buflen); int session_remote_lookup(s_sysaddr *addrs, int anum); void session_remote_log_status(void); -int session_check_password(s_faddr addr, const char *passwd); +/*int session_check_password(s_faddr addr, const char *passwd); seems not used*/ int session_set_inbound(void); void session_set_freqs_status(void); void session_set_send_options(void); From b5f3f48f0d7973ef32ba58265367b508eff9e4b8 Mon Sep 17 00:00:00 2001 From: Sergey Dorofeev Date: Sat, 4 Feb 2012 18:20:48 +0400 Subject: [PATCH 05/29] netspool send --- source/bforce/netspool.c | 92 +++++++++++++++++++++--------------- source/bforce/prot_common.c | 93 ++++++++++++++++++++++++++++++------- 2 files changed, 130 insertions(+), 55 deletions(-) diff --git a/source/bforce/netspool.c b/source/bforce/netspool.c index cf3a085..ec3e4b4 100644 --- a/source/bforce/netspool.c +++ b/source/bforce/netspool.c @@ -188,62 +188,80 @@ void netspool_receive(s_netspool_state *state) } +int netspool_read(s_netspool_state *state, void *buf, int buflen) +{ + int n; + if( state->length == 0 ) { + puts("everithing is read"); + return 0; + } + + n = recv(state->socket, buf, state->length>buflen? buflen: state->length, 0); + + if(n==0) { + state->state = NS_ERROR; + state->error = "remote socket shutdown"; + return -1; + } + + if(n==-1) { + puts("error reading data"); + printf("%d %s\n", errno, strerror(errno)); + state->state = NS_ERROR; + state->error = "IO error"; + return -1; + } + + state->length -= n; + return n; +} + +void netspool_acknowledge(s_netspool_state *state) +{ + char strbuf[STRBUF]; + int r; + + if( state->length > 0 ) { + state->state = NS_ERROR; + state->error = "Too early acknowledgement"; + return; + } + + snprintf(strbuf, STRBUF, "DONE %s", state->filename); + r = sendstr(state->socket, strbuf); + if( r ) { state->state = NS_ERROR; state->error = "IO error"; return; } + + state->state = NS_RECEIVING; + state->filename[0] = 0; +} + +void netspool_end(s_netspool_state *state) +{ + sendstr(state->socket, "END satisfied"); + close(state->socket); + state->state = NS_NOTINIT; +} + /* void savefile(const char *fn, unsigned long long l, int s) { char BUF[STRBUF]; int n, n1; int f; - f=open(fn, O_CREAT|O_EXCL|O_WRONLY, 0666); + f=open(fn, O_CREAT|O_EXCL|O_WRONLY, 0664); if(f==-1) { puts("error open file"); printf("%d %s\n", errno, strerror(errno)); exit(-3); } while(l) { - n=recv(s, BUF, l>STRBUF?STRBUF:l, 0); - if(n==0){ - puts("remote socket shutdown"); - exit(-3); - } - if(n==-1){ - puts("error reading data"); - printf("%d %s\n", errno, strerror(errno)); - exit(-3); - } n1 = write(f, BUF, n); if(n1!=n) { puts("error writing file"); printf("%d %s\n", errno, strerror(errno)); exit(-3); } - l-=n; } close(f); } - - -void main() { - char filename[STRBUF]; - unsigned long long length; - - - - filename[0]=0; - while(1) { - savefile(filename, length, s); - sprintf(strbuf, "DONE %s", filename); - sendstr(s, strbuf); - filename[0]=0; - continue; - } - - puts("!!!"); - exit(-1); - } - - sendstr(s, "END satisfied"); - close(s); - -} */ diff --git a/source/bforce/prot_common.c b/source/bforce/prot_common.c index ba9237d..529ac5e 100644 --- a/source/bforce/prot_common.c +++ b/source/bforce/prot_common.c @@ -199,36 +199,43 @@ int p_tx_fopen(s_protinfo *pi) return 1; get_next_file: - if( prot_get_next_file(&ptrl, pi) || !ptrl ) + if( prot_get_next_file(&ptrl, pi) ) return 1; + + if( ptrl ) { - /* Mark this file as "processed" */ - ptrl->status = STATUS_SENDING; + /* Mark this file as "processed" */ + ptrl->status = STATUS_SENDING; - pi->send_left_num -= 1; - pi->send_left_size -= ptrl->size; + pi->send_left_num -= 1; + pi->send_left_size -= ptrl->size; - if( pi->send_left_size < 0 ) + if( pi->send_left_size < 0 ) pi->send_left_size = 0; - if( pi->send_left_num < 0 ) + if( pi->send_left_num < 0 ) pi->send_left_num = 0; + + DEB((D_PROT, "p_tx_fopen: now opening \"%s\"", ptrl->fname)); - /* Reset MinCPS time counter */ - pi->tx_low_cps_time = 0; - - DEB((D_PROT, "p_tx_fopen: now opening \"%s\"", ptrl->fname)); - - if( stat(ptrl->fname, &st) ) - { + if( stat(ptrl->fname, &st) ) { logerr("send: cannot stat file \"%s\"", ptrl->fname); goto get_next_file; - } + } - if( (fp = file_open(ptrl->fname, "r")) == NULL ) - { + if( (fp = file_open(ptrl->fname, "r")) == NULL ) { logerr("send: cannot open file \"%s\"", ptrl->fname); goto get_next_file; + } + + } +#ifndef NETSPOOL + else { + return 1; } +#endif + + /* Reset MinCPS time counter */ + pi->tx_low_cps_time = 0; /* * Add new entry to the send files queue @@ -250,6 +257,25 @@ get_next_file: /* * Set file information */ +#ifdef NETSPOOL + if( !ptrl ) { + /* send file received through netspool */ + pi->send->fp = 0; + pi->send->local_name = "NETSPOOL"; + pi->send->type = out_filetype(state.netspool.filename); + pi->send->net_name = recode_file_out(p_convfilename(state.netspool.filename, pi->send->type)); + pi->send->fname = NULL; + pi->send->mod_time = time(NULL); + pi->send->mode = 0664; + pi->send->bytes_total = state.netspool.length; + pi->send->start_time = time(NULL); + pi->send->eofseen = FALSE; + pi->send->status = FSTAT_PROCESS; + pi->send->action = ACTION_ACKNOWLEDGE; + pi->send->flodsc = -1; + } else { + +#endif pi->send->fp = fp; pi->send->local_name = (char*)xstrcpy(file_getname(ptrl->fname)); pi->send->net_name = recode_file_out(p_convfilename(pi->send->local_name, ptrl->type)); @@ -265,7 +291,11 @@ get_next_file: pi->send->type = ptrl->type; pi->send->action = ptrl->action; pi->send->flodsc = ptrl->flodsc; - + +#idef NETSPOOL + } +#endif + if( strcmp(pi->send->local_name, pi->send->net_name) == 0 ) { log("send: \"%s\" %d bytes", @@ -404,6 +434,11 @@ int p_tx_fclose(s_protinfo *pi) else if( errno != ENOENT ) logerr("send: cannot truncate file \"%s\"", pi->send->fname); break; +#ifdef NETSPOOL + case ACTION_ACKNOWLEDE: + netspool_acknowlede(&state.netspool); + break; +#endif } } @@ -429,6 +464,24 @@ int p_tx_readfile(char *buffer, size_t buflen, s_protinfo *pi) struct stat st; long ftell_pos; +#ifdef NETSPOOL + if(pi->send->fname==NULL && strcmp(pi->send->localname, "NETSPOOL")==0 ) { + if( state->state != NS_RECVFILE ) { + log("send: wrong netspool state"); + pi->send->status = FSTAT_SKIPPED; + return -2; + } + n = netspool_read(&state.netspool, buffer, buflen); + pi->send->eofseen = state.netspool.length == 0; + if( n==-1 ) { + log("send: netspool error"); + log(netspool->state->error); + pi->send->status = FSTAT_SKIPPED; + return -2; + } + return n; + } +#endif /* * Sanity check: read from closed file. */ @@ -1223,6 +1276,10 @@ void p_session_cleanup(s_protinfo *pi, bool success) logerr("cannot unlink temporary file \"%s\"", ptrl->fname); } } + +#ifdef NETSPOOL + netspool_end(&state.netspool); +#endif } /***************************************************************************** From b1adc98f2df7715201b2bb3d63df707960d672bf Mon Sep 17 00:00:00 2001 From: Sergey Dorofeev Date: Sat, 4 Feb 2012 22:56:07 +0400 Subject: [PATCH 06/29] netspool fixes --- CHANGES.fidoman | 4 + source/Makefile.in | 2 +- source/bforce/netspool.c | 27 +- source/bforce/prot_common.c | 28 +- source/configure | 9494 +++++++++++++++++------------------ source/configure.in | 5 + source/include/acconfig.h | 22 - source/include/config.h.in | 3 + source/include/netspool.h | 33 +- source/include/outbound.h | 1 + source/openwrt-conf | 2 +- 11 files changed, 4585 insertions(+), 5036 deletions(-) delete mode 100644 source/include/acconfig.h diff --git a/CHANGES.fidoman b/CHANGES.fidoman index 9d66e5f..5af1697 100644 --- a/CHANGES.fidoman +++ b/CHANGES.fidoman @@ -1,3 +1,7 @@ +=== 2012-02 === + +Netspool support + === 2011-12-25 === Cmdline processing code is partially rewritten. diff --git a/source/Makefile.in b/source/Makefile.in index bdad7d4..d24b630 100644 --- a/source/Makefile.in +++ b/source/Makefile.in @@ -101,7 +101,7 @@ BFORCE_OBJS = bforce/bforce.o \ bforce/u_misc.o bforce/u_string.o \ bforce/u_time.o bforce/u_file.o \ bforce/u_pkt.o bforce/u_recode.o \ - bforce/u_plock.o + bforce/u_plock.o bforce/netspool.o .c.o: @echo Compiling $*.c diff --git a/source/bforce/netspool.c b/source/bforce/netspool.c index ec3e4b4..5269bdf 100644 --- a/source/bforce/netspool.c +++ b/source/bforce/netspool.c @@ -8,11 +8,10 @@ #include #include +#include "includes.h" #include "netspool.h" -const char *RHOST = "172.31.251.3"; -const char *RPORT = "24555"; - +#ifdef NETSPOOL int readstr(int s, char *buf, int len) { char c=0; @@ -99,7 +98,7 @@ void netspool_start(s_netspool_state *state, const char *host, const char *port, if( r ) { state->state = NS_ERROR; - state->error = gai_error(r); + state->error = gai_strerror(r); return; } @@ -118,7 +117,7 @@ void netspool_start(s_netspool_state *state, const char *host, const char *port, if(r==-1) { state->state = NS_ERROR; - state->error = "could not connect\n" + state->error = "could not connect"; return; } @@ -139,7 +138,10 @@ void netspool_start(s_netspool_state *state, const char *host, const char *port, void netspool_query(s_netspool_state *state, const char *what) { - int r = sendstr(state->socket, "GET ALL"); + char strbuf[STRBUF]; + int r; + snprintf(strbuf, STRBUF, "GET %s", what); /* ALL or comma separated NETMAIL, ECHOMAIL... */ + r = sendstr(state->socket, strbuf); if( r ) { state->state = NS_ERROR; state->error = "IO error"; @@ -153,7 +155,7 @@ void netspool_receive(s_netspool_state *state) char strbuf[STRBUF]; int r; - r = readstr(s, strbuf, STRBUF); + r = readstr(state->socket, strbuf, STRBUF); if( r ) { state->state = NS_ERROR; state->error = "IO error"; return; } puts(strbuf); if(strcmp(strbuf, "QUEUE EMPTY")==0) { @@ -162,15 +164,15 @@ void netspool_receive(s_netspool_state *state) } if(strncmp(strbuf, "FILENAME ", 9)==0) { - strcpy(filename, strbuf+9); - puts(filename); + strcpy(state->filename, strbuf+9); + puts(state->filename); } else { state->state = NS_ERROR; - state->error = "expected filename or queue empty" + state->error = "expected filename or queue empty"; return; } - r = readstr(s, strbuf, STRBUF); + r = readstr(state->socket, strbuf, STRBUF); if( r ) { state->state = NS_ERROR; state->error = "IO error"; return; } if(strncmp(strbuf, "BINARY ", 7)==0) { /*if(filename[0]==0) { @@ -182,7 +184,7 @@ void netspool_receive(s_netspool_state *state) state->state = NS_RECVFILE; } else { state->state = NS_ERROR; - state->error = "expected binary" + state->error = "expected binary"; return; } @@ -265,3 +267,4 @@ void savefile(const char *fn, unsigned long long l, int s) close(f); } */ +#endif diff --git a/source/bforce/prot_common.c b/source/bforce/prot_common.c index 529ac5e..08ac451 100644 --- a/source/bforce/prot_common.c +++ b/source/bforce/prot_common.c @@ -102,7 +102,9 @@ static int prot_get_next_file(s_filelist **dest, s_protinfo *pi) /* network queue */ #ifdef NETSPOOL + log("start netspool"); if(state.netspool.state == NS_NOTINIT) { + log("netspool connection"); char password[9]; char address[300]; char *host = conf_string(cf_netspool_host); @@ -122,18 +124,23 @@ static int prot_get_next_file(s_filelist **dest, s_protinfo *pi) } } - if(state.netspool_state == NS_READY) { + if(state.netspool.state == NS_READY) { + log("netspool request"); netspool_query(&state.netspool, "ALL"); } - if(state.netspool_state == NS_RECEIVING) { + if(state.netspool.state == NS_RECEIVING) { + log("netspool begin receive"); netspool_receive(&state.netspool); } - if(state.netspool_state == NS_RECVFILE) { + if(state.netspool.state == NS_RECVFILE) { + log("netspool start file"); *dest = NULL; return 0; } + + log("netspool gives no more files"); #endif @@ -292,7 +299,7 @@ get_next_file: pi->send->action = ptrl->action; pi->send->flodsc = ptrl->flodsc; -#idef NETSPOOL +#ifdef NETSPOOL } #endif @@ -435,8 +442,8 @@ int p_tx_fclose(s_protinfo *pi) logerr("send: cannot truncate file \"%s\"", pi->send->fname); break; #ifdef NETSPOOL - case ACTION_ACKNOWLEDE: - netspool_acknowlede(&state.netspool); + case ACTION_ACKNOWLEDGE: + netspool_acknowledge(&state.netspool); break; #endif } @@ -465,8 +472,8 @@ int p_tx_readfile(char *buffer, size_t buflen, s_protinfo *pi) long ftell_pos; #ifdef NETSPOOL - if(pi->send->fname==NULL && strcmp(pi->send->localname, "NETSPOOL")==0 ) { - if( state->state != NS_RECVFILE ) { + if(pi->send->fname==NULL && strcmp(pi->send->local_name, "NETSPOOL")==0 ) { + if( state.netspool.state != NS_RECVFILE ) { log("send: wrong netspool state"); pi->send->status = FSTAT_SKIPPED; return -2; @@ -475,7 +482,7 @@ int p_tx_readfile(char *buffer, size_t buflen, s_protinfo *pi) pi->send->eofseen = state.netspool.length == 0; if( n==-1 ) { log("send: netspool error"); - log(netspool->state->error); + log(state.netspool.error); pi->send->status = FSTAT_SKIPPED; return -2; } @@ -1278,6 +1285,9 @@ void p_session_cleanup(s_protinfo *pi, bool success) } #ifdef NETSPOOL + if(state.netspool.state==NS_ERROR) { + log("netspool error %s", state.netspool.error); + } netspool_end(&state.netspool); #endif } diff --git a/source/configure b/source/configure index d6e376c..64cb531 100755 --- a/source/configure +++ b/source/configure @@ -1,83 +1,426 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.59 for bforce 0.22.9. +# Generated by GNU Autoconf 2.68 for bforce 0.22.9. # # Report bugs to . # -# Copyright (C) 2003 Free Software Foundation, Inc. +# +# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, +# 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software +# Foundation, Inc. +# +# # This configure script is free software; the Free Software Foundation # gives unlimited permission to copy, distribute and modify it. -## --------------------- ## -## M4sh Initialization. ## -## --------------------- ## +## -------------------- ## +## M4sh Initialization. ## +## -------------------- ## -# Be Bourne compatible -if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then +# Be more Bourne compatible +DUALCASE=1; export DUALCASE # for MKS sh +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : emulate sh NULLCMD=: - # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which + # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' -elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then - set -o posix + setopt NO_GLOB_SUBST +else + case `(set -o) 2>/dev/null` in #( + *posix*) : + set -o posix ;; #( + *) : + ;; +esac fi -DUALCASE=1; export DUALCASE # for MKS sh -# Support unset when possible. -if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then - as_unset=unset -else - as_unset=false + +as_nl=' +' +export as_nl +# Printing a long string crashes Solaris 7 /usr/bin/printf. +as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' +as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo +as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo +# Prefer a ksh shell builtin over an external printf program on Solaris, +# but without wasting forks for bash or zsh. +if test -z "$BASH_VERSION$ZSH_VERSION" \ + && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then + as_echo='print -r --' + as_echo_n='print -rn --' +elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then + as_echo='printf %s\n' + as_echo_n='printf %s' +else + if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then + as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' + as_echo_n='/usr/ucb/echo -n' + else + as_echo_body='eval expr "X$1" : "X\\(.*\\)"' + as_echo_n_body='eval + arg=$1; + case $arg in #( + *"$as_nl"*) + expr "X$arg" : "X\\(.*\\)$as_nl"; + arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; + esac; + expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" + ' + export as_echo_n_body + as_echo_n='sh -c $as_echo_n_body as_echo' + fi + export as_echo_body + as_echo='sh -c $as_echo_body as_echo' +fi + +# The user is always right. +if test "${PATH_SEPARATOR+set}" != set; then + PATH_SEPARATOR=: + (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { + (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || + PATH_SEPARATOR=';' + } fi -# Work around bugs in pre-3.0 UWIN ksh. -$as_unset ENV MAIL MAILPATH +# IFS +# We need space, tab and new line, in precisely that order. Quoting is +# there to prevent editors from complaining about space-tab. +# (If _AS_PATH_WALK were called with IFS unset, it would disable word +# splitting by setting IFS to empty value.) +IFS=" "" $as_nl" + +# Find who we are. Look in the path if we contain no directory separator. +as_myself= +case $0 in #(( + *[\\/]* ) as_myself=$0 ;; + *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break + done +IFS=$as_save_IFS + + ;; +esac +# We did not find ourselves, most probably we were run as `sh COMMAND' +# in which case we are not to be found in the path. +if test "x$as_myself" = x; then + as_myself=$0 +fi +if test ! -f "$as_myself"; then + $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 + exit 1 +fi + +# Unset variables that we do not need and which cause bugs (e.g. in +# pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" +# suppresses any "Segmentation fault" message there. '((' could +# trigger a bug in pdksh 5.2.14. +for as_var in BASH_ENV ENV MAIL MAILPATH +do eval test x\${$as_var+set} = xset \ + && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : +done PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. -for as_var in \ - LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ - LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ - LC_TELEPHONE LC_TIME +LC_ALL=C +export LC_ALL +LANGUAGE=C +export LANGUAGE + +# CDPATH. +(unset CDPATH) >/dev/null 2>&1 && unset CDPATH + +if test "x$CONFIG_SHELL" = x; then + as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then : + emulate sh + NULLCMD=: + # Pre-4.2 versions of Zsh do word splitting on \${1+\"\$@\"}, which + # is contrary to our usage. Disable this feature. + alias -g '\${1+\"\$@\"}'='\"\$@\"' + setopt NO_GLOB_SUBST +else + case \`(set -o) 2>/dev/null\` in #( + *posix*) : + set -o posix ;; #( + *) : + ;; +esac +fi +" + as_required="as_fn_return () { (exit \$1); } +as_fn_success () { as_fn_return 0; } +as_fn_failure () { as_fn_return 1; } +as_fn_ret_success () { return 0; } +as_fn_ret_failure () { return 1; } + +exitcode=0 +as_fn_success || { exitcode=1; echo as_fn_success failed.; } +as_fn_failure && { exitcode=1; echo as_fn_failure succeeded.; } +as_fn_ret_success || { exitcode=1; echo as_fn_ret_success failed.; } +as_fn_ret_failure && { exitcode=1; echo as_fn_ret_failure succeeded.; } +if ( set x; as_fn_ret_success y && test x = \"\$1\" ); then : + +else + exitcode=1; echo positional parameters were not saved. +fi +test x\$exitcode = x0 || exit 1" + as_suggested=" as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO + as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO + eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" && + test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1 +test \$(( 1 + 1 )) = 2 || exit 1" + if (eval "$as_required") 2>/dev/null; then : + as_have_required=yes +else + as_have_required=no +fi + if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null; then : + +else + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +as_found=false +for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH do - if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then - eval $as_var=C; export $as_var + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + as_found=: + case $as_dir in #( + /*) + for as_base in sh bash ksh sh5; do + # Try only shells that exist, to save several forks. + as_shell=$as_dir/$as_base + if { test -f "$as_shell" || test -f "$as_shell.exe"; } && + { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$as_shell"; } 2>/dev/null; then : + CONFIG_SHELL=$as_shell as_have_required=yes + if { $as_echo "$as_bourne_compatible""$as_suggested" | as_run=a "$as_shell"; } 2>/dev/null; then : + break 2 +fi +fi + done;; + esac + as_found=false +done +$as_found || { if { test -f "$SHELL" || test -f "$SHELL.exe"; } && + { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$SHELL"; } 2>/dev/null; then : + CONFIG_SHELL=$SHELL as_have_required=yes +fi; } +IFS=$as_save_IFS + + + if test "x$CONFIG_SHELL" != x; then : + # We cannot yet assume a decent shell, so we have to provide a + # neutralization value for shells without unset; and this also + # works around shells that cannot unset nonexistent variables. + # Preserve -v and -x to the replacement shell. + BASH_ENV=/dev/null + ENV=/dev/null + (unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV + export CONFIG_SHELL + case $- in # (((( + *v*x* | *x*v* ) as_opts=-vx ;; + *v* ) as_opts=-v ;; + *x* ) as_opts=-x ;; + * ) as_opts= ;; + esac + exec "$CONFIG_SHELL" $as_opts "$as_myself" ${1+"$@"} +fi + + if test x$as_have_required = xno; then : + $as_echo "$0: This script requires a shell more modern than all" + $as_echo "$0: the shells that I found on your system." + if test x${ZSH_VERSION+set} = xset ; then + $as_echo "$0: In particular, zsh $ZSH_VERSION has bugs and should" + $as_echo "$0: be upgraded to zsh 4.3.4 or later." else - $as_unset $as_var + $as_echo "$0: Please tell bug-autoconf@gnu.org and +$0: e.kozhuhovskiy@gmail.com about your system, including +$0: any error possibly output before this message. Then +$0: install a modern shell, or manually run the script +$0: under such a shell if you do have one." fi -done + exit 1 +fi +fi +fi +SHELL=${CONFIG_SHELL-/bin/sh} +export SHELL +# Unset more variables known to interfere with behavior of common tools. +CLICOLOR_FORCE= GREP_OPTIONS= +unset CLICOLOR_FORCE GREP_OPTIONS + +## --------------------- ## +## M4sh Shell Functions. ## +## --------------------- ## +# as_fn_unset VAR +# --------------- +# Portably unset VAR. +as_fn_unset () +{ + { eval $1=; unset $1;} +} +as_unset=as_fn_unset -# Required to use basename. -if expr a : '\(a\)' >/dev/null 2>&1; then +# as_fn_set_status STATUS +# ----------------------- +# Set $? to STATUS, without forking. +as_fn_set_status () +{ + return $1 +} # as_fn_set_status + +# as_fn_exit STATUS +# ----------------- +# Exit the shell with STATUS, even in a "trap 0" or "set -e" context. +as_fn_exit () +{ + set +e + as_fn_set_status $1 + exit $1 +} # as_fn_exit + +# as_fn_mkdir_p +# ------------- +# Create "$as_dir" as a directory, including parents if necessary. +as_fn_mkdir_p () +{ + + case $as_dir in #( + -*) as_dir=./$as_dir;; + esac + test -d "$as_dir" || eval $as_mkdir_p || { + as_dirs= + while :; do + case $as_dir in #( + *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( + *) as_qdir=$as_dir;; + esac + as_dirs="'$as_qdir' $as_dirs" + as_dir=`$as_dirname -- "$as_dir" || +$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_dir" : 'X\(//\)[^/]' \| \ + X"$as_dir" : 'X\(//\)$' \| \ + X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$as_dir" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + test -d "$as_dir" && break + done + test -z "$as_dirs" || eval "mkdir $as_dirs" + } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" + + +} # as_fn_mkdir_p +# as_fn_append VAR VALUE +# ---------------------- +# Append the text in VALUE to the end of the definition contained in VAR. Take +# advantage of any shell optimizations that allow amortized linear growth over +# repeated appends, instead of the typical quadratic growth present in naive +# implementations. +if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : + eval 'as_fn_append () + { + eval $1+=\$2 + }' +else + as_fn_append () + { + eval $1=\$$1\$2 + } +fi # as_fn_append + +# as_fn_arith ARG... +# ------------------ +# Perform arithmetic evaluation on the ARGs, and store the result in the +# global $as_val. Take advantage of shells that can avoid forks. The arguments +# must be portable across $(()) and expr. +if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : + eval 'as_fn_arith () + { + as_val=$(( $* )) + }' +else + as_fn_arith () + { + as_val=`expr "$@" || test $? -eq 1` + } +fi # as_fn_arith + + +# as_fn_error STATUS ERROR [LINENO LOG_FD] +# ---------------------------------------- +# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are +# provided, also output the error to LOG_FD, referencing LINENO. Then exit the +# script with STATUS, using 1 if that was 0. +as_fn_error () +{ + as_status=$1; test $as_status -eq 0 && as_status=1 + if test "$4"; then + as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 + fi + $as_echo "$as_me: error: $2" >&2 + as_fn_exit $as_status +} # as_fn_error + +if expr a : '\(a\)' >/dev/null 2>&1 && + test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi -if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then +if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi +if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then + as_dirname=dirname +else + as_dirname=false +fi -# Name of the executable. -as_me=`$as_basename "$0" || +as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ - X"$0" : 'X\(/\)$' \| \ - . : '\(.\)' 2>/dev/null || -echo X/"$0" | - sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; } - /^X\/\(\/\/\)$/{ s//\1/; q; } - /^X\/\(\/\).*/{ s//\1/; q; } - s/.*/./; q'` - + X"$0" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X/"$0" | + sed '/^.*\/\([^/][^/]*\)\/*$/{ + s//\1/ + q + } + /^X\/\(\/\/\)$/{ + s//\1/ + q + } + /^X\/\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` -# PATH needs CR, and LINENO needs CR and PATH. # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' @@ -85,146 +428,107 @@ as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits -# The user is always right. -if test "${PATH_SEPARATOR+set}" != set; then - echo "#! /bin/sh" >conf$$.sh - echo "exit 0" >>conf$$.sh - chmod +x conf$$.sh - if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then - PATH_SEPARATOR=';' - else - PATH_SEPARATOR=: - fi - rm -f conf$$.sh -fi - - - as_lineno_1=$LINENO - as_lineno_2=$LINENO - as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` - test "x$as_lineno_1" != "x$as_lineno_2" && - test "x$as_lineno_3" = "x$as_lineno_2" || { - # Find who we are. Look in the path if we contain no path at all - # relative or not. - case $0 in - *[\\/]* ) as_myself=$0 ;; - *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break -done - - ;; - esac - # We did not find ourselves, most probably we were run as `sh COMMAND' - # in which case we are not to be found in the path. - if test "x$as_myself" = x; then - as_myself=$0 - fi - if test ! -f "$as_myself"; then - { echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2 - { (exit 1); exit 1; }; } - fi - case $CONFIG_SHELL in - '') - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for as_base in sh bash ksh sh5; do - case $as_dir in - /*) - if ("$as_dir/$as_base" -c ' - as_lineno_1=$LINENO - as_lineno_2=$LINENO - as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` - test "x$as_lineno_1" != "x$as_lineno_2" && - test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then - $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; } - $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; } - CONFIG_SHELL=$as_dir/$as_base - export CONFIG_SHELL - exec "$CONFIG_SHELL" "$0" ${1+"$@"} - fi;; - esac - done -done -;; - esac - # Create $as_me.lineno as a copy of $as_myself, but with $LINENO - # uniformly replaced by the line number. The first 'sed' inserts a - # line-number line before each line; the second 'sed' does the real - # work. The second script uses 'N' to pair each line-number line - # with the numbered line, and appends trailing '-' during - # substitution so that $LINENO is not a special case at line end. - # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the - # second 'sed' script. Blame Lee E. McMahon for sed's syntax. :-) - sed '=' <$as_myself | + as_lineno_1=$LINENO as_lineno_1a=$LINENO + as_lineno_2=$LINENO as_lineno_2a=$LINENO + eval 'test "x$as_lineno_1'$as_run'" != "x$as_lineno_2'$as_run'" && + test "x`expr $as_lineno_1'$as_run' + 1`" = "x$as_lineno_2'$as_run'"' || { + # Blame Lee E. McMahon (1931-1989) for sed's syntax. :-) + sed -n ' + p + /[$]LINENO/= + ' <$as_myself | sed ' + s/[$]LINENO.*/&-/ + t lineno + b + :lineno N - s,$,-, - : loop - s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3, + :loop + s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ t loop - s,-$,, - s,^['$as_cr_digits']*\n,, + s/-\n.*// ' >$as_me.lineno && - chmod +x $as_me.lineno || - { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2 - { (exit 1); exit 1; }; } + chmod +x "$as_me.lineno" || + { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; } # Don't try to exec as it changes $[0], causing all sort of problems # (the dirname of $[0] is not the place where we might find the - # original and so on. Autoconf is especially sensible to this). - . ./$as_me.lineno + # original and so on. Autoconf is especially sensitive to this). + . "./$as_me.lineno" # Exit status is that of the last command. exit } - -case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in - *c*,-n*) ECHO_N= ECHO_C=' -' ECHO_T=' ' ;; - *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;; - *) ECHO_N= ECHO_C='\c' ECHO_T= ;; +ECHO_C= ECHO_N= ECHO_T= +case `echo -n x` in #((((( +-n*) + case `echo 'xy\c'` in + *c*) ECHO_T=' ';; # ECHO_T is single tab character. + xy) ECHO_C='\c';; + *) echo `echo ksh88 bug on AIX 6.1` > /dev/null + ECHO_T=' ';; + esac;; +*) + ECHO_N='-n';; esac -if expr a : '\(a\)' >/dev/null 2>&1; then - as_expr=expr +rm -f conf$$ conf$$.exe conf$$.file +if test -d conf$$.dir; then + rm -f conf$$.dir/conf$$.file else - as_expr=false + rm -f conf$$.dir + mkdir conf$$.dir 2>/dev/null fi - -rm -f conf$$ conf$$.exe conf$$.file -echo >conf$$.file -if ln -s conf$$.file conf$$ 2>/dev/null; then - # We could just check for DJGPP; but this test a) works b) is more generic - # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04). - if test -f conf$$.exe; then - # Don't use ln at all; we don't have any links - as_ln_s='cp -p' - else +if (echo >conf$$.file) 2>/dev/null; then + if ln -s conf$$.file conf$$ 2>/dev/null; then as_ln_s='ln -s' + # ... but there are two gotchas: + # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. + # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. + # In both cases, we have to default to `cp -p'. + ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || + as_ln_s='cp -p' + elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln + else + as_ln_s='cp -p' fi -elif ln conf$$.file conf$$ 2>/dev/null; then - as_ln_s=ln else as_ln_s='cp -p' fi -rm -f conf$$ conf$$.exe conf$$.file +rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file +rmdir conf$$.dir 2>/dev/null if mkdir -p . 2>/dev/null; then - as_mkdir_p=: + as_mkdir_p='mkdir -p "$as_dir"' else test -d ./-p && rmdir ./-p as_mkdir_p=false fi -as_executable_p="test -f" +if test -x / >/dev/null 2>&1; then + as_test_x='test -x' +else + if ls -dL / >/dev/null 2>&1; then + as_ls_L_option=L + else + as_ls_L_option= + fi + as_test_x=' + eval sh -c '\'' + if test -d "$1"; then + test -d "$1/."; + else + case $1 in #( + -*)set "./$1";; + esac; + case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #(( + ???[sx]*):;;*)false;;esac;fi + '\'' sh + ' +fi +as_executable_p=$as_test_x # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" @@ -233,38 +537,25 @@ as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" -# IFS -# We need space, tab and new line, in precisely that order. -as_nl=' -' -IFS=" $as_nl" - -# CDPATH. -$as_unset CDPATH - +test -n "$DJDIR" || exec 7<&0 &1 # Name of the host. -# hostname on some systems (SVR3.2, Linux) returns a bogus exit status, +# hostname on some systems (SVR3.2, old GNU/Linux) returns a bogus exit status, # so uname gets run too. ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` -exec 6>&1 - # # Initializations. # ac_default_prefix=/usr/local +ac_clean_files= ac_config_libobj_dir=. +LIBOBJS= cross_compiling=no subdirs= MFLAGS= MAKEFLAGS= -SHELL=${CONFIG_SHELL-/bin/sh} - -# Maximum number of lines to put in a shell here document. -# This variable seems obsolete. It should probably be removed, and -# only ac_max_sed_lines should be used. -: ${ac_max_here_lines=38} # Identity of this package. PACKAGE_NAME='bforce' @@ -272,51 +563,151 @@ PACKAGE_TARNAME='bforce' PACKAGE_VERSION='0.22.9' PACKAGE_STRING='bforce 0.22.9' PACKAGE_BUGREPORT='e.kozhuhovskiy@gmail.com' +PACKAGE_URL='' ac_default_prefix=/usr/local/fido # Factoring default headers for most tests. ac_includes_default="\ #include -#if HAVE_SYS_TYPES_H +#ifdef HAVE_SYS_TYPES_H # include #endif -#if HAVE_SYS_STAT_H +#ifdef HAVE_SYS_STAT_H # include #endif -#if STDC_HEADERS +#ifdef STDC_HEADERS # include # include #else -# if HAVE_STDLIB_H +# ifdef HAVE_STDLIB_H # include # endif #endif -#if HAVE_STRING_H -# if !STDC_HEADERS && HAVE_MEMORY_H +#ifdef HAVE_STRING_H +# if !defined STDC_HEADERS && defined HAVE_MEMORY_H # include # endif # include #endif -#if HAVE_STRINGS_H +#ifdef HAVE_STRINGS_H # include #endif -#if HAVE_INTTYPES_H +#ifdef HAVE_INTTYPES_H # include -#else -# if HAVE_STDINT_H -# include -# endif #endif -#if HAVE_UNISTD_H +#ifdef HAVE_STDINT_H +# include +#endif +#ifdef HAVE_UNISTD_H # include #endif" -ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os OWNER GROUP SPOOLDIR LOGDIR YACC CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CPP EGREP LIBOBJS LTLIBOBJS' +ac_subst_vars='LTLIBOBJS +LIBOBJS +EGREP +GREP +CPP +INSTALL_DATA +INSTALL_SCRIPT +INSTALL_PROGRAM +OBJEXT +EXEEXT +ac_ct_CC +CPPFLAGS +LDFLAGS +CFLAGS +CC +YFLAGS +YACC +LOGDIR +SPOOLDIR +GROUP +OWNER +target_os +target_vendor +target_cpu +target +host_os +host_vendor +host_cpu +host +build_os +build_vendor +build_cpu +build +target_alias +host_alias +build_alias +LIBS +ECHO_T +ECHO_N +ECHO_C +DEFS +mandir +localedir +libdir +psdir +pdfdir +dvidir +htmldir +infodir +docdir +oldincludedir +includedir +localstatedir +sharedstatedir +sysconfdir +datadir +datarootdir +libexecdir +sbindir +bindir +program_transform_name +prefix +exec_prefix +PACKAGE_URL +PACKAGE_BUGREPORT +PACKAGE_STRING +PACKAGE_VERSION +PACKAGE_TARNAME +PACKAGE_NAME +PATH_SEPARATOR +SHELL' ac_subst_files='' +ac_user_opts=' +enable_option_checking +with_owner +with_group +with_spooldir +with_logdir +enable_debug +enable_dcd_control +enable_hangup_watch_cd +enable_log_passwd +enable_csy_locks +enable_syslog +enable_netspool +enable_buggy_emsi +with_uucp_lockdir +' + ac_precious_vars='build_alias +host_alias +target_alias +YACC +YFLAGS +CC +CFLAGS +LDFLAGS +LIBS +CPPFLAGS +CPP' + # Initialize some variables set by options. ac_init_help= ac_init_version=false +ac_unrecognized_opts= +ac_unrecognized_sep= # The variables have the same names as the options, with # dashes changed to underlines. cache_file=/dev/null @@ -339,34 +730,49 @@ x_libraries=NONE # and all the variables that are supposed to be based on exec_prefix # by default will actually change. # Use braces instead of parens because sh, perl, etc. also accept them. +# (The list follows the same order as the GNU Coding Standards.) bindir='${exec_prefix}/bin' sbindir='${exec_prefix}/sbin' libexecdir='${exec_prefix}/libexec' -datadir='${prefix}/share' +datarootdir='${prefix}/share' +datadir='${datarootdir}' sysconfdir='${prefix}/etc' sharedstatedir='${prefix}/com' localstatedir='${prefix}/var' -libdir='${exec_prefix}/lib' includedir='${prefix}/include' oldincludedir='/usr/include' -infodir='${prefix}/info' -mandir='${prefix}/man' +docdir='${datarootdir}/doc/${PACKAGE_TARNAME}' +infodir='${datarootdir}/info' +htmldir='${docdir}' +dvidir='${docdir}' +pdfdir='${docdir}' +psdir='${docdir}' +libdir='${exec_prefix}/lib' +localedir='${datarootdir}/locale' +mandir='${datarootdir}/man' ac_prev= +ac_dashdash= for ac_option do # If the previous option needs an argument, assign it. if test -n "$ac_prev"; then - eval "$ac_prev=\$ac_option" + eval $ac_prev=\$ac_option ac_prev= continue fi - ac_optarg=`expr "x$ac_option" : 'x[^=]*=\(.*\)'` + case $ac_option in + *=?*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;; + *=) ac_optarg= ;; + *) ac_optarg=yes ;; + esac # Accept the important Cygnus configure options, so we can diagnose typos. - case $ac_option in + case $ac_dashdash$ac_option in + --) + ac_dashdash=yes ;; -bindir | --bindir | --bindi | --bind | --bin | --bi) ac_prev=bindir ;; @@ -388,33 +794,59 @@ do --config-cache | -C) cache_file=config.cache ;; - -datadir | --datadir | --datadi | --datad | --data | --dat | --da) + -datadir | --datadir | --datadi | --datad) ac_prev=datadir ;; - -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \ - | --da=*) + -datadir=* | --datadir=* | --datadi=* | --datad=*) datadir=$ac_optarg ;; + -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \ + | --dataroo | --dataro | --datar) + ac_prev=datarootdir ;; + -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \ + | --dataroot=* | --dataroo=* | --dataro=* | --datar=*) + datarootdir=$ac_optarg ;; + -disable-* | --disable-*) - ac_feature=`expr "x$ac_option" : 'x-*disable-\(.*\)'` + ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'` # Reject names that are not valid shell variable names. - expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null && - { echo "$as_me: error: invalid feature name: $ac_feature" >&2 - { (exit 1); exit 1; }; } - ac_feature=`echo $ac_feature | sed 's/-/_/g'` - eval "enable_$ac_feature=no" ;; + expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && + as_fn_error $? "invalid feature name: $ac_useropt" + ac_useropt_orig=$ac_useropt + ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` + case $ac_user_opts in + *" +"enable_$ac_useropt" +"*) ;; + *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--disable-$ac_useropt_orig" + ac_unrecognized_sep=', ';; + esac + eval enable_$ac_useropt=no ;; + + -docdir | --docdir | --docdi | --doc | --do) + ac_prev=docdir ;; + -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*) + docdir=$ac_optarg ;; + + -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv) + ac_prev=dvidir ;; + -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*) + dvidir=$ac_optarg ;; -enable-* | --enable-*) - ac_feature=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` + ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` # Reject names that are not valid shell variable names. - expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null && - { echo "$as_me: error: invalid feature name: $ac_feature" >&2 - { (exit 1); exit 1; }; } - ac_feature=`echo $ac_feature | sed 's/-/_/g'` - case $ac_option in - *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;; - *) ac_optarg=yes ;; + expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && + as_fn_error $? "invalid feature name: $ac_useropt" + ac_useropt_orig=$ac_useropt + ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` + case $ac_user_opts in + *" +"enable_$ac_useropt" +"*) ;; + *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--enable-$ac_useropt_orig" + ac_unrecognized_sep=', ';; esac - eval "enable_$ac_feature='$ac_optarg'" ;; + eval enable_$ac_useropt=\$ac_optarg ;; -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ @@ -441,6 +873,12 @@ do -host=* | --host=* | --hos=* | --ho=*) host_alias=$ac_optarg ;; + -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht) + ac_prev=htmldir ;; + -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \ + | --ht=*) + htmldir=$ac_optarg ;; + -includedir | --includedir | --includedi | --included | --include \ | --includ | --inclu | --incl | --inc) ac_prev=includedir ;; @@ -465,13 +903,16 @@ do | --libexe=* | --libex=* | --libe=*) libexecdir=$ac_optarg ;; + -localedir | --localedir | --localedi | --localed | --locale) + ac_prev=localedir ;; + -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*) + localedir=$ac_optarg ;; + -localstatedir | --localstatedir | --localstatedi | --localstated \ - | --localstate | --localstat | --localsta | --localst \ - | --locals | --local | --loca | --loc | --lo) + | --localstate | --localstat | --localsta | --localst | --locals) ac_prev=localstatedir ;; -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ - | --localstate=* | --localstat=* | --localsta=* | --localst=* \ - | --locals=* | --local=* | --loca=* | --loc=* | --lo=*) + | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*) localstatedir=$ac_optarg ;; -mandir | --mandir | --mandi | --mand | --man | --ma | --m) @@ -536,6 +977,16 @@ do | --progr-tra=* | --program-tr=* | --program-t=*) program_transform_name=$ac_optarg ;; + -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd) + ac_prev=pdfdir ;; + -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*) + pdfdir=$ac_optarg ;; + + -psdir | --psdir | --psdi | --psd | --ps) + ac_prev=psdir ;; + -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*) + psdir=$ac_optarg ;; + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) silent=yes ;; @@ -586,26 +1037,36 @@ do ac_init_version=: ;; -with-* | --with-*) - ac_package=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` + ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` # Reject names that are not valid shell variable names. - expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null && - { echo "$as_me: error: invalid package name: $ac_package" >&2 - { (exit 1); exit 1; }; } - ac_package=`echo $ac_package| sed 's/-/_/g'` - case $ac_option in - *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;; - *) ac_optarg=yes ;; + expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && + as_fn_error $? "invalid package name: $ac_useropt" + ac_useropt_orig=$ac_useropt + ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` + case $ac_user_opts in + *" +"with_$ac_useropt" +"*) ;; + *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--with-$ac_useropt_orig" + ac_unrecognized_sep=', ';; esac - eval "with_$ac_package='$ac_optarg'" ;; + eval with_$ac_useropt=\$ac_optarg ;; -without-* | --without-*) - ac_package=`expr "x$ac_option" : 'x-*without-\(.*\)'` + ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'` # Reject names that are not valid shell variable names. - expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null && - { echo "$as_me: error: invalid package name: $ac_package" >&2 - { (exit 1); exit 1; }; } - ac_package=`echo $ac_package | sed 's/-/_/g'` - eval "with_$ac_package=no" ;; + expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && + as_fn_error $? "invalid package name: $ac_useropt" + ac_useropt_orig=$ac_useropt + ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` + case $ac_user_opts in + *" +"with_$ac_useropt" +"*) ;; + *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--without-$ac_useropt_orig" + ac_unrecognized_sep=', ';; + esac + eval with_$ac_useropt=no ;; --x) # Obsolete; use --with-x. @@ -625,27 +1086,26 @@ do | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) x_libraries=$ac_optarg ;; - -*) { echo "$as_me: error: unrecognized option: $ac_option -Try \`$0 --help' for more information." >&2 - { (exit 1); exit 1; }; } + -*) as_fn_error $? "unrecognized option: \`$ac_option' +Try \`$0 --help' for more information" ;; *=*) ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` # Reject names that are not valid shell variable names. - expr "x$ac_envvar" : ".*[^_$as_cr_alnum]" >/dev/null && - { echo "$as_me: error: invalid variable name: $ac_envvar" >&2 - { (exit 1); exit 1; }; } - ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` - eval "$ac_envvar='$ac_optarg'" + case $ac_envvar in #( + '' | [0-9]* | *[!_$as_cr_alnum]* ) + as_fn_error $? "invalid variable name: \`$ac_envvar'" ;; + esac + eval $ac_envvar=\$ac_optarg export $ac_envvar ;; *) # FIXME: should be removed in autoconf 3.0. - echo "$as_me: WARNING: you should use --build, --host, --target" >&2 + $as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2 expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && - echo "$as_me: WARNING: invalid host type: $ac_option" >&2 - : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option} + $as_echo "$as_me: WARNING: invalid host type: $ac_option" >&2 + : "${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}" ;; esac @@ -653,31 +1113,36 @@ done if test -n "$ac_prev"; then ac_option=--`echo $ac_prev | sed 's/_/-/g'` - { echo "$as_me: error: missing argument to $ac_option" >&2 - { (exit 1); exit 1; }; } + as_fn_error $? "missing argument to $ac_option" fi -# Be sure to have absolute paths. -for ac_var in exec_prefix prefix -do - eval ac_val=$`echo $ac_var` - case $ac_val in - [\\/$]* | ?:[\\/]* | NONE | '' ) ;; - *) { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 - { (exit 1); exit 1; }; };; +if test -n "$ac_unrecognized_opts"; then + case $enable_option_checking in + no) ;; + fatal) as_fn_error $? "unrecognized options: $ac_unrecognized_opts" ;; + *) $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;; esac -done +fi -# Be sure to have absolute paths. -for ac_var in bindir sbindir libexecdir datadir sysconfdir sharedstatedir \ - localstatedir libdir includedir oldincludedir infodir mandir +# Check all directory arguments for consistency. +for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ + datadir sysconfdir sharedstatedir localstatedir includedir \ + oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ + libdir localedir mandir do - eval ac_val=$`echo $ac_var` + eval ac_val=\$$ac_var + # Remove trailing slashes. case $ac_val in - [\\/$]* | ?:[\\/]* ) ;; - *) { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 - { (exit 1); exit 1; }; };; + */ ) + ac_val=`expr "X$ac_val" : 'X\(.*[^/]\)' \| "X$ac_val" : 'X\(.*\)'` + eval $ac_var=\$ac_val;; esac + # Be sure to have absolute directory names. + case $ac_val in + [\\/$]* | ?:[\\/]* ) continue;; + NONE | '' ) case $ac_var in *prefix ) continue;; esac;; + esac + as_fn_error $? "expected an absolute directory name for --$ac_var: $ac_val" done # There might be people who depend on the old broken behavior: `$host' @@ -691,8 +1156,8 @@ target=$target_alias if test "x$host_alias" != x; then if test "x$build_alias" = x; then cross_compiling=maybe - echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host. - If a cross compiler is detected then cross compile mode will be used." >&2 + $as_echo "$as_me: WARNING: if you wanted to set the --build type, don't use --host. + If a cross compiler is detected then cross compile mode will be used" >&2 elif test "x$build_alias" != "x$host_alias"; then cross_compiling=yes fi @@ -704,74 +1169,72 @@ test -n "$host_alias" && ac_tool_prefix=$host_alias- test "$silent" = yes && exec 6>/dev/null +ac_pwd=`pwd` && test -n "$ac_pwd" && +ac_ls_di=`ls -di .` && +ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` || + as_fn_error $? "working directory cannot be determined" +test "X$ac_ls_di" = "X$ac_pwd_ls_di" || + as_fn_error $? "pwd does not report name of working directory" + + # Find the source files, if location was not specified. if test -z "$srcdir"; then ac_srcdir_defaulted=yes - # Try the directory containing this script, then its parent. - ac_confdir=`(dirname "$0") 2>/dev/null || -$as_expr X"$0" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$0" : 'X\(//\)[^/]' \| \ - X"$0" : 'X\(//\)$' \| \ - X"$0" : 'X\(/\)' \| \ - . : '\(.\)' 2>/dev/null || -echo X"$0" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } - /^X\(\/\/\)[^/].*/{ s//\1/; q; } - /^X\(\/\/\)$/{ s//\1/; q; } - /^X\(\/\).*/{ s//\1/; q; } - s/.*/./; q'` + # Try the directory containing this script, then the parent directory. + ac_confdir=`$as_dirname -- "$as_myself" || +$as_expr X"$as_myself" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_myself" : 'X\(//\)[^/]' \| \ + X"$as_myself" : 'X\(//\)$' \| \ + X"$as_myself" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$as_myself" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` srcdir=$ac_confdir - if test ! -r $srcdir/$ac_unique_file; then + if test ! -r "$srcdir/$ac_unique_file"; then srcdir=.. fi else ac_srcdir_defaulted=no fi -if test ! -r $srcdir/$ac_unique_file; then - if test "$ac_srcdir_defaulted" = yes; then - { echo "$as_me: error: cannot find sources ($ac_unique_file) in $ac_confdir or .." >&2 - { (exit 1); exit 1; }; } - else - { echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2 - { (exit 1); exit 1; }; } - fi -fi -(cd $srcdir && test -r ./$ac_unique_file) 2>/dev/null || - { echo "$as_me: error: sources are in $srcdir, but \`cd $srcdir' does not work" >&2 - { (exit 1); exit 1; }; } -srcdir=`echo "$srcdir" | sed 's%\([^\\/]\)[\\/]*$%\1%'` -ac_env_build_alias_set=${build_alias+set} -ac_env_build_alias_value=$build_alias -ac_cv_env_build_alias_set=${build_alias+set} -ac_cv_env_build_alias_value=$build_alias -ac_env_host_alias_set=${host_alias+set} -ac_env_host_alias_value=$host_alias -ac_cv_env_host_alias_set=${host_alias+set} -ac_cv_env_host_alias_value=$host_alias -ac_env_target_alias_set=${target_alias+set} -ac_env_target_alias_value=$target_alias -ac_cv_env_target_alias_set=${target_alias+set} -ac_cv_env_target_alias_value=$target_alias -ac_env_CC_set=${CC+set} -ac_env_CC_value=$CC -ac_cv_env_CC_set=${CC+set} -ac_cv_env_CC_value=$CC -ac_env_CFLAGS_set=${CFLAGS+set} -ac_env_CFLAGS_value=$CFLAGS -ac_cv_env_CFLAGS_set=${CFLAGS+set} -ac_cv_env_CFLAGS_value=$CFLAGS -ac_env_LDFLAGS_set=${LDFLAGS+set} -ac_env_LDFLAGS_value=$LDFLAGS -ac_cv_env_LDFLAGS_set=${LDFLAGS+set} -ac_cv_env_LDFLAGS_value=$LDFLAGS -ac_env_CPPFLAGS_set=${CPPFLAGS+set} -ac_env_CPPFLAGS_value=$CPPFLAGS -ac_cv_env_CPPFLAGS_set=${CPPFLAGS+set} -ac_cv_env_CPPFLAGS_value=$CPPFLAGS -ac_env_CPP_set=${CPP+set} -ac_env_CPP_value=$CPP -ac_cv_env_CPP_set=${CPP+set} -ac_cv_env_CPP_value=$CPP +if test ! -r "$srcdir/$ac_unique_file"; then + test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .." + as_fn_error $? "cannot find sources ($ac_unique_file) in $srcdir" +fi +ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work" +ac_abs_confdir=`( + cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error $? "$ac_msg" + pwd)` +# When building in place, set srcdir=. +if test "$ac_abs_confdir" = "$ac_pwd"; then + srcdir=. +fi +# Remove unnecessary trailing slashes from srcdir. +# Double slashes in file names in object file debugging info +# mess up M-x gdb in Emacs. +case $srcdir in +*/) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;; +esac +for ac_var in $ac_precious_vars; do + eval ac_env_${ac_var}_set=\${${ac_var}+set} + eval ac_env_${ac_var}_value=\$${ac_var} + eval ac_cv_env_${ac_var}_set=\${${ac_var}+set} + eval ac_cv_env_${ac_var}_value=\$${ac_var} +done # # Report the --help message. @@ -794,20 +1257,17 @@ Configuration: --help=short display options specific to this package --help=recursive display the short help of all the included packages -V, --version display version information and exit - -q, --quiet, --silent do not print \`checking...' messages + -q, --quiet, --silent do not print \`checking ...' messages --cache-file=FILE cache test results in FILE [disabled] -C, --config-cache alias for \`--cache-file=config.cache' -n, --no-create do not create output files --srcdir=DIR find the sources in DIR [configure dir or \`..'] -_ACEOF - - cat <<_ACEOF Installation directories: --prefix=PREFIX install architecture-independent files in PREFIX - [$ac_default_prefix] + [$ac_default_prefix] --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX - [PREFIX] + [PREFIX] By default, \`make install' will install all the files in \`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify @@ -817,18 +1277,25 @@ for instance \`--prefix=\$HOME'. For better control, use the options below. Fine tuning of the installation directories: - --bindir=DIR user executables [EPREFIX/bin] - --sbindir=DIR system admin executables [EPREFIX/sbin] - --libexecdir=DIR program executables [EPREFIX/libexec] - --datadir=DIR read-only architecture-independent data [PREFIX/share] - --sysconfdir=DIR read-only single-machine data [PREFIX/etc] - --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] - --localstatedir=DIR modifiable single-machine data [PREFIX/var] - --libdir=DIR object code libraries [EPREFIX/lib] - --includedir=DIR C header files [PREFIX/include] - --oldincludedir=DIR C header files for non-gcc [/usr/include] - --infodir=DIR info documentation [PREFIX/info] - --mandir=DIR man documentation [PREFIX/man] + --bindir=DIR user executables [EPREFIX/bin] + --sbindir=DIR system admin executables [EPREFIX/sbin] + --libexecdir=DIR program executables [EPREFIX/libexec] + --sysconfdir=DIR read-only single-machine data [PREFIX/etc] + --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] + --localstatedir=DIR modifiable single-machine data [PREFIX/var] + --libdir=DIR object code libraries [EPREFIX/lib] + --includedir=DIR C header files [PREFIX/include] + --oldincludedir=DIR C header files for non-gcc [/usr/include] + --datarootdir=DIR read-only arch.-independent data root [PREFIX/share] + --datadir=DIR read-only architecture-independent data [DATAROOTDIR] + --infodir=DIR info documentation [DATAROOTDIR/info] + --localedir=DIR locale-dependent data [DATAROOTDIR/locale] + --mandir=DIR man documentation [DATAROOTDIR/man] + --docdir=DIR documentation root [DATAROOTDIR/doc/bforce] + --htmldir=DIR html documentation [DOCDIR] + --dvidir=DIR dvi documentation [DOCDIR] + --pdfdir=DIR pdf documentation [DOCDIR] + --psdir=DIR ps documentation [DOCDIR] _ACEOF cat <<\_ACEOF @@ -847,6 +1314,7 @@ if test -n "$ac_init_help"; then cat <<\_ACEOF Optional Features: + --disable-option-checking ignore unrecognized --enable/--with options --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) --enable-FEATURE[=ARG] include FEATURE [ARG=yes] --enable-debug enable debugging support (default) @@ -855,6 +1323,7 @@ Optional Features: --enable-log-passwd write session password to log (default) --enable-csy-locks use '.csy' locks while dialing (default) --enable-syslog use syslog for logging experimental (default) + --enable-netspool network attached inbound/outbound --disable-buggy-emsi disable buggy emsi support (default) Optional Packages: @@ -867,12 +1336,19 @@ Optional Packages: --with-uucp-lockdir specify directory for UUCP style locks Some influential environment variables: + YACC The `Yet Another Compiler Compiler' implementation to use. + Defaults to the first program found out of: `bison -y', `byacc', + `yacc'. + YFLAGS The list of arguments that will be passed by default to $YACC. + This script will default YFLAGS to the empty string to avoid a + default value of `-d' given by some make applications. CC C compiler command CFLAGS C compiler flags LDFLAGS linker flags, e.g. -L if you have libraries in a nonstandard directory - CPPFLAGS C/C++ preprocessor flags, e.g. -I if you have - headers in a nonstandard directory + LIBS libraries to pass to the linker, e.g. -l + CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I if + you have headers in a nonstandard directory CPP C preprocessor Use these variables to override the choices made by `configure' or to help @@ -880,156 +1356,534 @@ it to find libraries and programs with nonstandard names/locations. Report bugs to . _ACEOF +ac_status=$? fi if test "$ac_init_help" = "recursive"; then # If there are subdirs, report their specific --help. - ac_popdir=`pwd` for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue - test -d $ac_dir || continue + test -d "$ac_dir" || + { cd "$srcdir" && ac_pwd=`pwd` && srcdir=. && test -d "$ac_dir"; } || + continue ac_builddir=. -if test "$ac_dir" != .; then - ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` - # A "../" for each directory in $ac_dir_suffix. - ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'` -else - ac_dir_suffix= ac_top_builddir= -fi +case "$ac_dir" in +.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; +*) + ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` + # A ".." for each directory in $ac_dir_suffix. + ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` + case $ac_top_builddir_sub in + "") ac_top_builddir_sub=. ac_top_build_prefix= ;; + *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; + esac ;; +esac +ac_abs_top_builddir=$ac_pwd +ac_abs_builddir=$ac_pwd$ac_dir_suffix +# for backward compatibility: +ac_top_builddir=$ac_top_build_prefix case $srcdir in - .) # No --srcdir option. We are building in place. + .) # We are building in place. ac_srcdir=. - if test -z "$ac_top_builddir"; then - ac_top_srcdir=. - else - ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'` - fi ;; - [\\/]* | ?:[\\/]* ) # Absolute path. + ac_top_srcdir=$ac_top_builddir_sub + ac_abs_top_srcdir=$ac_pwd ;; + [\\/]* | ?:[\\/]* ) # Absolute name. ac_srcdir=$srcdir$ac_dir_suffix; - ac_top_srcdir=$srcdir ;; - *) # Relative path. - ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix - ac_top_srcdir=$ac_top_builddir$srcdir ;; -esac - -# Do not use `cd foo && pwd` to compute absolute paths, because -# the directories may not exist. -case `pwd` in -.) ac_abs_builddir="$ac_dir";; -*) - case "$ac_dir" in - .) ac_abs_builddir=`pwd`;; - [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";; - *) ac_abs_builddir=`pwd`/"$ac_dir";; - esac;; -esac -case $ac_abs_builddir in -.) ac_abs_top_builddir=${ac_top_builddir}.;; -*) - case ${ac_top_builddir}. in - .) ac_abs_top_builddir=$ac_abs_builddir;; - [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;; - *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;; - esac;; -esac -case $ac_abs_builddir in -.) ac_abs_srcdir=$ac_srcdir;; -*) - case $ac_srcdir in - .) ac_abs_srcdir=$ac_abs_builddir;; - [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;; - *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;; - esac;; -esac -case $ac_abs_builddir in -.) ac_abs_top_srcdir=$ac_top_srcdir;; -*) - case $ac_top_srcdir in - .) ac_abs_top_srcdir=$ac_abs_builddir;; - [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;; - *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;; - esac;; + ac_top_srcdir=$srcdir + ac_abs_top_srcdir=$srcdir ;; + *) # Relative name. + ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_top_build_prefix$srcdir + ac_abs_top_srcdir=$ac_pwd/$srcdir ;; esac - - cd $ac_dir - # Check for guested configure; otherwise get Cygnus style configure. - if test -f $ac_srcdir/configure.gnu; then - echo - $SHELL $ac_srcdir/configure.gnu --help=recursive - elif test -f $ac_srcdir/configure; then - echo - $SHELL $ac_srcdir/configure --help=recursive - elif test -f $ac_srcdir/configure.ac || - test -f $ac_srcdir/configure.in; then - echo - $ac_configure --help +ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix + + cd "$ac_dir" || { ac_status=$?; continue; } + # Check for guested configure. + if test -f "$ac_srcdir/configure.gnu"; then + echo && + $SHELL "$ac_srcdir/configure.gnu" --help=recursive + elif test -f "$ac_srcdir/configure"; then + echo && + $SHELL "$ac_srcdir/configure" --help=recursive else - echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 - fi - cd "$ac_popdir" + $as_echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 + fi || ac_status=$? + cd "$ac_pwd" || { ac_status=$?; break; } done fi -test -n "$ac_init_help" && exit 0 +test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF bforce configure 0.22.9 -generated by GNU Autoconf 2.59 +generated by GNU Autoconf 2.68 -Copyright (C) 2003 Free Software Foundation, Inc. +Copyright (C) 2010 Free Software Foundation, Inc. This configure script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. _ACEOF - exit 0 + exit fi -exec 5>config.log -cat >&5 <<_ACEOF -This file contains any messages produced by compilers while -running configure, to aid debugging if configure makes a mistake. - -It was created by bforce $as_me 0.22.9, which was -generated by GNU Autoconf 2.59. Invocation command line was - $ $0 $@ +## ------------------------ ## +## Autoconf initialization. ## +## ------------------------ ## -_ACEOF +# ac_fn_c_try_compile LINENO +# -------------------------- +# Try to compile conftest.$ac_ext, and return whether this succeeded. +ac_fn_c_try_compile () { -cat <<_ASUNAME -## --------- ## -## Platform. ## -## --------- ## - -hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` -uname -m = `(uname -m) 2>/dev/null || echo unknown` -uname -r = `(uname -r) 2>/dev/null || echo unknown` -uname -s = `(uname -s) 2>/dev/null || echo unknown` -uname -v = `(uname -v) 2>/dev/null || echo unknown` - -/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` -/bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` - -/bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` -/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` -/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` -hostinfo = `(hostinfo) 2>/dev/null || echo unknown` -/bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` -/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` -/bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + rm -f conftest.$ac_objext + if { { ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_compile") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + grep -v '^ *+' conftest.err >conftest.er1 + cat conftest.er1 >&5 + mv -f conftest.er1 conftest.err + fi + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then : + ac_retval=0 +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 -_ASUNAME + ac_retval=1 +fi + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + as_fn_set_status $ac_retval -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - echo "PATH: $as_dir" -done +} # ac_fn_c_try_compile -} >&5 +# ac_fn_c_try_link LINENO +# ----------------------- +# Try to link conftest.$ac_ext, and return whether this succeeded. +ac_fn_c_try_link () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + rm -f conftest.$ac_objext conftest$ac_exeext + if { { ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_link") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + grep -v '^ *+' conftest.err >conftest.er1 + cat conftest.er1 >&5 + mv -f conftest.er1 conftest.err + fi + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && { + test "$cross_compiling" = yes || + $as_test_x conftest$ac_exeext + }; then : + ac_retval=0 +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 -cat >&5 <<_ACEOF + ac_retval=1 +fi + # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information + # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would + # interfere with the next link command; also delete a directory that is + # left behind by Apple's compiler. We do this before executing the actions. + rm -rf conftest.dSYM conftest_ipa8_conftest.oo + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + as_fn_set_status $ac_retval + +} # ac_fn_c_try_link + +# ac_fn_c_try_cpp LINENO +# ---------------------- +# Try to preprocess conftest.$ac_ext, and return whether this succeeded. +ac_fn_c_try_cpp () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + if { { ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + grep -v '^ *+' conftest.err >conftest.er1 + cat conftest.er1 >&5 + mv -f conftest.er1 conftest.err + fi + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } > conftest.i && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then : + ac_retval=0 +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=1 +fi + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + as_fn_set_status $ac_retval + +} # ac_fn_c_try_cpp + +# ac_fn_c_try_run LINENO +# ---------------------- +# Try to link conftest.$ac_ext, and return whether this succeeded. Assumes +# that executables *can* be run. +ac_fn_c_try_run () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + if { { ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && { ac_try='./conftest$ac_exeext' + { { case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; }; then : + ac_retval=0 +else + $as_echo "$as_me: program exited with status $ac_status" >&5 + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=$ac_status +fi + rm -rf conftest.dSYM conftest_ipa8_conftest.oo + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + as_fn_set_status $ac_retval + +} # ac_fn_c_try_run + +# ac_fn_c_check_header_mongrel LINENO HEADER VAR INCLUDES +# ------------------------------------------------------- +# Tests whether HEADER exists, giving a warning if it cannot be compiled using +# the include files in INCLUDES and setting the cache variable VAR +# accordingly. +ac_fn_c_check_header_mongrel () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + if eval \${$3+:} false; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 +$as_echo_n "checking for $2... " >&6; } +if eval \${$3+:} false; then : + $as_echo_n "(cached) " >&6 +fi +eval ac_res=\$$3 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } +else + # Is the header compilable? +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 usability" >&5 +$as_echo_n "checking $2 usability... " >&6; } +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +#include <$2> +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_header_compiler=yes +else + ac_header_compiler=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_compiler" >&5 +$as_echo "$ac_header_compiler" >&6; } + +# Is the header present? +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 presence" >&5 +$as_echo_n "checking $2 presence... " >&6; } +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include <$2> +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + ac_header_preproc=yes +else + ac_header_preproc=no +fi +rm -f conftest.err conftest.i conftest.$ac_ext +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_preproc" >&5 +$as_echo "$ac_header_preproc" >&6; } + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in #(( + yes:no: ) + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&5 +$as_echo "$as_me: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 +$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} + ;; + no:yes:* ) + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: present but cannot be compiled" >&5 +$as_echo "$as_me: WARNING: $2: present but cannot be compiled" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: check for missing prerequisite headers?" >&5 +$as_echo "$as_me: WARNING: $2: check for missing prerequisite headers?" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: see the Autoconf documentation" >&5 +$as_echo "$as_me: WARNING: $2: see the Autoconf documentation" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&5 +$as_echo "$as_me: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 +$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} +( $as_echo "## --------------------------------------- ## +## Report this to e.kozhuhovskiy@gmail.com ## +## --------------------------------------- ##" + ) | sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 +$as_echo_n "checking for $2... " >&6; } +if eval \${$3+:} false; then : + $as_echo_n "(cached) " >&6 +else + eval "$3=\$ac_header_compiler" +fi +eval ac_res=\$$3 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } +fi + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + +} # ac_fn_c_check_header_mongrel + +# ac_fn_c_check_header_compile LINENO HEADER VAR INCLUDES +# ------------------------------------------------------- +# Tests whether HEADER exists and can be compiled using the include files in +# INCLUDES, setting the cache variable VAR accordingly. +ac_fn_c_check_header_compile () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 +$as_echo_n "checking for $2... " >&6; } +if eval \${$3+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +#include <$2> +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + eval "$3=yes" +else + eval "$3=no" +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +eval ac_res=\$$3 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + +} # ac_fn_c_check_header_compile + +# ac_fn_c_check_type LINENO TYPE VAR INCLUDES +# ------------------------------------------- +# Tests whether TYPE exists after having included INCLUDES, setting cache +# variable VAR accordingly. +ac_fn_c_check_type () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 +$as_echo_n "checking for $2... " >&6; } +if eval \${$3+:} false; then : + $as_echo_n "(cached) " >&6 +else + eval "$3=no" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +int +main () +{ +if (sizeof ($2)) + return 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +int +main () +{ +if (sizeof (($2))) + return 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + +else + eval "$3=yes" +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +eval ac_res=\$$3 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + +} # ac_fn_c_check_type + +# ac_fn_c_check_func LINENO FUNC VAR +# ---------------------------------- +# Tests whether FUNC exists, setting the cache variable VAR accordingly +ac_fn_c_check_func () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 +$as_echo_n "checking for $2... " >&6; } +if eval \${$3+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +/* Define $2 to an innocuous variant, in case declares $2. + For example, HP-UX 11i declares gettimeofday. */ +#define $2 innocuous_$2 + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $2 (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#endif + +#undef $2 + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char $2 (); +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined __stub_$2 || defined __stub___$2 +choke me +#endif + +int +main () +{ +return $2 (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + eval "$3=yes" +else + eval "$3=no" +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +eval ac_res=\$$3 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + +} # ac_fn_c_check_func +cat >config.log <<_ACEOF +This file contains any messages produced by compilers while +running configure, to aid debugging if configure makes a mistake. + +It was created by bforce $as_me 0.22.9, which was +generated by GNU Autoconf 2.68. Invocation command line was + + $ $0 $@ + +_ACEOF +exec 5>>config.log +{ +cat <<_ASUNAME +## --------- ## +## Platform. ## +## --------- ## + +hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` +uname -m = `(uname -m) 2>/dev/null || echo unknown` +uname -r = `(uname -r) 2>/dev/null || echo unknown` +uname -s = `(uname -s) 2>/dev/null || echo unknown` +uname -v = `(uname -v) 2>/dev/null || echo unknown` + +/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` +/bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` + +/bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` +/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` +/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` +/usr/bin/hostinfo = `(/usr/bin/hostinfo) 2>/dev/null || echo unknown` +/bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` +/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` +/bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` + +_ASUNAME + +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + $as_echo "PATH: $as_dir" + done +IFS=$as_save_IFS + +} >&5 + +cat >&5 <<_ACEOF ## ----------- ## @@ -1047,7 +1901,6 @@ _ACEOF ac_configure_args= ac_configure_args0= ac_configure_args1= -ac_sep= ac_must_keep_next=false for ac_pass in 1 2 do @@ -1058,13 +1911,13 @@ do -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) continue ;; - *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*) - ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; + *\'*) + ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; esac case $ac_pass in - 1) ac_configure_args0="$ac_configure_args0 '$ac_arg'" ;; + 1) as_fn_append ac_configure_args0 " '$ac_arg'" ;; 2) - ac_configure_args1="$ac_configure_args1 '$ac_arg'" + as_fn_append ac_configure_args1 " '$ac_arg'" if test $ac_must_keep_next = true; then ac_must_keep_next=false # Got value, back to normal. else @@ -1080,104 +1933,115 @@ do -* ) ac_must_keep_next=true ;; esac fi - ac_configure_args="$ac_configure_args$ac_sep'$ac_arg'" - # Get rid of the leading space. - ac_sep=" " + as_fn_append ac_configure_args " '$ac_arg'" ;; esac done done -$as_unset ac_configure_args0 || test "${ac_configure_args0+set}" != set || { ac_configure_args0=; export ac_configure_args0; } -$as_unset ac_configure_args1 || test "${ac_configure_args1+set}" != set || { ac_configure_args1=; export ac_configure_args1; } +{ ac_configure_args0=; unset ac_configure_args0;} +{ ac_configure_args1=; unset ac_configure_args1;} # When interrupted or exit'd, cleanup temporary files, and complete # config.log. We remove comments because anyway the quotes in there # would cause problems or look ugly. -# WARNING: Be sure not to use single quotes in there, as some shells, -# such as our DU 5.0 friend, will then `close' the trap. +# WARNING: Use '\'' to represent an apostrophe within the trap. +# WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug. trap 'exit_status=$? # Save into config.log some information that might help in debugging. { echo - cat <<\_ASBOX -## ---------------- ## + $as_echo "## ---------------- ## ## Cache variables. ## -## ---------------- ## -_ASBOX +## ---------------- ##" echo # The following way of writing the cache mishandles newlines in values, -{ +( + for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do + eval ac_val=\$$ac_var + case $ac_val in #( + *${as_nl}*) + case $ac_var in #( + *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 +$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; + esac + case $ac_var in #( + _ | IFS | as_nl) ;; #( + BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( + *) { eval $ac_var=; unset $ac_var;} ;; + esac ;; + esac + done (set) 2>&1 | - case `(ac_space='"'"' '"'"'; set | grep ac_space) 2>&1` in - *ac_space=\ *) + case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #( + *${as_nl}ac_space=\ *) sed -n \ - "s/'"'"'/'"'"'\\\\'"'"''"'"'/g; - s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='"'"'\\2'"'"'/p" - ;; + "s/'\''/'\''\\\\'\'''\''/g; + s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p" + ;; #( *) - sed -n \ - "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" + sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" ;; - esac; -} + esac | + sort +) echo - cat <<\_ASBOX -## ----------------- ## + $as_echo "## ----------------- ## ## Output variables. ## -## ----------------- ## -_ASBOX +## ----------------- ##" echo for ac_var in $ac_subst_vars do - eval ac_val=$`echo $ac_var` - echo "$ac_var='"'"'$ac_val'"'"'" + eval ac_val=\$$ac_var + case $ac_val in + *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; + esac + $as_echo "$ac_var='\''$ac_val'\''" done | sort echo if test -n "$ac_subst_files"; then - cat <<\_ASBOX -## ------------- ## -## Output files. ## -## ------------- ## -_ASBOX + $as_echo "## ------------------- ## +## File substitutions. ## +## ------------------- ##" echo for ac_var in $ac_subst_files do - eval ac_val=$`echo $ac_var` - echo "$ac_var='"'"'$ac_val'"'"'" + eval ac_val=\$$ac_var + case $ac_val in + *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; + esac + $as_echo "$ac_var='\''$ac_val'\''" done | sort echo fi if test -s confdefs.h; then - cat <<\_ASBOX -## ----------- ## + $as_echo "## ----------- ## ## confdefs.h. ## -## ----------- ## -_ASBOX +## ----------- ##" echo - sed "/^$/d" confdefs.h | sort + cat confdefs.h echo fi test "$ac_signal" != 0 && - echo "$as_me: caught signal $ac_signal" - echo "$as_me: exit $exit_status" + $as_echo "$as_me: caught signal $ac_signal" + $as_echo "$as_me: exit $exit_status" } >&5 - rm -f core *.core && - rm -rf conftest* confdefs* conf$$* $ac_clean_files && + rm -f core *.core core.conftest.* && + rm -f -r conftest* confdefs* conf$$* $ac_clean_files && exit $exit_status - ' 0 +' 0 for ac_signal in 1 2 13 15; do - trap 'ac_signal='$ac_signal'; { (exit 1); exit 1; }' $ac_signal + trap 'ac_signal='$ac_signal'; as_fn_exit 1' $ac_signal done ac_signal=0 # confdefs.h avoids OS command line length limits that DEFS can exceed. -rm -rf conftest* confdefs.h -# AIX cpp loses on an empty file, so make sure it contains at least a newline. -echo >confdefs.h +rm -f -r conftest* confdefs.h + +$as_echo "/* confdefs.h */" > confdefs.h # Predefined preprocessor variables. @@ -1185,112 +2049,137 @@ cat >>confdefs.h <<_ACEOF #define PACKAGE_NAME "$PACKAGE_NAME" _ACEOF - cat >>confdefs.h <<_ACEOF #define PACKAGE_TARNAME "$PACKAGE_TARNAME" _ACEOF - cat >>confdefs.h <<_ACEOF #define PACKAGE_VERSION "$PACKAGE_VERSION" _ACEOF - cat >>confdefs.h <<_ACEOF #define PACKAGE_STRING "$PACKAGE_STRING" _ACEOF - cat >>confdefs.h <<_ACEOF #define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" _ACEOF +cat >>confdefs.h <<_ACEOF +#define PACKAGE_URL "$PACKAGE_URL" +_ACEOF + # Let the site file select an alternate cache file if it wants to. -# Prefer explicitly selected file to automatically selected ones. -if test -z "$CONFIG_SITE"; then - if test "x$prefix" != xNONE; then - CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site" - else - CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" - fi +# Prefer an explicitly selected file to automatically selected ones. +ac_site_file1=NONE +ac_site_file2=NONE +if test -n "$CONFIG_SITE"; then + # We do not want a PATH search for config.site. + case $CONFIG_SITE in #(( + -*) ac_site_file1=./$CONFIG_SITE;; + */*) ac_site_file1=$CONFIG_SITE;; + *) ac_site_file1=./$CONFIG_SITE;; + esac +elif test "x$prefix" != xNONE; then + ac_site_file1=$prefix/share/config.site + ac_site_file2=$prefix/etc/config.site +else + ac_site_file1=$ac_default_prefix/share/config.site + ac_site_file2=$ac_default_prefix/etc/config.site fi -for ac_site_file in $CONFIG_SITE; do - if test -r "$ac_site_file"; then - { echo "$as_me:$LINENO: loading site script $ac_site_file" >&5 -echo "$as_me: loading site script $ac_site_file" >&6;} +for ac_site_file in "$ac_site_file1" "$ac_site_file2" +do + test "x$ac_site_file" = xNONE && continue + if test /dev/null != "$ac_site_file" && test -r "$ac_site_file"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5 +$as_echo "$as_me: loading site script $ac_site_file" >&6;} sed 's/^/| /' "$ac_site_file" >&5 - . "$ac_site_file" + . "$ac_site_file" \ + || { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "failed to load site script $ac_site_file +See \`config.log' for more details" "$LINENO" 5; } fi done if test -r "$cache_file"; then - # Some versions of bash will fail to source /dev/null (special - # files actually), so we avoid doing that. - if test -f "$cache_file"; then - { echo "$as_me:$LINENO: loading cache $cache_file" >&5 -echo "$as_me: loading cache $cache_file" >&6;} + # Some versions of bash will fail to source /dev/null (special files + # actually), so we avoid doing that. DJGPP emulates it as a regular file. + if test /dev/null != "$cache_file" && test -f "$cache_file"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5 +$as_echo "$as_me: loading cache $cache_file" >&6;} case $cache_file in - [\\/]* | ?:[\\/]* ) . $cache_file;; - *) . ./$cache_file;; + [\\/]* | ?:[\\/]* ) . "$cache_file";; + *) . "./$cache_file";; esac fi else - { echo "$as_me:$LINENO: creating cache $cache_file" >&5 -echo "$as_me: creating cache $cache_file" >&6;} + { $as_echo "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5 +$as_echo "$as_me: creating cache $cache_file" >&6;} >$cache_file fi # Check that the precious variables saved in the cache have kept the same # value. ac_cache_corrupted=false -for ac_var in `(set) 2>&1 | - sed -n 's/^ac_env_\([a-zA-Z_0-9]*\)_set=.*/\1/p'`; do +for ac_var in $ac_precious_vars; do eval ac_old_set=\$ac_cv_env_${ac_var}_set eval ac_new_set=\$ac_env_${ac_var}_set - eval ac_old_val="\$ac_cv_env_${ac_var}_value" - eval ac_new_val="\$ac_env_${ac_var}_value" + eval ac_old_val=\$ac_cv_env_${ac_var}_value + eval ac_new_val=\$ac_env_${ac_var}_value case $ac_old_set,$ac_new_set in set,) - { echo "$as_me:$LINENO: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 -echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 +$as_echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} ac_cache_corrupted=: ;; ,set) - { echo "$as_me:$LINENO: error: \`$ac_var' was not set in the previous run" >&5 -echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was not set in the previous run" >&5 +$as_echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} ac_cache_corrupted=: ;; ,);; *) if test "x$ac_old_val" != "x$ac_new_val"; then - { echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5 -echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} - { echo "$as_me:$LINENO: former value: $ac_old_val" >&5 -echo "$as_me: former value: $ac_old_val" >&2;} - { echo "$as_me:$LINENO: current value: $ac_new_val" >&5 -echo "$as_me: current value: $ac_new_val" >&2;} - ac_cache_corrupted=: + # differences in whitespace do not lead to failure. + ac_old_val_w=`echo x $ac_old_val` + ac_new_val_w=`echo x $ac_new_val` + if test "$ac_old_val_w" != "$ac_new_val_w"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' has changed since the previous run:" >&5 +$as_echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} + ac_cache_corrupted=: + else + { $as_echo "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5 +$as_echo "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;} + eval $ac_var=\$ac_old_val + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: former value: \`$ac_old_val'" >&5 +$as_echo "$as_me: former value: \`$ac_old_val'" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: current value: \`$ac_new_val'" >&5 +$as_echo "$as_me: current value: \`$ac_new_val'" >&2;} fi;; esac # Pass precious variables to config.status. if test "$ac_new_set" = set; then case $ac_new_val in - *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*) - ac_arg=$ac_var=`echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; + *\'*) ac_arg=$ac_var=`$as_echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; *) ac_arg=$ac_var=$ac_new_val ;; esac case " $ac_configure_args " in *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. - *) ac_configure_args="$ac_configure_args '$ac_arg'" ;; + *) as_fn_append ac_configure_args " '$ac_arg'" ;; esac fi done if $ac_cache_corrupted; then - { echo "$as_me:$LINENO: error: changes in the environment can compromise the build" >&5 -echo "$as_me: error: changes in the environment can compromise the build" >&2;} - { { echo "$as_me:$LINENO: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5 -echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&2;} - { (exit 1); exit 1; }; } + { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5 +$as_echo "$as_me: error: changes in the environment can compromise the build" >&2;} + as_fn_error $? "run \`make distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5 fi +## -------------------- ## +## Main body of script. ## +## -------------------- ## ac_ext=c ac_cpp='$CPP $CPPFLAGS' @@ -1299,132 +2188,139 @@ ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $ ac_compiler_gnu=$ac_cv_c_compiler_gnu - - - - - - - - - - - - - - - - - - - - - - - - - - ac_config_headers="$ac_config_headers include/config.h" +ac_config_headers="$ac_config_headers include/config.h" ac_aux_dir= -for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do - if test -f $ac_dir/install-sh; then +for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do + if test -f "$ac_dir/install-sh"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install-sh -c" break - elif test -f $ac_dir/install.sh; then + elif test -f "$ac_dir/install.sh"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install.sh -c" break - elif test -f $ac_dir/shtool; then + elif test -f "$ac_dir/shtool"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/shtool install -c" break fi done if test -z "$ac_aux_dir"; then - { { echo "$as_me:$LINENO: error: cannot find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." >&5 -echo "$as_me: error: cannot find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." >&2;} - { (exit 1); exit 1; }; } + as_fn_error $? "cannot find install-sh, install.sh, or shtool in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" "$LINENO" 5 fi -ac_config_guess="$SHELL $ac_aux_dir/config.guess" -ac_config_sub="$SHELL $ac_aux_dir/config.sub" -ac_configure="$SHELL $ac_aux_dir/configure" # This should be Cygnus configure. + +# These three variables are undocumented and unsupported, +# and are intended to be withdrawn in a future Autoconf release. +# They can cause serious problems if a builder's source tree is in a directory +# whose full name contains unusual characters. +ac_config_guess="$SHELL $ac_aux_dir/config.guess" # Please don't use this var. +ac_config_sub="$SHELL $ac_aux_dir/config.sub" # Please don't use this var. +ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var. + # Make sure we can run config.sub. -$ac_config_sub sun4 >/dev/null 2>&1 || - { { echo "$as_me:$LINENO: error: cannot run $ac_config_sub" >&5 -echo "$as_me: error: cannot run $ac_config_sub" >&2;} - { (exit 1); exit 1; }; } - -echo "$as_me:$LINENO: checking build system type" >&5 -echo $ECHO_N "checking build system type... $ECHO_C" >&6 -if test "${ac_cv_build+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_cv_build_alias=$build_alias -test -z "$ac_cv_build_alias" && - ac_cv_build_alias=`$ac_config_guess` -test -z "$ac_cv_build_alias" && - { { echo "$as_me:$LINENO: error: cannot guess build type; you must specify one" >&5 -echo "$as_me: error: cannot guess build type; you must specify one" >&2;} - { (exit 1); exit 1; }; } -ac_cv_build=`$ac_config_sub $ac_cv_build_alias` || - { { echo "$as_me:$LINENO: error: $ac_config_sub $ac_cv_build_alias failed" >&5 -echo "$as_me: error: $ac_config_sub $ac_cv_build_alias failed" >&2;} - { (exit 1); exit 1; }; } - -fi -echo "$as_me:$LINENO: result: $ac_cv_build" >&5 -echo "${ECHO_T}$ac_cv_build" >&6 +$SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 || + as_fn_error $? "cannot run $SHELL $ac_aux_dir/config.sub" "$LINENO" 5 + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking build system type" >&5 +$as_echo_n "checking build system type... " >&6; } +if ${ac_cv_build+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_build_alias=$build_alias +test "x$ac_build_alias" = x && + ac_build_alias=`$SHELL "$ac_aux_dir/config.guess"` +test "x$ac_build_alias" = x && + as_fn_error $? "cannot guess build type; you must specify one" "$LINENO" 5 +ac_cv_build=`$SHELL "$ac_aux_dir/config.sub" $ac_build_alias` || + as_fn_error $? "$SHELL $ac_aux_dir/config.sub $ac_build_alias failed" "$LINENO" 5 + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_build" >&5 +$as_echo "$ac_cv_build" >&6; } +case $ac_cv_build in +*-*-*) ;; +*) as_fn_error $? "invalid value of canonical build" "$LINENO" 5;; +esac build=$ac_cv_build -build_cpu=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` -build_vendor=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` -build_os=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` +ac_save_IFS=$IFS; IFS='-' +set x $ac_cv_build +shift +build_cpu=$1 +build_vendor=$2 +shift; shift +# Remember, the first character of IFS is used to create $*, +# except with old shells: +build_os=$* +IFS=$ac_save_IFS +case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac -echo "$as_me:$LINENO: checking host system type" >&5 -echo $ECHO_N "checking host system type... $ECHO_C" >&6 -if test "${ac_cv_host+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking host system type" >&5 +$as_echo_n "checking host system type... " >&6; } +if ${ac_cv_host+:} false; then : + $as_echo_n "(cached) " >&6 else - ac_cv_host_alias=$host_alias -test -z "$ac_cv_host_alias" && - ac_cv_host_alias=$ac_cv_build_alias -ac_cv_host=`$ac_config_sub $ac_cv_host_alias` || - { { echo "$as_me:$LINENO: error: $ac_config_sub $ac_cv_host_alias failed" >&5 -echo "$as_me: error: $ac_config_sub $ac_cv_host_alias failed" >&2;} - { (exit 1); exit 1; }; } + if test "x$host_alias" = x; then + ac_cv_host=$ac_cv_build +else + ac_cv_host=`$SHELL "$ac_aux_dir/config.sub" $host_alias` || + as_fn_error $? "$SHELL $ac_aux_dir/config.sub $host_alias failed" "$LINENO" 5 +fi fi -echo "$as_me:$LINENO: result: $ac_cv_host" >&5 -echo "${ECHO_T}$ac_cv_host" >&6 +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_host" >&5 +$as_echo "$ac_cv_host" >&6; } +case $ac_cv_host in +*-*-*) ;; +*) as_fn_error $? "invalid value of canonical host" "$LINENO" 5;; +esac host=$ac_cv_host -host_cpu=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` -host_vendor=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` -host_os=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` +ac_save_IFS=$IFS; IFS='-' +set x $ac_cv_host +shift +host_cpu=$1 +host_vendor=$2 +shift; shift +# Remember, the first character of IFS is used to create $*, +# except with old shells: +host_os=$* +IFS=$ac_save_IFS +case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac -echo "$as_me:$LINENO: checking target system type" >&5 -echo $ECHO_N "checking target system type... $ECHO_C" >&6 -if test "${ac_cv_target+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking target system type" >&5 +$as_echo_n "checking target system type... " >&6; } +if ${ac_cv_target+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test "x$target_alias" = x; then + ac_cv_target=$ac_cv_host else - ac_cv_target_alias=$target_alias -test "x$ac_cv_target_alias" = "x" && - ac_cv_target_alias=$ac_cv_host_alias -ac_cv_target=`$ac_config_sub $ac_cv_target_alias` || - { { echo "$as_me:$LINENO: error: $ac_config_sub $ac_cv_target_alias failed" >&5 -echo "$as_me: error: $ac_config_sub $ac_cv_target_alias failed" >&2;} - { (exit 1); exit 1; }; } + ac_cv_target=`$SHELL "$ac_aux_dir/config.sub" $target_alias` || + as_fn_error $? "$SHELL $ac_aux_dir/config.sub $target_alias failed" "$LINENO" 5 +fi fi -echo "$as_me:$LINENO: result: $ac_cv_target" >&5 -echo "${ECHO_T}$ac_cv_target" >&6 +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_target" >&5 +$as_echo "$ac_cv_target" >&6; } +case $ac_cv_target in +*-*-*) ;; +*) as_fn_error $? "invalid value of canonical target" "$LINENO" 5;; +esac target=$ac_cv_target -target_cpu=`echo $ac_cv_target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` -target_vendor=`echo $ac_cv_target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` -target_os=`echo $ac_cv_target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` +ac_save_IFS=$IFS; IFS='-' +set x $ac_cv_target +shift +target_cpu=$1 +target_vendor=$2 +shift; shift +# Remember, the first character of IFS is used to create $*, +# except with old shells: +target_os=$* +IFS=$ac_save_IFS +case $target_os in *\ *) target_os=`echo "$target_os" | sed 's/ /-/g'`;; esac # The aliases save the names the user supplied, while $host etc. @@ -1435,6 +2331,7 @@ test -n "$target_alias" && program_prefix=${target_alias}- + ############### # Setup version ############### @@ -1445,9 +2342,7 @@ if test -f $srcdir/.version ; then _ACEOF else - cat >>confdefs.h <<\_ACEOF -#define RELEASE_VERSION "?.?" -_ACEOF + $as_echo "#define RELEASE_VERSION \"?.?\"" >>confdefs.h fi @@ -1460,179 +2355,164 @@ SPOOLDIR=/var/spool/bforce LOGDIR=/var/log/bforce -# Check whether --with-owner or --without-owner was given. -if test "${with_owner+set}" = set; then - withval="$with_owner" - OWNER=$with_owner +# Check whether --with-owner was given. +if test "${with_owner+set}" = set; then : + withval=$with_owner; OWNER=$with_owner -fi; +fi -# Check whether --with-group or --without-group was given. -if test "${with_group+set}" = set; then - withval="$with_group" - GROUP=$with_group -fi; +# Check whether --with-group was given. +if test "${with_group+set}" = set; then : + withval=$with_group; GROUP=$with_group +fi -# Check whether --with-spooldir or --without-spooldir was given. -if test "${with_spooldir+set}" = set; then - withval="$with_spooldir" - SPOOLDIR=$with_spooldir -fi; +# Check whether --with-spooldir was given. +if test "${with_spooldir+set}" = set; then : + withval=$with_spooldir; SPOOLDIR=$with_spooldir +fi -# Check whether --with-logdir or --without-logdir was given. -if test "${with_logdir+set}" = set; then - withval="$with_logdir" - LOGDIR=$with_logdir -fi; -# Check whether --enable-debug or --disable-debug was given. -if test "${enable_debug+set}" = set; then - enableval="$enable_debug" - if test $enableval = yes; then +# Check whether --with-logdir was given. +if test "${with_logdir+set}" = set; then : + withval=$with_logdir; LOGDIR=$with_logdir -cat >>confdefs.h <<\_ACEOF -#define DEBUG 1 -_ACEOF +fi + + + +# Check whether --enable-debug was given. +if test "${enable_debug+set}" = set; then : + enableval=$enable_debug; if test $enableval = yes; then + +$as_echo "#define DEBUG 1" >>confdefs.h fi else -cat >>confdefs.h <<\_ACEOF -#define DEBUG 1 -_ACEOF +$as_echo "#define DEBUG 1" >>confdefs.h -fi; +fi -# Check whether --enable-dcd-control or --disable-dcd-control was given. -if test "${enable_dcd_control+set}" = set; then - enableval="$enable_dcd_control" - if test $enableval = yes; then -cat >>confdefs.h <<\_ACEOF -#define MODEM_WATCH_CARRIER 1 -_ACEOF +# Check whether --enable-dcd-control was given. +if test "${enable_dcd_control+set}" = set; then : + enableval=$enable_dcd_control; if test $enableval = yes; then + +$as_echo "#define MODEM_WATCH_CARRIER 1" >>confdefs.h fi else -cat >>confdefs.h <<\_ACEOF -#define MODEM_WATCH_CARRIER 1 -_ACEOF +$as_echo "#define MODEM_WATCH_CARRIER 1" >>confdefs.h -fi; +fi -# Check whether --enable-hangup-watch-cd or --disable-hangup-watch-cd was given. -if test "${enable_hangup_watch_cd+set}" = set; then - enableval="$enable_hangup_watch_cd" - if test $enableval = yes; then -cat >>confdefs.h <<\_ACEOF -#define MODEM_HANGUP_WATCH_CARRIER 1 -_ACEOF +# Check whether --enable-hangup-watch-cd was given. +if test "${enable_hangup_watch_cd+set}" = set; then : + enableval=$enable_hangup_watch_cd; if test $enableval = yes; then + +$as_echo "#define MODEM_HANGUP_WATCH_CARRIER 1" >>confdefs.h fi else -cat >>confdefs.h <<\_ACEOF -#define MODEM_HANGUP_WATCH_CARRIER 1 -_ACEOF +$as_echo "#define MODEM_HANGUP_WATCH_CARRIER 1" >>confdefs.h -fi; +fi -# Check whether --enable-log-passwd or --disable-log-passwd was given. -if test "${enable_log_passwd+set}" = set; then - enableval="$enable_log_passwd" - if test $enableval = yes; then -cat >>confdefs.h <<\_ACEOF -#define BFORCE_LOG_PASSWD 1 -_ACEOF +# Check whether --enable-log-passwd was given. +if test "${enable_log_passwd+set}" = set; then : + enableval=$enable_log_passwd; if test $enableval = yes; then + +$as_echo "#define BFORCE_LOG_PASSWD 1" >>confdefs.h fi else -cat >>confdefs.h <<\_ACEOF -#define BFORCE_LOG_PASSWD 1 -_ACEOF +$as_echo "#define BFORCE_LOG_PASSWD 1" >>confdefs.h -fi; +fi -# Check whether --enable-csy-locks or --disable-csy-locks was given. -if test "${enable_csy_locks+set}" = set; then - enableval="$enable_csy_locks" - if test $enableval = yes; then -cat >>confdefs.h <<\_ACEOF -#define BFORCE_USE_CSY 1 -_ACEOF +# Check whether --enable-csy-locks was given. +if test "${enable_csy_locks+set}" = set; then : + enableval=$enable_csy_locks; if test $enableval = yes; then + +$as_echo "#define BFORCE_USE_CSY 1" >>confdefs.h fi else -cat >>confdefs.h <<\_ACEOF -#define BFORCE_USE_CSY 1 -_ACEOF +$as_echo "#define BFORCE_USE_CSY 1" >>confdefs.h -fi; +fi -# Check whether --enable-syslog or --disable-syslog was given. -if test "${enable_syslog+set}" = set; then - enableval="$enable_syslog" - if test $enableval = yes; then -cat >>confdefs.h <<\_ACEOF -#define USE_SYSLOG 1 -_ACEOF +# Check whether --enable-syslog was given. +if test "${enable_syslog+set}" = set; then : + enableval=$enable_syslog; if test $enableval = yes; then + +$as_echo "#define USE_SYSLOG 1" >>confdefs.h fi else -cat >>confdefs.h <<\_ACEOF -#define USE_SYSLOG 1 -_ACEOF +$as_echo "#define USE_SYSLOG 1" >>confdefs.h -fi; +fi -# Check whether --enable-buggy_emsi or --disable-buggy_emsi was given. -if test "${enable_buggy_emsi+set}" = set; then - enableval="$enable_buggy_emsi" - if test $enableval = yes; then -cat >>confdefs.h <<\_ACEOF -#define BUGGY_EMSI 1 -_ACEOF +# Check whether --enable-netspool was given. +if test "${enable_netspool+set}" = set; then : + enableval=$enable_netspool; if test $enableval = yes; then + +$as_echo "#define NETSPOOL 1" >>confdefs.h fi else -cat >>confdefs.h <<\_ACEOF -#define BUGGY_EMSI 0 -_ACEOF +$as_echo "#define NETSPOOL 1" >>confdefs.h -fi; +fi -# Check whether --with-uucp-lockdir or --without-uucp-lockdir was given. -if test "${with_uucp_lockdir+set}" = set; then - withval="$with_uucp_lockdir" - cat >>confdefs.h <<_ACEOF +# Check whether --enable-buggy_emsi was given. +if test "${enable_buggy_emsi+set}" = set; then : + enableval=$enable_buggy_emsi; if test $enableval = yes; then + +$as_echo "#define BUGGY_EMSI 1" >>confdefs.h + + fi +else + +$as_echo "#define BUGGY_EMSI 0" >>confdefs.h + +fi + + + +# Check whether --with-uucp-lockdir was given. +if test "${with_uucp_lockdir+set}" = set; then : + withval=$with_uucp_lockdir; cat >>confdefs.h <<_ACEOF #define BFORCE_LOCK_DIR "$withval" _ACEOF else - echo "$as_me:$LINENO: checking \"UUCP lock files directory\"" >&5 -echo $ECHO_N "checking \"UUCP lock files directory\"... $ECHO_C" >&6 + { $as_echo "$as_me:${as_lineno-$LINENO}: checking \"UUCP lock files directory\"" >&5 +$as_echo_n "checking \"UUCP lock files directory\"... " >&6; } if test -d /var/lock/serial ; then lockdir=/var/lock/serial/ elif test -d /var/spool/lock ; then @@ -1645,10 +2525,11 @@ cat >>confdefs.h <<_ACEOF #define BFORCE_LOCK_DIR "$lockdir" _ACEOF - echo "$as_me:$LINENO: result: $lockdir" >&5 -echo "${ECHO_T}$lockdir" >&6 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lockdir" >&5 +$as_echo "$lockdir" >&6; } + +fi -fi; @@ -1657,10 +2538,10 @@ for ac_prog in 'bison -y' byacc do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_YACC+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_YACC+:} false; then : + $as_echo_n "(cached) " >&6 else if test -n "$YACC"; then ac_cv_prog_YACC="$YACC" # Let the user override the test. @@ -1670,26 +2551,28 @@ for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_YACC="$ac_prog" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done -done + done +IFS=$as_save_IFS fi fi YACC=$ac_cv_prog_YACC if test -n "$YACC"; then - echo "$as_me:$LINENO: result: $YACC" >&5 -echo "${ECHO_T}$YACC" >&6 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $YACC" >&5 +$as_echo "$YACC" >&6; } else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } fi + test -n "$YACC" && break done test -n "$YACC" || YACC="yacc" @@ -1702,10 +2585,10 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. set dummy ${ac_tool_prefix}gcc; ac_word=$2 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_CC+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_CC+:} false; then : + $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. @@ -1715,35 +2598,37 @@ for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CC="${ac_tool_prefix}gcc" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done -done + done +IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then - echo "$as_me:$LINENO: result: $CC" >&5 -echo "${ECHO_T}$CC" >&6 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +$as_echo "$CC" >&6; } else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } fi + fi if test -z "$ac_cv_prog_CC"; then ac_ct_CC=$CC # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_ac_ct_CC+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_CC+:} false; then : + $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. @@ -1753,39 +2638,50 @@ for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_CC="gcc" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done -done + done +IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then - echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 -echo "${ECHO_T}$ac_ct_CC" >&6 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 +$as_echo "$ac_ct_CC" >&6; } else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } fi - CC=$ac_ct_CC + if test "x$ac_ct_CC" = x; then + CC="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + CC=$ac_ct_CC + fi else CC="$ac_cv_prog_CC" fi if test -z "$CC"; then - if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. set dummy ${ac_tool_prefix}cc; ac_word=$2 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_CC+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_CC+:} false; then : + $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. @@ -1795,77 +2691,37 @@ for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CC="${ac_tool_prefix}cc" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done -done + done +IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then - echo "$as_me:$LINENO: result: $CC" >&5 -echo "${ECHO_T}$CC" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - -fi -if test -z "$ac_cv_prog_CC"; then - ac_ct_CC=$CC - # Extract the first word of "cc", so it can be a program name with args. -set dummy cc; ac_word=$2 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_ac_ct_CC+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$ac_ct_CC"; then - ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_CC="cc" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done - -fi -fi -ac_ct_CC=$ac_cv_prog_ac_ct_CC -if test -n "$ac_ct_CC"; then - echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 -echo "${ECHO_T}$ac_ct_CC" >&6 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +$as_echo "$CC" >&6; } else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } fi - CC=$ac_ct_CC -else - CC="$ac_cv_prog_CC" -fi + fi fi if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_CC+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_CC+:} false; then : + $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. @@ -1876,18 +2732,19 @@ for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then ac_prog_rejected=yes continue fi ac_cv_prog_CC="cc" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done -done + done +IFS=$as_save_IFS if test $ac_prog_rejected = yes; then # We found a bogon in the path, so make sure we never use it. @@ -1905,24 +2762,25 @@ fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then - echo "$as_me:$LINENO: result: $CC" >&5 -echo "${ECHO_T}$CC" >&6 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +$as_echo "$CC" >&6; } else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } fi + fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then - for ac_prog in cl + for ac_prog in cl.exe do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_CC+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_CC+:} false; then : + $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. @@ -1932,39 +2790,41 @@ for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CC="$ac_tool_prefix$ac_prog" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done -done + done +IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then - echo "$as_me:$LINENO: result: $CC" >&5 -echo "${ECHO_T}$CC" >&6 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +$as_echo "$CC" >&6; } else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } fi + test -n "$CC" && break done fi if test -z "$CC"; then ac_ct_CC=$CC - for ac_prog in cl + for ac_prog in cl.exe do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_ac_ct_CC+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_CC+:} false; then : + $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. @@ -1974,66 +2834,78 @@ for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_CC="$ac_prog" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done -done + done +IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then - echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 -echo "${ECHO_T}$ac_ct_CC" >&6 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 +$as_echo "$ac_ct_CC" >&6; } else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } fi + test -n "$ac_ct_CC" && break done - CC=$ac_ct_CC + if test "x$ac_ct_CC" = x; then + CC="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + CC=$ac_ct_CC + fi fi fi -test -z "$CC" && { { echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH -See \`config.log' for more details." >&5 -echo "$as_me: error: no acceptable C compiler found in \$PATH -See \`config.log' for more details." >&2;} - { (exit 1); exit 1; }; } +test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "no acceptable C compiler found in \$PATH +See \`config.log' for more details" "$LINENO" 5; } # Provide some information about the compiler. -echo "$as_me:$LINENO:" \ - "checking for C compiler version" >&5 -ac_compiler=`set X $ac_compile; echo $2` -{ (eval echo "$as_me:$LINENO: \"$ac_compiler --version &5\"") >&5 - (eval $ac_compiler --version &5) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } -{ (eval echo "$as_me:$LINENO: \"$ac_compiler -v &5\"") >&5 - (eval $ac_compiler -v &5) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } -{ (eval echo "$as_me:$LINENO: \"$ac_compiler -V &5\"") >&5 - (eval $ac_compiler -V &5) 2>&5 +$as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 +set X $ac_compile +ac_compiler=$2 +for ac_option in --version -v -V -qversion; do + { { ac_try="$ac_compiler $ac_option >&5" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_compiler $ac_option >&5") 2>conftest.err ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } + if test -s conftest.err; then + sed '10a\ +... rest of stderr output deleted ... + 10q' conftest.err >conftest.er1 + cat conftest.er1 >&5 + fi + rm -f conftest.er1 conftest.err + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } +done -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF +cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int @@ -2045,112 +2917,108 @@ main () } _ACEOF ac_clean_files_save=$ac_clean_files -ac_clean_files="$ac_clean_files a.out a.exe b.out" +ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out" # Try to create an executable without -o first, disregard a.out. # It will help us diagnose broken compilers, and finding out an intuition # of exeext. -echo "$as_me:$LINENO: checking for C compiler default output file name" >&5 -echo $ECHO_N "checking for C compiler default output file name... $ECHO_C" >&6 -ac_link_default=`echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` -if { (eval echo "$as_me:$LINENO: \"$ac_link_default\"") >&5 - (eval $ac_link_default) 2>&5 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5 +$as_echo_n "checking whether the C compiler works... " >&6; } +ac_link_default=`$as_echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` + +# The possible output files: +ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*" + +ac_rmfiles= +for ac_file in $ac_files +do + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; + * ) ac_rmfiles="$ac_rmfiles $ac_file";; + esac +done +rm -f $ac_rmfiles + +if { { ac_try="$ac_link_default" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_link_default") 2>&5 ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; then - # Find the output, starting from the most likely. This scheme is -# not robust to junk in `.', hence go to wildcards (a.*) only as a last -# resort. - -# Be careful to initialize this variable, since it used to be cached. -# Otherwise an old cache value of `no' led to `EXEEXT = no' in a Makefile. -ac_cv_exeext= -# b.out is created by i960 compilers. -for ac_file in a_out.exe a.exe conftest.exe a.out conftest a.* conftest.* b.out + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then : + # Autoconf-2.13 could set the ac_cv_exeext variable to `no'. +# So ignore a value of `no', otherwise this would lead to `EXEEXT = no' +# in a Makefile. We should not override ac_cv_exeext if it was cached, +# so that the user can short-circuit this test for compilers unknown to +# Autoconf. +for ac_file in $ac_files '' do test -f "$ac_file" || continue case $ac_file in - *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj ) - ;; - conftest.$ac_ext ) - # This is the source file. + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; [ab].out ) # We found the default executable, but exeext='' is most # certainly right. break;; *.* ) - ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` - # FIXME: I believe we export ac_cv_exeext for Libtool, - # but it would be cool to find out if it's true. Does anybody - # maintain Libtool? --akim. - export ac_cv_exeext + if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no; + then :; else + ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` + fi + # We set ac_cv_exeext here because the later test for it is not + # safe: cross compilers may not add the suffix if given an `-o' + # argument, so we may need to know it at that point already. + # Even if this section looks crufty: it has the advantage of + # actually working. break;; * ) break;; esac done +test "$ac_cv_exeext" = no && ac_cv_exeext= + else - echo "$as_me: failed program was:" >&5 + ac_file='' +fi +if test -z "$ac_file"; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +$as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -{ { echo "$as_me:$LINENO: error: C compiler cannot create executables -See \`config.log' for more details." >&5 -echo "$as_me: error: C compiler cannot create executables -See \`config.log' for more details." >&2;} - { (exit 77); exit 77; }; } +{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error 77 "C compiler cannot create executables +See \`config.log' for more details" "$LINENO" 5; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } fi - +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5 +$as_echo_n "checking for C compiler default output file name... " >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5 +$as_echo "$ac_file" >&6; } ac_exeext=$ac_cv_exeext -echo "$as_me:$LINENO: result: $ac_file" >&5 -echo "${ECHO_T}$ac_file" >&6 - -# Check the compiler produces executables we can run. If not, either -# the compiler is broken, or we cross compile. -echo "$as_me:$LINENO: checking whether the C compiler works" >&5 -echo $ECHO_N "checking whether the C compiler works... $ECHO_C" >&6 -# FIXME: These cross compiler hacks should be removed for Autoconf 3.0 -# If not cross compiling, check that we can run a simple program. -if test "$cross_compiling" != yes; then - if { ac_try='./$ac_file' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - cross_compiling=no - else - if test "$cross_compiling" = maybe; then - cross_compiling=yes - else - { { echo "$as_me:$LINENO: error: cannot run C compiled programs. -If you meant to cross compile, use \`--host'. -See \`config.log' for more details." >&5 -echo "$as_me: error: cannot run C compiled programs. -If you meant to cross compile, use \`--host'. -See \`config.log' for more details." >&2;} - { (exit 1); exit 1; }; } - fi - fi -fi -echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6 -rm -f a.out a.exe conftest$ac_cv_exeext b.out +rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out ac_clean_files=$ac_clean_files_save -# Check the compiler produces executables we can run. If not, either -# the compiler is broken, or we cross compile. -echo "$as_me:$LINENO: checking whether we are cross compiling" >&5 -echo $ECHO_N "checking whether we are cross compiling... $ECHO_C" >&6 -echo "$as_me:$LINENO: result: $cross_compiling" >&5 -echo "${ECHO_T}$cross_compiling" >&6 - -echo "$as_me:$LINENO: checking for suffix of executables" >&5 -echo $ECHO_N "checking for suffix of executables... $ECHO_C" >&6 -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5 +$as_echo_n "checking for suffix of executables... " >&6; } +if { { ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_link") 2>&5 ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; then + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then : # If both `conftest.exe' and `conftest' are `present' (well, observable) # catch `conftest.exe'. For instance with Cygwin, `ls conftest' will # work properly (i.e., refer to `conftest.exe'), while it won't with @@ -2158,38 +3026,90 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 for ac_file in conftest.exe conftest conftest.*; do test -f "$ac_file" || continue case $ac_file in - *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj ) ;; + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` - export ac_cv_exeext break;; * ) break;; esac done else - { { echo "$as_me:$LINENO: error: cannot compute suffix of executables: cannot compile and link -See \`config.log' for more details." >&5 -echo "$as_me: error: cannot compute suffix of executables: cannot compile and link -See \`config.log' for more details." >&2;} - { (exit 1); exit 1; }; } + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "cannot compute suffix of executables: cannot compile and link +See \`config.log' for more details" "$LINENO" 5; } fi - -rm -f conftest$ac_cv_exeext -echo "$as_me:$LINENO: result: $ac_cv_exeext" >&5 -echo "${ECHO_T}$ac_cv_exeext" >&6 +rm -f conftest conftest$ac_cv_exeext +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5 +$as_echo "$ac_cv_exeext" >&6; } rm -f conftest.$ac_ext EXEEXT=$ac_cv_exeext ac_exeext=$EXEEXT -echo "$as_me:$LINENO: checking for suffix of object files" >&5 -echo $ECHO_N "checking for suffix of object files... $ECHO_C" >&6 -if test "${ac_cv_objext+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +int +main () +{ +FILE *f = fopen ("conftest.out", "w"); + return ferror (f) || fclose (f) != 0; + + ; + return 0; +} _ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF +ac_clean_files="$ac_clean_files conftest.out" +# Check that the compiler produces executables we can run. If not, either +# the compiler is broken, or we cross compile. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5 +$as_echo_n "checking whether we are cross compiling... " >&6; } +if test "$cross_compiling" != yes; then + { { ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } + if { ac_try='./conftest$ac_cv_exeext' + { { case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; }; then + cross_compiling=no + else + if test "$cross_compiling" = maybe; then + cross_compiling=yes + else + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "cannot run C compiled programs. +If you meant to cross compile, use \`--host'. +See \`config.log' for more details" "$LINENO" 5; } + fi + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5 +$as_echo "$cross_compiling" >&6; } + +rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out +ac_clean_files=$ac_clean_files_save +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5 +$as_echo_n "checking for suffix of object files... " >&6; } +if ${ac_cv_objext+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int @@ -2201,45 +3121,46 @@ main () } _ACEOF rm -f conftest.o conftest.obj -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 +if { { ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_compile") 2>&5 ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; then - for ac_file in `(ls conftest.o conftest.obj; ls conftest.*) 2>/dev/null`; do + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then : + for ac_file in conftest.o conftest.obj conftest.*; do + test -f "$ac_file" || continue; case $ac_file in - *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg ) ;; + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM ) ;; *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` break;; esac done else - echo "$as_me: failed program was:" >&5 + $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -{ { echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile -See \`config.log' for more details." >&5 -echo "$as_me: error: cannot compute suffix of object files: cannot compile -See \`config.log' for more details." >&2;} - { (exit 1); exit 1; }; } +{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "cannot compute suffix of object files: cannot compile +See \`config.log' for more details" "$LINENO" 5; } fi - rm -f conftest.$ac_cv_objext conftest.$ac_ext fi -echo "$as_me:$LINENO: result: $ac_cv_objext" >&5 -echo "${ECHO_T}$ac_cv_objext" >&6 +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5 +$as_echo "$ac_cv_objext" >&6; } OBJEXT=$ac_cv_objext ac_objext=$OBJEXT -echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5 -echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6 -if test "${ac_cv_c_compiler_gnu+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5 +$as_echo_n "checking whether we are using the GNU C compiler... " >&6; } +if ${ac_cv_c_compiler_gnu+:} false; then : + $as_echo_n "(cached) " >&6 else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int @@ -2253,54 +3174,34 @@ main () return 0; } _ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then +if ac_fn_c_try_compile "$LINENO"; then : ac_compiler_gnu=yes else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_compiler_gnu=no + ac_compiler_gnu=no fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_cv_c_compiler_gnu=$ac_compiler_gnu fi -echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5 -echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6 -GCC=`test $ac_compiler_gnu = yes && echo yes` +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5 +$as_echo "$ac_cv_c_compiler_gnu" >&6; } +if test $ac_compiler_gnu = yes; then + GCC=yes +else + GCC= +fi ac_test_CFLAGS=${CFLAGS+set} ac_save_CFLAGS=$CFLAGS -CFLAGS="-g" -echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5 -echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6 -if test "${ac_cv_prog_cc_g+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 +$as_echo_n "checking whether $CC accepts -g... " >&6; } +if ${ac_cv_prog_cc_g+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_save_c_werror_flag=$ac_c_werror_flag + ac_c_werror_flag=yes + ac_cv_prog_cc_g=no + CFLAGS="-g" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int @@ -2311,38 +3212,49 @@ main () return 0; } _ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then +if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_g=yes else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 + CFLAGS="" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + +else + ac_c_werror_flag=$ac_save_c_werror_flag + CFLAGS="-g" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ -ac_cv_prog_cc_g=no + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_prog_cc_g=yes +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi -echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5 -echo "${ECHO_T}$ac_cv_prog_cc_g" >&6 +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + ac_c_werror_flag=$ac_save_c_werror_flag +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5 +$as_echo "$ac_cv_prog_cc_g" >&6; } if test "$ac_test_CFLAGS" = set; then CFLAGS=$ac_save_CFLAGS elif test $ac_cv_prog_cc_g = yes; then @@ -2358,18 +3270,14 @@ else CFLAGS= fi fi -echo "$as_me:$LINENO: checking for $CC option to accept ANSI C" >&5 -echo $ECHO_N "checking for $CC option to accept ANSI C... $ECHO_C" >&6 -if test "${ac_cv_prog_cc_stdc+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5 +$as_echo_n "checking for $CC option to accept ISO C89... " >&6; } +if ${ac_cv_prog_cc_c89+:} false; then : + $as_echo_n "(cached) " >&6 else - ac_cv_prog_cc_stdc=no + ac_cv_prog_cc_c89=no ac_save_CC=$CC -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF +cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include @@ -2397,12 +3305,17 @@ static char *f (char * (*g) (char **, int), char **p, ...) /* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has function prototypes and stuff, but not '\xHH' hex character constants. These don't provoke an error unfortunately, instead are silently treated - as 'x'. The following induces an error, until -std1 is added to get + as 'x'. The following induces an error, until -std is added to get proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an array size at least. It's necessary to write '\x00'==0 to get something - that's true only with -std1. */ + that's true only with -std. */ int osf4_cc_array ['\x00' == 0 ? 1 : -1]; +/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters + inside strings and character constants. */ +#define FOO(x) 'x' +int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; + int test (int i, double x); struct s1 {int (*f) (int a);}; struct s2 {int (*f) (double a);}; @@ -2417,201 +3330,37 @@ return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; return 0; } _ACEOF -# Don't try gcc -ansi; that turns off useful extensions and -# breaks some systems' header files. -# AIX -qlanglvl=ansi -# Ultrix and OSF/1 -std1 -# HP-UX 10.20 and later -Ae -# HP-UX older versions -Aa -D_HPUX_SOURCE -# SVR4 -Xc -D__EXTENSIONS__ -for ac_arg in "" -qlanglvl=ansi -std1 -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" +for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ + -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" do CC="$ac_save_CC $ac_arg" - rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_prog_cc_stdc=$ac_arg -break -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - + if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_prog_cc_c89=$ac_arg fi -rm -f conftest.err conftest.$ac_objext +rm -f core conftest.err conftest.$ac_objext + test "x$ac_cv_prog_cc_c89" != "xno" && break done -rm -f conftest.$ac_ext conftest.$ac_objext +rm -f conftest.$ac_ext CC=$ac_save_CC fi - -case "x$ac_cv_prog_cc_stdc" in - x|xno) - echo "$as_me:$LINENO: result: none needed" >&5 -echo "${ECHO_T}none needed" >&6 ;; +# AC_CACHE_VAL +case "x$ac_cv_prog_cc_c89" in + x) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 +$as_echo "none needed" >&6; } ;; + xno) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 +$as_echo "unsupported" >&6; } ;; *) - echo "$as_me:$LINENO: result: $ac_cv_prog_cc_stdc" >&5 -echo "${ECHO_T}$ac_cv_prog_cc_stdc" >&6 - CC="$CC $ac_cv_prog_cc_stdc" ;; + CC="$CC $ac_cv_prog_cc_c89" + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 +$as_echo "$ac_cv_prog_cc_c89" >&6; } ;; esac +if test "x$ac_cv_prog_cc_c89" != xno; then : -# Some people use a C++ compiler to compile C. Since we use `exit', -# in C++ we need to declare it. In case someone uses the same compiler -# for both compiling C and C++ we need to have the C++ compiler decide -# the declaration of exit, since it's the most demanding environment. -cat >conftest.$ac_ext <<_ACEOF -#ifndef __cplusplus - choke me -#endif -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - for ac_declaration in \ - '' \ - 'extern "C" void std::exit (int) throw (); using std::exit;' \ - 'extern "C" void std::exit (int); using std::exit;' \ - 'extern "C" void exit (int) throw ();' \ - 'extern "C" void exit (int);' \ - 'void exit (int);' -do - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_declaration -#include -int -main () -{ -exit (42); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - : -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -continue -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_declaration -int -main () -{ -exit (42); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - break -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -done -rm -f conftest* -if test -n "$ac_declaration"; then - echo '#ifdef __cplusplus' >>confdefs.h - echo $ac_declaration >>confdefs.h - echo '#endif' >>confdefs.h fi -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' @@ -2631,22 +3380,23 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # OS/2's system install, which has a completely different semantic # ./install, which can be erroneously created by make from ./install.sh. -echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5 -echo $ECHO_N "checking for a BSD-compatible install... $ECHO_C" >&6 +# Reject install programs that cannot install multiple files. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a BSD-compatible install" >&5 +$as_echo_n "checking for a BSD-compatible install... " >&6; } if test -z "$INSTALL"; then -if test "${ac_cv_path_install+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 +if ${ac_cv_path_install+:} false; then : + $as_echo_n "(cached) " >&6 else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. - # Account for people who put trailing slashes in PATH elements. -case $as_dir/ in - ./ | .// | /cC/* | \ + # Account for people who put trailing slashes in PATH elements. +case $as_dir/ in #(( + ./ | .// | /[cC]/* | \ /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ - ?:\\/os2\\/install\\/* | ?:\\/OS2\\/INSTALL\\/* | \ + ?:[\\/]os2[\\/]install[\\/]* | ?:[\\/]OS2[\\/]INSTALL[\\/]* | \ /usr/ucb/* ) ;; *) # OSF1 and SCO ODT 3.0 have their own names for install. @@ -2654,7 +3404,7 @@ case $as_dir/ in # by default. for ac_prog in ginstall scoinst install; do for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then + if { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; }; then if test $ac_prog = install && grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # AIX install. It has an incompatible calling convention. @@ -2664,30 +3414,43 @@ case $as_dir/ in # program-specific install script used by HP pwplus--don't use. : else - ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" - break 3 + rm -rf conftest.one conftest.two conftest.dir + echo one > conftest.one + echo two > conftest.two + mkdir conftest.dir + if "$as_dir/$ac_prog$ac_exec_ext" -c conftest.one conftest.two "`pwd`/conftest.dir" && + test -s conftest.one && test -s conftest.two && + test -s conftest.dir/conftest.one && + test -s conftest.dir/conftest.two + then + ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" + break 3 + fi fi fi done done ;; esac -done + done +IFS=$as_save_IFS + +rm -rf conftest.one conftest.two conftest.dir fi if test "${ac_cv_path_install+set}" = set; then INSTALL=$ac_cv_path_install else - # As a last resort, use the slow shell script. We don't cache a - # path for INSTALL within a source directory, because that will + # As a last resort, use the slow shell script. Don't cache a + # value for INSTALL within a source directory, because that will # break other packages using the cache if that directory is - # removed, or if the path is relative. + # removed, or if the value is a relative name. INSTALL=$ac_install_sh fi fi -echo "$as_me:$LINENO: result: $INSTALL" >&5 -echo "${ECHO_T}$INSTALL" >&6 +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $INSTALL" >&5 +$as_echo "$INSTALL" >&6; } # Use test -z because SunOS4 sh mishandles braces in ${var-val}. # It thinks the first close brace ends the variable substitution. @@ -2699,24 +3462,15 @@ test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' - - - - - ac_header_dirent=no for ac_hdr in dirent.h sys/ndir.h sys/dir.h ndir.h; do - as_ac_Header=`echo "ac_cv_header_dirent_$ac_hdr" | $as_tr_sh` -echo "$as_me:$LINENO: checking for $ac_hdr that defines DIR" >&5 -echo $ECHO_N "checking for $ac_hdr that defines DIR... $ECHO_C" >&6 -if eval "test \"\${$as_ac_Header+set}\" = set"; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF + as_ac_Header=`$as_echo "ac_cv_header_dirent_$ac_hdr" | $as_tr_sh` +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_hdr that defines DIR" >&5 +$as_echo_n "checking for $ac_hdr that defines DIR... " >&6; } +if eval \${$as_ac_Header+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include <$ac_hdr> @@ -2730,41 +3484,19 @@ return 0; return 0; } _ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then +if ac_fn_c_try_compile "$LINENO"; then : eval "$as_ac_Header=yes" else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -eval "$as_ac_Header=no" + eval "$as_ac_Header=no" fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi -echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 -echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 -if test `eval echo '${'$as_ac_Header'}'` = yes; then +eval ac_res=\$$as_ac_Header + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } +if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF -#define `echo "HAVE_$ac_hdr" | $as_tr_cpp` 1 +#define `$as_echo "HAVE_$ac_hdr" | $as_tr_cpp` 1 _ACEOF ac_header_dirent=$ac_hdr; break @@ -2773,252 +3505,116 @@ fi done # Two versions of opendir et al. are in -ldir and -lx on SCO Xenix. if test $ac_header_dirent = dirent.h; then - echo "$as_me:$LINENO: checking for library containing opendir" >&5 -echo $ECHO_N "checking for library containing opendir... $ECHO_C" >&6 -if test "${ac_cv_search_opendir+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing opendir" >&5 +$as_echo_n "checking for library containing opendir... " >&6; } +if ${ac_cv_search_opendir+:} false; then : + $as_echo_n "(cached) " >&6 else ac_func_search_save_LIBS=$LIBS -ac_cv_search_opendir=no -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF +cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -/* Override any gcc2 internal prototype to avoid an error. */ +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ char opendir (); int main () { -opendir (); +return opendir (); ; return 0; } _ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_search_opendir="none required" -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -if test "$ac_cv_search_opendir" = no; then - for ac_lib in dir; do +for ac_lib in '' dir; do + if test -z "$ac_lib"; then + ac_res="none required" + else + ac_res=-l$ac_lib LIBS="-l$ac_lib $ac_func_search_save_LIBS" - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ + fi + if ac_fn_c_try_link "$LINENO"; then : + ac_cv_search_opendir=$ac_res +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext + if ${ac_cv_search_opendir+:} false; then : + break +fi +done +if ${ac_cv_search_opendir+:} false; then : -/* Override any gcc2 internal prototype to avoid an error. */ -#ifdef __cplusplus -extern "C" -#endif -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char opendir (); -int -main () -{ -opendir (); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_search_opendir="-l$ac_lib" -break else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - done + ac_cv_search_opendir=no fi +rm conftest.$ac_ext LIBS=$ac_func_search_save_LIBS fi -echo "$as_me:$LINENO: result: $ac_cv_search_opendir" >&5 -echo "${ECHO_T}$ac_cv_search_opendir" >&6 -if test "$ac_cv_search_opendir" != no; then - test "$ac_cv_search_opendir" = "none required" || LIBS="$ac_cv_search_opendir $LIBS" +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_opendir" >&5 +$as_echo "$ac_cv_search_opendir" >&6; } +ac_res=$ac_cv_search_opendir +if test "$ac_res" != no; then : + test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" fi else - echo "$as_me:$LINENO: checking for library containing opendir" >&5 -echo $ECHO_N "checking for library containing opendir... $ECHO_C" >&6 -if test "${ac_cv_search_opendir+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing opendir" >&5 +$as_echo_n "checking for library containing opendir... " >&6; } +if ${ac_cv_search_opendir+:} false; then : + $as_echo_n "(cached) " >&6 else ac_func_search_save_LIBS=$LIBS -ac_cv_search_opendir=no -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF +cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -/* Override any gcc2 internal prototype to avoid an error. */ +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ char opendir (); int main () { -opendir (); +return opendir (); ; return 0; } _ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_search_opendir="none required" -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -if test "$ac_cv_search_opendir" = no; then - for ac_lib in x; do +for ac_lib in '' x; do + if test -z "$ac_lib"; then + ac_res="none required" + else + ac_res=-l$ac_lib LIBS="-l$ac_lib $ac_func_search_save_LIBS" - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ + fi + if ac_fn_c_try_link "$LINENO"; then : + ac_cv_search_opendir=$ac_res +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext + if ${ac_cv_search_opendir+:} false; then : + break +fi +done +if ${ac_cv_search_opendir+:} false; then : -/* Override any gcc2 internal prototype to avoid an error. */ -#ifdef __cplusplus -extern "C" -#endif -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char opendir (); -int -main () -{ -opendir (); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_search_opendir="-l$ac_lib" -break else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - done + ac_cv_search_opendir=no fi +rm conftest.$ac_ext LIBS=$ac_func_search_save_LIBS fi -echo "$as_me:$LINENO: result: $ac_cv_search_opendir" >&5 -echo "${ECHO_T}$ac_cv_search_opendir" >&6 -if test "$ac_cv_search_opendir" != no; then - test "$ac_cv_search_opendir" = "none required" || LIBS="$ac_cv_search_opendir $LIBS" +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_opendir" >&5 +$as_echo "$ac_cv_search_opendir" >&6; } +ac_res=$ac_cv_search_opendir +if test "$ac_res" != no; then : + test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" fi @@ -3029,15 +3625,15 @@ ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu -echo "$as_me:$LINENO: checking how to run the C preprocessor" >&5 -echo $ECHO_N "checking how to run the C preprocessor... $ECHO_C" >&6 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5 +$as_echo_n "checking how to run the C preprocessor... " >&6; } # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= fi if test -z "$CPP"; then - if test "${ac_cv_prog_CPP+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 + if ${ac_cv_prog_CPP+:} false; then : + $as_echo_n "(cached) " >&6 else # Double quotes because CPP needs to be expanded for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" @@ -3051,11 +3647,7 @@ do # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef __STDC__ # include @@ -3064,78 +3656,34 @@ cat >>conftest.$ac_ext <<_ACEOF #endif Syntax error _ACEOF -if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 - (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null; then - if test -s conftest.err; then - ac_cpp_err=$ac_c_preproc_warn_flag - ac_cpp_err=$ac_cpp_err$ac_c_werror_flag - else - ac_cpp_err= - fi -else - ac_cpp_err=yes -fi -if test -z "$ac_cpp_err"; then - : -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 +if ac_fn_c_try_cpp "$LINENO"; then : +else # Broken: fails on valid input. continue fi -rm -f conftest.err conftest.$ac_ext +rm -f conftest.err conftest.i conftest.$ac_ext - # OK, works on sane cases. Now check whether non-existent headers + # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF -if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 - (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null; then - if test -s conftest.err; then - ac_cpp_err=$ac_c_preproc_warn_flag - ac_cpp_err=$ac_cpp_err$ac_c_werror_flag - else - ac_cpp_err= - fi -else - ac_cpp_err=yes -fi -if test -z "$ac_cpp_err"; then +if ac_fn_c_try_cpp "$LINENO"; then : # Broken: success on invalid input. continue else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - # Passes both tests. ac_preproc_ok=: break fi -rm -f conftest.err conftest.$ac_ext +rm -f conftest.err conftest.i conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. -rm -f conftest.err conftest.$ac_ext -if $ac_preproc_ok; then +rm -f conftest.i conftest.err conftest.$ac_ext +if $ac_preproc_ok; then : break fi @@ -3147,8 +3695,8 @@ fi else ac_cv_prog_CPP=$CPP fi -echo "$as_me:$LINENO: result: $CPP" >&5 -echo "${ECHO_T}$CPP" >&6 +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5 +$as_echo "$CPP" >&6; } ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do @@ -3158,11 +3706,7 @@ do # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef __STDC__ # include @@ -3171,85 +3715,40 @@ cat >>conftest.$ac_ext <<_ACEOF #endif Syntax error _ACEOF -if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 - (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null; then - if test -s conftest.err; then - ac_cpp_err=$ac_c_preproc_warn_flag - ac_cpp_err=$ac_cpp_err$ac_c_werror_flag - else - ac_cpp_err= - fi -else - ac_cpp_err=yes -fi -if test -z "$ac_cpp_err"; then - : -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 +if ac_fn_c_try_cpp "$LINENO"; then : +else # Broken: fails on valid input. continue fi -rm -f conftest.err conftest.$ac_ext +rm -f conftest.err conftest.i conftest.$ac_ext - # OK, works on sane cases. Now check whether non-existent headers + # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF -if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 - (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null; then - if test -s conftest.err; then - ac_cpp_err=$ac_c_preproc_warn_flag - ac_cpp_err=$ac_cpp_err$ac_c_werror_flag - else - ac_cpp_err= - fi -else - ac_cpp_err=yes -fi -if test -z "$ac_cpp_err"; then +if ac_fn_c_try_cpp "$LINENO"; then : # Broken: success on invalid input. continue else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - # Passes both tests. ac_preproc_ok=: break fi -rm -f conftest.err conftest.$ac_ext +rm -f conftest.err conftest.i conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. -rm -f conftest.err conftest.$ac_ext -if $ac_preproc_ok; then - : +rm -f conftest.i conftest.err conftest.$ac_ext +if $ac_preproc_ok; then : + else - { { echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check -See \`config.log' for more details." >&5 -echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check -See \`config.log' for more details." >&2;} - { (exit 1); exit 1; }; } + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "C preprocessor \"$CPP\" fails sanity check +See \`config.log' for more details" "$LINENO" 5; } fi ac_ext=c @@ -3259,31 +3758,142 @@ ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $ ac_compiler_gnu=$ac_cv_c_compiler_gnu -echo "$as_me:$LINENO: checking for egrep" >&5 -echo $ECHO_N "checking for egrep... $ECHO_C" >&6 -if test "${ac_cv_prog_egrep+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5 +$as_echo_n "checking for grep that handles long lines and -e... " >&6; } +if ${ac_cv_path_GREP+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -z "$GREP"; then + ac_path_GREP_found=false + # Loop through the user's path and test for each of PROGNAME-LIST + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_prog in grep ggrep; do + for ac_exec_ext in '' $ac_executable_extensions; do + ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext" + { test -f "$ac_path_GREP" && $as_test_x "$ac_path_GREP"; } || continue +# Check for GNU ac_path_GREP and select it if it is found. + # Check for GNU $ac_path_GREP +case `"$ac_path_GREP" --version 2>&1` in +*GNU*) + ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;; +*) + ac_count=0 + $as_echo_n 0123456789 >"conftest.in" + while : + do + cat "conftest.in" "conftest.in" >"conftest.tmp" + mv "conftest.tmp" "conftest.in" + cp "conftest.in" "conftest.nl" + $as_echo 'GREP' >> "conftest.nl" + "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break + diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break + as_fn_arith $ac_count + 1 && ac_count=$as_val + if test $ac_count -gt ${ac_path_GREP_max-0}; then + # Best one so far, save it but keep looking for a better one + ac_cv_path_GREP="$ac_path_GREP" + ac_path_GREP_max=$ac_count + fi + # 10*(2^10) chars as input seems more than enough + test $ac_count -gt 10 && break + done + rm -f conftest.in conftest.tmp conftest.nl conftest.out;; +esac + + $ac_path_GREP_found && break 3 + done + done + done +IFS=$as_save_IFS + if test -z "$ac_cv_path_GREP"; then + as_fn_error $? "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 + fi +else + ac_cv_path_GREP=$GREP +fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5 +$as_echo "$ac_cv_path_GREP" >&6; } + GREP="$ac_cv_path_GREP" + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5 +$as_echo_n "checking for egrep... " >&6; } +if ${ac_cv_path_EGREP+:} false; then : + $as_echo_n "(cached) " >&6 else - if echo a | (grep -E '(a|b)') >/dev/null 2>&1 - then ac_cv_prog_egrep='grep -E' - else ac_cv_prog_egrep='egrep' + if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 + then ac_cv_path_EGREP="$GREP -E" + else + if test -z "$EGREP"; then + ac_path_EGREP_found=false + # Loop through the user's path and test for each of PROGNAME-LIST + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_prog in egrep; do + for ac_exec_ext in '' $ac_executable_extensions; do + ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext" + { test -f "$ac_path_EGREP" && $as_test_x "$ac_path_EGREP"; } || continue +# Check for GNU ac_path_EGREP and select it if it is found. + # Check for GNU $ac_path_EGREP +case `"$ac_path_EGREP" --version 2>&1` in +*GNU*) + ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;; +*) + ac_count=0 + $as_echo_n 0123456789 >"conftest.in" + while : + do + cat "conftest.in" "conftest.in" >"conftest.tmp" + mv "conftest.tmp" "conftest.in" + cp "conftest.in" "conftest.nl" + $as_echo 'EGREP' >> "conftest.nl" + "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break + diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break + as_fn_arith $ac_count + 1 && ac_count=$as_val + if test $ac_count -gt ${ac_path_EGREP_max-0}; then + # Best one so far, save it but keep looking for a better one + ac_cv_path_EGREP="$ac_path_EGREP" + ac_path_EGREP_max=$ac_count fi + # 10*(2^10) chars as input seems more than enough + test $ac_count -gt 10 && break + done + rm -f conftest.in conftest.tmp conftest.nl conftest.out;; +esac + + $ac_path_EGREP_found && break 3 + done + done + done +IFS=$as_save_IFS + if test -z "$ac_cv_path_EGREP"; then + as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 + fi +else + ac_cv_path_EGREP=$EGREP +fi + + fi fi -echo "$as_me:$LINENO: result: $ac_cv_prog_egrep" >&5 -echo "${ECHO_T}$ac_cv_prog_egrep" >&6 - EGREP=$ac_cv_prog_egrep +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5 +$as_echo "$ac_cv_path_EGREP" >&6; } + EGREP="$ac_cv_path_EGREP" -echo "$as_me:$LINENO: checking for ANSI C header files" >&5 -echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6 -if test "${ac_cv_header_stdc+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5 +$as_echo_n "checking for ANSI C header files... " >&6; } +if ${ac_cv_header_stdc+:} false; then : + $as_echo_n "(cached) " >&6 else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include @@ -3298,50 +3908,23 @@ main () return 0; } _ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then +if ac_fn_c_try_compile "$LINENO"; then : ac_cv_header_stdc=yes else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_header_stdc=no + ac_cv_header_stdc=no fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "memchr" >/dev/null 2>&1; then - : + $EGREP "memchr" >/dev/null 2>&1; then : + else ac_cv_header_stdc=no fi @@ -3351,18 +3934,14 @@ fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "free" >/dev/null 2>&1; then - : + $EGREP "free" >/dev/null 2>&1; then : + else ac_cv_header_stdc=no fi @@ -3372,16 +3951,13 @@ fi if test $ac_cv_header_stdc = yes; then # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. - if test "$cross_compiling" = yes; then + if test "$cross_compiling" = yes; then : : else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include +#include #if ((' ' & 0x0FF) == 0x020) # define ISLOWER(c) ('a' <= (c) && (c) <= 'z') # define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) @@ -3401,59 +3977,40 @@ main () for (i = 0; i < 256; i++) if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) - exit(2); - exit (0); + return 2; + return 0; } _ACEOF -rm -f conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { ac_try='./conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - : -else - echo "$as_me: program exited with status $ac_status" >&5 -echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 +if ac_fn_c_try_run "$LINENO"; then : -( exit $ac_status ) -ac_cv_header_stdc=no +else + ac_cv_header_stdc=no fi -rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext fi + fi fi -echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5 -echo "${ECHO_T}$ac_cv_header_stdc" >&6 +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5 +$as_echo "$ac_cv_header_stdc" >&6; } if test $ac_cv_header_stdc = yes; then -cat >>confdefs.h <<\_ACEOF -#define STDC_HEADERS 1 -_ACEOF +$as_echo "#define STDC_HEADERS 1" >>confdefs.h fi -echo "$as_me:$LINENO: checking for sys/wait.h that is POSIX.1 compatible" >&5 -echo $ECHO_N "checking for sys/wait.h that is POSIX.1 compatible... $ECHO_C" >&6 -if test "${ac_cv_header_sys_wait_h+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for sys/wait.h that is POSIX.1 compatible" >&5 +$as_echo_n "checking for sys/wait.h that is POSIX.1 compatible... " >&6; } +if ${ac_cv_header_sys_wait_h+:} false; then : + $as_echo_n "(cached) " >&6 else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #ifndef WEXITSTATUS -# define WEXITSTATUS(stat_val) ((unsigned)(stat_val) >> 8) +# define WEXITSTATUS(stat_val) ((unsigned int) (stat_val) >> 8) #endif #ifndef WIFEXITED # define WIFEXITED(stat_val) (((stat_val) & 255) == 0) @@ -3469,110 +4026,31 @@ main () return 0; } _ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then +if ac_fn_c_try_compile "$LINENO"; then : ac_cv_header_sys_wait_h=yes else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_header_sys_wait_h=no + ac_cv_header_sys_wait_h=no fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi -echo "$as_me:$LINENO: result: $ac_cv_header_sys_wait_h" >&5 -echo "${ECHO_T}$ac_cv_header_sys_wait_h" >&6 +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_sys_wait_h" >&5 +$as_echo "$ac_cv_header_sys_wait_h" >&6; } if test $ac_cv_header_sys_wait_h = yes; then -cat >>confdefs.h <<\_ACEOF -#define HAVE_SYS_WAIT_H 1 -_ACEOF +$as_echo "#define HAVE_SYS_WAIT_H 1" >>confdefs.h fi # On IRIX 5.3, sys/types and inttypes.h are conflicting. - - - - - - - - - for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ inttypes.h stdint.h unistd.h -do -as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` -echo "$as_me:$LINENO: checking for $ac_header" >&5 -echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 -if eval "test \"\${$as_ac_Header+set}\" = set"; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_includes_default - -#include <$ac_header> -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - eval "$as_ac_Header=yes" -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -eval "$as_ac_Header=no" -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 -echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 -if test `eval echo '${'$as_ac_Header'}'` = yes; then +do : + as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` +ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default +" +if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF -#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi @@ -3580,153 +4058,39 @@ fi done +for ac_header in fcntl.h sys/file.h sys/ioctl.h sys/time.h unistd.h +do : + as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` +ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" +if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF +fi +done - - -for ac_header in fcntl.h sys/file.h sys/ioctl.h sys/time.h unistd.h -do -as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` -if eval "test \"\${$as_ac_Header+set}\" = set"; then - echo "$as_me:$LINENO: checking for $ac_header" >&5 -echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 -if eval "test \"\${$as_ac_Header+set}\" = set"; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -fi -echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 -echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 -else - # Is the header compilable? -echo "$as_me:$LINENO: checking $ac_header usability" >&5 -echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_includes_default -#include <$ac_header> +for ac_header in termios.h sys/termiox.h sys/vfs.h sys/statfs.h sys/statvfs.h +do : + as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` +ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" +if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_header_compiler=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 -ac_header_compiler=no fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 -echo "${ECHO_T}$ac_header_compiler" >&6 -# Is the header present? -echo "$as_me:$LINENO: checking $ac_header presence" >&5 -echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include <$ac_header> -_ACEOF -if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 - (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null; then - if test -s conftest.err; then - ac_cpp_err=$ac_c_preproc_warn_flag - ac_cpp_err=$ac_cpp_err$ac_c_werror_flag - else - ac_cpp_err= - fi -else - ac_cpp_err=yes -fi -if test -z "$ac_cpp_err"; then - ac_header_preproc=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_header_preproc=no -fi -rm -f conftest.err conftest.$ac_ext -echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 -echo "${ECHO_T}$ac_header_preproc" >&6 - -# So? What about this header? -case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in - yes:no: ) - { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 -echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 -echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} - ac_header_preproc=yes - ;; - no:yes:* ) - { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 -echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 -echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 -echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 -echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 -echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 -echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} - ( - cat <<\_ASBOX -## --------------------------------------- ## -## Report this to e.kozhuhovskiy@gmail.com ## -## --------------------------------------- ## -_ASBOX - ) | - sed "s/^/$as_me: WARNING: /" >&2 - ;; -esac -echo "$as_me:$LINENO: checking for $ac_header" >&5 -echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 -if eval "test \"\${$as_ac_Header+set}\" = set"; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - eval "$as_ac_Header=\$ac_header_preproc" -fi -echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 -echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 - -fi -if test `eval echo '${'$as_ac_Header'}'` = yes; then - cat >>confdefs.h <<_ACEOF -#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +done + +for ac_header in sys/select.h sys/param.h sys/mount.h +do : + as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` +ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" +if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi @@ -3734,320 +4098,12 @@ fi done - - - - -for ac_header in termios.h sys/termiox.h sys/vfs.h sys/statfs.h sys/statvfs.h -do -as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` -if eval "test \"\${$as_ac_Header+set}\" = set"; then - echo "$as_me:$LINENO: checking for $ac_header" >&5 -echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 -if eval "test \"\${$as_ac_Header+set}\" = set"; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -fi -echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 -echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 -else - # Is the header compilable? -echo "$as_me:$LINENO: checking $ac_header usability" >&5 -echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_includes_default -#include <$ac_header> -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_header_compiler=yes +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for an ANSI C-conforming const" >&5 +$as_echo_n "checking for an ANSI C-conforming const... " >&6; } +if ${ac_cv_c_const+:} false; then : + $as_echo_n "(cached) " >&6 else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_header_compiler=no -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 -echo "${ECHO_T}$ac_header_compiler" >&6 - -# Is the header present? -echo "$as_me:$LINENO: checking $ac_header presence" >&5 -echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include <$ac_header> -_ACEOF -if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 - (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null; then - if test -s conftest.err; then - ac_cpp_err=$ac_c_preproc_warn_flag - ac_cpp_err=$ac_cpp_err$ac_c_werror_flag - else - ac_cpp_err= - fi -else - ac_cpp_err=yes -fi -if test -z "$ac_cpp_err"; then - ac_header_preproc=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_header_preproc=no -fi -rm -f conftest.err conftest.$ac_ext -echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 -echo "${ECHO_T}$ac_header_preproc" >&6 - -# So? What about this header? -case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in - yes:no: ) - { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 -echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 -echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} - ac_header_preproc=yes - ;; - no:yes:* ) - { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 -echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 -echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 -echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 -echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 -echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 -echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} - ( - cat <<\_ASBOX -## --------------------------------------- ## -## Report this to e.kozhuhovskiy@gmail.com ## -## --------------------------------------- ## -_ASBOX - ) | - sed "s/^/$as_me: WARNING: /" >&2 - ;; -esac -echo "$as_me:$LINENO: checking for $ac_header" >&5 -echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 -if eval "test \"\${$as_ac_Header+set}\" = set"; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - eval "$as_ac_Header=\$ac_header_preproc" -fi -echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 -echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 - -fi -if test `eval echo '${'$as_ac_Header'}'` = yes; then - cat >>confdefs.h <<_ACEOF -#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 -_ACEOF - -fi - -done - - - - -for ac_header in sys/select.h sys/param.h sys/mount.h -do -as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` -if eval "test \"\${$as_ac_Header+set}\" = set"; then - echo "$as_me:$LINENO: checking for $ac_header" >&5 -echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 -if eval "test \"\${$as_ac_Header+set}\" = set"; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -fi -echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 -echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 -else - # Is the header compilable? -echo "$as_me:$LINENO: checking $ac_header usability" >&5 -echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_includes_default -#include <$ac_header> -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_header_compiler=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_header_compiler=no -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 -echo "${ECHO_T}$ac_header_compiler" >&6 - -# Is the header present? -echo "$as_me:$LINENO: checking $ac_header presence" >&5 -echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include <$ac_header> -_ACEOF -if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 - (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null; then - if test -s conftest.err; then - ac_cpp_err=$ac_c_preproc_warn_flag - ac_cpp_err=$ac_cpp_err$ac_c_werror_flag - else - ac_cpp_err= - fi -else - ac_cpp_err=yes -fi -if test -z "$ac_cpp_err"; then - ac_header_preproc=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_header_preproc=no -fi -rm -f conftest.err conftest.$ac_ext -echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 -echo "${ECHO_T}$ac_header_preproc" >&6 - -# So? What about this header? -case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in - yes:no: ) - { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 -echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 -echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} - ac_header_preproc=yes - ;; - no:yes:* ) - { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 -echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 -echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 -echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 -echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 -echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 -echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} - ( - cat <<\_ASBOX -## --------------------------------------- ## -## Report this to e.kozhuhovskiy@gmail.com ## -## --------------------------------------- ## -_ASBOX - ) | - sed "s/^/$as_me: WARNING: /" >&2 - ;; -esac -echo "$as_me:$LINENO: checking for $ac_header" >&5 -echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 -if eval "test \"\${$as_ac_Header+set}\" = set"; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - eval "$as_ac_Header=\$ac_header_preproc" -fi -echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 -echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 - -fi -if test `eval echo '${'$as_ac_Header'}'` = yes; then - cat >>confdefs.h <<_ACEOF -#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 -_ACEOF - -fi - -done - - -echo "$as_me:$LINENO: checking for an ANSI C-conforming const" >&5 -echo $ECHO_N "checking for an ANSI C-conforming const... $ECHO_C" >&6 -if test "${ac_cv_c_const+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int @@ -4057,10 +4113,10 @@ main () #ifndef __cplusplus /* Ultrix mips cc rejects this. */ typedef int charset[2]; - const charset x; + const charset cs; /* SunOS 4.1.1 cc rejects this. */ - char const *const *ccp; - char **p; + char const *const *pcpcc; + char **ppc; /* NEC SVR4.0.2 mips cc rejects this. */ struct point {int x, y;}; static struct point const zero = {0,0}; @@ -4069,16 +4125,17 @@ main () an arm of an if-expression whose if-part is not a constant expression */ const char *g = "string"; - ccp = &g + (g ? g-g : 0); + pcpcc = &g + (g ? g-g : 0); /* HPUX 7.0 cc rejects these. */ - ++ccp; - p = (char**) ccp; - ccp = (char const *const *) p; + ++pcpcc; + ppc = (char**) pcpcc; + pcpcc = (char const *const *) ppc; { /* SCO 3.2v4 cc rejects this. */ char *t; char const *s = 0 ? (char *) 0 : (char const *) 0; *t++ = 0; + if (s) return 0; } { /* Someone thinks the Sun supposedly-ANSI compiler will reject this. */ int x[] = {25, 17}; @@ -4097,110 +4154,33 @@ main () } { /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */ const int foo = 10; + if (!foo) return 0; } + return !cs[0] && !zero.x; #endif ; return 0; } _ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then +if ac_fn_c_try_compile "$LINENO"; then : ac_cv_c_const=yes else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_c_const=no + ac_cv_c_const=no fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi -echo "$as_me:$LINENO: result: $ac_cv_c_const" >&5 -echo "${ECHO_T}$ac_cv_c_const" >&6 +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_const" >&5 +$as_echo "$ac_cv_c_const" >&6; } if test $ac_cv_c_const = no; then -cat >>confdefs.h <<\_ACEOF -#define const -_ACEOF +$as_echo "#define const /**/" >>confdefs.h fi -echo "$as_me:$LINENO: checking for mode_t" >&5 -echo $ECHO_N "checking for mode_t... $ECHO_C" >&6 -if test "${ac_cv_type_mode_t+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_includes_default -int -main () -{ -if ((mode_t *) 0) - return 0; -if (sizeof (mode_t)) - return 0; - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_type_mode_t=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 +ac_fn_c_check_type "$LINENO" "mode_t" "ac_cv_type_mode_t" "$ac_includes_default" +if test "x$ac_cv_type_mode_t" = xyes; then : -ac_cv_type_mode_t=no -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: $ac_cv_type_mode_t" >&5 -echo "${ECHO_T}$ac_cv_type_mode_t" >&6 -if test $ac_cv_type_mode_t = yes; then - : else cat >>confdefs.h <<_ACEOF @@ -4209,63 +4189,9 @@ _ACEOF fi -echo "$as_me:$LINENO: checking for pid_t" >&5 -echo $ECHO_N "checking for pid_t... $ECHO_C" >&6 -if test "${ac_cv_type_pid_t+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_includes_default -int -main () -{ -if ((pid_t *) 0) - return 0; -if (sizeof (pid_t)) - return 0; - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_type_pid_t=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 +ac_fn_c_check_type "$LINENO" "pid_t" "ac_cv_type_pid_t" "$ac_includes_default" +if test "x$ac_cv_type_pid_t" = xyes; then : -ac_cv_type_pid_t=no -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: $ac_cv_type_pid_t" >&5 -echo "${ECHO_T}$ac_cv_type_pid_t" >&6 -if test $ac_cv_type_pid_t = yes; then - : else cat >>confdefs.h <<_ACEOF @@ -4274,81 +4200,23 @@ _ACEOF fi -echo "$as_me:$LINENO: checking for size_t" >&5 -echo $ECHO_N "checking for size_t... $ECHO_C" >&6 -if test "${ac_cv_type_size_t+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_includes_default -int -main () -{ -if ((size_t *) 0) - return 0; -if (sizeof (size_t)) - return 0; - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_type_size_t=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 +ac_fn_c_check_type "$LINENO" "size_t" "ac_cv_type_size_t" "$ac_includes_default" +if test "x$ac_cv_type_size_t" = xyes; then : -ac_cv_type_size_t=no -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: $ac_cv_type_size_t" >&5 -echo "${ECHO_T}$ac_cv_type_size_t" >&6 -if test $ac_cv_type_size_t = yes; then - : else cat >>confdefs.h <<_ACEOF -#define size_t unsigned +#define size_t unsigned int _ACEOF fi -echo "$as_me:$LINENO: checking whether time.h and sys/time.h may both be included" >&5 -echo $ECHO_N "checking whether time.h and sys/time.h may both be included... $ECHO_C" >&6 -if test "${ac_cv_header_time+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether time.h and sys/time.h may both be included" >&5 +$as_echo_n "checking whether time.h and sys/time.h may both be included... " >&6; } +if ${ac_cv_header_time+:} false; then : + $as_echo_n "(cached) " >&6 else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include @@ -4363,56 +4231,27 @@ return 0; return 0; } _ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then +if ac_fn_c_try_compile "$LINENO"; then : ac_cv_header_time=yes else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_header_time=no + ac_cv_header_time=no fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi -echo "$as_me:$LINENO: result: $ac_cv_header_time" >&5 -echo "${ECHO_T}$ac_cv_header_time" >&6 +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_time" >&5 +$as_echo "$ac_cv_header_time" >&6; } if test $ac_cv_header_time = yes; then -cat >>confdefs.h <<\_ACEOF -#define TIME_WITH_SYS_TIME 1 -_ACEOF +$as_echo "#define TIME_WITH_SYS_TIME 1" >>confdefs.h fi -echo "$as_me:$LINENO: checking whether struct tm is in sys/time.h or time.h" >&5 -echo $ECHO_N "checking whether struct tm is in sys/time.h or time.h... $ECHO_C" >&6 -if test "${ac_cv_struct_tm+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether struct tm is in sys/time.h or time.h" >&5 +$as_echo_n "checking whether struct tm is in sys/time.h or time.h... " >&6; } +if ${ac_cv_struct_tm+:} false; then : + $as_echo_n "(cached) " >&6 else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include @@ -4420,63 +4259,36 @@ cat >>conftest.$ac_ext <<_ACEOF int main () { -struct tm *tp; tp->tm_sec; +struct tm tm; + int *p = &tm.tm_sec; + return !p; ; return 0; } _ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then +if ac_fn_c_try_compile "$LINENO"; then : ac_cv_struct_tm=time.h else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_struct_tm=sys/time.h + ac_cv_struct_tm=sys/time.h fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi -echo "$as_me:$LINENO: result: $ac_cv_struct_tm" >&5 -echo "${ECHO_T}$ac_cv_struct_tm" >&6 +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_struct_tm" >&5 +$as_echo "$ac_cv_struct_tm" >&6; } if test $ac_cv_struct_tm = sys/time.h; then -cat >>confdefs.h <<\_ACEOF -#define TM_IN_SYS_TIME 1 -_ACEOF +$as_echo "#define TM_IN_SYS_TIME 1" >>confdefs.h fi -echo "$as_me:$LINENO: checking whether getpgrp requires zero arguments" >&5 -echo $ECHO_N "checking whether getpgrp requires zero arguments... $ECHO_C" >&6 -if test "${ac_cv_func_getpgrp_void+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether getpgrp requires zero arguments" >&5 +$as_echo_n "checking whether getpgrp requires zero arguments... " >&6; } +if ${ac_cv_func_getpgrp_void+:} false; then : + $as_echo_n "(cached) " >&6 else # Use it with a single arg. -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF +cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $ac_includes_default int @@ -4487,65 +4299,36 @@ getpgrp (0); return 0; } _ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then +if ac_fn_c_try_compile "$LINENO"; then : ac_cv_func_getpgrp_void=no else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_func_getpgrp_void=yes + ac_cv_func_getpgrp_void=yes fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi -echo "$as_me:$LINENO: result: $ac_cv_func_getpgrp_void" >&5 -echo "${ECHO_T}$ac_cv_func_getpgrp_void" >&6 +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_getpgrp_void" >&5 +$as_echo "$ac_cv_func_getpgrp_void" >&6; } if test $ac_cv_func_getpgrp_void = yes; then -cat >>confdefs.h <<\_ACEOF -#define GETPGRP_VOID 1 -_ACEOF +$as_echo "#define GETPGRP_VOID 1" >>confdefs.h fi if test $ac_cv_c_compiler_gnu = yes; then - echo "$as_me:$LINENO: checking whether $CC needs -traditional" >&5 -echo $ECHO_N "checking whether $CC needs -traditional... $ECHO_C" >&6 -if test "${ac_cv_prog_gcc_traditional+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC needs -traditional" >&5 +$as_echo_n "checking whether $CC needs -traditional... " >&6; } +if ${ac_cv_prog_gcc_traditional+:} false; then : + $as_echo_n "(cached) " >&6 else ac_pattern="Autoconf.*'x'" - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include Autoconf TIOCGETP _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "$ac_pattern" >/dev/null 2>&1; then + $EGREP "$ac_pattern" >/dev/null 2>&1; then : ac_cv_prog_gcc_traditional=yes else ac_cv_prog_gcc_traditional=no @@ -4554,690 +4337,112 @@ rm -f conftest* if test $ac_cv_prog_gcc_traditional = no; then - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include Autoconf TCGETA _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "$ac_pattern" >/dev/null 2>&1; then + $EGREP "$ac_pattern" >/dev/null 2>&1; then : ac_cv_prog_gcc_traditional=yes fi rm -f conftest* fi fi -echo "$as_me:$LINENO: result: $ac_cv_prog_gcc_traditional" >&5 -echo "${ECHO_T}$ac_cv_prog_gcc_traditional" >&6 +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_gcc_traditional" >&5 +$as_echo "$ac_cv_prog_gcc_traditional" >&6; } if test $ac_cv_prog_gcc_traditional = yes; then - CC="$CC -traditional" - fi -fi - -echo "$as_me:$LINENO: checking for function prototypes" >&5 -echo $ECHO_N "checking for function prototypes... $ECHO_C" >&6 -if test "$ac_cv_prog_cc_stdc" != no; then - echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6 - -cat >>confdefs.h <<\_ACEOF -#define PROTOTYPES 1 -_ACEOF - - -cat >>confdefs.h <<\_ACEOF -#define __PROTOTYPES 1 -_ACEOF - -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - -echo "$as_me:$LINENO: checking whether setvbuf arguments are reversed" >&5 -echo $ECHO_N "checking whether setvbuf arguments are reversed... $ECHO_C" >&6 -if test "${ac_cv_func_setvbuf_reversed+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_cv_func_setvbuf_reversed=no - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include -# if PROTOTYPES - int (setvbuf) (FILE *, int, char *, size_t); -# endif -int -main () -{ -char buf; return setvbuf (stdout, _IOLBF, &buf, 1); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include -# if PROTOTYPES - int (setvbuf) (FILE *, int, char *, size_t); -# endif -int -main () -{ -char buf; return setvbuf (stdout, &buf, _IOLBF, 1); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - # It compiles and links either way, so it must not be declared - # with a prototype and most likely this is a K&R C compiler. - # Try running it. - if test "$cross_compiling" = yes; then - : # Assume setvbuf is not reversed when cross-compiling. -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include -int -main () -{ -/* This call has the arguments reversed. - A reversed system may check and see that the address of buf - is not _IOLBF, _IONBF, or _IOFBF, and return nonzero. */ - char buf; - if (setvbuf (stdout, _IOLBF, &buf, 1) != 0) - exit (1); - putchar ('\r'); - exit (0); /* Non-reversed systems SEGV here. */ - ; - return 0; -} -_ACEOF -rm -f conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { ac_try='./conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_func_setvbuf_reversed=yes -else - echo "$as_me: program exited with status $ac_status" >&5 -echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -( exit $ac_status ) -rm -f core *.core -fi -rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext -fi - ac_cv_func_setvbuf_reversed=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: $ac_cv_func_setvbuf_reversed" >&5 -echo "${ECHO_T}$ac_cv_func_setvbuf_reversed" >&6 -if test $ac_cv_func_setvbuf_reversed = yes; then - -cat >>confdefs.h <<\_ACEOF -#define SETVBUF_REVERSED 1 -_ACEOF - -fi - -echo "$as_me:$LINENO: checking return type of signal handlers" >&5 -echo $ECHO_N "checking return type of signal handlers... $ECHO_C" >&6 -if test "${ac_cv_type_signal+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include -#include -#ifdef signal -# undef signal -#endif -#ifdef __cplusplus -extern "C" void (*signal (int, void (*)(int)))(int); -#else -void (*signal ()) (); -#endif - -int -main () -{ -int i; - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_type_signal=void -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_type_signal=int -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: $ac_cv_type_signal" >&5 -echo "${ECHO_T}$ac_cv_type_signal" >&6 - -cat >>confdefs.h <<_ACEOF -#define RETSIGTYPE $ac_cv_type_signal -_ACEOF - - - -for ac_func in vprintf -do -as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` -echo "$as_me:$LINENO: checking for $ac_func" >&5 -echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 -if eval "test \"\${$as_ac_var+set}\" = set"; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -/* Define $ac_func to an innocuous variant, in case declares $ac_func. - For example, HP-UX 11i declares gettimeofday. */ -#define $ac_func innocuous_$ac_func - -/* System header to define __stub macros and hopefully few prototypes, - which can conflict with char $ac_func (); below. - Prefer to if __STDC__ is defined, since - exists even on freestanding compilers. */ - -#ifdef __STDC__ -# include -#else -# include -#endif - -#undef $ac_func - -/* Override any gcc2 internal prototype to avoid an error. */ -#ifdef __cplusplus -extern "C" -{ -#endif -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char $ac_func (); -/* The GNU C library defines this for functions which it implements - to always fail with ENOSYS. Some functions are actually named - something starting with __ and the normal name is an alias. */ -#if defined (__stub_$ac_func) || defined (__stub___$ac_func) -choke me -#else -char (*f) () = $ac_func; -#endif -#ifdef __cplusplus -} -#endif - -int -main () -{ -return f != $ac_func; - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - eval "$as_ac_var=yes" -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -eval "$as_ac_var=no" -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 -echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 -if test `eval echo '${'$as_ac_var'}'` = yes; then - cat >>confdefs.h <<_ACEOF -#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 -_ACEOF - -echo "$as_me:$LINENO: checking for _doprnt" >&5 -echo $ECHO_N "checking for _doprnt... $ECHO_C" >&6 -if test "${ac_cv_func__doprnt+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -/* Define _doprnt to an innocuous variant, in case declares _doprnt. - For example, HP-UX 11i declares gettimeofday. */ -#define _doprnt innocuous__doprnt - -/* System header to define __stub macros and hopefully few prototypes, - which can conflict with char _doprnt (); below. - Prefer to if __STDC__ is defined, since - exists even on freestanding compilers. */ - -#ifdef __STDC__ -# include -#else -# include -#endif - -#undef _doprnt - -/* Override any gcc2 internal prototype to avoid an error. */ -#ifdef __cplusplus -extern "C" -{ -#endif -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char _doprnt (); -/* The GNU C library defines this for functions which it implements - to always fail with ENOSYS. Some functions are actually named - something starting with __ and the normal name is an alias. */ -#if defined (__stub__doprnt) || defined (__stub____doprnt) -choke me -#else -char (*f) () = _doprnt; -#endif -#ifdef __cplusplus -} -#endif - -int -main () -{ -return f != _doprnt; - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_func__doprnt=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_func__doprnt=no -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: $ac_cv_func__doprnt" >&5 -echo "${ECHO_T}$ac_cv_func__doprnt" >&6 -if test $ac_cv_func__doprnt = yes; then - -cat >>confdefs.h <<\_ACEOF -#define HAVE_DOPRNT 1 -_ACEOF - -fi - -fi -done - - - - - - - - - -for ac_func in mkdir mktime select socket strspn strcasecmp mkstemp -do -as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` -echo "$as_me:$LINENO: checking for $ac_func" >&5 -echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 -if eval "test \"\${$as_ac_var+set}\" = set"; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -/* Define $ac_func to an innocuous variant, in case declares $ac_func. - For example, HP-UX 11i declares gettimeofday. */ -#define $ac_func innocuous_$ac_func - -/* System header to define __stub macros and hopefully few prototypes, - which can conflict with char $ac_func (); below. - Prefer to if __STDC__ is defined, since - exists even on freestanding compilers. */ - -#ifdef __STDC__ -# include -#else -# include -#endif - -#undef $ac_func - -/* Override any gcc2 internal prototype to avoid an error. */ -#ifdef __cplusplus -extern "C" -{ -#endif -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char $ac_func (); -/* The GNU C library defines this for functions which it implements - to always fail with ENOSYS. Some functions are actually named - something starting with __ and the normal name is an alias. */ -#if defined (__stub_$ac_func) || defined (__stub___$ac_func) -choke me -#else -char (*f) () = $ac_func; -#endif -#ifdef __cplusplus -} -#endif + CC="$CC -traditional" + fi +fi + +if ${ac_cv_func_setvbuf_reversed+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_cv_func_setvbuf_reversed=no +fi + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking return type of signal handlers" >&5 +$as_echo_n "checking return type of signal handlers... " >&6; } +if ${ac_cv_type_signal+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +#include int main () { -return f != $ac_func; +return *(signal (0, 0)) (0) == 1; ; return 0; } _ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - eval "$as_ac_var=yes" +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_type_signal=int else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -eval "$as_ac_var=no" -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext + ac_cv_type_signal=void fi -echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 -echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 -if test `eval echo '${'$as_ac_var'}'` = yes; then - cat >>confdefs.h <<_ACEOF -#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 -_ACEOF - +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi -done - - +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_type_signal" >&5 +$as_echo "$ac_cv_type_signal" >&6; } +cat >>confdefs.h <<_ACEOF +#define RETSIGTYPE $ac_cv_type_signal +_ACEOF -for ac_func in rename statfs statvfs setproctitle -do -as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` -echo "$as_me:$LINENO: checking for $ac_func" >&5 -echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 -if eval "test \"\${$as_ac_var+set}\" = set"; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ +for ac_func in vprintf +do : + ac_fn_c_check_func "$LINENO" "vprintf" "ac_cv_func_vprintf" +if test "x$ac_cv_func_vprintf" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_VPRINTF 1 _ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -/* Define $ac_func to an innocuous variant, in case declares $ac_func. - For example, HP-UX 11i declares gettimeofday. */ -#define $ac_func innocuous_$ac_func -/* System header to define __stub macros and hopefully few prototypes, - which can conflict with char $ac_func (); below. - Prefer to if __STDC__ is defined, since - exists even on freestanding compilers. */ +ac_fn_c_check_func "$LINENO" "_doprnt" "ac_cv_func__doprnt" +if test "x$ac_cv_func__doprnt" = xyes; then : -#ifdef __STDC__ -# include -#else -# include -#endif +$as_echo "#define HAVE_DOPRNT 1" >>confdefs.h -#undef $ac_func +fi -/* Override any gcc2 internal prototype to avoid an error. */ -#ifdef __cplusplus -extern "C" -{ -#endif -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char $ac_func (); -/* The GNU C library defines this for functions which it implements - to always fail with ENOSYS. Some functions are actually named - something starting with __ and the normal name is an alias. */ -#if defined (__stub_$ac_func) || defined (__stub___$ac_func) -choke me -#else -char (*f) () = $ac_func; -#endif -#ifdef __cplusplus -} -#endif +fi +done -int -main () -{ -return f != $ac_func; - ; - return 0; -} + +for ac_func in mkdir mktime select socket strspn strcasecmp mkstemp +do : + as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` +ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" +if eval test \"x\$"$as_ac_var"\" = x"yes"; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - eval "$as_ac_var=yes" -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 -eval "$as_ac_var=no" fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 -echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 -if test `eval echo '${'$as_ac_var'}'` = yes; then +done + +for ac_func in rename statfs statvfs setproctitle +do : + as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` +ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" +if eval test \"x\$"$as_ac_var"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF -#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 +#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF fi done - ac_config_files="$ac_config_files Makefile" +ac_config_files="$ac_config_files Makefile" + cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure # tests run on this system so they can be shared between configure @@ -5256,39 +4461,70 @@ _ACEOF # The following way of writing the cache mishandles newlines in values, # but we know of no workaround that is simple, portable, and efficient. -# So, don't put newlines in cache variables' values. +# So, we kill variables containing newlines. # Ultrix sh set writes to stderr and can't be redirected directly, # and sets the high bit in the cache file unless we assign to the vars. -{ +( + for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do + eval ac_val=\$$ac_var + case $ac_val in #( + *${as_nl}*) + case $ac_var in #( + *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 +$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; + esac + case $ac_var in #( + _ | IFS | as_nl) ;; #( + BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( + *) { eval $ac_var=; unset $ac_var;} ;; + esac ;; + esac + done + (set) 2>&1 | - case `(ac_space=' '; set | grep ac_space) 2>&1` in - *ac_space=\ *) - # `set' does not quote correctly, so add quotes (double-quote - # substitution turns \\\\ into \\, and sed turns \\ into \). + case $as_nl`(ac_space=' '; set) 2>&1` in #( + *${as_nl}ac_space=\ *) + # `set' does not quote correctly, so add quotes: double-quote + # substitution turns \\\\ into \\, and sed turns \\ into \. sed -n \ "s/'/'\\\\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" - ;; + ;; #( *) # `set' quotes correctly as required by POSIX, so do not add quotes. - sed -n \ - "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" + sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" ;; - esac; -} | + esac | + sort +) | sed ' + /^ac_cv_env_/b end t clear - : clear + :clear s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ t end - /^ac_cv_env/!s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ - : end' >>confcache -if diff $cache_file confcache >/dev/null 2>&1; then :; else - if test -w $cache_file; then - test "x$cache_file" != "x/dev/null" && echo "updating cache $cache_file" - cat confcache >$cache_file + s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ + :end' >>confcache +if diff "$cache_file" confcache >/dev/null 2>&1; then :; else + if test -w "$cache_file"; then + if test "x$cache_file" != "x/dev/null"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5 +$as_echo "$as_me: updating cache $cache_file" >&6;} + if test ! -f "$cache_file" || test -h "$cache_file"; then + cat confcache >"$cache_file" + else + case $cache_file in #( + */* | ?:*) + mv -f confcache "$cache_file"$$ && + mv -f "$cache_file"$$ "$cache_file" ;; #( + *) + mv -f confcache "$cache_file" ;; + esac + fi + fi else - echo "not updating unwritable cache $cache_file" + { $as_echo "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5 +$as_echo "$as_me: not updating unwritable cache $cache_file" >&6;} fi fi rm -f confcache @@ -5297,32 +4533,19 @@ test "x$prefix" = xNONE && prefix=$ac_default_prefix # Let make expand exec_prefix. test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' -# VPATH may cause trouble with some makes, so we remove $(srcdir), -# ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and -# trailing colons and then remove the whole line if VPATH becomes empty -# (actually we leave an empty line to preserve line numbers). -if test "x$srcdir" = x.; then - ac_vpsub='/^[ ]*VPATH[ ]*=/{ -s/:*\$(srcdir):*/:/; -s/:*\${srcdir}:*/:/; -s/:*@srcdir@:*/:/; -s/^\([^=]*=[ ]*\):*/\1/; -s/:*$//; -s/^[^=]*=[ ]*$//; -}' -fi - DEFS=-DHAVE_CONFIG_H ac_libobjs= ac_ltlibobjs= +U= for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue # 1. Remove the extension, and $U if already installed. - ac_i=`echo "$ac_i" | - sed 's/\$U\././;s/\.o$//;s/\.obj$//'` - # 2. Add them. - ac_libobjs="$ac_libobjs $ac_i\$U.$ac_objext" - ac_ltlibobjs="$ac_ltlibobjs $ac_i"'$U.lo' + ac_script='s/\$U\././;s/\.o$//;s/\.obj$//' + ac_i=`$as_echo "$ac_i" | sed "$ac_script"` + # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR + # will be set to the directory where LIBOBJS objects are built. + as_fn_append ac_libobjs " \${LIBOBJDIR}$ac_i\$U.$ac_objext" + as_fn_append ac_ltlibobjs " \${LIBOBJDIR}$ac_i"'$U.lo' done LIBOBJS=$ac_libobjs @@ -5330,12 +4553,14 @@ LTLIBOBJS=$ac_ltlibobjs -: ${CONFIG_STATUS=./config.status} +: "${CONFIG_STATUS=./config.status}" +ac_write_fail=0 ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files $CONFIG_STATUS" -{ echo "$as_me:$LINENO: creating $CONFIG_STATUS" >&5 -echo "$as_me: creating $CONFIG_STATUS" >&6;} -cat >$CONFIG_STATUS <<_ACEOF +{ $as_echo "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5 +$as_echo "$as_me: creating $CONFIG_STATUS" >&6;} +as_write_fail=0 +cat >$CONFIG_STATUS <<_ASEOF || as_write_fail=1 #! $SHELL # Generated by $as_me. # Run this file to recreate the current configuration. @@ -5345,81 +4570,253 @@ cat >$CONFIG_STATUS <<_ACEOF debug=false ac_cs_recheck=false ac_cs_silent=false -SHELL=\${CONFIG_SHELL-$SHELL} -_ACEOF - -cat >>$CONFIG_STATUS <<\_ACEOF -## --------------------- ## -## M4sh Initialization. ## -## --------------------- ## -# Be Bourne compatible -if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then +SHELL=\${CONFIG_SHELL-$SHELL} +export SHELL +_ASEOF +cat >>$CONFIG_STATUS <<\_ASEOF || as_write_fail=1 +## -------------------- ## +## M4sh Initialization. ## +## -------------------- ## + +# Be more Bourne compatible +DUALCASE=1; export DUALCASE # for MKS sh +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : emulate sh NULLCMD=: - # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which + # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' -elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then - set -o posix + setopt NO_GLOB_SUBST +else + case `(set -o) 2>/dev/null` in #( + *posix*) : + set -o posix ;; #( + *) : + ;; +esac fi -DUALCASE=1; export DUALCASE # for MKS sh -# Support unset when possible. -if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then - as_unset=unset -else - as_unset=false + +as_nl=' +' +export as_nl +# Printing a long string crashes Solaris 7 /usr/bin/printf. +as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' +as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo +as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo +# Prefer a ksh shell builtin over an external printf program on Solaris, +# but without wasting forks for bash or zsh. +if test -z "$BASH_VERSION$ZSH_VERSION" \ + && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then + as_echo='print -r --' + as_echo_n='print -rn --' +elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then + as_echo='printf %s\n' + as_echo_n='printf %s' +else + if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then + as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' + as_echo_n='/usr/ucb/echo -n' + else + as_echo_body='eval expr "X$1" : "X\\(.*\\)"' + as_echo_n_body='eval + arg=$1; + case $arg in #( + *"$as_nl"*) + expr "X$arg" : "X\\(.*\\)$as_nl"; + arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; + esac; + expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" + ' + export as_echo_n_body + as_echo_n='sh -c $as_echo_n_body as_echo' + fi + export as_echo_body + as_echo='sh -c $as_echo_body as_echo' fi +# The user is always right. +if test "${PATH_SEPARATOR+set}" != set; then + PATH_SEPARATOR=: + (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { + (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || + PATH_SEPARATOR=';' + } +fi + + +# IFS +# We need space, tab and new line, in precisely that order. Quoting is +# there to prevent editors from complaining about space-tab. +# (If _AS_PATH_WALK were called with IFS unset, it would disable word +# splitting by setting IFS to empty value.) +IFS=" "" $as_nl" + +# Find who we are. Look in the path if we contain no directory separator. +as_myself= +case $0 in #(( + *[\\/]* ) as_myself=$0 ;; + *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break + done +IFS=$as_save_IFS -# Work around bugs in pre-3.0 UWIN ksh. -$as_unset ENV MAIL MAILPATH + ;; +esac +# We did not find ourselves, most probably we were run as `sh COMMAND' +# in which case we are not to be found in the path. +if test "x$as_myself" = x; then + as_myself=$0 +fi +if test ! -f "$as_myself"; then + $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 + exit 1 +fi + +# Unset variables that we do not need and which cause bugs (e.g. in +# pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" +# suppresses any "Segmentation fault" message there. '((' could +# trigger a bug in pdksh 5.2.14. +for as_var in BASH_ENV ENV MAIL MAILPATH +do eval test x\${$as_var+set} = xset \ + && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : +done PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. -for as_var in \ - LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ - LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ - LC_TELEPHONE LC_TIME -do - if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then - eval $as_var=C; export $as_var - else - $as_unset $as_var +LC_ALL=C +export LC_ALL +LANGUAGE=C +export LANGUAGE + +# CDPATH. +(unset CDPATH) >/dev/null 2>&1 && unset CDPATH + + +# as_fn_error STATUS ERROR [LINENO LOG_FD] +# ---------------------------------------- +# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are +# provided, also output the error to LOG_FD, referencing LINENO. Then exit the +# script with STATUS, using 1 if that was 0. +as_fn_error () +{ + as_status=$1; test $as_status -eq 0 && as_status=1 + if test "$4"; then + as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 fi -done + $as_echo "$as_me: error: $2" >&2 + as_fn_exit $as_status +} # as_fn_error + + +# as_fn_set_status STATUS +# ----------------------- +# Set $? to STATUS, without forking. +as_fn_set_status () +{ + return $1 +} # as_fn_set_status + +# as_fn_exit STATUS +# ----------------- +# Exit the shell with STATUS, even in a "trap 0" or "set -e" context. +as_fn_exit () +{ + set +e + as_fn_set_status $1 + exit $1 +} # as_fn_exit + +# as_fn_unset VAR +# --------------- +# Portably unset VAR. +as_fn_unset () +{ + { eval $1=; unset $1;} +} +as_unset=as_fn_unset +# as_fn_append VAR VALUE +# ---------------------- +# Append the text in VALUE to the end of the definition contained in VAR. Take +# advantage of any shell optimizations that allow amortized linear growth over +# repeated appends, instead of the typical quadratic growth present in naive +# implementations. +if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : + eval 'as_fn_append () + { + eval $1+=\$2 + }' +else + as_fn_append () + { + eval $1=\$$1\$2 + } +fi # as_fn_append + +# as_fn_arith ARG... +# ------------------ +# Perform arithmetic evaluation on the ARGs, and store the result in the +# global $as_val. Take advantage of shells that can avoid forks. The arguments +# must be portable across $(()) and expr. +if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : + eval 'as_fn_arith () + { + as_val=$(( $* )) + }' +else + as_fn_arith () + { + as_val=`expr "$@" || test $? -eq 1` + } +fi # as_fn_arith + -# Required to use basename. -if expr a : '\(a\)' >/dev/null 2>&1; then +if expr a : '\(a\)' >/dev/null 2>&1 && + test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi -if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then +if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi +if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then + as_dirname=dirname +else + as_dirname=false +fi -# Name of the executable. -as_me=`$as_basename "$0" || +as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ - X"$0" : 'X\(/\)$' \| \ - . : '\(.\)' 2>/dev/null || -echo X/"$0" | - sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; } - /^X\/\(\/\/\)$/{ s//\1/; q; } - /^X\/\(\/\).*/{ s//\1/; q; } - s/.*/./; q'` + X"$0" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X/"$0" | + sed '/^.*\/\([^/][^/]*\)\/*$/{ + s//\1/ + q + } + /^X\/\(\/\/\)$/{ + s//\1/ + q + } + /^X\/\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` - -# PATH needs CR, and LINENO needs CR and PATH. # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' @@ -5427,148 +4824,123 @@ as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits -# The user is always right. -if test "${PATH_SEPARATOR+set}" != set; then - echo "#! /bin/sh" >conf$$.sh - echo "exit 0" >>conf$$.sh - chmod +x conf$$.sh - if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then - PATH_SEPARATOR=';' - else - PATH_SEPARATOR=: - fi - rm -f conf$$.sh -fi - - - as_lineno_1=$LINENO - as_lineno_2=$LINENO - as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` - test "x$as_lineno_1" != "x$as_lineno_2" && - test "x$as_lineno_3" = "x$as_lineno_2" || { - # Find who we are. Look in the path if we contain no path at all - # relative or not. - case $0 in - *[\\/]* ) as_myself=$0 ;; - *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break -done - - ;; - esac - # We did not find ourselves, most probably we were run as `sh COMMAND' - # in which case we are not to be found in the path. - if test "x$as_myself" = x; then - as_myself=$0 - fi - if test ! -f "$as_myself"; then - { { echo "$as_me:$LINENO: error: cannot find myself; rerun with an absolute path" >&5 -echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2;} - { (exit 1); exit 1; }; } - fi - case $CONFIG_SHELL in - '') - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for as_base in sh bash ksh sh5; do - case $as_dir in - /*) - if ("$as_dir/$as_base" -c ' - as_lineno_1=$LINENO - as_lineno_2=$LINENO - as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` - test "x$as_lineno_1" != "x$as_lineno_2" && - test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then - $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; } - $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; } - CONFIG_SHELL=$as_dir/$as_base - export CONFIG_SHELL - exec "$CONFIG_SHELL" "$0" ${1+"$@"} - fi;; - esac - done -done -;; - esac - - # Create $as_me.lineno as a copy of $as_myself, but with $LINENO - # uniformly replaced by the line number. The first 'sed' inserts a - # line-number line before each line; the second 'sed' does the real - # work. The second script uses 'N' to pair each line-number line - # with the numbered line, and appends trailing '-' during - # substitution so that $LINENO is not a special case at line end. - # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the - # second 'sed' script. Blame Lee E. McMahon for sed's syntax. :-) - sed '=' <$as_myself | - sed ' - N - s,$,-, - : loop - s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3, - t loop - s,-$,, - s,^['$as_cr_digits']*\n,, - ' >$as_me.lineno && - chmod +x $as_me.lineno || - { { echo "$as_me:$LINENO: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&5 -echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2;} - { (exit 1); exit 1; }; } - - # Don't try to exec as it changes $[0], causing all sort of problems - # (the dirname of $[0] is not the place where we might find the - # original and so on. Autoconf is especially sensible to this). - . ./$as_me.lineno - # Exit status is that of the last command. - exit -} - - -case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in - *c*,-n*) ECHO_N= ECHO_C=' -' ECHO_T=' ' ;; - *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;; - *) ECHO_N= ECHO_C='\c' ECHO_T= ;; +ECHO_C= ECHO_N= ECHO_T= +case `echo -n x` in #((((( +-n*) + case `echo 'xy\c'` in + *c*) ECHO_T=' ';; # ECHO_T is single tab character. + xy) ECHO_C='\c';; + *) echo `echo ksh88 bug on AIX 6.1` > /dev/null + ECHO_T=' ';; + esac;; +*) + ECHO_N='-n';; esac -if expr a : '\(a\)' >/dev/null 2>&1; then - as_expr=expr +rm -f conf$$ conf$$.exe conf$$.file +if test -d conf$$.dir; then + rm -f conf$$.dir/conf$$.file else - as_expr=false + rm -f conf$$.dir + mkdir conf$$.dir 2>/dev/null fi - -rm -f conf$$ conf$$.exe conf$$.file -echo >conf$$.file -if ln -s conf$$.file conf$$ 2>/dev/null; then - # We could just check for DJGPP; but this test a) works b) is more generic - # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04). - if test -f conf$$.exe; then - # Don't use ln at all; we don't have any links - as_ln_s='cp -p' - else +if (echo >conf$$.file) 2>/dev/null; then + if ln -s conf$$.file conf$$ 2>/dev/null; then as_ln_s='ln -s' + # ... but there are two gotchas: + # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. + # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. + # In both cases, we have to default to `cp -p'. + ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || + as_ln_s='cp -p' + elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln + else + as_ln_s='cp -p' fi -elif ln conf$$.file conf$$ 2>/dev/null; then - as_ln_s=ln else as_ln_s='cp -p' fi -rm -f conf$$ conf$$.exe conf$$.file +rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file +rmdir conf$$.dir 2>/dev/null + + +# as_fn_mkdir_p +# ------------- +# Create "$as_dir" as a directory, including parents if necessary. +as_fn_mkdir_p () +{ + + case $as_dir in #( + -*) as_dir=./$as_dir;; + esac + test -d "$as_dir" || eval $as_mkdir_p || { + as_dirs= + while :; do + case $as_dir in #( + *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( + *) as_qdir=$as_dir;; + esac + as_dirs="'$as_qdir' $as_dirs" + as_dir=`$as_dirname -- "$as_dir" || +$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_dir" : 'X\(//\)[^/]' \| \ + X"$as_dir" : 'X\(//\)$' \| \ + X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$as_dir" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + test -d "$as_dir" && break + done + test -z "$as_dirs" || eval "mkdir $as_dirs" + } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" + +} # as_fn_mkdir_p if mkdir -p . 2>/dev/null; then - as_mkdir_p=: + as_mkdir_p='mkdir -p "$as_dir"' else test -d ./-p && rmdir ./-p as_mkdir_p=false fi -as_executable_p="test -f" +if test -x / >/dev/null 2>&1; then + as_test_x='test -x' +else + if ls -dL / >/dev/null 2>&1; then + as_ls_L_option=L + else + as_ls_L_option= + fi + as_test_x=' + eval sh -c '\'' + if test -d "$1"; then + test -d "$1/."; + else + case $1 in #( + -*)set "./$1";; + esac; + case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #(( + ???[sx]*):;;*)false;;esac;fi + '\'' sh + ' +fi +as_executable_p=$as_test_x # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" @@ -5577,31 +4949,20 @@ as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" -# IFS -# We need space, tab and new line, in precisely that order. -as_nl=' -' -IFS=" $as_nl" - -# CDPATH. -$as_unset CDPATH - exec 6>&1 - -# Open the log real soon, to keep \$[0] and so on meaningful, and to +## ----------------------------------- ## +## Main body of $CONFIG_STATUS script. ## +## ----------------------------------- ## +_ASEOF +test $as_write_fail = 0 && chmod +x $CONFIG_STATUS || ac_write_fail=1 + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +# Save the log message, to keep $0 and so on meaningful, and to # report actual input values of CONFIG_FILES etc. instead of their -# values after options handling. Logging --version etc. is OK. -exec 5>>config.log -{ - echo - sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX -## Running $as_me. ## -_ASBOX -} >&5 -cat >&5 <<_CSEOF - +# values after options handling. +ac_log=" This file was extended by bforce $as_me 0.22.9, which was -generated by GNU Autoconf 2.59. Invocation command line was +generated by GNU Autoconf 2.68. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS @@ -5609,45 +4970,46 @@ generated by GNU Autoconf 2.59. Invocation command line was CONFIG_COMMANDS = $CONFIG_COMMANDS $ $0 $@ -_CSEOF -echo "on `(hostname || uname -n) 2>/dev/null | sed 1q`" >&5 -echo >&5 +on `(hostname || uname -n) 2>/dev/null | sed 1q` +" + _ACEOF -# Files that config.status was made for. -if test -n "$ac_config_files"; then - echo "config_files=\"$ac_config_files\"" >>$CONFIG_STATUS -fi +case $ac_config_files in *" +"*) set x $ac_config_files; shift; ac_config_files=$*;; +esac -if test -n "$ac_config_headers"; then - echo "config_headers=\"$ac_config_headers\"" >>$CONFIG_STATUS -fi +case $ac_config_headers in *" +"*) set x $ac_config_headers; shift; ac_config_headers=$*;; +esac -if test -n "$ac_config_links"; then - echo "config_links=\"$ac_config_links\"" >>$CONFIG_STATUS -fi -if test -n "$ac_config_commands"; then - echo "config_commands=\"$ac_config_commands\"" >>$CONFIG_STATUS -fi +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +# Files that config.status was made for. +config_files="$ac_config_files" +config_headers="$ac_config_headers" -cat >>$CONFIG_STATUS <<\_ACEOF +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 ac_cs_usage="\ -\`$as_me' instantiates files from templates according to the -current configuration. +\`$as_me' instantiates files and other configuration actions +from templates according to the current configuration. Unless the files +and actions are specified as TAGs, all are instantiated by default. -Usage: $0 [OPTIONS] [FILE]... +Usage: $0 [OPTION]... [TAG]... -h, --help print this help, then exit - -V, --version print version number, then exit - -q, --quiet do not print progress messages + -V, --version print version number and configuration settings, then exit + --config print configuration, then exit + -q, --quiet, --silent + do not print progress messages -d, --debug don't remove temporary files --recheck update $as_me by reconfiguring in the same conditions - --file=FILE[:TEMPLATE] - instantiate the configuration file FILE - --header=FILE[:TEMPLATE] - instantiate the configuration header FILE + --file=FILE[:TEMPLATE] + instantiate the configuration file FILE + --header=FILE[:TEMPLATE] + instantiate the configuration header FILE Configuration files: $config_files @@ -5655,84 +5017,90 @@ $config_files Configuration headers: $config_headers -Report bugs to ." -_ACEOF +Report bugs to ." -cat >>$CONFIG_STATUS <<_ACEOF +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ bforce config.status 0.22.9 -configured by $0, generated by GNU Autoconf 2.59, - with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\" +configured by $0, generated by GNU Autoconf 2.68, + with options \\"\$ac_cs_config\\" -Copyright (C) 2003 Free Software Foundation, Inc. +Copyright (C) 2010 Free Software Foundation, Inc. This config.status script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it." -srcdir=$srcdir -INSTALL="$INSTALL" + +ac_pwd='$ac_pwd' +srcdir='$srcdir' +INSTALL='$INSTALL' +test -n "\$AWK" || AWK=awk _ACEOF -cat >>$CONFIG_STATUS <<\_ACEOF -# If no file are specified by the user, then we need to provide default -# value. By we need to know if files were specified by the user. +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +# The default lists apply if the user does not specify any file. ac_need_defaults=: while test $# != 0 do case $1 in - --*=*) - ac_option=`expr "x$1" : 'x\([^=]*\)='` - ac_optarg=`expr "x$1" : 'x[^=]*=\(.*\)'` + --*=?*) + ac_option=`expr "X$1" : 'X\([^=]*\)='` + ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'` + ac_shift=: + ;; + --*=) + ac_option=`expr "X$1" : 'X\([^=]*\)='` + ac_optarg= ac_shift=: ;; - -*) + *) ac_option=$1 ac_optarg=$2 ac_shift=shift ;; - *) # This is not an option, so the user has probably given explicit - # arguments. - ac_option=$1 - ac_need_defaults=false;; esac case $ac_option in # Handling of the options. -_ACEOF -cat >>$CONFIG_STATUS <<\_ACEOF -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) ac_cs_recheck=: ;; - --version | --vers* | -V ) - echo "$ac_cs_version"; exit 0 ;; - --he | --h) - # Conflict between --help and --header - { { echo "$as_me:$LINENO: error: ambiguous option: $1 -Try \`$0 --help' for more information." >&5 -echo "$as_me: error: ambiguous option: $1 -Try \`$0 --help' for more information." >&2;} - { (exit 1); exit 1; }; };; - --help | --hel | -h ) - echo "$ac_cs_usage"; exit 0 ;; - --debug | --d* | -d ) + --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) + $as_echo "$ac_cs_version"; exit ;; + --config | --confi | --conf | --con | --co | --c ) + $as_echo "$ac_cs_config"; exit ;; + --debug | --debu | --deb | --de | --d | -d ) debug=: ;; --file | --fil | --fi | --f ) $ac_shift - CONFIG_FILES="$CONFIG_FILES $ac_optarg" + case $ac_optarg in + *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; + '') as_fn_error $? "missing file argument" ;; + esac + as_fn_append CONFIG_FILES " '$ac_optarg'" ac_need_defaults=false;; --header | --heade | --head | --hea ) $ac_shift - CONFIG_HEADERS="$CONFIG_HEADERS $ac_optarg" + case $ac_optarg in + *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; + esac + as_fn_append CONFIG_HEADERS " '$ac_optarg'" ac_need_defaults=false;; + --he | --h) + # Conflict between --help and --header + as_fn_error $? "ambiguous option: \`$1' +Try \`$0 --help' for more information.";; + --help | --hel | -h ) + $as_echo "$ac_cs_usage"; exit ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil | --si | --s) ac_cs_silent=: ;; # This is an error. - -*) { { echo "$as_me:$LINENO: error: unrecognized option: $1 -Try \`$0 --help' for more information." >&5 -echo "$as_me: error: unrecognized option: $1 -Try \`$0 --help' for more information." >&2;} - { (exit 1); exit 1; }; } ;; + -*) as_fn_error $? "unrecognized option: \`$1' +Try \`$0 --help' for more information." ;; - *) ac_config_targets="$ac_config_targets $1" ;; + *) as_fn_append ac_config_targets " $1" + ac_need_defaults=false ;; esac shift @@ -5746,31 +5114,45 @@ if $ac_cs_silent; then fi _ACEOF -cat >>$CONFIG_STATUS <<_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 if \$ac_cs_recheck; then - echo "running $SHELL $0 " $ac_configure_args \$ac_configure_extra_args " --no-create --no-recursion" >&6 - exec $SHELL $0 $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion + set X '$SHELL' '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion + shift + \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6 + CONFIG_SHELL='$SHELL' + export CONFIG_SHELL + exec "\$@" fi _ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +exec 5>>config.log +{ + echo + sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX +## Running $as_me. ## +_ASBOX + $as_echo "$ac_log" +} >&5 +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 - - -cat >>$CONFIG_STATUS <<\_ACEOF +# Handling of arguments. for ac_config_target in $ac_config_targets do - case "$ac_config_target" in - # Handling of arguments. - "Makefile" ) CONFIG_FILES="$CONFIG_FILES Makefile" ;; - "include/config.h" ) CONFIG_HEADERS="$CONFIG_HEADERS include/config.h" ;; - *) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5 -echo "$as_me: error: invalid argument: $ac_config_target" >&2;} - { (exit 1); exit 1; }; };; + case $ac_config_target in + "include/config.h") CONFIG_HEADERS="$CONFIG_HEADERS include/config.h" ;; + "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; + + *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;; esac done + # If the user did not use the arguments to specify the items to instantiate, # then the envvar interface is used. Set only those that are not. # We use the long form for the default assignment because of an extremely @@ -5781,575 +5163,550 @@ if $ac_need_defaults; then fi # Have a temporary directory for convenience. Make it in the build tree -# simply because there is no reason to put it here, and in addition, +# simply because there is no reason against having it here, and in addition, # creating and moving files from /tmp can sometimes cause problems. -# Create a temporary directory, and hook for its removal unless debugging. +# Hook for its removal unless debugging. +# Note that there is a small window in which the directory will not be cleaned: +# after its creation but before its name has been assigned to `$tmp'. $debug || { - trap 'exit_status=$?; rm -rf $tmp && exit $exit_status' 0 - trap '{ (exit 1); exit 1; }' 1 2 13 15 + tmp= ac_tmp= + trap 'exit_status=$? + : "${ac_tmp:=$tmp}" + { test ! -d "$ac_tmp" || rm -fr "$ac_tmp"; } && exit $exit_status +' 0 + trap 'as_fn_exit 1' 1 2 13 15 } - # Create a (secure) tmp directory for tmp files. { - tmp=`(umask 077 && mktemp -d -q "./confstatXXXXXX") 2>/dev/null` && - test -n "$tmp" && test -d "$tmp" + tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && + test -d "$tmp" } || { - tmp=./confstat$$-$RANDOM - (umask 077 && mkdir $tmp) -} || + tmp=./conf$$-$RANDOM + (umask 077 && mkdir "$tmp") +} || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5 +ac_tmp=$tmp + +# Set up the scripts for CONFIG_FILES section. +# No need to generate them if there are no CONFIG_FILES. +# This happens for instance with `./config.status config.h'. +if test -n "$CONFIG_FILES"; then + + +ac_cr=`echo X | tr X '\015'` +# On cygwin, bash can eat \r inside `` if the user requested igncr. +# But we know of no other shell where ac_cr would be empty at this +# point, so we can use a bashism as a fallback. +if test "x$ac_cr" = x; then + eval ac_cr=\$\'\\r\' +fi +ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' /dev/null` +if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then + ac_cs_awk_cr='\\r' +else + ac_cs_awk_cr=$ac_cr +fi + +echo 'BEGIN {' >"$ac_tmp/subs1.awk" && +_ACEOF + + { - echo "$me: cannot create a temporary directory in ." >&2 - { (exit 1); exit 1; } + echo "cat >conf$$subs.awk <<_ACEOF" && + echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' && + echo "_ACEOF" +} >conf$$subs.sh || + as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 +ac_delim_num=`echo "$ac_subst_vars" | grep -c '^'` +ac_delim='%!_!# ' +for ac_last_try in false false false false false :; do + . ./conf$$subs.sh || + as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 + + ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X` + if test $ac_delim_n = $ac_delim_num; then + break + elif $ac_last_try; then + as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 + else + ac_delim="$ac_delim!$ac_delim _$ac_delim!! " + fi +done +rm -f conf$$subs.sh + +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +cat >>"\$ac_tmp/subs1.awk" <<\\_ACAWK && +_ACEOF +sed -n ' +h +s/^/S["/; s/!.*/"]=/ +p +g +s/^[^!]*!// +:repl +t repl +s/'"$ac_delim"'$// +t delim +:nl +h +s/\(.\{148\}\)..*/\1/ +t more1 +s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/ +p +n +b repl +:more1 +s/["\\]/\\&/g; s/^/"/; s/$/"\\/ +p +g +s/.\{148\}// +t nl +:delim +h +s/\(.\{148\}\)..*/\1/ +t more2 +s/["\\]/\\&/g; s/^/"/; s/$/"/ +p +b +:more2 +s/["\\]/\\&/g; s/^/"/; s/$/"\\/ +p +g +s/.\{148\}// +t delim +' >$CONFIG_STATUS || ac_write_fail=1 +rm -f conf$$subs.awk +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +_ACAWK +cat >>"\$ac_tmp/subs1.awk" <<_ACAWK && + for (key in S) S_is_set[key] = 1 + FS = "" -_ACEOF +} +{ + line = $ 0 + nfields = split(line, field, "@") + substed = 0 + len = length(field[1]) + for (i = 2; i < nfields; i++) { + key = field[i] + keylen = length(key) + if (S_is_set[key]) { + value = S[key] + line = substr(line, 1, len) "" value "" substr(line, len + keylen + 3) + len += length(value) + length(field[++i]) + substed = 1 + } else + len += 1 + keylen + } -cat >>$CONFIG_STATUS <<_ACEOF + print line +} -# -# CONFIG_FILES section. -# +_ACAWK +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then + sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g" +else + cat +fi < "$ac_tmp/subs1.awk" > "$ac_tmp/subs.awk" \ + || as_fn_error $? "could not setup config files machinery" "$LINENO" 5 +_ACEOF + +# VPATH may cause trouble with some makes, so we remove sole $(srcdir), +# ${srcdir} and @srcdir@ entries from VPATH if srcdir is ".", strip leading and +# trailing colons and then remove the whole line if VPATH becomes empty +# (actually we leave an empty line to preserve line numbers). +if test "x$srcdir" = x.; then + ac_vpsub='/^[ ]*VPATH[ ]*=[ ]*/{ +h +s/// +s/^/:/ +s/[ ]*$/:/ +s/:\$(srcdir):/:/g +s/:\${srcdir}:/:/g +s/:@srcdir@:/:/g +s/^:*// +s/:*$// +x +s/\(=[ ]*\).*/\1/ +G +s/\n// +s/^[^=]*=[ ]*$// +}' +fi -# No need to generate the scripts if there are no CONFIG_FILES. -# This happens for instance when ./config.status config.h -if test -n "\$CONFIG_FILES"; then - # Protect against being on the right side of a sed subst in config.status. - sed 's/,@/@@/; s/@,/@@/; s/,;t t\$/@;t t/; /@;t t\$/s/[\\\\&,]/\\\\&/g; - s/@@/,@/; s/@@/@,/; s/@;t t\$/,;t t/' >\$tmp/subs.sed <<\\CEOF -s,@SHELL@,$SHELL,;t t -s,@PATH_SEPARATOR@,$PATH_SEPARATOR,;t t -s,@PACKAGE_NAME@,$PACKAGE_NAME,;t t -s,@PACKAGE_TARNAME@,$PACKAGE_TARNAME,;t t -s,@PACKAGE_VERSION@,$PACKAGE_VERSION,;t t -s,@PACKAGE_STRING@,$PACKAGE_STRING,;t t -s,@PACKAGE_BUGREPORT@,$PACKAGE_BUGREPORT,;t t -s,@exec_prefix@,$exec_prefix,;t t -s,@prefix@,$prefix,;t t -s,@program_transform_name@,$program_transform_name,;t t -s,@bindir@,$bindir,;t t -s,@sbindir@,$sbindir,;t t -s,@libexecdir@,$libexecdir,;t t -s,@datadir@,$datadir,;t t -s,@sysconfdir@,$sysconfdir,;t t -s,@sharedstatedir@,$sharedstatedir,;t t -s,@localstatedir@,$localstatedir,;t t -s,@libdir@,$libdir,;t t -s,@includedir@,$includedir,;t t -s,@oldincludedir@,$oldincludedir,;t t -s,@infodir@,$infodir,;t t -s,@mandir@,$mandir,;t t -s,@build_alias@,$build_alias,;t t -s,@host_alias@,$host_alias,;t t -s,@target_alias@,$target_alias,;t t -s,@DEFS@,$DEFS,;t t -s,@ECHO_C@,$ECHO_C,;t t -s,@ECHO_N@,$ECHO_N,;t t -s,@ECHO_T@,$ECHO_T,;t t -s,@LIBS@,$LIBS,;t t -s,@build@,$build,;t t -s,@build_cpu@,$build_cpu,;t t -s,@build_vendor@,$build_vendor,;t t -s,@build_os@,$build_os,;t t -s,@host@,$host,;t t -s,@host_cpu@,$host_cpu,;t t -s,@host_vendor@,$host_vendor,;t t -s,@host_os@,$host_os,;t t -s,@target@,$target,;t t -s,@target_cpu@,$target_cpu,;t t -s,@target_vendor@,$target_vendor,;t t -s,@target_os@,$target_os,;t t -s,@OWNER@,$OWNER,;t t -s,@GROUP@,$GROUP,;t t -s,@SPOOLDIR@,$SPOOLDIR,;t t -s,@LOGDIR@,$LOGDIR,;t t -s,@YACC@,$YACC,;t t -s,@CC@,$CC,;t t -s,@CFLAGS@,$CFLAGS,;t t -s,@LDFLAGS@,$LDFLAGS,;t t -s,@CPPFLAGS@,$CPPFLAGS,;t t -s,@ac_ct_CC@,$ac_ct_CC,;t t -s,@EXEEXT@,$EXEEXT,;t t -s,@OBJEXT@,$OBJEXT,;t t -s,@INSTALL_PROGRAM@,$INSTALL_PROGRAM,;t t -s,@INSTALL_SCRIPT@,$INSTALL_SCRIPT,;t t -s,@INSTALL_DATA@,$INSTALL_DATA,;t t -s,@CPP@,$CPP,;t t -s,@EGREP@,$EGREP,;t t -s,@LIBOBJS@,$LIBOBJS,;t t -s,@LTLIBOBJS@,$LTLIBOBJS,;t t -CEOF +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +fi # test -n "$CONFIG_FILES" +# Set up the scripts for CONFIG_HEADERS section. +# No need to generate them if there are no CONFIG_HEADERS. +# This happens for instance with `./config.status Makefile'. +if test -n "$CONFIG_HEADERS"; then +cat >"$ac_tmp/defines.awk" <<\_ACAWK || +BEGIN { _ACEOF - cat >>$CONFIG_STATUS <<\_ACEOF - # Split the substitutions into bite-sized pieces for seds with - # small command number limits, like on Digital OSF/1 and HP-UX. - ac_max_sed_lines=48 - ac_sed_frag=1 # Number of current file. - ac_beg=1 # First line for current file. - ac_end=$ac_max_sed_lines # Line after last line for current file. - ac_more_lines=: - ac_sed_cmds= - while $ac_more_lines; do - if test $ac_beg -gt 1; then - sed "1,${ac_beg}d; ${ac_end}q" $tmp/subs.sed >$tmp/subs.frag - else - sed "${ac_end}q" $tmp/subs.sed >$tmp/subs.frag - fi - if test ! -s $tmp/subs.frag; then - ac_more_lines=false - else - # The purpose of the label and of the branching condition is to - # speed up the sed processing (if there are no `@' at all, there - # is no need to browse any of the substitutions). - # These are the two extra sed commands mentioned above. - (echo ':t - /@[a-zA-Z_][a-zA-Z_0-9]*@/!b' && cat $tmp/subs.frag) >$tmp/subs-$ac_sed_frag.sed - if test -z "$ac_sed_cmds"; then - ac_sed_cmds="sed -f $tmp/subs-$ac_sed_frag.sed" - else - ac_sed_cmds="$ac_sed_cmds | sed -f $tmp/subs-$ac_sed_frag.sed" - fi - ac_sed_frag=`expr $ac_sed_frag + 1` - ac_beg=$ac_end - ac_end=`expr $ac_end + $ac_max_sed_lines` - fi - done - if test -z "$ac_sed_cmds"; then - ac_sed_cmds=cat +# Transform confdefs.h into an awk script `defines.awk', embedded as +# here-document in config.status, that substitutes the proper values into +# config.h.in to produce config.h. + +# Create a delimiter string that does not exist in confdefs.h, to ease +# handling of long lines. +ac_delim='%!_!# ' +for ac_last_try in false false :; do + ac_tt=`sed -n "/$ac_delim/p" confdefs.h` + if test -z "$ac_tt"; then + break + elif $ac_last_try; then + as_fn_error $? "could not make $CONFIG_HEADERS" "$LINENO" 5 + else + ac_delim="$ac_delim!$ac_delim _$ac_delim!! " fi -fi # test -n "$CONFIG_FILES" +done +# For the awk script, D is an array of macro values keyed by name, +# likewise P contains macro parameters if any. Preserve backslash +# newline sequences. + +ac_word_re=[_$as_cr_Letters][_$as_cr_alnum]* +sed -n ' +s/.\{148\}/&'"$ac_delim"'/g +t rset +:rset +s/^[ ]*#[ ]*define[ ][ ]*/ / +t def +d +:def +s/\\$// +t bsnl +s/["\\]/\\&/g +s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ +D["\1"]=" \3"/p +s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2"/p +d +:bsnl +s/["\\]/\\&/g +s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ +D["\1"]=" \3\\\\\\n"\\/p +t cont +s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2\\\\\\n"\\/p +t cont +d +:cont +n +s/.\{148\}/&'"$ac_delim"'/g +t clear +:clear +s/\\$// +t bsnlc +s/["\\]/\\&/g; s/^/"/; s/$/"/p +d +:bsnlc +s/["\\]/\\&/g; s/^/"/; s/$/\\\\\\n"\\/p +b cont +' >$CONFIG_STATUS || ac_write_fail=1 + +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 + for (key in D) D_is_set[key] = 1 + FS = "" +} +/^[\t ]*#[\t ]*(define|undef)[\t ]+$ac_word_re([\t (]|\$)/ { + line = \$ 0 + split(line, arg, " ") + if (arg[1] == "#") { + defundef = arg[2] + mac1 = arg[3] + } else { + defundef = substr(arg[1], 2) + mac1 = arg[2] + } + split(mac1, mac2, "(") #) + macro = mac2[1] + prefix = substr(line, 1, index(line, defundef) - 1) + if (D_is_set[macro]) { + # Preserve the white space surrounding the "#". + print prefix "define", macro P[macro] D[macro] + next + } else { + # Replace #undef with comments. This is necessary, for example, + # in the case of _POSIX_SOURCE, which is predefined and required + # on some systems where configure will not decide to define it. + if (defundef == "undef") { + print "/*", prefix defundef, macro, "*/" + next + } + } +} +{ print } +_ACAWK _ACEOF -cat >>$CONFIG_STATUS <<\_ACEOF -for ac_file in : $CONFIG_FILES; do test "x$ac_file" = x: && continue - # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". - case $ac_file in - - | *:- | *:-:* ) # input from stdin - cat >$tmp/stdin - ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` - ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; - *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` - ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; - * ) ac_file_in=$ac_file.in ;; +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 + as_fn_error $? "could not setup config headers machinery" "$LINENO" 5 +fi # test -n "$CONFIG_HEADERS" + + +eval set X " :F $CONFIG_FILES :H $CONFIG_HEADERS " +shift +for ac_tag +do + case $ac_tag in + :[FHLC]) ac_mode=$ac_tag; continue;; + esac + case $ac_mode$ac_tag in + :[FHL]*:*);; + :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5;; + :[FH]-) ac_tag=-:-;; + :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; + esac + ac_save_IFS=$IFS + IFS=: + set x $ac_tag + IFS=$ac_save_IFS + shift + ac_file=$1 + shift + + case $ac_mode in + :L) ac_source=$1;; + :[FH]) + ac_file_inputs= + for ac_f + do + case $ac_f in + -) ac_f="$ac_tmp/stdin";; + *) # Look for the file first in the build tree, then in the source tree + # (if the path is not absolute). The absolute path cannot be DOS-style, + # because $ac_f cannot contain `:'. + test -f "$ac_f" || + case $ac_f in + [\\/$]*) false;; + *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; + esac || + as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5;; + esac + case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac + as_fn_append ac_file_inputs " '$ac_f'" + done + + # Let's still pretend it is `configure' which instantiates (i.e., don't + # use $as_me), people would be surprised to read: + # /* config.h. Generated by config.status. */ + configure_input='Generated from '` + $as_echo "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g' + `' by configure.' + if test x"$ac_file" != x-; then + configure_input="$ac_file. $configure_input" + { $as_echo "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5 +$as_echo "$as_me: creating $ac_file" >&6;} + fi + # Neutralize special characters interpreted by sed in replacement strings. + case $configure_input in #( + *\&* | *\|* | *\\* ) + ac_sed_conf_input=`$as_echo "$configure_input" | + sed 's/[\\\\&|]/\\\\&/g'`;; #( + *) ac_sed_conf_input=$configure_input;; + esac + + case $ac_tag in + *:-:* | *:-) cat >"$ac_tmp/stdin" \ + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; + esac + ;; esac - # Compute @srcdir@, @top_srcdir@, and @INSTALL@ for subdirectories. - ac_dir=`(dirname "$ac_file") 2>/dev/null || + ac_dir=`$as_dirname -- "$ac_file" || $as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$ac_file" : 'X\(//\)[^/]' \| \ X"$ac_file" : 'X\(//\)$' \| \ - X"$ac_file" : 'X\(/\)' \| \ - . : '\(.\)' 2>/dev/null || -echo X"$ac_file" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } - /^X\(\/\/\)[^/].*/{ s//\1/; q; } - /^X\(\/\/\)$/{ s//\1/; q; } - /^X\(\/\).*/{ s//\1/; q; } - s/.*/./; q'` - { if $as_mkdir_p; then - mkdir -p "$ac_dir" - else - as_dir="$ac_dir" - as_dirs= - while test ! -d "$as_dir"; do - as_dirs="$as_dir $as_dirs" - as_dir=`(dirname "$as_dir") 2>/dev/null || -$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$as_dir" : 'X\(//\)[^/]' \| \ - X"$as_dir" : 'X\(//\)$' \| \ - X"$as_dir" : 'X\(/\)' \| \ - . : '\(.\)' 2>/dev/null || -echo X"$as_dir" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } - /^X\(\/\/\)[^/].*/{ s//\1/; q; } - /^X\(\/\/\)$/{ s//\1/; q; } - /^X\(\/\).*/{ s//\1/; q; } - s/.*/./; q'` - done - test ! -n "$as_dirs" || mkdir $as_dirs - fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5 -echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;} - { (exit 1); exit 1; }; }; } - + X"$ac_file" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$ac_file" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + as_dir="$ac_dir"; as_fn_mkdir_p ac_builddir=. -if test "$ac_dir" != .; then - ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` - # A "../" for each directory in $ac_dir_suffix. - ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'` -else - ac_dir_suffix= ac_top_builddir= -fi +case "$ac_dir" in +.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; +*) + ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` + # A ".." for each directory in $ac_dir_suffix. + ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` + case $ac_top_builddir_sub in + "") ac_top_builddir_sub=. ac_top_build_prefix= ;; + *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; + esac ;; +esac +ac_abs_top_builddir=$ac_pwd +ac_abs_builddir=$ac_pwd$ac_dir_suffix +# for backward compatibility: +ac_top_builddir=$ac_top_build_prefix case $srcdir in - .) # No --srcdir option. We are building in place. + .) # We are building in place. ac_srcdir=. - if test -z "$ac_top_builddir"; then - ac_top_srcdir=. - else - ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'` - fi ;; - [\\/]* | ?:[\\/]* ) # Absolute path. + ac_top_srcdir=$ac_top_builddir_sub + ac_abs_top_srcdir=$ac_pwd ;; + [\\/]* | ?:[\\/]* ) # Absolute name. ac_srcdir=$srcdir$ac_dir_suffix; - ac_top_srcdir=$srcdir ;; - *) # Relative path. - ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix - ac_top_srcdir=$ac_top_builddir$srcdir ;; + ac_top_srcdir=$srcdir + ac_abs_top_srcdir=$srcdir ;; + *) # Relative name. + ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_top_build_prefix$srcdir + ac_abs_top_srcdir=$ac_pwd/$srcdir ;; esac +ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix -# Do not use `cd foo && pwd` to compute absolute paths, because -# the directories may not exist. -case `pwd` in -.) ac_abs_builddir="$ac_dir";; -*) - case "$ac_dir" in - .) ac_abs_builddir=`pwd`;; - [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";; - *) ac_abs_builddir=`pwd`/"$ac_dir";; - esac;; -esac -case $ac_abs_builddir in -.) ac_abs_top_builddir=${ac_top_builddir}.;; -*) - case ${ac_top_builddir}. in - .) ac_abs_top_builddir=$ac_abs_builddir;; - [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;; - *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;; - esac;; -esac -case $ac_abs_builddir in -.) ac_abs_srcdir=$ac_srcdir;; -*) - case $ac_srcdir in - .) ac_abs_srcdir=$ac_abs_builddir;; - [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;; - *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;; - esac;; -esac -case $ac_abs_builddir in -.) ac_abs_top_srcdir=$ac_top_srcdir;; -*) - case $ac_top_srcdir in - .) ac_abs_top_srcdir=$ac_abs_builddir;; - [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;; - *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;; - esac;; -esac + case $ac_mode in + :F) + # + # CONFIG_FILE + # case $INSTALL in [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; - *) ac_INSTALL=$ac_top_builddir$INSTALL ;; + *) ac_INSTALL=$ac_top_build_prefix$INSTALL ;; esac +_ACEOF - # Let's still pretend it is `configure' which instantiates (i.e., don't - # use $as_me), people would be surprised to read: - # /* config.h. Generated by config.status. */ - if test x"$ac_file" = x-; then - configure_input= - else - configure_input="$ac_file. " - fi - configure_input=$configure_input"Generated from `echo $ac_file_in | - sed 's,.*/,,'` by configure." - - # First look for the input files in the build tree, otherwise in the - # src tree. - ac_file_inputs=`IFS=: - for f in $ac_file_in; do - case $f in - -) echo $tmp/stdin ;; - [\\/$]*) - # Absolute (can't be DOS-style, as IFS=:) - test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 -echo "$as_me: error: cannot find input file: $f" >&2;} - { (exit 1); exit 1; }; } - echo "$f";; - *) # Relative - if test -f "$f"; then - # Build tree - echo "$f" - elif test -f "$srcdir/$f"; then - # Source tree - echo "$srcdir/$f" - else - # /dev/null tree - { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 -echo "$as_me: error: cannot find input file: $f" >&2;} - { (exit 1); exit 1; }; } - fi;; - esac - done` || { (exit 1); exit 1; } - - if test x"$ac_file" != x-; then - { echo "$as_me:$LINENO: creating $ac_file" >&5 -echo "$as_me: creating $ac_file" >&6;} - rm -f "$ac_file" - fi +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +# If the template does not know about datarootdir, expand it. +# FIXME: This hack should be removed a few years after 2.60. +ac_datarootdir_hack=; ac_datarootdir_seen= +ac_sed_dataroot=' +/datarootdir/ { + p + q +} +/@datadir@/p +/@docdir@/p +/@infodir@/p +/@localedir@/p +/@mandir@/p' +case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in +*datarootdir*) ac_datarootdir_seen=yes;; +*@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 +$as_echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 + ac_datarootdir_hack=' + s&@datadir@&$datadir&g + s&@docdir@&$docdir&g + s&@infodir@&$infodir&g + s&@localedir@&$localedir&g + s&@mandir@&$mandir&g + s&\\\${datarootdir}&$datarootdir&g' ;; +esac _ACEOF -cat >>$CONFIG_STATUS <<_ACEOF - sed "$ac_vpsub + +# Neutralize VPATH when `$srcdir' = `.'. +# Shell code in configure.ac might set extrasub. +# FIXME: do we really want to maintain this feature? +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +ac_sed_extra="$ac_vpsub $extrasub _ACEOF -cat >>$CONFIG_STATUS <<\_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 :t /@[a-zA-Z_][a-zA-Z_0-9]*@/!b -s,@configure_input@,$configure_input,;t t -s,@srcdir@,$ac_srcdir,;t t -s,@abs_srcdir@,$ac_abs_srcdir,;t t -s,@top_srcdir@,$ac_top_srcdir,;t t -s,@abs_top_srcdir@,$ac_abs_top_srcdir,;t t -s,@builddir@,$ac_builddir,;t t -s,@abs_builddir@,$ac_abs_builddir,;t t -s,@top_builddir@,$ac_top_builddir,;t t -s,@abs_top_builddir@,$ac_abs_top_builddir,;t t -s,@INSTALL@,$ac_INSTALL,;t t -" $ac_file_inputs | (eval "$ac_sed_cmds") >$tmp/out - rm -f $tmp/stdin +s|@configure_input@|$ac_sed_conf_input|;t t +s&@top_builddir@&$ac_top_builddir_sub&;t t +s&@top_build_prefix@&$ac_top_build_prefix&;t t +s&@srcdir@&$ac_srcdir&;t t +s&@abs_srcdir@&$ac_abs_srcdir&;t t +s&@top_srcdir@&$ac_top_srcdir&;t t +s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t +s&@builddir@&$ac_builddir&;t t +s&@abs_builddir@&$ac_abs_builddir&;t t +s&@abs_top_builddir@&$ac_abs_top_builddir&;t t +s&@INSTALL@&$ac_INSTALL&;t t +$ac_datarootdir_hack +" +eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$ac_tmp/subs.awk" \ + >$ac_tmp/out || as_fn_error $? "could not create $ac_file" "$LINENO" 5 + +test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && + { ac_out=`sed -n '/\${datarootdir}/p' "$ac_tmp/out"`; test -n "$ac_out"; } && + { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' \ + "$ac_tmp/out"`; test -z "$ac_out"; } && + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir' +which seems to be undefined. Please make sure it is defined" >&5 +$as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' +which seems to be undefined. Please make sure it is defined" >&2;} + + rm -f "$ac_tmp/stdin" + case $ac_file in + -) cat "$ac_tmp/out" && rm -f "$ac_tmp/out";; + *) rm -f "$ac_file" && mv "$ac_tmp/out" "$ac_file";; + esac \ + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 + ;; + :H) + # + # CONFIG_HEADER + # if test x"$ac_file" != x-; then - mv $tmp/out $ac_file + { + $as_echo "/* $configure_input */" \ + && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" + } >"$ac_tmp/config.h" \ + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 + if diff "$ac_file" "$ac_tmp/config.h" >/dev/null 2>&1; then + { $as_echo "$as_me:${as_lineno-$LINENO}: $ac_file is unchanged" >&5 +$as_echo "$as_me: $ac_file is unchanged" >&6;} + else + rm -f "$ac_file" + mv "$ac_tmp/config.h" "$ac_file" \ + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 + fi else - cat $tmp/out - rm -f $tmp/out + $as_echo "/* $configure_input */" \ + && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" \ + || as_fn_error $? "could not create -" "$LINENO" 5 fi + ;; -done -_ACEOF -cat >>$CONFIG_STATUS <<\_ACEOF - -# -# CONFIG_HEADER section. -# -# These sed commands are passed to sed as "A NAME B NAME C VALUE D", where -# NAME is the cpp macro being defined and VALUE is the value it is being given. -# -# ac_d sets the value in "#define NAME VALUE" lines. -ac_dA='s,^\([ ]*\)#\([ ]*define[ ][ ]*\)' -ac_dB='[ ].*$,\1#\2' -ac_dC=' ' -ac_dD=',;t' -# ac_u turns "#undef NAME" without trailing blanks into "#define NAME VALUE". -ac_uA='s,^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)' -ac_uB='$,\1#\2define\3' -ac_uC=' ' -ac_uD=',;t' - -for ac_file in : $CONFIG_HEADERS; do test "x$ac_file" = x: && continue - # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". - case $ac_file in - - | *:- | *:-:* ) # input from stdin - cat >$tmp/stdin - ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` - ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; - *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` - ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; - * ) ac_file_in=$ac_file.in ;; esac - test x"$ac_file" != x- && { echo "$as_me:$LINENO: creating $ac_file" >&5 -echo "$as_me: creating $ac_file" >&6;} - - # First look for the input files in the build tree, otherwise in the - # src tree. - ac_file_inputs=`IFS=: - for f in $ac_file_in; do - case $f in - -) echo $tmp/stdin ;; - [\\/$]*) - # Absolute (can't be DOS-style, as IFS=:) - test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 -echo "$as_me: error: cannot find input file: $f" >&2;} - { (exit 1); exit 1; }; } - # Do quote $f, to prevent DOS paths from being IFS'd. - echo "$f";; - *) # Relative - if test -f "$f"; then - # Build tree - echo "$f" - elif test -f "$srcdir/$f"; then - # Source tree - echo "$srcdir/$f" - else - # /dev/null tree - { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 -echo "$as_me: error: cannot find input file: $f" >&2;} - { (exit 1); exit 1; }; } - fi;; - esac - done` || { (exit 1); exit 1; } - # Remove the trailing spaces. - sed 's/[ ]*$//' $ac_file_inputs >$tmp/in - -_ACEOF - -# Transform confdefs.h into two sed scripts, `conftest.defines' and -# `conftest.undefs', that substitutes the proper values into -# config.h.in to produce config.h. The first handles `#define' -# templates, and the second `#undef' templates. -# And first: Protect against being on the right side of a sed subst in -# config.status. Protect against being in an unquoted here document -# in config.status. -rm -f conftest.defines conftest.undefs -# Using a here document instead of a string reduces the quoting nightmare. -# Putting comments in sed scripts is not portable. -# -# `end' is used to avoid that the second main sed command (meant for -# 0-ary CPP macros) applies to n-ary macro definitions. -# See the Autoconf documentation for `clear'. -cat >confdef2sed.sed <<\_ACEOF -s/[\\&,]/\\&/g -s,[\\$`],\\&,g -t clear -: clear -s,^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*\)\(([^)]*)\)[ ]*\(.*\)$,${ac_dA}\1${ac_dB}\1\2${ac_dC}\3${ac_dD},gp -t end -s,^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\)$,${ac_dA}\1${ac_dB}\1${ac_dC}\2${ac_dD},gp -: end -_ACEOF -# If some macros were called several times there might be several times -# the same #defines, which is useless. Nevertheless, we may not want to -# sort them, since we want the *last* AC-DEFINE to be honored. -uniq confdefs.h | sed -n -f confdef2sed.sed >conftest.defines -sed 's/ac_d/ac_u/g' conftest.defines >conftest.undefs -rm -f confdef2sed.sed - -# This sed command replaces #undef with comments. This is necessary, for -# example, in the case of _POSIX_SOURCE, which is predefined and required -# on some systems where configure will not decide to define it. -cat >>conftest.undefs <<\_ACEOF -s,^[ ]*#[ ]*undef[ ][ ]*[a-zA-Z_][a-zA-Z_0-9]*,/* & */, -_ACEOF - -# Break up conftest.defines because some shells have a limit on the size -# of here documents, and old seds have small limits too (100 cmds). -echo ' # Handle all the #define templates only if necessary.' >>$CONFIG_STATUS -echo ' if grep "^[ ]*#[ ]*define" $tmp/in >/dev/null; then' >>$CONFIG_STATUS -echo ' # If there are no defines, we may have an empty if/fi' >>$CONFIG_STATUS -echo ' :' >>$CONFIG_STATUS -rm -f conftest.tail -while grep . conftest.defines >/dev/null -do - # Write a limited-size here document to $tmp/defines.sed. - echo ' cat >$tmp/defines.sed <>$CONFIG_STATUS - # Speed up: don't consider the non `#define' lines. - echo '/^[ ]*#[ ]*define/!b' >>$CONFIG_STATUS - # Work around the forget-to-reset-the-flag bug. - echo 't clr' >>$CONFIG_STATUS - echo ': clr' >>$CONFIG_STATUS - sed ${ac_max_here_lines}q conftest.defines >>$CONFIG_STATUS - echo 'CEOF - sed -f $tmp/defines.sed $tmp/in >$tmp/out - rm -f $tmp/in - mv $tmp/out $tmp/in -' >>$CONFIG_STATUS - sed 1,${ac_max_here_lines}d conftest.defines >conftest.tail - rm -f conftest.defines - mv conftest.tail conftest.defines -done -rm -f conftest.defines -echo ' fi # grep' >>$CONFIG_STATUS -echo >>$CONFIG_STATUS - -# Break up conftest.undefs because some shells have a limit on the size -# of here documents, and old seds have small limits too (100 cmds). -echo ' # Handle all the #undef templates' >>$CONFIG_STATUS -rm -f conftest.tail -while grep . conftest.undefs >/dev/null -do - # Write a limited-size here document to $tmp/undefs.sed. - echo ' cat >$tmp/undefs.sed <>$CONFIG_STATUS - # Speed up: don't consider the non `#undef' - echo '/^[ ]*#[ ]*undef/!b' >>$CONFIG_STATUS - # Work around the forget-to-reset-the-flag bug. - echo 't clr' >>$CONFIG_STATUS - echo ': clr' >>$CONFIG_STATUS - sed ${ac_max_here_lines}q conftest.undefs >>$CONFIG_STATUS - echo 'CEOF - sed -f $tmp/undefs.sed $tmp/in >$tmp/out - rm -f $tmp/in - mv $tmp/out $tmp/in -' >>$CONFIG_STATUS - sed 1,${ac_max_here_lines}d conftest.undefs >conftest.tail - rm -f conftest.undefs - mv conftest.tail conftest.undefs -done -rm -f conftest.undefs - -cat >>$CONFIG_STATUS <<\_ACEOF - # Let's still pretend it is `configure' which instantiates (i.e., don't - # use $as_me), people would be surprised to read: - # /* config.h. Generated by config.status. */ - if test x"$ac_file" = x-; then - echo "/* Generated by configure. */" >$tmp/config.h - else - echo "/* $ac_file. Generated by configure. */" >$tmp/config.h - fi - cat $tmp/in >>$tmp/config.h - rm -f $tmp/in - if test x"$ac_file" != x-; then - if diff $ac_file $tmp/config.h >/dev/null 2>&1; then - { echo "$as_me:$LINENO: $ac_file is unchanged" >&5 -echo "$as_me: $ac_file is unchanged" >&6;} - else - ac_dir=`(dirname "$ac_file") 2>/dev/null || -$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$ac_file" : 'X\(//\)[^/]' \| \ - X"$ac_file" : 'X\(//\)$' \| \ - X"$ac_file" : 'X\(/\)' \| \ - . : '\(.\)' 2>/dev/null || -echo X"$ac_file" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } - /^X\(\/\/\)[^/].*/{ s//\1/; q; } - /^X\(\/\/\)$/{ s//\1/; q; } - /^X\(\/\).*/{ s//\1/; q; } - s/.*/./; q'` - { if $as_mkdir_p; then - mkdir -p "$ac_dir" - else - as_dir="$ac_dir" - as_dirs= - while test ! -d "$as_dir"; do - as_dirs="$as_dir $as_dirs" - as_dir=`(dirname "$as_dir") 2>/dev/null || -$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$as_dir" : 'X\(//\)[^/]' \| \ - X"$as_dir" : 'X\(//\)$' \| \ - X"$as_dir" : 'X\(/\)' \| \ - . : '\(.\)' 2>/dev/null || -echo X"$as_dir" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } - /^X\(\/\/\)[^/].*/{ s//\1/; q; } - /^X\(\/\/\)$/{ s//\1/; q; } - /^X\(\/\).*/{ s//\1/; q; } - s/.*/./; q'` - done - test ! -n "$as_dirs" || mkdir $as_dirs - fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5 -echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;} - { (exit 1); exit 1; }; }; } - - rm -f $ac_file - mv $tmp/config.h $ac_file - fi - else - cat $tmp/config.h - rm -f $tmp/config.h - fi -done -_ACEOF +done # for ac_tag -cat >>$CONFIG_STATUS <<\_ACEOF -{ (exit 0); exit 0; } +as_fn_exit 0 _ACEOF -chmod +x $CONFIG_STATUS ac_clean_files=$ac_clean_files_save +test $ac_write_fail = 0 || + as_fn_error $? "write failure creating $CONFIG_STATUS" "$LINENO" 5 + # configure is writing to config.log, and then calls config.status. # config.status does its own redirection, appending to config.log. @@ -6369,10 +5726,15 @@ if test "$no_create" != yes; then exec 5>>config.log # Use ||, not &&, to avoid exiting from the if with $? = 1, which # would make configure fail if this is the last instruction. - $ac_cs_success || { (exit 1); exit 1; } + $ac_cs_success || as_fn_exit 1 fi +if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5 +$as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} +fi + +ac_config_files="$ac_config_files ../debian/Makefile" - ac_config_files="$ac_config_files ../debian/Makefile" cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure # tests run on this system so they can be shared between configure @@ -6391,39 +5753,70 @@ _ACEOF # The following way of writing the cache mishandles newlines in values, # but we know of no workaround that is simple, portable, and efficient. -# So, don't put newlines in cache variables' values. +# So, we kill variables containing newlines. # Ultrix sh set writes to stderr and can't be redirected directly, # and sets the high bit in the cache file unless we assign to the vars. -{ +( + for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do + eval ac_val=\$$ac_var + case $ac_val in #( + *${as_nl}*) + case $ac_var in #( + *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 +$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; + esac + case $ac_var in #( + _ | IFS | as_nl) ;; #( + BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( + *) { eval $ac_var=; unset $ac_var;} ;; + esac ;; + esac + done + (set) 2>&1 | - case `(ac_space=' '; set | grep ac_space) 2>&1` in - *ac_space=\ *) - # `set' does not quote correctly, so add quotes (double-quote - # substitution turns \\\\ into \\, and sed turns \\ into \). + case $as_nl`(ac_space=' '; set) 2>&1` in #( + *${as_nl}ac_space=\ *) + # `set' does not quote correctly, so add quotes: double-quote + # substitution turns \\\\ into \\, and sed turns \\ into \. sed -n \ "s/'/'\\\\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" - ;; + ;; #( *) # `set' quotes correctly as required by POSIX, so do not add quotes. - sed -n \ - "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" + sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" ;; - esac; -} | + esac | + sort +) | sed ' + /^ac_cv_env_/b end t clear - : clear + :clear s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ t end - /^ac_cv_env/!s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ - : end' >>confcache -if diff $cache_file confcache >/dev/null 2>&1; then :; else - if test -w $cache_file; then - test "x$cache_file" != "x/dev/null" && echo "updating cache $cache_file" - cat confcache >$cache_file + s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ + :end' >>confcache +if diff "$cache_file" confcache >/dev/null 2>&1; then :; else + if test -w "$cache_file"; then + if test "x$cache_file" != "x/dev/null"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5 +$as_echo "$as_me: updating cache $cache_file" >&6;} + if test ! -f "$cache_file" || test -h "$cache_file"; then + cat confcache >"$cache_file" + else + case $cache_file in #( + */* | ?:*) + mv -f confcache "$cache_file"$$ && + mv -f "$cache_file"$$ "$cache_file" ;; #( + *) + mv -f confcache "$cache_file" ;; + esac + fi + fi else - echo "not updating unwritable cache $cache_file" + { $as_echo "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5 +$as_echo "$as_me: not updating unwritable cache $cache_file" >&6;} fi fi rm -f confcache @@ -6432,32 +5825,19 @@ test "x$prefix" = xNONE && prefix=$ac_default_prefix # Let make expand exec_prefix. test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' -# VPATH may cause trouble with some makes, so we remove $(srcdir), -# ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and -# trailing colons and then remove the whole line if VPATH becomes empty -# (actually we leave an empty line to preserve line numbers). -if test "x$srcdir" = x.; then - ac_vpsub='/^[ ]*VPATH[ ]*=/{ -s/:*\$(srcdir):*/:/; -s/:*\${srcdir}:*/:/; -s/:*@srcdir@:*/:/; -s/^\([^=]*=[ ]*\):*/\1/; -s/:*$//; -s/^[^=]*=[ ]*$//; -}' -fi - DEFS=-DHAVE_CONFIG_H ac_libobjs= ac_ltlibobjs= +U= for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue # 1. Remove the extension, and $U if already installed. - ac_i=`echo "$ac_i" | - sed 's/\$U\././;s/\.o$//;s/\.obj$//'` - # 2. Add them. - ac_libobjs="$ac_libobjs $ac_i\$U.$ac_objext" - ac_ltlibobjs="$ac_ltlibobjs $ac_i"'$U.lo' + ac_script='s/\$U\././;s/\.o$//;s/\.obj$//' + ac_i=`$as_echo "$ac_i" | sed "$ac_script"` + # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR + # will be set to the directory where LIBOBJS objects are built. + as_fn_append ac_libobjs " \${LIBOBJDIR}$ac_i\$U.$ac_objext" + as_fn_append ac_ltlibobjs " \${LIBOBJDIR}$ac_i"'$U.lo' done LIBOBJS=$ac_libobjs @@ -6465,12 +5845,14 @@ LTLIBOBJS=$ac_ltlibobjs -: ${CONFIG_STATUS=./config.status} +: "${CONFIG_STATUS=./config.status}" +ac_write_fail=0 ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files $CONFIG_STATUS" -{ echo "$as_me:$LINENO: creating $CONFIG_STATUS" >&5 -echo "$as_me: creating $CONFIG_STATUS" >&6;} -cat >$CONFIG_STATUS <<_ACEOF +{ $as_echo "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5 +$as_echo "$as_me: creating $CONFIG_STATUS" >&6;} +as_write_fail=0 +cat >$CONFIG_STATUS <<_ASEOF || as_write_fail=1 #! $SHELL # Generated by $as_me. # Run this file to recreate the current configuration. @@ -6480,230 +5862,377 @@ cat >$CONFIG_STATUS <<_ACEOF debug=false ac_cs_recheck=false ac_cs_silent=false -SHELL=\${CONFIG_SHELL-$SHELL} -_ACEOF - -cat >>$CONFIG_STATUS <<\_ACEOF -## --------------------- ## -## M4sh Initialization. ## -## --------------------- ## -# Be Bourne compatible -if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then +SHELL=\${CONFIG_SHELL-$SHELL} +export SHELL +_ASEOF +cat >>$CONFIG_STATUS <<\_ASEOF || as_write_fail=1 +## -------------------- ## +## M4sh Initialization. ## +## -------------------- ## + +# Be more Bourne compatible +DUALCASE=1; export DUALCASE # for MKS sh +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : emulate sh NULLCMD=: - # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which + # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' -elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then - set -o posix -fi -DUALCASE=1; export DUALCASE # for MKS sh - -# Support unset when possible. -if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then - as_unset=unset + setopt NO_GLOB_SUBST else - as_unset=false + case `(set -o) 2>/dev/null` in #( + *posix*) : + set -o posix ;; #( + *) : + ;; +esac fi -# Work around bugs in pre-3.0 UWIN ksh. -$as_unset ENV MAIL MAILPATH -PS1='$ ' -PS2='> ' -PS4='+ ' - -# NLS nuisances. -for as_var in \ - LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ - LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ - LC_TELEPHONE LC_TIME -do - if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then - eval $as_var=C; export $as_var +as_nl=' +' +export as_nl +# Printing a long string crashes Solaris 7 /usr/bin/printf. +as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' +as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo +as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo +# Prefer a ksh shell builtin over an external printf program on Solaris, +# but without wasting forks for bash or zsh. +if test -z "$BASH_VERSION$ZSH_VERSION" \ + && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then + as_echo='print -r --' + as_echo_n='print -rn --' +elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then + as_echo='printf %s\n' + as_echo_n='printf %s' +else + if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then + as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' + as_echo_n='/usr/ucb/echo -n' else - $as_unset $as_var + as_echo_body='eval expr "X$1" : "X\\(.*\\)"' + as_echo_n_body='eval + arg=$1; + case $arg in #( + *"$as_nl"*) + expr "X$arg" : "X\\(.*\\)$as_nl"; + arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; + esac; + expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" + ' + export as_echo_n_body + as_echo_n='sh -c $as_echo_n_body as_echo' fi -done - -# Required to use basename. -if expr a : '\(a\)' >/dev/null 2>&1; then - as_expr=expr -else - as_expr=false -fi - -if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then - as_basename=basename -else - as_basename=false + export as_echo_body + as_echo='sh -c $as_echo_body as_echo' fi - -# Name of the executable. -as_me=`$as_basename "$0" || -$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ - X"$0" : 'X\(//\)$' \| \ - X"$0" : 'X\(/\)$' \| \ - . : '\(.\)' 2>/dev/null || -echo X/"$0" | - sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; } - /^X\/\(\/\/\)$/{ s//\1/; q; } - /^X\/\(\/\).*/{ s//\1/; q; } - s/.*/./; q'` - - -# PATH needs CR, and LINENO needs CR and PATH. -# Avoid depending upon Character Ranges. -as_cr_letters='abcdefghijklmnopqrstuvwxyz' -as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' -as_cr_Letters=$as_cr_letters$as_cr_LETTERS -as_cr_digits='0123456789' -as_cr_alnum=$as_cr_Letters$as_cr_digits - # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then - echo "#! /bin/sh" >conf$$.sh - echo "exit 0" >>conf$$.sh - chmod +x conf$$.sh - if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then - PATH_SEPARATOR=';' - else - PATH_SEPARATOR=: - fi - rm -f conf$$.sh + PATH_SEPARATOR=: + (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { + (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || + PATH_SEPARATOR=';' + } fi - as_lineno_1=$LINENO - as_lineno_2=$LINENO - as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` - test "x$as_lineno_1" != "x$as_lineno_2" && - test "x$as_lineno_3" = "x$as_lineno_2" || { - # Find who we are. Look in the path if we contain no path at all - # relative or not. - case $0 in - *[\\/]* ) as_myself=$0 ;; - *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +# IFS +# We need space, tab and new line, in precisely that order. Quoting is +# there to prevent editors from complaining about space-tab. +# (If _AS_PATH_WALK were called with IFS unset, it would disable word +# splitting by setting IFS to empty value.) +IFS=" "" $as_nl" + +# Find who we are. Look in the path if we contain no directory separator. +as_myself= +case $0 in #(( + *[\\/]* ) as_myself=$0 ;; + *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. - test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break + test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break + done +IFS=$as_save_IFS + + ;; +esac +# We did not find ourselves, most probably we were run as `sh COMMAND' +# in which case we are not to be found in the path. +if test "x$as_myself" = x; then + as_myself=$0 +fi +if test ! -f "$as_myself"; then + $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 + exit 1 +fi + +# Unset variables that we do not need and which cause bugs (e.g. in +# pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" +# suppresses any "Segmentation fault" message there. '((' could +# trigger a bug in pdksh 5.2.14. +for as_var in BASH_ENV ENV MAIL MAILPATH +do eval test x\${$as_var+set} = xset \ + && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : done +PS1='$ ' +PS2='> ' +PS4='+ ' - ;; - esac - # We did not find ourselves, most probably we were run as `sh COMMAND' - # in which case we are not to be found in the path. - if test "x$as_myself" = x; then - as_myself=$0 - fi - if test ! -f "$as_myself"; then - { { echo "$as_me:$LINENO: error: cannot find myself; rerun with an absolute path" >&5 -echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2;} - { (exit 1); exit 1; }; } +# NLS nuisances. +LC_ALL=C +export LC_ALL +LANGUAGE=C +export LANGUAGE + +# CDPATH. +(unset CDPATH) >/dev/null 2>&1 && unset CDPATH + + +# as_fn_error STATUS ERROR [LINENO LOG_FD] +# ---------------------------------------- +# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are +# provided, also output the error to LOG_FD, referencing LINENO. Then exit the +# script with STATUS, using 1 if that was 0. +as_fn_error () +{ + as_status=$1; test $as_status -eq 0 && as_status=1 + if test "$4"; then + as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 fi - case $CONFIG_SHELL in - '') - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for as_base in sh bash ksh sh5; do - case $as_dir in - /*) - if ("$as_dir/$as_base" -c ' - as_lineno_1=$LINENO - as_lineno_2=$LINENO - as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` - test "x$as_lineno_1" != "x$as_lineno_2" && - test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then - $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; } - $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; } - CONFIG_SHELL=$as_dir/$as_base - export CONFIG_SHELL - exec "$CONFIG_SHELL" "$0" ${1+"$@"} - fi;; - esac - done -done -;; - esac + $as_echo "$as_me: error: $2" >&2 + as_fn_exit $as_status +} # as_fn_error - # Create $as_me.lineno as a copy of $as_myself, but with $LINENO - # uniformly replaced by the line number. The first 'sed' inserts a - # line-number line before each line; the second 'sed' does the real - # work. The second script uses 'N' to pair each line-number line - # with the numbered line, and appends trailing '-' during - # substitution so that $LINENO is not a special case at line end. - # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the - # second 'sed' script. Blame Lee E. McMahon for sed's syntax. :-) - sed '=' <$as_myself | - sed ' - N - s,$,-, - : loop - s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3, - t loop - s,-$,, - s,^['$as_cr_digits']*\n,, - ' >$as_me.lineno && - chmod +x $as_me.lineno || - { { echo "$as_me:$LINENO: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&5 -echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2;} - { (exit 1); exit 1; }; } - # Don't try to exec as it changes $[0], causing all sort of problems - # (the dirname of $[0] is not the place where we might find the - # original and so on. Autoconf is especially sensible to this). - . ./$as_me.lineno - # Exit status is that of the last command. - exit +# as_fn_set_status STATUS +# ----------------------- +# Set $? to STATUS, without forking. +as_fn_set_status () +{ + return $1 +} # as_fn_set_status + +# as_fn_exit STATUS +# ----------------- +# Exit the shell with STATUS, even in a "trap 0" or "set -e" context. +as_fn_exit () +{ + set +e + as_fn_set_status $1 + exit $1 +} # as_fn_exit + +# as_fn_unset VAR +# --------------- +# Portably unset VAR. +as_fn_unset () +{ + { eval $1=; unset $1;} } +as_unset=as_fn_unset +# as_fn_append VAR VALUE +# ---------------------- +# Append the text in VALUE to the end of the definition contained in VAR. Take +# advantage of any shell optimizations that allow amortized linear growth over +# repeated appends, instead of the typical quadratic growth present in naive +# implementations. +if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : + eval 'as_fn_append () + { + eval $1+=\$2 + }' +else + as_fn_append () + { + eval $1=\$$1\$2 + } +fi # as_fn_append + +# as_fn_arith ARG... +# ------------------ +# Perform arithmetic evaluation on the ARGs, and store the result in the +# global $as_val. Take advantage of shells that can avoid forks. The arguments +# must be portable across $(()) and expr. +if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : + eval 'as_fn_arith () + { + as_val=$(( $* )) + }' +else + as_fn_arith () + { + as_val=`expr "$@" || test $? -eq 1` + } +fi # as_fn_arith -case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in - *c*,-n*) ECHO_N= ECHO_C=' -' ECHO_T=' ' ;; - *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;; - *) ECHO_N= ECHO_C='\c' ECHO_T= ;; -esac - -if expr a : '\(a\)' >/dev/null 2>&1; then +if expr a : '\(a\)' >/dev/null 2>&1 && + test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi +if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then + as_basename=basename +else + as_basename=false +fi + +if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then + as_dirname=dirname +else + as_dirname=false +fi + +as_me=`$as_basename -- "$0" || +$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X/"$0" | + sed '/^.*\/\([^/][^/]*\)\/*$/{ + s//\1/ + q + } + /^X\/\(\/\/\)$/{ + s//\1/ + q + } + /^X\/\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + +# Avoid depending upon Character Ranges. +as_cr_letters='abcdefghijklmnopqrstuvwxyz' +as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' +as_cr_Letters=$as_cr_letters$as_cr_LETTERS +as_cr_digits='0123456789' +as_cr_alnum=$as_cr_Letters$as_cr_digits + +ECHO_C= ECHO_N= ECHO_T= +case `echo -n x` in #((((( +-n*) + case `echo 'xy\c'` in + *c*) ECHO_T=' ';; # ECHO_T is single tab character. + xy) ECHO_C='\c';; + *) echo `echo ksh88 bug on AIX 6.1` > /dev/null + ECHO_T=' ';; + esac;; +*) + ECHO_N='-n';; +esac + rm -f conf$$ conf$$.exe conf$$.file -echo >conf$$.file -if ln -s conf$$.file conf$$ 2>/dev/null; then - # We could just check for DJGPP; but this test a) works b) is more generic - # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04). - if test -f conf$$.exe; then - # Don't use ln at all; we don't have any links - as_ln_s='cp -p' - else +if test -d conf$$.dir; then + rm -f conf$$.dir/conf$$.file +else + rm -f conf$$.dir + mkdir conf$$.dir 2>/dev/null +fi +if (echo >conf$$.file) 2>/dev/null; then + if ln -s conf$$.file conf$$ 2>/dev/null; then as_ln_s='ln -s' + # ... but there are two gotchas: + # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. + # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. + # In both cases, we have to default to `cp -p'. + ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || + as_ln_s='cp -p' + elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln + else + as_ln_s='cp -p' fi -elif ln conf$$.file conf$$ 2>/dev/null; then - as_ln_s=ln else as_ln_s='cp -p' fi -rm -f conf$$ conf$$.exe conf$$.file +rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file +rmdir conf$$.dir 2>/dev/null + + +# as_fn_mkdir_p +# ------------- +# Create "$as_dir" as a directory, including parents if necessary. +as_fn_mkdir_p () +{ + + case $as_dir in #( + -*) as_dir=./$as_dir;; + esac + test -d "$as_dir" || eval $as_mkdir_p || { + as_dirs= + while :; do + case $as_dir in #( + *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( + *) as_qdir=$as_dir;; + esac + as_dirs="'$as_qdir' $as_dirs" + as_dir=`$as_dirname -- "$as_dir" || +$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_dir" : 'X\(//\)[^/]' \| \ + X"$as_dir" : 'X\(//\)$' \| \ + X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$as_dir" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + test -d "$as_dir" && break + done + test -z "$as_dirs" || eval "mkdir $as_dirs" + } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" + +} # as_fn_mkdir_p if mkdir -p . 2>/dev/null; then - as_mkdir_p=: + as_mkdir_p='mkdir -p "$as_dir"' else test -d ./-p && rmdir ./-p as_mkdir_p=false fi -as_executable_p="test -f" +if test -x / >/dev/null 2>&1; then + as_test_x='test -x' +else + if ls -dL / >/dev/null 2>&1; then + as_ls_L_option=L + else + as_ls_L_option= + fi + as_test_x=' + eval sh -c '\'' + if test -d "$1"; then + test -d "$1/."; + else + case $1 in #( + -*)set "./$1";; + esac; + case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #(( + ???[sx]*):;;*)false;;esac;fi + '\'' sh + ' +fi +as_executable_p=$as_test_x # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" @@ -6712,31 +6241,20 @@ as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" -# IFS -# We need space, tab and new line, in precisely that order. -as_nl=' -' -IFS=" $as_nl" - -# CDPATH. -$as_unset CDPATH - exec 6>&1 - -# Open the log real soon, to keep \$[0] and so on meaningful, and to +## ----------------------------------- ## +## Main body of $CONFIG_STATUS script. ## +## ----------------------------------- ## +_ASEOF +test $as_write_fail = 0 && chmod +x $CONFIG_STATUS || ac_write_fail=1 + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +# Save the log message, to keep $0 and so on meaningful, and to # report actual input values of CONFIG_FILES etc. instead of their -# values after options handling. Logging --version etc. is OK. -exec 5>>config.log -{ - echo - sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX -## Running $as_me. ## -_ASBOX -} >&5 -cat >&5 <<_CSEOF - +# values after options handling. +ac_log=" This file was extended by bforce $as_me 0.22.9, which was -generated by GNU Autoconf 2.59. Invocation command line was +generated by GNU Autoconf 2.68. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS @@ -6744,45 +6262,46 @@ generated by GNU Autoconf 2.59. Invocation command line was CONFIG_COMMANDS = $CONFIG_COMMANDS $ $0 $@ -_CSEOF -echo "on `(hostname || uname -n) 2>/dev/null | sed 1q`" >&5 -echo >&5 +on `(hostname || uname -n) 2>/dev/null | sed 1q` +" + _ACEOF -# Files that config.status was made for. -if test -n "$ac_config_files"; then - echo "config_files=\"$ac_config_files\"" >>$CONFIG_STATUS -fi +case $ac_config_files in *" +"*) set x $ac_config_files; shift; ac_config_files=$*;; +esac -if test -n "$ac_config_headers"; then - echo "config_headers=\"$ac_config_headers\"" >>$CONFIG_STATUS -fi +case $ac_config_headers in *" +"*) set x $ac_config_headers; shift; ac_config_headers=$*;; +esac -if test -n "$ac_config_links"; then - echo "config_links=\"$ac_config_links\"" >>$CONFIG_STATUS -fi -if test -n "$ac_config_commands"; then - echo "config_commands=\"$ac_config_commands\"" >>$CONFIG_STATUS -fi +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +# Files that config.status was made for. +config_files="$ac_config_files" +config_headers="$ac_config_headers" -cat >>$CONFIG_STATUS <<\_ACEOF +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 ac_cs_usage="\ -\`$as_me' instantiates files from templates according to the -current configuration. +\`$as_me' instantiates files and other configuration actions +from templates according to the current configuration. Unless the files +and actions are specified as TAGs, all are instantiated by default. -Usage: $0 [OPTIONS] [FILE]... +Usage: $0 [OPTION]... [TAG]... -h, --help print this help, then exit - -V, --version print version number, then exit - -q, --quiet do not print progress messages + -V, --version print version number and configuration settings, then exit + --config print configuration, then exit + -q, --quiet, --silent + do not print progress messages -d, --debug don't remove temporary files --recheck update $as_me by reconfiguring in the same conditions - --file=FILE[:TEMPLATE] - instantiate the configuration file FILE - --header=FILE[:TEMPLATE] - instantiate the configuration header FILE + --file=FILE[:TEMPLATE] + instantiate the configuration file FILE + --header=FILE[:TEMPLATE] + instantiate the configuration header FILE Configuration files: $config_files @@ -6790,84 +6309,90 @@ $config_files Configuration headers: $config_headers -Report bugs to ." -_ACEOF +Report bugs to ." -cat >>$CONFIG_STATUS <<_ACEOF +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ bforce config.status 0.22.9 -configured by $0, generated by GNU Autoconf 2.59, - with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\" +configured by $0, generated by GNU Autoconf 2.68, + with options \\"\$ac_cs_config\\" -Copyright (C) 2003 Free Software Foundation, Inc. +Copyright (C) 2010 Free Software Foundation, Inc. This config.status script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it." -srcdir=$srcdir -INSTALL="$INSTALL" + +ac_pwd='$ac_pwd' +srcdir='$srcdir' +INSTALL='$INSTALL' +test -n "\$AWK" || AWK=awk _ACEOF -cat >>$CONFIG_STATUS <<\_ACEOF -# If no file are specified by the user, then we need to provide default -# value. By we need to know if files were specified by the user. +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +# The default lists apply if the user does not specify any file. ac_need_defaults=: while test $# != 0 do case $1 in - --*=*) - ac_option=`expr "x$1" : 'x\([^=]*\)='` - ac_optarg=`expr "x$1" : 'x[^=]*=\(.*\)'` + --*=?*) + ac_option=`expr "X$1" : 'X\([^=]*\)='` + ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'` + ac_shift=: + ;; + --*=) + ac_option=`expr "X$1" : 'X\([^=]*\)='` + ac_optarg= ac_shift=: ;; - -*) + *) ac_option=$1 ac_optarg=$2 ac_shift=shift ;; - *) # This is not an option, so the user has probably given explicit - # arguments. - ac_option=$1 - ac_need_defaults=false;; esac case $ac_option in # Handling of the options. -_ACEOF -cat >>$CONFIG_STATUS <<\_ACEOF -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) ac_cs_recheck=: ;; - --version | --vers* | -V ) - echo "$ac_cs_version"; exit 0 ;; - --he | --h) - # Conflict between --help and --header - { { echo "$as_me:$LINENO: error: ambiguous option: $1 -Try \`$0 --help' for more information." >&5 -echo "$as_me: error: ambiguous option: $1 -Try \`$0 --help' for more information." >&2;} - { (exit 1); exit 1; }; };; - --help | --hel | -h ) - echo "$ac_cs_usage"; exit 0 ;; - --debug | --d* | -d ) + --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) + $as_echo "$ac_cs_version"; exit ;; + --config | --confi | --conf | --con | --co | --c ) + $as_echo "$ac_cs_config"; exit ;; + --debug | --debu | --deb | --de | --d | -d ) debug=: ;; --file | --fil | --fi | --f ) $ac_shift - CONFIG_FILES="$CONFIG_FILES $ac_optarg" + case $ac_optarg in + *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; + '') as_fn_error $? "missing file argument" ;; + esac + as_fn_append CONFIG_FILES " '$ac_optarg'" ac_need_defaults=false;; --header | --heade | --head | --hea ) $ac_shift - CONFIG_HEADERS="$CONFIG_HEADERS $ac_optarg" + case $ac_optarg in + *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; + esac + as_fn_append CONFIG_HEADERS " '$ac_optarg'" ac_need_defaults=false;; + --he | --h) + # Conflict between --help and --header + as_fn_error $? "ambiguous option: \`$1' +Try \`$0 --help' for more information.";; + --help | --hel | -h ) + $as_echo "$ac_cs_usage"; exit ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil | --si | --s) ac_cs_silent=: ;; # This is an error. - -*) { { echo "$as_me:$LINENO: error: unrecognized option: $1 -Try \`$0 --help' for more information." >&5 -echo "$as_me: error: unrecognized option: $1 -Try \`$0 --help' for more information." >&2;} - { (exit 1); exit 1; }; } ;; + -*) as_fn_error $? "unrecognized option: \`$1' +Try \`$0 --help' for more information." ;; - *) ac_config_targets="$ac_config_targets $1" ;; + *) as_fn_append ac_config_targets " $1" + ac_need_defaults=false ;; esac shift @@ -6881,32 +6406,46 @@ if $ac_cs_silent; then fi _ACEOF -cat >>$CONFIG_STATUS <<_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 if \$ac_cs_recheck; then - echo "running $SHELL $0 " $ac_configure_args \$ac_configure_extra_args " --no-create --no-recursion" >&6 - exec $SHELL $0 $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion + set X '$SHELL' '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion + shift + \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6 + CONFIG_SHELL='$SHELL' + export CONFIG_SHELL + exec "\$@" fi _ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +exec 5>>config.log +{ + echo + sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX +## Running $as_me. ## +_ASBOX + $as_echo "$ac_log" +} >&5 +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 - - -cat >>$CONFIG_STATUS <<\_ACEOF +# Handling of arguments. for ac_config_target in $ac_config_targets do - case "$ac_config_target" in - # Handling of arguments. - "Makefile" ) CONFIG_FILES="$CONFIG_FILES Makefile" ;; - "../debian/Makefile" ) CONFIG_FILES="$CONFIG_FILES ../debian/Makefile" ;; - "include/config.h" ) CONFIG_HEADERS="$CONFIG_HEADERS include/config.h" ;; - *) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5 -echo "$as_me: error: invalid argument: $ac_config_target" >&2;} - { (exit 1); exit 1; }; };; + case $ac_config_target in + "include/config.h") CONFIG_HEADERS="$CONFIG_HEADERS include/config.h" ;; + "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; + "../debian/Makefile") CONFIG_FILES="$CONFIG_FILES ../debian/Makefile" ;; + + *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;; esac done + # If the user did not use the arguments to specify the items to instantiate, # then the envvar interface is used. Set only those that are not. # We use the long form for the default assignment because of an extremely @@ -6917,575 +6456,550 @@ if $ac_need_defaults; then fi # Have a temporary directory for convenience. Make it in the build tree -# simply because there is no reason to put it here, and in addition, +# simply because there is no reason against having it here, and in addition, # creating and moving files from /tmp can sometimes cause problems. -# Create a temporary directory, and hook for its removal unless debugging. +# Hook for its removal unless debugging. +# Note that there is a small window in which the directory will not be cleaned: +# after its creation but before its name has been assigned to `$tmp'. $debug || { - trap 'exit_status=$?; rm -rf $tmp && exit $exit_status' 0 - trap '{ (exit 1); exit 1; }' 1 2 13 15 + tmp= ac_tmp= + trap 'exit_status=$? + : "${ac_tmp:=$tmp}" + { test ! -d "$ac_tmp" || rm -fr "$ac_tmp"; } && exit $exit_status +' 0 + trap 'as_fn_exit 1' 1 2 13 15 } - # Create a (secure) tmp directory for tmp files. { - tmp=`(umask 077 && mktemp -d -q "./confstatXXXXXX") 2>/dev/null` && - test -n "$tmp" && test -d "$tmp" + tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && + test -d "$tmp" } || { - tmp=./confstat$$-$RANDOM - (umask 077 && mkdir $tmp) -} || + tmp=./conf$$-$RANDOM + (umask 077 && mkdir "$tmp") +} || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5 +ac_tmp=$tmp + +# Set up the scripts for CONFIG_FILES section. +# No need to generate them if there are no CONFIG_FILES. +# This happens for instance with `./config.status config.h'. +if test -n "$CONFIG_FILES"; then + + +ac_cr=`echo X | tr X '\015'` +# On cygwin, bash can eat \r inside `` if the user requested igncr. +# But we know of no other shell where ac_cr would be empty at this +# point, so we can use a bashism as a fallback. +if test "x$ac_cr" = x; then + eval ac_cr=\$\'\\r\' +fi +ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' /dev/null` +if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then + ac_cs_awk_cr='\\r' +else + ac_cs_awk_cr=$ac_cr +fi + +echo 'BEGIN {' >"$ac_tmp/subs1.awk" && +_ACEOF + + { - echo "$me: cannot create a temporary directory in ." >&2 - { (exit 1); exit 1; } + echo "cat >conf$$subs.awk <<_ACEOF" && + echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' && + echo "_ACEOF" +} >conf$$subs.sh || + as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 +ac_delim_num=`echo "$ac_subst_vars" | grep -c '^'` +ac_delim='%!_!# ' +for ac_last_try in false false false false false :; do + . ./conf$$subs.sh || + as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 + + ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X` + if test $ac_delim_n = $ac_delim_num; then + break + elif $ac_last_try; then + as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 + else + ac_delim="$ac_delim!$ac_delim _$ac_delim!! " + fi +done +rm -f conf$$subs.sh + +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +cat >>"\$ac_tmp/subs1.awk" <<\\_ACAWK && +_ACEOF +sed -n ' +h +s/^/S["/; s/!.*/"]=/ +p +g +s/^[^!]*!// +:repl +t repl +s/'"$ac_delim"'$// +t delim +:nl +h +s/\(.\{148\}\)..*/\1/ +t more1 +s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/ +p +n +b repl +:more1 +s/["\\]/\\&/g; s/^/"/; s/$/"\\/ +p +g +s/.\{148\}// +t nl +:delim +h +s/\(.\{148\}\)..*/\1/ +t more2 +s/["\\]/\\&/g; s/^/"/; s/$/"/ +p +b +:more2 +s/["\\]/\\&/g; s/^/"/; s/$/"\\/ +p +g +s/.\{148\}// +t delim +' >$CONFIG_STATUS || ac_write_fail=1 +rm -f conf$$subs.awk +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +_ACAWK +cat >>"\$ac_tmp/subs1.awk" <<_ACAWK && + for (key in S) S_is_set[key] = 1 + FS = "" -_ACEOF +} +{ + line = $ 0 + nfields = split(line, field, "@") + substed = 0 + len = length(field[1]) + for (i = 2; i < nfields; i++) { + key = field[i] + keylen = length(key) + if (S_is_set[key]) { + value = S[key] + line = substr(line, 1, len) "" value "" substr(line, len + keylen + 3) + len += length(value) + length(field[++i]) + substed = 1 + } else + len += 1 + keylen + } -cat >>$CONFIG_STATUS <<_ACEOF + print line +} -# -# CONFIG_FILES section. -# +_ACAWK +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then + sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g" +else + cat +fi < "$ac_tmp/subs1.awk" > "$ac_tmp/subs.awk" \ + || as_fn_error $? "could not setup config files machinery" "$LINENO" 5 +_ACEOF -# No need to generate the scripts if there are no CONFIG_FILES. -# This happens for instance when ./config.status config.h -if test -n "\$CONFIG_FILES"; then - # Protect against being on the right side of a sed subst in config.status. - sed 's/,@/@@/; s/@,/@@/; s/,;t t\$/@;t t/; /@;t t\$/s/[\\\\&,]/\\\\&/g; - s/@@/,@/; s/@@/@,/; s/@;t t\$/,;t t/' >\$tmp/subs.sed <<\\CEOF -s,@SHELL@,$SHELL,;t t -s,@PATH_SEPARATOR@,$PATH_SEPARATOR,;t t -s,@PACKAGE_NAME@,$PACKAGE_NAME,;t t -s,@PACKAGE_TARNAME@,$PACKAGE_TARNAME,;t t -s,@PACKAGE_VERSION@,$PACKAGE_VERSION,;t t -s,@PACKAGE_STRING@,$PACKAGE_STRING,;t t -s,@PACKAGE_BUGREPORT@,$PACKAGE_BUGREPORT,;t t -s,@exec_prefix@,$exec_prefix,;t t -s,@prefix@,$prefix,;t t -s,@program_transform_name@,$program_transform_name,;t t -s,@bindir@,$bindir,;t t -s,@sbindir@,$sbindir,;t t -s,@libexecdir@,$libexecdir,;t t -s,@datadir@,$datadir,;t t -s,@sysconfdir@,$sysconfdir,;t t -s,@sharedstatedir@,$sharedstatedir,;t t -s,@localstatedir@,$localstatedir,;t t -s,@libdir@,$libdir,;t t -s,@includedir@,$includedir,;t t -s,@oldincludedir@,$oldincludedir,;t t -s,@infodir@,$infodir,;t t -s,@mandir@,$mandir,;t t -s,@build_alias@,$build_alias,;t t -s,@host_alias@,$host_alias,;t t -s,@target_alias@,$target_alias,;t t -s,@DEFS@,$DEFS,;t t -s,@ECHO_C@,$ECHO_C,;t t -s,@ECHO_N@,$ECHO_N,;t t -s,@ECHO_T@,$ECHO_T,;t t -s,@LIBS@,$LIBS,;t t -s,@build@,$build,;t t -s,@build_cpu@,$build_cpu,;t t -s,@build_vendor@,$build_vendor,;t t -s,@build_os@,$build_os,;t t -s,@host@,$host,;t t -s,@host_cpu@,$host_cpu,;t t -s,@host_vendor@,$host_vendor,;t t -s,@host_os@,$host_os,;t t -s,@target@,$target,;t t -s,@target_cpu@,$target_cpu,;t t -s,@target_vendor@,$target_vendor,;t t -s,@target_os@,$target_os,;t t -s,@OWNER@,$OWNER,;t t -s,@GROUP@,$GROUP,;t t -s,@SPOOLDIR@,$SPOOLDIR,;t t -s,@LOGDIR@,$LOGDIR,;t t -s,@YACC@,$YACC,;t t -s,@CC@,$CC,;t t -s,@CFLAGS@,$CFLAGS,;t t -s,@LDFLAGS@,$LDFLAGS,;t t -s,@CPPFLAGS@,$CPPFLAGS,;t t -s,@ac_ct_CC@,$ac_ct_CC,;t t -s,@EXEEXT@,$EXEEXT,;t t -s,@OBJEXT@,$OBJEXT,;t t -s,@INSTALL_PROGRAM@,$INSTALL_PROGRAM,;t t -s,@INSTALL_SCRIPT@,$INSTALL_SCRIPT,;t t -s,@INSTALL_DATA@,$INSTALL_DATA,;t t -s,@CPP@,$CPP,;t t -s,@EGREP@,$EGREP,;t t -s,@LIBOBJS@,$LIBOBJS,;t t -s,@LTLIBOBJS@,$LTLIBOBJS,;t t -CEOF +# VPATH may cause trouble with some makes, so we remove sole $(srcdir), +# ${srcdir} and @srcdir@ entries from VPATH if srcdir is ".", strip leading and +# trailing colons and then remove the whole line if VPATH becomes empty +# (actually we leave an empty line to preserve line numbers). +if test "x$srcdir" = x.; then + ac_vpsub='/^[ ]*VPATH[ ]*=[ ]*/{ +h +s/// +s/^/:/ +s/[ ]*$/:/ +s/:\$(srcdir):/:/g +s/:\${srcdir}:/:/g +s/:@srcdir@:/:/g +s/^:*// +s/:*$// +x +s/\(=[ ]*\).*/\1/ +G +s/\n// +s/^[^=]*=[ ]*$// +}' +fi + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +fi # test -n "$CONFIG_FILES" +# Set up the scripts for CONFIG_HEADERS section. +# No need to generate them if there are no CONFIG_HEADERS. +# This happens for instance with `./config.status Makefile'. +if test -n "$CONFIG_HEADERS"; then +cat >"$ac_tmp/defines.awk" <<\_ACAWK || +BEGIN { _ACEOF - cat >>$CONFIG_STATUS <<\_ACEOF - # Split the substitutions into bite-sized pieces for seds with - # small command number limits, like on Digital OSF/1 and HP-UX. - ac_max_sed_lines=48 - ac_sed_frag=1 # Number of current file. - ac_beg=1 # First line for current file. - ac_end=$ac_max_sed_lines # Line after last line for current file. - ac_more_lines=: - ac_sed_cmds= - while $ac_more_lines; do - if test $ac_beg -gt 1; then - sed "1,${ac_beg}d; ${ac_end}q" $tmp/subs.sed >$tmp/subs.frag - else - sed "${ac_end}q" $tmp/subs.sed >$tmp/subs.frag - fi - if test ! -s $tmp/subs.frag; then - ac_more_lines=false - else - # The purpose of the label and of the branching condition is to - # speed up the sed processing (if there are no `@' at all, there - # is no need to browse any of the substitutions). - # These are the two extra sed commands mentioned above. - (echo ':t - /@[a-zA-Z_][a-zA-Z_0-9]*@/!b' && cat $tmp/subs.frag) >$tmp/subs-$ac_sed_frag.sed - if test -z "$ac_sed_cmds"; then - ac_sed_cmds="sed -f $tmp/subs-$ac_sed_frag.sed" - else - ac_sed_cmds="$ac_sed_cmds | sed -f $tmp/subs-$ac_sed_frag.sed" - fi - ac_sed_frag=`expr $ac_sed_frag + 1` - ac_beg=$ac_end - ac_end=`expr $ac_end + $ac_max_sed_lines` - fi - done - if test -z "$ac_sed_cmds"; then - ac_sed_cmds=cat +# Transform confdefs.h into an awk script `defines.awk', embedded as +# here-document in config.status, that substitutes the proper values into +# config.h.in to produce config.h. + +# Create a delimiter string that does not exist in confdefs.h, to ease +# handling of long lines. +ac_delim='%!_!# ' +for ac_last_try in false false :; do + ac_tt=`sed -n "/$ac_delim/p" confdefs.h` + if test -z "$ac_tt"; then + break + elif $ac_last_try; then + as_fn_error $? "could not make $CONFIG_HEADERS" "$LINENO" 5 + else + ac_delim="$ac_delim!$ac_delim _$ac_delim!! " fi -fi # test -n "$CONFIG_FILES" +done +# For the awk script, D is an array of macro values keyed by name, +# likewise P contains macro parameters if any. Preserve backslash +# newline sequences. + +ac_word_re=[_$as_cr_Letters][_$as_cr_alnum]* +sed -n ' +s/.\{148\}/&'"$ac_delim"'/g +t rset +:rset +s/^[ ]*#[ ]*define[ ][ ]*/ / +t def +d +:def +s/\\$// +t bsnl +s/["\\]/\\&/g +s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ +D["\1"]=" \3"/p +s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2"/p +d +:bsnl +s/["\\]/\\&/g +s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ +D["\1"]=" \3\\\\\\n"\\/p +t cont +s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2\\\\\\n"\\/p +t cont +d +:cont +n +s/.\{148\}/&'"$ac_delim"'/g +t clear +:clear +s/\\$// +t bsnlc +s/["\\]/\\&/g; s/^/"/; s/$/"/p +d +:bsnlc +s/["\\]/\\&/g; s/^/"/; s/$/\\\\\\n"\\/p +b cont +' >$CONFIG_STATUS || ac_write_fail=1 + +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 + for (key in D) D_is_set[key] = 1 + FS = "" +} +/^[\t ]*#[\t ]*(define|undef)[\t ]+$ac_word_re([\t (]|\$)/ { + line = \$ 0 + split(line, arg, " ") + if (arg[1] == "#") { + defundef = arg[2] + mac1 = arg[3] + } else { + defundef = substr(arg[1], 2) + mac1 = arg[2] + } + split(mac1, mac2, "(") #) + macro = mac2[1] + prefix = substr(line, 1, index(line, defundef) - 1) + if (D_is_set[macro]) { + # Preserve the white space surrounding the "#". + print prefix "define", macro P[macro] D[macro] + next + } else { + # Replace #undef with comments. This is necessary, for example, + # in the case of _POSIX_SOURCE, which is predefined and required + # on some systems where configure will not decide to define it. + if (defundef == "undef") { + print "/*", prefix defundef, macro, "*/" + next + } + } +} +{ print } +_ACAWK _ACEOF -cat >>$CONFIG_STATUS <<\_ACEOF -for ac_file in : $CONFIG_FILES; do test "x$ac_file" = x: && continue - # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". - case $ac_file in - - | *:- | *:-:* ) # input from stdin - cat >$tmp/stdin - ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` - ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; - *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` - ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; - * ) ac_file_in=$ac_file.in ;; +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 + as_fn_error $? "could not setup config headers machinery" "$LINENO" 5 +fi # test -n "$CONFIG_HEADERS" + + +eval set X " :F $CONFIG_FILES :H $CONFIG_HEADERS " +shift +for ac_tag +do + case $ac_tag in + :[FHLC]) ac_mode=$ac_tag; continue;; + esac + case $ac_mode$ac_tag in + :[FHL]*:*);; + :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5;; + :[FH]-) ac_tag=-:-;; + :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; + esac + ac_save_IFS=$IFS + IFS=: + set x $ac_tag + IFS=$ac_save_IFS + shift + ac_file=$1 + shift + + case $ac_mode in + :L) ac_source=$1;; + :[FH]) + ac_file_inputs= + for ac_f + do + case $ac_f in + -) ac_f="$ac_tmp/stdin";; + *) # Look for the file first in the build tree, then in the source tree + # (if the path is not absolute). The absolute path cannot be DOS-style, + # because $ac_f cannot contain `:'. + test -f "$ac_f" || + case $ac_f in + [\\/$]*) false;; + *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; + esac || + as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5;; + esac + case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac + as_fn_append ac_file_inputs " '$ac_f'" + done + + # Let's still pretend it is `configure' which instantiates (i.e., don't + # use $as_me), people would be surprised to read: + # /* config.h. Generated by config.status. */ + configure_input='Generated from '` + $as_echo "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g' + `' by configure.' + if test x"$ac_file" != x-; then + configure_input="$ac_file. $configure_input" + { $as_echo "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5 +$as_echo "$as_me: creating $ac_file" >&6;} + fi + # Neutralize special characters interpreted by sed in replacement strings. + case $configure_input in #( + *\&* | *\|* | *\\* ) + ac_sed_conf_input=`$as_echo "$configure_input" | + sed 's/[\\\\&|]/\\\\&/g'`;; #( + *) ac_sed_conf_input=$configure_input;; + esac + + case $ac_tag in + *:-:* | *:-) cat >"$ac_tmp/stdin" \ + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; + esac + ;; esac - # Compute @srcdir@, @top_srcdir@, and @INSTALL@ for subdirectories. - ac_dir=`(dirname "$ac_file") 2>/dev/null || + ac_dir=`$as_dirname -- "$ac_file" || $as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$ac_file" : 'X\(//\)[^/]' \| \ X"$ac_file" : 'X\(//\)$' \| \ - X"$ac_file" : 'X\(/\)' \| \ - . : '\(.\)' 2>/dev/null || -echo X"$ac_file" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } - /^X\(\/\/\)[^/].*/{ s//\1/; q; } - /^X\(\/\/\)$/{ s//\1/; q; } - /^X\(\/\).*/{ s//\1/; q; } - s/.*/./; q'` - { if $as_mkdir_p; then - mkdir -p "$ac_dir" - else - as_dir="$ac_dir" - as_dirs= - while test ! -d "$as_dir"; do - as_dirs="$as_dir $as_dirs" - as_dir=`(dirname "$as_dir") 2>/dev/null || -$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$as_dir" : 'X\(//\)[^/]' \| \ - X"$as_dir" : 'X\(//\)$' \| \ - X"$as_dir" : 'X\(/\)' \| \ - . : '\(.\)' 2>/dev/null || -echo X"$as_dir" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } - /^X\(\/\/\)[^/].*/{ s//\1/; q; } - /^X\(\/\/\)$/{ s//\1/; q; } - /^X\(\/\).*/{ s//\1/; q; } - s/.*/./; q'` - done - test ! -n "$as_dirs" || mkdir $as_dirs - fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5 -echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;} - { (exit 1); exit 1; }; }; } - + X"$ac_file" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$ac_file" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + as_dir="$ac_dir"; as_fn_mkdir_p ac_builddir=. -if test "$ac_dir" != .; then - ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` - # A "../" for each directory in $ac_dir_suffix. - ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'` -else - ac_dir_suffix= ac_top_builddir= -fi +case "$ac_dir" in +.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; +*) + ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` + # A ".." for each directory in $ac_dir_suffix. + ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` + case $ac_top_builddir_sub in + "") ac_top_builddir_sub=. ac_top_build_prefix= ;; + *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; + esac ;; +esac +ac_abs_top_builddir=$ac_pwd +ac_abs_builddir=$ac_pwd$ac_dir_suffix +# for backward compatibility: +ac_top_builddir=$ac_top_build_prefix case $srcdir in - .) # No --srcdir option. We are building in place. + .) # We are building in place. ac_srcdir=. - if test -z "$ac_top_builddir"; then - ac_top_srcdir=. - else - ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'` - fi ;; - [\\/]* | ?:[\\/]* ) # Absolute path. + ac_top_srcdir=$ac_top_builddir_sub + ac_abs_top_srcdir=$ac_pwd ;; + [\\/]* | ?:[\\/]* ) # Absolute name. ac_srcdir=$srcdir$ac_dir_suffix; - ac_top_srcdir=$srcdir ;; - *) # Relative path. - ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix - ac_top_srcdir=$ac_top_builddir$srcdir ;; + ac_top_srcdir=$srcdir + ac_abs_top_srcdir=$srcdir ;; + *) # Relative name. + ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_top_build_prefix$srcdir + ac_abs_top_srcdir=$ac_pwd/$srcdir ;; esac +ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix -# Do not use `cd foo && pwd` to compute absolute paths, because -# the directories may not exist. -case `pwd` in -.) ac_abs_builddir="$ac_dir";; -*) - case "$ac_dir" in - .) ac_abs_builddir=`pwd`;; - [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";; - *) ac_abs_builddir=`pwd`/"$ac_dir";; - esac;; -esac -case $ac_abs_builddir in -.) ac_abs_top_builddir=${ac_top_builddir}.;; -*) - case ${ac_top_builddir}. in - .) ac_abs_top_builddir=$ac_abs_builddir;; - [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;; - *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;; - esac;; -esac -case $ac_abs_builddir in -.) ac_abs_srcdir=$ac_srcdir;; -*) - case $ac_srcdir in - .) ac_abs_srcdir=$ac_abs_builddir;; - [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;; - *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;; - esac;; -esac -case $ac_abs_builddir in -.) ac_abs_top_srcdir=$ac_top_srcdir;; -*) - case $ac_top_srcdir in - .) ac_abs_top_srcdir=$ac_abs_builddir;; - [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;; - *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;; - esac;; -esac + case $ac_mode in + :F) + # + # CONFIG_FILE + # case $INSTALL in [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; - *) ac_INSTALL=$ac_top_builddir$INSTALL ;; + *) ac_INSTALL=$ac_top_build_prefix$INSTALL ;; esac +_ACEOF - # Let's still pretend it is `configure' which instantiates (i.e., don't - # use $as_me), people would be surprised to read: - # /* config.h. Generated by config.status. */ - if test x"$ac_file" = x-; then - configure_input= - else - configure_input="$ac_file. " - fi - configure_input=$configure_input"Generated from `echo $ac_file_in | - sed 's,.*/,,'` by configure." - - # First look for the input files in the build tree, otherwise in the - # src tree. - ac_file_inputs=`IFS=: - for f in $ac_file_in; do - case $f in - -) echo $tmp/stdin ;; - [\\/$]*) - # Absolute (can't be DOS-style, as IFS=:) - test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 -echo "$as_me: error: cannot find input file: $f" >&2;} - { (exit 1); exit 1; }; } - echo "$f";; - *) # Relative - if test -f "$f"; then - # Build tree - echo "$f" - elif test -f "$srcdir/$f"; then - # Source tree - echo "$srcdir/$f" - else - # /dev/null tree - { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 -echo "$as_me: error: cannot find input file: $f" >&2;} - { (exit 1); exit 1; }; } - fi;; - esac - done` || { (exit 1); exit 1; } - - if test x"$ac_file" != x-; then - { echo "$as_me:$LINENO: creating $ac_file" >&5 -echo "$as_me: creating $ac_file" >&6;} - rm -f "$ac_file" - fi +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +# If the template does not know about datarootdir, expand it. +# FIXME: This hack should be removed a few years after 2.60. +ac_datarootdir_hack=; ac_datarootdir_seen= +ac_sed_dataroot=' +/datarootdir/ { + p + q +} +/@datadir@/p +/@docdir@/p +/@infodir@/p +/@localedir@/p +/@mandir@/p' +case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in +*datarootdir*) ac_datarootdir_seen=yes;; +*@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 +$as_echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 + ac_datarootdir_hack=' + s&@datadir@&$datadir&g + s&@docdir@&$docdir&g + s&@infodir@&$infodir&g + s&@localedir@&$localedir&g + s&@mandir@&$mandir&g + s&\\\${datarootdir}&$datarootdir&g' ;; +esac _ACEOF -cat >>$CONFIG_STATUS <<_ACEOF - sed "$ac_vpsub + +# Neutralize VPATH when `$srcdir' = `.'. +# Shell code in configure.ac might set extrasub. +# FIXME: do we really want to maintain this feature? +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +ac_sed_extra="$ac_vpsub $extrasub _ACEOF -cat >>$CONFIG_STATUS <<\_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 :t /@[a-zA-Z_][a-zA-Z_0-9]*@/!b -s,@configure_input@,$configure_input,;t t -s,@srcdir@,$ac_srcdir,;t t -s,@abs_srcdir@,$ac_abs_srcdir,;t t -s,@top_srcdir@,$ac_top_srcdir,;t t -s,@abs_top_srcdir@,$ac_abs_top_srcdir,;t t -s,@builddir@,$ac_builddir,;t t -s,@abs_builddir@,$ac_abs_builddir,;t t -s,@top_builddir@,$ac_top_builddir,;t t -s,@abs_top_builddir@,$ac_abs_top_builddir,;t t -s,@INSTALL@,$ac_INSTALL,;t t -" $ac_file_inputs | (eval "$ac_sed_cmds") >$tmp/out - rm -f $tmp/stdin +s|@configure_input@|$ac_sed_conf_input|;t t +s&@top_builddir@&$ac_top_builddir_sub&;t t +s&@top_build_prefix@&$ac_top_build_prefix&;t t +s&@srcdir@&$ac_srcdir&;t t +s&@abs_srcdir@&$ac_abs_srcdir&;t t +s&@top_srcdir@&$ac_top_srcdir&;t t +s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t +s&@builddir@&$ac_builddir&;t t +s&@abs_builddir@&$ac_abs_builddir&;t t +s&@abs_top_builddir@&$ac_abs_top_builddir&;t t +s&@INSTALL@&$ac_INSTALL&;t t +$ac_datarootdir_hack +" +eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$ac_tmp/subs.awk" \ + >$ac_tmp/out || as_fn_error $? "could not create $ac_file" "$LINENO" 5 + +test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && + { ac_out=`sed -n '/\${datarootdir}/p' "$ac_tmp/out"`; test -n "$ac_out"; } && + { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' \ + "$ac_tmp/out"`; test -z "$ac_out"; } && + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir' +which seems to be undefined. Please make sure it is defined" >&5 +$as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' +which seems to be undefined. Please make sure it is defined" >&2;} + + rm -f "$ac_tmp/stdin" + case $ac_file in + -) cat "$ac_tmp/out" && rm -f "$ac_tmp/out";; + *) rm -f "$ac_file" && mv "$ac_tmp/out" "$ac_file";; + esac \ + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 + ;; + :H) + # + # CONFIG_HEADER + # if test x"$ac_file" != x-; then - mv $tmp/out $ac_file + { + $as_echo "/* $configure_input */" \ + && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" + } >"$ac_tmp/config.h" \ + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 + if diff "$ac_file" "$ac_tmp/config.h" >/dev/null 2>&1; then + { $as_echo "$as_me:${as_lineno-$LINENO}: $ac_file is unchanged" >&5 +$as_echo "$as_me: $ac_file is unchanged" >&6;} + else + rm -f "$ac_file" + mv "$ac_tmp/config.h" "$ac_file" \ + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 + fi else - cat $tmp/out - rm -f $tmp/out + $as_echo "/* $configure_input */" \ + && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" \ + || as_fn_error $? "could not create -" "$LINENO" 5 fi + ;; -done -_ACEOF -cat >>$CONFIG_STATUS <<\_ACEOF - -# -# CONFIG_HEADER section. -# -# These sed commands are passed to sed as "A NAME B NAME C VALUE D", where -# NAME is the cpp macro being defined and VALUE is the value it is being given. -# -# ac_d sets the value in "#define NAME VALUE" lines. -ac_dA='s,^\([ ]*\)#\([ ]*define[ ][ ]*\)' -ac_dB='[ ].*$,\1#\2' -ac_dC=' ' -ac_dD=',;t' -# ac_u turns "#undef NAME" without trailing blanks into "#define NAME VALUE". -ac_uA='s,^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)' -ac_uB='$,\1#\2define\3' -ac_uC=' ' -ac_uD=',;t' - -for ac_file in : $CONFIG_HEADERS; do test "x$ac_file" = x: && continue - # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". - case $ac_file in - - | *:- | *:-:* ) # input from stdin - cat >$tmp/stdin - ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` - ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; - *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` - ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; - * ) ac_file_in=$ac_file.in ;; esac - test x"$ac_file" != x- && { echo "$as_me:$LINENO: creating $ac_file" >&5 -echo "$as_me: creating $ac_file" >&6;} - - # First look for the input files in the build tree, otherwise in the - # src tree. - ac_file_inputs=`IFS=: - for f in $ac_file_in; do - case $f in - -) echo $tmp/stdin ;; - [\\/$]*) - # Absolute (can't be DOS-style, as IFS=:) - test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 -echo "$as_me: error: cannot find input file: $f" >&2;} - { (exit 1); exit 1; }; } - # Do quote $f, to prevent DOS paths from being IFS'd. - echo "$f";; - *) # Relative - if test -f "$f"; then - # Build tree - echo "$f" - elif test -f "$srcdir/$f"; then - # Source tree - echo "$srcdir/$f" - else - # /dev/null tree - { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 -echo "$as_me: error: cannot find input file: $f" >&2;} - { (exit 1); exit 1; }; } - fi;; - esac - done` || { (exit 1); exit 1; } - # Remove the trailing spaces. - sed 's/[ ]*$//' $ac_file_inputs >$tmp/in - -_ACEOF - -# Transform confdefs.h into two sed scripts, `conftest.defines' and -# `conftest.undefs', that substitutes the proper values into -# config.h.in to produce config.h. The first handles `#define' -# templates, and the second `#undef' templates. -# And first: Protect against being on the right side of a sed subst in -# config.status. Protect against being in an unquoted here document -# in config.status. -rm -f conftest.defines conftest.undefs -# Using a here document instead of a string reduces the quoting nightmare. -# Putting comments in sed scripts is not portable. -# -# `end' is used to avoid that the second main sed command (meant for -# 0-ary CPP macros) applies to n-ary macro definitions. -# See the Autoconf documentation for `clear'. -cat >confdef2sed.sed <<\_ACEOF -s/[\\&,]/\\&/g -s,[\\$`],\\&,g -t clear -: clear -s,^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*\)\(([^)]*)\)[ ]*\(.*\)$,${ac_dA}\1${ac_dB}\1\2${ac_dC}\3${ac_dD},gp -t end -s,^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\)$,${ac_dA}\1${ac_dB}\1${ac_dC}\2${ac_dD},gp -: end -_ACEOF -# If some macros were called several times there might be several times -# the same #defines, which is useless. Nevertheless, we may not want to -# sort them, since we want the *last* AC-DEFINE to be honored. -uniq confdefs.h | sed -n -f confdef2sed.sed >conftest.defines -sed 's/ac_d/ac_u/g' conftest.defines >conftest.undefs -rm -f confdef2sed.sed - -# This sed command replaces #undef with comments. This is necessary, for -# example, in the case of _POSIX_SOURCE, which is predefined and required -# on some systems where configure will not decide to define it. -cat >>conftest.undefs <<\_ACEOF -s,^[ ]*#[ ]*undef[ ][ ]*[a-zA-Z_][a-zA-Z_0-9]*,/* & */, -_ACEOF - -# Break up conftest.defines because some shells have a limit on the size -# of here documents, and old seds have small limits too (100 cmds). -echo ' # Handle all the #define templates only if necessary.' >>$CONFIG_STATUS -echo ' if grep "^[ ]*#[ ]*define" $tmp/in >/dev/null; then' >>$CONFIG_STATUS -echo ' # If there are no defines, we may have an empty if/fi' >>$CONFIG_STATUS -echo ' :' >>$CONFIG_STATUS -rm -f conftest.tail -while grep . conftest.defines >/dev/null -do - # Write a limited-size here document to $tmp/defines.sed. - echo ' cat >$tmp/defines.sed <>$CONFIG_STATUS - # Speed up: don't consider the non `#define' lines. - echo '/^[ ]*#[ ]*define/!b' >>$CONFIG_STATUS - # Work around the forget-to-reset-the-flag bug. - echo 't clr' >>$CONFIG_STATUS - echo ': clr' >>$CONFIG_STATUS - sed ${ac_max_here_lines}q conftest.defines >>$CONFIG_STATUS - echo 'CEOF - sed -f $tmp/defines.sed $tmp/in >$tmp/out - rm -f $tmp/in - mv $tmp/out $tmp/in -' >>$CONFIG_STATUS - sed 1,${ac_max_here_lines}d conftest.defines >conftest.tail - rm -f conftest.defines - mv conftest.tail conftest.defines -done -rm -f conftest.defines -echo ' fi # grep' >>$CONFIG_STATUS -echo >>$CONFIG_STATUS - -# Break up conftest.undefs because some shells have a limit on the size -# of here documents, and old seds have small limits too (100 cmds). -echo ' # Handle all the #undef templates' >>$CONFIG_STATUS -rm -f conftest.tail -while grep . conftest.undefs >/dev/null -do - # Write a limited-size here document to $tmp/undefs.sed. - echo ' cat >$tmp/undefs.sed <>$CONFIG_STATUS - # Speed up: don't consider the non `#undef' - echo '/^[ ]*#[ ]*undef/!b' >>$CONFIG_STATUS - # Work around the forget-to-reset-the-flag bug. - echo 't clr' >>$CONFIG_STATUS - echo ': clr' >>$CONFIG_STATUS - sed ${ac_max_here_lines}q conftest.undefs >>$CONFIG_STATUS - echo 'CEOF - sed -f $tmp/undefs.sed $tmp/in >$tmp/out - rm -f $tmp/in - mv $tmp/out $tmp/in -' >>$CONFIG_STATUS - sed 1,${ac_max_here_lines}d conftest.undefs >conftest.tail - rm -f conftest.undefs - mv conftest.tail conftest.undefs -done -rm -f conftest.undefs - -cat >>$CONFIG_STATUS <<\_ACEOF - # Let's still pretend it is `configure' which instantiates (i.e., don't - # use $as_me), people would be surprised to read: - # /* config.h. Generated by config.status. */ - if test x"$ac_file" = x-; then - echo "/* Generated by configure. */" >$tmp/config.h - else - echo "/* $ac_file. Generated by configure. */" >$tmp/config.h - fi - cat $tmp/in >>$tmp/config.h - rm -f $tmp/in - if test x"$ac_file" != x-; then - if diff $ac_file $tmp/config.h >/dev/null 2>&1; then - { echo "$as_me:$LINENO: $ac_file is unchanged" >&5 -echo "$as_me: $ac_file is unchanged" >&6;} - else - ac_dir=`(dirname "$ac_file") 2>/dev/null || -$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$ac_file" : 'X\(//\)[^/]' \| \ - X"$ac_file" : 'X\(//\)$' \| \ - X"$ac_file" : 'X\(/\)' \| \ - . : '\(.\)' 2>/dev/null || -echo X"$ac_file" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } - /^X\(\/\/\)[^/].*/{ s//\1/; q; } - /^X\(\/\/\)$/{ s//\1/; q; } - /^X\(\/\).*/{ s//\1/; q; } - s/.*/./; q'` - { if $as_mkdir_p; then - mkdir -p "$ac_dir" - else - as_dir="$ac_dir" - as_dirs= - while test ! -d "$as_dir"; do - as_dirs="$as_dir $as_dirs" - as_dir=`(dirname "$as_dir") 2>/dev/null || -$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$as_dir" : 'X\(//\)[^/]' \| \ - X"$as_dir" : 'X\(//\)$' \| \ - X"$as_dir" : 'X\(/\)' \| \ - . : '\(.\)' 2>/dev/null || -echo X"$as_dir" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } - /^X\(\/\/\)[^/].*/{ s//\1/; q; } - /^X\(\/\/\)$/{ s//\1/; q; } - /^X\(\/\).*/{ s//\1/; q; } - s/.*/./; q'` - done - test ! -n "$as_dirs" || mkdir $as_dirs - fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5 -echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;} - { (exit 1); exit 1; }; }; } +done # for ac_tag - rm -f $ac_file - mv $tmp/config.h $ac_file - fi - else - cat $tmp/config.h - rm -f $tmp/config.h - fi -done -_ACEOF - -cat >>$CONFIG_STATUS <<\_ACEOF -{ (exit 0); exit 0; } +as_fn_exit 0 _ACEOF -chmod +x $CONFIG_STATUS ac_clean_files=$ac_clean_files_save +test $ac_write_fail = 0 || + as_fn_error $? "write failure creating $CONFIG_STATUS" "$LINENO" 5 + # configure is writing to config.log, and then calls config.status. # config.status does its own redirection, appending to config.log. @@ -7505,6 +7019,10 @@ if test "$no_create" != yes; then exec 5>>config.log # Use ||, not &&, to avoid exiting from the if with $? = 1, which # would make configure fail if this is the last instruction. - $ac_cs_success || { (exit 1); exit 1; } + $ac_cs_success || as_fn_exit 1 +fi +if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5 +$as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} fi diff --git a/source/configure.in b/source/configure.in index f0e2722..90d4339 100644 --- a/source/configure.in +++ b/source/configure.in @@ -82,6 +82,11 @@ AC_ARG_ENABLE(syslog, [ --enable-syslog use syslog for logging [experimen AC_DEFINE([USE_SYSLOG], [1], [Use syslog for logging]) fi], [AC_DEFINE([USE_SYSLOG], [1], [Use syslog for logging])]) +AC_ARG_ENABLE(netspool, [ --enable-netspool network attached inbound/outbound], + [if test $enableval = yes; then + AC_DEFINE([NETSPOOL], [1], [Use netspool]) + fi], [AC_DEFINE([NETSPOOL], [1], [Use netspool])]) + AC_ARG_ENABLE(buggy_emsi, [ --disable-buggy-emsi disable buggy emsi support (default)], [if test $enableval = yes; then AC_DEFINE([BUGGY_EMSI], [1], [Disable buggy emsi]) diff --git a/source/include/acconfig.h b/source/include/acconfig.h deleted file mode 100644 index a2af565..0000000 --- a/source/include/acconfig.h +++ /dev/null @@ -1,22 +0,0 @@ - -/* Do you want debug code to be compiled? */ -#undef DEBUG - -/* Do you want use DCD line control? */ -#undef MODEM_WATCH_CARRIER - -/* Do you want hangup to watch for modem DCD line? */ -#undef MODEM_HANGUP_WATCH_CARRIER - -/* Version string */ -#undef RELEASE_VERSION - -/* Disable passwords logging? */ -#undef BFORCE_LOG_PASSWD - -/* Path to the UUCP lock files directory */ -#undef BFORCE_LOCK_DIR - -/* Do you want use .csy locks? */ -#undef BFORCE_USE_CSY - diff --git a/source/include/config.h.in b/source/include/config.h.in index bfe4224..795ff8a 100644 --- a/source/include/config.h.in +++ b/source/include/config.h.in @@ -62,6 +62,9 @@ /* Do you want to use syslog? */ #undef USE_SYSLOG +/* Netspool */ +#undef NETSPOOL + /* Do you want use .csy locks? */ #undef BFORCE_USE_CSY diff --git a/source/include/netspool.h b/source/include/netspool.h index 7c5be8d..1f9da03 100644 --- a/source/include/netspool.h +++ b/source/include/netspool.h @@ -1,4 +1,18 @@ +/* + * binkleyforce -- unix FTN mailer project + * + * Copyright (c) 1998-2000 Alexander Belkin, 2:5020/1398.11 + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * $Id$ + */ +#ifndef _NETSPOOL_H_ +#define _NETSPOOL_H_ #define NS_NOTINIT (0) #define NS_UNCONF (1) @@ -6,15 +20,28 @@ #define NS_READY (3) #define NS_RECEIVING (4) #define NS_RECVFILE (5) -#define NS_CLOSED (6) #define STRBUF (1024) typedef struct { int state; - char *error; + const char *error; int socket; - int filename[STRBUF]; + char filename[STRBUF]; unsigned long long length; } s_netspool_state; +/* create socket and start session */ +void netspool_start(s_netspool_state *state, const char *host, const char *port, const char *address, const char *password); +/* request for outbound */ +void netspool_query(s_netspool_state *state, const char *what); +/* receive next file */ +void netspool_receive(s_netspool_state *state); +/* read data */ +int netspool_read(s_netspool_state *state, void *buf, int buflen); +/* acknowledge successful file transmission */ +void netspool_acknowledge(s_netspool_state *state); +/* end session */ +void netspool_end(s_netspool_state *state); + +#endif diff --git a/source/include/outbound.h b/source/include/outbound.h index ef30754..ccc74f9 100644 --- a/source/include/outbound.h +++ b/source/include/outbound.h @@ -27,6 +27,7 @@ #define ACTION_UNLINK 0x001 /* Unlink file if send successful */ #define ACTION_TRUNCATE 0x002 /* Truncate file if send successful */ #define ACTION_FORCEUNLINK 0x004 /* Unlink file in any case after ses.*/ +#define ACTION_ACKNOWLEDGE 0x008 /* Report success to netspool server */ #define TYPE_UNKNOWN 0x000 #define TYPE_NETMAIL 0x001 diff --git a/source/openwrt-conf b/source/openwrt-conf index 2425633..9638897 100644 --- a/source/openwrt-conf +++ b/source/openwrt-conf @@ -11,4 +11,4 @@ CC=$PREFIX-gcc export PATH CC CPP -#./configure --prefix=/opt/bforce --host=mips-openwrt-linux --disable-syslog +#./configure --prefix=/opt/bforce --host=mips-openwrt-linux --disable-syslog --enable-netspool From e258f5b794f66715c851f9a5ecd8046466bb53e7 Mon Sep 17 00:00:00 2001 From: Sergey Dorofeev Date: Sat, 4 Feb 2012 23:24:53 +0400 Subject: [PATCH 07/29] netspool going beta --- source/bforce/conf_proc.c | 23 ++++++++++++++--------- source/bforce/prot_common.c | 8 +++++++- 2 files changed, 21 insertions(+), 10 deletions(-) diff --git a/source/bforce/conf_proc.c b/source/bforce/conf_proc.c index 83b7278..85ab298 100644 --- a/source/bforce/conf_proc.c +++ b/source/bforce/conf_proc.c @@ -163,19 +163,24 @@ s_conf_entry bforce_config[BFORCE_NUMBER_OF_KEYWORDS+1] = { CONF_KEY(zmodem_mincps_send, CT_CONNLIST), CONF_KEY(zmodem_send_dummy_pkt, CT_BOOLEAN), CONF_KEY(zmodem_skip_by_pos, CT_BOOLEAN), - CONF_KEY(zmodem_start_block_size, CT_NUMBER), - CONF_KEY(zmodem_tx_window, CT_NUMBER), - CONF_KEY(nomail_flag, CT_STRING), - CONF_KEY(bind_ip, CT_STRING), - CONF_KEY(recieved_to_lower, CT_BOOLEAN), + CONF_KEY(zmodem_start_block_size, CT_NUMBER), + CONF_KEY(zmodem_tx_window, CT_NUMBER), + CONF_KEY(nomail_flag, CT_STRING), + CONF_KEY(bind_ip, CT_STRING), + CONF_KEY(recieved_to_lower, CT_BOOLEAN), #ifdef USE_SYSLOG - CONF_KEY(syslog_facility, CT_NUMBER), + CONF_KEY(syslog_facility, CT_NUMBER), #endif #ifdef DEBUG - CONF_KEY(debug_file, CT_STRING), - CONF_KEY(debug_level, CT_DEBLEVEL), + CONF_KEY(debug_file, CT_STRING), + CONF_KEY(debug_level, CT_DEBLEVEL), #endif - CONF_KEY(split_inbound, CT_BOOLEAN), + CONF_KEY(split_inbound, CT_BOOLEAN), +#ifdef NETSPOOL + CONF_KEY(netspool_host, CT_STRING), + CONF_KEY(netspool_port, CT_STRING), +#endif + CONF_END() }; diff --git a/source/bforce/prot_common.c b/source/bforce/prot_common.c index 08ac451..4cd66e3 100644 --- a/source/bforce/prot_common.c +++ b/source/bforce/prot_common.c @@ -110,6 +110,7 @@ static int prot_get_next_file(s_filelist **dest, s_protinfo *pi) char *host = conf_string(cf_netspool_host); char *port = conf_string(cf_netspool_port); if(host==NULL) { + log("netspool is not configured"); state.netspool.state = NS_UNCONF; } else { snprintf(address, 299, state.node.addr.point? "%d:%d/%d.%d": "%d.%d.%d", @@ -120,6 +121,7 @@ static int prot_get_next_file(s_filelist **dest, s_protinfo *pi) } else { password[0] = 0; } + log("netspool start %s %s %s %s", host, port, address, password); netspool_start(&state.netspool, host, port, address, password); } } @@ -140,7 +142,11 @@ static int prot_get_next_file(s_filelist **dest, s_protinfo *pi) return 0; } - log("netspool gives no more files"); + if(state.netspool.state==NS_ERROR) { + log("netspool error %s", state.netspool.error); + } else { + log("netspool gives no more files"); + } #endif From ccd02f74d684047ffdec9225d6454f455e52d4d8 Mon Sep 17 00:00:00 2001 From: Sergey Dorofeev Date: Sun, 5 Feb 2012 00:26:57 +0400 Subject: [PATCH 08/29] shit --- source/bforce/prot_common.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/bforce/prot_common.c b/source/bforce/prot_common.c index 4cd66e3..38701c5 100644 --- a/source/bforce/prot_common.c +++ b/source/bforce/prot_common.c @@ -113,7 +113,7 @@ static int prot_get_next_file(s_filelist **dest, s_protinfo *pi) log("netspool is not configured"); state.netspool.state = NS_UNCONF; } else { - snprintf(address, 299, state.node.addr.point? "%d:%d/%d.%d": "%d.%d.%d", + snprintf(address, 299, state.node.addr.point? "%d:%d/%d.%d": "%d:%d/%d", state.node.addr.zone, state.node.addr.net, state.node.addr.node, state.node.addr.point); if(state.protected) { From 941a199f7d3686b87ddc33baa7c8f85545a5100f Mon Sep 17 00:00:00 2001 From: Sergey Dorofeev Date: Sun, 5 Feb 2012 00:39:52 +0400 Subject: [PATCH 09/29] password length limit for netspool --- source/bforce/prot_common.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/bforce/prot_common.c b/source/bforce/prot_common.c index 38701c5..935032e 100644 --- a/source/bforce/prot_common.c +++ b/source/bforce/prot_common.c @@ -105,7 +105,7 @@ static int prot_get_next_file(s_filelist **dest, s_protinfo *pi) log("start netspool"); if(state.netspool.state == NS_NOTINIT) { log("netspool connection"); - char password[9]; + char password[100]; char address[300]; char *host = conf_string(cf_netspool_host); char *port = conf_string(cf_netspool_port); @@ -117,7 +117,7 @@ static int prot_get_next_file(s_filelist **dest, s_protinfo *pi) state.node.addr.zone, state.node.addr.net, state.node.addr.node, state.node.addr.point); if(state.protected) { - session_get_password(state.node.addr, password, 8); + session_get_password(state.node.addr, password, 100); } else { password[0] = 0; } From e3533cfbe086eecda713813037d93e9a14eb6444 Mon Sep 17 00:00:00 2001 From: Sergey Dorofeev Date: Sun, 5 Feb 2012 10:43:54 +0400 Subject: [PATCH 10/29] binkp workaround --- source/bforce/prot_common.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/source/bforce/prot_common.c b/source/bforce/prot_common.c index 935032e..e1daeb6 100644 --- a/source/bforce/prot_common.c +++ b/source/bforce/prot_common.c @@ -134,6 +134,9 @@ static int prot_get_next_file(s_filelist **dest, s_protinfo *pi) if(state.netspool.state == NS_RECEIVING) { log("netspool begin receive"); netspool_receive(&state.netspool); + } else { + log("netspool is busy"); + return 1; } if(state.netspool.state == NS_RECVFILE) { From 64074ffb24384958638b6fa2b4e8f5784e7ffb49 Mon Sep 17 00:00:00 2001 From: Sergey Dorofeev Date: Sun, 5 Feb 2012 23:18:21 +0400 Subject: [PATCH 11/29] disable NR in NETSPOOL mode due to fatal incompatibility --- CHANGES.fidoman | 2 ++ source/bforce/prot_binkp.c | 4 ++++ source/bforce/prot_binkp_misc.c | 9 +++++++-- source/bforce/prot_common.c | 29 ++++++++++++++++++----------- 4 files changed, 31 insertions(+), 13 deletions(-) diff --git a/CHANGES.fidoman b/CHANGES.fidoman index 5af1697..ef27328 100644 --- a/CHANGES.fidoman +++ b/CHANGES.fidoman @@ -1,6 +1,8 @@ === 2012-02 === Netspool support +Netspool forcibly disables NR mode in binkp +(due to NR mode requires access to file on local filesystem) === 2011-12-25 === diff --git a/source/bforce/prot_binkp.c b/source/bforce/prot_binkp.c index f687a63..274cffe 100644 --- a/source/bforce/prot_binkp.c +++ b/source/bforce/prot_binkp.c @@ -363,7 +363,9 @@ int binkp_incoming(s_binkp_sysinfo *local_data, s_binkp_sysinfo *remote_data) override_get (&ovr, remote_data->addrs[i].addr, 0); if (!nodelist_checkflag (ovr.sFlags, "NR")) { +#ifndef NETSPOOL szOpt = xstrcat (szOpt, " NR"); +#endif break; } } @@ -439,6 +441,7 @@ int binkp_transfer(s_protinfo *pi) { if (remote->options & BINKP_OPT_NR) { binkp_queuemsgf(&bpi,BPMSG_FILE,"%s %ld %ld -1",name,total,time); binkp_send_state = BPT_Wait_M_GET; + log("binkp going to BPT_Wait_M_GET"); } else { binkp_queuemsgf(&bpi,BPMSG_FILE,"%s %ld %ld 0", name,total,time); binkp_send_state = BPT_Send_File; @@ -446,6 +449,7 @@ int binkp_transfer(s_protinfo *pi) { } } if (binkp_send_state == BPT_Send_File) { + log("binkp BPT_Send_File"); if (bpi.opos == 0 && bpi.n_msgs == 0) { if((n = p_tx_readfile (bpi.obuf+BINKP_BLK_HDRSIZE,4096,pi))<0) { p_tx_fclose (pi); diff --git a/source/bforce/prot_binkp_misc.c b/source/bforce/prot_binkp_misc.c index b84bf63..8321f86 100644 --- a/source/bforce/prot_binkp_misc.c +++ b/source/bforce/prot_binkp_misc.c @@ -538,8 +538,10 @@ void binkp_queue_sysinfo(s_bpinfo *bpi, s_binkp_sysinfo *binkp) if (state.caller) { char *szOpt = xstrcpy (" MB"); +#ifndef NETSPOOL if (!nodelist_checkflag (state.node.flags, "NR")) szOpt = xstrcat (szOpt, " NR"); +#endif if (!nodelist_checkflag (state.node.flags, "ND")) szOpt = xstrcat (szOpt, " ND"); if (*szOpt) @@ -732,9 +734,12 @@ void binkp_parse_options(s_binkp_sysinfo *binkp, char *options) for( p = string_token(options, &n, NULL, 0); p; p = string_token(NULL, &n, NULL, 0) ) { - if( !strcmp(p, "NR") ) +#ifndef NETSPOOL + if( !strcmp(p, "NR") ) { binkp->options |= BINKP_OPT_NR; - else if( !strcmp(p, "MB") ) + } else +#endif + if( !strcmp(p, "MB") ) binkp->options |= BINKP_OPT_MB; else if( !strcmp(p, "MPWD") ) binkp->options |= BINKP_OPT_MPWD; diff --git a/source/bforce/prot_common.c b/source/bforce/prot_common.c index e1daeb6..21273bb 100644 --- a/source/bforce/prot_common.c +++ b/source/bforce/prot_common.c @@ -102,9 +102,9 @@ static int prot_get_next_file(s_filelist **dest, s_protinfo *pi) /* network queue */ #ifdef NETSPOOL - log("start netspool"); + log("netspool next file"); if(state.netspool.state == NS_NOTINIT) { - log("netspool connection"); + log("new netspool connection"); char password[100]; char address[300]; char *host = conf_string(cf_netspool_host); @@ -135,7 +135,7 @@ static int prot_get_next_file(s_filelist **dest, s_protinfo *pi) log("netspool begin receive"); netspool_receive(&state.netspool); } else { - log("netspool is busy"); + log("netspool could not start receive"); return 1; } @@ -144,11 +144,14 @@ static int prot_get_next_file(s_filelist **dest, s_protinfo *pi) *dest = NULL; return 0; } - + + if(state.netspool.state == NS_READY) { + log("no files to receive"); + netspool_end(&state.netspool); + } + if(state.netspool.state==NS_ERROR) { - log("netspool error %s", state.netspool.error); - } else { - log("netspool gives no more files"); + log("no next file: netspool error %s", state.netspool.error); } #endif @@ -452,6 +455,7 @@ int p_tx_fclose(s_protinfo *pi) break; #ifdef NETSPOOL case ACTION_ACKNOWLEDGE: + log("netspool commit %s", state.netspool.filename); netspool_acknowledge(&state.netspool); break; #endif @@ -482,6 +486,7 @@ int p_tx_readfile(char *buffer, size_t buflen, s_protinfo *pi) #ifdef NETSPOOL if(pi->send->fname==NULL && strcmp(pi->send->local_name, "NETSPOOL")==0 ) { + log("reading netspool file"); if( state.netspool.state != NS_RECVFILE ) { log("send: wrong netspool state"); pi->send->status = FSTAT_SKIPPED; @@ -490,12 +495,14 @@ int p_tx_readfile(char *buffer, size_t buflen, s_protinfo *pi) n = netspool_read(&state.netspool, buffer, buflen); pi->send->eofseen = state.netspool.length == 0; if( n==-1 ) { - log("send: netspool error"); - log(state.netspool.error); + log("send: netspool error %s", state.netspool.error); pi->send->status = FSTAT_SKIPPED; return -2; } + log("got %d bytes from netspool", n); return n; + } else { + log("reading local file"); } #endif /* @@ -1295,9 +1302,9 @@ void p_session_cleanup(s_protinfo *pi, bool success) #ifdef NETSPOOL if(state.netspool.state==NS_ERROR) { - log("netspool error %s", state.netspool.error); + log("end session: netspool error %s", state.netspool.error); } - netspool_end(&state.netspool); + /*netspool_end(&state.netspool);*/ #endif } From d2d1edf80a328b75b548db57b819bb6745fd3e21 Mon Sep 17 00:00:00 2001 From: Sergey Dorofeev Date: Sun, 5 Feb 2012 23:28:42 +0400 Subject: [PATCH 12/29] disable NR in NETSPOOL mode due to fatal incompatibility --- source/bforce/prot_binkp.c | 4 ++-- source/bforce/prot_common.c | 20 ++++++++++---------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/source/bforce/prot_binkp.c b/source/bforce/prot_binkp.c index 274cffe..e9528af 100644 --- a/source/bforce/prot_binkp.c +++ b/source/bforce/prot_binkp.c @@ -441,7 +441,7 @@ int binkp_transfer(s_protinfo *pi) { if (remote->options & BINKP_OPT_NR) { binkp_queuemsgf(&bpi,BPMSG_FILE,"%s %ld %ld -1",name,total,time); binkp_send_state = BPT_Wait_M_GET; - log("binkp going to BPT_Wait_M_GET"); + /*log("binkp going to BPT_Wait_M_GET");*/ } else { binkp_queuemsgf(&bpi,BPMSG_FILE,"%s %ld %ld 0", name,total,time); binkp_send_state = BPT_Send_File; @@ -449,7 +449,7 @@ int binkp_transfer(s_protinfo *pi) { } } if (binkp_send_state == BPT_Send_File) { - log("binkp BPT_Send_File"); + /*log("binkp BPT_Send_File");*/ if (bpi.opos == 0 && bpi.n_msgs == 0) { if((n = p_tx_readfile (bpi.obuf+BINKP_BLK_HDRSIZE,4096,pi))<0) { p_tx_fclose (pi); diff --git a/source/bforce/prot_common.c b/source/bforce/prot_common.c index 21273bb..06ceecc 100644 --- a/source/bforce/prot_common.c +++ b/source/bforce/prot_common.c @@ -102,9 +102,9 @@ static int prot_get_next_file(s_filelist **dest, s_protinfo *pi) /* network queue */ #ifdef NETSPOOL - log("netspool next file"); + /*log("netspool next file");*/ if(state.netspool.state == NS_NOTINIT) { - log("new netspool connection"); + /*log("new netspool connection");*/ char password[100]; char address[300]; char *host = conf_string(cf_netspool_host); @@ -121,18 +121,18 @@ static int prot_get_next_file(s_filelist **dest, s_protinfo *pi) } else { password[0] = 0; } - log("netspool start %s %s %s %s", host, port, address, password); + log("netspool start %s %s %s (pwd)", host, port, address); netspool_start(&state.netspool, host, port, address, password); } } if(state.netspool.state == NS_READY) { - log("netspool request"); + /*log("netspool request");*/ netspool_query(&state.netspool, "ALL"); } if(state.netspool.state == NS_RECEIVING) { - log("netspool begin receive"); + /*log("netspool begin receive");*/ netspool_receive(&state.netspool); } else { log("netspool could not start receive"); @@ -140,13 +140,13 @@ static int prot_get_next_file(s_filelist **dest, s_protinfo *pi) } if(state.netspool.state == NS_RECVFILE) { - log("netspool start file"); + /*log("netspool start file");*/ *dest = NULL; return 0; } if(state.netspool.state == NS_READY) { - log("no files to receive"); + log("netspool queue empty"); netspool_end(&state.netspool); } @@ -486,7 +486,7 @@ int p_tx_readfile(char *buffer, size_t buflen, s_protinfo *pi) #ifdef NETSPOOL if(pi->send->fname==NULL && strcmp(pi->send->local_name, "NETSPOOL")==0 ) { - log("reading netspool file"); + /*log("reading netspool file");*/ if( state.netspool.state != NS_RECVFILE ) { log("send: wrong netspool state"); pi->send->status = FSTAT_SKIPPED; @@ -499,10 +499,10 @@ int p_tx_readfile(char *buffer, size_t buflen, s_protinfo *pi) pi->send->status = FSTAT_SKIPPED; return -2; } - log("got %d bytes from netspool", n); + /*log("got %d bytes from netspool", n);*/ return n; } else { - log("reading local file"); + /*log("reading local file");*/ } #endif /* From 185cff17a56e3185049f01b295307bb5f38a3e4b Mon Sep 17 00:00:00 2001 From: Sergey Dorofeev Date: Tue, 21 Feb 2012 08:53:49 +0400 Subject: [PATCH 13/29] binkp reengineered --- source/bforce/netspool.c | 43 +- source/bforce/prot_binkp.c | 1678 ++++++++++++++++++++----------- source/bforce/prot_binkp_misc.c | 473 +-------- source/bforce/prot_common.c | 61 +- source/bforce/prot_hydra.c | 2 +- source/bforce/prot_zmsend.c | 2 +- source/bforce/sess_main.c | 11 +- source/include/bforce.h | 1 - source/include/includes.h | 1 + source/include/prot_binkp.h | 98 +- source/include/prot_common.h | 47 +- source/openwrt-conf | 2 + 12 files changed, 1250 insertions(+), 1169 deletions(-) mode change 100644 => 100755 source/openwrt-conf diff --git a/source/bforce/netspool.c b/source/bforce/netspool.c index 5269bdf..86e9db1 100644 --- a/source/bforce/netspool.c +++ b/source/bforce/netspool.c @@ -19,12 +19,12 @@ int readstr(int s, char *buf, int len) { while(1) { r=recv(s, &c, 1, 0); if(r==0){ - puts("remote socket shutdown"); + //puts("remote socket shutdown"); return -3; } if(r==-1){ - puts("error reading string"); - printf("%d %s\n", errno, strerror(errno)); + //puts("error reading string"); + //printf("%d %s\n", errno, strerror(errno)); return -3; } if(c=='\n') { @@ -34,7 +34,7 @@ int readstr(int s, char *buf, int len) { *buf++=c; len--; if(!len) { - puts("string buffer overflow"); + //puts("string buffer overflow"); return -3; } } @@ -48,24 +48,24 @@ int sendstr(int s, const char *buf) { while(l>0) { c=send(s, buf, l, 0); if(c==-1){ - puts("error sending string"); - printf("%d %s\n", errno, strerror(errno)); + //puts("error sending string"); + //printf("%d %s\n", errno, strerror(errno)); return -3; } if(c==0){ - puts("zero send: may loop infinitely"); + //puts("zero send: may loop infinitely"); return -3; } l-=c; } c=send(s, &nl, 1, 0); if(c==-1){ - puts("error sending string"); - printf("%d %s\n", errno, strerror(errno)); + //puts("error sending string"); + //printf("%d %s\n", errno, strerror(errno)); return -3; } if(c==0){ - puts("zero send: may loop infinitely"); + //puts("zero send: may loop infinitely"); return -3; } return 0; @@ -107,7 +107,8 @@ void netspool_start(s_netspool_state *state, const char *host, const char *port, while(a) { r = connect(s, a->ai_addr, a->ai_addrlen); if(r==-1) { - printf("%d %s\n", errno, strerror(errno)); + //printf("%d %s\n", errno, strerror(errno)); + ; } else { break; } @@ -122,16 +123,16 @@ void netspool_start(s_netspool_state *state, const char *host, const char *port, } r = readstr(s, strbuf, STRBUF); - if( r ) { state->state = NS_ERROR; state->error = "IO error"; } - puts(strbuf); + if( r ) { state->state = NS_ERROR; state->error = "IO error"; return; } + //puts(strbuf); -- hello from remote snprintf(strbuf, STRBUF, "ADDRESS %s", address); r = sendstr(s, strbuf); - if( r ) { state->state = NS_ERROR; state->error = "IO error"; } + if( r ) { state->state = NS_ERROR; state->error = "IO error"; return; } snprintf(strbuf, STRBUF, "PASSWORD %s", password); r = sendstr(s, strbuf); - if( r ) { state->state = NS_ERROR; state->error = "IO error"; } + if( r ) { state->state = NS_ERROR; state->error = "IO error"; return; } state->state = NS_READY; } @@ -157,7 +158,7 @@ void netspool_receive(s_netspool_state *state) r = readstr(state->socket, strbuf, STRBUF); if( r ) { state->state = NS_ERROR; state->error = "IO error"; return; } - puts(strbuf); + //puts(strbuf); if(strcmp(strbuf, "QUEUE EMPTY")==0) { state->state = NS_READY; return; @@ -165,7 +166,7 @@ void netspool_receive(s_netspool_state *state) if(strncmp(strbuf, "FILENAME ", 9)==0) { strcpy(state->filename, strbuf+9); - puts(state->filename); + //puts(state->filename); } else { state->state = NS_ERROR; state->error = "expected filename or queue empty"; @@ -180,7 +181,7 @@ void netspool_receive(s_netspool_state *state) exit(-5); } */ sscanf(strbuf+7, "%Lu", &state->length); - printf("length=%Lu\n", state->length); + //printf("length=%Lu\n", state->length); state->state = NS_RECVFILE; } else { state->state = NS_ERROR; @@ -194,7 +195,7 @@ int netspool_read(s_netspool_state *state, void *buf, int buflen) { int n; if( state->length == 0 ) { - puts("everithing is read"); + //puts("everithing is read"); return 0; } @@ -207,8 +208,8 @@ int netspool_read(s_netspool_state *state, void *buf, int buflen) } if(n==-1) { - puts("error reading data"); - printf("%d %s\n", errno, strerror(errno)); + //puts("error reading data"); + //printf("%d %s\n", errno, strerror(errno)); state->state = NS_ERROR; state->error = "IO error"; return -1; diff --git a/source/bforce/prot_binkp.c b/source/bforce/prot_binkp.c index e9528af..6d83be4 100644 --- a/source/bforce/prot_binkp.c +++ b/source/bforce/prot_binkp.c @@ -21,23 +21,1064 @@ #include "prot_common.h" #include "prot_binkp.h" -typedef enum { - BPI_SendSysInfo, - BPI_WaitADR, - BPI_WaitPWD, - BPI_Auth -} binkp_incoming_state; +#define BINKP_HEADER (2) +#define BINKP_MAXBLOCK (32768) + +#define BINKP_BLK_CMD (1) +#define BINKP_BLK_DATA (2) typedef enum { - BPO_SendSysInfo, - BPO_WaitNUL, - BPO_SendPWD, - BPO_WaitADR, - BPO_Auth, - BPO_WaitOK -} binkp_outgoing_state; + frs_nothing, + frs_data, + frs_didget, + frs_skipping +} e_file_receive_status; + +typedef struct { + e_binkp_mode mode; + int phase; + int subphase; + s_binkp_sysinfo *local_data; + s_binkp_sysinfo *remote_data; + s_protinfo *pi; + bool address_established; // indicates that remote address is verified and disallows further change + char extracmd[BINKP_MAXBLOCK+1]; + bool extraislast; + bool password_received; + bool NR; + bool MB; + bool complete; + int batchsendcomplete; + int batchreceivecomplete; + bool waiting_got; + int batch_send_count; + int batch_recv_count; + e_file_receive_status frs; + int emptyloop; +} s_binkp_state; + +int binkp_getforsend(s_binkp_state *bstate, char *buf, int *block_type, unsigned short *block_length); +int binkp_doreceiveblock(s_binkp_state *bstate, char *buf, int block_type, unsigned short block_length); +void binkp_process_NUL(s_binkp_sysinfo *remote_data, char *buffer); +void binkp_process_ADR(s_binkp_sysinfo *remote_data, char *buffer); + +int binkp_loop(s_binkp_state *bstate) { + unsigned char readbuf[BINKP_HEADER+BINKP_MAXBLOCK+1]; + unsigned char writebuf[BINKP_HEADER+BINKP_MAXBLOCK+1]; + + int rc = HRC_OK; + + bstate->phase = 0; + bstate->subphase = 0; + bstate->extracmd[0] = -1; + bstate->extraislast = false; + bstate->password_received = false; + bstate->NR = false; + if(bstate->remote_data->options & BINKP_OPT_NR) { + bstate->NR = true; + } + bstate->MB = false; + if(bstate->remote_data->options & BINKP_OPT_MB) { + bstate->MB = true; + } + bstate->complete = false; // end in this mode (handshake or session) + bstate->batchsendcomplete = 0; + bstate->batchreceivecomplete = 0; + bstate->waiting_got = false; + bstate->batch_send_count = 0; + bstate->batch_recv_count = 0; + bstate->frs = frs_nothing; + bstate->emptyloop = 0; + + unsigned short read_pos=0; + unsigned short read_blklen=0; + unsigned short want_read=BINKP_HEADER; + + unsigned short write_pos=0; + unsigned short have_to_write=0; + + int n, m; + bool no_more_to_send = false; + bool no_more_read = false; + bool canread, canwrite; + + int timeout = conf_number(cf_binkp_timeout); + if( timeout==0 ) + timeout = 60; + + /* used for higher level calls */ + int block_type; + unsigned short block_length; + + // session criterium handshake criterium + while (!bstate->complete || bstate->waiting_got) { + log("loop s: %d r: %d", bstate->batchsendcomplete, bstate->batchreceivecomplete); + if(have_to_write==0 && (!no_more_to_send || bstate->extracmd[0]!=-1)) { + m = binkp_getforsend(bstate, writebuf+BINKP_HEADER, &block_type, &block_length); + if( m==1) { + //log("got block for sending %d %hu", block_type, block_length); + write_pos = 0; + have_to_write = block_length+BINKP_HEADER; + if( block_type == BINKP_BLK_CMD ) { + writebuf[0] = (block_length>>8)|0x80; + } + else if( block_type == BINKP_BLK_DATA ) { + writebuf[0] = (block_length>>8)&0x7f; + } else { + log("block for sending has invalid type, aborting"); + return -1; + } + writebuf[1] = block_length&0xff; + } else if (m==2) { + log("no more to send"); + no_more_to_send = true; + } + else if (m==0) { + log("binkp: nothing to write"); + } else { + log("getforsend error"); + return -1; + } + } + + if (bstate->batchsendcomplete && bstate->batchreceivecomplete) { + log("batch is complete"); + if (bstate->MB && (bstate->batch_send_count || bstate->batch_recv_count)) { + log("starting one more batch"); + bstate->batchsendcomplete -= 1; + bstate->batchreceivecomplete -= 1; + //bstate->firstbatch = false; + bstate->batch_send_count = 0; + bstate->batch_recv_count = 0; + no_more_to_send = false; + bstate->phase = 0; + bstate->frs = frs_nothing; + want_read = BINKP_HEADER; + continue; + } + else { + if (bstate->waiting_got) { + log("waiting for all files have being confirmed"); + } + else { + log("finishing session"); + bstate->complete = true; + want_read = 0; + } + } + } + + log("select read: %d write %d", want_read, have_to_write); + if (want_read || have_to_write) { + n = tty_select(want_read?&canread:NULL, have_to_write?&canwrite:NULL, timeout); + if( n<0 ) { + log("binkp error on tty_select"); + return -1; + } + } + else { + log("empty loop %d", ++bstate->emptyloop); + if (bstate->emptyloop==10) { + return -1; + } + } + + if(want_read && canread) { + n = tty_read(readbuf+read_pos, want_read); + if( n<0 ) { + log("binkp: tty read error"); + return -1; + } + else if (n==0) { + log("read: remote socket shutdown"); + return -1; + } + want_read -= n; + read_pos += n; + if (read_pos == BINKP_HEADER) { + // have read header, want read body + log("it should be 0: %d", want_read); + want_read = ((unsigned short)(readbuf[0]&0x7F)<<8) | readbuf[1]; + log("pending block, length %u", want_read); + } // no else here: if want_read may be zero here for zero length block + } + + // no_more_read only signs that read thread do not keep connection anymore but messages should be processed + if (want_read==0 && read_pos) { // check every loop, not only just after read as accepting may be deferred + block_type = readbuf[0]&0x80? BINKP_BLK_CMD: BINKP_BLK_DATA; + block_length = read_pos - BINKP_HEADER; + log("binkp: complete block is received %d %hu", block_type, block_length); + m = binkp_doreceiveblock(bstate, readbuf+BINKP_HEADER, block_type, block_length); + if(m==1) { + log("block is successfully accepted"); + read_pos = 0; + want_read = BINKP_HEADER; + } else if (m==2) { + log("block accepted and no more is needed in this mode"); + no_more_read = true; + read_pos = 0; + want_read = 0; //BINKP_HEADER; + } + else if (m==0) { + log("binkp: keeping buffer"); + } + else if (m==3) { + log("aborting session"); + bstate->complete = true; + rc = HRC_OTHER_ERR; + } + else { + log("doreceiveblock error"); + return -1; + } + } + + if (have_to_write && canwrite) { + log("writing %d pos %d", have_to_write, write_pos); + n = tty_write(writebuf+write_pos, have_to_write); + if( n<0 ) { + log("binkp: tty write error"); + return -1; + } + else if (n==0) { + log("write: remote socket shutdown"); + return -1; + } + //log("%d bytes sent", n); + write_pos += n; + have_to_write -= n; + } + } + return rc; +} + +int binkp_outgoing(s_binkp_sysinfo *local_data, s_binkp_sysinfo *remote_data) +{ + s_binkp_state s; + s.mode = bmode_outgoing_handshake; + s.local_data = local_data; + s.remote_data = remote_data; + s.pi = NULL; + s.address_established = false; + return binkp_loop(&s); +} + +int binkp_incoming(s_binkp_sysinfo *local_data, s_binkp_sysinfo *remote_data) +{ + s_binkp_state s; + s.mode = bmode_incoming_handshake; + s.local_data = local_data; + s.remote_data = remote_data; + s.pi = NULL; + s.address_established = false; + return binkp_loop(&s); +} + +int binkp_transfer(s_binkp_sysinfo *local_data, s_binkp_sysinfo *remote_data, s_protinfo *pi) +{ + log("start transfer"); + s_binkp_state s; + s.mode = bmode_transfer; + s.local_data = local_data; + s.remote_data = remote_data; + s.pi = pi; + return binkp_loop(&s); +} + + +// hanshake +// send +// all nuls +// address +// wait password +// send OK/ERR +// -- end handshake +// M_FILE +// (wait M_GET) +// data +// wait M_GOT +// next file +// send EOB + +// recv +// accept NULs +// accept address +// accept password +// -- end handshake +// accept M_GET or +// accept M_FILE +// accept data +// accept next file or EOB + + +int binkp_getforsend(s_binkp_state *bstate, char *buf, int *block_type, unsigned short *block_length) +{ + int my_sf, wr_pos; + int n; // read file + if (bstate->extracmd[0]!=-1) { + log("extra command from receiver %d %s", bstate->extracmd[0], bstate->extracmd+1); + buf[0] = bstate->extracmd[0]; + strcpy(buf+1, bstate->extracmd+1); + *block_type = BINKP_BLK_CMD; + *block_length = strlen(buf+1)+1; + bstate->extracmd[0] = -1; + if (bstate->extraislast) { + bstate->phase = 100; + log("extracmd is last"); + bstate->complete = true; + } + return 1; + } + if (bstate->mode==bmode_incoming_handshake || bstate->mode==bmode_outgoing_handshake ) { + switch( bstate->phase ) { +case 0: // MD5 challenge + bstate->phase+=1; + bstate->subphase=0; + if( bstate->mode==bmode_incoming_handshake && bstate->local_data->challenge_length > 0 ) + { + log("send challenge"); + char challenge[128]; + string_bin_to_hex(challenge, bstate->local_data->challenge, bstate->local_data->challenge_length); + buf[0] = BPMSG_NUL; + sprintf(buf+1, "OPT CRAM-MD5-%s", challenge); + log("sent %s", buf+1); + *block_type = BINKP_BLK_CMD; + *block_length = strlen(buf+1)+1; + return 1; + } + +case 1: // send sysinfo + my_sf = bstate->subphase; + bstate->subphase+=1; + *block_type = BINKP_BLK_CMD; + switch( my_sf ) { +case 0: + buf[0]=BPMSG_NUL; + *block_length = 1 + sprintf(buf+1, "SYS %s", bstate->local_data->systname); + return 1; +case 1: + buf[0]=BPMSG_NUL; + *block_length = 1 + sprintf(buf+1, "ZYZ %s", bstate->local_data->sysop); + return 1; +case 2: + buf[0]=BPMSG_NUL; + *block_length = 1 + sprintf(buf+1, "LOC %s", bstate->local_data->location); + return 1; +case 3: + buf[0]=BPMSG_NUL; + *block_length = 1 + sprintf(buf+1, "PHN %s", bstate->local_data->phone); + return 1; +case 4: + buf[0]=BPMSG_NUL; + *block_length = 1 + sprintf(buf+1, "NDL %s", bstate->local_data->flags); + return 1; +case 5: + buf[0]=BPMSG_NUL; + *block_length = 1 + sprintf(buf+1, "TIME %s", bstate->local_data->timestr); + return 1; +case 6: + buf[0]=BPMSG_NUL; + *block_length = 1 + sprintf(buf+1, "VER %s %s/%d.%d", + bstate->local_data->progname, bstate->local_data->protname, + bstate->local_data->majorver, bstate->local_data->minorver); + return 1; +case 7: + if (bstate->mode==bmode_outgoing_handshake) { + buf[0]=BPMSG_NUL; + strcpy(buf+1, "OPT MB"); + if (!nodelist_checkflag (state.node.flags, "NR")) + strcat(buf+1, " NR"); + // ND is too complicated and have unclear gain + // seems not to remove files from inbound until successful session end is enough to eliminate dupes + // if (!nodelist_checkflag (state.node.flags, "ND")) + // strcat(buf+1, " ND"); + *block_length = 1 + strlen(buf+1); + return 1; + } + // else skip subphase + my_sf += 1; + bstate->subphase += 1; +//case 8: + } + // here if subphase==8 + bstate->phase += 1; + bstate->subphase = 0; + // p + +case 2: + log("send address"); + bstate->phase += 1; + buf[0] = BPMSG_ADR; + wr_pos = 1; + int i; + for( i = 0; i < bstate->local_data->anum; i++ ) + { + if (i) wr_pos += sprintf(buf+wr_pos, " "); + if (bstate->local_data->addrs[i].addr.point) { + wr_pos += sprintf(buf+wr_pos, "%d:%d/%d.%d@%s", + bstate->local_data->addrs[i].addr.zone, bstate->local_data->addrs[i].addr.net, + bstate->local_data->addrs[i].addr.node, bstate->local_data->addrs[i].addr.point, + bstate->local_data->addrs[i].addr.domain); + } + else { + wr_pos += sprintf(buf+wr_pos, "%d:%d/%d@%s", + bstate->local_data->addrs[i].addr.zone, bstate->local_data->addrs[i].addr.net, + bstate->local_data->addrs[i].addr.node, + bstate->local_data->addrs[i].addr.domain); + } + } + *block_type = BINKP_BLK_CMD; + *block_length = wr_pos; + log("address: %s", buf+1); + return 1; + +case 3: // send password on outgoing or pw confirmation on incoming + // special empty password is sent if there is no password for the remote addr + if (bstate->mode==bmode_incoming_handshake) { + if (bstate->password_received) { + log("password verified"); + buf[0] = BPMSG_OK; + *block_type = BINKP_BLK_CMD; + *block_length = 1; + bstate->phase += 1; + return 1; + } + log("waiting for password from remote"); + return 0; // nothing to send + } + else if (bstate->mode==bmode_outgoing_handshake) { + if (!bstate->address_established) { + log("address not received still"); + return 0; + } + log("sending password"); + + buf[0] = BPMSG_PWD; + *block_type = BINKP_BLK_CMD; + + if( bstate->local_data->passwd == '\0' ) { + *block_length = 1 + sprintf(buf+1, "-"); + } + else if( bstate->remote_data->options & BINKP_OPT_MD5 ) { + char digest_bin[16]; + char digest_hex[33]; + + if(bstate->remote_data->challenge_length==0) { + log("waiting for challenge"); + return 0; + } + md5_cram_get(bstate->local_data->passwd, bstate->remote_data->challenge, + bstate->remote_data->challenge_length, digest_bin); + + /* Encode digest to the hex string */ + string_bin_to_hex(digest_hex, digest_bin, 16); + + *block_length = 1 + sprintf(buf+1, "CRAM-MD5-%s", digest_hex); + } + else { + *block_length = 1 + sprintf(buf+1, "%s", bstate->local_data->passwd); + } + bstate->phase += 1; + return 1; + } + else { + log("impossible mode"); + return -1; + } + + +case 4: + if (bstate->mode==bmode_incoming_handshake) { + log("incoming handshake is complete"); + bstate->complete = true; + } + else { + log("outgoing handshake: everything is sent"); + } + return 2; + } + + } + else if (bstate->mode == bmode_transfer) { + + switch (bstate->phase) { + send_next_file: + case 0: + log("fetch file from queue"); + if (p_tx_fopen(bstate->pi, NULL)) { + log("queue empty"); + bstate->phase = 4; + goto send_EOB; + } + bstate->waiting_got = true; + bstate->batch_send_count += 1; + + //send M_FILE -1 + if (bstate->NR) { + log("send M_FILE with -1"); + buf[0] = BPMSG_FILE; + *block_length = 1+sprintf(buf+1, "%s %ld %ld -1", bstate->pi->send->net_name, + bstate->pi->send->bytes_total, bstate->pi->send->mod_time); + *block_type = BINKP_BLK_CMD; + return 1; // no state change. phase would be changed to 1 by recv when M_GET is received + } + bstate->phase += 1; + + case 1: //send M_FILE - M_GET forcibly sets this phase. M_GET must open needed file + log("send M_FILE"); + buf[0] = BPMSG_FILE; + *block_length = 1+sprintf(buf+1, "%s %ld %ld 0", bstate->pi->send->net_name, + bstate->pi->send->bytes_total, bstate->pi->send->mod_time); + *block_type = BINKP_BLK_CMD; + bstate->phase += 1; + return 1; + + case 2: //send file data + n = p_tx_readfile (buf, 4096, bstate->pi); // BINKP_MAXBLOCK + if (n>0) { + *block_type = BINKP_BLK_DATA; + *block_length = n; + bstate->pi->send->bytes_sent += n; + return 1; + } + else if (n<0) { + log("p_tx_readfile error"); + return -1; + } + log("file is sent"); + bstate->pi->send->status = FSTAT_WAITACK; + + bstate->phase += 1; + + case 3: //wait for acknowlede + + if (bstate->pi->send->waitack) { + log("file must be acknowledged with M_GOT"); + int i; + bool ack = false; + for(i = 0; i < bstate->pi->n_sentfiles; i++ ) { + if (p_compfinfo(&bstate->pi->sentfiles[i], bstate->pi->send->fname, bstate->pi->send->bytes_total, bstate->pi->send->mod_time) == 0) { + if (bstate->pi->sentfiles[i].status == FSTAT_SUCCESS) { + ack = true; + log("acknowledged"); + break; + } + } + } + if (!ack) { + log("wait for ACK"); + return 0; + } + } else { + log("do not wait M_GOT"); + } + bstate->phase = 0; + goto send_next_file; + + send_EOB: + case 4: + log("send EOB n_sentfile=%d", bstate->pi->n_sentfiles); + buf[0] = BPMSG_EOB; + *block_type = BINKP_BLK_CMD; + *block_length = 1; + bstate->batchsendcomplete += 1; + bstate->phase += 1; + return 1; + + case 5: + log("nothing to send"); + return 2; + + -#define GOTO(label,newrc) { rc = (newrc); goto label; } + + } + + } else { + log("invalid mode"); + return -1; + } + log("unrecognized state, shutting down"); + bstate->complete = true; + return 2; + +} + + +int binkp_doreceiveblock(s_binkp_state *bstate, char *buf, int block_type, unsigned short block_length) +{ + switch (block_type) { +case BINKP_BLK_CMD: + if (block_length<1) { + log("zero length command received"); + return -1; + } + buf[block_length] = 0; // fencing for easy processing + switch (buf[0]) { +case BPMSG_NUL: /* Site information, just logging */ + log("M_NUL"); + binkp_process_NUL(bstate->remote_data, buf+1); + return 1; +case BPMSG_ADR: /* List of addresses */ + log("M_ADR"); + if (bstate->address_established) { + log("remote tries to change address"); + return -1; + } + if( bstate->extracmd[0] !=-1 ) return 0; // suspend !!! + binkp_process_ADR(bstate->remote_data, buf+1); + + if( !bstate->remote_data->anum ) { + log("error: remote did not supplied any addresses"); + if( bstate->extracmd[0] !=-1 ) return 0; // suspend + bstate->extracmd[0] = BPMSG_BSY; + strcpy(bstate->extracmd+1, "No addresses was presented"); + bstate->extraislast = true; + return 1; + } + + if (bstate->mode == bmode_incoming_handshake) { + int i; + log("sending options"); + bstate->extracmd[0] = BPMSG_NUL; + bstate->extraislast = false; + sprintf(bstate->extracmd+1,"OPT MB"); + s_override ovr; + for(i = 0; i < bstate->remote_data->anum; i++) { + ovr.sFlags = ""; + override_get (&ovr, bstate->remote_data->addrs[i].addr, 0); + if (nodelist_checkflag (ovr.sFlags, "NR")==0) { + strcat (bstate->extracmd+1, " NR"); + break; + } + } + } + // further use extracmd only for errors + + if (bstate->mode == bmode_outgoing_handshake) { + // check that remote has the address we call + if( session_addrs_check_genuine(bstate->remote_data->addrs, bstate->remote_data->anum, + state.node.addr) ) { + log("error: remote does not have the called address"); + bstate->extracmd[0] = BPMSG_ERR; + strcpy(bstate->extracmd+1, "Sorry, you are not who I need"); + bstate->extraislast = true; + return 1; + } + // check that all addresses of remote has the same password + strncpy(bstate->remote_data->passwd, bstate->local_data->passwd, BINKP_MAXPASSWD); + bstate->remote_data->passwd[BINKP_MAXPASSWD] = '\0'; + + if( session_addrs_check(bstate->remote_data->addrs, bstate->remote_data->anum, + bstate->remote_data->passwd, NULL, 0) ) { + log("error: Security violation"); + bstate->extracmd[0] = BPMSG_ERR; + strcpy(bstate->extracmd+1, "Security violation"); + bstate->extraislast = true; + return 1; + } + } + + bstate->address_established = true; + return 1; +case BPMSG_PWD: /* Session password */ + log("M_PWD received"); + if (bstate->mode != bmode_incoming_handshake) { + log("unexpected M_PWD"); + return -1; + } + if (!bstate->address_established) { + log("M_PWD before M_ADR"); + return -1; + } + + strnxcpy(bstate->remote_data->passwd, buf+1, block_length); + memcpy(bstate->remote_data->challenge, bstate->local_data->challenge, BINKP_MAXCHALLENGE+1); + bstate->remote_data->challenge_length = bstate->local_data->challenge_length; + + /* Do authorization */ + if( binkp_auth_incoming(bstate->remote_data) ) { + log("error: invalid password"); + if( bstate->extracmd[0] !=-1 ) return 0; // suspend if extra is occupied + bstate->extracmd[0] = BPMSG_ERR; + strcpy(bstate->extracmd+1, "Security violation"); + bstate->extraislast = true; + return 1; + } + // lock addresses + if( session_addrs_lock(bstate->remote_data->addrs, bstate->remote_data->anum) ) { + log("error locking addresses of the remote"); + if( bstate->extracmd[0] !=-1 ) return 0; // suspend if extra is occupied + bstate->extracmd[0] = BPMSG_BSY; + strcpy(bstate->extracmd+1, "All addresses are busy"); + bstate->extraislast = true; + return 1; + } + else { + log("flag password received"); + bstate->password_received = true; + return 2; + } + break; + +case BPMSG_FILE: /* File information */ + log("M_FILE"); + if (bstate->mode != bmode_transfer) { + log("unexpected M_FILE"); + return -1; + } + s_bpfinfo recvfi; + if( binkp_parsfinfo(buf+1, &recvfi, true) ) { + log ("M_FILE parse error: %s", buf + 1); + return -1; + } + bstate->batch_recv_count += 1; + if (bstate->frs == frs_data) { + log("overlapping M_FILE received"); + return -1; + } + + if (bstate->frs == frs_didget) { + log("is it what we want?"); + if( bstate->pi->recv && p_compfinfo(bstate->pi->recv, recvfi.fn, recvfi.sz, recvfi.tm) == 0 + && bstate->pi->recv->bytes_skipped == recvfi.offs && bstate->pi->recv->fp ) { + log("resuming %s from offset %d", recvfi.fn, recvfi.offs); + bstate->frs = frs_data; + return 1; + } + log("no, skipping (TODO: accept it)"); + if( bstate->extracmd[0] != -1 ) return 0; + bstate->extracmd[0] = BPMSG_SKIP; + sprintf(bstate->extracmd+1, "%s %ld %ld %ld", recvfi.fn, recvfi.sz, recvfi.tm); + bstate->extraislast = false; + return 1; + } + + if (bstate->frs!=frs_nothing && bstate->frs!=frs_skipping) { + log("strange receiving mode %d", bstate->frs); + return -1; + } + + if( bstate->extracmd[0] != -1 ) return 0; + switch(p_rx_fopen(bstate->pi, recvfi.fn, recvfi.sz, recvfi.tm, 0)) { +case 0: + if (bstate->pi->recv->bytes_skipped == recvfi.offs) { + log("accepting file %s from offset %d", recvfi.fn, recvfi.offs); + bstate->frs = frs_data; + return 1; + } + log("making M_GET to skip downloaded part"); + bstate->extracmd[0] = BPMSG_GET; + sprintf(bstate->extracmd+1, "%s %ld %ld %ld", + bstate->pi->recv->net_name, (long)bstate->pi->recv->bytes_total, + (long)bstate->pi->recv->mod_time, + (long)bstate->pi->recv->bytes_skipped); + bstate->extraislast = false; + bstate->frs = frs_didget; + return 1; +case 1: + log("SKIP (non-destructive)"); + bstate->extracmd[0] = BPMSG_SKIP; + sprintf(bstate->extracmd+1, "%s %ld %ld", bstate->pi->recv->net_name, (long)bstate->pi->recv->bytes_total, + (long)bstate->pi->recv->mod_time); + bstate->extraislast = false; + bstate->frs = frs_skipping; + return 1; +case 2: + log("SKIP (destructive)"); + bstate->extracmd[0] = BPMSG_GOT; + sprintf(bstate->extracmd+1, "%s %ld %ld", + bstate->pi->recv->net_name, (long)bstate->pi->recv->bytes_total, + (long)bstate->pi->recv->mod_time); + bstate->extraislast = false; + bstate->frs = frs_skipping; + return 1; +default: + log("p_rx_fopen_error"); + return -1; + } + log("never get here"); + return -1; + +case BPMSG_OK: /* Password was acknowleged (data ignored) */ + log("M_OK received"); + if (bstate->mode != bmode_outgoing_handshake) { + log("unexpected M_OK"); + return -1; + } + if (session_addrs_lock(bstate->remote_data->addrs, bstate->remote_data->anum)) { + log("error: unable to lock"); + if (bstate->extracmd[0]!=-1) return 0; + bstate->extracmd[0] = BPMSG_BSY; + strcpy(bstate->extracmd+1, "All addresses are busy"); + bstate->extraislast = true; + return 2; + } + log("outoing handshake successfully complete"); + bstate->complete = true; + return 2; + +case BPMSG_EOB: /* End Of Batch (data ignored) */ + log("M_EOB received"); + if (bstate->mode != bmode_transfer) { + log("unexpected M_EOB"); + return -1; + } + bstate->batchreceivecomplete += 1; + return 1; // continue receiving as M_GOT may and would arrive + +case BPMSG_GOT: /* File received */ +case BPMSG_SKIP: + log("received GOT/SKIP"); + if (bstate->mode != bmode_transfer) { + log("unexpected M_GOT/M_SKIP"); + return -1; + } + s_bpfinfo fi; + int i; + if (binkp_parsfinfo (buf+1, &fi, false)) { + log("error parsing"); + return -1; + } + + if (strcmp (bstate->pi->send->net_name, fi.fn) == 0 && bstate->pi->send->status != FSTAT_WAITACK) { + log("aborting current file"); + if (bstate->pi->send->netspool) { + log("cannot abort netspool in progress"); + return -1; + } + p_tx_fclose(bstate->pi); + bstate->phase = 0; + } + + for(i = 0; i < bstate->pi->n_sentfiles; i++ ) { + if (p_compfinfo (&bstate->pi->sentfiles[i], fi.fn, fi.sz, fi.tm) == 0) { + s_finfo *tmp = bstate->pi->send; + bstate->pi->send = &bstate->pi->sentfiles[i]; + if (buf[0] == BPMSG_SKIP) { + if (bstate->pi->send->netspool) { + log("cannot skip netspool"); + return -1; + } + log("skipped %s", fi.fn); + bstate->pi->send->status = FSTAT_REFUSED; + } else { + if (bstate->pi->send->status == FSTAT_WAITACK) { + log("confirmed %s", fi.fn); + bstate->pi->send->status = FSTAT_SUCCESS; + } else { + log("confirmed not sent file - skipped %s", fi.fn); + if (bstate->pi->send->netspool) { + log("cannot skip netspool"); + return -1; + } + bstate->pi->send->status = FSTAT_SKIPPED; + } + } + log("closing file"); + p_tx_fclose(bstate->pi); + bstate->pi->send = tmp; + goto check_that_all_files_are_confirmed; + } + } + log("unmatched file name"); + return -1; + +check_that_all_files_are_confirmed: + { + int i; + for (i = 0; i < bstate->pi->n_sentfiles; i++) { + if (bstate->pi->sentfiles[i].status == FSTAT_WAITACK) { + log("sent file %d waits for acknowlede", i); + return 1; + } + } + } + log("all files are confirmed"); + bstate->waiting_got = false; + return 1; + + +case BPMSG_ERR: /* Misc errors */ + log("remote error: %s", buf+1); + return 3; +case BPMSG_BSY: /* All AKAs are busy */ + log("remote busy: %s", buf+1); + return 3; + +case BPMSG_GET: /* Get a file from offset */ + log("received M_GET: cancel transmitting current file and send requested file if it is in outbound"); + if (bstate->mode != bmode_transfer) { + log("unexpected M_GET"); + return -1; + } + s_bpfinfo getfi; + if (binkp_parsfinfo(buf+1, &getfi, true) != 0) { + log("error parsing M_GET %s", buf+1); + return -1; + } + log("M_GET file %s size %d time %d offset %d", getfi.fn, getfi.sz, getfi.tm, getfi.offs); + + if (bstate->extracmd[0] != -1) return 0; + + if (p_compfinfo(bstate->pi->send, getfi.fn, getfi.sz, getfi.tm)==0) { + log("M_GET for currently transmitted file"); + if (getfi.offs==bstate->pi->send->bytes_sent) { + log("M_GET offset match current (seems NR mode)"); + // go to sending M_FILE + bstate->phase = 2; + bstate->extracmd[0] = BPMSG_FILE; + sprintf(bstate->extracmd+1, "%s %ld %ld %ld", + bstate->pi->send->net_name, (long)bstate->pi->send->bytes_total, + (long)bstate->pi->send->mod_time, (long)bstate->pi->send->bytes_sent); + bstate->extraislast = false; + return 1; + + } + } + + if (bstate->pi->send->netspool) { + log("ignore differing M_GET for netspool"); + return 1; + } + + if (bstate->pi->send && p_compfinfo(bstate->pi->send, getfi.fn, getfi.sz, getfi.tm)==0) { + if( p_tx_rewind(bstate->pi, getfi.offs) != 0 ) { + log("failed to rewind"); + p_tx_fclose(bstate->pi); + return -1; + } + log("sending \"%s\" from %ld offset", bstate->pi->send->fname, (long)getfi.offs); + bstate->pi->send->bytes_skipped = getfi.offs; + bstate->pi->send->bytes_sent = getfi.offs; + bstate->extracmd[0] = BPMSG_FILE; + sprintf(bstate->extracmd+1, "%s %ld %ld %ld", bstate->pi->send->net_name, (long)bstate->pi->send->bytes_total, + (long)bstate->pi->send->mod_time, (long)getfi.offs); + bstate->extraislast = false; + bstate->phase = 2; + return 1; + } + + if( bstate->pi->send ) { + log("aborting current file"); + p_tx_fclose(bstate->pi); + } + + s_filehint hint; + hint.fn = getfi.fn; + hint.sz = getfi.sz; + hint.tm = getfi.tm;; + if( p_tx_fopen(bstate->pi, &hint) != 0 ) { + log("could not satisfy M_GET"); + return -1; + } + if( p_tx_rewind(bstate->pi, getfi.offs) != 0 ) { + log("failed to rewind"); + p_tx_fclose(bstate->pi); + return -1; + } + bstate->waiting_got = true; + log("sending \"%s\" from %ld offset", bstate->pi->send->fname, (long)getfi.offs); + bstate->pi->send->bytes_skipped = getfi.offs; + bstate->pi->send->bytes_sent = getfi.offs; + bstate->extracmd[0] = BPMSG_FILE; + sprintf(bstate->extracmd+1, "%s %ld %ld %ld", bstate->pi->send->net_name, (long)bstate->pi->send->bytes_total, + (long)bstate->pi->send->mod_time, (long)getfi.offs); + bstate->extraislast = false; + bstate->phase = 2; + return 1; + } + log("unknown command %d received", buf[0]); + return -1; + +case BINKP_BLK_DATA: + //if there is file in progress + log("data block received length=%d", block_length); + if (block_length==0) { + log("ignore zero length data block, argus workaround"); + return 1; + } + if (bstate->frs == frs_nothing) { + log("unexpected data block"); + return -1; + } + if (bstate->frs == frs_didget || bstate->frs == frs_skipping) { + log("did M_GET or M_GOT or M_SKIP, skipping data"); + return 1; + } + + if (bstate->extracmd[0] != -1) return 0; + + long int n; + n = p_rx_writefile(buf, block_length, bstate->pi); + + if( n < 0 ) { + log("error writing file"); + if( n == -2 ) { + bstate->extracmd[0] = BPMSG_GOT; + sprintf(bstate->extracmd+1, "%s %ld %ld", bstate->pi->recv->net_name, (long)bstate->pi->recv->bytes_total, + (long)bstate->pi->recv->mod_time); + bstate->extraislast = false; + } + else { + bstate->extracmd[0] = BPMSG_SKIP; + sprintf(bstate->extracmd+1, "%s %ld %ld", bstate->pi->recv->net_name, (long)bstate->pi->recv->bytes_total, + (long)bstate->pi->recv->mod_time); + bstate->extraislast = false; + } + bstate->frs = frs_skipping; + p_rx_fclose(bstate->pi); + return 1; + } + else { + bstate->pi->recv->bytes_received += block_length; + + /* Was it the last data block? */ + if( bstate->pi->recv->bytes_received > bstate->pi->recv->bytes_total ) { + log("binkp got too many data (%ld, %ld expected)", + (long)bstate->pi->recv->bytes_received, (long)bstate->pi->recv->bytes_total); + + bstate->frs = frs_skipping; + bstate->pi->recv->status = FSTAT_REFUSED; + p_rx_fclose(bstate->pi); + return -1; + } + else if( bstate->pi->recv->bytes_received == bstate->pi->recv->bytes_total ) { + log("receive completed"); + bstate->frs = frs_nothing; + bstate->pi->recv->status = FSTAT_SUCCESS; + if( !p_rx_fclose(bstate->pi) ) { + bstate->extracmd[0] = BPMSG_GOT; + sprintf(bstate->extracmd+1, "%s %ld %ld", + bstate->pi->recv->net_name, (long)bstate->pi->recv->bytes_total, + (long)bstate->pi->recv->mod_time); + bstate->extraislast = false; + return 1; + } + else { + log("some error committing file"); + bstate->extracmd[0] = BPMSG_SKIP; + sprintf(bstate->extracmd+1, "%s %ld %ld", + bstate->pi->recv->net_name, (long)bstate->pi->recv->bytes_total, + (long)bstate->pi->recv->mod_time); + bstate->extraislast = false; + return 1; + } + } else { + log("data block accepted"); + return 1; + } + } + log("never should be here"); + return -1; +default: + log("impossible block_type"); + return -1; + } +} + + +// ---- inherent code ---- void binkp_process_NUL(s_binkp_sysinfo *remote_data, char *buffer) { @@ -91,7 +1132,7 @@ void binkp_process_NUL(s_binkp_sysinfo *remote_data, char *buffer) strnxcpy(remote_data->progname, buffer+4, sizeof(remote_data->progname)); } else - log("BinkP got invalid NUL: \"%s\"", string_printable(buffer)); + log("BinkP NUL: \"%s\"", string_printable(buffer)); // NUL cannot be invalid as it is optional info } void binkp_process_ADR(s_binkp_sysinfo *remote_data, char *buffer) @@ -99,8 +1140,7 @@ void binkp_process_ADR(s_binkp_sysinfo *remote_data, char *buffer) s_faddr addr; char *p, *q; - for( p = string_token(buffer, &q, NULL, 0); p; - p = string_token(NULL, &q, NULL, 0) ) + for( p = string_token(buffer, &q, NULL, 0); p; p = string_token(NULL, &q, NULL, 0) ) { if( ftn_addrparse(&addr, p, FALSE) ) log("BinkP got unparsable address \"%s\"", string_printable(p)); @@ -109,154 +1149,16 @@ void binkp_process_ADR(s_binkp_sysinfo *remote_data, char *buffer) } } -int binkp_outgoing(s_binkp_sysinfo *local_data, s_binkp_sysinfo *remote_data) -{ - s_bpinfo bpi; - binkp_outgoing_state binkp_state = BPO_SendSysInfo; - int rc = HRC_OK; - int recv_rc = 0; - int send_rc = 0; - bool send_ready = FALSE; - bool recv_ready = FALSE; - - binkp_init_bpinfo(&bpi); - - while(1) - { - switch(binkp_state) { - case BPO_SendSysInfo: - binkp_queue_sysinfo(&bpi, local_data); - binkp_state = BPO_WaitNUL; - break; - - case BPO_SendPWD: - if( *local_data->passwd == '\0' ) - { - binkp_queuemsg(&bpi, BPMSG_PWD, NULL, "-"); - } - else if( remote_data->options & BINKP_OPT_MD5 ) - { - char digest_bin[16]; - char digest_hex[33]; - - md5_cram_get(local_data->passwd, remote_data->challenge, - remote_data->challenge_length, digest_bin); - - /* Encode digest to the hex string */ - string_bin_to_hex(digest_hex, digest_bin, 16); - - binkp_queuemsg(&bpi, BPMSG_PWD, "CRAM-MD5-", digest_hex); - } - else - binkp_queuemsg(&bpi, BPMSG_PWD, NULL, local_data->passwd); - - binkp_state = BPO_WaitADR; - break; - - case BPO_Auth: - /* Set remote password same as local */ - strncpy(remote_data->passwd, local_data->passwd, BINKP_MAXPASSWD); - remote_data->passwd[BINKP_MAXPASSWD] = '\0'; - - if( !remote_data->anum ) - { - binkp_queuemsg(&bpi, BPMSG_BSY, NULL, "No addresses was presented"); - GOTO(Exit, HRC_BUSY); - } - else if( session_addrs_check_genuine(remote_data->addrs, remote_data->anum, - state.node.addr) ) - { - binkp_queuemsg(&bpi, BPMSG_ERR, NULL, "Sorry, you are not who I need"); - GOTO(Exit, HRC_NO_ADDRESS); - } - else if( session_addrs_check(remote_data->addrs, remote_data->anum, - remote_data->passwd, NULL, 0) ) - { - binkp_queuemsg(&bpi, BPMSG_ERR, NULL, "Security violation"); - GOTO(Exit, HRC_BAD_PASSWD); - } - else if( session_addrs_lock(remote_data->addrs, remote_data->anum) ) - { - binkp_queuemsg(&bpi, BPMSG_BSY, NULL, "All addresses are busy"); - GOTO(Exit, HRC_BUSY); - } - binkp_state = BPO_WaitOK; - break; - - default: - break; - } - - /* - * Receive/Send next data block - */ - send_ready = recv_ready = FALSE; - - if( tty_select(&recv_ready, (bpi.opos || bpi.n_msgs) ? - &send_ready : NULL, bpi.timeout) < 0 ) - GOTO(Abort, HRC_OTHER_ERR); - - recv_rc = BPMSG_NONE; - send_rc = 0; - - if( recv_ready && (recv_rc = binkp_recv(&bpi)) == BPMSG_EXIT ) - GOTO(Abort, HRC_OTHER_ERR); - - if( send_ready && (send_rc = binkp_send(&bpi)) < 0 ) - GOTO(Abort, HRC_OTHER_ERR); - - /* - * Handle received message - */ - switch(recv_rc) { - case BPMSG_NONE: - break; - - case BPMSG_NUL: - binkp_process_NUL(remote_data, bpi.ibuf+1); - if( binkp_state == BPO_WaitNUL ) - binkp_state = BPO_SendPWD; - break; - - case BPMSG_ADR: - if( binkp_state == BPO_WaitADR ) - { - binkp_process_ADR(remote_data, bpi.ibuf+1); - binkp_state = BPO_Auth; - } - break; - - case BPMSG_OK: - if( binkp_state == BPO_WaitOK ) - GOTO(Exit, HRC_OK); - break; - - case BPMSG_ERR: - log("BinkP error: \"%s\"", string_printable(bpi.ibuf+1)); - GOTO(Abort, HRC_FATAL_ERR); - - case BPMSG_BSY: - log("BinkP busy: \"%s\"", string_printable(bpi.ibuf+1)); - GOTO(Abort, HRC_TEMP_ERR); - } - } - -Exit: - if( binkp_flush_queue(&bpi, bpi.timeout) && rc == HRC_OK ) - rc = HRC_OTHER_ERR; - -Abort: - binkp_deinit_bpinfo(&bpi); - - return rc; -} - - int binkp_auth_incoming(s_binkp_sysinfo *remote_data) { if( remote_data->challenge_length > 0 && strncmp(remote_data->passwd, "CRAM-MD5-", 9) == 0 ) { + log("md5 auth addrs %s", remote_data->addrs); + log("md5 auth anum %d", remote_data->anum); + log("md5 auth passwd %s", remote_data->passwd + 9); + log("md5 auth challenge %s", remote_data->challenge); + log("md5 auth challenge len %d", remote_data->challenge_length); return session_addrs_check(remote_data->addrs, remote_data->anum, remote_data->passwd + 9, @@ -264,461 +1166,7 @@ int binkp_auth_incoming(s_binkp_sysinfo *remote_data) remote_data->challenge_length); } + log("plain-text auth"); return session_addrs_check(remote_data->addrs, remote_data->anum, remote_data->passwd, NULL, 0); } - -int binkp_incoming(s_binkp_sysinfo *local_data, s_binkp_sysinfo *remote_data) -{ - s_bpinfo bpi; - binkp_incoming_state binkp_state = BPI_SendSysInfo; - int rc = HRC_OK; - int recv_rc = 0; - int send_rc = 0; - bool send_ready = FALSE; - bool recv_ready = FALSE; - - binkp_init_bpinfo(&bpi); - - while(1) - { - switch(binkp_state) { - case BPI_SendSysInfo: - binkp_queue_sysinfo(&bpi, local_data); - binkp_state = BPI_WaitADR; - break; - - case BPI_Auth: - /* Set challenge string same as local */ - memcpy(remote_data->challenge, local_data->challenge, - sizeof(remote_data->challenge)); - remote_data->challenge_length = local_data->challenge_length; - - /* Do authorization */ - if( !remote_data->anum ) - { - binkp_queuemsg(&bpi, BPMSG_BSY, NULL, "No addresses was presented"); - GOTO(Exit, HRC_BUSY); - } - else if( binkp_auth_incoming(remote_data) ) - { - binkp_queuemsg(&bpi, BPMSG_ERR, NULL, "Security violation"); - GOTO(Exit, HRC_BAD_PASSWD); - } - else if( session_addrs_lock(remote_data->addrs, remote_data->anum) ) - { - binkp_queuemsg(&bpi, BPMSG_BSY, NULL, "All addresses are busy"); - GOTO(Exit, HRC_BUSY); - } - else - { - binkp_queuemsg(&bpi, BPMSG_OK, NULL, NULL); - GOTO(Exit, HRC_OK); - } - break; - - default: - break; - } - - /* - * Receive/Send next data block - */ - send_ready = recv_ready = FALSE; - - if( tty_select(&recv_ready, (bpi.opos || bpi.n_msgs) ? - &send_ready : NULL, bpi.timeout) < 0 ) - GOTO(Abort, HRC_OTHER_ERR); - - recv_rc = BPMSG_NONE; - send_rc = 0; - - if( recv_ready && (recv_rc = binkp_recv(&bpi)) == BPMSG_EXIT ) - GOTO(Abort, HRC_OTHER_ERR); - - if( send_ready && (send_rc = binkp_send(&bpi)) < 0 ) - GOTO(Abort, HRC_OTHER_ERR); - - /* - * Handle received message - */ - switch(recv_rc) { - case BPMSG_NONE: - break; - - case BPMSG_NUL: - binkp_process_NUL(remote_data, bpi.ibuf+1); - break; - - case BPMSG_ADR: - if( binkp_state == BPI_WaitADR ) - { - int i; - char *szOpt = xstrcpy (" MB"); - s_override ovr; - binkp_process_ADR(remote_data, bpi.ibuf+1); - for(i = 0; i < remote_data->anum; i++) - { - ovr.sFlags = ""; - override_get (&ovr, remote_data->addrs[i].addr, 0); - if (!nodelist_checkflag (ovr.sFlags, "NR")) - { -#ifndef NETSPOOL - szOpt = xstrcat (szOpt, " NR"); -#endif - break; - } - } - binkp_queuemsg(&bpi,BPMSG_NUL,"OPT",szOpt); - free (szOpt); - binkp_state = BPI_WaitPWD; - } - break; - - case BPMSG_PWD: - if( binkp_state == BPI_WaitPWD ) - { - strnxcpy(remote_data->passwd, bpi.ibuf+1, sizeof(remote_data->passwd)); - binkp_state = BPI_Auth; - } - break; - - case BPMSG_ERR: - log("BinkP error: \"%s\"", string_printable(bpi.ibuf+1)); - GOTO(Abort, HRC_FATAL_ERR); - - case BPMSG_BSY: - log("BinkP busy: \"%s\"", string_printable(bpi.ibuf+1)); - GOTO(Abort, HRC_TEMP_ERR); - } - } - -Exit: - if( binkp_flush_queue(&bpi, bpi.timeout) && rc == HRC_OK ) - rc = HRC_OTHER_ERR; - -Abort: - binkp_deinit_bpinfo(&bpi); - - return rc; -} - -int binkp_transfer(s_protinfo *pi) { - - int i, n, rc = PRC_NOERROR; - bool recv_ready = FALSE; - bool send_ready = FALSE; - bool rcvd_EOB = FALSE; - bool recv_file = FALSE; - int recv_rc = 0; - int send_rc = 0; - char *fname = NULL; - size_t fsize = 0; - time_t ftime = 0; - size_t foffs = 0; - s_bpinfo bpi; - s_binkp_sysinfo *remote; - enum { - BPT_Start_Send_File, - BPT_Wait_M_GET, - BPT_Send_File, - BPT_Wait_M_GOT, - BPT_No_Files, - BPT_EOB - } binkp_send_state = BPT_Start_Send_File; - remote = (s_binkp_sysinfo *) state.handshake->remote_data; - - binkp_init_bpinfo(&bpi); - - while (1) { - if (binkp_send_state == BPT_Start_Send_File) { - if (p_tx_fopen (pi)) { - binkp_send_state = BPT_No_Files; - } else { - char *name = pi->send->net_name; - long total = (long) pi->send->bytes_total; - long time = (long) pi->send->mod_time; - if (remote->options & BINKP_OPT_NR) { - binkp_queuemsgf(&bpi,BPMSG_FILE,"%s %ld %ld -1",name,total,time); - binkp_send_state = BPT_Wait_M_GET; - /*log("binkp going to BPT_Wait_M_GET");*/ - } else { - binkp_queuemsgf(&bpi,BPMSG_FILE,"%s %ld %ld 0", name,total,time); - binkp_send_state = BPT_Send_File; - } - } - } - if (binkp_send_state == BPT_Send_File) { - /*log("binkp BPT_Send_File");*/ - if (bpi.opos == 0 && bpi.n_msgs == 0) { - if((n = p_tx_readfile (bpi.obuf+BINKP_BLK_HDRSIZE,4096,pi))<0) { - p_tx_fclose (pi); - binkp_send_state = BPT_Start_Send_File; - } else { - binkp_puthdr (bpi.obuf, (unsigned) (n & 0x7fff)); - bpi.opos = n + BINKP_BLK_HDRSIZE; - pi->send->bytes_sent += n; - if (pi->send->eofseen) { - pi->send->status = FSTAT_WAITACK; - if (remote->options & BINKP_OPT_NR) - binkp_send_state = BPT_Wait_M_GOT; - else binkp_send_state = BPT_Start_Send_File; - } - } - } - } - if (binkp_send_state == BPT_No_Files) { - for (i = 0; i < pi->n_sentfiles; i++) { - if (pi->sentfiles[i].status == FSTAT_WAITACK) break; - } - if (i == pi->n_sentfiles) { - binkp_queuemsg (&bpi, BPMSG_EOB, NULL, NULL); - binkp_send_state = BPT_EOB; - } - } - /* End of the current batch (start the next batch if need). */ - if (binkp_send_state == BPT_EOB && rcvd_EOB) { - if (remote->options & BINKP_OPT_MB && bpi.msgs_in_batch > 2) { - bpi.msgs_in_batch = 0; - binkp_send_state = BPT_Start_Send_File; - rcvd_EOB = FALSE; - continue; - } - break; - } - recv_ready = send_ready = FALSE; - if( tty_select(&recv_ready, (bpi.opos || bpi.n_msgs) ? - &send_ready : NULL, bpi.timeout) < 0 ) - gotoexit(PRC_ERROR); - - recv_rc = BPMSG_NONE; - send_rc = 0; - - if( recv_ready && (recv_rc = binkp_recv(&bpi)) == BPMSG_EXIT ) - gotoexit(PRC_ERROR); - if( send_ready && (send_rc = binkp_send(&bpi)) < 0 ) - gotoexit(PRC_ERROR); - - switch(recv_rc) { - case BPMSG_NONE: - break; - case BPMSG_DATA: /* Got new data block */ - if( recv_file ) - { - if( (n = p_rx_writefile(bpi.ibuf, bpi.isize, pi)) < 0 ) - { - /* error writing file */ - if( n == -2 ) - { - binkp_queuemsgf(&bpi, BPMSG_GOT, "%s %ld %ld", - pi->recv->net_name, (long)pi->recv->bytes_total, - (long)pi->recv->mod_time); - } - else - { - binkp_queuemsgf(&bpi, BPMSG_SKIP, "%s %ld %ld", - pi->recv->net_name, (long)pi->recv->bytes_total, - (long)pi->recv->mod_time); - } - recv_file = FALSE; - p_rx_fclose(pi); - } - else - { - pi->recv->bytes_received += bpi.isize; - - /* Was it the last data block? */ - if( pi->recv->bytes_received > pi->recv->bytes_total ) - { - log("binkp got too many data (%ld, %ld expected)", - (long)pi->recv->bytes_received, - (long)pi->recv->bytes_total); - - recv_file = FALSE; - pi->recv->status = FSTAT_REFUSED; - (void)p_rx_fclose(pi); - - binkp_queuemsgf(&bpi, BPMSG_SKIP, "%s %ld %ld", - pi->recv->net_name, (long)pi->recv->bytes_total, - (long)pi->recv->mod_time); - } - else if( pi->recv->bytes_received == pi->recv->bytes_total ) - { - recv_file = FALSE; - pi->recv->status = FSTAT_SUCCESS; - if( !p_rx_fclose(pi) ) - { - binkp_queuemsgf(&bpi, BPMSG_GOT, "%s %ld %ld", - pi->recv->net_name, (long)pi->recv->bytes_total, - (long)pi->recv->mod_time); - } - else - { - binkp_queuemsgf(&bpi, BPMSG_SKIP, "%s %ld %ld", - pi->recv->net_name, (long)pi->recv->bytes_total, - (long)pi->recv->mod_time); - } - } - } - } -#ifdef DEBUG - else - DEB((D_PROT, "ignore received data block")); -#endif - break; - - case BPMSG_FILE: - - if( binkp_parsfinfo(bpi.ibuf+1, &fname, - &fsize, &ftime, &foffs) ) - { - log ("BinkP error: M_FILE: %s", bpi.ibuf + 1); - binkp_queuemsg(&bpi, BPMSG_ERR, "FILE: ", "unparsable arguments"); - goto FinishSession; - } - - if( pi->recv && !p_compfinfo(pi->recv, fname, fsize, ftime) - && pi->recv->bytes_skipped == foffs && pi->recv->fp ) - { - recv_file = TRUE; - break; - } - - if (recv_file) { - p_rx_fclose (pi); - recv_file = FALSE; - } - switch(p_rx_fopen(pi, fname, fsize, ftime, 0)) { - case 0: - if (pi->recv->bytes_skipped == foffs) - { - recv_file = TRUE; - break; - } - binkp_queuemsgf(&bpi, BPMSG_GET, "%s %ld %ld %ld", - pi->recv->net_name, (long)pi->recv->bytes_total, - (long)pi->recv->mod_time, - (long)pi->recv->bytes_skipped); - break; - case 1: - /* SKIP (non-destructive) */ - binkp_queuemsgf(&bpi, BPMSG_SKIP, "%s %ld %ld", - pi->recv->net_name, (long)pi->recv->bytes_total, - (long)pi->recv->mod_time); - break; - case 2: - /* SKIP (destructive) */ - binkp_queuemsgf(&bpi, BPMSG_GOT, "%s %ld %ld", - pi->recv->net_name, (long)pi->recv->bytes_total, - (long)pi->recv->mod_time); - break; - default: - ASSERT_MSG(); - } - break; - - case BPMSG_EOB: /* End Of Batch */ - if( recv_file ) - { - p_rx_fclose(pi); - recv_file = FALSE; - } - rcvd_EOB = TRUE; - break; - - case BPMSG_GOT: - case BPMSG_SKIP: - if (binkp_parsfinfo (bpi.ibuf+1,&fname,&fsize,&ftime,NULL)) { - char *m = recv_rc == BPMSG_GOT ? "M_GOT" : "M_SKIP"; - binkp_queuemsgf (&bpi, BPMSG_ERR, "%s: %s", m, bpi.ibuf + 1); - log ("BinkP error: %s: %s", m, bpi.ibuf + 1); - binkp_send_state = BPT_No_Files; - rc = PRC_ERROR; - break; - } - for(i = 0; i < pi->n_sentfiles; i++ ) { - if (!p_compfinfo (&pi->sentfiles[i], fname, fsize, ftime)) { - s_finfo *tmp = pi->send; - pi->send = &pi->sentfiles[i]; - if (recv_rc == BPMSG_SKIP) { - pi->send->status = FSTAT_REFUSED; - } else { - if (pi->send->status == FSTAT_WAITACK) { - pi->send->status = FSTAT_SUCCESS; - } else { - pi->send->status = FSTAT_SKIPPED; - } - } - p_tx_fclose(pi); - pi->send = tmp; - break; - } - } - if (!strcmp (pi->send->net_name, fname)) { - if (binkp_send_state == BPT_Send_File || - binkp_send_state == BPT_Wait_M_GET || - binkp_send_state == BPT_Wait_M_GOT) { - binkp_send_state = BPT_Start_Send_File; - } - } - break; - - case BPMSG_ERR: - log("remote report error: \"%s\"", bpi.ibuf+1); - gotoexit(PRC_ERROR); - break; - - case BPMSG_BSY: - log("remote busy error: \"%s\"", bpi.ibuf+1); - gotoexit(PRC_ERROR); - break; - - case BPMSG_GET: - if( binkp_parsfinfo(bpi.ibuf+1, &fname, &fsize, &ftime, &foffs) == 0 ) - { - if(!p_compfinfo(pi->send,fname,fsize,ftime)) - { - if( fseek(pi->send->fp, foffs, SEEK_SET) == -1 ) - { - log("cannot send file from requested offset %ld", (long)foffs); - p_tx_fclose(pi); - binkp_send_state = BPT_Start_Send_File; - } - else - { - log("sending \"%s\" from %ld offset", - pi->send->fname, (long)foffs); - pi->send->bytes_skipped = foffs; - pi->send->bytes_sent = foffs; - binkp_queuemsgf(&bpi, BPMSG_FILE, "%s %ld %ld %ld", - pi->send->net_name, (long)pi->send->bytes_total, - (long)pi->send->mod_time, (long)foffs); - binkp_send_state = BPT_Send_File; - } - } - } - break; - - default: - log("binkp got unhandled msg #%d", recv_rc); - break; - } - } /* end of while( !sent_EOB || !rcvd_EOB ) */ - - -FinishSession: - if( binkp_flush_queue(&bpi, bpi.timeout) && rc == PRC_NOERROR ) - rc = PRC_ERROR; - - -exit: - if( pi->send && pi->send->fp ) p_tx_fclose(pi); - if( pi->recv && pi->recv->fp ) p_rx_fclose(pi); - - binkp_deinit_bpinfo(&bpi); - - DEB((D_PROT, "binkp: BINKP exit = %d", rc)); - - return rc; -} - diff --git a/source/bforce/prot_binkp_misc.c b/source/bforce/prot_binkp_misc.c index 8321f86..f0456b4 100644 --- a/source/bforce/prot_binkp_misc.c +++ b/source/bforce/prot_binkp_misc.c @@ -21,198 +21,12 @@ #include "prot_common.h" #include "prot_binkp.h" -/***************************************************************************** - * Initialise binkp state structure, allocate memory for buffers, etc. - * - * Arguments: - * bpi pointer to the binkp state structure (s_bpinfo) - * - * Return value: - * None - */ -void binkp_init_bpinfo(s_bpinfo *bpi) -{ - memset(bpi, '\0', sizeof(s_bpinfo)); - - bpi->obuf = (char*)xmalloc(BINKP_MAX_BLKSIZE + BINKP_BLK_HDRSIZE + 1); - bpi->opos = 0; - bpi->optr = bpi->obuf; - - bpi->inew = TRUE; - bpi->isize = -1; - bpi->ibuf = (char*)xmalloc(BINKP_MAX_BLKSIZE + BINKP_BLK_HDRSIZE + 1); - - bpi->timeout = conf_number(cf_binkp_timeout); - if( !bpi->timeout ) - bpi->timeout = 300; -} - -/***************************************************************************** - * DeInitialise binkp state structure, release allocated memory, etc. - * - * Arguments: - * bpi pointer to the binkp state structure (s_bpinfo) - * - * Return value: - * None - */ -void binkp_deinit_bpinfo(s_bpinfo *bpi) -{ - if( bpi->obuf ) - free(bpi->obuf); - if( bpi->ibuf ) - free(bpi->ibuf); - if( bpi->msgqueue ) - free(bpi->msgqueue); - - memset(bpi, '\0', sizeof(s_bpinfo)); -} - -/***************************************************************************** - * Fills s[0] and s[1] with binkp frame header using value of u - * - * Arguments: - * s pointer to the binkp's frame header (2 bytes) - * val value to put - * - * Return value: - * None - */ -void binkp_puthdr(char *s, unsigned int val) -{ - s[0] = ( (unsigned long) val >> 8 ) & 0xff; - s[1] = ( (unsigned long) val ) & 0xff; -} - -/***************************************************************************** - * Fills s[0] with binkp message type value - * - * Arguments: - * s pointer to the destination buffer - * msg message type - * - * Return value: - * None - */ -void binkp_putmsgtype(char *s, e_bpmsg msg) -{ - s[0] = ( (unsigned int) msg ) & 0xff; -} - -/***************************************************************************** - * Extract size from binkp frame header - * - * Arguments: - * s pointer to the source buffer - * - * Return value: - * Value, extracted from binkp header - */ -int binkp_gethdr(const char *s) -{ - return ( (unsigned int) (((unsigned char) s[0]) & 0x7f) << 8 ) - | ( (unsigned int) (((unsigned char) s[1]) & 0xff) ); -} - -/***************************************************************************** - * Extract message type from s[0] - * - * Arguments: - * s pointer to the source buffer (1 byte) - * - * Return value: - * Value, extracted from binkp header, or -1 if extracted message type is - * out of range - */ -int binkp_getmsgtype(char ch) -{ - int val = ( ((unsigned char)ch) & 0x7f ); - - if( BPMSG_MIN > val || val > BPMSG_MAX ) - return -1; - else - return val; -} - -/***************************************************************************** - * Puts a message to the output messages queue. These msgs will be send - * right after the current data block - * - * Arguments: - * bpi binkp state structure - * msg message type - * s1 message text - * s2 message text (will be concatenated with s1) - * - * Return value: - * None - */ -void binkp_queuemsg(s_bpinfo *bpi, e_bpmsg msg, const char *s1, const char *s2) -{ - bpi->msgqueue = xrealloc(bpi->msgqueue, sizeof(s_bpmsg)*(bpi->n_msgs + 1)); - memset(&bpi->msgqueue[bpi->n_msgs], '\0', sizeof(s_bpmsg)); - - /* Set message type */ - bpi->msgqueue[bpi->n_msgs].type = msg; - - /* Set message data size (without frame header) */ - bpi->msgqueue[bpi->n_msgs].size = 1; - if( s1 ) bpi->msgqueue[bpi->n_msgs].size += strlen(s1); - if( s2 ) bpi->msgqueue[bpi->n_msgs].size += strlen(s2); - - /* Set message data */ - bpi->msgqueue[bpi->n_msgs].data = xmalloc(bpi->msgqueue[bpi->n_msgs].size+3); - binkp_puthdr(bpi->msgqueue[bpi->n_msgs].data, - (unsigned)(bpi->msgqueue[bpi->n_msgs].size | 0x8000)); - - binkp_putmsgtype(bpi->msgqueue[bpi->n_msgs].data + 2, msg); - - bpi->msgqueue[bpi->n_msgs].data[3] = '\0'; - if( s1 ) strcat(bpi->msgqueue[bpi->n_msgs].data + 3, s1); - if( s2 ) strcat(bpi->msgqueue[bpi->n_msgs].data + 3, s2); - - DEB((D_PROT, "binkp_queuemsg: queued message #%d, %ld bytes, \"%s\"", - (int)bpi->msgqueue[bpi->n_msgs].type, - (long)bpi->msgqueue[bpi->n_msgs].size, - (char*)bpi->msgqueue[bpi->n_msgs].data+3)); - - ++bpi->n_msgs; - ++bpi->msgs_in_batch; -} - -/***************************************************************************** - * Sends a message using format string - * - * Arguments: - * bpi binkp state structure - * msg message type - * fmt pointer to the format string, (man printf) - * - * Return value: - * None - */ -void binkp_queuemsgf(s_bpinfo *bpi, e_bpmsg msg, const char *fmt, ...) -{ - char msg_text[2048]; - va_list ap; - - va_start(ap, fmt); -#ifdef HAVE_SNPRINTF - vsnprintf(msg_text, sizeof(msg_text), fmt, ap); -#else - vsprintf(msg_text, fmt, ap); -#endif - va_end(ap); - - binkp_queuemsg(bpi, msg, msg_text, NULL); -} - /***************************************************************************** * Parse most common message arguments, send error message to remote * if needed. * * Arguments: - * s pointer to the string to parse + * str pointer to the string to parse * fn pointer to the pointer for extracted file name * sz pointer to the extracted file size * tm pointer to the extracted file modification time @@ -221,272 +35,21 @@ void binkp_queuemsgf(s_bpinfo *bpi, e_bpmsg msg, const char *fmt, ...) * Return value: * non-zero value on error, zero on success */ -int binkp_parsfinfo(char *str,char **fn,size_t *sz,time_t *tm,size_t *offs){ - char *n; - char *p_fname = NULL; - char *p_size = NULL; - char *p_time = NULL; - char *p_offs = NULL; - - static char *s = NULL; - - /* Attention, offs may be NULL! */ - - ASSERT(str != NULL && fn != NULL && sz != NULL && tm != NULL); - - DEB((D_PROT, "binkp_parsemsg: want parse \"%s\"", s)); - - if (s) free (s); - s = xstrcpy (str); - p_fname = string_token(s, &n, NULL, 0); - p_size = string_token(NULL, &n, NULL, 0); - p_time = string_token(NULL, &n, NULL, 0); - if( offs ) p_offs = string_token(NULL, &n, NULL, 0); - - if( p_fname && p_size && p_time && (!offs || p_offs) ) - { - if( ISDEC(p_size) && ISDEC(p_time) && - (!offs || ISDEC(p_offs) || !strcmp (p_offs, "-1")) ) - { - (*fn) = p_fname; - (*sz) = atol(p_size); - (*tm) = atol(p_time); - if( offs ) *offs = atol(p_offs); - DEB((D_PROT, "binkp_parsemsg: file = \"%s\", size = %d, time = %d", - *fn, *sz, *tm)); - return 0; - } - } - return 1; -} - -/***************************************************************************** - * Put message to a buffer - * - * Arguments: - * bpi binkp state structure - * msg message - * - * Return value: - * Zero on success, and non-zero value if no more free space left - * in the buffer - */ -int binkp_buffer_message(s_bpinfo *bpi, s_bpmsg *msg) -{ - DEB((D_PROT, "binkp_buffer_message: buffer message #%d, %ld byte(s)", - (int)msg->type, (long)msg->size)); - - /* Check for possible internal error */ - if( msg->size > BINKP_MAX_BLKSIZE ) - { - log("size of msg we want to send is too big (%db)", msg->size); - return 1; - } - - /* Is there space for the new msg? */ - if( bpi->opos + msg->size > BINKP_MAX_BLKSIZE ) return 1; - - if( msg->data ) - { - memcpy(bpi->obuf + bpi->opos, msg->data, msg->size + BINKP_BLK_HDRSIZE); - bpi->opos += msg->size + BINKP_BLK_HDRSIZE; - free(msg->data); - msg->data = NULL; - } - - return 0; -} - -/***************************************************************************** - * Send as much buffered data as possible (non-blocking) - * - * Arguments: - * bpi binkp state structure - * - * Return value: - * Zero on success, and non-zero value on errors - */ -int binkp_send_buffer(s_bpinfo *bpi) -{ - int n; - - DEB((D_PROT, "binkp_send_buffer: sending %ld byte(s)", (long)bpi->opos)); - - n = tty_write(bpi->optr, bpi->opos); - - if( n >= bpi->opos ) - { bpi->optr = bpi->obuf; bpi->opos = 0; } - else if( n > 0 ) - { bpi->optr += n; bpi->opos -= n; } - else - return -1; - - return 0; -} - -/***************************************************************************** - * Send as much buffered data or messages from the queue as possible - * - * Arguments: - * bpi binkp state structure - * - * Return value: - * Zero on success, and non-zero value on errors - */ -int binkp_send(s_bpinfo *bpi) +int binkp_parsfinfo(const char *str, s_bpfinfo *fi, bool with_offset) { - int i; - - if( bpi->opos == 0 && bpi->msgqueue ) - { - /* - * Buffer is empty and there are unsent msgs - */ - for( i = 0; i < bpi->n_msgs; i++ ) - { - if( bpi->msgqueue[i].sent == FALSE ) - { - if( binkp_buffer_message(bpi, &bpi->msgqueue[i]) ) - break; - else - bpi->msgqueue[i].sent = TRUE; - } - } - /* If the message queue is empty, free it */ - if( i >= bpi->n_msgs ) - { - if( bpi->msgqueue ) - { free(bpi->msgqueue); bpi->msgqueue = NULL; } - bpi->n_msgs = 0; - } - } - - return bpi->opos ? binkp_send_buffer(bpi) : 0; -} - -/***************************************************************************** - * Flush all buffers and queues that can contain unsent data - * - * Arguments: - * bpi binkp state structure - * timeout abort flushing if this time will be exceeded - * - * Return value: - * Zero on success, and non-zero value on errors - */ -int binkp_flush_queue(s_bpinfo *bpi, int timeout) -{ - bool send_ready = FALSE; - time_t flush_timer; - - timer_set(&flush_timer, timeout); - - while( bpi->opos > 0 || bpi->n_msgs > 0 ) - { - if( timer_expired(flush_timer) - || tty_select(NULL, &send_ready, 10) < 0 ) - return -1; - - if( send_ready && binkp_send(bpi) < 0 ) - return -1; - } - - return 0; -} - -/***************************************************************************** - * Try to receive next message or data block in non-blocking mode - * - * Arguments: - * bpi binkp state structure - * - * Return value: - * One of the BPMSG_* values - */ -int binkp_recv(s_bpinfo *bpi) -{ - int n = 0; - int size; - - if( bpi->inew || bpi->isize == -1 ) - { - bpi->inew = FALSE; - bpi->isize = -1; - size = BINKP_BLK_HDRSIZE; - } - else - size = bpi->isize; - - if( size > 0 ) - { - n = tty_read(bpi->ibuf + bpi->ipos, size - bpi->ipos); - if( n <= 0 ) return BPMSG_EXIT; - } - - bpi->ipos += n; - - if( bpi->ipos == size ) - { - if( bpi->isize == -1 ) - { - /* We got block header */ - bpi->ipos = 0; - bpi->imsg = ((bpi->ibuf[0] >> 7) & 0377) ? TRUE : FALSE; - bpi->isize = binkp_gethdr(bpi->ibuf); - DEB((D_PROT, "binkp_recv: received header: %ld byte(s) (%s)", - (long)bpi->isize, bpi->imsg ? "msg" : "data")); - if( bpi->isize > BINKP_MAX_BLKSIZE ) - { - log("internal error: got %ld bytes block size", bpi->isize); - return BPMSG_EXIT; - } - else if( bpi->isize == 0 ) - { - bpi->ipos = 0; - bpi->inew = TRUE; - bpi->isize = -1; - if( bpi->imsg == TRUE ) - log("zero length message from remote"); - } - } - else /* We got whole data block/message */ - { - if( bpi->imsg == TRUE ) /* Is it message? */ - { - bpi->ipos = 0; - bpi->inew = TRUE; - bpi->ibuf[size] = '\0'; - bpi->imsgtype = binkp_getmsgtype(bpi->ibuf[0]); - DEB((D_PROT, "binkp_recv: got message #%d, %ld byte(s), \"%s\"", - (int)bpi->imsgtype, bpi->isize, bpi->ibuf+1)); - ++bpi->msgs_in_batch; - if( bpi->imsgtype < 0 ) - { - bpi->isize = -1; - log("got incorrect message type"); - if( ++bpi->junkcount >= 5 ) - { - log("junk count exceeded"); - return BPMSG_EXIT; - } - return BPMSG_NONE; - } - return bpi->imsgtype; - } - else /* It is data */ - { - bpi->ipos = 0; - bpi->inew = TRUE; - bpi->ibuf[size] = '\0'; - DEB((D_PROT, "binkp_recv: got data block, %ld byte(s)", - (long)bpi->isize)); - return BPMSG_DATA; - } - } - } - - return BPMSG_NONE; + int r; + if( strlen(str)>PATH_MAX ) { + log("too long string, overflow may occur"); + return -1; + } + r = sscanf(str, with_offset? "%s %d %d %d": "%s %d %d", &fi->fn, &fi->sz, &fi->tm, &fi->offs); + if (r==(with_offset? 4: 3)) { + return 0; + } + else { + return -1; + } } /***************************************************************************** @@ -499,6 +62,7 @@ int binkp_recv(s_bpinfo *bpi) * Return value: * None */ +/* void binkp_queue_sysinfo(s_bpinfo *bpi, s_binkp_sysinfo *binkp) { int i; @@ -549,6 +113,7 @@ void binkp_queue_sysinfo(s_bpinfo *bpi, s_binkp_sysinfo *binkp) free (szOpt); } } +*/ /***************************************************************************** * Write options to the log @@ -574,6 +139,7 @@ void binkp_log_options(s_binkp_sysinfo *remote) * Return value: * None */ + void binkp_log_sysinfo(s_binkp_sysinfo *binkp) { int i; @@ -628,6 +194,7 @@ void binkp_log_sysinfo(s_binkp_sysinfo *binkp) log(" Time : %s", string_printable(binkp->timestr)); } + /***************************************************************************** * Set our local system information * @@ -727,6 +294,7 @@ void binkp_set_sysinfo(s_binkp_sysinfo *binkp, s_faddr *remote_addr, bool caller } } + void binkp_parse_options(s_binkp_sysinfo *binkp, char *options) { char *p, *n; @@ -734,11 +302,9 @@ void binkp_parse_options(s_binkp_sysinfo *binkp, char *options) for( p = string_token(options, &n, NULL, 0); p; p = string_token(NULL, &n, NULL, 0) ) { -#ifndef NETSPOOL if( !strcmp(p, "NR") ) { binkp->options |= BINKP_OPT_NR; } else -#endif if( !strcmp(p, "MB") ) binkp->options |= BINKP_OPT_MB; else if( !strcmp(p, "MPWD") ) @@ -776,3 +342,4 @@ void binkp_parse_options(s_binkp_sysinfo *binkp, char *options) } } + diff --git a/source/bforce/prot_common.c b/source/bforce/prot_common.c index 06ceecc..252a13e 100644 --- a/source/bforce/prot_common.c +++ b/source/bforce/prot_common.c @@ -40,8 +40,10 @@ const char *Protocols[] = * Return value: * Zero value on success and non-zero if nothing to send */ -static int prot_get_next_file(s_filelist **dest, s_protinfo *pi) + +static int prot_get_next_file(s_filelist **dest, s_protinfo *pi, s_filehint *hint) { + log("prot_get_next_file %d", hint); s_filelist *ptrl = NULL; s_filelist *best = NULL; s_fsqueue *q = &state.queue; @@ -49,7 +51,9 @@ static int prot_get_next_file(s_filelist **dest, s_protinfo *pi) *dest = NULL; /* local queue */ - for( ptrl = q->fslist; ptrl; ptrl = ptrl->next ) + for( ptrl = q->fslist; ptrl; ptrl = ptrl->next ) { + //log("scan %s", ptrl->fname); + if (hint) if (strcmp(hint->fn, ptrl->fname) !=0 || hint->sz != ptrl->size) continue; if( ptrl->status == STATUS_WILLSEND ) { if( pi->reqs_only ) @@ -85,6 +89,8 @@ static int prot_get_next_file(s_filelist **dest, s_protinfo *pi) else best = ptrl; } + } + //log("scan1 done"); if( best ) { @@ -92,16 +98,21 @@ static int prot_get_next_file(s_filelist **dest, s_protinfo *pi) return 0; } - for( ptrl = pi->filelist; ptrl; ptrl = ptrl->next ) + for( ptrl = pi->filelist; ptrl; ptrl = ptrl->next ) { + if (hint) if (strcmp(hint->fn, ptrl->fname) !=0 || hint->sz != ptrl->size) continue; if( ptrl->status == STATUS_WILLSEND ) { *dest = ptrl; return 0; } + } + //log("scan2 done"); /* network queue */ #ifdef NETSPOOL + if (hint) return 1; // cannot choose + /*log("netspool next file");*/ if(state.netspool.state == NS_NOTINIT) { /*log("new netspool connection");*/ @@ -132,7 +143,7 @@ static int prot_get_next_file(s_filelist **dest, s_protinfo *pi) } if(state.netspool.state == NS_RECEIVING) { - /*log("netspool begin receive");*/ + log("netspool begin receive"); netspool_receive(&state.netspool); } else { log("netspool could not start receive"); @@ -208,7 +219,7 @@ void prot_update_traffic(s_protinfo *pi, const s_fsqueue *q) * Return value: * Zero value on success and non-zero if have nothing to send */ -int p_tx_fopen(s_protinfo *pi) +int p_tx_fopen(s_protinfo *pi, s_filehint *hint) { FILE *fp; struct stat st; @@ -218,11 +229,14 @@ int p_tx_fopen(s_protinfo *pi) return 1; get_next_file: - if( prot_get_next_file(&ptrl, pi) ) - return 1; - + if( prot_get_next_file(&ptrl, pi, hint) ) { + log("no next file"); + return 1; + } + if( ptrl ) { + log("sending local file"); /* Mark this file as "processed" */ ptrl->status = STATUS_SENDING; @@ -261,12 +275,14 @@ get_next_file: */ if( pi->sentfiles && pi->n_sentfiles > 0 ) { + log("adding file to sentfile"); pi->sentfiles = (s_finfo *)xrealloc(pi->sentfiles, sizeof(s_finfo)*(pi->n_sentfiles+1)); memset(&pi->sentfiles[pi->n_sentfiles], '\0', sizeof(s_finfo)); pi->send = &pi->sentfiles[pi->n_sentfiles++]; } else { + log("adding file to new sentfile"); pi->sentfiles = (s_finfo *)xmalloc(sizeof(s_finfo)); memset(pi->sentfiles, '\0', sizeof(s_finfo)); pi->send = pi->sentfiles; @@ -292,6 +308,8 @@ get_next_file: pi->send->status = FSTAT_PROCESS; pi->send->action = ACTION_ACKNOWLEDGE; pi->send->flodsc = -1; + pi->send->waitack = true; + pi->send->netspool = true; } else { #endif @@ -310,7 +328,8 @@ get_next_file: pi->send->type = ptrl->type; pi->send->action = ptrl->action; pi->send->flodsc = ptrl->flodsc; - + pi->send->waitack = false; + pi->send->netspool = false; #ifdef NETSPOOL } #endif @@ -332,6 +351,15 @@ get_next_file: return 0; } +int p_tx_rewind(s_protinfo *pi, size_t pos) +{ + if( !pi || !pi->send || !pi->send->fp) { + log("cannot rewind"); + return -1; + } + return fseek(pi->send->fp, pos, SEEK_SET); +} + void prot_traffic_update(s_traffic *traf, size_t size, int xtime, int type) { if( type & TYPE_REQANSW ) @@ -387,6 +415,11 @@ int p_tx_fclose(s_protinfo *pi) long trans_time = 0; long cps = 0; + if (!pi->send) { + log("already closed"); + return -1; + } + if( pi->send->fp ) { (void)file_close(pi->send->fp); @@ -462,6 +495,8 @@ int p_tx_fclose(s_protinfo *pi) } } + pi->send = NULL; + return 0; } @@ -478,14 +513,14 @@ int p_tx_fclose(s_protinfo *pi) * -1 - error reading file (must try to send file later) * -2 - file must be skipped (send never) */ -int p_tx_readfile(char *buffer, size_t buflen, s_protinfo *pi) +long int p_tx_readfile(char *buffer, size_t buflen, s_protinfo *pi) { int n; struct stat st; long ftell_pos; #ifdef NETSPOOL - if(pi->send->fname==NULL && strcmp(pi->send->local_name, "NETSPOOL")==0 ) { + if (pi->send->netspool) { /*log("reading netspool file");*/ if( state.netspool.state != NS_RECVFILE ) { log("send: wrong netspool state"); @@ -575,7 +610,7 @@ int p_tx_readfile(char *buffer, size_t buflen, s_protinfo *pi) * -1 - error writing file (receive later) * -2 - file must be skipped (receive never) */ -int p_rx_writefile(const char *buffer, size_t buflen, s_protinfo *pi) +long int p_rx_writefile(const char *buffer, size_t buflen, s_protinfo *pi) { struct stat st; long ftell_pos = ftell(pi->recv->fp); @@ -918,7 +953,7 @@ int p_rx_fopen(s_protinfo *pi, char *fn, size_t sz, time_t tm, mode_t mode) * directory, do you know who could left it here ? :) */ - log("recv: allready have \"%s\"", pi->recv->fname); + log("recv: already have \"%s\"", pi->recv->fname); if( p_move2inbound(pi) == 0 ) pi->recv->status = FSTAT_SKIPPED; diff --git a/source/bforce/prot_hydra.c b/source/bforce/prot_hydra.c index a6521d7..ec7e26c 100644 --- a/source/bforce/prot_hydra.c +++ b/source/bforce/prot_hydra.c @@ -1327,7 +1327,7 @@ int hydra_batch(s_hydrainfo *hi, s_protinfo *pi) if( pi->send && pi->send->fp ) p_tx_fclose(pi); - send_EOB = p_tx_fopen(pi) ? TRUE : FALSE; + send_EOB = p_tx_fopen(pi, NULL) ? TRUE : FALSE; txtries = 0; txstate = HTX_FINFO; diff --git a/source/bforce/prot_zmsend.c b/source/bforce/prot_zmsend.c index 63b91d2..1874303 100644 --- a/source/bforce/prot_zmsend.c +++ b/source/bforce/prot_zmsend.c @@ -213,7 +213,7 @@ int tx_zmodem(s_protinfo *pi, bool caller) if( pi->send && pi->send->fp ) p_tx_fclose(pi); txtries = 0; - txstate = p_tx_fopen(pi) ? ZTX_FIN : ZTX_FINFO; + txstate = p_tx_fopen(pi, NULL) ? ZTX_FIN : ZTX_FINFO; break; case ZTX_FINFO: diff --git a/source/bforce/sess_main.c b/source/bforce/sess_main.c index a0ed39d..c4eaaab 100644 --- a/source/bforce/sess_main.c +++ b/source/bforce/sess_main.c @@ -132,7 +132,7 @@ int session_addrs_check(s_sysaddr *addrs, int anum, const char *passwd, char pbuf[32]; bool failure = FALSE; bool success = FALSE; - bool cram = (challenge && *challenge); + bool cram = challenge; if( !anum ) return -1; @@ -156,11 +156,12 @@ int session_addrs_check(s_sysaddr *addrs, int anum, const char *passwd, { char digest_bin[16]; char digest_hex[33]; - + md5_cram_get(pbuf, challenge, challenge_length, digest_bin); - + /* Encode digest to the hex string */ string_bin_to_hex(digest_hex, digest_bin, 16); + log("good password is %s", digest_hex); if( strcasecmp(passwd, digest_hex) == 0 ) good_passwd = TRUE; @@ -185,7 +186,7 @@ int session_addrs_check(s_sysaddr *addrs, int anum, const char *passwd, } } else - /* not password protected address */ + log("not password protected address"); addrs[i].good = TRUE; } @@ -813,7 +814,7 @@ int session(void) switch(state.handshake->protocol) { case PROT_BINKP: - rc = binkp_transfer(&pi); + rc = binkp_transfer((s_binkp_sysinfo *)state.handshake->local_data, (s_binkp_sysinfo *)state.handshake->remote_data, &pi); break; case PROT_ZMODEM: case PROT_ZEDZAP: diff --git a/source/include/bforce.h b/source/include/bforce.h index b4c607e..8a4324e 100644 --- a/source/include/bforce.h +++ b/source/include/bforce.h @@ -154,7 +154,6 @@ /* * Definition of new pretty types */ -typedef char bool; typedef unsigned long UINT32; typedef unsigned short UINT16; typedef unsigned char UINT8; diff --git a/source/include/includes.h b/source/include/includes.h index 0944199..685b939 100644 --- a/source/include/includes.h +++ b/source/include/includes.h @@ -16,6 +16,7 @@ #include "config.h" +#include #include #include #include diff --git a/source/include/prot_binkp.h b/source/include/prot_binkp.h index 15dc44b..ad124e0 100644 --- a/source/include/prot_binkp.h +++ b/source/include/prot_binkp.h @@ -54,6 +54,16 @@ #define BINKP_OPT_SHA1 0x10 /* CRAM-SHA1 authentication */ #define BINKP_OPT_DES 0x20 /* CRAM-DES authentication */ +typedef enum binkp_mode { + bmode_failoff, + bmode_incoming_handshake, + bmode_outgoing_handshake, + bmode_transfer, + bmode_complete +} e_binkp_mode; + + + typedef struct { s_sysaddr *addrs; int anum; @@ -79,9 +89,9 @@ typedef enum { /* * Pseudo message types, returned by binkp_recv() */ - BPMSG_EXIT = -3, /* Terminate session */ - BPMSG_NONE = -2, /* Got nothing intresting */ - BPMSG_DATA = -1, /* Got data block */ +// BPMSG_EXIT = -3, /* Terminate session */ +// BPMSG_NONE = -2, /* Got nothing intresting */ +// BPMSG_DATA = -1, /* Got data block */ /* * Real BinkP message types */ @@ -101,62 +111,70 @@ typedef enum { } e_bpmsg; -typedef struct { - bool sent; /* Sent message (queued) */ - e_bpmsg type; /* Message type */ - int size; /* Message size (length of text) */ - char *data; /* Message text */ -} s_bpmsg; - +//typedef struct { +// bool sent; /* Sent message (queued) */ +// e_bpmsg type; /* Message type */ +// int size; /* Message size (length of text) */ +// char *data; /* Message text */ +//} s_bpmsg; + + +//typedef struct { +// char *obuf; /* Output buffer */ +// int opos; /* Unsent bytes left in buffer */ +// char *optr; /* Send data from this position */ +// +// char *ibuf; /* Our input buffer */ +// int ipos; +// int isize; +//// bool imsg; /* Is it message? */ +/// bool inew; +// e_bpmsg imsgtype; /* Message type */ + // +// int junkcount; +// s_bpmsg *msgqueue; /* Outgoing messages queue */ +// int n_msgs; /* Number of messages in queue */ +// int msgs_in_batch; /* Number of messages in batch */ + +// int timeout; +//} s_bpinfo; typedef struct { - char *obuf; /* Output buffer */ - int opos; /* Unsent bytes left in buffer */ - char *optr; /* Send data from this position */ - - char *ibuf; /* Our input buffer */ - int ipos; - int isize; - bool imsg; /* Is it message? */ - bool inew; - e_bpmsg imsgtype; /* Message type */ - - int junkcount; - s_bpmsg *msgqueue; /* Outgoing messages queue */ - int n_msgs; /* Number of messages in queue */ - int msgs_in_batch; /* Number of messages in batch */ - - int timeout; -} s_bpinfo; + char fn[PATH_MAX]; + size_t sz; + time_t tm; + size_t offs; +} s_bpfinfo; /* prot_binkp.c */ int binkp_outgoing(s_binkp_sysinfo *local_data, s_binkp_sysinfo *remote_data); int binkp_incoming(s_binkp_sysinfo *local_data, s_binkp_sysinfo *remote_data); -int binkp_transfer(s_protinfo *pi); +int binkp_transfer(s_binkp_sysinfo *local_data, s_binkp_sysinfo *remote_data, s_protinfo *pi); /* prot_binkp_misc.c */ -void binkp_init_bpinfo(s_bpinfo *bpi); -void binkp_deinit_bpinfo(s_bpinfo *bpi); +//void binkp_init_bpinfo(s_bpinfo *bpi); +//void binkp_deinit_bpinfo(s_bpinfo *bpi); int binkp_gethdr(const char *s); int binkp_getmsgtype(char ch); void binkp_puthdr(char *s, unsigned int u); void binkp_putmsgtype(char *s, e_bpmsg msg); -void binkp_queuemsg(s_bpinfo *bpi, e_bpmsg msg, const char *s1, const char *s2); -void binkp_queuemsgf(s_bpinfo *bpi, e_bpmsg msg, const char *fmt, ...); -int binkp_parsfinfo(char *s, char **fn, size_t *sz, time_t *tm, size_t *offs); -int binkp_buffer_message(s_bpinfo *bpi, s_bpmsg *msg); -int binkp_send_buffer(s_bpinfo *bpi); -int binkp_send(s_bpinfo *bpi); -int binkp_flush_queue(s_bpinfo *bpi, int timeout); -int binkp_recv(s_bpinfo *bpi); +//void binkp_queuemsg(s_bpinfo *bpi, e_bpmsg msg, const char *s1, const char *s2); +//void binkp_queuemsgf(s_bpinfo *bpi, e_bpmsg msg, const char *fmt, ...); +int binkp_parsfinfo(const char *s, s_bpfinfo *fi, bool with_offset); +//int binkp_buffer_message(s_bpinfo *bpi, s_bpmsg *msg); +//int binkp_send_buffer(s_bpinfo *bpi); +//int binkp_send(s_bpinfo *bpi); +//int binkp_flush_queue(s_bpinfo *bpi, int timeout); +//int binkp_recv(s_bpinfo *bpi); void binkp_update_sysinfo(s_binkp_sysinfo *binkp); void binkp_log_options(s_binkp_sysinfo *remote); void binkp_log_sysinfo(s_binkp_sysinfo *binkp); -void binkp_queue_sysinfo(s_bpinfo *bpi, s_binkp_sysinfo *binkp); +//void binkp_queue_sysinfo(s_bpinfo *bpi, s_binkp_sysinfo *binkp); void binkp_set_sysinfo(s_binkp_sysinfo *binkp, s_faddr *remote_addr, bool caller); void binkp_parse_options(s_binkp_sysinfo *binkp, char *options); /* prot_binkp_api.c */ extern s_handshake_protocol handshake_protocol_binkp; + #endif /* _P_BINKP_H_ */ diff --git a/source/include/prot_common.h b/source/include/prot_common.h index a4f99d0..462fceb 100644 --- a/source/include/prot_common.h +++ b/source/include/prot_common.h @@ -50,22 +50,24 @@ typedef struct traffic { * Information on currently receiveing/transmitting file */ typedef struct finfo { - FILE *fp; /* File descriptor of current file */ - char *local_name; /* Local file name that is used at our side */ - char *net_name; /* File name as it known to the remote side */ - char *fname; /* Local file name with full path */ - time_t start_time; /* Start of current file rx/tx transactions */ - time_t mod_time; /* File last modification time */ - mode_t mode; - size_t bytes_total; /* File size */ - size_t bytes_sent; - size_t bytes_received; - size_t bytes_skipped; /* crash recovery */ - int eofseen; /* end of file seen */ - int status; - int action; - int type; - int flodsc; /* Index number in flo files table */ + FILE *fp; /* File descriptor of current file */ + char *local_name; /* Local file name that is used at our side */ + char *net_name; /* File name as it known to the remote side */ + char *fname; /* Local file name with full path */ + time_t start_time; /* Start of current file rx/tx transactions */ + time_t mod_time; /* File last modification time */ + mode_t mode; + size_t bytes_total; /* File size */ + size_t bytes_sent; + size_t bytes_received; + size_t bytes_skipped; /* crash recovery */ + int eofseen; /* end of file seen */ + int status; + int action; + int type; + int flodsc; /* Index number in flo files table */ + bool waitack; + bool netspool; } s_finfo; /* @@ -113,10 +115,17 @@ typedef struct protinfo { extern const char *Protocols[]; /* Protocol names */ -int p_tx_fopen(s_protinfo *pi); +typedef struct { + char *fn; + size_t sz; + time_t tm; +} s_filehint; + +int p_tx_fopen(s_protinfo *pi, s_filehint *hint); int p_tx_fclose(s_protinfo *pi); -int p_tx_readfile(char *buf, size_t sz, s_protinfo *pi); -int p_rx_writefile(const char *buf, size_t sz, s_protinfo *pi); +int p_tx_rewind(s_protinfo *pi, size_t pos); +long int p_tx_readfile(char *buf, size_t sz, s_protinfo *pi); +long int p_rx_writefile(const char *buf, size_t sz, s_protinfo *pi); int p_compfinfo(s_finfo *finf, const char *fn, size_t sz, time_t tm); int p_rx_fopen(s_protinfo *pi, char *f_name, size_t f_size, time_t f_modtime, mode_t f_mode); int p_rx_fclose(s_protinfo *pi); diff --git a/source/openwrt-conf b/source/openwrt-conf old mode 100644 new mode 100755 index 9638897..ffe57bd --- a/source/openwrt-conf +++ b/source/openwrt-conf @@ -11,4 +11,6 @@ CC=$PREFIX-gcc export PATH CC CPP +#make clean #./configure --prefix=/opt/bforce --host=mips-openwrt-linux --disable-syslog --enable-netspool +make && scp bin/bforce root@gw-home:/opt/bforce/bin From e3a691481ec1c8b24a350ade835bd0f585b8719b Mon Sep 17 00:00:00 2001 From: Sergey Dorofeev Date: Tue, 21 Feb 2012 22:27:22 +0400 Subject: [PATCH 14/29] response to M_GET only with already opened (and so sent) file --- source/bforce/prot_binkp.c | 10 +++++----- source/bforce/prot_common.c | 37 +++++++++++++++++++++++++++++++------ 2 files changed, 36 insertions(+), 11 deletions(-) diff --git a/source/bforce/prot_binkp.c b/source/bforce/prot_binkp.c index 6d83be4..5c70332 100644 --- a/source/bforce/prot_binkp.c +++ b/source/bforce/prot_binkp.c @@ -921,7 +921,7 @@ case BPMSG_GET: /* Get a file from offset */ if (bstate->extracmd[0] != -1) return 0; - if (p_compfinfo(bstate->pi->send, getfi.fn, getfi.sz, getfi.tm)==0) { + if (bstate->pi->send) if (p_compfinfo(bstate->pi->send, getfi.fn, getfi.sz, getfi.tm)==0) { log("M_GET for currently transmitted file"); if (getfi.offs==bstate->pi->send->bytes_sent) { log("M_GET offset match current (seems NR mode)"); @@ -937,18 +937,18 @@ case BPMSG_GET: /* Get a file from offset */ } } - if (bstate->pi->send->netspool) { + if (bstate->pi->send) if (bstate->pi->send->netspool) { log("ignore differing M_GET for netspool"); return 1; } - if (bstate->pi->send && p_compfinfo(bstate->pi->send, getfi.fn, getfi.sz, getfi.tm)==0) { + if (bstate->pi->send) if (p_compfinfo(bstate->pi->send, getfi.fn, getfi.sz, getfi.tm)==0) { + log("resending \"%s\" from %ld offset", bstate->pi->send->fname, (long)getfi.offs); if( p_tx_rewind(bstate->pi, getfi.offs) != 0 ) { log("failed to rewind"); p_tx_fclose(bstate->pi); return -1; } - log("sending \"%s\" from %ld offset", bstate->pi->send->fname, (long)getfi.offs); bstate->pi->send->bytes_skipped = getfi.offs; bstate->pi->send->bytes_sent = getfi.offs; bstate->extracmd[0] = BPMSG_FILE; @@ -967,7 +967,7 @@ case BPMSG_GET: /* Get a file from offset */ s_filehint hint; hint.fn = getfi.fn; hint.sz = getfi.sz; - hint.tm = getfi.tm;; + hint.tm = getfi.tm; if( p_tx_fopen(bstate->pi, &hint) != 0 ) { log("could not satisfy M_GET"); return -1; diff --git a/source/bforce/prot_common.c b/source/bforce/prot_common.c index 252a13e..70f1df9 100644 --- a/source/bforce/prot_common.c +++ b/source/bforce/prot_common.c @@ -43,7 +43,7 @@ const char *Protocols[] = static int prot_get_next_file(s_filelist **dest, s_protinfo *pi, s_filehint *hint) { - log("prot_get_next_file %d", hint); + log("prot_get_next_file"); // %s %d", hint->fn, hint->sz); s_filelist *ptrl = NULL; s_filelist *best = NULL; s_fsqueue *q = &state.queue; @@ -121,7 +121,7 @@ static int prot_get_next_file(s_filelist **dest, s_protinfo *pi, s_filehint *hin char *host = conf_string(cf_netspool_host); char *port = conf_string(cf_netspool_port); if(host==NULL) { - log("netspool is not configured"); + //log("netspool is not configured"); state.netspool.state = NS_UNCONF; } else { snprintf(address, 299, state.node.addr.point? "%d:%d/%d.%d": "%d:%d/%d", @@ -143,10 +143,10 @@ static int prot_get_next_file(s_filelist **dest, s_protinfo *pi, s_filehint *hin } if(state.netspool.state == NS_RECEIVING) { - log("netspool begin receive"); + //log("netspool begin receive"); netspool_receive(&state.netspool); } else { - log("netspool could not start receive"); + //log("netspool could not start receive"); return 1; } @@ -157,12 +157,12 @@ static int prot_get_next_file(s_filelist **dest, s_protinfo *pi, s_filehint *hin } if(state.netspool.state == NS_READY) { - log("netspool queue empty"); + //log("netspool queue empty"); netspool_end(&state.netspool); } if(state.netspool.state==NS_ERROR) { - log("no next file: netspool error %s", state.netspool.error); + log("netspool error %s", state.netspool.error); } #endif @@ -227,6 +227,31 @@ int p_tx_fopen(s_protinfo *pi, s_filehint *hint) if( state.sopts.holdall ) return 1; + + if (hint) { + log("trying to reopen file"); + int i; + for (i=0; i++; in_sentfiles) { + if (strcmp(pi->sentfiles[i].net_name, hint->fn)==0) { + log("name match"); + if (pi->sentfiles[i].bytes_total == hint->sz) { + log("size match"); + if (pi->sentfiles[i].mod_time == hint->tm) { + log("time match"); + if (!pi->sentfiles[i].fp) { + log("already closed"); + return -1; + } + pi->send = pi->sentfiles + i; + pi->send->eofseen = FALSE; + pi->send->status = FSTAT_PROCESS; + log("reopened %s", pi->send->fname); + return 0; + } + } + } + } + } get_next_file: if( prot_get_next_file(&ptrl, pi, hint) ) { From 1e13eb5557b7391311094c6d3ad782f1f9369354 Mon Sep 17 00:00:00 2001 From: Sergey Dorofeev Date: Tue, 21 Feb 2012 22:57:39 +0400 Subject: [PATCH 15/29] NETSPOOL fixes --- source/bforce/prot_binkp.c | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/source/bforce/prot_binkp.c b/source/bforce/prot_binkp.c index 5c70332..31eea4b 100644 --- a/source/bforce/prot_binkp.c +++ b/source/bforce/prot_binkp.c @@ -55,6 +55,7 @@ typedef struct { int batch_recv_count; e_file_receive_status frs; int emptyloop; + bool continuesend; } s_binkp_state; int binkp_getforsend(s_binkp_state *bstate, char *buf, int *block_type, unsigned short *block_length); @@ -89,6 +90,7 @@ int binkp_loop(s_binkp_state *bstate) { bstate->batch_recv_count = 0; bstate->frs = frs_nothing; bstate->emptyloop = 0; + bstate->continuesend = false; unsigned short read_pos=0; unsigned short read_blklen=0; @@ -113,7 +115,11 @@ int binkp_loop(s_binkp_state *bstate) { // session criterium handshake criterium while (!bstate->complete || bstate->waiting_got) { log("loop s: %d r: %d", bstate->batchsendcomplete, bstate->batchreceivecomplete); - if(have_to_write==0 && (!no_more_to_send || bstate->extracmd[0]!=-1)) { + if (bstate->continuesend) { + no_more_to_send = false; + bstate->continuesend = false; + } + if (have_to_write==0 && (!no_more_to_send || bstate->extracmd[0]!=-1)) { m = binkp_getforsend(bstate, writebuf+BINKP_HEADER, &block_type, &block_length); if( m==1) { //log("got block for sending %d %hu", block_type, block_length); @@ -520,7 +526,7 @@ case 4: *block_length = 1+sprintf(buf+1, "%s %ld %ld -1", bstate->pi->send->net_name, bstate->pi->send->bytes_total, bstate->pi->send->mod_time); *block_type = BINKP_BLK_CMD; - return 1; // no state change. phase would be changed to 1 by recv when M_GET is received + return 2; // no state change. phase would be changed to 1 by recv when M_GET is received } bstate->phase += 1; @@ -557,7 +563,7 @@ case 4: int i; bool ack = false; for(i = 0; i < bstate->pi->n_sentfiles; i++ ) { - if (p_compfinfo(&bstate->pi->sentfiles[i], bstate->pi->send->fname, bstate->pi->send->bytes_total, bstate->pi->send->mod_time) == 0) { + if (p_compfinfo(&bstate->pi->sentfiles[i], bstate->pi->send->net_name, bstate->pi->send->bytes_total, bstate->pi->send->mod_time) == 0) { if (bstate->pi->sentfiles[i].status == FSTAT_SUCCESS) { ack = true; log("acknowledged"); @@ -566,9 +572,10 @@ case 4: } } if (!ack) { - log("wait for ACK"); + log("wait for M_GOT"); return 0; } + log("M_GOT received, going to next file"); } else { log("do not wait M_GOT"); } @@ -932,6 +939,7 @@ case BPMSG_GET: /* Get a file from offset */ bstate->pi->send->net_name, (long)bstate->pi->send->bytes_total, (long)bstate->pi->send->mod_time, (long)bstate->pi->send->bytes_sent); bstate->extraislast = false; + bstate->continuesend = true; return 1; } @@ -939,11 +947,12 @@ case BPMSG_GET: /* Get a file from offset */ if (bstate->pi->send) if (bstate->pi->send->netspool) { log("ignore differing M_GET for netspool"); + bstate->continuesend = true; return 1; } if (bstate->pi->send) if (p_compfinfo(bstate->pi->send, getfi.fn, getfi.sz, getfi.tm)==0) { - log("resending \"%s\" from %ld offset", bstate->pi->send->fname, (long)getfi.offs); + log("resending \"%s\" from %ld offset", bstate->pi->send->net_name, (long)getfi.offs); if( p_tx_rewind(bstate->pi, getfi.offs) != 0 ) { log("failed to rewind"); p_tx_fclose(bstate->pi); @@ -956,6 +965,7 @@ case BPMSG_GET: /* Get a file from offset */ (long)bstate->pi->send->mod_time, (long)getfi.offs); bstate->extraislast = false; bstate->phase = 2; + bstate->continuesend = true; return 1; } @@ -978,7 +988,7 @@ case BPMSG_GET: /* Get a file from offset */ return -1; } bstate->waiting_got = true; - log("sending \"%s\" from %ld offset", bstate->pi->send->fname, (long)getfi.offs); + log("sending \"%s\" from %ld offset", bstate->pi->send->net_name, (long)getfi.offs); bstate->pi->send->bytes_skipped = getfi.offs; bstate->pi->send->bytes_sent = getfi.offs; bstate->extracmd[0] = BPMSG_FILE; @@ -986,6 +996,7 @@ case BPMSG_GET: /* Get a file from offset */ (long)bstate->pi->send->mod_time, (long)getfi.offs); bstate->extraislast = false; bstate->phase = 2; + bstate->continuesend = true; return 1; } log("unknown command %d received", buf[0]); From 1aff894fc31c089ec003b983002ec276b4b53ae3 Mon Sep 17 00:00:00 2001 From: Sergey Dorofeev Date: Wed, 22 Feb 2012 21:10:50 +0400 Subject: [PATCH 16/29] Fixed NR mode: prevent to open multiple files --- source/bforce/prot_binkp.c | 18 ++++++++++-------- source/bforce/prot_binkp_misc.c | 1 + source/bforce/prot_common.c | 5 ++++- 3 files changed, 15 insertions(+), 9 deletions(-) diff --git a/source/bforce/prot_binkp.c b/source/bforce/prot_binkp.c index 31eea4b..ce0b90b 100644 --- a/source/bforce/prot_binkp.c +++ b/source/bforce/prot_binkp.c @@ -121,7 +121,7 @@ int binkp_loop(s_binkp_state *bstate) { } if (have_to_write==0 && (!no_more_to_send || bstate->extracmd[0]!=-1)) { m = binkp_getforsend(bstate, writebuf+BINKP_HEADER, &block_type, &block_length); - if( m==1) { + if(m==1 || m==3) { //log("got block for sending %d %hu", block_type, block_length); write_pos = 0; have_to_write = block_length+BINKP_HEADER; @@ -135,13 +135,15 @@ int binkp_loop(s_binkp_state *bstate) { return -1; } writebuf[1] = block_length&0xff; - } else if (m==2) { + } + if (m==2 || m==3) { log("no more to send"); no_more_to_send = true; } - else if (m==0) { + if (m==0) { log("binkp: nothing to write"); - } else { + } + if (m<0 || m>3) { log("getforsend error"); return -1; } @@ -524,9 +526,9 @@ case 4: log("send M_FILE with -1"); buf[0] = BPMSG_FILE; *block_length = 1+sprintf(buf+1, "%s %ld %ld -1", bstate->pi->send->net_name, - bstate->pi->send->bytes_total, bstate->pi->send->mod_time); + (long)bstate->pi->send->bytes_total, (long)bstate->pi->send->mod_time); *block_type = BINKP_BLK_CMD; - return 2; // no state change. phase would be changed to 1 by recv when M_GET is received + return 3; // no state change. phase would be changed to 1 by recv when M_GET is received } bstate->phase += 1; @@ -865,7 +867,7 @@ case BPMSG_SKIP: if (buf[0] == BPMSG_SKIP) { if (bstate->pi->send->netspool) { log("cannot skip netspool"); - return -1; + return -1; // no reason to continue sending } log("skipped %s", fi.fn); bstate->pi->send->status = FSTAT_REFUSED; @@ -877,7 +879,7 @@ case BPMSG_SKIP: log("confirmed not sent file - skipped %s", fi.fn); if (bstate->pi->send->netspool) { log("cannot skip netspool"); - return -1; + return -1; // no reason to continue sending } bstate->pi->send->status = FSTAT_SKIPPED; } diff --git a/source/bforce/prot_binkp_misc.c b/source/bforce/prot_binkp_misc.c index f0456b4..0c9ae32 100644 --- a/source/bforce/prot_binkp_misc.c +++ b/source/bforce/prot_binkp_misc.c @@ -43,6 +43,7 @@ int binkp_parsfinfo(const char *str, s_bpfinfo *fi, bool with_offset) log("too long string, overflow may occur"); return -1; } + log("info to parse: %s", str); r = sscanf(str, with_offset? "%s %d %d %d": "%s %d %d", &fi->fn, &fi->sz, &fi->tm, &fi->offs); if (r==(with_offset? 4: 3)) { return 0; diff --git a/source/bforce/prot_common.c b/source/bforce/prot_common.c index 70f1df9..b0cea86 100644 --- a/source/bforce/prot_common.c +++ b/source/bforce/prot_common.c @@ -229,9 +229,10 @@ int p_tx_fopen(s_protinfo *pi, s_filehint *hint) return 1; if (hint) { - log("trying to reopen file"); + log("trying to reopen file %s size %d time %d", hint->fn, hint->sz, hint->tm); int i; for (i=0; i++; in_sentfiles) { + log("check %s %d %d", pi->sentfiles[i].net_name, pi->sentfiles[i].bytes_total, pi->sentfiles[i].mod_time); if (strcmp(pi->sentfiles[i].net_name, hint->fn)==0) { log("name match"); if (pi->sentfiles[i].bytes_total == hint->sz) { @@ -251,6 +252,8 @@ int p_tx_fopen(s_protinfo *pi, s_filehint *hint) } } } + log("no file for this hint"); + return -1; } get_next_file: From 3e9e152054da9b4532eb8632482926196f2e1b40 Mon Sep 17 00:00:00 2001 From: Sergey Dorofeev Date: Thu, 23 Feb 2012 16:33:52 +0400 Subject: [PATCH 17/29] moved address lists to state variable --- source/bforce/freq_srif.c | 3 +- source/bforce/netspool.c | 11 ++-- source/bforce/prot_binkp.c | 54 +++++++++---------- source/bforce/prot_binkp_api.c | 27 +++++----- source/bforce/prot_binkp_misc.c | 27 ++++------ source/bforce/prot_common.c | 45 ++++++++++++---- source/bforce/prot_emsi.c | 8 +-- source/bforce/prot_emsi_api.c | 37 +++++++------ source/bforce/prot_emsi_misc.c | 76 +++++++++++++------------- source/bforce/prot_yoohoo.c | 96 ++++++++++++++++----------------- source/bforce/prot_yoohoo_api.c | 39 +++++++------- source/bforce/prot_zmsend.c | 2 +- source/bforce/sess_common.c | 49 ++++++++++------- source/include/prot_binkp.h | 4 +- source/include/prot_emsi.h | 4 +- source/include/prot_yoohoo.h | 4 +- source/include/session.h | 29 ++++++---- 17 files changed, 275 insertions(+), 240 deletions(-) diff --git a/source/bforce/freq_srif.c b/source/bforce/freq_srif.c index 8b2acf1..bd9207e 100644 --- a/source/bforce/freq_srif.c +++ b/source/bforce/freq_srif.c @@ -68,8 +68,7 @@ int req_createsrif(char *sname, char *req, char *rsp) else fprintf(fp, "Sysop SysOp\n"); - if( state.handshake && state.handshake->remote_address - && (aptr = state.handshake->remote_address(state.handshake)) ) + if( aptr = session_1remote_address() ) fprintf(fp, "AKA %s\n", ftn_addrstr(abuf, *aptr)); else return -1; diff --git a/source/bforce/netspool.c b/source/bforce/netspool.c index 86e9db1..2ce7461 100644 --- a/source/bforce/netspool.c +++ b/source/bforce/netspool.c @@ -73,7 +73,7 @@ int sendstr(int s, const char *buf) { -void netspool_start(s_netspool_state *state, const char *host, const char *port, const char *address, const char *password) +void netspool_start(s_netspool_state *state, const char *host, const char *port, const char *addresses, const char *password) { int s, r; struct addrinfo hint; @@ -126,9 +126,12 @@ void netspool_start(s_netspool_state *state, const char *host, const char *port, if( r ) { state->state = NS_ERROR; state->error = "IO error"; return; } //puts(strbuf); -- hello from remote - snprintf(strbuf, STRBUF, "ADDRESS %s", address); - r = sendstr(s, strbuf); - if( r ) { state->state = NS_ERROR; state->error = "IO error"; return; } + while (*addresses) { // stop when zero length string under pointer + snprintf(strbuf, STRBUF, "ADDRESS %s", addresses); + r = sendstr(s, strbuf); + if( r ) { state->state = NS_ERROR; state->error = "IO error"; return; } + addresses += strlen(addresses)+1; // go to next string + } snprintf(strbuf, STRBUF, "PASSWORD %s", password); r = sendstr(s, strbuf); diff --git a/source/bforce/prot_binkp.c b/source/bforce/prot_binkp.c index ce0b90b..fd89f28 100644 --- a/source/bforce/prot_binkp.c +++ b/source/bforce/prot_binkp.c @@ -61,7 +61,7 @@ typedef struct { int binkp_getforsend(s_binkp_state *bstate, char *buf, int *block_type, unsigned short *block_length); int binkp_doreceiveblock(s_binkp_state *bstate, char *buf, int block_type, unsigned short block_length); void binkp_process_NUL(s_binkp_sysinfo *remote_data, char *buffer); -void binkp_process_ADR(s_binkp_sysinfo *remote_data, char *buffer); +void binkp_process_ADR(char *buffer); int binkp_loop(s_binkp_state *bstate) { unsigned char readbuf[BINKP_HEADER+BINKP_MAXBLOCK+1]; @@ -419,20 +419,20 @@ case 2: buf[0] = BPMSG_ADR; wr_pos = 1; int i; - for( i = 0; i < bstate->local_data->anum; i++ ) + for( i = 0; i < state.n_localaddr; i++ ) { if (i) wr_pos += sprintf(buf+wr_pos, " "); - if (bstate->local_data->addrs[i].addr.point) { + if (state.localaddrs[i].addr.point) { wr_pos += sprintf(buf+wr_pos, "%d:%d/%d.%d@%s", - bstate->local_data->addrs[i].addr.zone, bstate->local_data->addrs[i].addr.net, - bstate->local_data->addrs[i].addr.node, bstate->local_data->addrs[i].addr.point, - bstate->local_data->addrs[i].addr.domain); + state.localaddrs[i].addr.zone, state.localaddrs[i].addr.net, + state.localaddrs[i].addr.node, state.localaddrs[i].addr.point, + state.localaddrs[i].addr.domain); } else { wr_pos += sprintf(buf+wr_pos, "%d:%d/%d@%s", - bstate->local_data->addrs[i].addr.zone, bstate->local_data->addrs[i].addr.net, - bstate->local_data->addrs[i].addr.node, - bstate->local_data->addrs[i].addr.domain); + state.localaddrs[i].addr.zone, state.localaddrs[i].addr.net, + state.localaddrs[i].addr.node, + state.localaddrs[i].addr.domain); } } *block_type = BINKP_BLK_CMD; @@ -635,9 +635,9 @@ case BPMSG_ADR: /* List of addresses */ return -1; } if( bstate->extracmd[0] !=-1 ) return 0; // suspend !!! - binkp_process_ADR(bstate->remote_data, buf+1); + binkp_process_ADR(buf+1); - if( !bstate->remote_data->anum ) { + if( !state.n_remoteaddr ) { log("error: remote did not supplied any addresses"); if( bstate->extracmd[0] !=-1 ) return 0; // suspend bstate->extracmd[0] = BPMSG_BSY; @@ -653,9 +653,9 @@ case BPMSG_ADR: /* List of addresses */ bstate->extraislast = false; sprintf(bstate->extracmd+1,"OPT MB"); s_override ovr; - for(i = 0; i < bstate->remote_data->anum; i++) { + for(i = 0; i < state.n_remoteaddr; i++) { ovr.sFlags = ""; - override_get (&ovr, bstate->remote_data->addrs[i].addr, 0); + override_get (&ovr, state.remoteaddrs[i].addr, 0); if (nodelist_checkflag (ovr.sFlags, "NR")==0) { strcat (bstate->extracmd+1, " NR"); break; @@ -666,7 +666,7 @@ case BPMSG_ADR: /* List of addresses */ if (bstate->mode == bmode_outgoing_handshake) { // check that remote has the address we call - if( session_addrs_check_genuine(bstate->remote_data->addrs, bstate->remote_data->anum, + if( session_addrs_check_genuine(state.remoteaddrs, state.n_remoteaddr, state.node.addr) ) { log("error: remote does not have the called address"); bstate->extracmd[0] = BPMSG_ERR; @@ -678,7 +678,7 @@ case BPMSG_ADR: /* List of addresses */ strncpy(bstate->remote_data->passwd, bstate->local_data->passwd, BINKP_MAXPASSWD); bstate->remote_data->passwd[BINKP_MAXPASSWD] = '\0'; - if( session_addrs_check(bstate->remote_data->addrs, bstate->remote_data->anum, + if( session_addrs_check(state.remoteaddrs, state.n_remoteaddr, bstate->remote_data->passwd, NULL, 0) ) { log("error: Security violation"); bstate->extracmd[0] = BPMSG_ERR; @@ -715,7 +715,7 @@ case BPMSG_PWD: /* Session password */ return 1; } // lock addresses - if( session_addrs_lock(bstate->remote_data->addrs, bstate->remote_data->anum) ) { + if( session_addrs_lock(state.remoteaddrs, state.n_remoteaddr) ) { log("error locking addresses of the remote"); if( bstate->extracmd[0] !=-1 ) return 0; // suspend if extra is occupied bstate->extracmd[0] = BPMSG_BSY; @@ -815,7 +815,7 @@ case BPMSG_OK: /* Password was acknowleged (data ignored) */ log("unexpected M_OK"); return -1; } - if (session_addrs_lock(bstate->remote_data->addrs, bstate->remote_data->anum)) { + if (session_addrs_lock(state.remoteaddrs, state.n_remoteaddr)) { log("error: unable to lock"); if (bstate->extracmd[0]!=-1) return 0; bstate->extracmd[0] = BPMSG_BSY; @@ -1148,7 +1148,7 @@ void binkp_process_NUL(s_binkp_sysinfo *remote_data, char *buffer) log("BinkP NUL: \"%s\"", string_printable(buffer)); // NUL cannot be invalid as it is optional info } -void binkp_process_ADR(s_binkp_sysinfo *remote_data, char *buffer) +void binkp_process_ADR(char *buffer) { s_faddr addr; char *p, *q; @@ -1158,7 +1158,7 @@ void binkp_process_ADR(s_binkp_sysinfo *remote_data, char *buffer) if( ftn_addrparse(&addr, p, FALSE) ) log("BinkP got unparsable address \"%s\"", string_printable(p)); else - session_addrs_add(&remote_data->addrs, &remote_data->anum, addr); + session_addrs_add(&state.remoteaddrs, &state.n_remoteaddr, addr); } } @@ -1167,19 +1167,19 @@ int binkp_auth_incoming(s_binkp_sysinfo *remote_data) if( remote_data->challenge_length > 0 && strncmp(remote_data->passwd, "CRAM-MD5-", 9) == 0 ) { - log("md5 auth addrs %s", remote_data->addrs); - log("md5 auth anum %d", remote_data->anum); - log("md5 auth passwd %s", remote_data->passwd + 9); - log("md5 auth challenge %s", remote_data->challenge); - log("md5 auth challenge len %d", remote_data->challenge_length); - return session_addrs_check(remote_data->addrs, - remote_data->anum, + //log("md5 auth addrs %s", remote_data->addrs); + //log("md5 auth anum %d", remote_data->anum); + //log("md5 auth passwd %s", remote_data->passwd + 9); + //log("md5 auth challenge %s", remote_data->challenge); + //log("md5 auth challenge len %d", remote_data->challenge_length); + return session_addrs_check(state.remoteaddrs, + state.n_remoteaddr, remote_data->passwd + 9, remote_data->challenge, remote_data->challenge_length); } log("plain-text auth"); - return session_addrs_check(remote_data->addrs, remote_data->anum, + return session_addrs_check(state.remoteaddrs, state.n_remoteaddr, remote_data->passwd, NULL, 0); } diff --git a/source/bforce/prot_binkp_api.c b/source/bforce/prot_binkp_api.c index 761679e..ec3f765 100644 --- a/source/bforce/prot_binkp_api.c +++ b/source/bforce/prot_binkp_api.c @@ -48,7 +48,7 @@ s_handshake_protocol handshake_protocol_binkp = { binkp_incoming2, binkp_outgoing2, /* Section 2 */ - binkp_remote_address, +// binkp_remote_address, binkp_remote_password, binkp_remote_sysop_name, binkp_remote_system_name, @@ -58,7 +58,7 @@ s_handshake_protocol handshake_protocol_binkp = { binkp_remote_mailer, NULL, /* Section 3 */ - binkp_local_address, +// binkp_local_address, binkp_local_password }; @@ -113,9 +113,9 @@ int binkp_incoming2(s_handshake_protocol *THIS) rc = binkp_incoming(local_data, remote_data); binkp_log_sysinfo(remote_data); - if( remote_data->anum > 0 ) + if( state.n_remoteaddr > 0 ) { - session_remote_lookup(remote_data->addrs, remote_data->anum); + session_remote_lookup(state.remoteaddrs, state.n_remoteaddr); session_remote_log_status(); binkp_log_options(remote_data); } @@ -125,8 +125,8 @@ int binkp_incoming2(s_handshake_protocol *THIS) /* * Create mail/files queue */ - session_create_files_queue(remote_data->addrs, - remote_data->anum); + session_create_files_queue(state.remoteaddrs, + state.n_remoteaddr); session_set_send_options(); session_set_inbound(); session_set_freqs_status(); @@ -155,9 +155,9 @@ int binkp_outgoing2(s_handshake_protocol *THIS) rc = binkp_outgoing(local_data, remote_data); binkp_log_sysinfo(remote_data); - if( remote_data->anum > 0 ) + if( state.n_remoteaddr > 0 ) { - session_remote_lookup(remote_data->addrs, remote_data->anum); + session_remote_lookup(state.remoteaddrs, state.n_remoteaddr); session_remote_log_status(); binkp_log_options(remote_data); } @@ -167,8 +167,7 @@ int binkp_outgoing2(s_handshake_protocol *THIS) /* * Create mail/files queue */ - session_create_files_queue(remote_data->addrs, - remote_data->anum); + session_create_files_queue(state.remoteaddrs, state.n_remoteaddr); session_set_send_options(); session_set_inbound(); } @@ -176,7 +175,7 @@ int binkp_outgoing2(s_handshake_protocol *THIS) return rc; } -s_faddr *binkp_remote_address(s_handshake_protocol *THIS) +/*s_faddr *binkp_remote_address(s_handshake_protocol *THIS) { ASSERT(THIS); ASSERT(THIS->remote_data); @@ -185,7 +184,7 @@ s_faddr *binkp_remote_address(s_handshake_protocol *THIS) return &((s_binkp_sysinfo *)THIS->remote_data)->addrs[0].addr; return NULL; -} +} */ char *binkp_remote_password(s_handshake_protocol *THIS) { @@ -264,7 +263,7 @@ char *binkp_remote_mailer(s_handshake_protocol *THIS) return NULL; } -s_faddr *binkp_local_address(s_handshake_protocol *THIS) +/*s_faddr *binkp_local_address(s_handshake_protocol *THIS) { ASSERT(THIS); ASSERT(THIS->local_data); @@ -273,7 +272,7 @@ s_faddr *binkp_local_address(s_handshake_protocol *THIS) return &((s_binkp_sysinfo *)THIS->local_data)->addrs[0].addr; return NULL; -} +} */ char *binkp_local_password(s_handshake_protocol *THIS) { diff --git a/source/bforce/prot_binkp_misc.c b/source/bforce/prot_binkp_misc.c index 0c9ae32..9bc77bc 100644 --- a/source/bforce/prot_binkp_misc.c +++ b/source/bforce/prot_binkp_misc.c @@ -146,11 +146,9 @@ void binkp_log_sysinfo(s_binkp_sysinfo *binkp) int i; char abuf[BF_MAXADDRSTR+1]; - if( binkp->anum ) - for( i = 0; i < binkp->anum; i++ ) - { - log(" Address : %s", ftn_addrstr(abuf, binkp->addrs[i].addr)); - } + for( i = 0; i < state.n_remoteaddr; i++ ) { + log(" Address : %s", ftn_addrstr(abuf, state.remoteaddrs[i].addr)); + } if( *binkp->systname && *binkp->phone ) log(" System : %s (%s)", @@ -220,25 +218,21 @@ void binkp_set_sysinfo(s_binkp_sysinfo *binkp, s_faddr *remote_addr, bool caller const char *p_flags = conf_string(cf_flags); /* free previously allocated memory */ - if( binkp->addrs ) - free(binkp->addrs); +// if( binkp->addrs ) +// free(binkp->addrs); memset(binkp, '\0', sizeof(s_binkp_sysinfo)); /* Set best primary address */ - if( remote_addr ) - { + if(remote_addr) { primary = session_get_bestaka(*remote_addr); /* Add primary address */ - if( primary ) - session_addrs_add(&binkp->addrs, &binkp->anum, *primary); + if (primary) session_addrs_add(&state.localaddrs, &state.n_localaddr, *primary); } /* Add other AKAs */ - for( addr_ptr = conf_first(cf_address); addr_ptr; - addr_ptr = conf_next(addr_ptr) ) - { + for( addr_ptr = conf_first(cf_address); addr_ptr; addr_ptr = conf_next(addr_ptr) ) { for( hide_ptr = conf_first(cf_hide_our_aka); hide_ptr; hide_ptr = conf_next(hide_ptr) ) { @@ -247,12 +241,11 @@ void binkp_set_sysinfo(s_binkp_sysinfo *binkp, s_faddr *remote_addr, bool caller } if( !hide_ptr && primary != &addr_ptr->d.falist.addr ) - session_addrs_add(&binkp->addrs, &binkp->anum, + session_addrs_add(&state.localaddrs, &state.n_localaddr, addr_ptr->d.falist.addr); } - if( binkp->anum == 0 ) - log("warning: no addresses will be presented to remote"); + if (state.n_localaddr == 0) log("warning: no addresses will be presented to remote"); /* session password */ if( caller ) diff --git a/source/bforce/prot_common.c b/source/bforce/prot_common.c index b0cea86..f854e21 100644 --- a/source/bforce/prot_common.c +++ b/source/bforce/prot_common.c @@ -41,12 +41,13 @@ const char *Protocols[] = * Zero value on success and non-zero if nothing to send */ -static int prot_get_next_file(s_filelist **dest, s_protinfo *pi, s_filehint *hint) +static int prot_get_next_file(s_filelist **dest, s_protinfo *pi) { log("prot_get_next_file"); // %s %d", hint->fn, hint->sz); s_filelist *ptrl = NULL; s_filelist *best = NULL; s_fsqueue *q = &state.queue; + s_filehint *hint = NULL; // M_GET hinting does not work good here as it spec net_name and it is unknown here (especially for PKTs) *dest = NULL; @@ -116,24 +117,48 @@ static int prot_get_next_file(s_filelist **dest, s_protinfo *pi, s_filehint *hin /*log("netspool next file");*/ if(state.netspool.state == NS_NOTINIT) { /*log("new netspool connection");*/ - char password[100]; - char address[300]; +#define ADDRBUF 3000 +#define SMALLBUF 128 + char password[SMALLBUF]; + char address[SMALLBUF]; + char addresses[ADDRBUF]; + int i, pos, alen; char *host = conf_string(cf_netspool_host); char *port = conf_string(cf_netspool_port); if(host==NULL) { //log("netspool is not configured"); state.netspool.state = NS_UNCONF; } else { - snprintf(address, 299, state.node.addr.point? "%d:%d/%d.%d": "%d:%d/%d", - state.node.addr.zone, state.node.addr.net, - state.node.addr.node, state.node.addr.point); + if (state.n_remoteaddr==0) { + log("cannot start netspool: list of remote addresses has zero length"); + return -1; + } + for(i=0, pos=0; i ADDRBUF-1) { // space for zero length string as end marker + log("no buffer space for address %s", address); + break; + } + log("add address %s", address); + memcpy (addresses+pos, address, alen); + pos += alen; + addresses[pos++] = 0; + } + addresses[pos++] = 0; + if(state.protected) { - session_get_password(state.node.addr, password, 100); + session_get_password(state.remoteaddrs[0].addr, password, SMALLBUF); } else { password[0] = 0; } - log("netspool start %s %s %s (pwd)", host, port, address); - netspool_start(&state.netspool, host, port, address, password); + log("netspool start %s %s", host, port); + netspool_start(&state.netspool, host, port, addresses, password); } } @@ -257,7 +282,7 @@ int p_tx_fopen(s_protinfo *pi, s_filehint *hint) } get_next_file: - if( prot_get_next_file(&ptrl, pi, hint) ) { + if( prot_get_next_file(&ptrl, pi) ) { log("no next file"); return 1; } diff --git a/source/bforce/prot_emsi.c b/source/bforce/prot_emsi.c index 76585f9..1ffbba7 100644 --- a/source/bforce/prot_emsi.c +++ b/source/bforce/prot_emsi.c @@ -610,7 +610,7 @@ void emsi_set_sysinfo(s_emsi *emsi, s_emsi *remote_emsi, int hrc, const char *p_emsifr = conf_string(cf_emsi_FR_time); /* free previously allocated memory */ - if( emsi->addrs ) free(emsi->addrs); +// if( emsi->addrs ) free(emsi->addrs); memset(emsi, '\0', sizeof(s_emsi)); @@ -624,7 +624,7 @@ void emsi_set_sysinfo(s_emsi *emsi, s_emsi *remote_emsi, int hrc, /* Add primary address */ if( primary ) - session_addrs_add(&emsi->addrs, &emsi->anum, *primary); + session_addrs_add(&state.localaddrs, &state.n_localaddr, *primary); /* Add other AKAs */ for( addr_ptr = conf_first(cf_address); addr_ptr; @@ -638,11 +638,11 @@ void emsi_set_sysinfo(s_emsi *emsi, s_emsi *remote_emsi, int hrc, } if( !hide_ptr && primary != &addr_ptr->d.falist.addr ) - session_addrs_add(&emsi->addrs, &emsi->anum, + session_addrs_add(&state.localaddrs, &state.n_localaddr, addr_ptr->d.falist.addr); } - if( emsi->anum == 0 ) + if( state.localaddrs == 0 ) log("warning: no addresses will be presented to remote"); /* session password */ diff --git a/source/bforce/prot_emsi_api.c b/source/bforce/prot_emsi_api.c index f230a68..c77fc14 100644 --- a/source/bforce/prot_emsi_api.c +++ b/source/bforce/prot_emsi_api.c @@ -24,7 +24,7 @@ void emsi_init(s_handshake_protocol *THIS); void emsi_deinit(s_handshake_protocol *THIS); int emsi_incoming(s_handshake_protocol *THIS); int emsi_outgoing(s_handshake_protocol *THIS); -s_faddr *emsi_remote_address(s_handshake_protocol *THIS); +//s_faddr *emsi_remote_address(s_handshake_protocol *THIS); char *emsi_remote_password(s_handshake_protocol *THIS); char *emsi_remote_sysop_name(s_handshake_protocol *THIS); char *emsi_remote_system_name(s_handshake_protocol *THIS); @@ -33,7 +33,7 @@ char *emsi_remote_phone(s_handshake_protocol *THIS); char *emsi_remote_flags(s_handshake_protocol *THIS); char *emsi_remote_mailer(s_handshake_protocol *THIS); int emsi_remote_traffic(s_handshake_protocol *THIS, s_traffic *dest); -s_faddr *emsi_local_address(s_handshake_protocol *THIS); +//s_faddr *emsi_local_address(s_handshake_protocol *THIS); char *emsi_local_password(s_handshake_protocol *THIS); s_handshake_protocol handshake_protocol_emsi = { @@ -49,7 +49,7 @@ s_handshake_protocol handshake_protocol_emsi = { emsi_incoming, emsi_outgoing, /* Section 2 */ - emsi_remote_address, +// emsi_remote_address, emsi_remote_password, emsi_remote_sysop_name, emsi_remote_system_name, @@ -59,7 +59,7 @@ s_handshake_protocol handshake_protocol_emsi = { emsi_remote_mailer, emsi_remote_traffic, /* Section 3 */ - emsi_local_address, +// emsi_local_address, emsi_local_password }; @@ -151,7 +151,7 @@ int emsi_incoming(s_handshake_protocol *THIS) /* * Check password(s) */ - if( session_addrs_check(remote_emsi->addrs, remote_emsi->anum, + if( session_addrs_check(state.remoteaddrs, state.n_remoteaddr, remote_emsi->passwd, NULL, 0) ) { rc = HRC_BAD_PASSWD; @@ -161,7 +161,7 @@ int emsi_incoming(s_handshake_protocol *THIS) else { /* Lock (create BSY) remote addresses */ - if( session_addrs_lock(remote_emsi->addrs, remote_emsi->anum) ) + if( session_addrs_lock(state.remoteaddrs, state.n_remoteaddr) ) { log("all remote addresses are busy"); rc = HRC_BUSY; @@ -172,7 +172,7 @@ int emsi_incoming(s_handshake_protocol *THIS) * We know caller's address so we can process * more expressions and fill state.node structure.. */ - session_remote_lookup(remote_emsi->addrs, remote_emsi->anum); + session_remote_lookup(state.remoteaddrs, state.n_remoteaddr); if( session_check_speed() ) rc = HRC_LOW_SPEED; @@ -219,8 +219,8 @@ int emsi_incoming(s_handshake_protocol *THIS) /* * Create mail/files queue */ - session_create_files_queue(remote_emsi->addrs, - remote_emsi->anum); + session_create_files_queue(state.remoteaddrs, + state.n_remoteaddr); /* * Set FREQ processor status @@ -290,21 +290,21 @@ int emsi_outgoing(s_handshake_protocol *THIS) /* * Make sure expected address was presented */ - if( session_addrs_check_genuine(remote_emsi->addrs, - remote_emsi->anum, state.node.addr) ) + if( session_addrs_check_genuine(state.remoteaddrs, + state.n_remoteaddr, state.node.addr) ) return HRC_NO_ADDRESS; /* * Check password(s) */ - if( session_addrs_check(remote_emsi->addrs, remote_emsi->anum, + if( session_addrs_check(state.remoteaddrs, state.n_remoteaddr, remote_emsi->passwd, NULL, 0) ) return HRC_BAD_PASSWD; /* * Lock (create BSY) remote addresses */ - (void)session_addrs_lock(remote_emsi->addrs, remote_emsi->anum); + (void)session_addrs_lock(state.remoteaddrs, state.n_remoteaddr); /* * Set protocol we will use ("options" ignored) @@ -341,13 +341,12 @@ int emsi_outgoing(s_handshake_protocol *THIS) /* * Create mail/files queue */ - session_create_files_queue(remote_emsi->addrs, - remote_emsi->anum); + session_create_files_queue(state.remoteaddrs, state.n_remoteaddr); return HRC_OK; } -s_faddr *emsi_remote_address(s_handshake_protocol *THIS) +/*s_faddr *emsi_remote_address(s_handshake_protocol *THIS) { ASSERT(THIS); ASSERT(THIS->remote_data); @@ -356,7 +355,7 @@ s_faddr *emsi_remote_address(s_handshake_protocol *THIS) return &((s_emsi *)THIS->remote_data)->addrs[0].addr; return NULL; -} +} */ char *emsi_remote_password(s_handshake_protocol *THIS) { @@ -456,7 +455,7 @@ int emsi_remote_traffic(s_handshake_protocol *THIS, s_traffic *dest) return -1; } -s_faddr *emsi_local_address(s_handshake_protocol *THIS) +/*s_faddr *emsi_local_address(s_handshake_protocol *THIS) { ASSERT(THIS); ASSERT(THIS->local_data); @@ -465,7 +464,7 @@ s_faddr *emsi_local_address(s_handshake_protocol *THIS) return &((s_emsi *)THIS->local_data)->addrs[0].addr; return NULL; -} +} */ char *emsi_local_password(s_handshake_protocol *THIS) { diff --git a/source/bforce/prot_emsi_misc.c b/source/bforce/prot_emsi_misc.c index ea9558b..12fdf2c 100644 --- a/source/bforce/prot_emsi_misc.c +++ b/source/bforce/prot_emsi_misc.c @@ -116,10 +116,10 @@ char *emsi_createdat(s_emsi *emsi) /* our addresses, akas, etc :) */ tmp = add_char(tmp, '{'); - for( i = 0; i < emsi->anum; i++ ) + for( i = 0; i < state.n_localaddr; i++ ) { if( i ) tmp = add_char(tmp, ' '); - tmp = add_str(tmp, ftn_addrstr(abuf, emsi->addrs[i].addr)); + tmp = add_str(tmp, ftn_addrstr(abuf, state.localaddrs[i].addr)); } tmp = add_char(tmp, '}'); @@ -146,27 +146,27 @@ char *emsi_createdat(s_emsi *emsi) if( emsi->linkcodes.FNC ) tmp = add_str(tmp, "FNC,"); if( emsi->linkcodes.RMA ) tmp = add_str(tmp, "RMA,"); if( emsi->linkcodes.RH1 ) tmp = add_str(tmp, "RH1,"); - for( i = 0; i < emsi->anum; i++ ) + for( i = 0; i < state.n_localaddr; i++ ) { - if( emsi->addrs[i].flags & EMSI_FLAG_PU ) + if( state.localaddrs[i].flags & EMSI_FLAG_PU ) tmp = add_nflag(tmp, "PU", i); - if( emsi->addrs[i].flags & EMSI_FLAG_HA ) + if( state.localaddrs[i].flags & EMSI_FLAG_HA ) tmp = add_nflag(tmp, "HA", i); - if( emsi->addrs[i].flags & EMSI_FLAG_PM ) + if( state.localaddrs[i].flags & EMSI_FLAG_PM ) tmp = add_nflag(tmp, "PM", i); - if( emsi->addrs[i].flags & EMSI_FLAG_NF ) + if( state.localaddrs[i].flags & EMSI_FLAG_NF ) tmp = add_nflag(tmp, "NF", i); - if( emsi->addrs[i].flags & EMSI_FLAG_NX ) + if( state.localaddrs[i].flags & EMSI_FLAG_NX ) tmp = add_nflag(tmp, "NX", i); - if( emsi->addrs[i].flags & EMSI_FLAG_NR ) + if( state.localaddrs[i].flags & EMSI_FLAG_NR ) tmp = add_nflag(tmp, "NR", i); - if( emsi->addrs[i].flags & EMSI_FLAG_HN ) + if( state.localaddrs[i].flags & EMSI_FLAG_HN ) tmp = add_nflag(tmp, "HN", i); - if( emsi->addrs[i].flags & EMSI_FLAG_HX ) + if( state.localaddrs[i].flags & EMSI_FLAG_HX ) tmp = add_nflag(tmp, "HX", i); - if( emsi->addrs[i].flags & EMSI_FLAG_HF ) + if( state.localaddrs[i].flags & EMSI_FLAG_HF ) tmp = add_nflag(tmp, "HF", i); - if( emsi->addrs[i].flags & EMSI_FLAG_HR ) + if( state.localaddrs[i].flags & EMSI_FLAG_HR ) tmp = add_nflag(tmp, "HR", i); } if( tmp[strlen(tmp+1)] == ',' ) @@ -468,10 +468,10 @@ int emsi_parsedat(char *emsi_dat, s_emsi *emsi) if( ftn_addrparse(&addr, p, FALSE) ) log("unparsable address \"%s\" skipped", p); else - session_addrs_add(&emsi->addrs, &emsi->anum, addr); + session_addrs_add(&state.remoteaddrs, &state.n_remoteaddr, addr); } - if( emsi->anum == 0 ) + if( state.n_remoteaddr == 0 ) { log("parsable addresses not found"); return(1); @@ -502,24 +502,24 @@ int emsi_parsedat(char *emsi_dat, s_emsi *emsi) else if( !strcmp(p, "RMA") ) emsi->linkcodes.RMA = 1; else if( !strcmp(p, "RH1") ) emsi->linkcodes.RH1 = 1; /* check EMSI-II address dependend flags */ - else if( ((i=nflgcmp(p, "HA")) >= 0) && (i < emsi->anum) ) - emsi->addrs[i].flags |= EMSI_FLAG_HA; - else if( ((i=nflgcmp(p, "PM")) >= 0) && (i < emsi->anum) ) - emsi->addrs[i].flags |= EMSI_FLAG_PM; - else if( ((i=nflgcmp(p, "NF")) >= 0) && (i < emsi->anum) ) - emsi->addrs[i].flags |= EMSI_FLAG_NF; - else if( ((i=nflgcmp(p, "NX")) >= 0) && (i < emsi->anum) ) - emsi->addrs[i].flags |= EMSI_FLAG_NX; - else if( ((i=nflgcmp(p, "NR")) >= 0) && (i < emsi->anum) ) - emsi->addrs[i].flags |= EMSI_FLAG_NR; - else if( ((i=nflgcmp(p, "HN")) >= 0) && (i < emsi->anum) ) - emsi->addrs[i].flags |= EMSI_FLAG_HN; - else if( ((i=nflgcmp(p, "HX")) >= 0) && (i < emsi->anum) ) - emsi->addrs[i].flags |= EMSI_FLAG_HX; - else if( ((i=nflgcmp(p, "HF")) >= 0) && (i < emsi->anum) ) - emsi->addrs[i].flags |= EMSI_FLAG_HF; - else if( ((i=nflgcmp(p, "HR")) >= 0) && (i < emsi->anum) ) - emsi->addrs[i].flags |= EMSI_FLAG_HR; + else if( ((i=nflgcmp(p, "HA")) >= 0) && (i < state.n_remoteaddr) ) + state.remoteaddrs[i].flags |= EMSI_FLAG_HA; + else if( ((i=nflgcmp(p, "PM")) >= 0) && (i < state.n_remoteaddr) ) + state.remoteaddrs[i].flags |= EMSI_FLAG_PM; + else if( ((i=nflgcmp(p, "NF")) >= 0) && (i < state.n_remoteaddr) ) + state.remoteaddrs[i].flags |= EMSI_FLAG_NF; + else if( ((i=nflgcmp(p, "NX")) >= 0) && (i < state.n_remoteaddr) ) + state.remoteaddrs[i].flags |= EMSI_FLAG_NX; + else if( ((i=nflgcmp(p, "NR")) >= 0) && (i < state.n_remoteaddr) ) + state.remoteaddrs[i].flags |= EMSI_FLAG_NR; + else if( ((i=nflgcmp(p, "HN")) >= 0) && (i < state.n_remoteaddr) ) + state.remoteaddrs[i].flags |= EMSI_FLAG_HN; + else if( ((i=nflgcmp(p, "HX")) >= 0) && (i < state.n_remoteaddr) ) + state.remoteaddrs[i].flags |= EMSI_FLAG_HX; + else if( ((i=nflgcmp(p, "HF")) >= 0) && (i < state.n_remoteaddr) ) + state.remoteaddrs[i].flags |= EMSI_FLAG_HF; + else if( ((i=nflgcmp(p, "HR")) >= 0) && (i < state.n_remoteaddr) ) + state.remoteaddrs[i].flags |= EMSI_FLAG_HR; } /* compatibility codes */ @@ -670,14 +670,14 @@ void emsi_logdat(s_emsi *emsi) if( emsi->have_emsi ) { - if( emsi->anum ) + if( state.n_remoteaddr ) { - for( i = 0; i < emsi->anum; i++ ) + for( i = 0; i < state.n_remoteaddr; i++ ) { - if( emsi->addrs[i].busy ) - log(" Address : %s (Busy)", ftn_addrstr(abuf, emsi->addrs[i].addr)); + if( state.remoteaddrs[i].busy ) + log(" Address : %s (Busy)", ftn_addrstr(abuf, state.remoteaddrs[i].addr)); else - log(" Address : %s", ftn_addrstr(abuf, emsi->addrs[i].addr)); + log(" Address : %s", ftn_addrstr(abuf, state.remoteaddrs[i].addr)); } } else diff --git a/source/bforce/prot_yoohoo.c b/source/bforce/prot_yoohoo.c index 6c76c00..d84e36a 100644 --- a/source/bforce/prot_yoohoo.c +++ b/source/bforce/prot_yoohoo.c @@ -64,35 +64,35 @@ static int yoohoo_getword(const char *buf) * Return value: * None */ -static void yoohoo_put_hello(char *buffer, s_yoohoo_sysinfo *hello) +static void yoohoo_put_hello(char *buffer, s_yoohoo_sysinfo *myhello) { char *p, *q; - ASSERT(buffer && hello); + ASSERT(buffer && myhello); memset(buffer, '\0', YOOHOO_HELLOLEN); p = buffer; p = yoohoo_putword(p, 0x6f); p = yoohoo_putword(p, 0x01); /* Hello version */ - p = yoohoo_putword(p, hello->product_code); /* Product code */ - p = yoohoo_putword(p, hello->version_maj); /* Major version */ - p = yoohoo_putword(p, hello->version_min); /* Minor version */ + p = yoohoo_putword(p, myhello->product_code); /* Product code */ + p = yoohoo_putword(p, myhello->version_maj); /* Major version */ + p = yoohoo_putword(p, myhello->version_min); /* Minor version */ - strnxcpy(p, hello->system, 60); /* Node name */ + strnxcpy(p, myhello->system, 60); /* Node name */ /* * Add domain after the end of 'Node name' * TODO: check it for buffer overflows %-I */ - if( hello->anum > 0 && hello->addrs[0].addr.domain - && *hello->addrs[0].addr.domain ) + if( state.n_localaddr > 0 && state.localaddrs[0].addr.domain + && *state.localaddrs[0].addr.domain ) { char *q; - if( strlen(hello->system) + strlen(hello->addrs[0].addr.domain) > 57 ) + if( strlen(myhello->system) + strlen(state.localaddrs[0].addr.domain) > 57 ) { - if( strlen(hello->addrs[0].addr.domain) < 60 ) - q = p + (60 - strlen(hello->addrs[0].addr.domain)); + if( strlen(state.localaddrs[0].addr.domain) < 60 ) + q = p + (60 - strlen(state.localaddrs[0].addr.domain)); else q = p; @@ -100,29 +100,29 @@ static void yoohoo_put_hello(char *buffer, s_yoohoo_sysinfo *hello) } else { - q = p + strlen(hello->system) + 1; + q = p + strlen(myhello->system) + 1; } - strnxcpy(q, hello->addrs[0].addr.domain, 60-(q-p)); + strnxcpy(q, state.localaddrs[0].addr.domain, 60-(q-p)); } p += 60; - strnxcpy(p, hello->sysop, 20); /* SysOp name */ + strnxcpy(p, myhello->sysop, 20); /* SysOp name */ p += 20; - if( hello->anum > 0 ) + if( state.n_localaddr > 0 ) { - p = yoohoo_putword(p, hello->addrs[0].addr.zone); - p = yoohoo_putword(p, hello->addrs[0].addr.net); - p = yoohoo_putword(p, hello->addrs[0].addr.node); - p = yoohoo_putword(p, hello->addrs[0].addr.point); + p = yoohoo_putword(p, state.localaddrs[0].addr.zone); + p = yoohoo_putword(p, state.localaddrs[0].addr.net); + p = yoohoo_putword(p, state.localaddrs[0].addr.node); + p = yoohoo_putword(p, state.localaddrs[0].addr.point); } else p += 8; - strncpy(p, hello->passwd, 8); /* Session password */ + strncpy(p, myhello->passwd, 8); /* Session password */ p += 8; p += 8; /* Reserved 8 bytes */ - p = yoohoo_putword(p, hello->capabilities); /* Capabilities */ + p = yoohoo_putword(p, myhello->capabilities); /* Capabilities */ p += 12; /* Reserved 12 bytes */ #ifdef DEBUG @@ -145,11 +145,11 @@ static void yoohoo_put_hello(char *buffer, s_yoohoo_sysinfo *hello) * Return value: * None */ -static int yoohoo_get_hello(s_yoohoo_sysinfo *hello, const char *buffer) +static int yoohoo_get_hello(s_yoohoo_sysinfo *remhello, const char *buffer) { s_faddr addr; - ASSERT(buffer && hello); + ASSERT(buffer && remhello); #ifdef DEBUG { @@ -159,16 +159,16 @@ static int yoohoo_get_hello(s_yoohoo_sysinfo *hello, const char *buffer) } #endif - memset(hello, '\0', sizeof(s_yoohoo_sysinfo)); + memset(remhello, '\0', sizeof(s_yoohoo_sysinfo)); if( yoohoo_getword(buffer+2) != 0x01 ) log("YooHoo hello version is %d!", yoohoo_getword(buffer+2)); - hello->product_code = yoohoo_getword(buffer+4); - hello->version_maj = yoohoo_getword(buffer+6); - hello->version_min = yoohoo_getword(buffer+8); - strnxcpy(hello->system, buffer+10, MIN(sizeof(hello->system),60+1)); - strnxcpy(hello->sysop, buffer+70, MIN(sizeof(hello->sysop),20+1)); + remhello->product_code = yoohoo_getword(buffer+4); + remhello->version_maj = yoohoo_getword(buffer+6); + remhello->version_min = yoohoo_getword(buffer+8); + strnxcpy(remhello->system, buffer+10, MIN(sizeof(remhello->system),60+1)); + strnxcpy(remhello->sysop, buffer+70, MIN(sizeof(remhello->sysop),20+1)); /* * Extract address @@ -178,11 +178,11 @@ static int yoohoo_get_hello(s_yoohoo_sysinfo *hello, const char *buffer) addr.net = yoohoo_getword(buffer+92); addr.node = yoohoo_getword(buffer+94); addr.point = yoohoo_getword(buffer+96); - session_addrs_add(&hello->addrs, &hello->anum, addr); + session_addrs_add(&state.remoteaddrs, &state.n_remoteaddr, addr); - strnxcpy(hello->passwd, buffer+98, MIN(sizeof(hello->passwd),8+1)); + strnxcpy(remhello->passwd, buffer+98, MIN(sizeof(remhello->passwd),8+1)); /* Reserved 8 bytes */ - hello->capabilities = yoohoo_getword(buffer+114); + remhello->capabilities = yoohoo_getword(buffer+114); /* Reserved 12 bytes */ return 0; @@ -466,11 +466,11 @@ void yoohoo_set_sysinfo(s_yoohoo_sysinfo *local_data, int hrc, * Set our local address */ if( primary ) - session_addrs_add(&local_data->addrs, &local_data->anum, *primary); + session_addrs_add(&state.localaddrs, &state.n_localaddr, *primary); else if( (addr_ptr = conf_first(cf_address)) ) - session_addrs_add(&local_data->addrs, &local_data->anum, addr_ptr->d.falist.addr); + session_addrs_add(&state.localaddrs, &state.n_localaddr, addr_ptr->d.falist.addr); - if( !local_data->anum ) + if( !state.n_localaddr ) log("warning: no addresses will be presented to remote"); /* @@ -557,35 +557,35 @@ void yoohoo_set_sysinfo(s_yoohoo_sysinfo *local_data, int hrc, * Return value: * None */ -void yoohoo_log_sysinfo(s_yoohoo_sysinfo *yoohoo) +void yoohoo_log_sysinfo(s_yoohoo_sysinfo *remyoohoo) { int i; char abuf[BF_MAXADDRSTR+1]; - if( yoohoo->anum ) - for( i = 0; i < yoohoo->anum; i++ ) + if( state.n_remoteaddr ) + for( i = 0; i < state.n_remoteaddr; i++ ) { - log(" Address : %s", ftn_addrstr(abuf, yoohoo->addrs[i].addr)); + log(" Address : %s", ftn_addrstr(abuf, state.remoteaddrs[i].addr)); } else log(" Address : "); - if( yoohoo->system[0] ) - log(" System : %s", string_printable(yoohoo->system)); + if( remyoohoo->system[0] ) + log(" System : %s", string_printable(remyoohoo->system)); #ifdef BFORCE_LOG_PASSWD - if( yoohoo->passwd[0] ) - log(" Password : %s", string_printable(yoohoo->passwd)); + if( remyoohoo->passwd[0] ) + log(" Password : %s", string_printable(remyoohoo->passwd)); #endif - if( yoohoo->sysop[0] ) - log(" SysOp : %s", string_printable(yoohoo->sysop)); + if( remyoohoo->sysop[0] ) + log(" SysOp : %s", string_printable(remyoohoo->sysop)); - if( yoohoo->product_code || yoohoo->version_maj || yoohoo->version_min ) + if( remyoohoo->product_code || remyoohoo->version_maj || remyoohoo->version_min ) { log(" Mailer : %s [%02x] %d.%d", - "?", yoohoo->product_code, - yoohoo->version_maj, yoohoo->version_min); + "?", remyoohoo->product_code, + remyoohoo->version_maj, remyoohoo->version_min); } } diff --git a/source/bforce/prot_yoohoo_api.c b/source/bforce/prot_yoohoo_api.c index cff6357..49526b9 100644 --- a/source/bforce/prot_yoohoo_api.c +++ b/source/bforce/prot_yoohoo_api.c @@ -24,7 +24,7 @@ void yoohoo_init(s_handshake_protocol *THIS); void yoohoo_deinit(s_handshake_protocol *THIS); int yoohoo_incoming(s_handshake_protocol *THIS); int yoohoo_outgoing(s_handshake_protocol *THIS); -s_faddr *yoohoo_remote_address(s_handshake_protocol *THIS); +//s_faddr *yoohoo_remote_address(s_handshake_protocol *THIS); char *yoohoo_remote_password(s_handshake_protocol *THIS); char *yoohoo_remote_sysop_name(s_handshake_protocol *THIS); char *yoohoo_remote_system_name(s_handshake_protocol *THIS); @@ -32,7 +32,7 @@ char *yoohoo_remote_location(s_handshake_protocol *THIS); char *yoohoo_remote_phone(s_handshake_protocol *THIS); char *yoohoo_remote_flags(s_handshake_protocol *THIS); char *yoohoo_remote_mailer(s_handshake_protocol *THIS); -s_faddr *yoohoo_local_address(s_handshake_protocol *THIS); +//s_faddr *yoohoo_local_address(s_handshake_protocol *THIS); char *yoohoo_local_password(s_handshake_protocol *THIS); s_handshake_protocol handshake_protocol_yoohoo = { @@ -48,7 +48,7 @@ s_handshake_protocol handshake_protocol_yoohoo = { yoohoo_incoming, yoohoo_outgoing, /* Section 2 */ - yoohoo_remote_address, +// yoohoo_remote_address, yoohoo_remote_password, yoohoo_remote_sysop_name, yoohoo_remote_system_name, @@ -58,7 +58,7 @@ s_handshake_protocol handshake_protocol_yoohoo = { NULL, NULL, /* Section 3 */ - yoohoo_local_address, +// yoohoo_local_address, yoohoo_local_password }; @@ -113,7 +113,7 @@ int yoohoo_incoming(s_handshake_protocol *THIS) /* * Check password(s) */ - if( session_addrs_check(remote_data->addrs, remote_data->anum, + if( session_addrs_check(state.remoteaddrs, state.n_remoteaddr, remote_data->passwd, NULL, 0) ) { rc = HRC_BAD_PASSWD; @@ -123,8 +123,8 @@ int yoohoo_incoming(s_handshake_protocol *THIS) else { /* Lock (create BSY) remote addresses */ - if( session_addrs_lock(remote_data->addrs, - remote_data->anum) ) + if( session_addrs_lock(state.remoteaddrs, + state.n_remoteaddr) ) { log("all remote addresses are busy"); rc = HRC_BUSY; @@ -135,7 +135,7 @@ int yoohoo_incoming(s_handshake_protocol *THIS) * Fill state.node with a first valid * address, try to lookup it in nodelist */ - session_remote_lookup(remote_data->addrs, remote_data->anum); + session_remote_lookup(state.remoteaddrs, state.n_remoteaddr); if( session_check_speed() ) rc = HRC_LOW_SPEED; @@ -180,7 +180,7 @@ int yoohoo_incoming(s_handshake_protocol *THIS) /* * Create mail/files queue */ - session_create_files_queue(remote_data->addrs, remote_data->anum); + session_create_files_queue(state.remoteaddrs, state.n_remoteaddr); /* * Set FREQ processor status @@ -238,23 +238,23 @@ int yoohoo_outgoing(s_handshake_protocol *THIS) /* * Make sure expected address was presented */ - if( session_addrs_check_genuine(remote_data->addrs, - remote_data->anum, + if( session_addrs_check_genuine(state.remoteaddrs, + state.n_remoteaddr, state.node.addr) ) return HRC_NO_ADDRESS; /* * Check password(s) */ - if( session_addrs_check(remote_data->addrs, remote_data->anum, + if( session_addrs_check(state.remoteaddrs, state.n_remoteaddr, remote_data->passwd, NULL, 0) ) return HRC_BAD_PASSWD; /* * Lock (create BSY) remote addresses */ - (void)session_addrs_lock(remote_data->addrs, - remote_data->anum); + (void)session_addrs_lock(state.remoteaddrs, + state.n_remoteaddr); /* * Set protocol we will use ("options" ignored) @@ -289,13 +289,12 @@ int yoohoo_outgoing(s_handshake_protocol *THIS) /* * Create mail/files queue */ - session_create_files_queue(remote_data->addrs, - remote_data->anum); + session_create_files_queue(state.remoteaddrs, state.n_remoteaddr); return HRC_OK; } -s_faddr *yoohoo_remote_address(s_handshake_protocol *THIS) +/*s_faddr *yoohoo_remote_address(s_handshake_protocol *THIS) { ASSERT(THIS); ASSERT(THIS->remote_data); @@ -304,7 +303,7 @@ s_faddr *yoohoo_remote_address(s_handshake_protocol *THIS) return &((s_yoohoo_sysinfo *)THIS->remote_data)->addrs[0].addr; return NULL; -} +} */ char *yoohoo_remote_password(s_handshake_protocol *THIS) { @@ -339,7 +338,7 @@ char *yoohoo_remote_system_name(s_handshake_protocol *THIS) return NULL; } -s_faddr *yoohoo_local_address(s_handshake_protocol *THIS) +/*s_faddr *yoohoo_local_address(s_handshake_protocol *THIS) { ASSERT(THIS); ASSERT(THIS->local_data); @@ -348,7 +347,7 @@ s_faddr *yoohoo_local_address(s_handshake_protocol *THIS) return &((s_yoohoo_sysinfo *)THIS->local_data)->addrs[0].addr; return NULL; -} +} */ char *yoohoo_local_password(s_handshake_protocol *THIS) { diff --git a/source/bforce/prot_zmsend.c b/source/bforce/prot_zmsend.c index 1874303..1c9ffd9 100644 --- a/source/bforce/prot_zmsend.c +++ b/source/bforce/prot_zmsend.c @@ -58,7 +58,7 @@ static void zmodem_add_empty_packet(s_protinfo *pi) memset(&pkt, '\0', sizeof(s_packet)); pkt.dest = state.node.addr; - pkt.orig = *state.handshake->remote_address(state.handshake); + if (session_1remote_address()) pkt.orig = *session_1remote_address(); if( pkt_createpacket(p_tmpname, &pkt) ) { diff --git a/source/bforce/sess_common.c b/source/bforce/sess_common.c index 0fd32f1..956401c 100644 --- a/source/bforce/sess_common.c +++ b/source/bforce/sess_common.c @@ -52,8 +52,7 @@ int session_run_command(const char *execstr) if( state.handshake ) { - if( state.handshake->remote_address - && (addr = state.handshake->remote_address(state.handshake)) ) + if( addr = session_1remote_address() ) { exec_env_add(&eopts, "REM_ADDR_FTN", ftn_addrstr_fido(abuf, *addr)); @@ -61,8 +60,7 @@ int session_run_command(const char *execstr) ftn_addrstr_inet(abuf, *addr)); } - if( state.handshake->local_address - && (addr = state.handshake->local_address(state.handshake)) ) + if( addr = session_1local_address() ) { exec_env_add(&eopts, "LOC_ADDR_FTN", ftn_addrstr_fido(abuf, *addr)); @@ -166,27 +164,38 @@ void init_state(s_state *pstate) void deinit_state(s_state *pstate) { - if( pstate->linename ) - free(pstate->linename); - if( pstate->cidstr ) - free(pstate->cidstr); - if( pstate->peername ) - free(pstate->peername); - if( pstate->connstr ) - free(pstate->connstr); - if( pstate->inbound ) - free(pstate->inbound); - if( pstate->tinbound ) - free(pstate->tinbound); - if( pstate->mailfor ) - deinit_falist(pstate->mailfor); - + if (pstate->linename) free(pstate->linename); + if (pstate->cidstr) free(pstate->cidstr); + if (pstate->peername) free(pstate->peername); + if (pstate->connstr) free(pstate->connstr); + if (pstate->inbound) free(pstate->inbound); + if (pstate->tinbound) free(pstate->tinbound); + if (pstate->mailfor) deinit_falist(pstate->mailfor); + deinit_fsqueue(&pstate->queue); - if( state.handshake && state.handshake->deinit ) + if (state.handshake && state.handshake->deinit) { state.handshake->deinit(state.handshake); + } + + if (pstate->remoteaddrs) free (pstate->remoteaddrs); + if (pstate->localaddrs) free (pstate->localaddrs); memset(pstate, '\0', sizeof(s_state)); pstate->session_rc = -1; } + +s_faddr *session_1remote_address() +{ + if (state.n_remoteaddr > 0) return &state.remoteaddrs[0].addr; + + return NULL; +} + +s_faddr *session_1local_address() +{ + if (state.n_localaddr > 0) return &state.localaddrs[0].addr; + + return NULL; +} diff --git a/source/include/prot_binkp.h b/source/include/prot_binkp.h index ad124e0..985d2a2 100644 --- a/source/include/prot_binkp.h +++ b/source/include/prot_binkp.h @@ -65,8 +65,8 @@ typedef enum binkp_mode { typedef struct { - s_sysaddr *addrs; - int anum; +// s_sysaddr *addrs; +// int anum; char passwd[BINKP_MAXPASSWD+1]; char systname[BINKP_MAXSYSTNAME+1]; char location[BINKP_MAXLOCATION+1]; diff --git a/source/include/prot_emsi.h b/source/include/prot_emsi.h index 5a7a07f..7e8c688 100644 --- a/source/include/prot_emsi.h +++ b/source/include/prot_emsi.h @@ -143,8 +143,8 @@ struct emsi * {EMSI_DAT} (main handshake information) */ bool have_emsi; - s_sysaddr *addrs; /* dynamicaly allocated array */ - int anum; /* number of used entries in it */ +// s_sysaddr *addrs; /* dynamicaly allocated array */ +// int anum; /* number of used entries in it */ char passwd[EMSI_MAXPASSWD+1]; s_linkcodes linkcodes; /* XXn linkcodes contained in eaddr */ s_compcodes compcodes; diff --git a/source/include/prot_yoohoo.h b/source/include/prot_yoohoo.h index f798983..dbf9842 100644 --- a/source/include/prot_yoohoo.h +++ b/source/include/prot_yoohoo.h @@ -22,8 +22,8 @@ */ typedef struct { - s_sysaddr *addrs; /* FTN address */ - int anum; +// s_sysaddr *addrs; /* FTN address */ +// int anum; int product_code; /* product code */ int version_maj; /* major revision of the product */ int version_min; /* minor revision of the product */ diff --git a/source/include/session.h b/source/include/session.h index f1ed013..649c143 100644 --- a/source/include/session.h +++ b/source/include/session.h @@ -20,6 +20,14 @@ #include "io.h" #include "nodelist.h" #include "outbound.h" + +typedef struct sysaddr { + s_faddr addr; + bool busy; + bool good; + int flags; +} s_sysaddr; + #include "prot_common.h" #ifdef NETSPOOL @@ -62,13 +70,6 @@ typedef enum reqstat { #define HRC_TEMP_ERR 7 /* Any other temporary handshake error */ #define HRC_OTHER_ERR 8 /* Any other error (e.g. timeout, NO CARRIER) */ -typedef struct sysaddr { - s_faddr addr; - bool busy; - bool good; - int flags; -} s_sysaddr; - typedef struct { char passwd[128]; char challenge[128]; @@ -109,7 +110,7 @@ typedef struct handshake_protocol /* * 2. Remote system information extract methods */ - s_faddr* (*remote_address)(struct handshake_protocol *THIS); +// s_faddr* (*remote_address)(struct handshake_protocol *THIS); char* (*remote_password)(struct handshake_protocol *THIS); char* (*remote_sysop_name)(struct handshake_protocol *THIS); char* (*remote_system_name)(struct handshake_protocol *THIS); @@ -122,7 +123,7 @@ typedef struct handshake_protocol /* * 3. Local system information extract methods */ - s_faddr* (*local_address)(struct handshake_protocol *THIS); +// s_faddr* (*local_address)(struct handshake_protocol *THIS); char* (*local_password)(struct handshake_protocol *THIS); } s_handshake_protocol; @@ -162,6 +163,10 @@ const s_modemport *modemport; #ifdef NETSPOOL s_netspool_state netspool; #endif + s_sysaddr *remoteaddrs; + int n_remoteaddr; + s_sysaddr *localaddrs; + int n_localaddr; }; typedef struct state s_state; @@ -187,7 +192,8 @@ int session_init_outgoing(); int session_init_incoming(); /* s_main.c */ -extern s_state state; +extern s_state state; // IF YOU WANT MAKE THIS PROGRAM MULTITHREAD, MAKE THIS VARIBLE LOCAL TO THE THREADS AND PASS IT TO SUBROUTINES +// YOU SHOULD ADD IT TO ALL FUNCTIONS: IT IS MANY OF HANDWORK BUT EASY TO DO s_faddr *session_get_bestaka(s_faddr addr); int session_addrs_lock(s_sysaddr *addrs, int anum); @@ -213,6 +219,9 @@ void session_traffic(void); void session_update_history(s_traffic *send, s_traffic *recv, int rc); int session(void); +s_faddr* session_1remote_address(); +s_faddr* session_1local_address(); + /* sess_call.c */ int call_system(s_faddr addr, const s_bforce_opts *opts); int call_system_modem(void); From 6eac20718a728b48dd99de660ba2f40ea027bea0 Mon Sep 17 00:00:00 2001 From: Sergey Dorofeev Date: Thu, 23 Feb 2012 21:51:03 +0400 Subject: [PATCH 18/29] debug zedzap --- source/bforce/prot_zmsend.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/source/bforce/prot_zmsend.c b/source/bforce/prot_zmsend.c index 1c9ffd9..9a9a5a6 100644 --- a/source/bforce/prot_zmsend.c +++ b/source/bforce/prot_zmsend.c @@ -210,10 +210,10 @@ int tx_zmodem(s_protinfo *pi, bool caller) case ZTX_NEXTFILE: DEB((D_PROT, "tx_zmodem: entering state ZTX_NEXTFILE")); - if( pi->send && pi->send->fp ) - p_tx_fclose(pi); + if (pi->send) p_tx_fclose(pi); txtries = 0; txstate = p_tx_fopen(pi, NULL) ? ZTX_FIN : ZTX_FINFO; + log("nextfile next state: %d", txstate); break; case ZTX_FINFO: @@ -556,7 +556,7 @@ int tx_zmodem(s_protinfo *pi, bool caller) case ZFIN: /* BUG!BUG!BUG!BUG!BUG!BUG!BUG!BUG!BUG! */ /* BUG!BUG!BUG!BUG!BUG!BUG!BUG!BUG!BUG! */ - /* BUG!BUG!BUG!BUG!BUG!BUG!BUG!BUG!BUG! */ + log(" BUG!BUG!BUG!BUG!BUG!BUG!BUG!BUG!BUG! "); if( txstate == ZTX_FINACK ) { if( PUTSTR("OO") == 0 ) @@ -590,7 +590,7 @@ int tx_zmodem(s_protinfo *pi, bool caller) /* Check pos */ if( (Z_Rxpos || txstate != ZTX_FINFOACK) - && fseek(pi->send->fp, Z_Rxpos, 0) ) + && p_tx_rewind(pi, Z_Rxpos) ) { logerr("can't send file from requested position"); /* Open next file for send */ @@ -641,7 +641,7 @@ int tx_zmodem(s_protinfo *pi, bool caller) case ZCRC: if( txstate == ZTX_FINFOACK ) { - /* Send file's CRC-32 */ + log(" Send file's CRC-32 "); crc32 = 0xFFFFFFFFL; while( ((c = getc(pi->send->fp)) != EOF) && --Z_Rxpos ) @@ -717,8 +717,7 @@ exit: setalarm(0); - if( pi->send && pi->send->fp ) - p_tx_fclose(pi); + if (pi->send) p_tx_fclose(pi); if( txbuf ) free(txbuf); From 096f382eaa869457f200bf2a21ed825ea96efb35 Mon Sep 17 00:00:00 2001 From: Sergey Dorofeev Date: Thu, 23 Feb 2012 23:14:33 +0400 Subject: [PATCH 19/29] Added support for FIDO DNS zone --- source/bforce/conf_proc.c | 1 + source/bforce/sess_call.c | 15 +++++++++++++++ source/include/confread.h | 1 + 3 files changed, 17 insertions(+) diff --git a/source/bforce/conf_proc.c b/source/bforce/conf_proc.c index 85ab298..1b224ad 100644 --- a/source/bforce/conf_proc.c +++ b/source/bforce/conf_proc.c @@ -180,6 +180,7 @@ s_conf_entry bforce_config[BFORCE_NUMBER_OF_KEYWORDS+1] = { CONF_KEY(netspool_host, CT_STRING), CONF_KEY(netspool_port, CT_STRING), #endif + CONF_KEY(fidodnszone, CT_STRING), CONF_END() }; diff --git a/source/bforce/sess_call.c b/source/bforce/sess_call.c index ebfec47..a5b5a35 100644 --- a/source/bforce/sess_call.c +++ b/source/bforce/sess_call.c @@ -758,6 +758,21 @@ int call_system(s_faddr addr, const s_bforce_opts *opts) state.override.sIpaddr, sizeof(state.node.host)); } + if( call_mayuse & CALL_TCPIP_ANY && !tcpip_isgood_host(state.node.host) ) { + char *fidodnszone = conf_string(cf_fidodnszone); + if (fidodnszone) { + if (addr.point) { + snprintf(state.node.host, BNI_MAXHOST, "p%d.f%d.n%d.z%d.%s", + addr.point, addr.node, addr.net, addr.zone, fidodnszone); + } + else { + snprintf(state.node.host, BNI_MAXHOST, "f%d.n%d.z%d.%s", + addr.node, addr.net, addr.zone, fidodnszone); + } + log("use fido DNS zone: %s", state.node.host); + } + } + if( call_mayuse & CALL_TCPIP_ANY && !tcpip_isgood_host(state.node.host) ) { call_mayuse &= ~CALL_TCPIP_ANY; diff --git a/source/include/confread.h b/source/include/confread.h index 547d89c..797ddb0 100644 --- a/source/include/confread.h +++ b/source/include/confread.h @@ -275,6 +275,7 @@ typedef enum { cf_netspool_host, cf_netspool_port, #endif + cf_fidodnszone, BFORCE_NUMBER_OF_KEYWORDS } bforce_config_keyword; From fde43cf87c5df052bab04e890cbee91062f17159 Mon Sep 17 00:00:00 2001 From: Sergey Dorofeev Date: Fri, 24 Feb 2012 22:24:56 +0400 Subject: [PATCH 20/29] segfault fix --- source/bforce/prot_binkp_api.c | 12 +++++++++--- source/bforce/prot_common.c | 23 +++++++++++++++++++---- source/bforce/prot_zmsend.c | 5 ++++- source/bforce/sess_common.c | 2 ++ 4 files changed, 34 insertions(+), 8 deletions(-) diff --git a/source/bforce/prot_binkp_api.c b/source/bforce/prot_binkp_api.c index ec3f765..25232ec 100644 --- a/source/bforce/prot_binkp_api.c +++ b/source/bforce/prot_binkp_api.c @@ -78,21 +78,27 @@ void binkp_init(s_handshake_protocol *THIS) void binkp_deinit(s_handshake_protocol *THIS) { - ASSERT(THIS); - ASSERT(THIS->remote_data); - ASSERT(THIS->local_data); + log("binkp_deinit"); + if (THIS==NULL) { + log("THIS==NULL"); + return; + } if( THIS->remote_data ) { memset(THIS->remote_data, '\0', sizeof(s_binkp_sysinfo)); free(THIS->remote_data); + THIS->remote_data = NULL; } if( THIS->local_data ) { memset(THIS->local_data, '\0', sizeof(s_binkp_sysinfo)); free(THIS->local_data); + THIS->local_data = NULL; } + log("binkp_deinit end"); + } int binkp_incoming2(s_handshake_protocol *THIS) diff --git a/source/bforce/prot_common.c b/source/bforce/prot_common.c index f854e21..8c0988a 100644 --- a/source/bforce/prot_common.c +++ b/source/bforce/prot_common.c @@ -349,7 +349,7 @@ get_next_file: if( !ptrl ) { /* send file received through netspool */ pi->send->fp = 0; - pi->send->local_name = "NETSPOOL"; + pi->send->local_name = (char*)xstrcpy("NETSPOOL"); pi->send->type = out_filetype(state.netspool.filename); pi->send->net_name = recode_file_out(p_convfilename(state.netspool.filename, pi->send->type)); pi->send->fname = NULL; @@ -749,7 +749,9 @@ static int p_move2inbound(s_protinfo *pi) { log("recv: cannot get unique name for \"%s\"", pi->recv->local_name); + log("free realname"); free(realname); + log("freed"); return 1; } @@ -796,10 +798,16 @@ static int p_move2inbound(s_protinfo *pi) destname); } - if( realname ) + if( realname ) { + log("free realname"); free(realname); - if( uniqname ) + log("freed"); + } + if( uniqname ) { + log("free uniqname"); free(uniqname); + log("freed"); + } return rc ? 1 : 0; } @@ -984,8 +992,9 @@ int p_rx_fopen(s_protinfo *pi, char *fn, size_t sz, time_t tm, mode_t mode) pi->recv->status = FSTAT_SKIPPED; } } - + log("free fname"); free(fname); fname = NULL; + log("freed"); if( pi->recv->status == FSTAT_SKIPPED ) return 2; @@ -1013,8 +1022,10 @@ int p_rx_fopen(s_protinfo *pi, char *fn, size_t sz, time_t tm, mode_t mode) else pi->recv->status = FSTAT_REFUSED; + log("free pi->recv->fname"); free(pi->recv->fname); pi->recv->fname = NULL; + log("freed"); return pi->recv->status == FSTAT_SKIPPED ? 2 : 1; } @@ -1636,6 +1647,7 @@ char *prot_unique_name(char *dirname, char *fname, int type) */ void deinit_finfo(s_finfo *fi) { + log("deinit_finfo"); if( fi->fp ) fclose(fi->fp); @@ -1647,6 +1659,7 @@ void deinit_finfo(s_finfo *fi) free(fi->fname); memset(fi, '\0', sizeof(s_finfo)); + log("deinit_finfo end"); } /***************************************************************************** @@ -1764,6 +1777,7 @@ void init_protinfo(s_protinfo *pi, bool caller) void deinit_protinfo(s_protinfo *pi) { int i; + log("deinit_protinfo"); for( i = 0; i < pi->n_sentfiles; i++ ) deinit_finfo(&pi->sentfiles[i]); @@ -1779,4 +1793,5 @@ void deinit_protinfo(s_protinfo *pi) free(pi->rcvdfiles); memset(pi, '\0', sizeof(s_protinfo)); + log("deinit_protinfo end"); } diff --git a/source/bforce/prot_zmsend.c b/source/bforce/prot_zmsend.c index 9a9a5a6..714b896 100644 --- a/source/bforce/prot_zmsend.c +++ b/source/bforce/prot_zmsend.c @@ -719,8 +719,11 @@ exit: if (pi->send) p_tx_fclose(pi); - if( txbuf ) + if( txbuf ) { free(txbuf); + txbuf = NULL; + } + return(rc); } diff --git a/source/bforce/sess_common.c b/source/bforce/sess_common.c index 956401c..e3c235a 100644 --- a/source/bforce/sess_common.c +++ b/source/bforce/sess_common.c @@ -164,6 +164,7 @@ void init_state(s_state *pstate) void deinit_state(s_state *pstate) { + log("deinit_state begin"); if (pstate->linename) free(pstate->linename); if (pstate->cidstr) free(pstate->cidstr); if (pstate->peername) free(pstate->peername); @@ -184,6 +185,7 @@ void deinit_state(s_state *pstate) memset(pstate, '\0', sizeof(s_state)); pstate->session_rc = -1; + log("deinit_state end"); } s_faddr *session_1remote_address() From 0b7bbf4b48293c301bd6da9548f87fae274ba226 Mon Sep 17 00:00:00 2001 From: Sergey Dorofeev Date: Sun, 26 Feb 2012 08:43:04 +0400 Subject: [PATCH 21/29] - --- CHANGES.fidoman | 3 +-- source/bforce/prot_binkp.c | 1 + 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGES.fidoman b/CHANGES.fidoman index ef27328..35143e2 100644 --- a/CHANGES.fidoman +++ b/CHANGES.fidoman @@ -1,8 +1,7 @@ === 2012-02 === Netspool support -Netspool forcibly disables NR mode in binkp -(due to NR mode requires access to file on local filesystem) +24554 protocol remake === 2011-12-25 === diff --git a/source/bforce/prot_binkp.c b/source/bforce/prot_binkp.c index fd89f28..e5685c0 100644 --- a/source/bforce/prot_binkp.c +++ b/source/bforce/prot_binkp.c @@ -2,6 +2,7 @@ * binkleyforce -- unix FTN mailer project * * Copyright (c) 1998-2000 Alexander Belkin, 2:5020/1398.11 + * Copyright (c) 2012 Sergey Dorofeev, 2:5020/12000 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by From 96619efc96a6e9e0cc5f5de260e6b1be3c263601 Mon Sep 17 00:00:00 2001 From: Sergey Dorofeev Date: Wed, 29 Feb 2012 21:38:43 +0400 Subject: [PATCH 22/29] slash checking in binkp --- source/bforce/prot_binkp_misc.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/source/bforce/prot_binkp_misc.c b/source/bforce/prot_binkp_misc.c index 9bc77bc..1d2b19c 100644 --- a/source/bforce/prot_binkp_misc.c +++ b/source/bforce/prot_binkp_misc.c @@ -39,12 +39,23 @@ int binkp_parsfinfo(const char *str, s_bpfinfo *fi, bool with_offset) { int r; + char *chkslash; if( strlen(str)>PATH_MAX ) { log("too long string, overflow may occur"); return -1; } log("info to parse: %s", str); r = sscanf(str, with_offset? "%s %d %d %d": "%s %d %d", &fi->fn, &fi->sz, &fi->tm, &fi->offs); + chkslash = fi->fn; + while (1) { + chkslash = strchr(chkslash, '/'); + if (chkslash) { + *chkslash = '_'; + } + else { + break; + } + } if (r==(with_offset? 4: 3)) { return 0; } From 1c2f44fc3faf8c531fd4c7396ca263396e5dcdbd Mon Sep 17 00:00:00 2001 From: Sergey Dorofeev Date: Fri, 9 Mar 2012 15:13:11 +0400 Subject: [PATCH 23/29] reporting all receive errors to remote --- source/bforce/prot_binkp.c | 97 +++++++++++++++----------------------- 1 file changed, 39 insertions(+), 58 deletions(-) diff --git a/source/bforce/prot_binkp.c b/source/bforce/prot_binkp.c index e5685c0..87cf186 100644 --- a/source/bforce/prot_binkp.c +++ b/source/bforce/prot_binkp.c @@ -614,26 +614,26 @@ case 4: } +#define PROTO_ERROR(msg) log("error: %s", msg); bstate->extracmd[0] = BPMSG_ERR; strcpy(bstate->extracmd+1, msg); bstate->extraislast = true; return -1; + int binkp_doreceiveblock(s_binkp_state *bstate, char *buf, int block_type, unsigned short block_length) { switch (block_type) { case BINKP_BLK_CMD: if (block_length<1) { - log("zero length command received"); - return -1; + PROTO_ERROR("Zero length command received") } buf[block_length] = 0; // fencing for easy processing switch (buf[0]) { case BPMSG_NUL: /* Site information, just logging */ - log("M_NUL"); + log("received M_NUL len=%d", block_length); binkp_process_NUL(bstate->remote_data, buf+1); return 1; case BPMSG_ADR: /* List of addresses */ - log("M_ADR"); + log("received M_ADR len=%d", block_length); if (bstate->address_established) { - log("remote tries to change address"); - return -1; + PROTO_ERROR("remote tries to change address"); } if( bstate->extracmd[0] !=-1 ) return 0; // suspend !!! binkp_process_ADR(buf+1); @@ -692,14 +692,12 @@ case BPMSG_ADR: /* List of addresses */ bstate->address_established = true; return 1; case BPMSG_PWD: /* Session password */ - log("M_PWD received"); + log("received M_PWD len=%d", block_length); if (bstate->mode != bmode_incoming_handshake) { - log("unexpected M_PWD"); - return -1; + PROTO_ERROR("unexpected M_PWD"); } if (!bstate->address_established) { - log("M_PWD before M_ADR"); - return -1; + PROTO_ERROR("M_PWD before M_ADR"); } strnxcpy(bstate->remote_data->passwd, buf+1, block_length); @@ -732,20 +730,18 @@ case BPMSG_PWD: /* Session password */ break; case BPMSG_FILE: /* File information */ - log("M_FILE"); + log("received M_FILE len=%d", block_length); if (bstate->mode != bmode_transfer) { - log("unexpected M_FILE"); - return -1; + PROTO_ERROR("unexpected M_FILE"); } s_bpfinfo recvfi; if( binkp_parsfinfo(buf+1, &recvfi, true) ) { log ("M_FILE parse error: %s", buf + 1); - return -1; + PROTO_ERROR("invalid M_FILE"); } bstate->batch_recv_count += 1; if (bstate->frs == frs_data) { - log("overlapping M_FILE received"); - return -1; + PROTO_ERROR("overlapping M_FILE received"); } if (bstate->frs == frs_didget) { @@ -766,7 +762,7 @@ case BPMSG_FILE: /* File information */ if (bstate->frs!=frs_nothing && bstate->frs!=frs_skipping) { log("strange receiving mode %d", bstate->frs); - return -1; + PROTO_ERROR("invalid mode for M_FILE"); } if( bstate->extracmd[0] != -1 ) return 0; @@ -804,17 +800,14 @@ case 2: bstate->frs = frs_skipping; return 1; default: - log("p_rx_fopen_error"); - return -1; + PROTO_ERROR("p_rx_fopen_error"); } - log("never get here"); - return -1; + PROTO_ERROR("never should get here"); case BPMSG_OK: /* Password was acknowleged (data ignored) */ - log("M_OK received"); + log("received M_OK len=%d", block_length); if (bstate->mode != bmode_outgoing_handshake) { - log("unexpected M_OK"); - return -1; + PROTO_ERROR("unexpected M_OK"); } if (session_addrs_lock(state.remoteaddrs, state.n_remoteaddr)) { log("error: unable to lock"); @@ -829,33 +822,29 @@ case BPMSG_OK: /* Password was acknowleged (data ignored) */ return 2; case BPMSG_EOB: /* End Of Batch (data ignored) */ - log("M_EOB received"); + log("received M_EOB len=%d", block_length); if (bstate->mode != bmode_transfer) { - log("unexpected M_EOB"); - return -1; + PROTO_ERROR("unexpected M_EOB"); } bstate->batchreceivecomplete += 1; return 1; // continue receiving as M_GOT may and would arrive case BPMSG_GOT: /* File received */ case BPMSG_SKIP: - log("received GOT/SKIP"); + log("received GOT/SKIP len=%d", block_length); if (bstate->mode != bmode_transfer) { - log("unexpected M_GOT/M_SKIP"); - return -1; + PROTO_ERROR("unexpected M_GOT/M_SKIP"); } s_bpfinfo fi; int i; if (binkp_parsfinfo (buf+1, &fi, false)) { - log("error parsing"); - return -1; + PROTO_ERROR("error parsing M_GOT/M_SKIP"); } if (strcmp (bstate->pi->send->net_name, fi.fn) == 0 && bstate->pi->send->status != FSTAT_WAITACK) { log("aborting current file"); if (bstate->pi->send->netspool) { - log("cannot abort netspool in progress"); - return -1; + PROTO_ERROR("cannot SKIP or REFUSE netspool"); } p_tx_fclose(bstate->pi); bstate->phase = 0; @@ -867,8 +856,7 @@ case BPMSG_SKIP: bstate->pi->send = &bstate->pi->sentfiles[i]; if (buf[0] == BPMSG_SKIP) { if (bstate->pi->send->netspool) { - log("cannot skip netspool"); - return -1; // no reason to continue sending + PROTO_ERROR("cannot skip netspool"); } log("skipped %s", fi.fn); bstate->pi->send->status = FSTAT_REFUSED; @@ -879,8 +867,7 @@ case BPMSG_SKIP: } else { log("confirmed not sent file - skipped %s", fi.fn); if (bstate->pi->send->netspool) { - log("cannot skip netspool"); - return -1; // no reason to continue sending + PROTO_ERROR("cannot skip netspool"); } bstate->pi->send->status = FSTAT_SKIPPED; } @@ -891,8 +878,7 @@ case BPMSG_SKIP: goto check_that_all_files_are_confirmed; } } - log("unmatched file name"); - return -1; + PROTO_ERROR("unmatched file name in M_GOT/M_SKIP"); check_that_all_files_are_confirmed: { @@ -917,15 +903,14 @@ case BPMSG_BSY: /* All AKAs are busy */ return 3; case BPMSG_GET: /* Get a file from offset */ - log("received M_GET: cancel transmitting current file and send requested file if it is in outbound"); + log("received M_GET len=%d", block_length); if (bstate->mode != bmode_transfer) { - log("unexpected M_GET"); - return -1; + PROTO_ERROR("unexpected M_GET"); } s_bpfinfo getfi; if (binkp_parsfinfo(buf+1, &getfi, true) != 0) { log("error parsing M_GET %s", buf+1); - return -1; + PROTO_ERROR("invalid M_GET"); } log("M_GET file %s size %d time %d offset %d", getfi.fn, getfi.sz, getfi.tm, getfi.offs); @@ -959,7 +944,7 @@ case BPMSG_GET: /* Get a file from offset */ if( p_tx_rewind(bstate->pi, getfi.offs) != 0 ) { log("failed to rewind"); p_tx_fclose(bstate->pi); - return -1; + PROTO_ERROR("seek error") } bstate->pi->send->bytes_skipped = getfi.offs; bstate->pi->send->bytes_sent = getfi.offs; @@ -982,13 +967,12 @@ case BPMSG_GET: /* Get a file from offset */ hint.sz = getfi.sz; hint.tm = getfi.tm; if( p_tx_fopen(bstate->pi, &hint) != 0 ) { - log("could not satisfy M_GET"); - return -1; + PROTO_ERROR("could not satisfy M_GET"); } if( p_tx_rewind(bstate->pi, getfi.offs) != 0 ) { log("failed to rewind"); p_tx_fclose(bstate->pi); - return -1; + PROTO_ERROR("seek error 2"); } bstate->waiting_got = true; log("sending \"%s\" from %ld offset", bstate->pi->send->net_name, (long)getfi.offs); @@ -1003,7 +987,7 @@ case BPMSG_GET: /* Get a file from offset */ return 1; } log("unknown command %d received", buf[0]); - return -1; + PROTO_ERROR("invalid command") case BINKP_BLK_DATA: //if there is file in progress @@ -1013,8 +997,7 @@ case BINKP_BLK_DATA: return 1; } if (bstate->frs == frs_nothing) { - log("unexpected data block"); - return -1; + PROTO_ERROR("unexpected data block"); } if (bstate->frs == frs_didget || bstate->frs == frs_skipping) { log("did M_GET or M_GOT or M_SKIP, skipping data"); @@ -1027,7 +1010,7 @@ case BINKP_BLK_DATA: n = p_rx_writefile(buf, block_length, bstate->pi); if( n < 0 ) { - log("error writing file"); + log("error writing local file"); if( n == -2 ) { bstate->extracmd[0] = BPMSG_GOT; sprintf(bstate->extracmd+1, "%s %ld %ld", bstate->pi->recv->net_name, (long)bstate->pi->recv->bytes_total, @@ -1055,7 +1038,7 @@ case BINKP_BLK_DATA: bstate->frs = frs_skipping; bstate->pi->recv->status = FSTAT_REFUSED; p_rx_fclose(bstate->pi); - return -1; + PROTO_ERROR("extra data for file") } else if( bstate->pi->recv->bytes_received == bstate->pi->recv->bytes_total ) { log("receive completed"); @@ -1083,11 +1066,9 @@ case BINKP_BLK_DATA: return 1; } } - log("never should be here"); - return -1; + PROTO_ERROR("never should be here"); default: - log("impossible block_type"); - return -1; + PROTO_ERROR("impossible block_type"); } } From f2d9c6e4a7348a181344489d217227b3fc3b0cfd Mon Sep 17 00:00:00 2001 From: Sergey Dorofeev Date: Fri, 9 Mar 2012 15:26:43 +0400 Subject: [PATCH 24/29] binkp_loop return codes --- source/bforce/prot_binkp.c | 31 +++++++++++++++++-------------- source/include/prot_common.h | 12 ++++++------ 2 files changed, 23 insertions(+), 20 deletions(-) diff --git a/source/bforce/prot_binkp.c b/source/bforce/prot_binkp.c index 87cf186..4992b70 100644 --- a/source/bforce/prot_binkp.c +++ b/source/bforce/prot_binkp.c @@ -57,6 +57,7 @@ typedef struct { e_file_receive_status frs; int emptyloop; bool continuesend; + int rc; } s_binkp_state; int binkp_getforsend(s_binkp_state *bstate, char *buf, int *block_type, unsigned short *block_length); @@ -68,8 +69,7 @@ int binkp_loop(s_binkp_state *bstate) { unsigned char readbuf[BINKP_HEADER+BINKP_MAXBLOCK+1]; unsigned char writebuf[BINKP_HEADER+BINKP_MAXBLOCK+1]; - int rc = HRC_OK; - + bstate->rc = PRC_NOERROR; bstate->phase = 0; bstate->subphase = 0; bstate->extracmd[0] = -1; @@ -133,7 +133,7 @@ int binkp_loop(s_binkp_state *bstate) { writebuf[0] = (block_length>>8)&0x7f; } else { log("block for sending has invalid type, aborting"); - return -1; + return PRC_ERROR; } writebuf[1] = block_length&0xff; } @@ -146,7 +146,7 @@ int binkp_loop(s_binkp_state *bstate) { } if (m<0 || m>3) { log("getforsend error"); - return -1; + return PRC_ERROR; } } @@ -182,13 +182,13 @@ int binkp_loop(s_binkp_state *bstate) { n = tty_select(want_read?&canread:NULL, have_to_write?&canwrite:NULL, timeout); if( n<0 ) { log("binkp error on tty_select"); - return -1; + return PRC_ERROR; } } else { log("empty loop %d", ++bstate->emptyloop); if (bstate->emptyloop==10) { - return -1; + return PRC_ERROR; } } @@ -196,11 +196,11 @@ int binkp_loop(s_binkp_state *bstate) { n = tty_read(readbuf+read_pos, want_read); if( n<0 ) { log("binkp: tty read error"); - return -1; + return PRC_ERROR; } else if (n==0) { log("read: remote socket shutdown"); - return -1; + return PRC_REMOTEABORTED; } want_read -= n; read_pos += n; @@ -234,11 +234,11 @@ int binkp_loop(s_binkp_state *bstate) { else if (m==3) { log("aborting session"); bstate->complete = true; - rc = HRC_OTHER_ERR; + //rc = HRC_OTHER_ERR; } else { log("doreceiveblock error"); - return -1; + return PRC_ERROR; } } @@ -247,18 +247,18 @@ int binkp_loop(s_binkp_state *bstate) { n = tty_write(writebuf+write_pos, have_to_write); if( n<0 ) { log("binkp: tty write error"); - return -1; + return PRC_ERROR; } else if (n==0) { log("write: remote socket shutdown"); - return -1; + return PRC_REMOTEABORTED; } //log("%d bytes sent", n); write_pos += n; have_to_write -= n; } } - return rc; + return bstate->rc; } int binkp_outgoing(s_binkp_sysinfo *local_data, s_binkp_sysinfo *remote_data) @@ -614,7 +614,8 @@ case 4: } -#define PROTO_ERROR(msg) log("error: %s", msg); bstate->extracmd[0] = BPMSG_ERR; strcpy(bstate->extracmd+1, msg); bstate->extraislast = true; return -1; +#define PROTO_ERROR(msg) { log("error: %s", msg); bstate->rc = PRC_LOCALABORTED; \ +bstate->extracmd[0] = BPMSG_ERR; strcpy(bstate->extracmd+1, msg); bstate->extraislast = true; return 1; } int binkp_doreceiveblock(s_binkp_state *bstate, char *buf, int block_type, unsigned short block_length) @@ -897,9 +898,11 @@ check_that_all_files_are_confirmed: case BPMSG_ERR: /* Misc errors */ log("remote error: %s", buf+1); + bstate->rc = PRC_REMOTEABORTED; return 3; case BPMSG_BSY: /* All AKAs are busy */ log("remote busy: %s", buf+1); + bstate->rc = PRC_REMOTEABORTED; return 3; case BPMSG_GET: /* Get a file from offset */ diff --git a/source/include/prot_common.h b/source/include/prot_common.h index 462fceb..d5967fc 100644 --- a/source/include/prot_common.h +++ b/source/include/prot_common.h @@ -17,12 +17,12 @@ #include "outbound.h" /* File transfer protocols return codes */ -#define PRC_NOERROR 0 /* No comments :) */ -#define PRC_ERROR 1 /* I/O error occured while snd./rcv. */ -#define PRC_REMOTEABORTED 2 /* "ABORT" initiated by remote */ -#define PRC_LOCALABORTED 3 /* We got SIGINT/SIGTERM? */ -#define PRC_CPSTOOLOW 4 /* Cps was so low.. :( */ -#define PRC_STOPTIME 5 /* Aborted due to the time limits */ +#define PRC_NOERROR 0 /* Successful session */ +#define PRC_ERROR 20 /* I/O error occured while snd./rcv. */ +#define PRC_REMOTEABORTED 21 /* "ABORT" initiated by remote */ +#define PRC_LOCALABORTED 22 /* We got SIGINT/SIGTERM? */ +#define PRC_CPSTOOLOW 23 /* Cps was so low.. :( */ +#define PRC_STOPTIME 24 /* Aborted due to the time limits */ /* Send/Recv file status values */ #define FSTAT_PROCESS 1 From 441f4021c21442585be7e819e6bac68e71a417e6 Mon Sep 17 00:00:00 2001 From: Sergey Dorofeev Date: Fri, 9 Mar 2012 20:44:43 +0400 Subject: [PATCH 25/29] logging, binkp TRF --- CHANGES.fidoman | 6 + examples/bforce.conf | 21 +--- source/.version | 2 +- source/Makefile.in | 2 + source/bforce/TODO_netspool | 8 -- source/bforce/bforce.c | 15 +-- source/bforce/conf_proc.c | 22 ++-- source/bforce/conf_read.c | 26 ++++- source/bforce/daemon.c | 4 - source/bforce/logger.c | 78 ++++++------- source/bforce/prot_binkp.c | 193 +++++++++++++++++--------------- source/bforce/prot_binkp_api.c | 22 +++- source/bforce/prot_binkp_misc.c | 2 +- source/bforce/prot_common.c | 101 +++++++++-------- source/bforce/sess_answ.c | 4 - source/bforce/sess_call.c | 12 -- source/bforce/sess_common.c | 4 +- source/bforce/sess_main.c | 4 +- source/bforce/u_plock.c | 6 + source/configure | 48 ++++---- source/configure.in | 2 +- source/include/bforce.h | 19 ---- source/include/confread.h | 2 +- source/include/logger.h | 15 ++- source/include/prot_binkp.h | 4 + source/openwrt-conf | 6 +- 26 files changed, 320 insertions(+), 308 deletions(-) delete mode 100644 source/bforce/TODO_netspool diff --git a/CHANGES.fidoman b/CHANGES.fidoman index 35143e2..e8d148d 100644 --- a/CHANGES.fidoman +++ b/CHANGES.fidoman @@ -1,3 +1,9 @@ +=== 2012-03 === + +$DEBUGLEVEL, $DEBUGFILE removed - please use configuration options + +DNS zone support + === 2012-02 === Netspool support diff --git a/examples/bforce.conf b/examples/bforce.conf index c890b86..adee3cc 100644 --- a/examples/bforce.conf +++ b/examples/bforce.conf @@ -24,9 +24,6 @@ ## Config reader directives: ## ## $INCLUDE Include this file -## $LOGFILE Log to this file -## $DEBUGFILE Write debug information to this file -## $DEBUGLEVEL Change debug level ## ## $IFEXP All data between ``$IFEXP'' and ``$ENDIF'' ## directives will be used with the specified @@ -35,8 +32,6 @@ ## ## Examples: ## -## $DEBUGLEVEL Outbound hShake -## ## $IFEXP ((2:*/*.* | !protected) & Time 23:00-01:00) ## options NoFreqs ## min_speed_in 14400 @@ -81,7 +76,13 @@ options NoDirZap NoJanus NoChat # #log_file_daemon /var/log/bforce/bf-daemon #log_file /var/log/bforce/bf-log + +# Debugging information completness level. Debugging is disabled by +# default. Allowed debug levels: config, nodelist, outbound, info, hshake, +# ttyio, modem, prot, freq, daemon, full + #debug_file /var/log/bforce/bf-debug +#debug_level info hshake prot # # Existing of this file forbid any outgoing modem calls. Existing of @@ -90,16 +91,6 @@ options NoDirZap NoJanus NoChat # nodial_flag /etc/nodial -# -# Debugging information completness level. Debugging is disabled by -# default. Allowed debug levels: config, nodelist, outbound, info, hshake, -# ttyio, modem, prot, freq, daemon, full -# -# It seems to be broken now, use "$DEBUGLEVEL" instead -# -#debug_level info hshake prot -# - # # Inbound directories # diff --git a/source/.version b/source/.version index 6b9f278..fd137eb 100644 --- a/source/.version +++ b/source/.version @@ -1 +1 @@ -0.22.9 +0.24 diff --git a/source/Makefile.in b/source/Makefile.in index d24b630..0cdcb90 100644 --- a/source/Makefile.in +++ b/source/Makefile.in @@ -31,11 +31,13 @@ SPOOLDIR = @SPOOLDIR@ DAEMON_LOGFILE = $(LOGDIR)/bf-daemon BFORCE_LOGFILE = $(LOGDIR)/bf-log BFORCE_DEBFILE = $(LOGDIR)/bf-debug +BFORCE_DEBLEVEL = 0L BFORCE_CFGFILE = $(CONFDIR)/bforce.conf DEFINES = -DDAEMON_LOGFILE=\"$(DAEMON_LOGFILE)\" \ -DBFORCE_LOGFILE=\"$(BFORCE_LOGFILE)\" \ -DBFORCE_DEBFILE=\"$(BFORCE_DEBFILE)\" \ + -DBFORCE_DEBLEVEL=$(BFORCE_DEBLEVEL) \ -DBFORCE_CFGFILE=\"$(BFORCE_CFGFILE)\" \ -DBF_OS=\"@build_os@\" @DEFS@ diff --git a/source/bforce/TODO_netspool b/source/bforce/TODO_netspool deleted file mode 100644 index 01ad5bb..0000000 --- a/source/bforce/TODO_netspool +++ /dev/null @@ -1,8 +0,0 @@ -tx_zmodem -rx_zmodem -hydra -binkp_transfer - - - all of then do use p_tx_readfile - \ No newline at end of file diff --git a/source/bforce/bforce.c b/source/bforce/bforce.c index 57b0642..9440c85 100644 --- a/source/bforce/bforce.c +++ b/source/bforce/bforce.c @@ -422,13 +422,13 @@ int main(int argc, char *argv[], char *envp[]) } } } - -/* if( (rc = log_open(log_getfilename(LOG_FILE_SESSION), NULL, NULL)) ) + +/* if( (rc = log_open(BFORCE_LOGFILE, NULL, NULL)) ) //compiled in { log("can't continue without logging"); gotoexit(BFERR_FATALERROR); - } -*/ + }*/ + /* Process primary config file */ if( opts.confname && *opts.confname ) rc = conf_readconf(opts.confname, 0); @@ -442,17 +442,12 @@ int main(int argc, char *argv[], char *envp[]) (void)conf_readconf(opts.incname, 1); /* Reopen log file if it was defined in config */ - if( log_open(log_getfilename(LOG_FILE_SESSION), NULL, NULL) ) + if( log_reopen(log_getfilename(LOG_FILE_SESSION), NULL, NULL) ) { log("can't continue without logging"); gotoexit(BFERR_FATALERROR); } -#ifdef DEBUG - /* Same for the debug file */ - (void)debug_setfilename(log_getfilename(LOG_FILE_DEBUG)); -#endif - //char runmode_str[21]; //snprintf(runmode_str, 20, "Run mode: %d", opts.runmode); //log(runmode_str); diff --git a/source/bforce/conf_proc.c b/source/bforce/conf_proc.c index 1b224ad..624c4df 100644 --- a/source/bforce/conf_proc.c +++ b/source/bforce/conf_proc.c @@ -173,7 +173,7 @@ s_conf_entry bforce_config[BFORCE_NUMBER_OF_KEYWORDS+1] = { #endif #ifdef DEBUG CONF_KEY(debug_file, CT_STRING), - CONF_KEY(debug_level, CT_DEBLEVEL), + CONF_KEY(debug_level, CT_STRING), #endif CONF_KEY(split_inbound, CT_BOOLEAN), #ifdef NETSPOOL @@ -201,9 +201,9 @@ static int proc_dialresp(s_dialresp *dest, char *value); static int proc_translate(s_translate *dest, char *value); static int proc_speeddep(s_connlist *dest, char *value); static int proc_tries(s_tries *dest, char *value); -#ifdef DEBUG -static int proc_debuglevel(s_number *dest, char *value); -#endif +//#ifdef DEBUG +//static int proc_debuglevel(s_number *dest, char *value); move to reader +//#endif static int proc_filebox(s_filebox *dest, char *value); static int append_config_entry(s_conf_entry *conf_ent, s_cval_entry *cval_entry) @@ -292,11 +292,11 @@ int proc_configline(const char *k, const char *e, const char *v) case CT_TRIES: rc = proc_tries(&temp_value.d.tries, copy); break; -#ifdef DEBUG - case CT_DEBLEVEL: - rc = proc_debuglevel(&temp_value.d.number, copy); - break; -#endif +//#ifdef DEBUG +// case CT_DEBLEVEL: +// rc = proc_debuglevel(&temp_value.d.number, copy); +// break; +//#endif case CT_FILEBOX: rc = proc_filebox(&temp_value.d.filebox, copy); break; @@ -933,7 +933,7 @@ static int proc_tries(s_tries *dest, char *value) * Line format: DebugLevel [].. */ #ifdef DEBUG -static int proc_debuglevel(s_number *dest, char *value) +/*static int proc_debuglevel(s_number *dest, char *value) { int rc = PROC_RC_OK; long deblevel = 0L; @@ -945,7 +945,7 @@ static int proc_debuglevel(s_number *dest, char *value) dest->num = deblevel; return(rc); -} +} */ #endif /* diff --git a/source/bforce/conf_read.c b/source/bforce/conf_read.c index 2b4c349..0332864 100644 --- a/source/bforce/conf_read.c +++ b/source/bforce/conf_read.c @@ -32,10 +32,10 @@ const char *conf_getconfname(void) return(name); } -int conf_readpasswdlist(s_falist **pwdlist, char *fname) +/*int conf_readpasswdlist(s_falist **pwdlist, char *fname) { return(0); -} +} */ /* * Prepare config string for parsing, check for comments @@ -131,6 +131,7 @@ static void conf_parsestr(char *str, char **key, char **expr, char **value) int conf_readconf(const char *confname, int inclevel) { +// printf("%s %d\n", confname, inclevel); FILE *fp = NULL; char tmp[BF_MAXCFGLINE + 1]; int rc, maxrc = 0; @@ -300,7 +301,7 @@ int conf_readconf(const char *confname, int inclevel) isifexpr = FALSE; } } - else if( strcasecmp(p_key+1, "logfile") == 0 ) +/* else if( strcasecmp(p_key+1, "logfile") == 0 ) { if( value == NULL || expr ) { @@ -359,7 +360,7 @@ int conf_readconf(const char *confname, int inclevel) rc = PROC_RC_IGNORE; } #endif - } + }*/ else { log("unknown directive `%s'", p_key); @@ -426,11 +427,24 @@ int conf_readconf(const char *confname, int inclevel) DEB((D_CONFIG, "readconfig: exit with maxrc = %d", maxrc)); + /* update subsystems */ + if (inclevel==0) { // end of main config + if( log_reopen(log_getfilename(LOG_FILE_SESSION), NULL, NULL) ) + { + log("can't continue without logging"); + exit(-1); + } +#ifdef DEBUG + debug_configure(); + +#endif + } + return maxrc; } #ifdef DEBUG -void debug_override(void) +/*void debug_override(void) { s_cval_entry *ptrl; char abuf[BF_MAXADDRSTR+1]; @@ -452,6 +466,6 @@ void debug_override(void) } DEB((D_CONFIG, "debug_override: END")); -} +}*/ #endif /* DEBUG */ diff --git a/source/bforce/daemon.c b/source/bforce/daemon.c index bdd45d4..0b0c5f0 100644 --- a/source/bforce/daemon.c +++ b/source/bforce/daemon.c @@ -914,10 +914,6 @@ int daemon_run(const char *confname, const char *incname, bool quit) return BFERR_FATALERROR; } -#ifdef DEBUG - (void)debug_setfilename(log_getfilename(LOG_FILE_DEBUG)); -#endif - log("%sstarting daemon (%s)", started ? "re" : "", BF_VERSION); diff --git a/source/bforce/logger.c b/source/bforce/logger.c index fcd3300..16ba5f2 100644 --- a/source/bforce/logger.c +++ b/source/bforce/logger.c @@ -32,7 +32,7 @@ static char log_ttyname[32] = ""; * Local variables needed to make debug work */ static FILE *debug_fp = NULL; -static long debug_current_debuglevel = 0L; +static long debug_current_debuglevel = BFORCE_DEBLEVEL; static char debug_name[BF_MAXPATH+1] = BFORCE_DEBFILE; static bool debug_invalid_name = FALSE; @@ -56,6 +56,9 @@ struct debuglevel { { "Freq", D_FREQ }, { "Statem", D_STATEM }, { "Daemon", D_DAEMON }, + { "Free", D_FREE }, + { "24554", D_24554 }, +// { "Daemon", D_DAEMON }, { "Full", D_FULL }, { NULL, 0 } }; @@ -385,28 +388,16 @@ int logerr(const char *s, ...) #ifdef DEBUG -void debug_setlevel(long newlevel, bool logit) -{ - if( logit && newlevel != debug_current_debuglevel ) - { - log("changing debug level from 0x%07x to 0x%07x", - debug_current_debuglevel, newlevel); - debug_current_debuglevel = newlevel; - } -} - -bool debug_isopened(void) -{ - return debug_fp ? TRUE : FALSE; -} - -int debug_parsestring(char *str, unsigned long *deblevel) +int _debug_parsestring(char *str, unsigned long *deblevel) { int i, rc = 0; char *n; char *p_str = NULL; - ASSERT(str != NULL); + if (str==NULL) { + puts("DEBUG level string is empty, please configure"); + exit(-1); + } *deblevel = 0L; @@ -427,40 +418,49 @@ int debug_parsestring(char *str, unsigned long *deblevel) rc = 1; } } - return rc; + return rc; } -void debug_setfilename(const char *debugname) +void debug_configure() // this function should be called after configuration is settled { - ASSERT(debugname != NULL); - - if( !strcmp(debug_name, debugname) ) return; + char *debugfile = conf_string(cf_debug_file); + char *debuglevel = conf_string(cf_debug_level); + unsigned long n_debuglevel; + + if (debugfile!=NULL) { + if( strcmp(debug_name, debugfile)!=0 ) { - if( debug_isopened() ) debug_close(); + if( debug_isopened() ) debug_close(); /* Reset ignore flag */ - if( debug_invalid_name ) + if( debug_invalid_name ) debug_invalid_name = FALSE; - strnxcpy(debug_name, debugname, sizeof(debug_name)); + strncpy(debug_name, debugfile, sizeof(debug_name)); + } + } + + _debug_parsestring(debuglevel, &n_debuglevel); + + if( n_debuglevel != debug_current_debuglevel ) { + log("changing debug level from 0x%08x to 0x%08x", + debug_current_debuglevel, n_debuglevel); + debug_current_debuglevel = n_debuglevel; + } +} + +bool debug_isopened(void) +{ + return debug_fp ? TRUE : FALSE; } -int debug_open(const char *debugname) +int debug_open() { char buf[40]; ASSERT(debug_fp == NULL); - if( debugname ) - { - if( (debug_fp = fopen(debugname, "a")) == NULL ) - { - logerr("can't open debug file \"%s\"", debugname); - return -1; - } - strnxcpy(debug_name, debugname, sizeof(debug_name)); - } - else if( debug_name ) + if( debug_name ) { if( (debug_fp = fopen(debug_name, "a")) == NULL ) { @@ -502,7 +502,7 @@ int debug_close(void) rc = fclose(debug_fp) ? 0 : -1; debug_fp = NULL; } - return rc; + return rc; } int debug(unsigned long what, const char *str, ...) @@ -515,7 +515,7 @@ int debug(unsigned long what, const char *str, ...) { if( debug_fp == NULL && debug_invalid_name == FALSE ) { - debug_open(NULL); + debug_open(); } if( debug_fp ) diff --git a/source/bforce/prot_binkp.c b/source/bforce/prot_binkp.c index 4992b70..ade03ea 100644 --- a/source/bforce/prot_binkp.c +++ b/source/bforce/prot_binkp.c @@ -115,7 +115,8 @@ int binkp_loop(s_binkp_state *bstate) { // session criterium handshake criterium while (!bstate->complete || bstate->waiting_got) { - log("loop s: %d r: %d", bstate->batchsendcomplete, bstate->batchreceivecomplete); + DEB((D_24554, "loop s: %d r: %d p: %d sp: %d", bstate->batchsendcomplete, bstate->batchreceivecomplete, + bstate->phase, bstate->subphase)); if (bstate->continuesend) { no_more_to_send = false; bstate->continuesend = false; @@ -123,7 +124,7 @@ int binkp_loop(s_binkp_state *bstate) { if (have_to_write==0 && (!no_more_to_send || bstate->extracmd[0]!=-1)) { m = binkp_getforsend(bstate, writebuf+BINKP_HEADER, &block_type, &block_length); if(m==1 || m==3) { - //log("got block for sending %d %hu", block_type, block_length); + //DEB((D_24554, "got block for sending %d %hu", block_type, block_length)); write_pos = 0; have_to_write = block_length+BINKP_HEADER; if( block_type == BINKP_BLK_CMD ) { @@ -132,28 +133,28 @@ int binkp_loop(s_binkp_state *bstate) { else if( block_type == BINKP_BLK_DATA ) { writebuf[0] = (block_length>>8)&0x7f; } else { - log("block for sending has invalid type, aborting"); + DEB((D_24554, "block for sending has invalid type, aborting")); return PRC_ERROR; } writebuf[1] = block_length&0xff; } if (m==2 || m==3) { - log("no more to send"); + DEB((D_24554, "no more to send")); no_more_to_send = true; } if (m==0) { - log("binkp: nothing to write"); + DEB((D_24554, "binkp: nothing to write")); } if (m<0 || m>3) { - log("getforsend error"); + DEB((D_24554, "getforsend error")); return PRC_ERROR; } } if (bstate->batchsendcomplete && bstate->batchreceivecomplete) { - log("batch is complete"); + DEB((D_24554, "batch is complete")); if (bstate->MB && (bstate->batch_send_count || bstate->batch_recv_count)) { - log("starting one more batch"); + DEB((D_24554, "starting one more batch")); bstate->batchsendcomplete -= 1; bstate->batchreceivecomplete -= 1; //bstate->firstbatch = false; @@ -167,17 +168,17 @@ int binkp_loop(s_binkp_state *bstate) { } else { if (bstate->waiting_got) { - log("waiting for all files have being confirmed"); + DEB((D_24554, "waiting for all files have being confirmed")); } else { - log("finishing session"); + DEB((D_24554, "finishing session")); bstate->complete = true; want_read = 0; } } } - log("select read: %d write %d", want_read, have_to_write); + DEB((D_24554, "select read: %d write: %d", want_read, have_to_write)); if (want_read || have_to_write) { n = tty_select(want_read?&canread:NULL, have_to_write?&canwrite:NULL, timeout); if( n<0 ) { @@ -186,8 +187,9 @@ int binkp_loop(s_binkp_state *bstate) { } } else { - log("empty loop %d", ++bstate->emptyloop); + DEB((D_24554, "empty loop %d", ++bstate->emptyloop)); if (bstate->emptyloop==10) { + log("eternal loop"); return PRC_ERROR; } } @@ -202,13 +204,14 @@ int binkp_loop(s_binkp_state *bstate) { log("read: remote socket shutdown"); return PRC_REMOTEABORTED; } + DEB((D_24554, "got %d bytes", n)); want_read -= n; read_pos += n; if (read_pos == BINKP_HEADER) { // have read header, want read body - log("it should be 0: %d", want_read); + DEB((D_24554, "it should be 0: %d", want_read)); want_read = ((unsigned short)(readbuf[0]&0x7F)<<8) | readbuf[1]; - log("pending block, length %u", want_read); + DEB((D_24554, "got block header, block length %u", want_read)); } // no else here: if want_read may be zero here for zero length block } @@ -216,23 +219,23 @@ int binkp_loop(s_binkp_state *bstate) { if (want_read==0 && read_pos) { // check every loop, not only just after read as accepting may be deferred block_type = readbuf[0]&0x80? BINKP_BLK_CMD: BINKP_BLK_DATA; block_length = read_pos - BINKP_HEADER; - log("binkp: complete block is received %d %hu", block_type, block_length); + DEB((D_24554, "binkp: complete block is received %d %hu", block_type, block_length)); m = binkp_doreceiveblock(bstate, readbuf+BINKP_HEADER, block_type, block_length); if(m==1) { - log("block is successfully accepted"); + DEB((D_24554, "block is successfully accepted")); read_pos = 0; want_read = BINKP_HEADER; } else if (m==2) { - log("block accepted and no more is needed in this mode"); + DEB((D_24554, "block accepted and no more is needed in this mode")); no_more_read = true; read_pos = 0; want_read = 0; //BINKP_HEADER; } else if (m==0) { - log("binkp: keeping buffer"); + DEB((D_24554, "binkp: keeping buffer")); } else if (m==3) { - log("aborting session"); + DEB((D_24554, "aborting session")); bstate->complete = true; //rc = HRC_OTHER_ERR; } @@ -243,7 +246,7 @@ int binkp_loop(s_binkp_state *bstate) { } if (have_to_write && canwrite) { - log("writing %d pos %d", have_to_write, write_pos); + DEB((D_24554, "writing %d pos %d", have_to_write, write_pos)); n = tty_write(writebuf+write_pos, have_to_write); if( n<0 ) { log("binkp: tty write error"); @@ -253,7 +256,7 @@ int binkp_loop(s_binkp_state *bstate) { log("write: remote socket shutdown"); return PRC_REMOTEABORTED; } - //log("%d bytes sent", n); + DEB((D_24554, "%d bytes sent", n)); write_pos += n; have_to_write -= n; } @@ -285,7 +288,7 @@ int binkp_incoming(s_binkp_sysinfo *local_data, s_binkp_sysinfo *remote_data) int binkp_transfer(s_binkp_sysinfo *local_data, s_binkp_sysinfo *remote_data, s_protinfo *pi) { - log("start transfer"); + DEB((D_24554, "start transfer")); s_binkp_state s; s.mode = bmode_transfer; s.local_data = local_data; @@ -325,7 +328,7 @@ int binkp_getforsend(s_binkp_state *bstate, char *buf, int *block_type, unsigned int my_sf, wr_pos; int n; // read file if (bstate->extracmd[0]!=-1) { - log("extra command from receiver %d %s", bstate->extracmd[0], bstate->extracmd+1); + DEB((D_24554, "send command from receiver %d %s", bstate->extracmd[0], bstate->extracmd+1)); buf[0] = bstate->extracmd[0]; strcpy(buf+1, bstate->extracmd+1); *block_type = BINKP_BLK_CMD; @@ -333,7 +336,7 @@ int binkp_getforsend(s_binkp_state *bstate, char *buf, int *block_type, unsigned bstate->extracmd[0] = -1; if (bstate->extraislast) { bstate->phase = 100; - log("extracmd is last"); + DEB((D_24554, "extracmd is last")); bstate->complete = true; } return 1; @@ -345,12 +348,12 @@ case 0: // MD5 challenge bstate->subphase=0; if( bstate->mode==bmode_incoming_handshake && bstate->local_data->challenge_length > 0 ) { - log("send challenge"); + DEB((D_24554, "send challenge")); char challenge[128]; string_bin_to_hex(challenge, bstate->local_data->challenge, bstate->local_data->challenge_length); buf[0] = BPMSG_NUL; sprintf(buf+1, "OPT CRAM-MD5-%s", challenge); - log("sent %s", buf+1); + DEB((D_24554, "send M_NUL %s", buf+1)); *block_type = BINKP_BLK_CMD; *block_length = strlen(buf+1)+1; return 1; @@ -390,6 +393,7 @@ case 6: *block_length = 1 + sprintf(buf+1, "VER %s %s/%d.%d", bstate->local_data->progname, bstate->local_data->protname, bstate->local_data->majorver, bstate->local_data->minorver); + DEB((D_24554, "send M_NUL %s", buf+1)); return 1; case 7: if (bstate->mode==bmode_outgoing_handshake) { @@ -402,6 +406,7 @@ case 7: // if (!nodelist_checkflag (state.node.flags, "ND")) // strcat(buf+1, " ND"); *block_length = 1 + strlen(buf+1); + DEB((D_24554, "send M_NUL %s", buf+1)); return 1; } // else skip subphase @@ -415,7 +420,7 @@ case 7: // p case 2: - log("send address"); + DEB((D_24554, "send address")); bstate->phase += 1; buf[0] = BPMSG_ADR; wr_pos = 1; @@ -438,29 +443,29 @@ case 2: } *block_type = BINKP_BLK_CMD; *block_length = wr_pos; - log("address: %s", buf+1); + DEB((D_24554, "send address: %s", buf+1)); return 1; case 3: // send password on outgoing or pw confirmation on incoming // special empty password is sent if there is no password for the remote addr if (bstate->mode==bmode_incoming_handshake) { if (bstate->password_received) { - log("password verified"); + DEB((D_24554, "password verified")); buf[0] = BPMSG_OK; *block_type = BINKP_BLK_CMD; *block_length = 1; bstate->phase += 1; return 1; } - log("waiting for password from remote"); + DEB((D_24554, "waiting for password from remote")); return 0; // nothing to send } else if (bstate->mode==bmode_outgoing_handshake) { if (!bstate->address_established) { - log("address not received still"); + DEB((D_24554, "address not received still")); return 0; } - log("sending password"); + DEB((D_24554, "sending password")); buf[0] = BPMSG_PWD; *block_type = BINKP_BLK_CMD; @@ -473,7 +478,7 @@ case 3: // send password on outgoing or pw confirmation on incoming char digest_hex[33]; if(bstate->remote_data->challenge_length==0) { - log("waiting for challenge"); + DEB((D_24554, "waiting for challenge")); return 0; } md5_cram_get(bstate->local_data->passwd, bstate->remote_data->challenge, @@ -498,11 +503,11 @@ case 3: // send password on outgoing or pw confirmation on incoming case 4: if (bstate->mode==bmode_incoming_handshake) { - log("incoming handshake is complete"); + DEB((D_24554, "incoming handshake is complete")); bstate->complete = true; } else { - log("outgoing handshake: everything is sent"); + DEB((D_24554, "outgoing handshake: everything is sent")); } return 2; } @@ -513,9 +518,9 @@ case 4: switch (bstate->phase) { send_next_file: case 0: - log("fetch file from queue"); + DEB((D_24554, "fetch file from queue")); if (p_tx_fopen(bstate->pi, NULL)) { - log("queue empty"); + DEB((D_24554, "queue empty")); bstate->phase = 4; goto send_EOB; } @@ -524,7 +529,7 @@ case 4: //send M_FILE -1 if (bstate->NR) { - log("send M_FILE with -1"); + DEB((D_24554, "send M_FILE with -1")); buf[0] = BPMSG_FILE; *block_length = 1+sprintf(buf+1, "%s %ld %ld -1", bstate->pi->send->net_name, (long)bstate->pi->send->bytes_total, (long)bstate->pi->send->mod_time); @@ -534,7 +539,7 @@ case 4: bstate->phase += 1; case 1: //send M_FILE - M_GET forcibly sets this phase. M_GET must open needed file - log("send M_FILE"); + DEB((D_24554, "send M_FILE")); buf[0] = BPMSG_FILE; *block_length = 1+sprintf(buf+1, "%s %ld %ld 0", bstate->pi->send->net_name, bstate->pi->send->bytes_total, bstate->pi->send->mod_time); @@ -554,7 +559,7 @@ case 4: log("p_tx_readfile error"); return -1; } - log("file is sent"); + DEB((D_24554, "file is sent")); bstate->pi->send->status = FSTAT_WAITACK; bstate->phase += 1; @@ -562,32 +567,32 @@ case 4: case 3: //wait for acknowlede if (bstate->pi->send->waitack) { - log("file must be acknowledged with M_GOT"); + DEB((D_24554, "file must be acknowledged with M_GOT")); int i; bool ack = false; for(i = 0; i < bstate->pi->n_sentfiles; i++ ) { if (p_compfinfo(&bstate->pi->sentfiles[i], bstate->pi->send->net_name, bstate->pi->send->bytes_total, bstate->pi->send->mod_time) == 0) { if (bstate->pi->sentfiles[i].status == FSTAT_SUCCESS) { ack = true; - log("acknowledged"); + DEB((D_24554, "acknowledged")); break; } } } if (!ack) { - log("wait for M_GOT"); + DEB((D_24554, "wait for M_GOT")); return 0; } - log("M_GOT received, going to next file"); + DEB((D_24554, "M_GOT received, going to next file")); } else { - log("do not wait M_GOT"); + DEB((D_24554, "do not wait M_GOT")); } bstate->phase = 0; goto send_next_file; send_EOB: case 4: - log("send EOB n_sentfile=%d", bstate->pi->n_sentfiles); + DEB((D_24554, "send EOB n_sentfile=%d", bstate->pi->n_sentfiles)); buf[0] = BPMSG_EOB; *block_type = BINKP_BLK_CMD; *block_length = 1; @@ -596,7 +601,7 @@ case 4: return 1; case 5: - log("nothing to send"); + DEB((D_24554, "nothing to send")); return 2; @@ -628,11 +633,12 @@ case BINKP_BLK_CMD: buf[block_length] = 0; // fencing for easy processing switch (buf[0]) { case BPMSG_NUL: /* Site information, just logging */ - log("received M_NUL len=%d", block_length); + DEB((D_24554, "received M_NUL len=%d", block_length)); + DEB((D_24554, "M_NUL %s", buf+1)); binkp_process_NUL(bstate->remote_data, buf+1); return 1; case BPMSG_ADR: /* List of addresses */ - log("received M_ADR len=%d", block_length); + DEB((D_24554, "received M_ADR len=%d", block_length)); if (bstate->address_established) { PROTO_ERROR("remote tries to change address"); } @@ -650,7 +656,7 @@ case BPMSG_ADR: /* List of addresses */ if (bstate->mode == bmode_incoming_handshake) { int i; - log("sending options"); + DEB((D_24554, "sending options")); bstate->extracmd[0] = BPMSG_NUL; bstate->extraislast = false; sprintf(bstate->extracmd+1,"OPT MB"); @@ -693,7 +699,7 @@ case BPMSG_ADR: /* List of addresses */ bstate->address_established = true; return 1; case BPMSG_PWD: /* Session password */ - log("received M_PWD len=%d", block_length); + DEB((D_24554, "received M_PWD len=%d", block_length)); if (bstate->mode != bmode_incoming_handshake) { PROTO_ERROR("unexpected M_PWD"); } @@ -724,14 +730,14 @@ case BPMSG_PWD: /* Session password */ return 1; } else { - log("flag password received"); + DEB((D_24554, "flag password received")); bstate->password_received = true; return 2; } break; case BPMSG_FILE: /* File information */ - log("received M_FILE len=%d", block_length); + DEB((D_24554, "received M_FILE len=%d", block_length)); if (bstate->mode != bmode_transfer) { PROTO_ERROR("unexpected M_FILE"); } @@ -746,14 +752,14 @@ case BPMSG_FILE: /* File information */ } if (bstate->frs == frs_didget) { - log("is it what we want?"); + DEB((D_24554, "is it what we want?")); if( bstate->pi->recv && p_compfinfo(bstate->pi->recv, recvfi.fn, recvfi.sz, recvfi.tm) == 0 && bstate->pi->recv->bytes_skipped == recvfi.offs && bstate->pi->recv->fp ) { log("resuming %s from offset %d", recvfi.fn, recvfi.offs); bstate->frs = frs_data; return 1; } - log("no, skipping (TODO: accept it)"); + DEB((D_24554, "no, skipping; TODO: accept it")); if( bstate->extracmd[0] != -1 ) return 0; bstate->extracmd[0] = BPMSG_SKIP; sprintf(bstate->extracmd+1, "%s %ld %ld %ld", recvfi.fn, recvfi.sz, recvfi.tm); @@ -762,7 +768,7 @@ case BPMSG_FILE: /* File information */ } if (bstate->frs!=frs_nothing && bstate->frs!=frs_skipping) { - log("strange receiving mode %d", bstate->frs); + DEB((D_24554, "strange receiving mode %d", bstate->frs)); PROTO_ERROR("invalid mode for M_FILE"); } @@ -774,7 +780,7 @@ case 0: bstate->frs = frs_data; return 1; } - log("making M_GET to skip downloaded part"); + DEB((D_24554, "making M_GET to skip downloaded part")); bstate->extracmd[0] = BPMSG_GET; sprintf(bstate->extracmd+1, "%s %ld %ld %ld", bstate->pi->recv->net_name, (long)bstate->pi->recv->bytes_total, @@ -784,7 +790,7 @@ case 0: bstate->frs = frs_didget; return 1; case 1: - log("SKIP (non-destructive)"); + DEB((D_24554, "SKIP, non-destructive")); bstate->extracmd[0] = BPMSG_SKIP; sprintf(bstate->extracmd+1, "%s %ld %ld", bstate->pi->recv->net_name, (long)bstate->pi->recv->bytes_total, (long)bstate->pi->recv->mod_time); @@ -792,7 +798,7 @@ case 1: bstate->frs = frs_skipping; return 1; case 2: - log("SKIP (destructive)"); + DEB((D_24554, "SKIP, destructive")); bstate->extracmd[0] = BPMSG_GOT; sprintf(bstate->extracmd+1, "%s %ld %ld", bstate->pi->recv->net_name, (long)bstate->pi->recv->bytes_total, @@ -806,7 +812,7 @@ default: PROTO_ERROR("never should get here"); case BPMSG_OK: /* Password was acknowleged (data ignored) */ - log("received M_OK len=%d", block_length); + DEB((D_24554, "received M_OK len=%d", block_length)); if (bstate->mode != bmode_outgoing_handshake) { PROTO_ERROR("unexpected M_OK"); } @@ -818,12 +824,12 @@ case BPMSG_OK: /* Password was acknowleged (data ignored) */ bstate->extraislast = true; return 2; } - log("outoing handshake successfully complete"); + DEB((D_24554, "outoing handshake successfully complete")); bstate->complete = true; return 2; case BPMSG_EOB: /* End Of Batch (data ignored) */ - log("received M_EOB len=%d", block_length); + DEB((D_24554, "received M_EOB len=%d", block_length)); if (bstate->mode != bmode_transfer) { PROTO_ERROR("unexpected M_EOB"); } @@ -832,7 +838,7 @@ case BPMSG_EOB: /* End Of Batch (data ignored) */ case BPMSG_GOT: /* File received */ case BPMSG_SKIP: - log("received GOT/SKIP len=%d", block_length); + DEB((D_24554, "received GOT/SKIP len=%d", block_length)); if (bstate->mode != bmode_transfer) { PROTO_ERROR("unexpected M_GOT/M_SKIP"); } @@ -843,7 +849,7 @@ case BPMSG_SKIP: } if (strcmp (bstate->pi->send->net_name, fi.fn) == 0 && bstate->pi->send->status != FSTAT_WAITACK) { - log("aborting current file"); + DEB((D_24554, "aborting current file")); if (bstate->pi->send->netspool) { PROTO_ERROR("cannot SKIP or REFUSE netspool"); } @@ -863,7 +869,7 @@ case BPMSG_SKIP: bstate->pi->send->status = FSTAT_REFUSED; } else { if (bstate->pi->send->status == FSTAT_WAITACK) { - log("confirmed %s", fi.fn); + DEB((D_24554, "confirmed %s", fi.fn)); bstate->pi->send->status = FSTAT_SUCCESS; } else { log("confirmed not sent file - skipped %s", fi.fn); @@ -873,7 +879,7 @@ case BPMSG_SKIP: bstate->pi->send->status = FSTAT_SKIPPED; } } - log("closing file"); + DEB((D_24554, "closing file")); p_tx_fclose(bstate->pi); bstate->pi->send = tmp; goto check_that_all_files_are_confirmed; @@ -886,12 +892,12 @@ check_that_all_files_are_confirmed: int i; for (i = 0; i < bstate->pi->n_sentfiles; i++) { if (bstate->pi->sentfiles[i].status == FSTAT_WAITACK) { - log("sent file %d waits for acknowlede", i); + DEB((D_24554, "sent file %d waits for acknowlede", i)); return 1; } } } - log("all files are confirmed"); + DEB((D_24554, "all files are confirmed")); bstate->waiting_got = false; return 1; @@ -906,23 +912,23 @@ case BPMSG_BSY: /* All AKAs are busy */ return 3; case BPMSG_GET: /* Get a file from offset */ - log("received M_GET len=%d", block_length); + DEB((D_24554, "received M_GET len=%d", block_length)); if (bstate->mode != bmode_transfer) { PROTO_ERROR("unexpected M_GET"); } s_bpfinfo getfi; if (binkp_parsfinfo(buf+1, &getfi, true) != 0) { - log("error parsing M_GET %s", buf+1); + DEB((D_24554, "error parsing M_GET %s", buf+1)); PROTO_ERROR("invalid M_GET"); } - log("M_GET file %s size %d time %d offset %d", getfi.fn, getfi.sz, getfi.tm, getfi.offs); + DEB((D_24554, "M_GET file %s size %d time %d offset %d", getfi.fn, getfi.sz, getfi.tm, getfi.offs)); if (bstate->extracmd[0] != -1) return 0; if (bstate->pi->send) if (p_compfinfo(bstate->pi->send, getfi.fn, getfi.sz, getfi.tm)==0) { - log("M_GET for currently transmitted file"); + DEB((D_24554, "M_GET for currently transmitted file")); if (getfi.offs==bstate->pi->send->bytes_sent) { - log("M_GET offset match current (seems NR mode)"); + DEB((D_24554, "M_GET offset match current, seems NR mode")); // go to sending M_FILE bstate->phase = 2; bstate->extracmd[0] = BPMSG_FILE; @@ -937,7 +943,7 @@ case BPMSG_GET: /* Get a file from offset */ } if (bstate->pi->send) if (bstate->pi->send->netspool) { - log("ignore differing M_GET for netspool"); + DEB((D_24554, "ignore differing M_GET for netspool")); bstate->continuesend = true; return 1; } @@ -945,7 +951,7 @@ case BPMSG_GET: /* Get a file from offset */ if (bstate->pi->send) if (p_compfinfo(bstate->pi->send, getfi.fn, getfi.sz, getfi.tm)==0) { log("resending \"%s\" from %ld offset", bstate->pi->send->net_name, (long)getfi.offs); if( p_tx_rewind(bstate->pi, getfi.offs) != 0 ) { - log("failed to rewind"); + DEB((D_24554, "failed to rewind")); p_tx_fclose(bstate->pi); PROTO_ERROR("seek error") } @@ -961,7 +967,7 @@ case BPMSG_GET: /* Get a file from offset */ } if( bstate->pi->send ) { - log("aborting current file"); + DEB((D_24554, "aborting current file")); p_tx_fclose(bstate->pi); } @@ -973,7 +979,7 @@ case BPMSG_GET: /* Get a file from offset */ PROTO_ERROR("could not satisfy M_GET"); } if( p_tx_rewind(bstate->pi, getfi.offs) != 0 ) { - log("failed to rewind"); + DEB((D_24554, "failed to rewind")); p_tx_fclose(bstate->pi); PROTO_ERROR("seek error 2"); } @@ -989,21 +995,21 @@ case BPMSG_GET: /* Get a file from offset */ bstate->continuesend = true; return 1; } - log("unknown command %d received", buf[0]); + DEB((D_24554, "unknown command %d received", buf[0])); PROTO_ERROR("invalid command") case BINKP_BLK_DATA: //if there is file in progress - log("data block received length=%d", block_length); + DEB((D_24554, "data block received length=%d", block_length)); if (block_length==0) { - log("ignore zero length data block, argus workaround"); + log("warning: remote have sent zero length data block"); return 1; } if (bstate->frs == frs_nothing) { PROTO_ERROR("unexpected data block"); } if (bstate->frs == frs_didget || bstate->frs == frs_skipping) { - log("did M_GET or M_GOT or M_SKIP, skipping data"); + DEB((D_24554, "did M_GET or M_GOT or M_SKIP, skipping data")); return 1; } @@ -1044,7 +1050,7 @@ case BINKP_BLK_DATA: PROTO_ERROR("extra data for file") } else if( bstate->pi->recv->bytes_received == bstate->pi->recv->bytes_total ) { - log("receive completed"); + DEB((D_24554, "receive completed")); bstate->frs = frs_nothing; bstate->pi->recv->status = FSTAT_SUCCESS; if( !p_rx_fclose(bstate->pi) ) { @@ -1056,7 +1062,7 @@ case BINKP_BLK_DATA: return 1; } else { - log("some error committing file"); + DEB((D_24554, "some error committing file")); bstate->extracmd[0] = BPMSG_SKIP; sprintf(bstate->extracmd+1, "%s %ld %ld", bstate->pi->recv->net_name, (long)bstate->pi->recv->bytes_total, @@ -1065,7 +1071,7 @@ case BINKP_BLK_DATA: return 1; } } else { - log("data block accepted"); + DEB((D_24554, "data block accepted")); return 1; } } @@ -1129,6 +1135,13 @@ void binkp_process_NUL(s_binkp_sysinfo *remote_data, char *buffer) else strnxcpy(remote_data->progname, buffer+4, sizeof(remote_data->progname)); } + else if( strncmp(buffer, "TRF ", 4) == 0 ) { + // usually 24554 protocol mailers send only netmail size and arcmail+files size + DEB((D_24554, "process TRF")); + if( sscanf(buffer, "TRF %d %d", &remote_data->TRF_PKT, &remote_data->TRF_other)==2 ) { + remote_data->has_TRF = true; + } + } else log("BinkP NUL: \"%s\"", string_printable(buffer)); // NUL cannot be invalid as it is optional info } @@ -1152,11 +1165,11 @@ int binkp_auth_incoming(s_binkp_sysinfo *remote_data) if( remote_data->challenge_length > 0 && strncmp(remote_data->passwd, "CRAM-MD5-", 9) == 0 ) { - //log("md5 auth addrs %s", remote_data->addrs); - //log("md5 auth anum %d", remote_data->anum); - //log("md5 auth passwd %s", remote_data->passwd + 9); - //log("md5 auth challenge %s", remote_data->challenge); - //log("md5 auth challenge len %d", remote_data->challenge_length); + //DEB((D_24554, "md5 auth addrs %s", remote_data->addrs)); + //DEB((D_24554, "md5 auth anum %d", remote_data->anum)); + //DEB((D_24554, "md5 auth passwd %s", remote_data->passwd + 9)); + //DEB((D_24554, "md5 auth challenge %s", remote_data->challenge)); + //DEB((D_24554, "md5 auth challenge len %d", remote_data->challenge_length)); return session_addrs_check(state.remoteaddrs, state.n_remoteaddr, remote_data->passwd + 9, @@ -1164,7 +1177,7 @@ int binkp_auth_incoming(s_binkp_sysinfo *remote_data) remote_data->challenge_length); } - log("plain-text auth"); + DEB((D_24554, "plain-text auth")); return session_addrs_check(state.remoteaddrs, state.n_remoteaddr, remote_data->passwd, NULL, 0); } diff --git a/source/bforce/prot_binkp_api.c b/source/bforce/prot_binkp_api.c index 25232ec..d977736 100644 --- a/source/bforce/prot_binkp_api.c +++ b/source/bforce/prot_binkp_api.c @@ -56,7 +56,7 @@ s_handshake_protocol handshake_protocol_binkp = { binkp_remote_phone, binkp_remote_flags, binkp_remote_mailer, - NULL, + binkp_remote_traffic, /* Section 3 */ // binkp_local_address, binkp_local_password @@ -78,7 +78,7 @@ void binkp_init(s_handshake_protocol *THIS) void binkp_deinit(s_handshake_protocol *THIS) { - log("binkp_deinit"); + DEB((D_FREE, "binkp_deinit")); if (THIS==NULL) { log("THIS==NULL"); return; @@ -97,7 +97,7 @@ void binkp_deinit(s_handshake_protocol *THIS) free(THIS->local_data); THIS->local_data = NULL; } - log("binkp_deinit end"); + DEB((D_FREE, "binkp_deinit end")); } @@ -291,3 +291,19 @@ char *binkp_local_password(s_handshake_protocol *THIS) return NULL; } +int binkp_remote_traffic(s_handshake_protocol *THIS, s_traffic *dest) +{ + ASSERT(THIS); + ASSERT(THIS->remote_data); + ASSERT(dest); + + memset(dest, '\0', sizeof(s_traffic)); + + if (((s_binkp_sysinfo *)THIS->remote_data)->has_TRF) { + dest->netmail_size = ((s_binkp_sysinfo *)THIS->remote_data)->TRF_PKT; + dest->arcmail_size = 0; + dest->files_size = ((s_binkp_sysinfo *)THIS->remote_data)->TRF_other; + return 0; + } + return -1; +} diff --git a/source/bforce/prot_binkp_misc.c b/source/bforce/prot_binkp_misc.c index 1d2b19c..585dd4e 100644 --- a/source/bforce/prot_binkp_misc.c +++ b/source/bforce/prot_binkp_misc.c @@ -44,7 +44,7 @@ int binkp_parsfinfo(const char *str, s_bpfinfo *fi, bool with_offset) log("too long string, overflow may occur"); return -1; } - log("info to parse: %s", str); + DEB((D_24554, "info to parse: %s", str)); r = sscanf(str, with_offset? "%s %d %d %d": "%s %d %d", &fi->fn, &fi->sz, &fi->tm, &fi->offs); chkslash = fi->fn; while (1) { diff --git a/source/bforce/prot_common.c b/source/bforce/prot_common.c index 8c0988a..fe5af1a 100644 --- a/source/bforce/prot_common.c +++ b/source/bforce/prot_common.c @@ -43,7 +43,7 @@ const char *Protocols[] = static int prot_get_next_file(s_filelist **dest, s_protinfo *pi) { - log("prot_get_next_file"); // %s %d", hint->fn, hint->sz); + DEB((D_OUTBOUND, "prot_get_next_file")); // %s %d", hint->fn, hint->sz); s_filelist *ptrl = NULL; s_filelist *best = NULL; s_fsqueue *q = &state.queue; @@ -53,7 +53,7 @@ static int prot_get_next_file(s_filelist **dest, s_protinfo *pi) /* local queue */ for( ptrl = q->fslist; ptrl; ptrl = ptrl->next ) { - //log("scan %s", ptrl->fname); + //DEB((D_OUTBOUND, "scan %s", ptrl->fname)); if (hint) if (strcmp(hint->fn, ptrl->fname) !=0 || hint->sz != ptrl->size) continue; if( ptrl->status == STATUS_WILLSEND ) { @@ -91,7 +91,7 @@ static int prot_get_next_file(s_filelist **dest, s_protinfo *pi) best = ptrl; } } - //log("scan1 done"); + //DEB((D_OUTBOUND, log("scan1 done"); if( best ) { @@ -107,16 +107,16 @@ static int prot_get_next_file(s_filelist **dest, s_protinfo *pi) return 0; } } - //log("scan2 done"); + //DEB((D_OUTBOUND, log("scan2 done"); /* network queue */ #ifdef NETSPOOL if (hint) return 1; // cannot choose - /*log("netspool next file");*/ + /*DEB((D_OUTBOUND, log("netspool next file");*/ if(state.netspool.state == NS_NOTINIT) { - /*log("new netspool connection");*/ + /*DEB((D_OUTBOUND, log("new netspool connection");*/ #define ADDRBUF 3000 #define SMALLBUF 128 char password[SMALLBUF]; @@ -126,7 +126,7 @@ static int prot_get_next_file(s_filelist **dest, s_protinfo *pi) char *host = conf_string(cf_netspool_host); char *port = conf_string(cf_netspool_port); if(host==NULL) { - //log("netspool is not configured"); + //DEB((D_OUTBOUND, log("netspool is not configured"); state.netspool.state = NS_UNCONF; } else { if (state.n_remoteaddr==0) { @@ -145,7 +145,7 @@ static int prot_get_next_file(s_filelist **dest, s_protinfo *pi) log("no buffer space for address %s", address); break; } - log("add address %s", address); + DEB((D_OUTBOUND, "add address %s", address)); memcpy (addresses+pos, address, alen); pos += alen; addresses[pos++] = 0; @@ -163,26 +163,26 @@ static int prot_get_next_file(s_filelist **dest, s_protinfo *pi) } if(state.netspool.state == NS_READY) { - /*log("netspool request");*/ + /*DEB((D_OUTBOUND, log("netspool request");*/ netspool_query(&state.netspool, "ALL"); } if(state.netspool.state == NS_RECEIVING) { - //log("netspool begin receive"); + //DEB((D_OUTBOUND, log("netspool begin receive"); netspool_receive(&state.netspool); } else { - //log("netspool could not start receive"); + //DEB((D_OUTBOUND, log("netspool could not start receive"); return 1; } if(state.netspool.state == NS_RECVFILE) { - /*log("netspool start file");*/ + /*DEB((D_OUTBOUND, log("netspool start file");*/ *dest = NULL; return 0; } if(state.netspool.state == NS_READY) { - //log("netspool queue empty"); + //DEB((D_OUTBOUND, log("netspool queue empty"); netspool_end(&state.netspool); } @@ -254,42 +254,42 @@ int p_tx_fopen(s_protinfo *pi, s_filehint *hint) return 1; if (hint) { - log("trying to reopen file %s size %d time %d", hint->fn, hint->sz, hint->tm); + DEB((D_OUTBOUND, "trying to reopen file %s size %d time %d", hint->fn, hint->sz, hint->tm)); int i; for (i=0; i++; in_sentfiles) { - log("check %s %d %d", pi->sentfiles[i].net_name, pi->sentfiles[i].bytes_total, pi->sentfiles[i].mod_time); + DEB((D_OUTBOUND, "check %s %d %d", pi->sentfiles[i].net_name, pi->sentfiles[i].bytes_total, pi->sentfiles[i].mod_time)); if (strcmp(pi->sentfiles[i].net_name, hint->fn)==0) { - log("name match"); + DEB((D_OUTBOUND, "name match")); if (pi->sentfiles[i].bytes_total == hint->sz) { - log("size match"); + DEB((D_OUTBOUND, "size match")); if (pi->sentfiles[i].mod_time == hint->tm) { - log("time match"); + DEB((D_OUTBOUND, "time match")); if (!pi->sentfiles[i].fp) { - log("already closed"); + DEB((D_OUTBOUND, "already closed")); return -1; } pi->send = pi->sentfiles + i; pi->send->eofseen = FALSE; pi->send->status = FSTAT_PROCESS; - log("reopened %s", pi->send->fname); + DEB((D_OUTBOUND, "reopened %s", pi->send->fname)); return 0; } } } } - log("no file for this hint"); + DEB((D_OUTBOUND, "no file for this hint")); return -1; } get_next_file: if( prot_get_next_file(&ptrl, pi) ) { - log("no next file"); + DEB((D_OUTBOUND, "no next file")); return 1; } if( ptrl ) { - log("sending local file"); + DEB((D_OUTBOUND, "sending local file")); /* Mark this file as "processed" */ ptrl->status = STATUS_SENDING; @@ -328,14 +328,14 @@ get_next_file: */ if( pi->sentfiles && pi->n_sentfiles > 0 ) { - log("adding file to sentfile"); + DEB((D_OUTBOUND, "adding file to sentfile")); pi->sentfiles = (s_finfo *)xrealloc(pi->sentfiles, sizeof(s_finfo)*(pi->n_sentfiles+1)); memset(&pi->sentfiles[pi->n_sentfiles], '\0', sizeof(s_finfo)); pi->send = &pi->sentfiles[pi->n_sentfiles++]; } else { - log("adding file to new sentfile"); + DEB((D_OUTBOUND, "adding file to new sentfile")); pi->sentfiles = (s_finfo *)xmalloc(sizeof(s_finfo)); memset(pi->sentfiles, '\0', sizeof(s_finfo)); pi->send = pi->sentfiles; @@ -407,7 +407,7 @@ get_next_file: int p_tx_rewind(s_protinfo *pi, size_t pos) { if( !pi || !pi->send || !pi->send->fp) { - log("cannot rewind"); + DEB((D_OUTBOUND, "cannot rewind")); return -1; } return fseek(pi->send->fp, pos, SEEK_SET); @@ -469,7 +469,7 @@ int p_tx_fclose(s_protinfo *pi) long cps = 0; if (!pi->send) { - log("already closed"); + DEB((D_OUTBOUND, "already closed")); return -1; } @@ -541,7 +541,7 @@ int p_tx_fclose(s_protinfo *pi) break; #ifdef NETSPOOL case ACTION_ACKNOWLEDGE: - log("netspool commit %s", state.netspool.filename); + DEB((D_OUTBOUND, "netspool commit %s", state.netspool.filename)); netspool_acknowledge(&state.netspool); break; #endif @@ -574,7 +574,7 @@ long int p_tx_readfile(char *buffer, size_t buflen, s_protinfo *pi) #ifdef NETSPOOL if (pi->send->netspool) { - /*log("reading netspool file");*/ + /*DEB((D_OUTBOUND, log("reading netspool file");*/ if( state.netspool.state != NS_RECVFILE ) { log("send: wrong netspool state"); pi->send->status = FSTAT_SKIPPED; @@ -587,10 +587,10 @@ long int p_tx_readfile(char *buffer, size_t buflen, s_protinfo *pi) pi->send->status = FSTAT_SKIPPED; return -2; } - /*log("got %d bytes from netspool", n);*/ + /*DEB((D_OUTBOUND, log("got %d bytes from netspool", n);*/ return n; } else { - /*log("reading local file");*/ + /*DEB((D_OUTBOUND, log("reading local file");*/ } #endif /* @@ -749,9 +749,9 @@ static int p_move2inbound(s_protinfo *pi) { log("recv: cannot get unique name for \"%s\"", pi->recv->local_name); - log("free realname"); + DEB((D_FREE, "free realname")); free(realname); - log("freed"); + DEB((D_FREE, "freed")); return 1; } @@ -799,14 +799,14 @@ static int p_move2inbound(s_protinfo *pi) } if( realname ) { - log("free realname"); + DEB((D_FREE, "free realname")); free(realname); - log("freed"); + DEB((D_FREE, "freed")); } if( uniqname ) { - log("free uniqname"); + DEB((D_FREE, "free uniqname")); free(uniqname); - log("freed"); + DEB((D_FREE, "freed")); } return rc ? 1 : 0; @@ -988,13 +988,13 @@ int p_rx_fopen(s_protinfo *pi, char *fn, size_t sz, time_t tm, mode_t mode) if( pi->recv->mod_time == localtogmt(st.st_mtime) && pi->recv->bytes_total == st.st_size ) { - log("recv: allready have \"%s\"", fname); + log("recv: already have \"%s\"", fname); pi->recv->status = FSTAT_SKIPPED; } } - log("free fname"); + DEB((D_FREE, "free fname")); free(fname); fname = NULL; - log("freed"); + DEB((D_FREE, "freed")); if( pi->recv->status == FSTAT_SKIPPED ) return 2; @@ -1022,10 +1022,10 @@ int p_rx_fopen(s_protinfo *pi, char *fn, size_t sz, time_t tm, mode_t mode) else pi->recv->status = FSTAT_REFUSED; - log("free pi->recv->fname"); + DEB((D_FREE, "free pi->recv->fname")); free(pi->recv->fname); pi->recv->fname = NULL; - log("freed"); + DEB((D_FREE, "freed")); return pi->recv->status == FSTAT_SKIPPED ? 2 : 1; } @@ -1064,8 +1064,10 @@ int p_rx_fopen(s_protinfo *pi, char *fn, size_t sz, time_t tm, mode_t mode) logerr("recv: cannot open \"%s\" -> refuse", pi->recv->fname); pi->recv->status = FSTAT_REFUSED; + DEB((D_FREE, "p_rx_open free")); free(pi->recv->fname); pi->recv->fname = NULL; + DEB((D_FREE, "p_rx_open ok")); return 1; } @@ -1595,8 +1597,10 @@ char *prot_unique_name(char *dirname, char *fname, int type) *p = 'A'; else if( --p < result || *p == '.' || *p == '/' ) { + DEB((D_FREE, "free result")); free(result); result = NULL; + DEB((D_FREE, "result ok")); break; } } @@ -1627,8 +1631,11 @@ char *prot_unique_name(char *dirname, char *fname, int type) if( try >= MAX_TRIES ) { - if( result ) + if( result ) { + DEB((D_FREE, "free result")); free(result); + DEB((D_FREE, "result ok")); + } return NULL; } @@ -1647,7 +1654,7 @@ char *prot_unique_name(char *dirname, char *fname, int type) */ void deinit_finfo(s_finfo *fi) { - log("deinit_finfo"); + DEB((D_FREE, "deinit_finfo")); if( fi->fp ) fclose(fi->fp); @@ -1659,7 +1666,7 @@ void deinit_finfo(s_finfo *fi) free(fi->fname); memset(fi, '\0', sizeof(s_finfo)); - log("deinit_finfo end"); + DEB((D_FREE, "deinit_finfo end")); } /***************************************************************************** @@ -1777,7 +1784,7 @@ void init_protinfo(s_protinfo *pi, bool caller) void deinit_protinfo(s_protinfo *pi) { int i; - log("deinit_protinfo"); + DEB((D_FREE, "deinit_protinfo")); for( i = 0; i < pi->n_sentfiles; i++ ) deinit_finfo(&pi->sentfiles[i]); @@ -1793,5 +1800,5 @@ void deinit_protinfo(s_protinfo *pi) free(pi->rcvdfiles); memset(pi, '\0', sizeof(s_protinfo)); - log("deinit_protinfo end"); + DEB((D_FREE, "deinit_protinfo end")); } diff --git a/source/bforce/sess_answ.c b/source/bforce/sess_answ.c index c8095e1..c3d386f 100644 --- a/source/bforce/sess_answ.c +++ b/source/bforce/sess_answ.c @@ -69,10 +69,6 @@ int answ_system(e_session type, char *connstr, int inetd) gotoexit(BFERR_FATALERROR); } -#ifdef DEBUG - (void)debug_setfilename(log_getfilename(LOG_FILE_DEBUG)); -#endif - if( inetd ) { if( connstr && *connstr ) diff --git a/source/bforce/sess_call.c b/source/bforce/sess_call.c index a5b5a35..ed0a307 100644 --- a/source/bforce/sess_call.c +++ b/source/bforce/sess_call.c @@ -249,10 +249,6 @@ int call_system_quiet(const char *connstr, bool inet) return BFERR_FATALERROR; } -#ifdef DEBUG - (void)debug_setfilename(log_getfilename(LOG_FILE_DEBUG)); -#endif - if( inet ) { if( connstr && *connstr ) @@ -350,10 +346,6 @@ int call_system_modem(void) log("can't continue without logging"); return BFERR_FATALERROR; } - -#ifdef DEBUG - (void)debug_setfilename(log_getfilename(LOG_FILE_DEBUG)); -#endif if( (rc = port_open(state.modemport, 1, &oldtio)) == 0 ) { @@ -505,10 +497,6 @@ int call_system_tcpip(int callwith) // only TCPIP values log("can't continue without logging"); return BFERR_FATALERROR; } - -#ifdef DEBUG - (void)debug_setfilename(log_getfilename(LOG_FILE_DEBUG)); -#endif switch( callwith ) { case CALL_TCPIP_BINKP: diff --git a/source/bforce/sess_common.c b/source/bforce/sess_common.c index e3c235a..7dece83 100644 --- a/source/bforce/sess_common.c +++ b/source/bforce/sess_common.c @@ -164,7 +164,7 @@ void init_state(s_state *pstate) void deinit_state(s_state *pstate) { - log("deinit_state begin"); + DEB((D_FREE, "deinit_state begin")); if (pstate->linename) free(pstate->linename); if (pstate->cidstr) free(pstate->cidstr); if (pstate->peername) free(pstate->peername); @@ -185,7 +185,7 @@ void deinit_state(s_state *pstate) memset(pstate, '\0', sizeof(s_state)); pstate->session_rc = -1; - log("deinit_state end"); + DEB((D_FREE, "deinit_state end")); } s_faddr *session_1remote_address() diff --git a/source/bforce/sess_main.c b/source/bforce/sess_main.c index c4eaaab..8351c2d 100644 --- a/source/bforce/sess_main.c +++ b/source/bforce/sess_main.c @@ -161,7 +161,7 @@ int session_addrs_check(s_sysaddr *addrs, int anum, const char *passwd, /* Encode digest to the hex string */ string_bin_to_hex(digest_hex, digest_bin, 16); - log("good password is %s", digest_hex); + //log("good password is %s", digest_hex); if( strcasecmp(passwd, digest_hex) == 0 ) good_passwd = TRUE; @@ -621,7 +621,7 @@ void session_traffic(void) rc = session_traffic_set_incoming(&state.traff_recv); session_traffic_log(TRUE, rc ? NULL : &state.traff_recv); - /* Outgoing traffic must be allread calculated */ + /* Outgoing traffic must be already calculated */ session_traffic_log(FALSE, &state.traff_send); } diff --git a/source/bforce/u_plock.c b/source/bforce/u_plock.c index 5af27b6..bd3b77b 100644 --- a/source/bforce/u_plock.c +++ b/source/bforce/u_plock.c @@ -161,7 +161,9 @@ int plock_create(const char *lockname) *++p = '\0'; else { + DEB((D_FREE, "plock free")); free(tmpname); + DEB((D_FREE, "plock freed")); return PLOCK_ERROR; } tmpname = xstrcat(tmpname, "bforce-XXXXXX"); @@ -169,7 +171,9 @@ int plock_create(const char *lockname) if( (p = mktemp(tmpname)) == NULL ) { logerr("can't generate unique file name from \"%s\"", tmpname); + DEB((D_FREE, "plock free")); free(tmpname); + DEB((D_FREE, "plock freed")); return PLOCK_ERROR; } @@ -179,7 +183,9 @@ int plock_create(const char *lockname) DEB((D_OUTBOUND, "out_bsy_createfile: createlink(\"%s\", \"%s\"), rc = %d", lockname, p, rc)); + DEB((D_FREE, "plock free")); free(tmpname); + DEB((D_FREE, "plock freed")); return rc; } diff --git a/source/configure b/source/configure index 64cb531..e851d30 100755 --- a/source/configure +++ b/source/configure @@ -1,8 +1,8 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.68 for bforce 0.22.9. +# Generated by GNU Autoconf 2.68 for bforce 0.24. # -# Report bugs to . +# Report bugs to . # # # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, @@ -238,11 +238,11 @@ fi $as_echo "$0: In particular, zsh $ZSH_VERSION has bugs and should" $as_echo "$0: be upgraded to zsh 4.3.4 or later." else - $as_echo "$0: Please tell bug-autoconf@gnu.org and -$0: e.kozhuhovskiy@gmail.com about your system, including -$0: any error possibly output before this message. Then -$0: install a modern shell, or manually run the script -$0: under such a shell if you do have one." + $as_echo "$0: Please tell bug-autoconf@gnu.org and sergey@fidoman.ru +$0: about your system, including any error possibly output +$0: before this message. Then install a modern shell, or +$0: manually run the script under such a shell if you do +$0: have one." fi exit 1 fi @@ -560,9 +560,9 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='bforce' PACKAGE_TARNAME='bforce' -PACKAGE_VERSION='0.22.9' -PACKAGE_STRING='bforce 0.22.9' -PACKAGE_BUGREPORT='e.kozhuhovskiy@gmail.com' +PACKAGE_VERSION='0.24' +PACKAGE_STRING='bforce 0.24' +PACKAGE_BUGREPORT='sergey@fidoman.ru' PACKAGE_URL='' ac_default_prefix=/usr/local/fido @@ -1243,7 +1243,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures bforce 0.22.9 to adapt to many kinds of systems. +\`configure' configures bforce 0.24 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1309,7 +1309,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of bforce 0.22.9:";; + short | recursive ) echo "Configuration of bforce 0.24:";; esac cat <<\_ACEOF @@ -1354,7 +1354,7 @@ Some influential environment variables: Use these variables to override the choices made by `configure' or to help it to find libraries and programs with nonstandard names/locations. -Report bugs to . +Report bugs to . _ACEOF ac_status=$? fi @@ -1417,7 +1417,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -bforce configure 0.22.9 +bforce configure 0.24 generated by GNU Autoconf 2.68 Copyright (C) 2010 Free Software Foundation, Inc. @@ -1664,9 +1664,9 @@ $as_echo "$as_me: WARNING: $2: see the Autoconf documentation" >&2;} $as_echo "$as_me: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 $as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} -( $as_echo "## --------------------------------------- ## -## Report this to e.kozhuhovskiy@gmail.com ## -## --------------------------------------- ##" +( $as_echo "## -------------------------------- ## +## Report this to sergey@fidoman.ru ## +## -------------------------------- ##" ) | sed "s/^/$as_me: WARNING: /" >&2 ;; esac @@ -1840,7 +1840,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by bforce $as_me 0.22.9, which was +It was created by bforce $as_me 0.24, which was generated by GNU Autoconf 2.68. Invocation command line was $ $0 $@ @@ -4961,7 +4961,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by bforce $as_me 0.22.9, which was +This file was extended by bforce $as_me 0.24, which was generated by GNU Autoconf 2.68. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -5017,13 +5017,13 @@ $config_files Configuration headers: $config_headers -Report bugs to ." +Report bugs to ." _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -bforce config.status 0.22.9 +bforce config.status 0.24 configured by $0, generated by GNU Autoconf 2.68, with options \\"\$ac_cs_config\\" @@ -6253,7 +6253,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by bforce $as_me 0.22.9, which was +This file was extended by bforce $as_me 0.24, which was generated by GNU Autoconf 2.68. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -6309,13 +6309,13 @@ $config_files Configuration headers: $config_headers -Report bugs to ." +Report bugs to ." _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -bforce config.status 0.22.9 +bforce config.status 0.24 configured by $0, generated by GNU Autoconf 2.68, with options \\"\$ac_cs_config\\" diff --git a/source/configure.in b/source/configure.in index 90d4339..6a8f4de 100644 --- a/source/configure.in +++ b/source/configure.in @@ -3,7 +3,7 @@ dnl dnl $Id$ dnl #AC_INIT(bforce/bforce.c) -AC_INIT([bforce],[0.22.9],[e.kozhuhovskiy@gmail.com]) +AC_INIT([bforce],[0.24],[sergey@fidoman.ru]) AC_CONFIG_HEADER(include/config.h) AC_CANONICAL_SYSTEM dnl # Minimum Autoconf version required. diff --git a/source/include/bforce.h b/source/include/bforce.h index 8a4324e..c364436 100644 --- a/source/include/bforce.h +++ b/source/include/bforce.h @@ -14,22 +14,6 @@ #ifndef _BFORCE_H_ #define _BFORCE_H_ -#ifndef DAEMON_LOGFILE -#define DAEMON_LOGFILE "/var/log/bforce/bf-daemon" -#endif - -#ifndef BFORCE_LOGFILE -#define BFORCE_LOGFILE "/var/log/bforce/bf-log" -#endif - -#ifndef BFORCE_DEBFILE -#define BFORCE_DEBFILE "/var/log/bforce/bf-debug" -#endif - -#ifndef BFORCE_CFGFILE -#define BFORCE_CFGFILE "/etc/bforce/bforce.conf" -#endif - /* * BinkleyForce limits */ @@ -39,9 +23,6 @@ #define BF_MAXDOMAIN 40 #define BF_MAXADDRSTR 80 -/* IP-only nodes phone */ -#define NO_PSTN_PHONE "00-00-000000" - /* * Maximum length of file name (without path) */ diff --git a/source/include/confread.h b/source/include/confread.h index 797ddb0..db88b9f 100644 --- a/source/include/confread.h +++ b/source/include/confread.h @@ -319,7 +319,7 @@ typedef struct conf_entry { CT_STRING, CT_TRANSLATE, CT_TRIES, - CT_DEBLEVEL, +// CT_DEBLEVEL, CT_FILEBOX } type; s_cval_entry *data; diff --git a/source/include/logger.h b/source/include/logger.h index 5d4b3e9..8c86721 100644 --- a/source/include/logger.h +++ b/source/include/logger.h @@ -46,6 +46,8 @@ enum { LOG_FILE_DAEMON, LOG_FILE_SESSION, LOG_FILE_DEBUG, LOG_FILE_HISTORY }; # define D_FREQ 0x0000400L # define D_STATEM 0x0000800L # define D_DAEMON 0x0001000L +# define D_24554 0x0002000L +# define D_FREE 0x0004000L # define D_FULL 0xfffffffL #endif @@ -67,13 +69,14 @@ int log(const char *s, ...); int logerr(const char *s, ...); #ifdef DEBUG -void debug_setlevel(long newlevel, bool logit); +//void debug_setlevel(long newlevel, bool logit); bool debug_isopened(void); -void debug_setfilename(const char *debugname); -int debug_parsestring(char *str, unsigned long *deblevel); -int debug_open(const char *debugname); -int debug_close(void); -int debug(unsigned long what, const char *str, ...); +//void debug_setfilename(const char *debugname); +//int debug_parsestring(char *str, unsigned long *deblevel); +int debug_open(); +int debug_close(); +int debug(unsigned long what, const char *str, ...); +void debug_configure(); #endif #endif diff --git a/source/include/prot_binkp.h b/source/include/prot_binkp.h index 985d2a2..e44c487 100644 --- a/source/include/prot_binkp.h +++ b/source/include/prot_binkp.h @@ -82,6 +82,9 @@ typedef struct { int options; char challenge[BINKP_MAXCHALLENGE+1]; int challenge_length; + bool has_TRF; + int TRF_PKT; + int TRF_other; } s_binkp_sysinfo; @@ -172,6 +175,7 @@ void binkp_log_sysinfo(s_binkp_sysinfo *binkp); //void binkp_queue_sysinfo(s_bpinfo *bpi, s_binkp_sysinfo *binkp); void binkp_set_sysinfo(s_binkp_sysinfo *binkp, s_faddr *remote_addr, bool caller); void binkp_parse_options(s_binkp_sysinfo *binkp, char *options); +int binkp_remote_traffic(s_handshake_protocol *THIS, s_traffic *dest); /* prot_binkp_api.c */ extern s_handshake_protocol handshake_protocol_binkp; diff --git a/source/openwrt-conf b/source/openwrt-conf index ffe57bd..4558c1b 100755 --- a/source/openwrt-conf +++ b/source/openwrt-conf @@ -12,5 +12,7 @@ CC=$PREFIX-gcc export PATH CC CPP #make clean -#./configure --prefix=/opt/bforce --host=mips-openwrt-linux --disable-syslog --enable-netspool -make && scp bin/bforce root@gw-home:/opt/bforce/bin +#./configure --prefix=/opt/bforce --host=mips-openwrt-linux --disable-syslog --enable-netspool +#--with-logdir=/home/fido/log --with-spooldir=/home/fido/bforce +#make && scp bin/bforce root@gw-home:/opt/bforce/bin/bforce-new +make && scp bin/bforce root@gw-home:/opt/bforce/bin/bforce \ No newline at end of file From f131ba864f2db512518e95e660ee0818a54a7a8c Mon Sep 17 00:00:00 2001 From: Sergey Dorofeev Date: Sat, 10 Mar 2012 20:37:57 +0400 Subject: [PATCH 26/29] Debug log cheat: add exclamation sign to filename and get separate debug log for each session --- source/bforce/bforce.c | 2 +- source/bforce/logger.c | 38 ++++++++++++++++++++++++------------- source/bforce/prot_binkp.c | 6 ++++-- source/bforce/sess_common.c | 12 ++++++++++++ 4 files changed, 42 insertions(+), 16 deletions(-) diff --git a/source/bforce/bforce.c b/source/bforce/bforce.c index 9440c85..aba549d 100644 --- a/source/bforce/bforce.c +++ b/source/bforce/bforce.c @@ -483,7 +483,7 @@ exit: #ifdef DEBUG if( debug_isopened() ) debug_close(); #endif - + DEB((D_FREE, "good exit")); exit(rc); } diff --git a/source/bforce/logger.c b/source/bforce/logger.c index 16ba5f2..c8e9a3e 100644 --- a/source/bforce/logger.c +++ b/source/bforce/logger.c @@ -106,11 +106,6 @@ int log_open(const char *logname, const char *ext, const char *tty) if( logname ) { - /* Reset previous settings */ - *log_name = '\0'; - *log_extension = '\0'; - *log_ttyname = '\0'; - strnxcpy(log_name, logname, sizeof(log_name)); if( tty && *tty ) @@ -122,14 +117,9 @@ int log_open(const char *logname, const char *ext, const char *tty) strnxcat(log_name, ".", sizeof(log_name)); strnxcat(log_name, ext, sizeof(log_name)); } - - if( (log_fp = fopen(log_name, "a")) == NULL ) - { - logerr("can't open log file \"%s\"", log_name); - return -1; - } } - else if( log_name ) + + if( log_name ) { /* Open previously set log file */ @@ -462,7 +452,29 @@ int debug_open() if( debug_name ) { - if( (debug_fp = fopen(debug_name, "a")) == NULL ) + + char log_name[PATH_MAX]; + char *marker; + /* Reset previous settings */ + *log_name = '\0'; + *log_extension = '\0'; + *log_ttyname = '\0'; + + if (marker = strchr(debug_name, '!')) { + struct timespec xtm; + struct tm btm; + clock_gettime(CLOCK_REALTIME, &xtm); + gmtime_r(&xtm.tv_sec, &btm); + // hope sysop will not DoS his own node + memcpy(log_name, debug_name, marker-debug_name); + sprintf( log_name + (marker-debug_name) + strftime(log_name + (marker-debug_name), 100, ".%Y-%m-%d.%H.%M.%S.", &btm), "%09ld.%s", xtm.tv_nsec, marker+1); + // I'm too lazy to add variable + } + else { + strcpy(log_name, debug_name); + } + + if( (debug_fp = fopen(log_name, "a")) == NULL ) { /* Don't try to open it next time */ debug_invalid_name = TRUE; diff --git a/source/bforce/prot_binkp.c b/source/bforce/prot_binkp.c index ade03ea..b55107b 100644 --- a/source/bforce/prot_binkp.c +++ b/source/bforce/prot_binkp.c @@ -360,6 +360,7 @@ case 0: // MD5 challenge } case 1: // send sysinfo + DEB((D_24554, "send sysinfo")); my_sf = bstate->subphase; bstate->subphase+=1; *block_type = BINKP_BLK_CMD; @@ -450,7 +451,7 @@ case 3: // send password on outgoing or pw confirmation on incoming // special empty password is sent if there is no password for the remote addr if (bstate->mode==bmode_incoming_handshake) { if (bstate->password_received) { - DEB((D_24554, "password verified")); + DEB((D_24554, "send OK, password verified")); buf[0] = BPMSG_OK; *block_type = BINKP_BLK_CMD; *block_length = 1; @@ -465,7 +466,7 @@ case 3: // send password on outgoing or pw confirmation on incoming DEB((D_24554, "address not received still")); return 0; } - DEB((D_24554, "sending password")); + DEB((D_24554, "send password")); buf[0] = BPMSG_PWD; *block_type = BINKP_BLK_CMD; @@ -550,6 +551,7 @@ case 4: case 2: //send file data n = p_tx_readfile (buf, 4096, bstate->pi); // BINKP_MAXBLOCK if (n>0) { + DEB((D_24554, "send data block len=%d", n)); *block_type = BINKP_BLK_DATA; *block_length = n; bstate->pi->send->bytes_sent += n; diff --git a/source/bforce/sess_common.c b/source/bforce/sess_common.c index 7dece83..b5043ea 100644 --- a/source/bforce/sess_common.c +++ b/source/bforce/sess_common.c @@ -165,21 +165,33 @@ void init_state(s_state *pstate) void deinit_state(s_state *pstate) { DEB((D_FREE, "deinit_state begin")); + + DEB((D_FREE, "deinit_state linename")); if (pstate->linename) free(pstate->linename); + DEB((D_FREE, "deinit_state cidstr")); if (pstate->cidstr) free(pstate->cidstr); + DEB((D_FREE, "deinit_state peername")); if (pstate->peername) free(pstate->peername); + DEB((D_FREE, "deinit_state connstr")); if (pstate->connstr) free(pstate->connstr); + DEB((D_FREE, "deinit_state inbound")); if (pstate->inbound) free(pstate->inbound); + DEB((D_FREE, "deinit_state tinbound")); if (pstate->tinbound) free(pstate->tinbound); + DEB((D_FREE, "deinit_state mailfor")); if (pstate->mailfor) deinit_falist(pstate->mailfor); + DEB((D_FREE, "deinit_state fsqueue")); deinit_fsqueue(&pstate->queue); + DEB((D_FREE, "deinit_state handshake")); if (state.handshake && state.handshake->deinit) { state.handshake->deinit(state.handshake); } + DEB((D_FREE, "deinit_state remotedata")); if (pstate->remoteaddrs) free (pstate->remoteaddrs); + DEB((D_FREE, "deinit_state localdata")); if (pstate->localaddrs) free (pstate->localaddrs); memset(pstate, '\0', sizeof(s_state)); From 700c2177296e477d92798e130c45637de5c3403b Mon Sep 17 00:00:00 2001 From: Sergey Dorofeev Date: Sat, 10 Mar 2012 20:50:35 +0400 Subject: [PATCH 27/29] minor fixes --- source/bforce/bforce.c | 2 +- source/bforce/sess_answ.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/source/bforce/bforce.c b/source/bforce/bforce.c index aba549d..0e2acb6 100644 --- a/source/bforce/bforce.c +++ b/source/bforce/bforce.c @@ -480,10 +480,10 @@ exit: /* Shutdown logging services */ if( log_isopened() ) log_close(); + DEB((D_FREE, "good exit")); #ifdef DEBUG if( debug_isopened() ) debug_close(); #endif - DEB((D_FREE, "good exit")); exit(rc); } diff --git a/source/bforce/sess_answ.c b/source/bforce/sess_answ.c index c3d386f..3a6e57c 100644 --- a/source/bforce/sess_answ.c +++ b/source/bforce/sess_answ.c @@ -41,7 +41,7 @@ int answ_system(e_session type, char *connstr, int inetd) state.inet = TRUE; } else - state.linename = isatty(0) ? port_get_name(ttyname(0)) : "tcpip"; + state.linename = isatty(0) ? port_get_name(ttyname(0)) : xstrcpy("tcpip"); if( !inetd ) { From e560e318f051a2915896038b1b937d0a4e0f4f82 Mon Sep 17 00:00:00 2001 From: Sergey Dorofeev Date: Sat, 10 Mar 2012 21:33:29 +0400 Subject: [PATCH 28/29] git --- source/bforce/prot_binkp.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/source/bforce/prot_binkp.c b/source/bforce/prot_binkp.c index b55107b..992446b 100644 --- a/source/bforce/prot_binkp.c +++ b/source/bforce/prot_binkp.c @@ -839,8 +839,11 @@ case BPMSG_EOB: /* End Of Batch (data ignored) */ return 1; // continue receiving as M_GOT may and would arrive case BPMSG_GOT: /* File received */ + DEB((D_24554, "received M_GOT len=%d", block_length)); + goto got_skip; case BPMSG_SKIP: - DEB((D_24554, "received GOT/SKIP len=%d", block_length)); + DEB((D_24554, "received M_SKIP len=%d", block_length)); +got_skip: if (bstate->mode != bmode_transfer) { PROTO_ERROR("unexpected M_GOT/M_SKIP"); } From eeea113b69965dda79e6442893b0de9315fe617a Mon Sep 17 00:00:00 2001 From: Sergey Dorofeev Date: Sat, 10 Mar 2012 21:48:17 +0400 Subject: [PATCH 29/29] git --- source/.version | 1 + 1 file changed, 1 insertion(+) create mode 100644 source/.version diff --git a/source/.version b/source/.version new file mode 100644 index 0000000..39010d2 --- /dev/null +++ b/source/.version @@ -0,0 +1 @@ +0.23