mirror of
https://github.com/adtools/clib2.git
synced 2025-12-08 14:59:05 +00:00
- Small corrections...
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@15121 87f5fb63-7c3d-0410-a384-fd976d0f7a62
This commit is contained in:
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: unistd_execve.c,v 1.5 2006-08-02 11:07:57 obarthel Exp $
|
||||
* $Id: unistd_execve.c,v 1.6 2006-08-02 14:44:01 obarthel Exp $
|
||||
*
|
||||
* :ts=4
|
||||
*
|
||||
@ -83,7 +83,7 @@ find_resident_command(const char * command_name)
|
||||
|
||||
if(seg != NULL)
|
||||
{
|
||||
/* Check if that's a disable command or something else. */
|
||||
/* Check if that's a disabled command or something else. */
|
||||
if((seg->seg_UC < 0) && ((seg->seg_UC > CMD_INTERNAL) || (seg->seg_UC <= CMD_DISABLED)))
|
||||
{
|
||||
seg = NULL;
|
||||
@ -149,8 +149,8 @@ get_first_script_line(const char * path,char ** line_ptr)
|
||||
script_line_size = script_line_length + 10;
|
||||
}
|
||||
|
||||
/* Stop when we hit a line feed or unprintable character */
|
||||
if(c == '\n' || c < ' ' || (c >= 128 && c < 160))
|
||||
/* Stop when we hit a line feed or an unprintable character */
|
||||
if(c == '\n' || (c < ' ' && c != '\t' && c != '\r') || (c >= 128 && c < 160))
|
||||
break;
|
||||
|
||||
script_line[script_line_length++] = c;
|
||||
@ -594,7 +594,7 @@ build_arg_string(char *const argv[],char * arg_string)
|
||||
(*arg_string++) = '*';
|
||||
(*arg_string++) = s[j];
|
||||
}
|
||||
else if(s[j] == '\n')
|
||||
else if (s[j] == '\n')
|
||||
{
|
||||
(*arg_string++) = '*';
|
||||
(*arg_string++) = 'N';
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: unistd_execvp.c,v 1.4 2006-08-02 08:00:29 obarthel Exp $
|
||||
* $Id: unistd_execvp.c,v 1.5 2006-08-02 14:44:01 obarthel Exp $
|
||||
*
|
||||
* :ts=4
|
||||
*
|
||||
@ -96,8 +96,10 @@ int
|
||||
execvp(const char *command,char * const argv[])
|
||||
{
|
||||
char * command_buffer = NULL;
|
||||
size_t command_name_len,i;
|
||||
char * path_copy = NULL;
|
||||
int result = -1;
|
||||
BOOL found_path_separators;
|
||||
|
||||
/* Do not allow null command */
|
||||
if(command == NULL || (*command) == '\0')
|
||||
@ -106,14 +108,28 @@ execvp(const char *command,char * const argv[])
|
||||
goto out;
|
||||
}
|
||||
|
||||
command_name_len = strlen(command);
|
||||
|
||||
/* Check if there are any path separator characters in the
|
||||
command name. */
|
||||
found_path_separators = FALSE;
|
||||
|
||||
for(i = 0 ; i < command_name_len ; i++)
|
||||
{
|
||||
if(command[i] == '/' || command[i] == ':')
|
||||
{
|
||||
found_path_separators = TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* If it's an absolute or relative path name, it's easy. */
|
||||
if(strchr(command,'/') != NULL || strchr(command,':') != NULL)
|
||||
if(found_path_separators)
|
||||
{
|
||||
result = execve(command, argv, environ);
|
||||
}
|
||||
else
|
||||
{
|
||||
size_t command_name_len = strlen(command);
|
||||
size_t command_buffer_size = 0;
|
||||
char * path_delimiter;
|
||||
char * path;
|
||||
|
||||
Reference in New Issue
Block a user