Example #1
0
/*
 * tempFileSetup - set up a temp file with data in it
 */
static void tempFileSetup( file **cfile, char *list[], int maxlist, int indent,
                           bool makelower )
{
    int         j, boff, i, k;
    char        dd[FILENAME_MAX];

    /*
     * allocate temporary file structures
     */
    *cfile = FileAlloc( NULL );

    /*
     * copy data into buffer and create fcbs
     */
    j = boff = 0;
    while( j < maxlist ) {
        strcpy( dd, list[j] );
        if( makelower ) {
            FileLower( dd );
        }
        k = strlen( dd );
        if( k + 2 + indent + boff > MAX_IO_BUFFER ) {
            CreateFcbData( *cfile, boff );
            (*cfile)->fcbs.tail->non_swappable = TRUE;
            boff = 0;
        }
        if( indent ) {
            for( i = 0; i < indent; i++ ) {
                ReadBuffer[boff + i] = ' ';
            }
        }
        memcpy( &ReadBuffer[boff + indent], dd, k );
        /* Don't change the CRLF state of the current file */
        if( EditFlags.WriteCRLF ) {
            memcpy( &ReadBuffer[boff + k + indent], crlf, 2 );
            boff += 2;
        } else {
            memcpy( &ReadBuffer[boff + k + indent], &crlf[1], 1 );
            boff += 1;
        }
        boff += k + indent;
        j++;
    }

    CreateFcbData( *cfile, boff );
    (*cfile)->fcbs.tail->non_swappable = TRUE;

} /* tempFileSetup */
Example #2
0
/*
 * tempFileSetup - set up a temp file with data in it
 */
static void tempFileSetup( file **cfile, char *list[], int maxlist, int indent,
                           bool makelower )
{
    int         j, boff, i, k;
    char        dd[FILENAME_MAX];

    /*
     * allocate temporary file structures
     */
    *cfile = FileAlloc( NULL );

    /*
     * copy data into buffer and create fcbs
     */
    j = boff = 0;
    while( j < maxlist ) {
        strcpy( dd, list[j] );
        if( makelower ) {
            FileLower( dd );
        }
        k = strlen( dd );
        if( k + 2 + indent + boff > MAX_IO_BUFFER ) {
            CreateFcbData( *cfile, boff );
            (*cfile)->fcbs.tail->non_swappable = true;
            boff = 0;
        }
        if( indent ) {
            for( i = 0; i < indent; i++ ) {
                ReadBuffer[boff + i] = ' ';
            }
        }
        memcpy( &ReadBuffer[boff + indent], dd, k );
        ReadBuffer[boff + k + indent] = CR;
        ReadBuffer[boff + k + indent + 1] = LF;
        boff += k + indent + 2;
        j++;
    }

    CreateFcbData( *cfile, boff );
    (*cfile)->fcbs.tail->non_swappable = true;

} /* tempFileSetup */