BRL-CAD
Loading...
Searching...
No Matches
user.h File Reference
#include "common.h"
#include "bu/defines.h"
Include dependency graph for user.h:

Go to the source code of this file.

Enumerations

enum  bu_name_type { BU_USER_ACCT , BU_USER_REAL , BU_USER_AUTO }
 

Functions

charbu_user_name (enum bu_user_type type, char *name, size_t size)
 

Enumeration Type Documentation

◆ bu_name_type

used to specify what name type is desired

Enumerator
BU_USER_ACCT 

user account name

BU_USER_REAL 

user real full name

BU_USER_AUTO 

either account or real

Definition at line 29 of file user.h.

Function Documentation

◆ bu_user_name()

char * bu_user_name ( enum bu_user_type  type,
char name,
size_t  size 
)

Routine for obtaining user names

Returns a given user's account name or real full name if available. May return "unknown" if the name is not available. If 'name' is empty, then the current user's name will be returned. If 'name' is not empty, then it is used as a case-insensitive lookup string.

If 'name' is NULL or size is 0, then dynamic memory will be allocated with bu_malloc() and returned.

char name[128] = {0};
(void)bu_user_name(BU_USER_AUTO, name, sizeof(name));
char *name = bu_user_name(BU_USER_REAL, "username", 0);
bu_free(name);
Definition dvec.h:74
void bu_free(void *ptr, const char *str)
@ BU_USER_ACCT
Definition user.h:30
@ BU_USER_AUTO
Definition user.h:32
@ BU_USER_REAL
Definition user.h:31
char * bu_user_name(enum bu_user_type type, char *name, size_t size)