Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
L
lxc
Project
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
Chen Yisong
lxc
Commits
d51dde8a
Commit
d51dde8a
authored
Dec 06, 2017
by
RicardoSanchezA
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
lxc_init: changed minor details
Signed-off-by:
RicardoSanchezA
<
ricardo.sanchez@utexas.edu
>
parent
5ee606bc
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
44 deletions
+9
-44
lxc_init.c
src/lxc/lxc_init.c
+9
-44
No files found.
src/lxc/lxc_init.c
View file @
d51dde8a
...
@@ -76,7 +76,7 @@ struct arguments {
...
@@ -76,7 +76,7 @@ struct arguments {
const
char
*
name
;
const
char
*
name
;
char
*
log_file
;
char
*
log_file
;
char
*
log_priority
;
char
*
log_priority
;
int
quiet
;
bool
quiet
;
const
char
*
lxcpath
;
const
char
*
lxcpath
;
/* remaining arguments */
/* remaining arguments */
...
@@ -317,44 +317,8 @@ out:
...
@@ -317,44 +317,8 @@ out:
static
void
print_usage
(
const
struct
option
longopts
[])
static
void
print_usage
(
const
struct
option
longopts
[])
{
{
int
i
;
fprintf
(
stderr
,
"Usage: lxc-init [-n|--name=NAME] [-h|--help] [--usage] [--version]
\n
\
const
struct
option
*
opt
;
[-q|--quiet] [-o|--logfile=LOGFILE] [-l|--logpriority=LOGPRIORITY] [-P|--lxcpath=LXCPATH]
\n
"
);
fprintf
(
stderr
,
"Usage: lxc-init "
);
for
(
opt
=
longopts
,
i
=
1
;
opt
->
name
;
opt
++
,
i
++
)
{
int
j
;
char
*
uppername
;
uppername
=
strdup
(
opt
->
name
);
if
(
!
uppername
)
exit
(
-
ENOMEM
);
for
(
j
=
0
;
uppername
[
j
];
j
++
)
uppername
[
j
]
=
toupper
(
uppername
[
j
]);
fprintf
(
stderr
,
"["
);
if
(
isprint
(
opt
->
val
))
fprintf
(
stderr
,
"-%c|"
,
opt
->
val
);
fprintf
(
stderr
,
"--%s"
,
opt
->
name
);
if
(
opt
->
has_arg
==
required_argument
)
fprintf
(
stderr
,
"=%s"
,
uppername
);
if
(
opt
->
has_arg
==
optional_argument
)
fprintf
(
stderr
,
"[=%s]"
,
uppername
);
fprintf
(
stderr
,
"] "
);
if
(
!
(
i
%
4
))
fprintf
(
stderr
,
"
\n\t
"
);
free
(
uppername
);
}
fprintf
(
stderr
,
"
\n
"
);
exit
(
0
);
exit
(
0
);
}
}
...
@@ -364,7 +328,7 @@ static void print_version()
...
@@ -364,7 +328,7 @@ static void print_version()
exit
(
0
);
exit
(
0
);
}
}
static
void
print_help
(
int
code
)
static
void
print_help
()
{
{
fprintf
(
stderr
,
"\
fprintf
(
stderr
,
"\
Usage: lxc-init --name=NAME -- COMMAND
\n
\
Usage: lxc-init --name=NAME -- COMMAND
\n
\
...
@@ -386,7 +350,6 @@ for any corresponding short options.\n\
...
@@ -386,7 +350,6 @@ for any corresponding short options.\n\
\n
\
\n
\
See the lxc-init man page for further information.
\n\n
"
);
See the lxc-init man page for further information.
\n\n
"
);
exit
(
code
);
}
}
static
int
arguments_parse
(
struct
arguments
*
args
,
int
argc
,
static
int
arguments_parse
(
struct
arguments
*
args
,
int
argc
,
...
@@ -410,7 +373,7 @@ static int arguments_parse(struct arguments *args, int argc,
...
@@ -410,7 +373,7 @@ static int arguments_parse(struct arguments *args, int argc,
args
->
log_priority
=
optarg
;
args
->
log_priority
=
optarg
;
break
;
break
;
case
'q'
:
case
'q'
:
args
->
quiet
=
1
;
args
->
quiet
=
true
;
break
;
break
;
case
'P'
:
case
'P'
:
remove_trailing_slashes
(
optarg
);
remove_trailing_slashes
(
optarg
);
...
@@ -421,9 +384,11 @@ static int arguments_parse(struct arguments *args, int argc,
...
@@ -421,9 +384,11 @@ static int arguments_parse(struct arguments *args, int argc,
case
OPT_VERSION
:
case
OPT_VERSION
:
print_version
();
print_version
();
case
'?'
:
case
'?'
:
print_help
(
1
);
print_help
();
exit
(
EXIT_FAILURE
);
case
'h'
:
case
'h'
:
print_help
(
0
);
print_help
();
exit
(
EXIT_SUCCESS
);
}
}
}
}
...
...
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