model_server/project/src/proj_restore.cxx
// returns 1 on success
//         0 on failure
returns 1 on success
0 on failure
returns 1 on success 0 on failure
int prjParser::extract_flags (char *buf_ptr, PRJ_field fld)
{
    Initialize(prjParser::extract_flags);
    int ret = 0;
    if (!buf_ptr || !buf_ptr[0])
	return ret;
    char *flags   = (fld == PRJ_phys) ? pline.phys_flags : pline.model_flags;
    char *del_str = strstr(buf_ptr, prjDELEMETER);
    if (!del_str) {
	if (OSapi_strncmp (buf_ptr, NULL_NAME, OSapi_strlen(NULL_NAME)) == 0) {
	    ret = 1;
	    if (fld == PRJ_model)
		pline.model_name = NULL_NAME;
	}
    } else {
	del_str[0] = 0;
	{
	    genString tmp; char *buf_tmp = 0;
	    project_path_sys_vars_translate( buf_ptr, tmp);
	    buf_tmp = (char *)tmp;
	    genString& trg = (fld == PRJ_phys) ? pline.phys_name : pline.model_name;
	    char *cvt_ptr = 0;
	    trg = create_path_2DIS_no_realpath( buf_tmp, &cvt_ptr );
	    if (cvt_ptr) free (cvt_ptr);
	}
	del_str[0] = prjDELEMETER[0];
	del_str = del_str + OSapi_strlen(prjDELEMETER);
	for (int i = 0 ; i < PRJ_Flag_Last && del_str[i] ; i++)
	    flags[i] = del_str[i];
	flags[PRJ_Flag_Last] = 0;
	ret = 1;
    }
    return ret;
}
int prjParser :: extract_flags ( char * buf_ptr , PRJ_field fld ) { Initialize ( prjParser :: extract_flags ) ; int ret = 0 ; if ( ! buf_ptr || ! buf_ptr [ 0 ] ) return ret ; char * flags = ( fld == PRJ_phys ) ? pline . phys_flags : pline . model_flags ; char * del_str = strstr ( buf_ptr , prjDELEMETER ) ; if ( ! del_str ) { if ( OSapi_strncmp ( buf_ptr , NULL_NAME , OSapi_strlen ( NULL_NAME ) ) == 0 ) { ret = 1 ; if ( fld == PRJ_model ) pline . model_name = NULL_NAME ; } } else { del_str [ 0 ] = 0 ; { genString tmp ; char * buf_tmp = 0 ; project_path_sys_vars_translate ( buf_ptr , tmp ) ; buf_tmp = ( char * ) tmp ; genString & trg = ( fld == PRJ_phys ) ? pline . phys_name : pline . model_name ; char * cvt_ptr = 0 ; trg = create_path_2DIS_no_realpath ( buf_tmp , & cvt_ptr ) ; if ( cvt_ptr ) free ( cvt_ptr ) ; } del_str [ 0 ] = prjDELEMETER [ 0 ] ; del_str = del_str + OSapi_strlen ( prjDELEMETER ) ; for ( int i = 0 ; i < PRJ_Flag_Last && del_str [ i ] ; i ++ ) flags [ i ] = del_str [ i ] ; flags [ PRJ_Flag_Last ] = 0 ; ret = 1 ; } return ret ; }
returns 1 on success
0 on failure
returns 1 on success 0 on failure
// All flags and file names are supposed to be zero at this point // and does not need to be cleaned