delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/2000/09/02/15:30:58

Sender: rich AT phekda DOT freeserve DOT co DOT uk
Message-ID: <39B1535D.75A11A6E@phekda.freeserve.co.uk>
Date: Sat, 02 Sep 2000 20:22:05 +0100
From: Richard Dawe <rich AT phekda DOT freeserve DOT co DOT uk>
X-Mailer: Mozilla 4.51 [en] (X11; I; Linux 2.2.14 i586)
X-Accept-Language: de,fr
MIME-Version: 1.0
To: DJGPP workers <djgpp-workers AT delorie DOT com>
Subject: Re: Doc for __dosexec_find_on_path()
References: <39B0DC84 DOT 389C0357 AT phekda DOT freeserve DOT co DOT uk> <9427-Sat02Sep2000153710+0300-eliz AT is DOT elta DOT co DOT il>
Reply-To: djgpp-workers AT delorie DOT com

This is a multi-part message in MIME format.
--------------1C990F9D576F7AB854E62D54
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

Hello.

Eli Zaretskii wrote:
> 
> Richard Dawe wrote:
> > I suggest that this file is called dxfndpth.txh
[snip]
> I'd rather add your contribution to dosexec.txh.  Do you see something
> wrong with that?

No, I don't. At the time I thought you could only have one node per .txh
file, but there is no such limit. Please find attached a diff for
dosexec.txh. I also broke the the spawn*() declarations across two lines,
rather than relying on automatic breaks.

> > While writing this document, I noticed that dosexec.c does not have an
> > interpreter for .cmd files. I think these are Windows NT batch files,
> > perhaps OS/2. I wonder how easy it would be to add support for these?
> 
> What would that support have to be?  If you need cmd.exe to get *.cmd
> files supported, what would a program do when cmd.exe isn't available?

Don't we need an interpreter line for '.cmd' using
__dosexec_command_exec()? I've probably misunderstood the point of this
table. Also, if you cannot invoke .cmd files without using the extension,
I guess it will be handled by script_exec() anyway.

> > I was also wondering about my dpmi.h patch.
> 
> It's on my todo list, don't worry.  I'll get to it, eventually...

Okey dokey.

Thanks, bye, Rich =]

-- 
Richard Dawe
[ mailto:richdawe AT bigfoot DOT com | http://www.bigfoot.com/~richdawe/ ]
--------------1C990F9D576F7AB854E62D54
Content-Type: text/plain; charset=us-ascii;
 name="dosexec.txh.diff"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
 filename="dosexec.txh.diff"

*** src/libc/dos/process/dosexec.txh	Sun Mar 21 01:38:28 1999
--- /home/rich/src/djgpp/src/libc/dos/process/dosexec.txh	Sat Sep  2 19:18:31 2000
***************
*** 5,18 ****
  #include <process.h>
  
  int spawnl(int mode, const char *path, const char *argv0, ..., NULL);
! int spawnle(int mode, const char *path, const char *argv0, ..., NULL /*, const char **envp */);
  int spawnlp(int mode, const char *path, const char *argv0, ..., NULL);
! int spawnlpe(int mode, const char *path, const char *argv0, ..., NULL /*, const char **envp */);
  
  int spawnv(int mode, const char *path, const char **argv);
! int spawnve(int mode, const char *path, const char **argv, const char **envp);
  int spawnvp(int mode, const char *path, const char **argv);
! int spawnvpe(int mode, const char *path, const char **argv, const char **envp);
  @end example
  
  @subheading Description
--- 5,22 ----
  #include <process.h>
  
  int spawnl(int mode, const char *path, const char *argv0, ..., NULL);
! int spawnle(int mode, const char *path, const char *argv0, ..., NULL
!             /*, const char **envp */);
  int spawnlp(int mode, const char *path, const char *argv0, ..., NULL);
! int spawnlpe(int mode, const char *path, const char *argv0, ..., NULL
!              /*, const char **envp */);
  
  int spawnv(int mode, const char *path, const char **argv);
! int spawnve(int mode, const char *path, const char **argv,
!             const char **envp);
  int spawnvp(int mode, const char *path, const char **argv);
! int spawnvpe(int mode, const char *path, const char **argv,
!              const char **envp);
  @end example
  
  @subheading Description
***************
*** 127,129 ****
--- 131,175 ----
  spawnvpe(P_WAIT, "gcc", args, environ);
  @end example
  
+ @c -----------------------------------------------------------------------
+ 
+ @node __dosexec_find_on_path, process
+ @subheading Syntax
+ 
+ @example
+ #include <stdio.h>
+ #include <libc/dosexec.h>
+ 
+ char *__dosexec_find_on_path(const char *program,
+                              char *envp[], char *buf);
+ @end example
+ 
+ @subheading Description
+ 
+ This function searches for a program using a given path.  The program is
+ searched for using a known set of exectuable extensions, e.g. @file{.exe}.
+ These executable extensions are described for the @code{spawn*()} function
+ (@pxref{spawn*}).
+ 
+ Pass the program name in @var{program}, the environment array in @var{envp}
+ and the output buffer in @var{buf}.  @var{envp} is an array of pointers
+ to the environment; it must be terminated with a @code{NULL} pointer.
+ @var{buf} must be large enough to hold @samp{FILENAME_MAX} bytes.
+ 
+ @var{envp} controls where @code{__dosexec_find_on_path()} looks for
+ the program.  If @var{envp} is @code{NULL}, then only the current directory
+ is searched.  If @var{envp} contains the @samp{PATH} environment variable
+ in the form @samp{PATH=@dots{}}, then its directories are also searched.
+ The global variable @code{environ} is usually passed for @var{envp}.
+ 
+ @subheading Return Value
+ 
+ If the function finds the program, with or without one of the known
+ executable extensions, either in the current directory or along
+ the @samp{PATH} as recorded in @var{envp}, it puts the full pathname
+ into @var{buf} and returns a pointer to @var{buf}.  Otherwise, it returns
+ @code{NULL}.
+ 
+ @subheading Portability
+ 
+ @portability !ansi, !posix


--------------1C990F9D576F7AB854E62D54--

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019