libexplain  1.4.D001
Functions
libexplain/program_name.h File Reference

obtain the name of the program More...

Go to the source code of this file.

Functions

const char * explain_program_name_get (void)
void explain_program_name_set (const char *name)
void explain_program_name_assemble (int yesno)

Detailed Description

obtain the name of the program

Definition in file program_name.h.


Function Documentation

void explain_program_name_assemble ( int  yesno)

The explain_option_assemble_program_name_set option is used to override any EXPLAIN_OPTIONS or default setting as to whether or not the explain_output_error, explain_output_error_and_die and explain_output_warning functions should include the program name at the start the messages.

If not explicitly set, is controlled by the EXPLAIN_OPTIONS environemnt variable, or defaults to false if not set there either.

Parameters:
yesnotrue (non-zero) to include the program name, zero (false) to omit the program name.
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.
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.