dis_sql/src/esql.cxx
/* The following routine adds a component (directory or filename) to an
 * existing directory name.  It does the right thing regardless of
 * whether the original directory string ends in a separator character
 * or not.  The result is malloced and must be freed by the caller.
 */
The following routine adds a component (directory or filename) to an
existing directory name.  It does the right thing regardless of
whether the original directory string ends in a separator character
or not.  The result is malloced and must be freed by the caller.
The following routine adds a component ( directory or filename ) to an existing directory name . It does the right thing regardless of whether the original directory string ends in a separator character or not . The result is malloced and must be freed by the caller .
static char* concat_path(const char* basepath, const char* component) {
    size_t blen = strlen(basepath);
    size_t clen = strlen(component);
#ifdef ISO_CPP_HEADERS
    char* result = (char*)std::malloc(blen + clen + 2);
#else
    char* result = (char*)malloc(blen + clen + 2);
#endif
    strcpy(result, basepath);
    if (basepath[blen - 1] != PATH_SEPARATOR) {
        result[blen++] = PATH_SEPARATOR;
    }
    strcpy(result + blen, component);
    return result;
}
static char * concat_path ( const char * basepath , const char * component ) { size_t blen = strlen ( basepath ) ; size_t clen = strlen ( component ) ; #ifdef ISO_CPP_HEADERS char * result = ( char * ) std :: malloc ( blen + clen + 2 ) ; #else char * result = ( char * ) malloc ( blen + clen + 2 ) ; #endif strcpy ( result , basepath ) ; if ( basepath [ blen - 1 ] != PATH_SEPARATOR ) { result [ blen ++ ] = PATH_SEPARATOR ; } strcpy ( result + blen , component ) ; return result ; }
The following routine adds a component (directory or filename) to an
 existing directory name.
The following routine adds a component ( directory or filename ) to an existing directory name .