chiark / gitweb /
Commit as 2.1.0.
[mLib] / quis.3
CommitLineData
b6b9d458 1.\" -*-nroff-*-
fbf20b5b 2.TH quis 3 "22 May 1999" "Straylight/Edgeware" "mLib utilities library"
b6b9d458 3.SH NAME
4quis \- remember the program's name for use in messages
08da152e 5.\" @quis
6.\" @ego
7.\" @QUIS
4a74ab73 8.\" @pquis
b6b9d458 9.SH SYNOPSIS
10.nf
11.B "#include <mLib/quis.h>"
12
13.BI "void ego(const char *" p );
14.B "const char *quis(void);"
15.B "const char *QUIS;"
4a74ab73 16.BI "int pquis(FILE *" fp ", const char *" p );
b6b9d458 17.fi
18.SH DESCRIPTION
19The
20.B ego
21function should be called early in your program's initialization
22sequence, with the value of
23.B argv[0]
24as its argument. It will strip away leading path components, and a
25leading `\-' character (in case the program was called as a login
26shell), and keep the resulting short name for later.
27.PP
28The
29.B quis
30function returns the stored program name. There is also a macro
31.B QUIS
32which expands to the name of a global variable whose value is the string
33returned by
34.BR quis() .
35.PP
36Don't ask why it's done this way. There are raisins, but they're mostly
37hysterical.
38.PP
4a74ab73 39The function
40.B pquis
41is passed a file pointer
42.I fp
43and a string
44.IR p :
45it writes the string to the file, replacing every lone occurrence of the
46character
47.RB ` $ '
48by the program name. Pairs
49.RB (` $$ ')
50are written as single dollar signs. The return value is zero if
51everything went OK, or the constant
52.B EOF
53if there was an error.
54.PP
b6b9d458 55The program name is used in the messages produced by the
08da152e 56.BR die (3)
b6b9d458 57and
08da152e 58.BR moan (3)
b6b9d458 59functions.
08da152e 60.SH "SEE ALSO"
61.BR report (3),
62.BR mLib (3).
b6b9d458 63.SH AUTHOR
9b5ac6ff 64Mark Wooding, <mdw@distorted.org.uk>