Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
apk-tools
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
61
Issues
61
List
Boards
Labels
Service Desk
Milestones
Merge Requests
15
Merge Requests
15
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
alpine
apk-tools
Commits
bfd53b59
Commit
bfd53b59
authored
Sep 09, 2011
by
Timo Teräs
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
print: minor cleanup to indented writer
parent
4bf13c3d
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
18 additions
and
20 deletions
+18
-20
src/apk.c
src/apk.c
+5
-6
src/apk_blob.h
src/apk_blob.h
+0
-8
src/apk_print.h
src/apk_print.h
+6
-0
src/print.c
src/print.c
+6
-5
src/solver.c
src/solver.c
+1
-1
No files found.
src/apk.c
View file @
bfd53b59
...
...
@@ -97,7 +97,7 @@ static int format_option(char *buf, size_t len, struct apk_option *o,
static
void
print_usage
(
const
char
*
cmd
,
const
char
*
args
,
int
num_opts
,
struct
apk_option
*
opts
)
{
struct
apk_indent
indent
=
{
0
,
11
};
struct
apk_indent
indent
=
{
.
indent
=
11
};
char
word
[
128
];
int
i
,
j
;
...
...
@@ -116,7 +116,7 @@ static void print_usage(const char *cmd, const char *args, int num_opts,
static
void
print_options
(
int
num_opts
,
struct
apk_option
*
opts
)
{
struct
apk_indent
indent
=
{
0
,
26
};
struct
apk_indent
indent
=
{
.
indent
=
26
};
char
word
[
128
];
int
i
;
...
...
@@ -139,19 +139,18 @@ static int usage(struct apk_applet *applet)
printf
(
"
\n
The following commands are available:
\n
"
);
for
(
a
=
&
__start_apkapplets
;
a
<
&
__stop_apkapplets
;
a
++
)
{
struct
apk_indent
indent
=
{
0
,
26
};
struct
apk_indent
indent
=
{
.
indent
=
26
};
indent
.
x
=
printf
(
" %-*s"
,
indent
.
indent
-
3
,
(
*
a
)
->
name
);
apk_print_indented_words
(
&
indent
,
(
*
a
)
->
help
);
printf
(
"
\n
"
);
}
}
else
{
struct
apk_indent
indent
=
{
0
,
2
};
struct
apk_indent
indent
=
{
.
indent
=
2
};
print_usage
(
applet
->
name
,
applet
->
arguments
,
applet
->
num_options
,
applet
->
options
);
printf
(
"
\n
Description:
\n
%*s"
,
indent
.
indent
-
1
,
""
);
indent
.
x
=
indent
.
indent
-
1
;
printf
(
"
\n
Description:
\n
"
);
apk_print_indented_words
(
&
indent
,
applet
->
help
);
printf
(
"
\n
"
);
}
...
...
src/apk_blob.h
View file @
bfd53b59
...
...
@@ -109,14 +109,6 @@ void apk_blob_pull_csum(apk_blob_t *b, struct apk_checksum *csum);
void
apk_blob_pull_base64
(
apk_blob_t
*
b
,
apk_blob_t
to
);
void
apk_blob_pull_hexdump
(
apk_blob_t
*
b
,
apk_blob_t
to
);
struct
apk_indent
{
int
x
;
int
indent
;
};
void
apk_print_indented_words
(
struct
apk_indent
*
i
,
const
char
*
text
);
int
apk_print_indented
(
struct
apk_indent
*
i
,
apk_blob_t
blob
);
void
apk_atom_init
(
void
);
apk_blob_t
*
apk_blob_atomize
(
apk_blob_t
blob
);
apk_blob_t
*
apk_blob_atomize_dup
(
apk_blob_t
blob
);
...
...
src/apk_print.h
View file @
bfd53b59
...
...
@@ -23,6 +23,12 @@ const char *apk_error_str(int error);
void
apk_reset_screen_width
(
void
);
int
apk_get_screen_width
(
void
);
struct
apk_indent
{
int
x
;
int
indent
;
};
int
apk_print_indented
(
struct
apk_indent
*
i
,
apk_blob_t
blob
);
void
apk_print_indented_words
(
struct
apk_indent
*
i
,
const
char
*
text
);
...
...
src/print.c
View file @
bfd53b59
...
...
@@ -41,11 +41,12 @@ int apk_get_screen_width(void)
int
apk_print_indented
(
struct
apk_indent
*
i
,
apk_blob_t
blob
)
{
if
(
i
->
x
+
blob
.
len
+
1
>=
apk_get_screen_width
())
{
i
->
x
=
i
->
indent
;
printf
(
"
\n
%*s"
,
i
->
indent
-
1
,
""
);
}
i
->
x
+=
printf
(
" "
BLOB_FMT
,
BLOB_PRINTF
(
blob
));
if
(
i
->
x
+
blob
.
len
+
1
>=
apk_get_screen_width
())
i
->
x
=
printf
(
"
\n
%*s"
BLOB_FMT
,
i
->
indent
,
""
,
BLOB_PRINTF
(
blob
))
-
1
;
else
if
(
i
->
x
<=
i
->
indent
)
i
->
x
+=
printf
(
"%*s"
BLOB_FMT
,
i
->
indent
-
i
->
x
,
""
,
BLOB_PRINTF
(
blob
));
else
i
->
x
+=
printf
(
" "
BLOB_FMT
,
BLOB_PRINTF
(
blob
));
return
0
;
}
...
...
src/solver.c
View file @
bfd53b59
...
...
@@ -915,7 +915,7 @@ static int dump_packages(struct apk_changeset *changeset,
{
struct
apk_change
*
change
;
struct
apk_name
*
name
;
struct
apk_indent
indent
=
{
0
,
2
};
struct
apk_indent
indent
=
{
.
indent
=
2
};
int
match
=
0
,
i
;
for
(
i
=
0
;
i
<
changeset
->
changes
->
num
;
i
++
)
{
...
...
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