This is Unofficial EPICS BASE Doxygen Site
osdgetexec.c File Reference
#include <string.h>
#include <stdlib.h>
#include <osiFileName.h>
+ Include dependency graph for osdgetexec.c:

Go to the source code of this file.

Functions

char * epicsGetExecName (void)
 
char * epicsGetExecDir (void)
 

Function Documentation

char* epicsGetExecDir ( void  )

Return the absolute path of the directory containing the current executable.

Returns
NULL or the path. Caller must free()

Definition at line 18 of file osdgetexec.c.

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 * epicsGetExecName(void)
Definition: osdgetexec.c:9
char* epicsGetExecName ( void  )

Return the absolute path of the current executable.

Returns
NULL or the path. Caller must free()

Definition at line 7 of file osdgetexec.c.

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 }
char * strdup(const char *)
#define NULL
Definition: catime.c:38