chiark / gitweb /
Infrastructure: Split the files into subdirectories.
[mLib] / ui / quis.c
CommitLineData
0875b58f 1/* -*-c-*-
2 *
0875b58f 3 * Setting the program name
4 *
5 * (c) 1998 Straylight/Edgeware
6 */
7
d4efbcd9 8/*----- Licensing notice --------------------------------------------------*
0875b58f 9 *
10 * This file is part of the mLib utilities library.
11 *
12 * mLib is free software; you can redistribute it and/or modify
c846879c 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.
d4efbcd9 16 *
0875b58f 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
c846879c 20 * GNU Library General Public License for more details.
d4efbcd9 21 *
c846879c 22 * You should have received a copy of the GNU Library General Public
0bd98442 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.
0875b58f 26 */
27
0875b58f 28/*----- Header files ------------------------------------------------------*/
29
30#include <stdarg.h>
31#include <stdio.h>
32#include <stdlib.h>
33#include <string.h>
34
35#include "quis.h"
36
37/*----- Global variables --------------------------------------------------*/
38
39const char *pn__name = "<UNNAMED>"; /* Program name */
40
41/*----- Functions provided ------------------------------------------------*/
42
43/* --- @quis@ --- *
44 *
45 * Arguments: ---
46 *
47 * Returns: Pointer to the program name.
48 *
49 * Use: Returns the program name.
50 */
51
52const char *quis(void) { return (QUIS); }
53
54/* --- @ego@ --- *
55 *
56 * Arguments: @const char *p@ = pointer to program name
57 *
58 * Returns: ---
59 *
60 * Use: Tells mLib what the program's name is.
61 */
62
63#ifndef PATHSEP
64# if defined(__riscos)
65# define PATHSEP '.'
66# elif defined(__unix) || defined(unix)
67# define PATHSEP '/'
68# else
69# define PATHSEP '\\'
70# endif
71#endif
72
73void ego(const char *p)
74{
75 const char *q = p;
76 while (*q) {
77 if (*q++ == PATHSEP)
78 p = q;
79 }
1c66031e 80 if (*p == '-')
81 p++;
0875b58f 82 pn__name = p;
83}
84
f826a458 85#undef PATHSEP
86
0875b58f 87/*----- That's all, folks -------------------------------------------------*/