util.c

Mon, 20 Apr 2020 10:14:32 -0500

author
Tuomo Valkonen <tuomov@iki.fi>
date
Mon, 20 Apr 2020 10:14:32 -0500
changeset 119
87e3bb5086e8
parent 117
c7ad4b23a277
permissions
-rw-r--r--

Convert README to markdown

0
86b7f6f9c5c0 Tailorization of trunk
tailor@f281.ttorni.ton.tut.fi
parents:
diff changeset
1 /*
86b7f6f9c5c0 Tailorization of trunk
tailor@f281.ttorni.ton.tut.fi
parents:
diff changeset
2 * libtu/util.c
86b7f6f9c5c0 Tailorization of trunk
tailor@f281.ttorni.ton.tut.fi
parents:
diff changeset
3 *
36
63cd573ffbcf trunk: changeset 39
tuomov
parents: 12
diff changeset
4 * Copyright (c) Tuomo Valkonen 1999-2002.
53
f8f9366b359c trunk: changeset 57
tuomov
parents: 36
diff changeset
5 *
f8f9366b359c trunk: changeset 57
tuomov
parents: 36
diff changeset
6 * You may distribute and modify this library under the terms of either
f8f9366b359c trunk: changeset 57
tuomov
parents: 36
diff changeset
7 * the Clarified Artistic License or the GNU LGPL, version 2.1 or later.
0
86b7f6f9c5c0 Tailorization of trunk
tailor@f281.ttorni.ton.tut.fi
parents:
diff changeset
8 */
86b7f6f9c5c0 Tailorization of trunk
tailor@f281.ttorni.ton.tut.fi
parents:
diff changeset
9
86b7f6f9c5c0 Tailorization of trunk
tailor@f281.ttorni.ton.tut.fi
parents:
diff changeset
10 #include <stdarg.h>
86b7f6f9c5c0 Tailorization of trunk
tailor@f281.ttorni.ton.tut.fi
parents:
diff changeset
11 #include <stdio.h>
86b7f6f9c5c0 Tailorization of trunk
tailor@f281.ttorni.ton.tut.fi
parents:
diff changeset
12 #include <stdlib.h>
86b7f6f9c5c0 Tailorization of trunk
tailor@f281.ttorni.ton.tut.fi
parents:
diff changeset
13 #include <string.h>
86b7f6f9c5c0 Tailorization of trunk
tailor@f281.ttorni.ton.tut.fi
parents:
diff changeset
14
117
c7ad4b23a277 locale.h name seems to conflict with system locale.h name on some systems
tuomov
parents: 112
diff changeset
15 #include "localex.h"
70
e866dc825481 trunk: changeset 1408
tuomov
parents: 62
diff changeset
16 #include "util.h"
e866dc825481 trunk: changeset 1408
tuomov
parents: 62
diff changeset
17 #include "misc.h"
0
86b7f6f9c5c0 Tailorization of trunk
tailor@f281.ttorni.ton.tut.fi
parents:
diff changeset
18
86b7f6f9c5c0 Tailorization of trunk
tailor@f281.ttorni.ton.tut.fi
parents:
diff changeset
19
86b7f6f9c5c0 Tailorization of trunk
tailor@f281.ttorni.ton.tut.fi
parents:
diff changeset
20 static const char *progname=NULL;
86b7f6f9c5c0 Tailorization of trunk
tailor@f281.ttorni.ton.tut.fi
parents:
diff changeset
21
86b7f6f9c5c0 Tailorization of trunk
tailor@f281.ttorni.ton.tut.fi
parents:
diff changeset
22
12
5fd153b29d40 trunk: changeset 15
tuomov
parents: 9
diff changeset
23 void libtu_init(const char *argv0)
0
86b7f6f9c5c0 Tailorization of trunk
tailor@f281.ttorni.ton.tut.fi
parents:
diff changeset
24 {
62
aae5facf9fc5 trunk: changeset 1318
tuomov
parents: 53
diff changeset
25 progname=argv0;
85
9f94b2e96e3b trunk: changeset 1934
tuomov
parents: 79
diff changeset
26
112
ccc57312b8d0 CF_NO_GETTEXT
Tuomo Valkonen <tuomov@iki.fi>
parents: 109
diff changeset
27 #ifndef CF_NO_GETTEXT
62
aae5facf9fc5 trunk: changeset 1318
tuomov
parents: 53
diff changeset
28 textdomain(simple_basename(argv0));
0
86b7f6f9c5c0 Tailorization of trunk
tailor@f281.ttorni.ton.tut.fi
parents:
diff changeset
29 #endif
86b7f6f9c5c0 Tailorization of trunk
tailor@f281.ttorni.ton.tut.fi
parents:
diff changeset
30 }
86b7f6f9c5c0 Tailorization of trunk
tailor@f281.ttorni.ton.tut.fi
parents:
diff changeset
31
86b7f6f9c5c0 Tailorization of trunk
tailor@f281.ttorni.ton.tut.fi
parents:
diff changeset
32
109
96a557abc364 Renamed `prog_execname` `libtu_progname` and added `libtu_progbasename`.
Tuomo Valkonen <tuomov@iki.fi>
parents: 85
diff changeset
33 const char *libtu_progname()
0
86b7f6f9c5c0 Tailorization of trunk
tailor@f281.ttorni.ton.tut.fi
parents:
diff changeset
34 {
62
aae5facf9fc5 trunk: changeset 1318
tuomov
parents: 53
diff changeset
35 return progname;
0
86b7f6f9c5c0 Tailorization of trunk
tailor@f281.ttorni.ton.tut.fi
parents:
diff changeset
36 }
86b7f6f9c5c0 Tailorization of trunk
tailor@f281.ttorni.ton.tut.fi
parents:
diff changeset
37
109
96a557abc364 Renamed `prog_execname` `libtu_progname` and added `libtu_progbasename`.
Tuomo Valkonen <tuomov@iki.fi>
parents: 85
diff changeset
38
96a557abc364 Renamed `prog_execname` `libtu_progname` and added `libtu_progbasename`.
Tuomo Valkonen <tuomov@iki.fi>
parents: 85
diff changeset
39 const char *libtu_progbasename()
96a557abc364 Renamed `prog_execname` `libtu_progname` and added `libtu_progbasename`.
Tuomo Valkonen <tuomov@iki.fi>
parents: 85
diff changeset
40 {
96a557abc364 Renamed `prog_execname` `libtu_progname` and added `libtu_progbasename`.
Tuomo Valkonen <tuomov@iki.fi>
parents: 85
diff changeset
41 const char *s=strrchr(progname, '/');
96a557abc364 Renamed `prog_execname` `libtu_progname` and added `libtu_progbasename`.
Tuomo Valkonen <tuomov@iki.fi>
parents: 85
diff changeset
42
96a557abc364 Renamed `prog_execname` `libtu_progname` and added `libtu_progbasename`.
Tuomo Valkonen <tuomov@iki.fi>
parents: 85
diff changeset
43 return (s==NULL ? progname : s+1);
96a557abc364 Renamed `prog_execname` `libtu_progname` and added `libtu_progbasename`.
Tuomo Valkonen <tuomov@iki.fi>
parents: 85
diff changeset
44 }
96a557abc364 Renamed `prog_execname` `libtu_progname` and added `libtu_progbasename`.
Tuomo Valkonen <tuomov@iki.fi>
parents: 85
diff changeset
45

mercurial