Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
M
mysh-1
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
JaeGeonOh
mysh-1
Commits
7934b809
Commit
7934b809
authored
6 years ago
by
Jaegeon
Browse files
Options
Downloads
Patches
Plain Diff
fix | parsig
parent
1a75c6e3
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/commands.c
+6
-5
6 additions, 5 deletions
src/commands.c
src/utils.c
+10
-3
10 additions, 3 deletions
src/utils.c
with
16 additions
and
8 deletions
src/commands.c
+
6
−
5
View file @
7934b809
...
@@ -45,7 +45,7 @@ static int is_built_in_command(const char* command_name)
...
@@ -45,7 +45,7 @@ static int is_built_in_command(const char* command_name)
*/
*/
int
evaluate_command
(
int
n_commands
,
struct
single_command
(
*
commands
)[
512
],
struct
pidStorage
*
ps
)
int
evaluate_command
(
int
n_commands
,
struct
single_command
(
*
commands
)[
512
],
struct
pidStorage
*
ps
)
{
{
int
ti
,
status
,
i
,
j
,
n
;
int
ti
,
status
,
i
,
j
,
n
,
re_i
;
pid_t
p_id
;
pid_t
p_id
;
char
tmp_path
[
PATH_MAX
];
char
tmp_path
[
PATH_MAX
];
struct
aliased_command
**
aliased_commands
;
struct
aliased_command
**
aliased_commands
;
...
@@ -53,7 +53,6 @@ int evaluate_command(int n_commands, struct single_command (*commands)[512], str
...
@@ -53,7 +53,6 @@ int evaluate_command(int n_commands, struct single_command (*commands)[512], str
while
(
n_commands
>
ti
)
{
while
(
n_commands
>
ti
)
{
struct
single_command
*
com
=
(
*
commands
)
+
ti
++
;
struct
single_command
*
com
=
(
*
commands
)
+
ti
++
;
assert
(
com
->
argc
!=
0
);
assert
(
com
->
argc
!=
0
);
n
=
get_no_alias
();
n
=
get_no_alias
();
...
@@ -89,7 +88,9 @@ int evaluate_command(int n_commands, struct single_command (*commands)[512], str
...
@@ -89,7 +88,9 @@ int evaluate_command(int n_commands, struct single_command (*commands)[512], str
ps
->
pid_arr
[
ps
->
arr_i
][
ps
->
arr_n
++
]
=
p_id
;
ps
->
pid_arr
[
ps
->
arr_i
][
ps
->
arr_n
++
]
=
p_id
;
}
}
}
else
{
}
else
{
return
exute_command
(
com
,
tmp_path
,
ps
);
re_i
=
exute_command
(
com
,
tmp_path
,
ps
);
if
(
re_i
)
return
re_i
;
}
}
}
}
return
0
;
return
0
;
...
...
This diff is collapsed.
Click to expand it.
src/utils.c
+
10
−
3
View file @
7934b809
...
@@ -23,6 +23,7 @@ void mysh_parse_command(const char* command,
...
@@ -23,6 +23,7 @@ void mysh_parse_command(const char* command,
++
ti
;
++
ti
;
tok
=
strtok_r
(
NULL
,
"|"
,
&
saveptr
);
tok
=
strtok_r
(
NULL
,
"|"
,
&
saveptr
);
}
}
*
n_commands
=
ti
;
*
n_commands
=
ti
;
...
@@ -46,7 +47,13 @@ void parse_single_command(const char* command,
...
@@ -46,7 +47,13 @@ void parse_single_command(const char* command,
flag
=
0
;
flag
=
0
;
point
=
command
[
command_i
++
];
point
=
command
[
command_i
++
];
while
(
point
!=
'\n'
){
while
(
1
){
if
(
point
==
'\n'
||
point
==
'\0'
)
break
;
else
if
(
buf_i
==
0
&&
point
==
' '
){
point
=
command
[
command_i
++
];
continue
;
}
buf
[
buf_i
++
]
=
point
;
buf
[
buf_i
++
]
=
point
;
if
(
!
flag
&&
point
==
' '
){
if
(
!
flag
&&
point
==
' '
){
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment