This is Unofficial EPICS BASE Doxygen Site
osdgetexec.c
Go to the documentation of this file.
1 
2 #include <string.h>
3 #include <stdlib.h>
4 
5 #include <osiFileName.h>
6 
7 char *epicsGetExecName(void)
8 {
9  const char *raw = getexecname();
10  char *ret = NULL;
11  /* manpage says getexecname() might return a relative path. we treat this as an error */
12  if(raw[0]=='/') {
13  ret = strdup(raw);
14  }
15  return ret;
16 }
17 
18 char *epicsGetExecDir(void)
19 {
20  char *ret = epicsGetExecName();
21  if(ret) {
22  char *sep = strrchr(ret, '/');
23  if(sep) {
24  /* nil the charactor after the / */
25  sep[1] = '\0';
26  }
27  }
28  return ret;
29 }
char * strdup(const char *)
#define NULL
Definition: catime.c:38
char * epicsGetExecName(void)
Definition: osdgetexec.c:9
char * epicsGetExecDir(void)
Definition: osdgetexec.c:38