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