model_server/project/src/fileEntry.cxx
// Returns: 0 on success
//         -1 if file does not exist -or- permition is not granted
0 on success
1 if file does not exist -or- permition is not granted
0 on success 1 if file does not exist - or - permition is not granted
int fileEntry::access (int r_w, int *was_valid)
{
    int ret = 0;
    if ( !(r_w == R_OK || r_w == W_OK || r_w == X_OK || r_w || F_OK) )
	ret = OSapi_access ((char *)path, r_w);
    else {
	if ( (r_w == R_OK && !rok_is_valid) ||
	     (r_w == W_OK && !wok_is_valid) ||
	     (r_w == X_OK && !xok_is_valid) ||
	     (r_w == F_OK && !fok_is_valid) ) {
	    if (was_valid) *was_valid = 0;
	    ret = this->stat ((struct OStype_stat *)0, was_valid);
	} else
	    if (was_valid) *was_valid = 1;
	if (ret == 0) {
	    if (r_w == R_OK)
		ret = (_rok_ok) ? 0 : -1;
	    else if (r_w == W_OK)
		ret = (_wok_ok) ? 0 : -1;
	    else if (r_w == X_OK)
		ret = (_xok_ok) ? 0 : -1;
	    else if (r_w == F_OK)
		ret = (_fok_ok) ? 0 : -1;
	} else
	    ret = -1;
    }
    return ret;
}
int fileEntry :: access ( int r_w , int * was_valid ) { int ret = 0 ; if ( ! ( r_w == R_OK || r_w == W_OK || r_w == X_OK || r_w || F_OK ) ) ret = OSapi_access ( ( char * ) path , r_w ) ; else { if ( ( r_w == R_OK && ! rok_is_valid ) || ( r_w == W_OK && ! wok_is_valid ) || ( r_w == X_OK && ! xok_is_valid ) || ( r_w == F_OK && ! fok_is_valid ) ) { if ( was_valid ) * was_valid = 0 ; ret = this -> stat ( ( struct OStype_stat * ) 0 , was_valid ) ; } else if ( was_valid ) * was_valid = 1 ; if ( ret == 0 ) { if ( r_w == R_OK ) ret = ( _rok_ok ) ? 0 : -1 ; else if ( r_w == W_OK ) ret = ( _wok_ok ) ? 0 : -1 ; else if ( r_w == X_OK ) ret = ( _xok_ok ) ? 0 : -1 ; else if ( r_w == F_OK ) ret = ( _fok_ok ) ? 0 : -1 ; } else ret = -1 ; } return ret ; }
Returns: 0 on success
1 if file does not exist -or- permition is not granted
Returns : 0 on success 1 if file does not exist - or - permition is not granted