Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
abc
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lvzhengyang
abc
Commits
f2610921
Commit
f2610921
authored
Mar 10, 2015
by
Alan Mishchenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adding new command 'abcrc' to load "abc.rc" on demand.
parent
bb22a20c
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
5 deletions
+25
-5
src/base/cmd/cmd.c
+25
-5
No files found.
src/base/cmd/cmd.c
View file @
f2610921
...
@@ -38,7 +38,7 @@ ABC_NAMESPACE_IMPL_START
...
@@ -38,7 +38,7 @@ ABC_NAMESPACE_IMPL_START
static
int
CmdCommandTime
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
);
static
int
CmdCommandTime
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
);
static
int
CmdCommandEcho
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
);
static
int
CmdCommandEcho
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
);
static
int
CmdCommandQuit
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
);
static
int
CmdCommandQuit
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
);
static
int
CmdCommand
Which
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
);
static
int
CmdCommand
Abcrc
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
);
static
int
CmdCommandHistory
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
);
static
int
CmdCommandHistory
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
);
static
int
CmdCommandAlias
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
);
static
int
CmdCommandAlias
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
);
static
int
CmdCommandUnalias
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
);
static
int
CmdCommandUnalias
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
);
...
@@ -87,6 +87,7 @@ void Cmd_Init( Abc_Frame_t * pAbc )
...
@@ -87,6 +87,7 @@ void Cmd_Init( Abc_Frame_t * pAbc )
Cmd_CommandAdd
(
pAbc
,
"Basic"
,
"time"
,
CmdCommandTime
,
0
);
Cmd_CommandAdd
(
pAbc
,
"Basic"
,
"time"
,
CmdCommandTime
,
0
);
Cmd_CommandAdd
(
pAbc
,
"Basic"
,
"echo"
,
CmdCommandEcho
,
0
);
Cmd_CommandAdd
(
pAbc
,
"Basic"
,
"echo"
,
CmdCommandEcho
,
0
);
Cmd_CommandAdd
(
pAbc
,
"Basic"
,
"quit"
,
CmdCommandQuit
,
0
);
Cmd_CommandAdd
(
pAbc
,
"Basic"
,
"quit"
,
CmdCommandQuit
,
0
);
Cmd_CommandAdd
(
pAbc
,
"Basic"
,
"abcrc"
,
CmdCommandAbcrc
,
0
);
Cmd_CommandAdd
(
pAbc
,
"Basic"
,
"history"
,
CmdCommandHistory
,
0
);
Cmd_CommandAdd
(
pAbc
,
"Basic"
,
"history"
,
CmdCommandHistory
,
0
);
Cmd_CommandAdd
(
pAbc
,
"Basic"
,
"alias"
,
CmdCommandAlias
,
0
);
Cmd_CommandAdd
(
pAbc
,
"Basic"
,
"alias"
,
CmdCommandAlias
,
0
);
Cmd_CommandAdd
(
pAbc
,
"Basic"
,
"unalias"
,
CmdCommandUnalias
,
0
);
Cmd_CommandAdd
(
pAbc
,
"Basic"
,
"unalias"
,
CmdCommandUnalias
,
0
);
...
@@ -310,10 +311,9 @@ int CmdCommandQuit( Abc_Frame_t * pAbc, int argc, char **argv )
...
@@ -310,10 +311,9 @@ int CmdCommandQuit( Abc_Frame_t * pAbc, int argc, char **argv )
return
-
1
;
return
-
1
;
usage:
usage:
fprintf
(
pAbc
->
Err
,
"usage: quit [-
h] [-s
]
\n
"
);
fprintf
(
pAbc
->
Err
,
"usage: quit [-
sh
]
\n
"
);
fprintf
(
pAbc
->
Err
,
" -h print the command usage
\n
"
);
fprintf
(
pAbc
->
Err
,
" -h print the command usage
\n
"
);
fprintf
(
pAbc
->
Err
,
fprintf
(
pAbc
->
Err
,
" -s frees all the memory before quitting
\n
"
);
" -s frees all the memory before quitting
\n
"
);
return
1
;
return
1
;
}
}
...
@@ -328,9 +328,29 @@ int CmdCommandQuit( Abc_Frame_t * pAbc, int argc, char **argv )
...
@@ -328,9 +328,29 @@ int CmdCommandQuit( Abc_Frame_t * pAbc, int argc, char **argv )
SeeAlso []
SeeAlso []
******************************************************************************/
******************************************************************************/
int
CmdCommand
Which
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
)
int
CmdCommand
Abcrc
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
)
{
{
int
c
;
Extra_UtilGetoptReset
();
while
(
(
c
=
Extra_UtilGetopt
(
argc
,
argv
,
"h"
)
)
!=
EOF
)
{
switch
(
c
)
{
case
'h'
:
goto
usage
;
break
;
default:
goto
usage
;
}
}
Abc_UtilsSource
(
pAbc
);
return
0
;
return
0
;
usage:
fprintf
(
pAbc
->
Err
,
"usage: abcrc [-h]
\n
"
);
fprintf
(
pAbc
->
Err
,
" -h sources
\"
abc.rc
\"
from the current/parent/grandparent directory
\n
"
);
return
1
;
}
}
/**Function********************************************************************
/**Function********************************************************************
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a 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