Annotation of parser3/src/targets/cgi/fixopt.C, revision 1.1

1.1     ! paf         1: /** @file
        !             2:        Parser: CGI: fixing command line options decl.
        !             3: 
        !             4:        Copyright (c) 2001, 2002 ArtLebedev Group (http://www.artlebedev.com)
        !             5:        Author: Alexandr Petrosian <paf@design.ru> (http://paf.design.ru)
        !             6: */
        !             7: 
        !             8: static const char* IDENT_FIXOPT_C="$Date: 2002/08/01 11:41:21 $";
        !             9: 
        !            10: #include "pa_config_includes.h"
        !            11: 
        !            12: #include "pa_common.h"
        !            13: #include "pa_exception.h"
        !            14: 
        !            15: // defines
        !            16: 
        !            17: #define MAX_ARGV 100
        !            18: 
        !            19: void fixopt(
        !            20:        int beforec, char **beforev, 
        !            21:        int& afterc, char **& aafterv) {
        !            22: 
        !            23:        static char *afterv[MAX_ARGV];
        !            24:        aafterv=afterv;
        !            25:        afterc=0;
        !            26: 
        !            27:        if(beforec)
        !            28:                afterv[afterc++]=beforev[0]; // do not fix argv[0]
        !            29: 
        !            30:        for(int i=1; i<beforec-1; i++) {
        !            31:                char *many=beforev[i];
        !            32:                while(char *one=lsplit(&many, ' ')) {
        !            33:                        if(afterc==MAX_ARGV-1 /*so not to check later*/)
        !            34:                                throw Exception(0,
        !            35:                                        0,
        !            36:                                        "too many command line arguments (more then %d)", MAX_ARGV-1);
        !            37:                        afterv[afterc++]=one;                           
        !            38:                }
        !            39:        }
        !            40: 
        !            41:        afterv[afterc++]=beforev[beforec-1];
        !            42: }

E-mail: