environment/confstrtest.c

///////////////////////////////////////////////////////////////////////////////
// Filename: confstrtest.c
///////////////////////////////////////////////////////////////////////////////
// Purpose: get configuration dependent string variables 
///////////////////////////////////////////////////////////////////////////////
// History:
// ========
//
// Date     Time     Name      Description   
// -------- -------- --------  ------------------------------------------------
// 96/02/06 02:01:07 muellerg: created
//
///////////////////////////////////////////////////////////////////////////////


// Feature test switches ///////////////////////////// Feature test switches //

#define __USE_POSIX_2



// System headers /////////////////////////////////////////// System headers //

#include <unistd.h>
#include <stdlib.h>
#include <iostream.h>




// Local headers ///////////////////////////////////////////// Local headers //
    /* NONE */



// Macros /////////////////////////////////////////////////////////// Macros //
    /* NONE */



// File scope objects /////////////////////////////////// File scope objects //
    /* NONE */



// External variables, functions, and classes ///////////// External objects //
    /* NONE */



// Signal catching functions ///////////////////// Signal catching functions //
    /* NONE */



// Structures, unions, and class definitions /////////////////// Definitions //
    /* NONE */



// Functions and class implementation /// Functions and class implementation //
    /* NONE */



// Main /////////////////////////////////////////////////////////////// Main //
    /* NONE */


int 
main(void)
{
#ifdef sun
    cout << "confstr not supported by sun" << endl;
#else
    char *pathbuf; size_t n;

    n = confstr(_CS_PATH,NULL,(size_t)0);

    if ((pathbuf = (char *)malloc(n)) == NULL) abort();
        confstr(_CS_PATH, pathbuf, n);

    cout << pathbuf << endl;

    free(pathbuf);
#endif
    return 0;
}