#include <unistd.h>
#include <limits.h>
#include <errno.h>
-#include <syslog.h>
#include <getopt.h>
#include "verbose.h"
int i;
char *wpath;
- openlog(appname, LOG_PERROR, LOG_USER);
+ LOGUSER(appname);
xmlsec_init();
verbosity++;
break;
case ':':
- syslog(LOG_ERR, "missing argument value");
+ ERROR("missing argument value");
return 1;
default:
- syslog(LOG_ERR, "unrecognized option");
+ ERROR("unrecognized option");
return 1;
}
}
for (i = 0 ; av[i] != NULL ; i++) {
wpath = realpath(av[i], NULL);
if (wpath == NULL) {
- syslog(LOG_ERR, "error while getting realpath of %dth widget: %s", i+1, av[i]);
+ ERROR("error while getting realpath of %dth widget: %s", i+1, av[i]);
return 1;
}
av[i] = wpath;
return 0;
}
-static struct wgt *wgt_at_workdir()
-{
- int rc, wfd;
- struct wgt *wgt;
-
- wfd = workdirfd();
- if (wfd < 0)
- return NULL;
-
- wgt = wgt_create();
- if (!wgt) {
- syslog(LOG_ERR, "failed to allocate wgt");
- close(wfd);
- return NULL;
- }
-
- rc = wgt_connectat(wgt, wfd, NULL);
- if (rc) {
- syslog(LOG_ERR, "failed to connect wgt to workdir");
- close(wfd);
- wgt_unref(wgt);
- return NULL;
- }
-
- return wgt;
-}
-
-
static int check_and_show()
{
- struct wgt *wgt;
struct wgt_info *ifo;
- wgt = wgt_at_workdir();
- if (!wgt)
- return -1;
-
- ifo = wgt_info_get(wgt, 1, 1, 1);
- if (!ifo) {
- wgt_unref(wgt);
+ ifo = wgt_info_createat(workdirfd, NULL, 1, 1, 1);
+ if (!ifo)
return -1;
- }
wgt_info_dump(ifo, 1, "");
wgt_info_unref(ifo);
- wgt_unref(wgt);
return 0;
}
/* install the widget of the file */
static void show(const char *wgtfile)
{
- notice("-- INFO for widget %s --", wgtfile);
+ NOTICE("-- INFO for widget %s --", wgtfile);
/* workdir */
if (make_workdir_base("/tmp", "UNPACK", 0)) {
- syslog(LOG_ERR, "failed to create a working directory");
+ ERROR("failed to create a working directory");
return;
}
- if (enter_workdir(0))
- goto error2;
-
if (zread(wgtfile, 0))
goto error2;