You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@celix.apache.org by pn...@apache.org on 2023/06/30 18:33:23 UTC
[celix] 02/06: Fix query command to include framework services
This is an automated email from the ASF dual-hosted git repository.
pnoltes pushed a commit to branch feature/585-celix-conditions
in repository https://gitbox.apache.org/repos/asf/celix.git
commit cb9f45dd4715b76d74850e293f0ecaefad8c9455
Author: Pepijn Noltes <pn...@apache.org>
AuthorDate: Tue Jun 27 20:06:04 2023 +0200
Fix query command to include framework services
---
bundles/shell/shell/src/query_command.c | 16 ++++++++++------
1 file changed, 10 insertions(+), 6 deletions(-)
diff --git a/bundles/shell/shell/src/query_command.c b/bundles/shell/shell/src/query_command.c
index 490513b9..95c7360c 100644
--- a/bundles/shell/shell/src/query_command.c
+++ b/bundles/shell/shell/src/query_command.c
@@ -20,13 +20,13 @@
#include <string.h>
#include <stdlib.h>
+#include "celix_bundle.h"
+#include "celix_bundle_context.h"
+#include "celix_constants.h"
#include "celix_framework.h"
#include "celix_shell_constants.h"
-#include "celix_bundle_context.h"
-#include "std_commands.h"
-#include "celix_bundle.h"
#include "celix_utils.h"
-
+#include "std_commands.h"
struct query_options {
bool useColors;
@@ -143,9 +143,13 @@ static void queryCommand_listServices(celix_bundle_context_t *ctx, const struct
data.nrOfProvidedServicesFound = 0;
data.nrOfRequestedServicesFound = 0;
- if (opts->bndId >= 0L) {
+ if (opts->bndId >= CELIX_FRAMEWORK_BUNDLE_ID) {
queryCommand_listServicesForBundle(ctx, opts->bndId, &data, opts, sout, serr);
} else {
+ //query framework bundle
+ queryCommand_listServicesForBundle(ctx, CELIX_FRAMEWORK_BUNDLE_ID, &data, opts, sout, serr);
+
+ //query rest of the bundles
celix_array_list_t *bundleIds = celix_bundleContext_listBundles(ctx);
for (int i = 0; i < celix_arrayList_size(bundleIds); ++i) {
long bndId = celix_arrayList_getLong(bundleIds, i);
@@ -199,7 +203,7 @@ bool queryCommand_execute(void *_ptr, const char *command_line_str, FILE *sout,
//check if its a number (bundle id)
errno = 0;
long bndId = strtol(sub_str, NULL, 10);
- if (bndId > 0 && errno == 0 /*not EINVAL*/) {
+ if (bndId >= CELIX_FRAMEWORK_BUNDLE_ID && errno == 0 /*not EINVAL*/) {
opts.bndId = bndId;
} else {
//not option and not a bundle id -> query