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
8d74bafd
Commit
8d74bafd
authored
Sep 21, 2016
by
Christian Brauner
Committed by
Stéphane Graber
Sep 23, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tools: do not add trailing spaces on lxc-ls -1
Signed-off-by:
Christian Brauner
<
christian.brauner@canonical.com
>
parent
8b4e6d69
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
10 deletions
+14
-10
lxc_ls.c
src/lxc/tools/lxc_ls.c
+14
-10
No files found.
src/lxc/tools/lxc_ls.c
View file @
8d74bafd
...
@@ -144,7 +144,7 @@ static void ls_print_fancy_format(struct ls *l, struct lengths *lht,
...
@@ -144,7 +144,7 @@ static void ls_print_fancy_format(struct ls *l, struct lengths *lht,
* Only print names of containers.
* Only print names of containers.
*/
*/
static
void
ls_print_names
(
struct
ls
*
l
,
struct
lengths
*
lht
,
static
void
ls_print_names
(
struct
ls
*
l
,
struct
lengths
*
lht
,
size_t
ls_arr
,
size_t
termwidth
);
size_t
ls_arr
,
size_t
termwidth
,
bool
list
);
/*
/*
* Print default fancy format.
* Print default fancy format.
...
@@ -264,7 +264,7 @@ int main(int argc, char *argv[])
...
@@ -264,7 +264,7 @@ int main(int argc, char *argv[])
unsigned
int
cols
=
0
;
unsigned
int
cols
=
0
;
if
(
!
my_args
.
ls_line
)
if
(
!
my_args
.
ls_line
)
cols
=
ls_get_term_width
();
cols
=
ls_get_term_width
();
ls_print_names
(
ls_arr
,
&
max_len
,
ls_size
,
cols
);
ls_print_names
(
ls_arr
,
&
max_len
,
ls_size
,
cols
,
my_args
.
ls_line
);
}
}
ret
=
EXIT_SUCCESS
;
ret
=
EXIT_SUCCESS
;
...
@@ -743,7 +743,7 @@ static struct ls *ls_new(struct ls **ls, size_t *size)
...
@@ -743,7 +743,7 @@ static struct ls *ls_new(struct ls **ls, size_t *size)
}
}
static
void
ls_print_names
(
struct
ls
*
l
,
struct
lengths
*
lht
,
static
void
ls_print_names
(
struct
ls
*
l
,
struct
lengths
*
lht
,
size_t
size
,
size_t
termwidth
)
size_t
size
,
size_t
termwidth
,
bool
list
)
{
{
/* If list is empty do nothing. */
/* If list is empty do nothing. */
if
(
size
==
0
)
if
(
size
==
0
)
...
@@ -752,14 +752,18 @@ static void ls_print_names(struct ls *l, struct lengths *lht,
...
@@ -752,14 +752,18 @@ static void ls_print_names(struct ls *l, struct lengths *lht,
size_t
i
,
len
=
0
;
size_t
i
,
len
=
0
;
struct
ls
*
m
=
NULL
;
struct
ls
*
m
=
NULL
;
for
(
i
=
0
,
m
=
l
;
i
<
size
;
i
++
,
m
++
)
{
for
(
i
=
0
,
m
=
l
;
i
<
size
;
i
++
,
m
++
)
{
printf
(
"%-*s"
,
lht
->
name_length
,
m
->
name
?
m
->
name
:
"-"
);
if
(
list
)
{
len
+=
lht
->
name_length
;
printf
(
"%s
\n
"
,
m
->
name
?
m
->
name
:
"-"
);
if
((
len
+
lht
->
name_length
)
>=
termwidth
)
{
printf
(
"
\n
"
);
len
=
0
;
}
else
{
}
else
{
printf
(
" "
);
printf
(
"%-*s"
,
lht
->
name_length
,
m
->
name
?
m
->
name
:
"-"
);
len
++
;
len
+=
lht
->
name_length
;
if
((
len
+
lht
->
name_length
)
>=
termwidth
)
{
printf
(
"
\n
"
);
len
=
0
;
}
else
{
printf
(
" "
);
len
++
;
}
}
}
}
}
if
(
len
>
0
)
if
(
len
>
0
)
...
...
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