~ubuntu-branches/ubuntu/jaunty/ncbi-tools6/jaunty

« back to all changes in this revision

Viewing changes to network/vibnet/netcnfg.c

  • Committer: Bazaar Package Importer
  • Author(s): Aaron M. Ucko
  • Date: 2008-07-14 19:43:15 UTC
  • mfrom: (2.1.12 intrepid)
  • Revision ID: james.westby@ubuntu.com-20080714194315-ed44u9ek7txva2rz
Tags: 6.1.20080302-3
tools/readdb.c: enable madvise()-based code on all glibc (hence all
Debian) systems, not just Linux.  (Closes: #490437.)

Show diffs side-by-side

added added

removed removed

Lines of Context:
23
23
 *
24
24
 * ===========================================================================
25
25
 *
26
 
 * RCS $Id: netcnfg.c,v 6.15 2003/09/11 05:28:02 kans Exp $
 
26
 * RCS $Id: netcnfg.c,v 6.16 2007/07/13 18:29:18 kans Exp $
27
27
 *
28
28
 * Author:  Kans, Epstein
29
29
 *
115
115
  }
116
116
}
117
117
 
118
 
static Boolean NoEntryExists (CharPtr type)
 
118
static Boolean NoEntryExists (CharPtr sect, CharPtr type)
119
119
 
