diff options
author | Kenneth Heafield <github@kheafield.com> | 2012-10-22 12:07:20 +0100 |
---|---|---|
committer | Kenneth Heafield <github@kheafield.com> | 2012-10-22 12:07:20 +0100 |
commit | 5f98fe5c4f2a2090eeb9d30c030305a70a8347d1 (patch) | |
tree | 9b6002f850e6dea1e3400c6b19bb31a9cdf3067f /jam-files/engine/option.c | |
parent | cf9994131993b40be62e90e213b1e11e6b550143 (diff) | |
parent | 21825a09d97c2e0afd20512f306fb25fed55e529 (diff) |
Merge remote branch 'upstream/master'
Conflicts:
Jamroot
bjam
decoder/Jamfile
decoder/cdec.cc
dpmert/Jamfile
jam-files/sanity.jam
klm/lm/Jamfile
klm/util/Jamfile
mira/Jamfile
Diffstat (limited to 'jam-files/engine/option.c')
-rw-r--r-- | jam-files/engine/option.c | 94 |
1 files changed, 0 insertions, 94 deletions
diff --git a/jam-files/engine/option.c b/jam-files/engine/option.c deleted file mode 100644 index d25e5e8a..00000000 --- a/jam-files/engine/option.c +++ /dev/null @@ -1,94 +0,0 @@ -/* - * Copyright 1993, 1995 Christopher Seiwald. - * - * This file is part of Jam - see jam.c for Copyright information. - */ - -# include "jam.h" -# include "option.h" - -/* - * option.c - command line option processing - * - * {o >o - * \<>) "Process command line options as defined in <option.h>. - * Return the number of argv[] elements used up by options, - * or -1 if an invalid option flag was given or an argument - * was supplied for an option that does not require one." - */ - -int getoptions( int argc, char * * argv, char * opts, bjam_option * optv ) -{ - int i; - int optc = N_OPTS; - - memset( (char *)optv, '\0', sizeof( *optv ) * N_OPTS ); - - for ( i = 0; i < argc; ++i ) - { - char *arg; - - if ( ( argv[ i ][ 0 ] != '-' ) || - ( ( argv[ i ][ 1 ] != '-' ) && !isalpha( argv[ i ][ 1 ] ) ) ) - continue; - - if ( !optc-- ) - { - printf( "too many options (%d max)\n", N_OPTS ); - return -1; - } - - for ( arg = &argv[ i ][ 1 ]; *arg; ++arg ) - { - char * f; - - for ( f = opts; *f; ++f ) - if ( *f == *arg ) - break; - - if ( !*f ) - { - printf( "Invalid option: -%c\n", *arg ); - return -1; - } - - optv->flag = *f; - - if ( f[ 1 ] != ':' ) - { - optv++->val = "true"; - } - else if ( arg[ 1 ] ) - { - optv++->val = &arg[1]; - break; - } - else if ( ++i < argc ) - { - optv++->val = argv[ i ]; - break; - } - else - { - printf( "option: -%c needs argument\n", *f ); - return -1; - } - } - } - - return i; -} - - -/* - * Name: getoptval() - find an option given its character. - */ - -char * getoptval( bjam_option * optv, char opt, int subopt ) -{ - int i; - for ( i = 0; i < N_OPTS; ++i, ++optv ) - if ( ( optv->flag == opt ) && !subopt-- ) - return optv->val; - return 0; -} |