0875b58f |
1 | /* -*-c-*- |
2 | * |
f826a458 |
3 | * $Id: quis.c,v 1.5 1999/10/04 21:44:06 mdw Exp $ |
0875b58f |
4 | * |
5 | * Setting the program name |
6 | * |
7 | * (c) 1998 Straylight/Edgeware |
8 | */ |
9 | |
c846879c |
10 | /*----- Licensing notice --------------------------------------------------* |
0875b58f |
11 | * |
12 | * This file is part of the mLib utilities library. |
13 | * |
14 | * mLib is free software; you can redistribute it and/or modify |
c846879c |
15 | * it under the terms of the GNU Library General Public License as |
16 | * published by the Free Software Foundation; either version 2 of the |
17 | * License, or (at your option) any later version. |
18 | * |
0875b58f |
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 |
c846879c |
22 | * GNU Library General Public License for more details. |
23 | * |
24 | * You should have received a copy of the GNU Library General Public |
0bd98442 |
25 | * License along with mLib; if not, write to the Free |
26 | * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, |
27 | * MA 02111-1307, USA. |
0875b58f |
28 | */ |
29 | |
30 | /*----- Revision history --------------------------------------------------* |
31 | * |
32 | * $Log: quis.c,v $ |
f826a458 |
33 | * Revision 1.5 1999/10/04 21:44:06 mdw |
34 | * Undefine PATHSEP when finished with. |
35 | * |
0bd98442 |
36 | * Revision 1.4 1999/05/06 19:51:35 mdw |
37 | * Reformatted the LGPL notice a little bit. |
38 | * |
c846879c |
39 | * Revision 1.3 1999/05/05 18:50:31 mdw |
40 | * Change licensing conditions to LGPL. |
41 | * |
1c66031e |
42 | * Revision 1.2 1999/02/28 15:16:29 mdw |
43 | * quis: remove the leading `-' from the name, in case we're invoked as a |
44 | * login shell. |
45 | * |
46 | * Revision 1.1.1.1 1998/06/17 23:44:42 mdw |
47 | * Initial version of mLib |
0875b58f |
48 | * |
49 | */ |
50 | |
51 | /*----- Header files ------------------------------------------------------*/ |
52 | |
53 | #include <stdarg.h> |
54 | #include <stdio.h> |
55 | #include <stdlib.h> |
56 | #include <string.h> |
57 | |
58 | #include "quis.h" |
59 | |
60 | /*----- Global variables --------------------------------------------------*/ |
61 | |
62 | const char *pn__name = "<UNNAMED>"; /* Program name */ |
63 | |
64 | /*----- Functions provided ------------------------------------------------*/ |
65 | |
66 | /* --- @quis@ --- * |
67 | * |
68 | * Arguments: --- |
69 | * |
70 | * Returns: Pointer to the program name. |
71 | * |
72 | * Use: Returns the program name. |
73 | */ |
74 | |
75 | const char *quis(void) { return (QUIS); } |
76 | |
77 | /* --- @ego@ --- * |
78 | * |
79 | * Arguments: @const char *p@ = pointer to program name |
80 | * |
81 | * Returns: --- |
82 | * |
83 | * Use: Tells mLib what the program's name is. |
84 | */ |
85 | |
86 | #ifndef PATHSEP |
87 | # if defined(__riscos) |
88 | # define PATHSEP '.' |
89 | # elif defined(__unix) || defined(unix) |
90 | # define PATHSEP '/' |
91 | # else |
92 | # define PATHSEP '\\' |
93 | # endif |
94 | #endif |
95 | |
96 | void ego(const char *p) |
97 | { |
98 | const char *q = p; |
99 | while (*q) { |
100 | if (*q++ == PATHSEP) |
101 | p = q; |
102 | } |
1c66031e |
103 | if (*p == '-') |
104 | p++; |
0875b58f |
105 | pn__name = p; |
106 | } |
107 | |
f826a458 |
108 | #undef PATHSEP |
109 | |
0875b58f |
110 | /*----- That's all, folks -------------------------------------------------*/ |