120
120
{
121
121
  Char  str [256];
122
122
 
123
 
  if (GetAppParam ("NCBI", "NET_SERV", type, NULL, str, sizeof (str))) {
 
123
  if (GetAppParam ("NCBI", sect, type, NULL, str, sizeof (str))) {
124
124
    if (! StringHasNoText (str)) return FALSE;
125
125
  }
126
126
  return TRUE;
148
148
    Update ();
149
149
    return;
150
150
  } else if (val == 3) {
151
 
    SetAppParam ("NCBI", "NET_SERV", "SRV_CONN_MODE", "SERVICE");
152
 
    SetAppParam ("NCBI", "NET_SERV", "FIREWALL", "TRUE");
 
151
    SetAppParam ("NCBI", "CONN", "FIREWALL", "TRUE");
153
152
    GetTitle (ncp->proxyHost, str, sizeof (str));
154
153
    if (! StringHasNoText (str)) {
155
 
      SetAppParam ("NCBI", "NET_SERV", "SRV_HTTP_PROXY_HOST", str);
 
154
      SetAppParam ("NCBI", "CONN", "HTTP_PROXY_HOST", str);
156
155
      GetTitle (ncp->proxyPort, str, sizeof (str));
157
156
      if (StringICmp (str, "80") == 0) {
158
157
        str [0] = '\0';
159
158
      }
160
159
      if (! StringHasNoText (str)) {
161
 
        SetAppParam ("NCBI", "NET_SERV", "SRV_HTTP_PROXY_PORT", str);
 
160
        SetAppParam ("NCBI", "CONN", "HTTP_PROXY_PORT", str);
162
161
      } else {
163
 
        SetAppParam ("NCBI", "NET_SERV", "SRV_HTTP_PROXY_PORT", NULL);
 
162
        SetAppParam ("NCBI", "CONN", "HTTP_PROXY_PORT", NULL);
164
163
      }
165
164
    } else {
166
 
      SetAppParam ("NCBI", "NET_SERV", "SRV_HTTP_PROXY_HOST", NULL);
167
 
      SetAppParam ("NCBI", "NET_SERV", "SRV_HTTP_PROXY_PORT", NULL);
 
165
      SetAppParam ("NCBI", "CONN", "HTTP_PROXY_HOST", NULL);
 
166
      SetAppParam ("NCBI", "CONN", "HTTP_PROXY_PORT", NULL);
168
167
    }
169
168
    GetTitle (ncp->firewallProxy, str, sizeof (str));
170
169
    if (! StringHasNoText (str)) {
171
 
      SetAppParam ("NCBI", "NET_SERV", "SRV_PROXY_HOST", str);
 
170
      SetAppParam ("NCBI", "CONN", "PROXY_HOST", str);
172
171
    } else {
173
 
      SetAppParam ("NCBI", "NET_SERV", "SRV_PROXY_HOST", NULL);
 
172
      SetAppParam ("NCBI", "CONN", "PROXY_HOST", NULL);
174
173
    }
175
174
  } else {
176
 
    SetAppParam ("NCBI", "NET_SERV", "SRV_CONN_MODE", NULL);
177
 
    SetAppParam ("NCBI", "NET_SERV", "FIREWALL", NULL);
178
 
    SetAppParam ("NCBI", "NET_SERV", "SRV_HTTP_PROXY_HOST", NULL);
179
 
    SetAppParam ("NCBI", "NET_SERV", "SRV_HTTP_PROXY_PORT", NULL);
180
 
    SetAppParam ("NCBI", "NET_SERV", "SRV_PROXY_HOST", NULL);
 
175
    SetAppParam ("NCBI", "CONN", "FIREWALL", NULL);
 
176
    SetAppParam ("NCBI", "CONN", "HTTP_PROXY_HOST", NULL);
 
177
    SetAppParam ("NCBI", "CONN", "HTTP_PROXY_PORT", NULL);
 
178
    SetAppParam ("NCBI", "CONN", "PROXY_HOST", NULL);
181
179
  }
182
180
 
183
181
  if (GetStatus (ncp->dnsAvailable)) {
184
 
    SetAppParam ("NCBI", "NET_SERV", "SRV_ENGINE_HOST", NULL);
 
182
    SetAppParam ("NCBI", "CONN", "HOST", NULL);
185
183
  } else {
186
 
    SetAppParam ("NCBI", "NET_SERV", "SRV_ENGINE_HOST", "130.14.22.106");
 
184
    SetAppParam ("NCBI", "CONN", "HOST", "130.14.29.110");
187
185
  }
188
186
 
189
187
  switch (GetValue (ncp->timeOut)) {
190
188
    case 1 :
191
 
      SetAppParam ("NCBI", "NET_SERV", "SRV_CONN_TIMEOUT", "10");
 
189
      SetAppParam ("NCBI", "CONN", "TIMEOUT", "10");
192
190
      break;
193
191
    case 3 :
194
 
      SetAppParam ("NCBI", "NET_SERV", "SRV_CONN_TIMEOUT", "60");
 
192
      SetAppParam ("NCBI", "CONN", "TIMEOUT", "60");
195
193
      break;
196
194
    case 4 :
197
 
      SetAppParam ("NCBI", "NET_SERV", "SRV_CONN_TIMEOUT", "300");
 
195
      SetAppParam ("NCBI", "CONN", "TIMEOUT", "300");
198
196
      break;
199
197
    default :
200
 
      SetAppParam ("NCBI", "NET_SERV", "SRV_CONN_TIMEOUT", NULL);
 
198
      SetAppParam ("NCBI", "CONN", "TIMEOUT", NULL);
201
199
      break;
202
200
  }
203
201
 
 
202
  /*
204
203
  if (GetAppParam ("NCBI", "NET_SERV", "SRV_ENGINE_PORT", NULL, str, sizeof (str))) {
205
204
    if (StringICmp (str, "80") == 0) {
206
205
      SetAppParam ("NCBI", "NET_SERV", "SRV_ENGINE_PORT", NULL);
212
211
      SetAppParam ("NCBI", "NET_SERV", "SRV_ENGINE_URL", NULL);
213
212
    }
214
213
  }
 
214
  */
215
215
 
216
 
  if (NoEntryExists ("SRV_CONN_MODE") &&
217
 
      NoEntryExists ("FIREWALL") &&
218
 
      NoEntryExists ("SRV_CONN_TIMEOUT") &&
219
 
      NoEntryExists ("SRV_ENGINE_HOST") &&
220
 
      NoEntryExists ("SRV_ENGINE_PORT") &&
221
 
      NoEntryExists ("SRV_ENGINE_URL") &&
222
 
      NoEntryExists ("SRV_HTTP_PROXY_HOST") &&
223
 
      NoEntryExists ("SRV_HTTP_PROXY_PORT") &&
224
 
      NoEntryExists ("SRV_PROXY_HOST")) {
225
 
    SetAppParam ("NCBI", "NET_SERV", NULL, NULL);
 
216
  if (NoEntryExists ("CONN", "FIREWALL") &&
 
217
      NoEntryExists ("CONN", "TIMEOUT") &&
 
218
      NoEntryExists ("CONN", "PROXY_HOST") &&
 
219
      NoEntryExists ("CONN", "HOST") &&
 
220
      NoEntryExists ("CONN", "HTTP_PROXY_HOST") &&
 
221
      NoEntryExists ("CONN", "HTTP_PROXY_PORT")) {
 
222
    SetAppParam ("NCBI", "CONN", NULL, NULL);
226
223
  }
227
224
 
228
225
  accepted = ncp->accepted;
420
417
    if (! netCurrentlyOn) {
421
418
      SafeSetValue (ncp->srvConnMode, 1);
422
419
      Hide (ncp->netGroup);
423
 
    } else if (GetAppParam ("NCBI", "NET_SERV", "SRV_CONN_MODE", "WWW", str, sizeof (str))) {
424
 
      if (StringICmp (str, "FIREWALL") == 0) {
 
420
    } else if (GetAppParam ("NCBI", "CONN", "FIREWALL", NULL, str, sizeof (str))) {
 
421
      if (StringICmp (str, "TRUE") == 0) {
425
422
        SafeSetValue (ncp->srvConnMode, 3);
426
 
      } else if (StringICmp (str, "SERVICE") == 0) {
427
 
        if (GetAppParam ("NCBI", "NET_SERV", "FIREWALL", "WWW", str, sizeof (str))) {
428
 
          if (StringICmp (str, "TRUE") == 0) {
429
 
            SafeSetValue (ncp->srvConnMode, 3);
430
 
          }
431
 
        }
432
423
      }
433
424
    }
434
 
    if (GetAppParam ("NCBI", "NET_SERV", "SRV_HTTP_PROXY_HOST", NULL, str, sizeof (str))) {
 
425
    if (GetAppParam ("NCBI", "CONN", "HTTP_PROXY_HOST", NULL, str, sizeof (str))) {
435
426
      if (! StringHasNoText (str)) {
436
427
        SafeSetTitle (ncp->proxyHost, str);
437
428
        if (GetValue (ncp->srvConnMode) == 2) {
439
430
        }
440
431
      }
441
432
    }
442
 
    if (GetAppParam ("NCBI", "NET_SERV", "SRV_HTTP_PROXY_PORT", NULL, str, sizeof (str))) {
 
433
    if (GetAppParam ("NCBI", "CONN", "HTTP_PROXY_PORT", NULL, str, sizeof (str))) {
443
434
      if (! StringHasNoText (str)) {
444
435
        SafeSetTitle (ncp->proxyPort, str);
445
436
      }
446
437
    }
447
 
    if (GetAppParam ("NCBI", "NET_SERV", "SRV_PROXY_HOST", NULL, str, sizeof (str))) {
 
438
    if (GetAppParam ("NCBI", "CONN", "PROXY_HOST", NULL, str, sizeof (str))) {
448
439
      if (! StringHasNoText (str)) {
449
440
        SafeSetTitle (ncp->firewallProxy, str);
450
441
      }
451
442
    }
452
 
    if (GetAppParam ("NCBI", "NET_SERV", "SRV_ENGINE_HOST", NULL, str, sizeof (str))) {
453
 
      if (StringICmp (str, "130.14.22.106") == 0 || StringICmp (str, "130.14.22.107") == 0 ) {
 
443
    if (GetAppParam ("NCBI", "CONN", "HOST", NULL, str, sizeof (str))) {
 
444
      if (StringICmp (str, "130.14.29.110") == 0) {
454
445
        SafeSetStatus (ncp->dnsAvailable, FALSE);
455
446
      }
456
447
    }
457
 
    if (GetAppParam ("NCBI", "NET_SERV", "SRV_CONN_TIMEOUT", "30", str, sizeof (str))) {
 
448
    if (GetAppParam ("NCBI", "CONN", "TIMEOUT", "30", str, sizeof (str))) {
458
449
      if (StringICmp (str, "10") == 0) {
459
450
        SafeSetValue (ncp->timeOut, 1);
460
451
      } else if (StringICmp (str, "60") == 0) {