4 author: José Bollo <jose.bollo@iot.bzh>
6 Licensed under the Apache License, Version 2.0 (the "License");
7 you may not use this file except in compliance with the License.
8 You may obtain a copy of the License at
10 http://www.apache.org/licenses/LICENSE-2.0
12 Unless required by applicable law or agreed to in writing, software
13 distributed under the License is distributed on an "AS IS" BASIS,
14 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 See the License for the specific language governing permissions and
16 limitations under the License.
19 #define _BSD_SOURCE /* see readdir */
34 static const char appname[] = "wgtpkg-info";
36 static void show(const char *wgtfile);
41 "usage: %s [-f] [-q] [-v] wgtfile...\n"
50 static struct option options[] = {
51 { "help", no_argument, NULL, 'h' },
52 { "quiet", no_argument, NULL, 'q' },
53 { "verbose", no_argument, NULL, 'v' },
57 /* info the widgets of the list */
58 int main(int ac, char **av)
68 i = getopt_long(ac, av, "hqv", options, NULL);
83 ERROR("missing argument value");
86 ERROR("unrecognized option");
91 /* canonic names for files */
93 for (i = 0 ; av[i] != NULL ; i++) {
94 wpath = realpath(av[i], NULL);
96 ERROR("error while getting realpath of %dth widget: %s", i+1, av[i]);
109 static int check_and_show()
111 struct wgt_info *ifo;
113 ifo = wgt_info_createat(workdirfd, NULL, 1, 1, 1);
116 wgt_info_dump(ifo, 1, "");
121 /* install the widget of the file */
122 static void show(const char *wgtfile)
124 NOTICE("-- INFO for widget %s --", wgtfile);
127 if (make_workdir_base("/tmp", "UNPACK", 0)) {
128 ERROR("failed to create a working directory");
132 if (zread(wgtfile, 0))
135 if (check_all_signatures())