GRASS 8 Programmer's Manual 8.6.0dev(2026)-55de52a352
Loading...
Searching...
No Matches
whoami.c File Reference

GIS Library - Login name functions. More...

#include <unistd.h>
#include <stdlib.h>
#include <pwd.h>
#include <grass/gis.h>
Include dependency graph for gis/whoami.c:

Go to the source code of this file.

Functions

const charG_whoami (void)
 Gets user's name.
 

Detailed Description

GIS Library - Login name functions.

SPDX-FileCopyrightText: 2001-2009 GRASS Development Team SPDX-License-Identifier: GPL-2.0-or-later

Author
Original author CERL

Definition in file gis/whoami.c.

Function Documentation

◆ G_whoami()

const char * G_whoami ( void  )

Gets user's name.

Returns a pointer to a string containing the user's login name.

Tries getlogin() first, then goes to the password file. However, some masscomp getlogin() fails in ucb universe because the ttyname(0) rotuine fails in ucb universe. So we check for this, too.

Returns
pointer to string ("anonymous" by default)

Definition at line 32 of file gis/whoami.c.

References AMI_STREAM< T >::AMI_STREAM(), G_initialize_done(), G_is_initialized(), G_store(), and name.

Referenced by G__script(), G_init_all(), G_open_mail(), Rast_short_history(), Vect__init_head(), and Vect_hist_command().