45
FAQ: Added two section making FSP slower/faster, version bumped
45
FAQ: Added two section making FSP slower/faster, version bumped
47
do not use exit code -1 in fspscan
47
do not use exit code -1 in fspscan
48
LAMAH fspd: improve some error messages, run on port 80 by default
49
Changed all exit() calls to use standard EX_* values. Some utilities
50
still do not returns error exit when they should.
51
fhostcmd: split host managing functions into fhost.c
52
fhost.c: do not output partial results when dns resolving fails
53
fhost.c: fallback to other display method (host/ip name) on
55
common lib: When doing addr resolving turn port 0 into 21.
56
fhostcmd: ignore servers without port number set
57
new command fsetup: C rewrite of old Perl script. This command is
58
like fhostcmd but uses standard fspsites file format
49
Version 2.8.1b22 - 20 Dec 2004
60
Version 2.8.1b22 - 20 Dec 2004
50
fixed sf bug 1060594: fspd: owner can't rename files
61
fixed sf bug 1060594: fspd: owner can't rename files
1
FSP SUITE TO DO LIST
1
FSP SUITE TO DO LIST
2
/* maintained by hsn -at- netmag * cz */
4
/* maintained by hsn -at- netmag * cz */
4
Radim Kolar's personal wishlist from 1997
6
Radim Kolar's personal wishlist from 1997
5
*-high priority-*
7
*-high priority-*
6
- show loosers online (finfo command) and server statz
8
- show loosers online (finfo command) and server statz
8
- password change command !?
10
TESTSUITE NEEDED:
10
TESTSUITE NEEDED:
11
Write a simple FSP protocol testing tool
11
Write a simple FSP protocol testing tool
41
normalize return error codes of all clients
41
some client commands should exit with nonzero rc on failure
42
write new clients for new commands - fpasswd finfo
45
add support for more sane fsplist file format (as used by warez
49
genie.lut.ac.uk 21 genie / # small UK site
51
clients do not freeing memory allocated from glob()
44
clients do not freeing memory allocated from glob()
53
FUTURE FEATURES FOR SERVER:
46
FUTURE FEATURES FOR SERVER:
57
special defence against rapid/double fire clients (burst command in fspclient)
50
special defence against rapid/double fire clients (burst command in fspclient)
58
Native Supports for symbolic links (needed for mirroring Debian)
51
Native Supports for symbolic links (needed for mirroring Debian)
59
new LSTAT COMMAND, new MAKELINK command
52
new LSTAT COMMAND, new MAKELINK command
60
Server should save .FSP_CONTENT using 1k size directory blocks
55
Server should save .FSP_CONTENT using 1k size directory blocks
56
Server should support sending different sized directory blocks
62
:midle:may not be in 2.8.2
58
:midle:may not be in 2.8.2
63
write FSP_CHANGE_PASSWORD command
59
write FSP_CHANGE_PASSWORD command
80
PERFORMANCE:
76
PERFORMANCE:
81
do host hashtable shrinking/clearing sometimes
77
do host hashtable shrinking/clearing sometimes
82
stat cache pro FSP_STAT a other stat() calls
78
stat cache for FSP_STAT a other stat() calls
83
chage O(N) fifo cache to some more sane lru hashtable code.
79
chage O(N) fifo cache to some more sane lru hashtable code.
84
background time() alarm() caller
80
background time() alarm() caller
85
Current performance 1925648B/s
81
Current performance 1925648B/s
88
separate manpage for 7 fsp (protocol definition) == write FSP RFC
84
separate manpage for 7 fsp (protocol definition) == write FSP RFC
89
Register udp/21 for FSP in iana
85
Register udp/21 for FSP in iana. FSP RFC needed!
90
manual page for fmvcmd.1
86
manual page for fmvcmd.1
92
libraries and support for FSP protocol
88
libraries and support for FSP protocol
114
return(new);
114
return(new);
116
perror("palloc");
116
perror("palloc");
117
exit(1);
117
exit(EX_OSERR);
120
extern int isoutput;
120
extern int isoutput;
154
if ( (!value && endchar == str) || (endchar[0] &&
154
if ( (!value && endchar == str) || (endchar[0] &&
155
(!endch || endchar[0] != *endch))) {
155
(!endch || endchar[0] != *endch))) {
156
fprintf(stderr,"%s: %s", option, "illegal numeric value");
156
fprintf(stderr,"%s: %s", option, "illegal numeric value");
157
exit(1);
157
exit(EX_USAGE);
159
if (endch)
159
if (endch)
160
*endch = endchar[0];
160
*endch = endchar[0];
203
if (!(*store = (char *)realloc(*store, len *= 2))) {
203
if (!(*store = (char *)realloc(*store, len *= 2))) {
204
perror("realloc");
204
perror("realloc");
205
client_done();
205
client_done();
206
exit(1);
206
exit(EX_OSERR);
208
bcopy(path, p, plen);
208
bcopy(path, p, plen);
209
p += plen;
209
p += plen;
280
case -1:
280
case -1:
281
perror ("fork");
281
perror ("fork");
282
exit(1);
282
exit(EX_OSERR);
284
execvp(plan->e_argv[0], plan->e_argv);
284
execvp(plan->e_argv[0], plan->e_argv);
285
perror ("execvp");
285
perror ("execvp");
286
exit(1);
286
exit(EX_OSERR);
288
pid = wait(&status);
288
pid = wait(&status);
297
if ( (p = (char *)malloc(len))) return((char *)p);
297
if ( (p = (char *)malloc(len))) return((char *)p);
298
perror("malloc");
298
perror("malloc");
299
exit(1);
299
exit(EX_OSERR);
320
for (ap = argv = *argvp;; ++ap) {
320
for (ap = argv = *argvp;; ++ap) {
321
if (!*ap) {
321
if (!*ap) {
322
fprintf(stderr,"%s: no terminating", isok ? "-ok" : "-exec");
322
fprintf(stderr,"%s: no terminating", isok ? "-ok" : "-exec");
323
exit(1);
323
exit(EX_USAGE);
325
if (**ap == ';') break;
325
if (**ap == ';') break;
446
if (stat(filename, &sb)) {
446
if (stat(filename, &sb)) {
447
perror("stat");
447
perror("stat");
448
exit(1);
448
exit(EX_NOINPUT);
450
new = palloc(N_NEWER, find_newer);
450
new = palloc(N_NEWER, find_newer);
451
new->t_data = sb.st_mtime;
451
new->t_data = sb.st_mtime;
542
default:
542
default:
543
fprintf(stderr,"-type: unknown type");
543
fprintf(stderr,"-type: unknown type");
544
exit(1);
544
exit(EX_USAGE);
547
new = palloc(N_TYPE, find_type);
547
new = palloc(N_TYPE, find_type);
93
if (next->type == N_CLOSEPAREN) {
93
if (next->type == N_CLOSEPAREN) {
94
if (subplan == NULL) {
94
if (subplan == NULL) {
95
fprintf(stderr,"(): empty inner expression");
95
fprintf(stderr,"(): empty inner expression");
96
exit(1);
96
exit(EX_USAGE);
98
node->p_data[0] = subplan;
98
node->p_data[0] = subplan;
99
node->type = N_EXPR;
99
node->type = N_EXPR;
135
if (expr->type == N_CLOSEPAREN) {
135
if (expr->type == N_CLOSEPAREN) {
136
fprintf(stderr,"): no beginning '('");
136
fprintf(stderr,"): no beginning '('");
137
exit(1);
137
exit(EX_USAGE);
140
/* add the expression to our result plan */
140
/* add the expression to our result plan */
184
if (node == NULL) {
184
if (node == NULL) {
185
fprintf(stderr,"!: no following expression");
185
fprintf(stderr,"!: no following expression");
186
exit(1);
186
exit(EX_USAGE);
188
if (node->type == N_OR) {
188
if (node->type == N_OR) {
189
fprintf(stderr,"!: nothing between ! and -o");
189
fprintf(stderr,"!: nothing between ! and -o");
190
exit(1);
190
exit(EX_USAGE);
192
if (notlevel % 2 != 1) next = node;
192
if (notlevel % 2 != 1) next = node;
193
else next->p_data[0] = node;
193
else next->p_data[0] = node;
234
if (next->type == N_OR) {
234
if (next->type == N_OR) {
235
if (result == NULL) {
235
if (result == NULL) {
236
fprintf(stderr,"-o: no expression before -o");
236
fprintf(stderr,"-o: no expression before -o");
237
exit(1);
237
exit(EX_USAGE);
239
next->p_data[0] = result;
239
next->p_data[0] = result;
240
next->p_data[1] = or_squish(plan);
240
next->p_data[1] = or_squish(plan);
241
if (next->p_data[1] == NULL) {
241
if (next->p_data[1] == NULL) {
242
fprintf(stderr,"-o: no expression after -o");
242
fprintf(stderr,"-o: no expression after -o");
243
exit(1);
243
exit(EX_USAGE);
245
return(next);
245
return(next);
104
#ifdef CLIENT_TIMEOUT
104
#ifdef CLIENT_TIMEOUT
105
if (total_delay/1000 >= env_timeout ) {
105
if (total_delay/1000 >= env_timeout ) {
106
fprintf(stderr, "\rRemote server not responding.\n");
106
fprintf(stderr, "\rRemote server not responding.\n");
107
exit(1);
107
exit(EX_UNAVAILABLE);
110
idle_delay = idle_delay * 4 / 3;
110
idle_delay = idle_delay * 4 / 3;
128
continue;
128
continue;
129
default:
129
default:
130
perror("sendto");
130
perror("sendto");
131
exit(1);
131
exit(EX_IOERR);
134
/* Check if w_delay is within limits */
134
/* Check if w_delay is within limits */
205
if(client_intr_state == 2) {
205
if(client_intr_state == 2) {
206
if(!key_persists) client_done();
206
if(!key_persists) client_done();
207
exit(1);
207
exit(EX_TEMPFAIL);
210
#ifdef DEBUG
210
#ifdef DEBUG
221
static RETSIGTYPE client_intr (int signum)
221
static RETSIGTYPE client_intr (int signum)
223
switch(client_intr_state) {
223
switch(client_intr_state) {
224
case 0: exit(2);
224
case 0: exit(EX_TEMPFAIL);
225
case 1: client_intr_state = 2; break;
225
case 1: client_intr_state = 2; break;
226
case 2: exit(3);
226
case 2: exit(EX_TEMPFAIL);
228
#ifndef RELIABLE_SIGNALS
228
#ifndef RELIABLE_SIGNALS
229
signal(SIGINT,client_intr);
229
signal(SIGINT,client_intr);
242
if((myfd = _x_udp(env_listen_on,&myport)) == -1) {
242
if((myfd = _x_udp(env_listen_on,&myport)) == -1) {
243
perror("socket open");
243
perror("socket open");
244
exit(1);
244
exit(EX_OSERR);
247
if(_x_adr(host,port,&server_addr) == -1) {
247
if(_x_adr(host,port,&server_addr) == -1) {
248
perror("server addr");
248
perror("server addr");
249
exit(1);
249
exit(EX_OSERR);
252
client_init_key(server_addr.sin_addr.s_addr,port,getpid());
252
client_init_key(server_addr.sin_addr.s_addr,port,getpid());
63
if(flock(lock_fd,LOCK_EX) == -1) {
63
if(flock(lock_fd,LOCK_EX) == -1) {
64
perror("flock");
64
perror("flock");
65
exit(1);
65
exit(EX_OSERR);
67
if(read(lock_fd,&okey,sizeof(okey)) == -1) {
67
if(read(lock_fd,&okey,sizeof(okey)) == -1) {
68
perror("read"); exit(1);
68
perror("read"); exit(EX_OSERR);
70
if(lseek(lock_fd,0L,0) == -1) {
70
if(lseek(lock_fd,0L,0) == -1) {
71
perror("seek");
71
perror("seek");
72
exit(1);
72
exit(EX_OSERR);
74
return(okey);
74
return(okey);
80
key=nkey;
80
key=nkey;
81
if(write(lock_fd,&key,sizeof(key)) == -1) {
81
if(write(lock_fd,&key,sizeof(key)) == -1) {
82
perror("write");
82
perror("write");
83
exit(1);
83
exit(EX_OSERR);
85
if(lseek(lock_fd,0L,0) == -1) {
85
if(lseek(lock_fd,0L,0) == -1) {
86
perror("seek");
86
perror("seek");
87
exit(1);
87
exit(EX_OSERR);
89
if(flock(lock_fd,LOCK_UN) == -1) {
89
if(flock(lock_fd,LOCK_UN) == -1) {
90
perror("unflock");
90
perror("unflock");
91
exit(1);
91
exit(EX_OSERR);
130
if(lockf(lock_fd,F_LOCK,sizeof(okey)) == -1) {
130
if(lockf(lock_fd,F_LOCK,sizeof(okey)) == -1) {
131
perror("lockf");
131
perror("lockf");
132
exit(1);
132
exit(EX_OSERR);
134
if(read(lock_fd,&okey,sizeof(okey)) == -1) {
134
if(read(lock_fd,&okey,sizeof(okey)) == -1) {
135
perror("read");
135
perror("read");
136
exit(1);
136
exit(EX_OSERR);
138
if(lseek(lock_fd,0L,0) == -1) {
138
if(lseek(lock_fd,0L,0) == -1) {
139
perror("seek");
139
perror("seek");
140
exit(1);
140
exit(EX_OSERR);
142
return(okey);
142
return(okey);
148
key=nkey;
148
key=nkey;
149
if(write(lock_fd,&key,sizeof(key)) == -1) {
149
if(write(lock_fd,&key,sizeof(key)) == -1) {
150
perror("write");
150
perror("write");
151
exit(1);
151
exit(EX_OSERR);
153
if(lseek(lock_fd,0L,0) == -1) {
153
if(lseek(lock_fd,0L,0) == -1) {
154
perror("seek");
154
perror("seek");
155
exit(1);
155
exit(EX_OSERR);
157
if(lockf(lock_fd,F_ULOCK,sizeof(key)) == -1) {
157
if(lockf(lock_fd,F_ULOCK,sizeof(key)) == -1) {
158
perror("unlockf");
158
perror("unlockf");
159
exit(1);
159
exit(EX_OSERR);
200
if(lockf(lock_fd,F_LOCK,2) == -1) {
200
if(lockf(lock_fd,F_LOCK,2) == -1) {
201
perror("lockf");
201
perror("lockf");
202
exit(1);
202
exit(EX_OSERR);
204
return(*share_key);
204
return(*share_key);
209
*share_key = key;
209
*share_key = key;
210
if(lockf(lock_fd,F_ULOCK,2) == -1) {
210
if(lockf(lock_fd,F_ULOCK,2) == -1) {
211
perror("unlockf");
211
perror("unlockf");
212
exit(1);
212
exit(EX_OSERR);
229
if((lock_key = ftok(key_string,238)) == -1) {
229
if((lock_key = ftok(key_string,238)) == -1) {
230
perror("ftok");
230
perror("ftok");
231
exit(1);
231
exit(EX_OSERR);
233
if((lock_shm = shmget(lock_key,2*sizeof(unsigned int),IPC_CREAT|0666)) == -1) {
233
if((lock_shm = shmget(lock_key,2*sizeof(unsigned int),IPC_CREAT|0666)) == -1) {
234
perror("shmget");
234
perror("shmget");
235
exit(1);
235
exit(EX_OSERR);
237
if(!(share_key = (unsigned int *) shmat(lock_shm,(char*)0,0))) {
237
if(!(share_key = (unsigned int *) shmat(lock_shm,(char*)0,0))) {
238
perror("shmat");
238
perror("shmat");
239
exit(1);
239
exit(EX_OSERR);
317
if(semop(lock_sem,&sem,1) == -1 )
317
if(semop(lock_sem,&sem,1) == -1 )
319
perror("semop");
319
perror("semop");
320
exit(1);
320
exit(EX_OSERR);
322
return(*share_key);
322
return(*share_key);
333
*share_key = key;
333
*share_key = key;
334
if(semop(lock_sem,&sem,1) == -1) {
334
if(semop(lock_sem,&sem,1) == -1) {
335
perror("semop");
335
perror("semop");
336
exit(1);
336
exit(EX_OSERR);
357
if((lock_key = ftok(key_string,238)) == -1) {
357
if((lock_key = ftok(key_string,238)) == -1) {
358
perror("ftok");
358
perror("ftok");
359
exit(1);
359
exit(EX_OSERR);
361
if((lock_shm = shmget(lock_key,2*sizeof(unsigned int),IPC_CREAT|0666)) == -1) {
361
if((lock_shm = shmget(lock_key,2*sizeof(unsigned int),IPC_CREAT|0666)) == -1) {
362
perror("shmget");
362
perror("shmget");
363
exit(1);
363
exit(EX_OSERR);
365
if(!(share_key = (unsigned int *) shmat(lock_shm,(char*)0,0))) {
365
if(!(share_key = (unsigned int *) shmat(lock_shm,(char*)0,0))) {
366
perror("shmat");
366
perror("shmat");
367
exit(1);
367
exit(EX_OSERR);
370
if((lock_sem = semget(lock_key,0,0)) == -1) {
370
if((lock_sem = semget(lock_key,0,0)) == -1) {
377
if(semctl(lock_sem,0,SETVAL,sun) == -1)
377
if(semctl(lock_sem,0,SETVAL,sun) == -1)
379
perror("semctl setval");
379
perror("semctl setval");
380
exit(1);
380
exit(EX_OSERR);
382
*share_key = key;
382
*share_key = key;
390
if(semop(lock_sem,&sem,1) == -1) {
390
if(semop(lock_sem,&sem,1) == -1) {
391
perror("semop");
391
perror("semop");
392
exit(1);
392
exit(EX_OSERR);
400
if (shmdt((char *)share_key) < 0)
400
if (shmdt((char *)share_key) < 0)
402
perror("shmdt");
402
perror("shmdt");
403
exit(1);
403
exit(EX_OSERR);
405
/* check if we are only one process holding lock */
405
/* check if we are only one process holding lock */
406
rc = semctl(lock_sem,1,GETVAL);
406
rc = semctl(lock_sem,1,GETVAL);
407
if (rc == -1)
407
if (rc == -1)
409
perror("semctl");
409
perror("semctl");
410
exit(1);
410
exit(EX_OSERR);
412
if (rc == 1)
412
if (rc == 1)
3
bin_PROGRAMS=fcatcmd fcdcmd fducmd ffindcmd fgetcmd fgrabcmd fhostcmd \
3
bin_PROGRAMS=fcatcmd fcdcmd fducmd ffindcmd fgetcmd fgrabcmd fhostcmd \
4
flscmd fmkdir fprocmd fput frmcmd frmdircmd fver fspmerge \
4
flscmd fmkdir fprocmd fput frmcmd frmdircmd fver fspmerge \
5
fstatcmd fmvcmd fbye
5
fstatcmd fmvcmd fbye fsetupcmd
7
LDADD=-L../common -L../bsd_src -L../client -lclient -lcommon -lbsdfsp $(EX_LIBS)
7
LDADD=-L../common -L../bsd_src -L../client -lclient -lcommon -lbsdfsp $(EX_LIBS)
10
fcdcmd_SOURCES=fcdcmd.c printpro.c
10
fcdcmd_SOURCES=fcdcmd.c printpro.c
11
fprocmd_SOURCES=printpro.c fprocmd.c
11
fprocmd_SOURCES=printpro.c fprocmd.c
12
noinst_HEADERS=printpro.h fhost.h merge.h
12
noinst_HEADERS=printpro.h fhost.h merge.h
13
fhostcmd_SOURCES=fhostcmd.c fspprof.l
13
fhostcmd_SOURCES=fhostcmd.c fspprof.l fhost.c
14
fhostcmd_LDADD=$(LDADD)
14
fhostcmd_LDADD=$(LDADD)
15
fsetupcmd_SOURCES=fsetupcmd.c fspsites.l fhost.c
16
fsetupcmd_LDADD=$(LDADD)
16
fspmerge_LDADD=fcatcmd_m.o fcdcmd_m.o fducmd_m.o ffindcmd_m.o fgetcmd_m.o \
18
fspmerge_LDADD=fcatcmd_m.o fcdcmd_m.o fducmd_m.o ffindcmd_m.o fgetcmd_m.o \
17
fgrabcmd_m.o fhostcmd_m.o flscmd_m.o fmkdir_m.o fprocmd_m.o \
19
fgrabcmd_m.o fhostcmd_m.o flscmd_m.o fmkdir_m.o fprocmd_m.o \
18
fput_m.o frmcmd_m.o frmdircmd_m.o fver_m.o fmvcmd_m.o \
20
fput_m.o frmcmd_m.o frmdircmd_m.o fver_m.o fmvcmd_m.o \
19
fstatcmd_m.o fbye_m.o $(LDADD)
21
fstatcmd_m.o fbye_m.o fhost.o $(LDADD)
21
fgetcmd_CFLAGS:=-DCOMMAND_GET
23
fgetcmd_CFLAGS:=-DCOMMAND_GET
31
#define FSP_STAT stat
31
#define FSP_STAT stat
36
#include "fhost.h"
34
#include "fhost.h"
38
static const char *home="/";
36
static const char *home="/";
40
static struct fsp_host *host;
41
static int hostsize=0;
42
static int tryfile=0;
37
static int tryfile=0;
44
/* allocate and init fsp_host structure */
39
45
struct fsp_host * init_host(void)
40
/* generated lex parser */
46
{
41
extern FILE *yyin;
47
struct fsp_host *h;
42
int yylex(void);
49
h=malloc(sizeof(struct fsp_host));
58
h->alias=calloc(1,sizeof(char *));
71
void add_host_alias(struct fsp_host *h, const char *name)
76
h->alias=realloc(h->alias,sizeof(char *)*(i+2));
77
h->alias[i]=strdup(name);
81
void add_host(struct fsp_host *h)
86
host=realloc(host,sizeof(struct fsp_host)*(hostsize+1));
89
perror("host realloc");
92
memcpy(host+hostsize,h,sizeof(struct fsp_host));
97
static struct fsp_host *find_host(const char *name)
101
if(name==NULL || hostsize==0 ) return NULL;
102
for(i=0;i<hostsize;i++)
105
if(!strcmp(host[i].hostname,name)) return &host[i];
107
if(!strcmp(host[i].hostaddr,name)) return &host[i];
109
while(host[i].alias[j])
111
if(!strcmp(host[i].alias[j],name)) return &host[i];
118
static void host_usage (void) /* print usage message */
45
static void host_usage (void) /* print usage message */
121
fprintf(stderr," [-o timeout] [-t trace] [-w password]\n");
48
fprintf(stderr," [-o timeout] [-t trace] [-w password]\n");
122
fprintf(stderr," [-f filename] [-h [number|name]] [-c | -b]\n");
49
fprintf(stderr," [-f filename] [-h [number|name]] [-c | -b]\n");
123
fprintf(stderr," [host port [directory] | abbreviation]\n");
50
fprintf(stderr," [host port [directory] | abbreviation]\n");
124
exit(0);
51
exit(EX_OK);
127
/* get data out of resource file */
54
/* get data out of resource file */
150
fclose(input);
77
fclose(input);
153
static void list_prof_file (void) /* list resource file */
156
for(i=0;i<hostsize;i++)
158
printf("host: %s port: %d\n",(host[i].hostname?host[i].hostname : host[i].hostaddr),(host[i].port<=0? 21 : host[i].port));
164
int main (int argc, char ** argv)
80
int main (int argc, char ** argv)
166
int optletter,csh,lhost=0;
82
int optletter,csh,lhost=0;
168
const char *filename=NULL;
84
const char *filename=NULL;
169
char *log;
85
char *log;
170
struct passwd *pw=0L;
86
struct passwd *pw=0L;
173
struct fsp_host *setup=NULL;
87
struct fsp_host *setup=NULL;
175
log = (char *)getlogin();
89
log = (char *)getlogin();
249
if (filename || argc==1) { /* list only */
163
if (filename || argc==1) { /* list only */
250
parse_prof_file_new(filename);
164
parse_prof_file_new(filename);
251
list_prof_file();
165
list_prof_file();
252
exit(0);
166
exit(EX_OK);
255
if (setup->delay>=0) {
169
if(setup->hostname==NULL && setup->hostaddr==NULL)
256
if (csh) printf("setenv FSP_DELAY %d;\n",setup->delay);
170
{
257
else printf("FSP_DELAY=%d;\nexport FSP_DELAY;\n",setup->delay);
171
fprintf(stderr,"fhost: No host given!\n");
258
}
172
exit(EX_USAGE);
259
if (setup->local_port>=0) {
173
}
260
if (csh) printf("setenv FSP_LOCALPORT %d;\n",setup->local_port);
174
print_host_setup(setup,csh,lhost);
261
else printf("FSP_LOCALPORT=%d;\nexport FSP_LOCALPORT;\n",setup->local_port);
175
exit(EX_OK);
263
if (setup->trace>=0) {
265
if (setup->trace) printf("setenv FSP_TRACE;\n");
266
else printf("unsetenv FSP_TRACE;\n");
268
if (setup->trace) printf("FSP_TRACE;\nexport FSP_TRACE;\n");
269
else printf("unset FSP_TRACE;\n");
272
if (setup->timeout>=0) {
273
if (csh) printf("setenv FSP_TIMEOUT %d;\n",setup->timeout);
274
else printf("FSP_TIMEOUT=%d;\nexport FSP_TIMEOUT;\n",setup->timeout);
276
if (setup->port>=0) {
277
if (csh) printf("setenv FSP_PORT %d;\n",setup->port);
278
else printf("FSP_PORT=%d;\nexport FSP_PORT;\n",setup->port);
280
if (setup->local_dir) {
281
if (csh) printf("setenv FSP_LOCAL_DIR ");
282
else printf("FSP_LOCAL_DIR=");
283
for (p=setup->local_dir;*p && *p!='\n' && *p!=' ';p++) printf("%c",*p);
284
if (csh) printf(";\n");
285
else printf(";\nexport FSP_LOCAL_DIR;\n");
287
if (setup->password) {
288
if (csh) printf("setenv FSP_PASSWORD ");
289
else printf("FSP_PASSWORD=");
290
for (p=setup->password;*p && *p!='\n' && *p!=' ';p++) printf("%c",*p);
291
if (csh) printf(";\n");
292
else printf(";\nexport FSP_PASSWORD;\n");
294
if (setup->hostname || setup->hostaddr) {
295
if (csh) printf("setenv FSP_HOST ");
296
else printf("FSP_HOST=");
297
if(setup->hostname) {
298
for(p = setup->hostname; *p && *p!='\n' && *p!= ' '; p++);
301
if(setup->hostaddr) {
302
for(p=setup->hostaddr;*p && *p !='\n' && *p!=' ';p++);
305
if(lhost==NAME && !setup->hostname) {
307
addr=inet_addr(setup->hostaddr);
308
if ( (hp=gethostbyaddr((char *) &addr, sizeof(addr), AF_INET)))
309
setup->hostname= (char *)hp->h_name;
311
if (!setup->hostname) lhost=NUMBER;
313
if (lhost==NUMBER && !setup->hostaddr) { /* look for number */
315
if ( (hp=gethostbyname(setup->hostname)))
316
setup->hostaddr=(char *)inet_ntoa(*(struct in_addr *) * hp->h_addr_list);
318
if (!setup->hostaddr) lhost=NAME;
321
if (setup->hostaddr) lhost=NUMBER;
322
else if (setup->hostname) lhost=NAME;
324
fprintf(stderr,"fhost: No host given!");
328
printf("%s", (lhost==NAME)? setup->hostname : setup->hostaddr);
329
if (csh) printf(";\n");
330
else printf(";\nexport FSP_HOST;\n");
331
if (!setup->dir) setup->dir="/"; /* if host is set we need this */
334
if (csh) printf("setenv FSP_DIR ");
335
else printf("FSP_DIR=");
336
for (p=setup->dir;*p && *p!='\n' && *p!=' ';p++) printf("%c",*p);
337
if (csh) printf(";\n");
338
else printf(";\nexport FSP_DIR;\n");
341
if (csh) printf("setenv FSP_NAME \"");
342
else printf("FSP_NAME=\"");
344
for (p=setup->hostname;*p && *p!='\n' && *p!=' ';p++) printf("%c",*p);
345
if (csh) printf("\";\n");
346
else printf("\";\nexport FSP_NAME;\n");
8
* It is only checked if neither ./.fsp_prof nor ~/.fsp_prof exist *
8
* It is only checked if neither ./.fsp_prof nor ~/.fsp_prof exist *
9
****************************************************************************/
9
****************************************************************************/
10
#define FSPRC SYSCONFDIR"/fsp_prof"
10
#define FSPRC SYSCONFDIR"/fsp_prof"
11
#define FSPSITESRC SYSCONFDIR"/fspsites"
12
/****************************************************************************
13
/****************************************************************************
13
* The basename of the local startup file *
14
* The basename of the local startup file *
14
****************************************************************************/
15
****************************************************************************/
15
#define FSPPROF ".fsp_prof"
16
#define FSPPROF ".fsp_prof"
17
#define FSPSITES ".fspsites"
17
/****************************************************************************
19
/****************************************************************************
18
* Define the CLIENT_TIMEOUT if you want the client programs to time out
20
* Define the CLIENT_TIMEOUT if you want the client programs to time out