fsetupcmd got -l option

This commit is contained in:
Radim Kolar 2009-09-15 17:01:16 +02:00
parent a241a9f1d6
commit 588f449894
5 changed files with 48 additions and 7 deletions

View File

@ -30,6 +30,8 @@ Version NEXT
fsetupcmd - reject port number > 65535
fsetupcmd - code cleaned a bit. Error message is now
fsetup: No host given! instead of fhost:
fsetupcmd got -l option. It lists all known fsp servers collected
from .fspsites files.
Version 2.8.1b25 - 10 Sep 2009
GNU autotools build system was entirely replaced by SCons

View File

@ -114,6 +114,24 @@ void list_prof_file (void) /* list resource file */
return;
}
void list_sites_file (void) /* list resource file in fspsites format */
{
int i,j;
for(i=0;i<hostsize;i++)
{
printf("%-20s%6d %-20s",(host[i].hostname?host[i].hostname : host[i].hostaddr),(host[i].port<=0? 21 : host[i].port), host[i].dir != NULL? host[i].dir : "/");
j=0;
while(host[i].alias[j])
{
printf(" %s",host[i].alias[j]);
j++;
}
printf("\n");
}
return;
}
/* lhost: type of FSP_HOST address NUMBER or NAME */
int print_host_setup(struct fsp_host *setup,int csh,int lhost)
{

View File

@ -20,3 +20,4 @@ void add_host_alias(struct fsp_host *h, const char *name);
struct fsp_host *find_host(const char *name);
void list_prof_file (void); /* list resource file */
int print_host_setup(struct fsp_host *setup,int csh,int lhost);
void list_sites_file(void); /* list resource file in fspsites format */

View File

@ -37,7 +37,7 @@ int sitewrap(void);
static void setup_usage (void) /* print usage message */
{
fprintf(stderr,"Usage: fsetup [ -b | -c ] host port [directory] | abbreviation \n");
fprintf(stderr,"Usage: fsetup -l | [ -b | -c ] host port [directory] | abbreviation \n");
exit(EX_OK);
}
@ -84,7 +84,7 @@ int main (int argc, char ** argv)
}
setup=init_host();
while ((optletter=getopt(argc, argv,"hbc?")) != EOF)
while ((optletter=getopt(argc, argv,"hbcl?")) != EOF)
switch (optletter) {
case '?':
case 'h':
@ -95,6 +95,10 @@ int main (int argc, char ** argv)
case 'c':
csh=1;
break;
case 'l':
parse_prof_file_new();
list_sites_file();
exit(0);
default:
setup_usage();
break;

View File

@ -1,8 +1,8 @@
.TH FSETUP 1 "Jan 2005" FSP
.TH FSETUP 1 "Sep 2009" FSP
.SH NAME
fsetupcmd, fsetup \- set environment variables
.SH SYNOPSIS
.B fsetup [-c | -b] host port [directory] | abbreviation
.B fsetup -l | [-c | -b] host port [directory] | abbreviation
.SH DESCRIPTION
.LP
.B fsetup
@ -28,6 +28,7 @@ searching in the resource file will be done.
Since programs cannot change environment variables of their parent shell in
a simple way, it is recommended that the user defines a shell alias or
function to make it possible.
.LP
.B csh
example:
.LP
@ -35,10 +36,19 @@ example:
alias fsetup 'eval `fsetupcmd \!*`'
.fi
.SH FILES
.LP
~/.fspsites
.br
/etc/fspsites
For more information about the resource file confer
.I fspsites(5).
.SH ARGUMENTS
.LP
.B -l
-- displays sites from
.I fspsites(5)
.LP
.B -b
-- output Bourne shell code
.LP
@ -47,11 +57,17 @@ For more information about the resource file confer
.SH ENVIRONMENT
.LP
The environment variables associate this program with a FSP database and are
set (resp. unset) if needed. See fsp_env(7) for list.
set (resp. unset) if needed. See
.I fsp_env(7)
for list.
.SH HISTORY
.LP
This is rewrite of classic fsetup Perl script which was used in gold
This program is rewrite of classic fsetup Perl script which was used in gold
FSP era to parse standard fspsites format used for FSP site list exchange.
It was used as replacement for
.I fsp_prof(5)
because it is much easier to use and more suitable for exchanging
lists of public fsp servers.
.SH "SEE ALSO"
.PD
fcatcmd(1), fcdcmd(1), fgetcmd(1), fgrabcmd(1), flscmd(1), fmkdir(1),