4 Licensed under the Apache License, Version 2.0 (the "License");
5 you may not use this file except in compliance with the License.
6 You may obtain a copy of the License at
8 http://www.apache.org/licenses/LICENSE-2.0
10 Unless required by applicable law or agreed to in writing, software
11 distributed under the License is distributed on an "AS IS" BASIS,
12 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 See the License for the specific language governing permissions and
14 limitations under the License.
17 #define _BSD_SOURCE /* see readdir */
33 static const char appname[] = "wgtpkg-info";
35 static void show(const char *wgtfile);
40 "usage: %s [-f] [-q] [-v] wgtfile...\n"
49 static struct option options[] = {
50 { "help", no_argument, NULL, 'h' },
51 { "quiet", no_argument, NULL, 'q' },
52 { "verbose", no_argument, NULL, 'v' },
56 /* info the widgets of the list */
57 int main(int ac, char **av)
62 openlog(appname, LOG_PERROR, LOG_USER);
67 i = getopt_long(ac, av, "hqv", options, NULL);
82 syslog(LOG_ERR, "missing argument value");
85 syslog(LOG_ERR, "unrecognized option");
90 /* canonic names for files */
92 for (i = 0 ; av[i] != NULL ; i++) {
93 wpath = realpath(av[i], NULL);
95 syslog(LOG_ERR, "error while getting realpath of %dth widget: %s", i+1, av[i]);
108 static struct wgt *wgt_at_workdir()
119 syslog(LOG_ERR, "failed to allocate wgt");
124 rc = wgt_connectat(wgt, wfd, NULL);
126 syslog(LOG_ERR, "failed to connect wgt to workdir");
136 static int check_and_show()
139 struct wgt_info *ifo;
141 wgt = wgt_at_workdir();
145 ifo = wgt_info_get(wgt, 1, 1, 1);
150 wgt_info_dump(ifo, 1, "");
156 /* install the widget of the file */
157 static void show(const char *wgtfile)
159 notice("-- INFO for widget %s --", wgtfile);
162 if (make_workdir_base("/tmp", "UNPACK", 0)) {
163 syslog(LOG_ERR, "failed to create a working directory");
167 if (enter_workdir(0))
170 if (zread(wgtfile, 0))
173 if (check_all_signatures())