mirror of
https://github.com/troglobit/finit.git
synced 2026-11-29 21:08:21 +00:00
initctl: list, only print whitespace separator between services
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This commit is contained in:
1 parent
94aec26e8c
commit
f91205cbad
1 file changed
+9
-2
+9
-2
@@ -63,6 +63,7 @@ static int calc_width(char *arr[], size_t len)
|
|||||||
static void do_list(const char *heading, const char *path)
|
static void do_list(const char *heading, const char *path)
|
||||||
{
|
{
|
||||||
int num;
|
int num;
|
||||||
|
int prev;
|
||||||
int width;
|
int width;
|
||||||
char buf[screen_cols];
|
char buf[screen_cols];
|
||||||
size_t i, len;
|
size_t i, len;
|
||||||
@@ -89,11 +90,17 @@ static void do_list(const char *heading, const char *path)
|
|||||||
if ((num - 1) * 2 + num * width > screen_cols)
|
if ((num - 1) * 2 + num * width > screen_cols)
|
||||||
num--;
|
num--;
|
||||||
|
|
||||||
|
prev = 0;
|
||||||
for (i = 0; i < gl.gl_pathc; i++) {
|
for (i = 0; i < gl.gl_pathc; i++) {
|
||||||
if (i > 0 && !(i % num))
|
if (i > 0 && !(i % num)) {
|
||||||
puts("");
|
puts("");
|
||||||
|
prev = 0;
|
||||||
|
}
|
||||||
|
|
||||||
printf("%-*s ", width, gl.gl_pathv[i]);
|
if (prev)
|
||||||
|
printf(" ");
|
||||||
|
printf("%-*s", width, gl.gl_pathv[i]);
|
||||||
|
prev++;
|
||||||
}
|
}
|
||||||
puts("\n");
|
puts("\n");
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user