Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
M
mysh-0
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
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
PARKSUYEON
mysh-0
Commits
df162ca7
Commit
df162ca7
authored
7 years ago
by
PARK SUYEON
Browse files
Options
Downloads
Patches
Plain Diff
Update src/main.c
parent
98ad1850
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/main.c
+8
-5
8 additions, 5 deletions
src/main.c
with
8 additions
and
5 deletions
src/main.c
+
8
−
5
View file @
df162ca7
...
...
@@ -59,10 +59,10 @@ int main()
apply_alias:
mysh_parse_command
(
buf
,
&
argc
,
&
argv
);
/*
for(int i=0;i<argc;i++){
for
(
int
i
=
0
;
i
<
argc
;
i
++
){
printf
(
"%s,%d"
,
argv
[
i
],
i
);
}
*/
if
(
strcmp
(
argv
[
0
],
""
)
==
0
)
{
goto
release_and_continue
;
}
else
if
(
strcmp
(
argv
[
0
],
"cd"
)
==
0
)
{
...
...
@@ -81,7 +81,7 @@ apply_alias:
goto
release_and_exit
;
}
else
{
for
(
int
i
=
0
;
i
<
n_aliased_command
;
++
i
)
{
if
(
strcmp
(
argv
[
1
],
aliased_commands
[
i
]
->
alias
)
==
0
)
{
if
(
strcmp
(
argv
[
0
],
aliased_commands
[
i
]
->
alias
)
==
0
)
{
strcpy
(
buf
,
aliased_commands
[
i
]
->
command
);
goto
apply_alias
;
...
...
@@ -120,13 +120,16 @@ static void release_argv(int argc, char*** argv) {
int
do_alias
(
int
argc
,
char
**
argv
)
{
if
(
!
validate_alias_argv
(
argc
,
argv
))
return
-
1
;
strcat
(
argv
[
2
],
" "
);
strcat
(
argv
[
2
],
argv
[
3
]);
for
(
int
i
=
0
;
i
<
sizeof
(
aliased_commands
)
/
sizeof
(
struct
aliased_command
*
);
++
i
)
{
aliased_commands
[
i
]
=
malloc
(
sizeof
(
struct
aliased_command
));
}
strcat
(
argv
[
2
],
" "
);
strcat
(
argv
[
2
],
argv
[
3
]);
// strcat(argv[2]," ");
// strcat(argv[2], argv[3]);
strcpy
(
aliased_commands
[
n_aliased_command
]
->
alias
,
argv
[
1
]);
strcpy
(
aliased_commands
[
n_aliased_command
]
->
command
,
argv
[
2
]);
...
...
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