From e03a1f0044ebd7a477b44af411f296d72e3bba4d Mon Sep 17 00:00:00 2001
From: Chantry Xavier <shiningxc@gmail.com>
Date: Fri, 5 Oct 2007 16:18:29 +0200
Subject: pacman/pacman.c : add --logfile option.

Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
---
 src/pacman/pacman.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/src/pacman/pacman.c b/src/pacman/pacman.c
index 54a962a8..5d8694c1 100644
--- a/src/pacman/pacman.c
+++ b/src/pacman/pacman.c
@@ -140,6 +140,7 @@ static void usage(int op, char *myname)
 			printf(_("      --ignore <pkg>   ignore a package upgrade (can be used more than once)\n"));
 		}
 		printf(_("      --config <path>  set an alternate configuration file\n"));
+		printf(_("      --logfile <path> set an alternate log file\n"));
 		printf(_("      --noconfirm      do not ask for any confirmation\n"));
 		printf(_("      --noprogressbar  do not show a progress bar when downloading files\n"));
 		printf(_("      --noscriptlet    do not execute the install scriptlet if one exists\n"));
@@ -286,6 +287,7 @@ static int parseargs(int argc, char *argv[])
 		{"noscriptlet", no_argument,      0, 1005},
 		{"cachedir",   required_argument, 0, 1007},
 		{"asdeps",     no_argument,       0, 1008},
+		{"logfile",    required_argument, 0, 1009},
 		{0, 0, 0, 0}
 	};
 
@@ -338,6 +340,14 @@ static int parseargs(int argc, char *argv[])
 			case 1008:
 				config->flags |= PM_TRANS_FLAG_ALLDEPS;
 				break;
+			case 1009:
+				if(alpm_option_set_logfile(optarg) != 0) {
+					pm_printf(PM_LOG_ERROR, _("problem setting logfile '%s' (%s)\n"),
+							optarg, alpm_strerrorlast());
+					return(1);
+				}
+				config->have_logfile = 1;
+				break;
 			case 'A': config->op = (config->op != PM_OP_MAIN ? 0 : PM_OP_ADD); break;
 			case 'F':
 				config->op = (config->op != PM_OP_MAIN ? 0 : PM_OP_UPGRADE);
-- 
cgit v1.2.3-70-g09d2