ReactOS  0.4.10-dev-19-g39281f0
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

EXPORT char* getexecpath ( )

Definition at line 55 of file getexecpath.c.

Referenced by searchfileinpath().

56 {
57 #ifdef PATH_IMPL
58 #ifdef METHOD_SYMLINK
59  char buf[1024];
60  ssize_t len;
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 }
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
_Check_return_ _CRTIMP char *__cdecl strdup(_In_opt_z_ const char *_Src)
smooth NULL
Definition: ftsmooth.c:416
_CRTIMP int __cdecl getpid(void)
int ssize_t
Definition: rosdhcp.h:48
GLenum GLsizei len
Definition: glext.h:6722
int readlink(const char *path, char *buf, size_t size)