ReactOS 0.4.16-dev-334-g4d9f67c
getexecpath.c File Reference
#include <schily/mconfig.h>
#include <schily/types.h>
#include <schily/unistd.h>
#include <schily/string.h>
#include <schily/standard.h>
#include <schily/schily.h>
Include dependency graph for getexecpath.c:

Go to the source code of this file.

Functions

EXPORT chargetexecpath ()
 

Function Documentation

◆ getexecpath()

EXPORT char * getexecpath ( )

Definition at line 55 of file getexecpath.c.

56{
57#ifdef PATH_IMPL
58#ifdef METHOD_SYMLINK
59 char buf[1024];
61
62 len = readlink(SYMLINK_PATH, buf, sizeof (buf)-1);
63 if (len == -1)
64 return (NULL);
65 buf[len] = '\0';
66 return (strdup(buf));
67#endif
68#ifdef HAVE_PROC_PIDPATH /* Mac OS X */
69 char buf[1024];
70 int len;
71
72 len = proc_pidpath(getpid(), buf, sizeof (buf));
73 if (len == -1)
74 return (NULL);
75 return (strdup(buf));
76#endif
77#else
78 return (NULL);
79#endif
80}
#define NULL
Definition: types.h:112
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
GLenum GLsizei len
Definition: glext.h:6722
int readlink(const char *path, char *buf, size_t size)
int ssize_t
Definition: rosdhcp.h:48
_Check_return_ _CRTIMP char *__cdecl strdup(_In_opt_z_ const char *_Src)
#define getpid
Definition: wintirpc.h:52

Referenced by searchfileinpath().