view doc/progname.texi @ 40156:066c585853e5

tests: Accommodate a shell that is not in /bin/sh. * tests/init.sh (setup_): Set srcdir and builddir. (BOURNE_SHELL): New variable. * modules/acl-tests (Depends-on): Add 'test-framework-sh'. * modules/file-has-acl-tests (Depends-on): Likewise. * modules/copy-file-tests (Depends-on): Likewise. * tests/test-set-mode-acl-1.sh: Use the test framework. Invoke shell scripts through $BOURNE_SHELL. * tests/test-set-mode-acl-2.sh: Likewise. * tests/test-copy-acl-1.sh: Likewise. * tests/test-copy-acl-2.sh: Likewise. * tests/test-file-has-acl-1.sh: Likewise. * tests/test-file-has-acl-2.sh: Likewise. * tests/test-copy-file-1.sh: Likewise. * tests/test-copy-file-2.sh: Likewise. * tests/test-set-mode-acl.sh (builddir): Consider value set by the invoker. * tests/test-copy-acl.sh (builddir): Likewise. * tests/test-file-has-acl.sh (builddir): Likewise. * tests/test-copy-file.sh (builddir): Likewise. * tests/test-vc-list-files-cvs.sh: Don't create shims for executables in build-aux/. Instead, invoke shell scripts through $BOURNE_SHELL. * tests/test-vc-list-files-git.sh: Likewise.
author Bruno Haible <bruno@clisp.org>
date Sun, 27 Jan 2019 16:01:23 +0100
parents 7201768c5696
children
line wrap: on
line source

@node progname and getprogname
@section progname and getprogname

@c Copyright (C) 2007, 2009-2019 Free Software Foundation, Inc.

@c Permission is granted to copy, distribute and/or modify this document
@c under the terms of the GNU Free Documentation License, Version 1.3 or
@c any later version published by the Free Software Foundation; with no
@c Invariant Sections, no Front-Cover Texts, and no Back-Cover
@c Texts.  A copy of the license is included in the ``GNU Free
@c Documentation License'' file as part of this distribution.

Gnulib has two modules for retrieving the name of the currently executing
program: @code{progname} and @code{getprogname}.

@findex progname
@vindex program_name
The @code{progname} module defines a variable @code{program_name}.
It contains the name of the currently executing program, on all platforms.
But it cannot be used implicitly:  It requires that every @code{main}
function be modified to invoke @code{set_program_name (argv[0])} as one
of its first actions.

@findex getprogname
The @code{getprogname} module defines a function @code{getprogname()}.
It returns the name of the currently executing program, on most platforms.
The advantage of this module is that it can be used without prior
initializations.  But it has limitations:  In some rare situations, it
cannot determine the name; then it returns @code{"?"} instead.  And on
some platforms, it returns a truncated program name.

@findex error
The @code{error} function uses the @code{getprogname} module.