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
62
Issues
62
List
Boards
Labels
Service Desk
Milestones
Merge Requests
14
Merge Requests
14
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
5daa663a
Commit
5daa663a
authored
Apr 21, 2009
by
Natanael Copa
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
info: let -e print which packages are installed
parent
b0921eba
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
30 additions
and
14 deletions
+30
-14
src/info.c
src/info.c
+30
-14
No files found.
src/info.c
View file @
5daa663a
...
...
@@ -23,19 +23,31 @@ struct info_ctx {
void
(
*
subaction
)(
struct
apk_package
*
pkg
);
};
static
int
info_list
(
struct
info_ctx
*
ctx
,
struct
apk_database
*
db
,
int
argc
,
char
**
argv
)
static
void
verbose_print_pkg
(
struct
apk_package
*
pkg
,
int
minimal_verbosity
)
{
struct
apk_package
*
pkg
;
int
verbosity
=
apk_verbosity
;
if
(
verbosity
<
minimal_verbosity
)
verbosity
=
minimal_verbosity
;
if
(
pkg
==
NULL
||
verbosity
<
1
)
return
;
list_for_each_entry
(
pkg
,
&
db
->
installed
.
packages
,
installed_pkgs_list
)
{
printf
(
"%s"
,
pkg
->
name
->
name
);
if
(
apk_verbosity
>
0
)
printf
(
"-%s"
,
pkg
->
version
);
if
(
apk_verbosity
>
1
)
printf
(
"- %s"
,
pkg
->
description
);
printf
(
"-%s"
,
pkg
->
version
);
if
(
apk_verbosity
>
2
)
printf
(
" - %s"
,
pkg
->
description
);
printf
(
"
\n
"
);
}
}
static
int
info_list
(
struct
info_ctx
*
ctx
,
struct
apk_database
*
db
,
int
argc
,
char
**
argv
)
{
struct
apk_package
*
pkg
;
list_for_each_entry
(
pkg
,
&
db
->
installed
.
packages
,
installed_pkgs_list
)
verbose_print_pkg
(
pkg
,
1
);
return
0
;
}
...
...
@@ -43,22 +55,26 @@ static int info_exists(struct info_ctx *ctx, struct apk_database *db,
int
argc
,
char
**
argv
)
{
struct
apk_name
*
name
;
int
i
,
j
;
int
i
,
j
,
ret
=
0
;
for
(
i
=
0
;
i
<
argc
;
i
++
)
{
name
=
apk_db_query_name
(
db
,
APK_BLOB_STR
(
argv
[
i
]));
if
(
name
==
NULL
)
return
1
;
if
(
name
==
NULL
)
{
ret
++
;
continue
;
}
for
(
j
=
0
;
j
<
name
->
pkgs
->
num
;
j
++
)
{
if
(
apk_pkg_get_state
(
name
->
pkgs
->
item
[
j
])
==
APK_PKG_INSTALLED
)
break
;
}
if
(
j
>=
name
->
pkgs
->
num
)
return
2
;
if
(
j
>=
name
->
pkgs
->
num
)
{
ret
++
;
}
else
verbose_print_pkg
(
name
->
pkgs
->
item
[
j
],
0
);
}
return
0
;
return
ret
;
}
static
int
info_who_owns
(
struct
info_ctx
*
ctx
,
struct
apk_database
*
db
,
...
...
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