#define SQLERROR(x) fprintf(stderr, "%s %d: %s\n", __func__, __LINE__, (x))
#endif
-static char *dupstr(char *s) {
- size_t n;
- char *d;
-
- n = strlen(s);
- d = malloc(n+1);
- if (d) {
- d = strcpy(d, s);
- }
- return d;
-}
-
#if 0
int zpm_newpkg(struct zpm *z, char *base, char *version, int release) {
char *sql = "insert or ignore into packages (package,version,release) values (?,?,?)";
);
}
-/* set package struct variables, database, environment, then command line */
-int zpm_readopts(struct zpm *zpm, int ac, char **av) {
- char *ev;
- struct zpm_package *pkg;
-
- if (!zpm) {
- return -1;
- }
-
- pkg = zpm->current_package;
-
- if (pkg) {
- ev = getenv("ZPMPACKAGE");
- if (ev) {
- pkg->name = dupstr(ev);
- }
- ev = getenv("ZPMPKGREL");
- if (ev) {
- pkg->release = strtol(ev, 0, 0);
- }
- ev = getenv("ZPMPKGVER");
- if (ev) {
- pkg->version = dupstr(ev);
- }
- }
-
- /* now, parse the options, return optind so the caller can adjust if needed */
-
- return av ? ac : 1;
-}
-
int zpm_extract(struct zpm *pkg, char *hash, char *path, int mode) {
int rc;
return 1;
}
- /* this is really just read env */
- zpm_readopts(&pkg, ac, av);
-
/* given a package name, get the packages */
/* no package name, get all */