Rechercher une page de manuel
user.3bobcat
Langue: en
Version: 317224 (ubuntu - 07/07/09)
Section: 3 (Bibliothèques de fonctions)
Sommaire
NAME
FBB::User - Provides the /etc/passwd info of the current userSYNOPSIS
#include <bobcat/user>Linking option: -lbobcat
DESCRIPTION
This class retrieves the information of the current user from the information in /etc/passwd. The class is a simple wrapper class around the getpwent(3) function.NAMESPACE
FBBAll constructors, members, operators and manipulators, mentioned in this man-page, are defined in the namespace FBB.
INHERITS FROM
-CONSTRUCTORS
- o
- User():
The default constructor determines the current user's data. The proper completion of this constructor should be checked by calling the User::verify() member (see below). The copy constructor is available.
MEMBER FUNCTIONS
- o
- size_t groupid() const:
Returns the user's group-id. - o
- std::string homedir() const:
Returns the user's home directory (including a trailing /). - o
- std::string name() const:
Returns the user's user-name. - o
- std::string password() const:
Returns the user's encrypted password. But see also the BUGS section. - o
- std::string realname() const:
Returns the user's real name, as listed in the /etc/passwd's gecos field. - o
- std::string shell() const:
Returns the user's shell. - o
- size_t userid() const:
Returns the user's user-id. - o
- void verify() const:
This operator throws an Errno exception if the User constructor did not properly complete because the current user name could not be found in /etc/passwd. It should be called before using any other User member (not required after using the copy constructor).
EXAMPLE
#include <bobcat/user> #include <iostream> using namespace std; using namespace FBB; int main() { User user; user.verify(); cout << "\n" "name : " << user.name() << "\n" << "password : " << user.password() << "\n" << "user id : " << user.userid() << "\n" << "group id : " << user.groupid() << "\n" << "real name : " << user.realname() << "\n" << "home dir : " << user.homedir() << "\n" << "shell : " << user.shell() << "\n" << endl; return 0; }
FILES
bobcat/user - defines the class interfaceSEE ALSO
bobcat(7), getpwent(3)BUGS
If the user is a member of multiple groups, only the group id listed in /etc/passwd is returned by groupid().If shadow passwording is used, the string returned by password() will probably not contain the encrypted password.
DISTRIBUTION FILES
- o
- bobcat_2.00.1-x.dsc: detached signature;
- o
- bobcat_2.00.1-x.tar.gz: source archive;
- o
- bobcat_2.00.1-x_i386.changes: change log;
- o
- libbobcat1_2.00.1-x_i386.deb: debian package holding the libraries;
- o
- libbobcat1-dev_2.00.1-x_i386.deb: debian package holding the libraries, headers and manual pages;
- o
- http://sourceforge.net/projects/bobcat: public archive location;
BOBCAT
Bobcat is an acronym of `Brokken's Own Base Classes And Templates'.COPYRIGHT
This is free software, distributed under the terms of the GNU General Public License (GPL).AUTHOR
Frank B. Brokken (f.b.brokken@rug.nl).Contenus ©2006-2024 Benjamin Poulain
Design ©2006-2024 Maxime Vantorre