chiark / gitweb /
*.[ch]: Remove unnecessary header files.
[mLib] / ui / quis.c
1 /* -*-c-*-
2  *
3  * Setting the program name
4  *
5  * (c) 1998 Straylight/Edgeware
6  */
7
8 /*----- Licensing notice --------------------------------------------------*
9  *
10  * This file is part of the mLib utilities library.
11  *
12  * mLib is free software; you can redistribute it and/or modify
13  * it under the terms of the GNU Library General Public License as
14  * published by the Free Software Foundation; either version 2 of the
15  * License, or (at your option) any later version.
16  *
17  * mLib is distributed in the hope that it will be useful,
18  * but WITHOUT ANY WARRANTY; without even the implied warranty of
19  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
20  * GNU Library General Public License for more details.
21  *
22  * You should have received a copy of the GNU Library General Public
23  * License along with mLib; if not, write to the Free
24  * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
25  * MA 02111-1307, USA.
26  */
27
28 /*----- Header files ------------------------------------------------------*/
29
30 #include "quis.h"
31
32 /*----- Global variables --------------------------------------------------*/
33
34 const char *pn__name = "<UNNAMED>";     /* Program name */
35
36 /*----- Functions provided ------------------------------------------------*/
37
38 /* --- @quis@ --- *
39  *
40  * Arguments:   ---
41  *
42  * Returns:     Pointer to the program name.
43  *
44  * Use:         Returns the program name.
45  */
46
47 const char *quis(void) { return (QUIS); }
48
49 /* --- @ego@ --- *
50  *
51  * Arguments:   @const char *p@ = pointer to program name
52  *
53  * Returns:     ---
54  *
55  * Use:         Tells mLib what the program's name is.
56  */
57
58 #ifndef PATHSEP
59 #  if defined(__riscos)
60 #    define PATHSEP '.'
61 #  elif defined(__unix) || defined(unix)
62 #    define PATHSEP '/'
63 #  else
64 #    define PATHSEP '\\'
65 #  endif
66 #endif
67
68 void ego(const char *p)
69 {
70   const char *q = p;
71   while (*q) {
72     if (*q++ == PATHSEP)
73       p = q;
74   }
75   if (*p == '-')
76     p++;
77   pn__name = p;
78 }
79
80 #undef PATHSEP
81
82 /*----- That's all, folks -------------------------------------------------*/