index : pacman | |
Archlinux32 fork of pacman | gitolite user |
summaryrefslogtreecommitdiff |
author | Xavier Chantry <shiningxc@gmail.com> | 2008-12-20 06:51:59 +0100 |
---|---|---|
committer | Dan McGee <dan@archlinux.org> | 2009-09-06 16:17:17 -0500 |
commit | c88ac86292a9cd9b87ab9ebf203b9eca75af1f28 (patch) | |
tree | e79968b7836c536c4c5302aeef225ed868fa0d0a /src | |
parent | 6e1b1aea5908fba6669b31a0a92f934a6a2aa244 (diff) |
-rw-r--r-- | src/pacman/pacman.c | 28 |
diff --git a/src/pacman/pacman.c b/src/pacman/pacman.c index 6e5147c5..37472083 100644 --- a/src/pacman/pacman.c +++ b/src/pacman/pacman.c @@ -957,6 +957,29 @@ static int parseconfig(const char *file) return(_parseconfig(file, NULL, NULL)); } +/** print commandline to logfile + */ +static void cl_to_log(int argc, char* argv[]) +{ + size_t size = 0; + int i; + for(i = 0; i<argc; i++) { + size += strlen(argv[i]) + 1; + } + char *cl_text = malloc(size); + if(!cl_text) + return; + char *p = cl_text; + for(i = 0; i<argc-1; i++) { + strcpy(p, argv[i]); + p += strlen(argv[i]); + *p++ = ' '; + } + strcpy(p, argv[i]); + alpm_logaction("Running '%s'\n", cl_text); + free(cl_text); +} + /** Main function. * @param argc argc * @param argv argv @@ -1083,6 +1106,11 @@ int main(int argc, char *argv[]) cleanup(EXIT_FAILURE); } + /* Log commandline */ + if(needs_root()) { + cl_to_log(argc, argv); + } + /* start the requested operation */ switch(config->op) { case PM_OP_REMOVE: |