/////////////////////////////////////////////////////////////////////////// // / // Split the components of a CGI result string into / // individual sub strings / // / // For example the string / // name=Your+name&action=%2B10%25&log=~mas/log / // / // is composed of three named elements: / // / // Element String associated with element / // name Your name / // action +10% / // log /usr/staff/mas/log / // / // (C) M.A.Smith University of Brighton / // Permission is granted to use this code / // provided this declaration and copyright notice remains intact. / // 21 October 1995 / // / // / // I m p l e m e n t a t i o n / /////////////////////////////////////////////////////////////////////////// #ifndef CLASS_PARSE_IMP #define CLASS_PARSE_IMP #include "parse.hpp" #include #include #ifndef NO_MAP # include #endif Parse::Parse( char list[] ) { the_str = NULL; set( list ); } Parse::~Parse() { if ( the_str != NULL ) { // Release storage delete [] the_str; } } void Parse::set( char list[] ) { if ( the_str != NULL ) { // Release storage delete [] the_str; } the_length = strlen( list ); // Length of string the_str = new char[the_length+1]; // Allocate area strcpy( the_str, list ); // copy to } char *Parse::get_item( char name[], int pos, bool file ) { int len = strlen( name ); int cur_tag = 1; for( int i=0; ipw_dir; // Users home directory } int len_root = strlen(root); int len_path = len_root + strlen(rest); char *new_path = new char[len_path+1]; // Dynamic string strcpy( &new_path[0], root ); // abs user path strcpy( &new_path[len_root], rest ); // remainder return new_path; } else { return path; } #endif return path; } #endif