www.delorie.com/gnu/docs/dld/dld_5.html   search  
 
Buy GNU books!


Dld

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

3.1.1 Locating the Executable File

The path name of the executing process as required by dld_init might not be easily obtained all the time. Not all systems pass the entire path name of the executable file as the first argument (argv[0]) to main. In order to obtain the full path of the executable file, dld_init uses the dld_find_program function.

Function: char *dld_find_progname (const char *progname)
dld_find_progname returns the absolute path name of the file that would be executed if command were given as a command. It looks up the environment variable PATH, searches in each of the directory listed for progname, and returns the absolute path name for the first occurrence.

Note: If the current process is executed using the execve call without passing the correct path name as argument 0, dld_find_program (argv[0]) will also fail to locate the executable file.

dld_find_executable returns zero if command is not found in any of the directories listed in PATH.


  webmaster   donations   bookstore     delorie software   privacy  
  Copyright © 2003   by The Free Software Foundation     Updated Jun 2003  

Please take a moment to fill out this visitor survey
You can help support this site by visiting the advertisers that sponsor it! (only once each, though)