Example #1
0
/*
 * MakeExpressionNonRegular - escape out all magical chars
 */
void MakeExpressionNonRegular( char *str )
{
    int         i, j = 0, k;
    char        *foo;

    k = strlen( str );
    foo = StaticAlloc();
    for( i = 0; i < k; i++ ) {
        if( str[i] == '/' ) {
            foo[j++] = '\\';
        } else if( strchr( META, str[i] ) != NULL ) {
            foo[j++] = '\\';
            if( IsMagicCharRegular( str[i] ) ) {
                j--;
            }
        }
        foo[j++] = str[i];
    }
    foo[j] = 0;
    strcpy( str, foo );
    StaticFree( foo );

} /* MakeExpressionNonRegular */
Example #2
0
static vi_rc getFile( char *fname )
{
    char        dir[MAX_STR];
    char        *dirptr, ch;
    vi_rc       rc;

    NextWord1( fname, dir );
    rc = EditFile( dir, FALSE );
    if( rc != ERR_NO_ERR ) {
        return( rc );
    }
    dirptr = dir;
    if( isFgrep ) {
        if( caseIgn ) {
            ch = '~';
        } else {
            ch = '@';
        }
        dirptr += 2;
        strcpy( dirptr, origString );
        MakeExpressionNonRegular( dirptr );
        dirptr--;
        *dirptr = ch;
        if( IsMagicCharRegular( ch ) ) {
            dirptr--;
            *dirptr = '\\';
        }
    } else {
        strcpy( dir, origString );
    }
    AddString2( &(EditVars.FindHist.data[EditVars.FindHist.curr % EditVars.FindHist.max] ), origString );
    EditVars.FindHist.curr += 1;
    ColorFind( dirptr, FINDFL_NOERROR );
    SetLastFind( origString );
    return( rc );
}