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 int check_and_show()
110 struct wgt_info *ifo;
112 ifo = wgt_info_createat(workdirfd, NULL, 1, 1, 1);
115 wgt_info_dump(ifo, 1, "");
120 /* install the widget of the file */
121 static void show(const char *wgtfile)
123 notice("-- INFO for widget %s --", wgtfile);
126 if (make_workdir_base("/tmp", "UNPACK", 0)) {
127 syslog(LOG_ERR, "failed to create a working directory");
131 if (zread(wgtfile, 0))
134 if (check_all_signatures())