Welcome to EZDefinition.com
Technological Concepts, Abbreviations & Definitions
Main Menu
Main categories
  • Operating Systems
  • Computer Hardware
  • Internet
  • Programming Languages
  • Multimedia
  • Software
  • Security and Encryption
  • Communications and Networking
  • Organizations
  • Books
  • Databases
  • Games
  • E-commerce

    [an error occurred while processing this directive]

  • EZDefinition Sponsor
    Please visit our sponsor Parosoft.com
    Related Links to System databases
    [an error occurred while processing this directive]
    System databases
    [an error occurred while processing this directive]
    Computer Technologies  Operating Systems  UNIX System databases

    System databases

    System databases

    The C library calls which query the databases are, amongst others,
    getpwnam get password data by name
    getpwuid get password data by uid
    getgrnam get group data by name
    gethostent get entry in hosts database
    getnetgrent get entry in netgroups database
    getservbyname get servive by name
    getservbyport get service by port
    get protobyname get protocol by name
    For a complete list and how to use these, see the UNIX manual.
    The following example shows how to read the password file of the system. The functions used here can be used regardless of whether the network information service (NIS) is in use. The data are returned in a structure which is defined in ´/usr/include/pwd.h'.
    /******************************************************************/
    /* */
    /* Read the passwd file by name and sequentially */
    /* */
    /******************************************************************/

    #include <unistd.h>
    #include <pwd.h>

    main ()

    { uid_t uid;
    struct passwd *pw;

    uid = getuid();

    pw = getpwuid(uid);

    printf ("Your login name is %s\n",pw->pw_name);

    printf ("Now here comes the whole file!\n\n");

    setpwent();

    while (getpwent())
    {
    printf ("%s:%s:%s\n",pw->pw_name,pw->pw_gecos,pw->pw_dir);
    }

    endpwent();
    }


    [an error occurred while processing this directive]

    [an error occurred while processing this directive]
     

    All Rights Reserved

    Terms of usage   Please read our privacy stetment
    Copyright © 1999-2006 EZDefinition.com

     

    [an error occurred while processing this directive]