Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
clean-and-itasks
clean-ide
Commits
7e4600b7
Commit
7e4600b7
authored
Apr 21, 2004
by
John van Groningen
Browse files
add function fork_execv_pid
parent
5d39d781
Changes
3
Hide whitespace changes
Inline
Side-by-side
Mac/Clean System Files/cUtilSystem.o
View file @
7e4600b7
No preview for this file type
Mac/Clean System Files/cUtilSystem.xo
View file @
7e4600b7
No preview for this file type
Mac/cUtilSystem.c
View file @
7e4600b7
...
...
@@ -218,17 +218,10 @@ int close (int d)
}
#endif
int
fork_execv_waitpid
(
char
*
command
,
char
*
stderr_file_name
,
int
*
status_p
)
static
int
parse_arguments
(
char
*
command
,
char
**
argv
)
{
char
*
p
,
*
(
argv
[
2049
]);
int
argc
,
result
;
#ifndef __MACH__
if
(
!
initSystemBundle
())
return
-
1
;
#endif
result
=
0
;
char
*
p
;
int
argc
;
argc
=
0
;
p
=
command
;
...
...
@@ -274,6 +267,24 @@ int fork_execv_waitpid (char *command,char *stderr_file_name,int *status_p)
++
p
;
}
argv
[
argc
]
=
NULL
;
return
argc
;
}
int
fork_execv_waitpid
(
char
*
command
,
char
*
stderr_file_name
,
int
*
status_p
)
{
char
*
(
argv
[
2049
]);
int
argc
,
result
;
#ifndef __MACH__
if
(
!
initSystemBundle
())
return
-
1
;
#endif
result
=
0
;
argc
=
parse_arguments
(
command
,
argv
);
if
(
argc
>
0
){
int
pid
;
...
...
@@ -300,7 +311,6 @@ int fork_execv_waitpid (char *command,char *stderr_file_name,int *status_p)
int
fork_execv
(
char
*
p_command
)
{
char
*
p
;
char
*
(
argv
[
2049
]);
int
argc
,
result
;
char
*
command
;
...
...
@@ -325,63 +335,70 @@ int fork_execv (char *p_command)
}
result
=
0
;
argc
=
parse_arguments
(
command
,
argv
);
argc
=
0
;
p
=
command
;
if
(
argc
>
0
){
int
pid
;
pid
=
fork
();
if
(
pid
==
0
)
result
=
execv
(
argv
[
0
],
argv
);
else
if
(
pid
!=-
1
)
result
=
0
;
else
result
=
1
;
}
while
(
*
p
==
' '
||
*
p
==
'\t'
)
++
p
;
DisposePtr
(
command
);
while
(
*
p
!=
'\0'
&&
argc
<
2048
){
if
(
*
p
==
'\''
){
char
c
,
*
d_p
;
++
p
;
argv
[
argc
]
=
p
;
return
result
;
}
d_p
=
p
;
c
=*
p
;
while
(
!
(
c
==
'\''
&&
p
[
1
]
!=
'\''
)
&&
c
!=
'\0'
){
*
d_p
++=
c
;
if
(
c
==
'\''
)
++
p
;
c
=*++
p
;
}
if
(
*
p
==
'\0'
){
*
d_p
=
'\0'
;
break
;
}
++
argc
;
*
d_p
=
'\0'
;
++
p
;
}
else
{
argv
[
argc
++
]
=
p
;
while
(
*
p
!=
' '
&&
*
p
!=
'\t'
&&
*
p
!=
'\0'
)
++
p
;
int
fork_execv_pid
(
char
*
p_command
,
int
*
pid_p
)
{
char
*
(
argv
[
2049
]);
int
argc
,
result
;
char
*
command
;
#ifndef __MACH__
if
(
!
initSystemBundle
())
return
-
1
;
#endif
{
char
*
p
,
*
d_p
;
for
(
p
=
p_command
;
*
p
!=
'\0'
;
++
p
)
;
if
(
*
p
!=
'\0'
)
*
p
++=
'\0'
;
}
while
(
*
p
==
' '
||
*
p
==
'\t'
)
++
p
;
command
=
NewPtr
(
p
+
1
-
p_command
);
d_p
=
command
;
for
(
p
=
p_command
;
*
p
!=
'\0'
;
++
p
)
*
d_p
++=*
p
;
*
d_p
=
'\0'
;
}
argv
[
argc
]
=
NULL
;
result
=
0
;
argc
=
parse_arguments
(
command
,
argv
);
if
(
argc
>
0
){
int
pid
;
pid
=
fork
();
*
pid_p
=
pid
;
if
(
pid
==
0
)
result
=
execv
(
argv
[
0
],
argv
);
else
if
(
pid
!=-
1
)
result
=
0
;
else
result
=
1
;
}
}
else
*
pid_p
=
0
;
DisposePtr
(
command
);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment