environment/systemtype.c

///////////////////////////////////////////////////////////////////////////////
// Filename: systemtype.c
///////////////////////////////////////////////////////////////////////////////
// Purpose: get some information over system where program is running
///////////////////////////////////////////////////////////////////////////////
// History:
// ========
//
// Date     Time     Name      Description   
// -------- -------- --------  ------------------------------------------------
// 96/02/06 02:08:54 muellerg: created
//
///////////////////////////////////////////////////////////////////////////////


// Feature test switches ///////////////////////////// Feature test switches //
    /* NONE */


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

#include <stdlib.h>
#include <sys/utsname.h>


// Local headers ///////////////////////////////////////////// Local headers //

#include "../common.h"



// 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 //

int
main(int argc, char *argv[])
{
    error.set_program_name(argv[0]);    

    struct utsname un;

    if ( uname( &un ) == -1 ) // if -1, an error occurred 
        error.system("uname failed");

    // no errors occurred, so display the fields 

    cout    << "System name:\t" << un.sysname << endl
            << "Node name:\t"   << un.nodename << endl
            << "Release:\t"     << un.release << endl
            << "Version:\t"     << un.version << endl
            << "Machine:\t"     << un.machine << endl

#ifdef _HPUX_SOURCE
            << "ID Number:\t"   << un.__idnumber << endl
#endif

            << endl;

    return(EXIT_SUCCESS);
}