Commit eed2e1fa authored by Pontus Freyhult's avatar Pontus Freyhult

Now handle GNU options --version and --help correctly.

Rev: src/sftp/ChangeLog:1.8
Rev: src/sftp/gnu_stuff.c:1.2
Rev: src/sftp/gnu_stuff.h:1.2
Rev: src/sftp/lsftp.c:1.4
parent 3adb4699
2002-02-25 Pontus <pont@it.uu.se>
* lsftp.c (main): Readded support for GNU-thingies (was lost
somehow some time ago).
* gnu_stuff.c (lsftp_welcome): Included Niels in welcome message.
(version_option): dito.
(do_gnu_stuff): New function to check for GNU-thingies.
* configure.ac: Added ugly fix to detect if we're part of the main
lsh distribution. If we are, assume $bindir/lshg works
satisfactionary.
......
......@@ -28,7 +28,7 @@
void lsftp_welcome()
{
printf( "Welcome to %s %s by Pontus Sköld and various.\n", PACKAGE, VERSION );
printf( "Welcome to %s %s by Pontus Sköld, Niels Möller and various.\n", PACKAGE, VERSION );
printf( "This program is free software, for more information\n" );
printf( "please see the file COPYING or type about, you may\n" );
printf( "also use help or ? to get help.\n\n");
......@@ -38,14 +38,14 @@ void lsftp_welcome()
void help_option()
{
printf("Usage:");
printf("Usage:\n");
exit(0); /* Exit successfully */
}
void version_option()
{
printf("%s %s\n", PACKAGE, VERSION);
printf("Copyright (C) 2001, Pontus Sköld and various contributors\n\n");
printf("Copyright (C) Pontus Sköld, Niels Möller and various contributors\n\n");
printf("This program is free software, you may distribute it under the\n");
printf("terms of the GNU Genereal Public License. \n\n");
......@@ -58,4 +58,20 @@ void version_option()
exit(0); /* Exit successfully */
}
void do_gnu_stuff( const char** argv )
{
const char** current = argv;
while( *current ) /* More arguments? */
{
if( !strcmp( *current, "--version" ) )
version_option();
if( !strcmp( *current, "--help" ) )
help_option();
current++;
}
}
......@@ -36,4 +36,5 @@ void help_option(void);
void version_option(void);
void lsftp_welcome(void);
void do_gnu_stuff( const char** argv );
#endif
......@@ -170,6 +170,8 @@ int main(int argc, char** argv, char** envp)
{
int i;
do_gnu_stuff( argv ); /* Check for GNU thingies and act accordingly */
lsftp_rl_init(); /* Safe even if built for noninteractive use only */
mgetenv_init( envp ); /* Tell mgetenv about environment parameters */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment