//pkginst/main.c |
---|
33,6 → 33,7 |
#include "libunzip.h" |
#include "pkginst.h" |
#include "pkgrem.h" |
#include "showinst.h" |
#include "version.h" |
39,6 → 40,7 |
enum ACTIONTYPES { |
ACTION_INSTALL, |
ACTION_REMOVE, |
ACTION_LISTFILES, |
ACTION_HELP |
}; |
50,6 → 52,7 |
"\n" |
"Usage: PKGINST install package.zip\n" |
" PKGINST remove package\n" |
" PKGINST listfiles package\n" |
"\n" |
"PKGINST is published under the MIT license. It uses a configuration file\n" |
"located at %%DOSDIR%%\\CFG\\PKGINST.CFG\n" |
67,6 → 70,8 |
return(ACTION_INSTALL); |
} else if (strcasecmp(argv[1], "remove") == 0) { |
return(ACTION_REMOVE); |
} else if (strcasecmp(argv[1], "listfiles") == 0) { |
return(ACTION_LISTFILES); |
} else { |
return(ACTION_HELP); |
} |
134,6 → 139,9 |
case ACTION_REMOVE: |
res = pkgrem(argv[2], dosdir); |
break; |
case ACTION_LISTFILES: |
res = listfilesofpkg(argv[2], dosdir); |
break; |
default: |
res = showhelp(); |
break; |
//pkginst/showinst.c |
---|
162,14 → 162,16 |
/* Prints files owned by a package */ |
void listfilesofpkg(char *pkgname, const char *dosdir) { |
int listfilesofpkg(const char *pkgname, const char *dosdir) { |
struct flist_t *flist, *flist_ptr; |
/* load the list of files belonging to pkgname */ |
flist = pkg_loadflist(pkgname, dosdir); |
if (flist == NULL) return(-1); |
/* display each filename on screen */ |
for (flist_ptr = flist; flist_ptr != NULL; flist_ptr = flist_ptr->next) { |
printf("%s\n", flist_ptr->fname); |
puts(flist_ptr->fname); |
} |
/* free the list of files */ |
pkg_freeflist(flist); |
return(0); |
} |
//pkginst/showinst.h |
---|
8,5 → 8,5 |
void pkg_freeflist(struct flist_t *flist); |
struct flist_t *pkg_loadflist(const char *pkgname, const char *dosdir); |
void showinstalledpkgs(char *filterstr, const char *dosdir); |
void listfilesofpkg(char *pkgname, const char *dosdir); |
int listfilesofpkg(const char *pkgname, const char *dosdir); |
#endif |