libexplain  1.4.D001
Functions | Variables
libexplain/program_name.c File Reference
#include <libexplain/ac/limits.h>
#include <libexplain/ac/stdlib.h>
#include <libexplain/ac/string.h>
#include <libexplain/ac/sys/param.h>
#include <libexplain/fileinfo.h>
#include <libexplain/name_max.h>
#include <libexplain/program_name.h>

Go to the source code of this file.

Functions

static void explain_program_name_set_real (const char *name)
const char * explain_program_name_get (void)
void explain_program_name_set (const char *name)

Variables

static char progname [NAME_MAX+1]

Function Documentation

const char* explain_program_name_get ( void  )

The explain_program_name_get function may be used to obtain the command name of the process. Depending on how capable /proc is on your system, or, failing that, how capable lsof(1) is on your system, this may or may not produce a sensable result. It works well on Linux.

Returns:
pointer to string containing the command name (no slashes) of the calling process.

Definition at line 83 of file program_name.c.

void explain_program_name_set ( const char *  name)

The explain_program_name_set function may be used to set the libexplain libraries' idea of the command name of the calling process, setting the string to be returned by the explain_program_name_get function. This overrides the automatic behaviour, which can be quite desirable in commands that can be invoked with more than one name, e.g. if they are a hard link synoym.

This also sets the option to include the program name in all of the error messages issued by the explain_*_or_die functions.

Parameters:
nameThe name of the calling process.

Definition at line 129 of file program_name.c.

static void explain_program_name_set_real ( const char *  name) [static]

Definition at line 34 of file program_name.c.


Variable Documentation

char progname[NAME_MAX+1] [static]

Definition at line 30 of file program_name.c.