public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] proj/ufed:master commit in: /
@ 2013-02-05 13:53 Sven Eden
  0 siblings, 0 replies; 238+ messages in thread
From: Sven Eden @ 2013-02-05 13:53 UTC (permalink / raw
  To: gentoo-commits

commit:     b337b321826a76e225f51606fe74041f6650f320
Author:     Sven Eden <sven.eden <AT> gmx <DOT> de>
AuthorDate: Tue Feb  5 13:54:02 2013 +0000
Commit:     Sven Eden <sven.eden <AT> gmx <DOT> de>
CommitDate: Tue Feb  5 13:54:02 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/ufed.git;a=commit;h=b337b321

Updated man page and moved it to be an .in file, as the local EPREFIX has to be determined and substituted before it can be installed.

---
 ufed-curses-help.c |    2 +-
 ufed.8             |  113 ---------------------------------------
 ufed.8.in          |  150 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 151 insertions(+), 114 deletions(-)

diff --git a/ufed-curses-help.c b/ufed-curses-help.c
index 02f852c..87fbb74 100644
--- a/ufed-curses-help.c
+++ b/ufed-curses-help.c
@@ -45,7 +45,7 @@ static void init_lines(void)
 "",
 "Note: Depending on your system, you may need to wait a second before ufed "
 "detects the Escape key or mouse clicks; in some cases, you can use the "
-"ncurses environment variable ESCDELAY to change this. See the ncurses(3x) "
+"ncurses environment variable ESCDELAY to change this. See the ncurses(3X) "
 "manpage for more info.",
 "",
 "--- Display layout ---",

diff --git a/ufed.8 b/ufed.8
deleted file mode 100644
index ce0619e..0000000
--- a/ufed.8
+++ /dev/null
@@ -1,113 +0,0 @@
-.TH "UFED" "8" "24 Apr 2002" "UFED 0.34" "UFED"
-.SH "NAME"
-ufed \- Gentoo Linux USE flags editor
-.SH "SYNOPSIS"
-.B ufed 
-.SH "DESCRIPTION"
-UFED is a simple program designed to help you configure the
-systems USE flags (see below) to your liking. To enable or
-disable a flag highlight it and hit space.
-
-UFED attempts to show you where a particular use setting
-came from. Each USE flag has a 3 character descriptor that
-represents the three ways a use flag can be set.
-Additionally two more characters show the status of the
-description found in that line.
-
-The 1st char is the setting from the make.defaults file(s).
-These are the defaults for Gentoo as a whole. These should
-not be changed.
-
-The 2nd char is the setting from the package.use file(s).
-These will change as packages are added or removed from the
-system.
-
-The 3rd char is the setting from the make.conf file. These
-are the only ones that should be changed by the user and
-these are the ones that UFED changes.
-
-If the character is a + then that USE flag was set in that
-file, if it is a space then the flag was not mentioned in
-that file and if it is a - then that flag was unset in that
-file.
-
-The 4th char is either empty for global flag descriptions
-or an L for local flag descriptions.
-
-The 5th char is either empty if none of the affected
-packages is installed, or an i if at least one affected
-package is installed.
-
-.B What are USE flags?
-
-The USE settings system is a flexible way to enable or disable various features
-at package build-time on a global level and for individual packages. This
-allows an administrator to control how packages are built in regards to the
-optional features which can be compiled into those packages.
-
-For instance, packages with optional GNOME support can have this support
-disabled at compile time by disabling the "gnome" USE flag. Enabling the
-"gnome" USE flag would enable GNOME support in these packages.
-
-The effect of USE flags on packages is dependent on whether both the
-software itself and the package ebuild supports the USE flag as an optional
-feature. If the software does not have support for an optional feature then the
-corresponding USE flag will obviously have no effect.
-
-Also many package dependencies are not considered optional by the software and
-thus USE flags will have no effect on those mandatory dependencies.
-
-A list of USE keywords used by a particular package can be found by checking
-the IUSE line in any ebuild file or by using "equery" from gentoolkit.
-
-See http://www.gentoo.org/doc/en/handbook/handbook-x86.xml?part=2&chap=2
-for more information on USE flags.
-
-Please also note that if UFED describes a flag (Unknown) it generally means
-that it is either a spelling error in one of the 3 configuration files or
-it is not an officially sanctioned USE flag. Sanctioned USE flags can be found 
-in /usr/portage/profiles/use.desc and in /usr/portage/profiles/use.local.desc.
-
-.SH "REPORTING BUGS"
-Please report bugs via http://bugs.gentoo.org/
-.SH "SEE ALSO"
-.BR emerge (1),
-.BR ebuild (5),
-.BR make.conf (5)
-.SH "FILES"
-.TP
-\fB@GENTOO_PORTAGE_EPREFIX@/etc/make.conf\fR 
-\fB@GENTOO_PORTAGE_EPREFIX@/etc/portage/make.conf\fR 
-.br
-Contains user specified USE flags
-.TP
-\fB@GENTOO_PORTAGE_EPREFIX@/etc/make.conf.old\fR
-\fB@GENTOO_PORTAGE_EPREFIX@/etc/portage/make.conf.old\fR
-.br
-This is where ufed places a backup of your make.conf file.
-.TP
-\fB@GENTOO_PORTAGE_EPREFIX@/etc/make.profile/make.defaults\fR
-Contains system default USE flags
-.TP
-\fB@GENTOO_PORTAGE_EPREFIX@/etc/make.profile/package.use\fR
-Contains per package default USE flags
-.TP
-\fB@GENTOO_PORTAGE_EPREFIX@/etc/make.profile/use.mask\fR
-Restricted USE flags
-.TP
-\fB@GENTOO_PORTAGE_EPREFIX@/usr/portage/profiles/use.desc\fR
-Description strings for global USE flags
-.TP
-\fB@GENTOO_PORTAGE_EPREFIX@/usr/portage/profiles/use.local.desc\fR
-Description strings for local USE flags
-.SH "AUTHORS"
-Robin Johnson <robbat2@gentoo.org>
-.br
-Fred Van Andel <fava@gentoo.org>
-.br
-Arun Bhanu <codebear@gentoo.org>
-.br
-Maik Schreiber <blizzy@gentoo.org> (original author)
-.br
-.SH "CVS HEADER"
-$Header: /var/cvsroot/gentoo-src/ufed/docs/ufed.8,v 1.4 2004/06/03 05:00:04 fava Exp $"

diff --git a/ufed.8.in b/ufed.8.in
new file mode 100644
index 0000000..2db4214
--- /dev/null
+++ b/ufed.8.in
@@ -0,0 +1,150 @@
+.TH "UFED" "8" "05 Feb 2013" "UFED 0.42" "UFED"
+.SH "NAME"
+ufed \- Gentoo Linux USE flags editor
+.SH "SYNOPSIS"
+.B ufed 
+.SH "DESCRIPTION"
+UFED is a simple program designed to help you configure the
+systems USE flags (see below) to your liking. To enable or
+disable a flag highlight it and hit space.
+
+.B Navigation and control
+
+Use the Up and Down arrow keys, the Page Up and Page Down keys, the Home and
+End keys, or start typing the name of a flag to select it.
+Use the space bar to toggle the setting.
+
+If ncurses is installed with the "gpm" use flag enabled, you can use your
+mouse to navigate and to toggle the settings, too.
+
+After changing flags, press the Return or Enter key to make this permanent,
+or press Escape to revert your changes.
+
+Note: Depending on your system, you may need to wait a second before ufed
+detects the Escape key or mouse clicks; in some cases, you can use the
+ncurses environment variable ESCDELAY to change this. See the ncurses(3X)
+manpage for more info.
+
+.B Display layout
+
+ufed will present you with a list of descriptions for each USE flag. If a
+description is too long to fit on your screen, you can use the Left and Right
+arrow keys to scroll the descriptions.
+
+ufed attempts to show you where a particular use setting came from, and what
+its scope and state is.
+
+The display consists of the following information:
+ (s) flag  M|DPC|Si| (packages) description
+
+(s)  : Your selection, either '+' to enable, '-' to disable, or empty to keep
+the default value.
+.br
+flag : The name of the flag
+.br
+M    : Either 'M' for Masked (always disabled), 'F' for Forced (always
+enabled) or empty for regular flags.
+.br
+D    : Default settings from make.defaults.
+.br
+P    : Package settings from package.use.
+.br
+C    : Configration setting from make.conf.
+.br
+S    : Scope of the description, package specific descriptions have an 'L'
+for "local".
+.br
+i    : 'i' if any affected package is installed.
+.br
+(packages): List of affected packages
+.br
+description : The description of the flag from use.desc or use.local.desc.
+
+If the character in any of the D, P or C column is a + then that USE flag was
+set in that file, if it is a space then the flag was not mentioned in that
+file and if it is a - then that flag was unset in that file.
+
+.B What are USE flags?
+
+The USE settings system is a flexible way to enable or disable various features
+at package build-time on a global level and for individual packages. This
+allows an administrator to control how packages are built in regards to the
+optional features which can be compiled into those packages.
+
+For instance, packages with optional GNOME support can have this support
+disabled at compile time by disabling the "gnome" USE flag. Enabling the
+"gnome" USE flag would enable GNOME support in these packages.
+
+The effect of USE flags on packages is dependent on whether both the
+software itself and the package ebuild supports the USE flag as an optional
+feature. If the software does not have support for an optional feature then the
+corresponding USE flag will obviously have no effect.
+
+Also many package dependencies are not considered optional by the software and
+thus USE flags will have no effect on those mandatory dependencies.
+
+A list of USE keywords used by a particular package can be found by checking
+the IUSE line in any ebuild file or by using "equery" from gentoolkit.
+
+See http://www.gentoo.org/doc/en/handbook/handbook-x86.xml?part=2&chap=2
+for more information on USE flags.
+
+Please also note that if UFED describes a flag (Unknown) it generally means
+that it is either a spelling error in one of the 3 configuration files or
+it is not an officially sanctioned USE flag. Sanctioned USE flags can be found 
+in /usr/portage/profiles/use.desc and in /usr/portage/profiles/use.local.desc.
+
+.SH "REPORTING BUGS"
+Please report bugs via http://bugs.gentoo.org/
+.SH "SEE ALSO"
+.BR emerge (1),
+.BR ebuild (5),
+.BR make.conf (5)
+.SH "FILES"
+.TP
+\fB@GENTOO_PORTAGE_EPREFIX@/etc/make.conf, @GENTOO_PORTAGE_EPREFIX@/etc/portage/make.conf\fR 
+.br
+Contains user specified USE flags
+.TP
+\fB@GENTOO_PORTAGE_EPREFIX@/etc/make.conf.old, @GENTOO_PORTAGE_EPREFIX@/etc/portage/make.conf.old\fR
+.br
+This is where ufed places a backup of your make.conf file.
+.TP
+\fB@GENTOO_PORTAGE_EPREFIX@/etc/make.profile/make.defaults\fR
+Contains system default USE flags
+.TP
+\fB@GENTOO_PORTAGE_EPREFIX@/etc/make.profile/package.use\fR
+Contains per package default USE flags
+.TP
+\fB@GENTOO_PORTAGE_EPREFIX@/etc/portage/package.use\fR
+Contains user specified USE flags per package
+.TP
+\fB@GENTOO_PORTAGE_EPREFIX@/etc/make.profile/use.mask\fR
+Restricted USE flags
+.TP
+\fB@GENTOO_PORTAGE_EPREFIX@/etc/make.profile/use.force\fR
+Enforced USE flags
+.TP
+\fB@GENTOO_PORTAGE_EPREFIX@/usr/portage/profiles/use.desc\fR
+Description strings for global USE flags
+.TP
+\fB@GENTOO_PORTAGE_EPREFIX@/usr/portage/profiles/use.local.desc\fR
+Description strings for local USE flags
+.SH "AUTHORS"
+ufed was originally written by Maik Schreiber <blizzy@blizzy.de>.
+.br
+ufed was previously maintained by
+.br
+ Robin Johnson <robbat2@gentoo.org>,
+.br
+ Fred Van Andel <fava@gentoo.org>,
+.br
+ Arun Bhanu <codebear@gentoo.org> and
+.br
+ Harald van Dijk <truedfx@gentoo.org>.
+.br
+ufed is currently maintained by
+.br
+ Sven Eden <yamakuzure@gmx.net>.
+.SH "CVS HEADER"
+$Header: /var/cvsroot/gentoo-src/ufed/docs/ufed.8,v 1.4 2004/06/03 05:00:04 fava Exp $"


^ permalink raw reply related	[flat|nested] 238+ messages in thread
* [gentoo-commits] proj/ufed:master commit in: /
@ 2020-11-07 14:25 Sven Eden
  0 siblings, 0 replies; 238+ messages in thread
From: Sven Eden @ 2020-11-07 14:25 UTC (permalink / raw
  To: gentoo-commits

commit:     0755fcf420d120b978cf6cf9364a26c6c0e67c0b
Author:     Sven Eden <sven.eden <AT> prydeworx <DOT> com>
AuthorDate: Sat Nov  7 14:25:16 2020 +0000
Commit:     Sven Eden <sven.eden <AT> gmx <DOT> de>
CommitDate: Sat Nov  7 14:25:16 2020 +0000
URL:        https://gitweb.gentoo.org/proj/ufed.git/commit/?id=0755fcf4

Remove -* from flag list as being very dangerous. (Bug 722856)

Signed-off-by: Sven Eden <sven.eden <AT> prydeworx.com>

 Portage.pm | 15 +--------------
 1 file changed, 1 insertion(+), 14 deletions(-)

diff --git a/Portage.pm b/Portage.pm
index 3b1791e..706af38 100644
--- a/Portage.pm
+++ b/Portage.pm
@@ -431,22 +431,9 @@ sub _determine_profiles
 # No parameters accepted
 sub _final_cleaning
 {
-	# The "disable all" flag is truncated to '*' by the parsing, but
-	# it has to read '-*'.
-	_add_temp("-*", "global");
-
-	$_use_temp->{'-*'}{global}{descr} = "{Never enable any flags other than those specified in make.conf}";
-	$_use_temp->{'-*'}{global}{conf} = 0; ## Can never be -1
-
-	# Set it from the truncated config:
-	if (defined($_use_temp->{'*'}{global})) {
-		$_use_temp->{'*'}{global}{conf} > -1
-			and $_use_temp->{'-*'}{global}{conf} = 1;
-	}
-
 	# The following use flags are dangerous or internal only
 	# and must no be available using ufed:
-	defined($_use_temp->{"*"})         and delete($_use_temp->{"*"});
+	defined($_use_temp->{"*"})         and delete($_use_temp->{"*"}); ## USE="-*"
 	defined($_use_temp->{"bootstrap"}) and delete($_use_temp->{"bootstrap"});
 	defined($_use_temp->{"build"})     and delete($_use_temp->{"build"});
 	defined($_use_temp->{"livecd"})    and delete($_use_temp->{"livecd"});


^ permalink raw reply related	[flat|nested] 238+ messages in thread
* [gentoo-commits] proj/ufed:master commit in: /
@ 2020-05-02  8:38 Ulrich Müller
  0 siblings, 0 replies; 238+ messages in thread
From: Ulrich Müller @ 2020-05-02  8:38 UTC (permalink / raw
  To: gentoo-commits

commit:     6c38e84d36291e1bc9ebf1a924a727cf240f65f3
Author:     Ulrich Müller <ulm <AT> gentoo <DOT> org>
AuthorDate: Sat May  2 08:37:53 2020 +0000
Commit:     Ulrich Müller <ulm <AT> gentoo <DOT> org>
CommitDate: Sat May  2 08:37:53 2020 +0000
URL:        https://gitweb.gentoo.org/proj/ufed.git/commit/?id=6c38e84d

Mark package.use flags as local rather than global.

Thanks to Martin Väth <martin <AT> mvath.de> for the patch.

Bug: https://bugs.gentoo.org/549042
Signed-off-by: Ulrich Müller <ulm <AT> gentoo.org>

 Portage.pm | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Portage.pm b/Portage.pm
index 0815fb2..3b1791e 100644
--- a/Portage.pm
+++ b/Portage.pm
@@ -938,7 +938,7 @@ sub _read_package_use
 			for my $flag (@flags) {
 				my $state = $flag =~ s/^-// || 0;
 
-				_add_temp($flag, "global");
+				_add_temp($flag, "local");
 				_add_temp($flag, $pkg);
 
 				if ($state) {


^ permalink raw reply related	[flat|nested] 238+ messages in thread
* [gentoo-commits] proj/ufed:master commit in: /
@ 2019-09-27  6:42 Sven Eden
  0 siblings, 0 replies; 238+ messages in thread
From: Sven Eden @ 2019-09-27  6:42 UTC (permalink / raw
  To: gentoo-commits

commit:     6bc38442b022588b18577962c56d05cfb7fceede
Author:     Sven Eden <yamakuzure <AT> gmx <DOT> net>
AuthorDate: Fri Sep 27 06:38:50 2019 +0000
Commit:     Sven Eden <sven.eden <AT> gmx <DOT> de>
CommitDate: Fri Sep 27 06:42:12 2019 +0000
URL:        https://gitweb.gentoo.org/proj/ufed.git/commit/?id=6bc38442

Version 0.95 Release

Closes: https://bugs.gentoo.org/695262
Signed-off-by: Sven Eden <yamakuzure <AT> gmx.net>

 configure.ac | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/configure.ac b/configure.ac
index a8eda7f..5a93678 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,5 +1,5 @@
 AC_PREREQ([2.69])
-AC_INIT([ufed],[git],[https://bugs.gentoo.org/])
+AC_INIT([ufed],[0.95],[https://bugs.gentoo.org/])
 AM_INIT_AUTOMAKE([1.14 -Wall foreign dist-bzip2 no-dist-gzip subdir-objects])
 AC_CONFIG_SRCDIR([ufed-curses.c])
 AC_CONFIG_HEADERS([config.h])


^ permalink raw reply related	[flat|nested] 238+ messages in thread
* [gentoo-commits] proj/ufed:master commit in: /
@ 2019-09-27  6:39 Sven Eden
  0 siblings, 0 replies; 238+ messages in thread
From: Sven Eden @ 2019-09-27  6:39 UTC (permalink / raw
  To: gentoo-commits

commit:     fedffcced0e40ea7882bf944f83b3a09b4595b1b
Author:     Sven Eden <yamakuzure <AT> gmx <DOT> net>
AuthorDate: Fri Sep 27 06:38:50 2019 +0000
Commit:     Sven Eden <sven.eden <AT> gmx <DOT> de>
CommitDate: Fri Sep 27 06:39:15 2019 +0000
URL:        https://gitweb.gentoo.org/proj/ufed.git/commit/?id=fedffcce

Version 0.95 Release

Signed-off-by: Sven Eden <yamakuzure <AT> gmx.net>

 configure.ac | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/configure.ac b/configure.ac
index a8eda7f..5a93678 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,5 +1,5 @@
 AC_PREREQ([2.69])
-AC_INIT([ufed],[git],[https://bugs.gentoo.org/])
+AC_INIT([ufed],[0.95],[https://bugs.gentoo.org/])
 AM_INIT_AUTOMAKE([1.14 -Wall foreign dist-bzip2 no-dist-gzip subdir-objects])
 AC_CONFIG_SRCDIR([ufed-curses.c])
 AC_CONFIG_HEADERS([config.h])


^ permalink raw reply related	[flat|nested] 238+ messages in thread
* [gentoo-commits] proj/ufed:master commit in: /
@ 2019-09-24 17:57 Sven Eden
  0 siblings, 0 replies; 238+ messages in thread
From: Sven Eden @ 2019-09-24 17:57 UTC (permalink / raw
  To: gentoo-commits

commit:     5df696152a15ab827381d524c28ce87ee0568a00
Author:     Sven Eden <yamakuzure <AT> gmx <DOT> net>
AuthorDate: Tue Sep 24 17:45:47 2019 +0000
Commit:     Sven Eden <sven.eden <AT> gmx <DOT> de>
CommitDate: Tue Sep 24 17:57:12 2019 +0000
URL:        https://gitweb.gentoo.org/proj/ufed.git/commit/?id=5df69615

Do not hand over overly long lines (Fixes bug #695262)

ufed-curses-checklist.c:ufed_getline() is limited to LINE_MAX, which is 2048
bytes. Unfortunately local USE flags can blast this limit, as ufed.pl also
transmit an alternative description with stripped keywords.

This commit lets ufed.pl calculate whether a description has to be shorted, and
does so if needed.

Bug: https://bugs.gentoo.org/695262
Signed-off-by: Sven Eden <yamakuzure <AT> gmx.net>

 .gitignore |  2 ++
 ufed.pl.in | 13 +++++++++++--
 2 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/.gitignore b/.gitignore
index c16694f..fc4c607 100644
--- a/.gitignore
+++ b/.gitignore
@@ -25,3 +25,5 @@ depcomp
 install-sh
 missing
 compile
+ufed.workspace*
+cb/*

diff --git a/ufed.pl.in b/ufed.pl.in
index 4cd2484..f01c8a2 100644
--- a/ufed.pl.in
+++ b/ufed.pl.in
@@ -109,9 +109,18 @@ sub flags_dialog {
 
 		# Finally print the local description lines
 		for my $pkg (sort keys %{$conf->{"local"}}) {
+			# ufed handles up to 2048 bytes long lines, but local descriptions can be as long
+			# as maintainers choose, so we have to do a bit more work here.
+			my $extra_len = length($pkg) + 18; # +One for the NULL-Byte
+			my $full_desc = $conf->{"local"}{$pkg}{descr};
+			my $alt_desc  = $conf->{"local"}{$pkg}{descr_alt};
+			my $full_max  = (2048 - $extra_len) / 3 * 2 - 19; # 19 is the length of the metadata hint
+			my $alt_max   = (2048 - $extra_len) / 3 - 1;
 			$outTxt .= sprintf("\t%s\t%s\t (%s) [ %s%s%s%s%s%s]\n",
-						$conf->{"local"}{$pkg}{descr},
-						$conf->{"local"}{$pkg}{descr_alt},
+						( length($full_desc) > $full_max
+						  ?  substr($full_desc, 0, $full_max) . " (See metadata.xml)"
+						  :         $full_desc ),
+						substr($alt_desc, 0, $alt_max),
 						$pkg,
 						$conf->{"local"}{$pkg}{installed} > 0 ? '+' :
 						$conf->{"local"}{$pkg}{installed} < 0 ? '-' : ' ',


^ permalink raw reply related	[flat|nested] 238+ messages in thread
* [gentoo-commits] proj/ufed:master commit in: /
@ 2019-09-24 17:56 Sven Eden
  0 siblings, 0 replies; 238+ messages in thread
From: Sven Eden @ 2019-09-24 17:56 UTC (permalink / raw
  To: gentoo-commits

commit:     2242469d3d92ec35ca50ad7cdd394a0c59365997
Author:     Sven Eden <yamakuzure <AT> gmx <DOT> net>
AuthorDate: Tue Sep 24 17:45:47 2019 +0000
Commit:     Sven Eden <sven.eden <AT> gmx <DOT> de>
CommitDate: Tue Sep 24 17:45:47 2019 +0000
URL:        https://gitweb.gentoo.org/proj/ufed.git/commit/?id=2242469d

Do not hand over overly long lines (Fixes bug #695262)

ufed-curses-checklist.c:ufed_getline() is limited to LINE_MAX, which is 2048
bytes. Unfortunately local USE flags can blast this limit, as ufed.pl also
transmit an alternative description with stripped keywords.

This commit lets ufed.pl calculate whether a description has to be shorted, and
does so if needed.

Bug: 695262
Signed-off-by: Sven Eden <yamakuzure <AT> gmx.net>

 .gitignore |  2 ++
 ufed.pl.in | 13 +++++++++++--
 2 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/.gitignore b/.gitignore
index c16694f..fc4c607 100644
--- a/.gitignore
+++ b/.gitignore
@@ -25,3 +25,5 @@ depcomp
 install-sh
 missing
 compile
+ufed.workspace*
+cb/*

diff --git a/ufed.pl.in b/ufed.pl.in
index 4cd2484..f01c8a2 100644
--- a/ufed.pl.in
+++ b/ufed.pl.in
@@ -109,9 +109,18 @@ sub flags_dialog {
 
 		# Finally print the local description lines
 		for my $pkg (sort keys %{$conf->{"local"}}) {
+			# ufed handles up to 2048 bytes long lines, but local descriptions can be as long
+			# as maintainers choose, so we have to do a bit more work here.
+			my $extra_len = length($pkg) + 18; # +One for the NULL-Byte
+			my $full_desc = $conf->{"local"}{$pkg}{descr};
+			my $alt_desc  = $conf->{"local"}{$pkg}{descr_alt};
+			my $full_max  = (2048 - $extra_len) / 3 * 2 - 19; # 19 is the length of the metadata hint
+			my $alt_max   = (2048 - $extra_len) / 3 - 1;
 			$outTxt .= sprintf("\t%s\t%s\t (%s) [ %s%s%s%s%s%s]\n",
-						$conf->{"local"}{$pkg}{descr},
-						$conf->{"local"}{$pkg}{descr_alt},
+						( length($full_desc) > $full_max
+						  ?  substr($full_desc, 0, $full_max) . " (See metadata.xml)"
+						  :         $full_desc ),
+						substr($alt_desc, 0, $alt_max),
 						$pkg,
 						$conf->{"local"}{$pkg}{installed} > 0 ? '+' :
 						$conf->{"local"}{$pkg}{installed} < 0 ? '-' : ' ',


^ permalink raw reply related	[flat|nested] 238+ messages in thread
* [gentoo-commits] proj/ufed:master commit in: /
@ 2019-04-07 15:17 David Seifert
  0 siblings, 0 replies; 238+ messages in thread
From: David Seifert @ 2019-04-07 15:17 UTC (permalink / raw
  To: gentoo-commits

commit:     d7566969c2009d876eefd9016514650faada3521
Author:     David Seifert <soap <AT> gentoo <DOT> org>
AuthorDate: Sun Apr  7 15:15:36 2019 +0000
Commit:     David Seifert <soap <AT> gentoo <DOT> org>
CommitDate: Sun Apr  7 15:15:36 2019 +0000
URL:        https://gitweb.gentoo.org/proj/ufed.git/commit/?id=d7566969

Rename `getline` to `ufed_getline` to avoid clash

* `getline` is defined by POSIX.1-2008
  http://man7.org/linux/man-pages/man3/getline.3.html

Bug: https://bugs.gentoo.org/644518
Signed-off-by: David Seifert <soap <AT> gentoo.org>

 ufed-curses-checklist.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/ufed-curses-checklist.c b/ufed-curses-checklist.c
index d457c1c..3f81c9f 100644
--- a/ufed-curses-checklist.c
+++ b/ufed-curses-checklist.c
@@ -27,7 +27,7 @@ static void setFlagWrapDraw(sFlag* flag, int index, sWrap** wrap, size_t* pos, s
 
 
 /* static functions */
-static char *getline(FILE *fp)
+static char *ufed_getline(FILE *fp)
 {
 	static size_t size = LINE_MAX;
 
@@ -101,7 +101,7 @@ static void read_flags(void)
 		ERROR_EXIT(-1, "fdopen failed with error %d\n", errno);
 	atexit(&free_flags);
 
-	for(line = getline(input); line ; line = getline(input)) {
+	for(line = ufed_getline(input); line ; line = ufed_getline(input)) {
 		name.start  = name.end  = -1;
 		state.start = state.end = -1;
 
@@ -135,7 +135,7 @@ static void read_flags(void)
 			pkg.start      = pkg.end      = -1;
 			state.start    = state.end    = -1;
 
-			line = getline(input);
+			line = ufed_getline(input);
 			if (!line) break;
 
 			if ( (sscanf(line, "\t%n%*[^\t]%n\t%n%*[^\t]%n\t (%n%*[^)]%n) [%n%*[ +-]%n%c",


^ permalink raw reply related	[flat|nested] 238+ messages in thread
* [gentoo-commits] proj/ufed:master commit in: /
@ 2019-04-07 13:56 David Seifert
  0 siblings, 0 replies; 238+ messages in thread
From: David Seifert @ 2019-04-07 13:56 UTC (permalink / raw
  To: gentoo-commits

commit:     42f34212fed44f783da8af3d9deb230dbef9fa9f
Author:     David Seifert <soap <AT> gentoo <DOT> org>
AuthorDate: Sun Apr  7 13:56:33 2019 +0000
Commit:     David Seifert <soap <AT> gentoo <DOT> org>
CommitDate: Sun Apr  7 13:56:33 2019 +0000
URL:        https://gitweb.gentoo.org/proj/ufed.git/commit/?id=42f34212

Fix `make distcheck`

Signed-off-by: David Seifert <soap <AT> gentoo.org>

 Makefile.am  | 14 ++++++--------
 configure.ac |  2 +-
 2 files changed, 7 insertions(+), 9 deletions(-)

diff --git a/Makefile.am b/Makefile.am
index f8f5999..3cc209d 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -20,27 +20,25 @@ noinst_HEADERS = \
 	ufed-curses-globals.h \
 	ufed-curses-help.h \
 	ufed-curses-types.h
-	
-dist_man_MANS = ufed.8
+
+man_MANS = ufed.8
 EXTRA_DIST = ufed.pl.in ufed.8.in
 
+CLEANFILES = $(sbin_SCRIPTS) $(man_MANS)
+
 ufed: $(top_srcdir)/ufed.pl.in
-	cd $(top_srcdir) && \
 	rm -f ufed.tmp && \
 	$(SED) \
 		-e 's|XX_PACKAGE_VERSION[@]|$(PACKAGE_VERSION)|g' \
 		-e 's|XX_PERL[@]|$(PERL)|g' \
 		-e 's|XX_pkglibexecdir[@]|$(pkglibexecdir)|g' \
 		-e 's|XX_perldir[@]|$(perldir)|g' \
-		ufed.pl.in >ufed.tmp && \
-	chmod +x ufed.tmp && \
+		$(top_srcdir)/ufed.pl.in >ufed.tmp && \
 	mv ufed.tmp ufed
 
 ufed.8: $(top_srcdir)/ufed.8.in
-	cd $(top_srcdir) && \
 	rm -f ufed.8.tmp && \
 	$(SED) \
 		-e 's|@GENTOO_PORTAGE_EPREFIX@|$(E_PREFIX)|g' \
-		ufed.8.in >ufed.8.tmp && \
-	chmod +x ufed.8.tmp && \
+		$(top_srcdir)/ufed.8.in >ufed.8.tmp && \
 	mv ufed.8.tmp ufed.8

diff --git a/configure.ac b/configure.ac
index 736d06a..a8eda7f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,6 +1,6 @@
 AC_PREREQ([2.69])
 AC_INIT([ufed],[git],[https://bugs.gentoo.org/])
-AM_INIT_AUTOMAKE([foreign subdir-objects])
+AM_INIT_AUTOMAKE([1.14 -Wall foreign dist-bzip2 no-dist-gzip subdir-objects])
 AC_CONFIG_SRCDIR([ufed-curses.c])
 AC_CONFIG_HEADERS([config.h])
 


^ permalink raw reply related	[flat|nested] 238+ messages in thread
* [gentoo-commits] proj/ufed:master commit in: /
@ 2019-04-07 13:19 David Seifert
  0 siblings, 0 replies; 238+ messages in thread
From: David Seifert @ 2019-04-07 13:19 UTC (permalink / raw
  To: gentoo-commits

commit:     2a8781ad0f4625c898538ecd76214a3a416c779a
Author:     David Seifert <soap <AT> gentoo <DOT> org>
AuthorDate: Sun Apr  7 13:19:14 2019 +0000
Commit:     David Seifert <soap <AT> gentoo <DOT> org>
CommitDate: Sun Apr  7 13:19:14 2019 +0000
URL:        https://gitweb.gentoo.org/proj/ufed.git/commit/?id=2a8781ad

Fix unescaped left brace warning

Bug: https://bugs.gentoo.org/675332
Signed-off-by: David Seifert <soap <AT> gentoo.org>

 Portage.pm | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Portage.pm b/Portage.pm
index a86e5bb..0815fb2 100644
--- a/Portage.pm
+++ b/Portage.pm
@@ -1055,7 +1055,7 @@ sub _read_sh {
 						$addvalue =~ s[
 							\\\n       | # backslash-newline
 							\\(.)      | # other escaped characters
-							\$({)?       # $
+							\$(\{)?      # $
 							$IDENT       # followed by an identifier
 							(?(2)})      # optionally enclosed in braces
 						][


^ permalink raw reply related	[flat|nested] 238+ messages in thread
* [gentoo-commits] proj/ufed:master commit in: /
@ 2019-04-07 13:19 David Seifert
  0 siblings, 0 replies; 238+ messages in thread
From: David Seifert @ 2019-04-07 13:19 UTC (permalink / raw
  To: gentoo-commits

commit:     b7ec4bddf04444ca3c44340cbdb42539bbd4ca73
Author:     David Seifert <soap <AT> gentoo <DOT> org>
AuthorDate: Sun Apr  7 13:19:23 2019 +0000
Commit:     David Seifert <soap <AT> gentoo <DOT> org>
CommitDate: Sun Apr  7 13:19:23 2019 +0000
URL:        https://gitweb.gentoo.org/proj/ufed.git/commit/?id=b7ec4bdd

Remove and .gitignore Autotools cruft

Signed-off-by: David Seifert <soap <AT> gentoo.org>

 .gitignore  |   5 +
 config.h.in |  67 -------
 depcomp     | 630 ------------------------------------------------------------
 install-sh  | 520 -------------------------------------------------
 missing     | 376 ------------------------------------
 5 files changed, 5 insertions(+), 1593 deletions(-)

diff --git a/.gitignore b/.gitignore
index 9ac0d82..c16694f 100644
--- a/.gitignore
+++ b/.gitignore
@@ -20,3 +20,8 @@ ufed.8
 patches/
 *.tar.bz2
 ufed-?.*/
+config.h.in
+depcomp
+install-sh
+missing
+compile

diff --git a/config.h.in b/config.h.in
deleted file mode 100644
index 0916a33..0000000
--- a/config.h.in
+++ /dev/null
@@ -1,67 +0,0 @@
-/* config.h.in.  Generated from configure.ac by autoheader.  */
-
-/* Define to 1 if you have the <inttypes.h> header file. */
-#undef HAVE_INTTYPES_H
-
-/* Define to 1 if you have the <memory.h> header file. */
-#undef HAVE_MEMORY_H
-
-/* Define to 1 if you have the <stdint.h> header file. */
-#undef HAVE_STDINT_H
-
-/* Define to 1 if you have the <stdlib.h> header file. */
-#undef HAVE_STDLIB_H
-
-/* Define to 1 if you have the <strings.h> header file. */
-#undef HAVE_STRINGS_H
-
-/* Define to 1 if you have the <string.h> header file. */
-#undef HAVE_STRING_H
-
-/* Define to 1 if you have the <sys/stat.h> header file. */
-#undef HAVE_SYS_STAT_H
-
-/* Define to 1 if you have the <sys/types.h> header file. */
-#undef HAVE_SYS_TYPES_H
-
-/* Define to 1 if you have the <unistd.h> header file. */
-#undef HAVE_UNISTD_H
-
-/* Define to 1 if the system has the type `_Bool'. */
-#undef HAVE__BOOL
-
-/* Name of package */
-#undef PACKAGE
-
-/* Define to the address where bug reports for this package should be sent. */
-#undef PACKAGE_BUGREPORT
-
-/* Define to the full name of this package. */
-#undef PACKAGE_NAME
-
-/* Define to the full name and version of this package. */
-#undef PACKAGE_STRING
-
-/* Define to the one symbol short name of this package. */
-#undef PACKAGE_TARNAME
-
-/* Define to the home page for this package. */
-#undef PACKAGE_URL
-
-/* Define to the version of this package. */
-#undef PACKAGE_VERSION
-
-/* Define to 1 if you have the ANSI C header files. */
-#undef STDC_HEADERS
-
-/* Version number of package */
-#undef VERSION
-
-/* Define to `__inline__' or `__inline' if that's what the C compiler
-   calls it, or to nothing if 'inline' is not supported under any name.  */
-#ifndef __cplusplus
-#undef inline
-#endif
-
-/* Define to `unsigned int' if <sys/types.h> does not define. */
-#undef size_t

diff --git a/depcomp b/depcomp
deleted file mode 100755
index df8eea7..0000000
--- a/depcomp
+++ /dev/null
@@ -1,630 +0,0 @@
-#! /bin/sh
-# depcomp - compile a program generating dependencies as side-effects
-
-scriptversion=2009-04-28.21; # UTC
-
-# Copyright (C) 1999, 2000, 2003, 2004, 2005, 2006, 2007, 2009 Free
-# Software Foundation, Inc.
-
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2, or (at your option)
-# any later version.
-
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-
-# You should have received a copy of the GNU General Public License
-# along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-# As a special exception to the GNU General Public License, if you
-# distribute this file as part of a program that contains a
-# configuration script generated by Autoconf, you may include it under
-# the same distribution terms that you use for the rest of that program.
-
-# Originally written by Alexandre Oliva <oliva@dcc.unicamp.br>.
-
-case $1 in
-  '')
-     echo "$0: No command.  Try \`$0 --help' for more information." 1>&2
-     exit 1;
-     ;;
-  -h | --h*)
-    cat <<\EOF
-Usage: depcomp [--help] [--version] PROGRAM [ARGS]
-
-Run PROGRAMS ARGS to compile a file, generating dependencies
-as side-effects.
-
-Environment variables:
-  depmode     Dependency tracking mode.
-  source      Source file read by `PROGRAMS ARGS'.
-  object      Object file output by `PROGRAMS ARGS'.
-  DEPDIR      directory where to store dependencies.
-  depfile     Dependency file to output.
-  tmpdepfile  Temporary file to use when outputing dependencies.
-  libtool     Whether libtool is used (yes/no).
-
-Report bugs to <bug-automake@gnu.org>.
-EOF
-    exit $?
-    ;;
-  -v | --v*)
-    echo "depcomp $scriptversion"
-    exit $?
-    ;;
-esac
-
-if test -z "$depmode" || test -z "$source" || test -z "$object"; then
-  echo "depcomp: Variables source, object and depmode must be set" 1>&2
-  exit 1
-fi
-
-# Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po.
-depfile=${depfile-`echo "$object" |
-  sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`}
-tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`}
-
-rm -f "$tmpdepfile"
-
-# Some modes work just like other modes, but use different flags.  We
-# parameterize here, but still list the modes in the big case below,
-# to make depend.m4 easier to write.  Note that we *cannot* use a case
-# here, because this file can only contain one case statement.
-if test "$depmode" = hp; then
-  # HP compiler uses -M and no extra arg.
-  gccflag=-M
-  depmode=gcc
-fi
-
-if test "$depmode" = dashXmstdout; then
-   # This is just like dashmstdout with a different argument.
-   dashmflag=-xM
-   depmode=dashmstdout
-fi
-
-cygpath_u="cygpath -u -f -"
-if test "$depmode" = msvcmsys; then
-   # This is just like msvisualcpp but w/o cygpath translation.
-   # Just convert the backslash-escaped backslashes to single forward
-   # slashes to satisfy depend.m4
-   cygpath_u="sed s,\\\\\\\\,/,g"
-   depmode=msvisualcpp
-fi
-
-case "$depmode" in
-gcc3)
-## gcc 3 implements dependency tracking that does exactly what
-## we want.  Yay!  Note: for some reason libtool 1.4 doesn't like
-## it if -MD -MP comes after the -MF stuff.  Hmm.
-## Unfortunately, FreeBSD c89 acceptance of flags depends upon
-## the command line argument order; so add the flags where they
-## appear in depend2.am.  Note that the slowdown incurred here
-## affects only configure: in makefiles, %FASTDEP% shortcuts this.
-  for arg
-  do
-    case $arg in
-    -c) set fnord "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" "$arg" ;;
-    *)  set fnord "$@" "$arg" ;;
-    esac
-    shift # fnord
-    shift # $arg
-  done
-  "$@"
-  stat=$?
-  if test $stat -eq 0; then :
-  else
-    rm -f "$tmpdepfile"
-    exit $stat
-  fi
-  mv "$tmpdepfile" "$depfile"
-  ;;
-
-gcc)
-## There are various ways to get dependency output from gcc.  Here's
-## why we pick this rather obscure method:
-## - Don't want to use -MD because we'd like the dependencies to end
-##   up in a subdir.  Having to rename by hand is ugly.
-##   (We might end up doing this anyway to support other compilers.)
-## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like
-##   -MM, not -M (despite what the docs say).
-## - Using -M directly means running the compiler twice (even worse
-##   than renaming).
-  if test -z "$gccflag"; then
-    gccflag=-MD,
-  fi
-  "$@" -Wp,"$gccflag$tmpdepfile"
-  stat=$?
-  if test $stat -eq 0; then :
-  else
-    rm -f "$tmpdepfile"
-    exit $stat
-  fi
-  rm -f "$depfile"
-  echo "$object : \\" > "$depfile"
-  alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz
-## The second -e expression handles DOS-style file names with drive letters.
-  sed -e 's/^[^:]*: / /' \
-      -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile"
-## This next piece of magic avoids the `deleted header file' problem.
-## The problem is that when a header file which appears in a .P file
-## is deleted, the dependency causes make to die (because there is
-## typically no way to rebuild the header).  We avoid this by adding
-## dummy dependencies for each header file.  Too bad gcc doesn't do
-## this for us directly.
-  tr ' ' '
-' < "$tmpdepfile" |
-## Some versions of gcc put a space before the `:'.  On the theory
-## that the space means something, we add a space to the output as
-## well.
-## Some versions of the HPUX 10.20 sed can't process this invocation
-## correctly.  Breaking it into two sed invocations is a workaround.
-    sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
-  rm -f "$tmpdepfile"
-  ;;
-
-hp)
-  # This case exists only to let depend.m4 do its work.  It works by
-  # looking at the text of this script.  This case will never be run,
-  # since it is checked for above.
-  exit 1
-  ;;
-
-sgi)
-  if test "$libtool" = yes; then
-    "$@" "-Wp,-MDupdate,$tmpdepfile"
-  else
-    "$@" -MDupdate "$tmpdepfile"
-  fi
-  stat=$?
-  if test $stat -eq 0; then :
-  else
-    rm -f "$tmpdepfile"
-    exit $stat
-  fi
-  rm -f "$depfile"
-
-  if test -f "$tmpdepfile"; then  # yes, the sourcefile depend on other files
-    echo "$object : \\" > "$depfile"
-
-    # Clip off the initial element (the dependent).  Don't try to be
-    # clever and replace this with sed code, as IRIX sed won't handle
-    # lines with more than a fixed number of characters (4096 in
-    # IRIX 6.2 sed, 8192 in IRIX 6.5).  We also remove comment lines;
-    # the IRIX cc adds comments like `#:fec' to the end of the
-    # dependency line.
-    tr ' ' '
-' < "$tmpdepfile" \
-    | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \
-    tr '
-' ' ' >> "$depfile"
-    echo >> "$depfile"
-
-    # The second pass generates a dummy entry for each header file.
-    tr ' ' '
-' < "$tmpdepfile" \
-   | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \
-   >> "$depfile"
-  else
-    # The sourcefile does not contain any dependencies, so just
-    # store a dummy comment line, to avoid errors with the Makefile
-    # "include basename.Plo" scheme.
-    echo "#dummy" > "$depfile"
-  fi
-  rm -f "$tmpdepfile"
-  ;;
-
-aix)
-  # The C for AIX Compiler uses -M and outputs the dependencies
-  # in a .u file.  In older versions, this file always lives in the
-  # current directory.  Also, the AIX compiler puts `$object:' at the
-  # start of each line; $object doesn't have directory information.
-  # Version 6 uses the directory in both cases.
-  dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
-  test "x$dir" = "x$object" && dir=
-  base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
-  if test "$libtool" = yes; then
-    tmpdepfile1=$dir$base.u
-    tmpdepfile2=$base.u
-    tmpdepfile3=$dir.libs/$base.u
-    "$@" -Wc,-M
-  else
-    tmpdepfile1=$dir$base.u
-    tmpdepfile2=$dir$base.u
-    tmpdepfile3=$dir$base.u
-    "$@" -M
-  fi
-  stat=$?
-
-  if test $stat -eq 0; then :
-  else
-    rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
-    exit $stat
-  fi
-
-  for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
-  do
-    test -f "$tmpdepfile" && break
-  done
-  if test -f "$tmpdepfile"; then
-    # Each line is of the form `foo.o: dependent.h'.
-    # Do two passes, one to just change these to
-    # `$object: dependent.h' and one to simply `dependent.h:'.
-    sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile"
-    # That's a tab and a space in the [].
-    sed -e 's,^.*\.[a-z]*:[	 ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
-  else
-    # The sourcefile does not contain any dependencies, so just
-    # store a dummy comment line, to avoid errors with the Makefile
-    # "include basename.Plo" scheme.
-    echo "#dummy" > "$depfile"
-  fi
-  rm -f "$tmpdepfile"
-  ;;
-
-icc)
-  # Intel's C compiler understands `-MD -MF file'.  However on
-  #    icc -MD -MF foo.d -c -o sub/foo.o sub/foo.c
-  # ICC 7.0 will fill foo.d with something like
-  #    foo.o: sub/foo.c
-  #    foo.o: sub/foo.h
-  # which is wrong.  We want:
-  #    sub/foo.o: sub/foo.c
-  #    sub/foo.o: sub/foo.h
-  #    sub/foo.c:
-  #    sub/foo.h:
-  # ICC 7.1 will output
-  #    foo.o: sub/foo.c sub/foo.h
-  # and will wrap long lines using \ :
-  #    foo.o: sub/foo.c ... \
-  #     sub/foo.h ... \
-  #     ...
-
-  "$@" -MD -MF "$tmpdepfile"
-  stat=$?
-  if test $stat -eq 0; then :
-  else
-    rm -f "$tmpdepfile"
-    exit $stat
-  fi
-  rm -f "$depfile"
-  # Each line is of the form `foo.o: dependent.h',
-  # or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'.
-  # Do two passes, one to just change these to
-  # `$object: dependent.h' and one to simply `dependent.h:'.
-  sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile"
-  # Some versions of the HPUX 10.20 sed can't process this invocation
-  # correctly.  Breaking it into two sed invocations is a workaround.
-  sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" |
-    sed -e 's/$/ :/' >> "$depfile"
-  rm -f "$tmpdepfile"
-  ;;
-
-hp2)
-  # The "hp" stanza above does not work with aCC (C++) and HP's ia64
-  # compilers, which have integrated preprocessors.  The correct option
-  # to use with these is +Maked; it writes dependencies to a file named
-  # 'foo.d', which lands next to the object file, wherever that
-  # happens to be.
-  # Much of this is similar to the tru64 case; see comments there.
-  dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
-  test "x$dir" = "x$object" && dir=
-  base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
-  if test "$libtool" = yes; then
-    tmpdepfile1=$dir$base.d
-    tmpdepfile2=$dir.libs/$base.d
-    "$@" -Wc,+Maked
-  else
-    tmpdepfile1=$dir$base.d
-    tmpdepfile2=$dir$base.d
-    "$@" +Maked
-  fi
-  stat=$?
-  if test $stat -eq 0; then :
-  else
-     rm -f "$tmpdepfile1" "$tmpdepfile2"
-     exit $stat
-  fi
-
-  for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2"
-  do
-    test -f "$tmpdepfile" && break
-  done
-  if test -f "$tmpdepfile"; then
-    sed -e "s,^.*\.[a-z]*:,$object:," "$tmpdepfile" > "$depfile"
-    # Add `dependent.h:' lines.
-    sed -ne '2,${
-	       s/^ *//
-	       s/ \\*$//
-	       s/$/:/
-	       p
-	     }' "$tmpdepfile" >> "$depfile"
-  else
-    echo "#dummy" > "$depfile"
-  fi
-  rm -f "$tmpdepfile" "$tmpdepfile2"
-  ;;
-
-tru64)
-   # The Tru64 compiler uses -MD to generate dependencies as a side
-   # effect.  `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'.
-   # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put
-   # dependencies in `foo.d' instead, so we check for that too.
-   # Subdirectories are respected.
-   dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
-   test "x$dir" = "x$object" && dir=
-   base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
-
-   if test "$libtool" = yes; then
-      # With Tru64 cc, shared objects can also be used to make a
-      # static library.  This mechanism is used in libtool 1.4 series to
-      # handle both shared and static libraries in a single compilation.
-      # With libtool 1.4, dependencies were output in $dir.libs/$base.lo.d.
-      #
-      # With libtool 1.5 this exception was removed, and libtool now
-      # generates 2 separate objects for the 2 libraries.  These two
-      # compilations output dependencies in $dir.libs/$base.o.d and
-      # in $dir$base.o.d.  We have to check for both files, because
-      # one of the two compilations can be disabled.  We should prefer
-      # $dir$base.o.d over $dir.libs/$base.o.d because the latter is
-      # automatically cleaned when .libs/ is deleted, while ignoring
-      # the former would cause a distcleancheck panic.
-      tmpdepfile1=$dir.libs/$base.lo.d   # libtool 1.4
-      tmpdepfile2=$dir$base.o.d          # libtool 1.5
-      tmpdepfile3=$dir.libs/$base.o.d    # libtool 1.5
-      tmpdepfile4=$dir.libs/$base.d      # Compaq CCC V6.2-504
-      "$@" -Wc,-MD
-   else
-      tmpdepfile1=$dir$base.o.d
-      tmpdepfile2=$dir$base.d
-      tmpdepfile3=$dir$base.d
-      tmpdepfile4=$dir$base.d
-      "$@" -MD
-   fi
-
-   stat=$?
-   if test $stat -eq 0; then :
-   else
-      rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4"
-      exit $stat
-   fi
-
-   for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4"
-   do
-     test -f "$tmpdepfile" && break
-   done
-   if test -f "$tmpdepfile"; then
-      sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile"
-      # That's a tab and a space in the [].
-      sed -e 's,^.*\.[a-z]*:[	 ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
-   else
-      echo "#dummy" > "$depfile"
-   fi
-   rm -f "$tmpdepfile"
-   ;;
-
-#nosideeffect)
-  # This comment above is used by automake to tell side-effect
-  # dependency tracking mechanisms from slower ones.
-
-dashmstdout)
-  # Important note: in order to support this mode, a compiler *must*
-  # always write the preprocessed file to stdout, regardless of -o.
-  "$@" || exit $?
-
-  # Remove the call to Libtool.
-  if test "$libtool" = yes; then
-    while test "X$1" != 'X--mode=compile'; do
-      shift
-    done
-    shift
-  fi
-
-  # Remove `-o $object'.
-  IFS=" "
-  for arg
-  do
-    case $arg in
-    -o)
-      shift
-      ;;
-    $object)
-      shift
-      ;;
-    *)
-      set fnord "$@" "$arg"
-      shift # fnord
-      shift # $arg
-      ;;
-    esac
-  done
-
-  test -z "$dashmflag" && dashmflag=-M
-  # Require at least two characters before searching for `:'
-  # in the target name.  This is to cope with DOS-style filenames:
-  # a dependency such as `c:/foo/bar' could be seen as target `c' otherwise.
-  "$@" $dashmflag |
-    sed 's:^[  ]*[^: ][^:][^:]*\:[    ]*:'"$object"'\: :' > "$tmpdepfile"
-  rm -f "$depfile"
-  cat < "$tmpdepfile" > "$depfile"
-  tr ' ' '
-' < "$tmpdepfile" | \
-## Some versions of the HPUX 10.20 sed can't process this invocation
-## correctly.  Breaking it into two sed invocations is a workaround.
-    sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
-  rm -f "$tmpdepfile"
-  ;;
-
-dashXmstdout)
-  # This case only exists to satisfy depend.m4.  It is never actually
-  # run, as this mode is specially recognized in the preamble.
-  exit 1
-  ;;
-
-makedepend)
-  "$@" || exit $?
-  # Remove any Libtool call
-  if test "$libtool" = yes; then
-    while test "X$1" != 'X--mode=compile'; do
-      shift
-    done
-    shift
-  fi
-  # X makedepend
-  shift
-  cleared=no eat=no
-  for arg
-  do
-    case $cleared in
-    no)
-      set ""; shift
-      cleared=yes ;;
-    esac
-    if test $eat = yes; then
-      eat=no
-      continue
-    fi
-    case "$arg" in
-    -D*|-I*)
-      set fnord "$@" "$arg"; shift ;;
-    # Strip any option that makedepend may not understand.  Remove
-    # the object too, otherwise makedepend will parse it as a source file.
-    -arch)
-      eat=yes ;;
-    -*|$object)
-      ;;
-    *)
-      set fnord "$@" "$arg"; shift ;;
-    esac
-  done
-  obj_suffix=`echo "$object" | sed 's/^.*\././'`
-  touch "$tmpdepfile"
-  ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@"
-  rm -f "$depfile"
-  cat < "$tmpdepfile" > "$depfile"
-  sed '1,2d' "$tmpdepfile" | tr ' ' '
-' | \
-## Some versions of the HPUX 10.20 sed can't process this invocation
-## correctly.  Breaking it into two sed invocations is a workaround.
-    sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
-  rm -f "$tmpdepfile" "$tmpdepfile".bak
-  ;;
-
-cpp)
-  # Important note: in order to support this mode, a compiler *must*
-  # always write the preprocessed file to stdout.
-  "$@" || exit $?
-
-  # Remove the call to Libtool.
-  if test "$libtool" = yes; then
-    while test "X$1" != 'X--mode=compile'; do
-      shift
-    done
-    shift
-  fi
-
-  # Remove `-o $object'.
-  IFS=" "
-  for arg
-  do
-    case $arg in
-    -o)
-      shift
-      ;;
-    $object)
-      shift
-      ;;
-    *)
-      set fnord "$@" "$arg"
-      shift # fnord
-      shift # $arg
-      ;;
-    esac
-  done
-
-  "$@" -E |
-    sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \
-       -e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' |
-    sed '$ s: \\$::' > "$tmpdepfile"
-  rm -f "$depfile"
-  echo "$object : \\" > "$depfile"
-  cat < "$tmpdepfile" >> "$depfile"
-  sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile"
-  rm -f "$tmpdepfile"
-  ;;
-
-msvisualcpp)
-  # Important note: in order to support this mode, a compiler *must*
-  # always write the preprocessed file to stdout.
-  "$@" || exit $?
-
-  # Remove the call to Libtool.
-  if test "$libtool" = yes; then
-    while test "X$1" != 'X--mode=compile'; do
-      shift
-    done
-    shift
-  fi
-
-  IFS=" "
-  for arg
-  do
-    case "$arg" in
-    -o)
-      shift
-      ;;
-    $object)
-      shift
-      ;;
-    "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI")
-	set fnord "$@"
-	shift
-	shift
-	;;
-    *)
-	set fnord "$@" "$arg"
-	shift
-	shift
-	;;
-    esac
-  done
-  "$@" -E 2>/dev/null |
-  sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::\1:p' | $cygpath_u | sort -u > "$tmpdepfile"
-  rm -f "$depfile"
-  echo "$object : \\" > "$depfile"
-  sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::	\1 \\:p' >> "$depfile"
-  echo "	" >> "$depfile"
-  sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::\1\::p' >> "$depfile"
-  rm -f "$tmpdepfile"
-  ;;
-
-msvcmsys)
-  # This case exists only to let depend.m4 do its work.  It works by
-  # looking at the text of this script.  This case will never be run,
-  # since it is checked for above.
-  exit 1
-  ;;
-
-none)
-  exec "$@"
-  ;;
-
-*)
-  echo "Unknown depmode $depmode" 1>&2
-  exit 1
-  ;;
-esac
-
-exit 0
-
-# Local Variables:
-# mode: shell-script
-# sh-indentation: 2
-# eval: (add-hook 'write-file-hooks 'time-stamp)
-# time-stamp-start: "scriptversion="
-# time-stamp-format: "%:y-%02m-%02d.%02H"
-# time-stamp-time-zone: "UTC"
-# time-stamp-end: "; # UTC"
-# End:

diff --git a/install-sh b/install-sh
deleted file mode 100755
index 6781b98..0000000
--- a/install-sh
+++ /dev/null
@@ -1,520 +0,0 @@
-#!/bin/sh
-# install - install a program, script, or datafile
-
-scriptversion=2009-04-28.21; # UTC
-
-# This originates from X11R5 (mit/util/scripts/install.sh), which was
-# later released in X11R6 (xc/config/util/install.sh) with the
-# following copyright and license.
-#
-# Copyright (C) 1994 X Consortium
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to
-# deal in the Software without restriction, including without limitation the
-# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
-# sell copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
-# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
-# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC-
-# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-#
-# Except as contained in this notice, the name of the X Consortium shall not
-# be used in advertising or otherwise to promote the sale, use or other deal-
-# ings in this Software without prior written authorization from the X Consor-
-# tium.
-#
-#
-# FSF changes to this file are in the public domain.
-#
-# Calling this script install-sh is preferred over install.sh, to prevent
-# `make' implicit rules from creating a file called install from it
-# when there is no Makefile.
-#
-# This script is compatible with the BSD install script, but was written
-# from scratch.
-
-nl='
-'
-IFS=" ""	$nl"
-
-# set DOITPROG to echo to test this script
-
-# Don't use :- since 4.3BSD and earlier shells don't like it.
-doit=${DOITPROG-}
-if test -z "$doit"; then
-  doit_exec=exec
-else
-  doit_exec=$doit
-fi
-
-# Put in absolute file names if you don't have them in your path;
-# or use environment vars.
-
-chgrpprog=${CHGRPPROG-chgrp}
-chmodprog=${CHMODPROG-chmod}
-chownprog=${CHOWNPROG-chown}
-cmpprog=${CMPPROG-cmp}
-cpprog=${CPPROG-cp}
-mkdirprog=${MKDIRPROG-mkdir}
-mvprog=${MVPROG-mv}
-rmprog=${RMPROG-rm}
-stripprog=${STRIPPROG-strip}
-
-posix_glob='?'
-initialize_posix_glob='
-  test "$posix_glob" != "?" || {
-    if (set -f) 2>/dev/null; then
-      posix_glob=
-    else
-      posix_glob=:
-    fi
-  }
-'
-
-posix_mkdir=
-
-# Desired mode of installed file.
-mode=0755
-
-chgrpcmd=
-chmodcmd=$chmodprog
-chowncmd=
-mvcmd=$mvprog
-rmcmd="$rmprog -f"
-stripcmd=
-
-src=
-dst=
-dir_arg=
-dst_arg=
-
-copy_on_change=false
-no_target_directory=
-
-usage="\
-Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE
-   or: $0 [OPTION]... SRCFILES... DIRECTORY
-   or: $0 [OPTION]... -t DIRECTORY SRCFILES...
-   or: $0 [OPTION]... -d DIRECTORIES...
-
-In the 1st form, copy SRCFILE to DSTFILE.
-In the 2nd and 3rd, copy all SRCFILES to DIRECTORY.
-In the 4th, create DIRECTORIES.
-
-Options:
-     --help     display this help and exit.
-     --version  display version info and exit.
-
-  -c            (ignored)
-  -C            install only if different (preserve the last data modification time)
-  -d            create directories instead of installing files.
-  -g GROUP      $chgrpprog installed files to GROUP.
-  -m MODE       $chmodprog installed files to MODE.
-  -o USER       $chownprog installed files to USER.
-  -s            $stripprog installed files.
-  -t DIRECTORY  install into DIRECTORY.
-  -T            report an error if DSTFILE is a directory.
-
-Environment variables override the default commands:
-  CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG
-  RMPROG STRIPPROG
-"
-
-while test $# -ne 0; do
-  case $1 in
-    -c) ;;
-
-    -C) copy_on_change=true;;
-
-    -d) dir_arg=true;;
-
-    -g) chgrpcmd="$chgrpprog $2"
-	shift;;
-
-    --help) echo "$usage"; exit $?;;
-
-    -m) mode=$2
-	case $mode in
-	  *' '* | *'	'* | *'
-'*	  | *'*'* | *'?'* | *'['*)
-	    echo "$0: invalid mode: $mode" >&2
-	    exit 1;;
-	esac
-	shift;;
-
-    -o) chowncmd="$chownprog $2"
-	shift;;
-
-    -s) stripcmd=$stripprog;;
-
-    -t) dst_arg=$2
-	shift;;
-
-    -T) no_target_directory=true;;
-
-    --version) echo "$0 $scriptversion"; exit $?;;
-
-    --)	shift
-	break;;
-
-    -*)	echo "$0: invalid option: $1" >&2
-	exit 1;;
-
-    *)  break;;
-  esac
-  shift
-done
-
-if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then
-  # When -d is used, all remaining arguments are directories to create.
-  # When -t is used, the destination is already specified.
-  # Otherwise, the last argument is the destination.  Remove it from $@.
-  for arg
-  do
-    if test -n "$dst_arg"; then
-      # $@ is not empty: it contains at least $arg.
-      set fnord "$@" "$dst_arg"
-      shift # fnord
-    fi
-    shift # arg
-    dst_arg=$arg
-  done
-fi
-
-if test $# -eq 0; then
-  if test -z "$dir_arg"; then
-    echo "$0: no input file specified." >&2
-    exit 1
-  fi
-  # It's OK to call `install-sh -d' without argument.
-  # This can happen when creating conditional directories.
-  exit 0
-fi
-
-if test -z "$dir_arg"; then
-  trap '(exit $?); exit' 1 2 13 15
-
-  # Set umask so as not to create temps with too-generous modes.
-  # However, 'strip' requires both read and write access to temps.
-  case $mode in
-    # Optimize common cases.
-    *644) cp_umask=133;;
-    *755) cp_umask=22;;
-
-    *[0-7])
-      if test -z "$stripcmd"; then
-	u_plus_rw=
-      else
-	u_plus_rw='% 200'
-      fi
-      cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;;
-    *)
-      if test -z "$stripcmd"; then
-	u_plus_rw=
-      else
-	u_plus_rw=,u+rw
-      fi
-      cp_umask=$mode$u_plus_rw;;
-  esac
-fi
-
-for src
-do
-  # Protect names starting with `-'.
-  case $src in
-    -*) src=./$src;;
-  esac
-
-  if test -n "$dir_arg"; then
-    dst=$src
-    dstdir=$dst
-    test -d "$dstdir"
-    dstdir_status=$?
-  else
-
-    # Waiting for this to be detected by the "$cpprog $src $dsttmp" command
-    # might cause directories to be created, which would be especially bad
-    # if $src (and thus $dsttmp) contains '*'.
-    if test ! -f "$src" && test ! -d "$src"; then
-      echo "$0: $src does not exist." >&2
-      exit 1
-    fi
-
-    if test -z "$dst_arg"; then
-      echo "$0: no destination specified." >&2
-      exit 1
-    fi
-
-    dst=$dst_arg
-    # Protect names starting with `-'.
-    case $dst in
-      -*) dst=./$dst;;
-    esac
-
-    # If destination is a directory, append the input filename; won't work
-    # if double slashes aren't ignored.
-    if test -d "$dst"; then
-      if test -n "$no_target_directory"; then
-	echo "$0: $dst_arg: Is a directory" >&2
-	exit 1
-      fi
-      dstdir=$dst
-      dst=$dstdir/`basename "$src"`
-      dstdir_status=0
-    else
-      # Prefer dirname, but fall back on a substitute if dirname fails.
-      dstdir=`
-	(dirname "$dst") 2>/dev/null ||
-	expr X"$dst" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
-	     X"$dst" : 'X\(//\)[^/]' \| \
-	     X"$dst" : 'X\(//\)$' \| \
-	     X"$dst" : 'X\(/\)' \| . 2>/dev/null ||
-	echo X"$dst" |
-	    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
-		   s//\1/
-		   q
-		 }
-		 /^X\(\/\/\)[^/].*/{
-		   s//\1/
-		   q
-		 }
-		 /^X\(\/\/\)$/{
-		   s//\1/
-		   q
-		 }
-		 /^X\(\/\).*/{
-		   s//\1/
-		   q
-		 }
-		 s/.*/./; q'
-      `
-
-      test -d "$dstdir"
-      dstdir_status=$?
-    fi
-  fi
-
-  obsolete_mkdir_used=false
-
-  if test $dstdir_status != 0; then
-    case $posix_mkdir in
-      '')
-	# Create intermediate dirs using mode 755 as modified by the umask.
-	# This is like FreeBSD 'install' as of 1997-10-28.
-	umask=`umask`
-	case $stripcmd.$umask in
-	  # Optimize common cases.
-	  *[2367][2367]) mkdir_umask=$umask;;
-	  .*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;;
-
-	  *[0-7])
-	    mkdir_umask=`expr $umask + 22 \
-	      - $umask % 100 % 40 + $umask % 20 \
-	      - $umask % 10 % 4 + $umask % 2
-	    `;;
-	  *) mkdir_umask=$umask,go-w;;
-	esac
-
-	# With -d, create the new directory with the user-specified mode.
-	# Otherwise, rely on $mkdir_umask.
-	if test -n "$dir_arg"; then
-	  mkdir_mode=-m$mode
-	else
-	  mkdir_mode=
-	fi
-
-	posix_mkdir=false
-	case $umask in
-	  *[123567][0-7][0-7])
-	    # POSIX mkdir -p sets u+wx bits regardless of umask, which
-	    # is incompatible with FreeBSD 'install' when (umask & 300) != 0.
-	    ;;
-	  *)
-	    tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$
-	    trap 'ret=$?; rmdir "$tmpdir/d" "$tmpdir" 2>/dev/null; exit $ret' 0
-
-	    if (umask $mkdir_umask &&
-		exec $mkdirprog $mkdir_mode -p -- "$tmpdir/d") >/dev/null 2>&1
-	    then
-	      if test -z "$dir_arg" || {
-		   # Check for POSIX incompatibilities with -m.
-		   # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or
-		   # other-writeable bit of parent directory when it shouldn't.
-		   # FreeBSD 6.1 mkdir -m -p sets mode of existing directory.
-		   ls_ld_tmpdir=`ls -ld "$tmpdir"`
-		   case $ls_ld_tmpdir in
-		     d????-?r-*) different_mode=700;;
-		     d????-?--*) different_mode=755;;
-		     *) false;;
-		   esac &&
-		   $mkdirprog -m$different_mode -p -- "$tmpdir" && {
-		     ls_ld_tmpdir_1=`ls -ld "$tmpdir"`
-		     test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1"
-		   }
-		 }
-	      then posix_mkdir=:
-	      fi
-	      rmdir "$tmpdir/d" "$tmpdir"
-	    else
-	      # Remove any dirs left behind by ancient mkdir implementations.
-	      rmdir ./$mkdir_mode ./-p ./-- 2>/dev/null
-	    fi
-	    trap '' 0;;
-	esac;;
-    esac
-
-    if
-      $posix_mkdir && (
-	umask $mkdir_umask &&
-	$doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir"
-      )
-    then :
-    else
-
-      # The umask is ridiculous, or mkdir does not conform to POSIX,
-      # or it failed possibly due to a race condition.  Create the
-      # directory the slow way, step by step, checking for races as we go.
-
-      case $dstdir in
-	/*) prefix='/';;
-	-*) prefix='./';;
-	*)  prefix='';;
-      esac
-
-      eval "$initialize_posix_glob"
-
-      oIFS=$IFS
-      IFS=/
-      $posix_glob set -f
-      set fnord $dstdir
-      shift
-      $posix_glob set +f
-      IFS=$oIFS
-
-      prefixes=
-
-      for d
-      do
-	test -z "$d" && continue
-
-	prefix=$prefix$d
-	if test -d "$prefix"; then
-	  prefixes=
-	else
-	  if $posix_mkdir; then
-	    (umask=$mkdir_umask &&
-	     $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break
-	    # Don't fail if two instances are running concurrently.
-	    test -d "$prefix" || exit 1
-	  else
-	    case $prefix in
-	      *\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;;
-	      *) qprefix=$prefix;;
-	    esac
-	    prefixes="$prefixes '$qprefix'"
-	  fi
-	fi
-	prefix=$prefix/
-      done
-
-      if test -n "$prefixes"; then
-	# Don't fail if two instances are running concurrently.
-	(umask $mkdir_umask &&
-	 eval "\$doit_exec \$mkdirprog $prefixes") ||
-	  test -d "$dstdir" || exit 1
-	obsolete_mkdir_used=true
-      fi
-    fi
-  fi
-
-  if test -n "$dir_arg"; then
-    { test -z "$chowncmd" || $doit $chowncmd "$dst"; } &&
-    { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } &&
-    { test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false ||
-      test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1
-  else
-
-    # Make a couple of temp file names in the proper directory.
-    dsttmp=$dstdir/_inst.$$_
-    rmtmp=$dstdir/_rm.$$_
-
-    # Trap to clean up those temp files at exit.
-    trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0
-
-    # Copy the file name to the temp name.
-    (umask $cp_umask && $doit_exec $cpprog "$src" "$dsttmp") &&
-
-    # and set any options; do chmod last to preserve setuid bits.
-    #
-    # If any of these fail, we abort the whole thing.  If we want to
-    # ignore errors from any of these, just make sure not to ignore
-    # errors from the above "$doit $cpprog $src $dsttmp" command.
-    #
-    { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } &&
-    { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } &&
-    { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } &&
-    { test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } &&
-
-    # If -C, don't bother to copy if it wouldn't change the file.
-    if $copy_on_change &&
-       old=`LC_ALL=C ls -dlL "$dst"	2>/dev/null` &&
-       new=`LC_ALL=C ls -dlL "$dsttmp"	2>/dev/null` &&
-
-       eval "$initialize_posix_glob" &&
-       $posix_glob set -f &&
-       set X $old && old=:$2:$4:$5:$6 &&
-       set X $new && new=:$2:$4:$5:$6 &&
-       $posix_glob set +f &&
-
-       test "$old" = "$new" &&
-       $cmpprog "$dst" "$dsttmp" >/dev/null 2>&1
-    then
-      rm -f "$dsttmp"
-    else
-      # Rename the file to the real destination.
-      $doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null ||
-
-      # The rename failed, perhaps because mv can't rename something else
-      # to itself, or perhaps because mv is so ancient that it does not
-      # support -f.
-      {
-	# Now remove or move aside any old file at destination location.
-	# We try this two ways since rm can't unlink itself on some
-	# systems and the destination file might be busy for other
-	# reasons.  In this case, the final cleanup might fail but the new
-	# file should still install successfully.
-	{
-	  test ! -f "$dst" ||
-	  $doit $rmcmd -f "$dst" 2>/dev/null ||
-	  { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null &&
-	    { $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; }
-	  } ||
-	  { echo "$0: cannot unlink or rename $dst" >&2
-	    (exit 1); exit 1
-	  }
-	} &&
-
-	# Now rename the file to the real destination.
-	$doit $mvcmd "$dsttmp" "$dst"
-      }
-    fi || exit 1
-
-    trap '' 0
-  fi
-done
-
-# Local variables:
-# eval: (add-hook 'write-file-hooks 'time-stamp)
-# time-stamp-start: "scriptversion="
-# time-stamp-format: "%:y-%02m-%02d.%02H"
-# time-stamp-time-zone: "UTC"
-# time-stamp-end: "; # UTC"
-# End:

diff --git a/missing b/missing
deleted file mode 100755
index 28055d2..0000000
--- a/missing
+++ /dev/null
@@ -1,376 +0,0 @@
-#! /bin/sh
-# Common stub for a few missing GNU programs while installing.
-
-scriptversion=2009-04-28.21; # UTC
-
-# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005, 2006,
-# 2008, 2009 Free Software Foundation, Inc.
-# Originally by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996.
-
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2, or (at your option)
-# any later version.
-
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-
-# You should have received a copy of the GNU General Public License
-# along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-# As a special exception to the GNU General Public License, if you
-# distribute this file as part of a program that contains a
-# configuration script generated by Autoconf, you may include it under
-# the same distribution terms that you use for the rest of that program.
-
-if test $# -eq 0; then
-  echo 1>&2 "Try \`$0 --help' for more information"
-  exit 1
-fi
-
-run=:
-sed_output='s/.* --output[ =]\([^ ]*\).*/\1/p'
-sed_minuso='s/.* -o \([^ ]*\).*/\1/p'
-
-# In the cases where this matters, `missing' is being run in the
-# srcdir already.
-if test -f configure.ac; then
-  configure_ac=configure.ac
-else
-  configure_ac=configure.in
-fi
-
-msg="missing on your system"
-
-case $1 in
---run)
-  # Try to run requested program, and just exit if it succeeds.
-  run=
-  shift
-  "$@" && exit 0
-  # Exit code 63 means version mismatch.  This often happens
-  # when the user try to use an ancient version of a tool on
-  # a file that requires a minimum version.  In this case we
-  # we should proceed has if the program had been absent, or
-  # if --run hadn't been passed.
-  if test $? = 63; then
-    run=:
-    msg="probably too old"
-  fi
-  ;;
-
-  -h|--h|--he|--hel|--help)
-    echo "\
-$0 [OPTION]... PROGRAM [ARGUMENT]...
-
-Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an
-error status if there is no known handling for PROGRAM.
-
-Options:
-  -h, --help      display this help and exit
-  -v, --version   output version information and exit
-  --run           try to run the given command, and emulate it if it fails
-
-Supported PROGRAM values:
-  aclocal      touch file \`aclocal.m4'
-  autoconf     touch file \`configure'
-  autoheader   touch file \`config.h.in'
-  autom4te     touch the output file, or create a stub one
-  automake     touch all \`Makefile.in' files
-  bison        create \`y.tab.[ch]', if possible, from existing .[ch]
-  flex         create \`lex.yy.c', if possible, from existing .c
-  help2man     touch the output file
-  lex          create \`lex.yy.c', if possible, from existing .c
-  makeinfo     touch the output file
-  tar          try tar, gnutar, gtar, then tar without non-portable flags
-  yacc         create \`y.tab.[ch]', if possible, from existing .[ch]
-
-Version suffixes to PROGRAM as well as the prefixes \`gnu-', \`gnu', and
-\`g' are ignored when checking the name.
-
-Send bug reports to <bug-automake@gnu.org>."
-    exit $?
-    ;;
-
-  -v|--v|--ve|--ver|--vers|--versi|--versio|--version)
-    echo "missing $scriptversion (GNU Automake)"
-    exit $?
-    ;;
-
-  -*)
-    echo 1>&2 "$0: Unknown \`$1' option"
-    echo 1>&2 "Try \`$0 --help' for more information"
-    exit 1
-    ;;
-
-esac
-
-# normalize program name to check for.
-program=`echo "$1" | sed '
-  s/^gnu-//; t
-  s/^gnu//; t
-  s/^g//; t'`
-
-# Now exit if we have it, but it failed.  Also exit now if we
-# don't have it and --version was passed (most likely to detect
-# the program).  This is about non-GNU programs, so use $1 not
-# $program.
-case $1 in
-  lex*|yacc*)
-    # Not GNU programs, they don't have --version.
-    ;;
-
-  tar*)
-    if test -n "$run"; then
-       echo 1>&2 "ERROR: \`tar' requires --run"
-       exit 1
-    elif test "x$2" = "x--version" || test "x$2" = "x--help"; then
-       exit 1
-    fi
-    ;;
-
-  *)
-    if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
-       # We have it, but it failed.
-       exit 1
-    elif test "x$2" = "x--version" || test "x$2" = "x--help"; then
-       # Could not run --version or --help.  This is probably someone
-       # running `$TOOL --version' or `$TOOL --help' to check whether
-       # $TOOL exists and not knowing $TOOL uses missing.
-       exit 1
-    fi
-    ;;
-esac
-
-# If it does not exist, or fails to run (possibly an outdated version),
-# try to emulate it.
-case $program in
-  aclocal*)
-    echo 1>&2 "\
-WARNING: \`$1' is $msg.  You should only need it if
-         you modified \`acinclude.m4' or \`${configure_ac}'.  You might want
-         to install the \`Automake' and \`Perl' packages.  Grab them from
-         any GNU archive site."
-    touch aclocal.m4
-    ;;
-
-  autoconf*)
-    echo 1>&2 "\
-WARNING: \`$1' is $msg.  You should only need it if
-         you modified \`${configure_ac}'.  You might want to install the
-         \`Autoconf' and \`GNU m4' packages.  Grab them from any GNU
-         archive site."
-    touch configure
-    ;;
-
-  autoheader*)
-    echo 1>&2 "\
-WARNING: \`$1' is $msg.  You should only need it if
-         you modified \`acconfig.h' or \`${configure_ac}'.  You might want
-         to install the \`Autoconf' and \`GNU m4' packages.  Grab them
-         from any GNU archive site."
-    files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}`
-    test -z "$files" && files="config.h"
-    touch_files=
-    for f in $files; do
-      case $f in
-      *:*) touch_files="$touch_files "`echo "$f" |
-				       sed -e 's/^[^:]*://' -e 's/:.*//'`;;
-      *) touch_files="$touch_files $f.in";;
-      esac
-    done
-    touch $touch_files
-    ;;
-
-  automake*)
-    echo 1>&2 "\
-WARNING: \`$1' is $msg.  You should only need it if
-         you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'.
-         You might want to install the \`Automake' and \`Perl' packages.
-         Grab them from any GNU archive site."
-    find . -type f -name Makefile.am -print |
-	   sed 's/\.am$/.in/' |
-	   while read f; do touch "$f"; done
-    ;;
-
-  autom4te*)
-    echo 1>&2 "\
-WARNING: \`$1' is needed, but is $msg.
-         You might have modified some files without having the
-         proper tools for further handling them.
-         You can get \`$1' as part of \`Autoconf' from any GNU
-         archive site."
-
-    file=`echo "$*" | sed -n "$sed_output"`
-    test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
-    if test -f "$file"; then
-	touch $file
-    else
-	test -z "$file" || exec >$file
-	echo "#! /bin/sh"
-	echo "# Created by GNU Automake missing as a replacement of"
-	echo "#  $ $@"
-	echo "exit 0"
-	chmod +x $file
-	exit 1
-    fi
-    ;;
-
-  bison*|yacc*)
-    echo 1>&2 "\
-WARNING: \`$1' $msg.  You should only need it if
-         you modified a \`.y' file.  You may need the \`Bison' package
-         in order for those modifications to take effect.  You can get
-         \`Bison' from any GNU archive site."
-    rm -f y.tab.c y.tab.h
-    if test $# -ne 1; then
-        eval LASTARG="\${$#}"
-	case $LASTARG in
-	*.y)
-	    SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'`
-	    if test -f "$SRCFILE"; then
-	         cp "$SRCFILE" y.tab.c
-	    fi
-	    SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'`
-	    if test -f "$SRCFILE"; then
-	         cp "$SRCFILE" y.tab.h
-	    fi
-	  ;;
-	esac
-    fi
-    if test ! -f y.tab.h; then
-	echo >y.tab.h
-    fi
-    if test ! -f y.tab.c; then
-	echo 'main() { return 0; }' >y.tab.c
-    fi
-    ;;
-
-  lex*|flex*)
-    echo 1>&2 "\
-WARNING: \`$1' is $msg.  You should only need it if
-         you modified a \`.l' file.  You may need the \`Flex' package
-         in order for those modifications to take effect.  You can get
-         \`Flex' from any GNU archive site."
-    rm -f lex.yy.c
-    if test $# -ne 1; then
-        eval LASTARG="\${$#}"
-	case $LASTARG in
-	*.l)
-	    SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'`
-	    if test -f "$SRCFILE"; then
-	         cp "$SRCFILE" lex.yy.c
-	    fi
-	  ;;
-	esac
-    fi
-    if test ! -f lex.yy.c; then
-	echo 'main() { return 0; }' >lex.yy.c
-    fi
-    ;;
-
-  help2man*)
-    echo 1>&2 "\
-WARNING: \`$1' is $msg.  You should only need it if
-	 you modified a dependency of a manual page.  You may need the
-	 \`Help2man' package in order for those modifications to take
-	 effect.  You can get \`Help2man' from any GNU archive site."
-
-    file=`echo "$*" | sed -n "$sed_output"`
-    test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
-    if test -f "$file"; then
-	touch $file
-    else
-	test -z "$file" || exec >$file
-	echo ".ab help2man is required to generate this page"
-	exit $?
-    fi
-    ;;
-
-  makeinfo*)
-    echo 1>&2 "\
-WARNING: \`$1' is $msg.  You should only need it if
-         you modified a \`.texi' or \`.texinfo' file, or any other file
-         indirectly affecting the aspect of the manual.  The spurious
-         call might also be the consequence of using a buggy \`make' (AIX,
-         DU, IRIX).  You might want to install the \`Texinfo' package or
-         the \`GNU make' package.  Grab either from any GNU archive site."
-    # The file to touch is that specified with -o ...
-    file=`echo "$*" | sed -n "$sed_output"`
-    test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
-    if test -z "$file"; then
-      # ... or it is the one specified with @setfilename ...
-      infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'`
-      file=`sed -n '
-	/^@setfilename/{
-	  s/.* \([^ ]*\) *$/\1/
-	  p
-	  q
-	}' $infile`
-      # ... or it is derived from the source name (dir/f.texi becomes f.info)
-      test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info
-    fi
-    # If the file does not exist, the user really needs makeinfo;
-    # let's fail without touching anything.
-    test -f $file || exit 1
-    touch $file
-    ;;
-
-  tar*)
-    shift
-
-    # We have already tried tar in the generic part.
-    # Look for gnutar/gtar before invocation to avoid ugly error
-    # messages.
-    if (gnutar --version > /dev/null 2>&1); then
-       gnutar "$@" && exit 0
-    fi
-    if (gtar --version > /dev/null 2>&1); then
-       gtar "$@" && exit 0
-    fi
-    firstarg="$1"
-    if shift; then
-	case $firstarg in
-	*o*)
-	    firstarg=`echo "$firstarg" | sed s/o//`
-	    tar "$firstarg" "$@" && exit 0
-	    ;;
-	esac
-	case $firstarg in
-	*h*)
-	    firstarg=`echo "$firstarg" | sed s/h//`
-	    tar "$firstarg" "$@" && exit 0
-	    ;;
-	esac
-    fi
-
-    echo 1>&2 "\
-WARNING: I can't seem to be able to run \`tar' with the given arguments.
-         You may want to install GNU tar or Free paxutils, or check the
-         command line arguments."
-    exit 1
-    ;;
-
-  *)
-    echo 1>&2 "\
-WARNING: \`$1' is needed, and is $msg.
-         You might have modified some files without having the
-         proper tools for further handling them.  Check the \`README' file,
-         it often tells you about the needed prerequisites for installing
-         this package.  You may also peek at any GNU archive site, in case
-         some other package would contain this missing \`$1' program."
-    exit 1
-    ;;
-esac
-
-exit 0
-
-# Local variables:
-# eval: (add-hook 'write-file-hooks 'time-stamp)
-# time-stamp-start: "scriptversion="
-# time-stamp-format: "%:y-%02m-%02d.%02H"
-# time-stamp-time-zone: "UTC"
-# time-stamp-end: "; # UTC"
-# End:


^ permalink raw reply related	[flat|nested] 238+ messages in thread
* [gentoo-commits] proj/ufed:master commit in: /
@ 2019-04-07 13:19 David Seifert
  0 siblings, 0 replies; 238+ messages in thread
From: David Seifert @ 2019-04-07 13:19 UTC (permalink / raw
  To: gentoo-commits

commit:     52b31c56480cb8a05167094d65172e45a90bfc77
Author:     David Seifert <soap <AT> gentoo <DOT> org>
AuthorDate: Sun Apr  7 13:19:17 2019 +0000
Commit:     David Seifert <soap <AT> gentoo <DOT> org>
CommitDate: Sun Apr  7 13:19:17 2019 +0000
URL:        https://gitweb.gentoo.org/proj/ufed.git/commit/?id=52b31c56

Replace `libexecdir` by `pkglibexecdir`

Signed-off-by: David Seifert <soap <AT> gentoo.org>

 Makefile.am | 5 ++---
 ufed.pl.in  | 4 ++--
 2 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/Makefile.am b/Makefile.am
index 2e92da4..954f36b 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,11 +1,10 @@
 PACKAGE_VERSION = @PACKAGE_VERSION@
 PERL = @PERL@
-libexecdir = @libdir@/@PACKAGE@
 perldir = @datadir@/@PACKAGE@
 E_PREFIX := $(shell portageq envvar EPREFIX 2>/dev/null)
 
 sbin_SCRIPTS = ufed
-libexec_PROGRAMS = ufed-curses
+pkglibexec_PROGRAMS = ufed-curses
 dist_perl_DATA = Portage.pm
 
 ufed_curses_SOURCES = \
@@ -32,7 +31,7 @@ ufed: ufed.pl.in
 	sed \
 		-e 's|XX_PACKAGE_VERSION[@]|$(PACKAGE_VERSION)|g' \
 		-e 's|XX_PERL[@]|$(PERL)|g' \
-		-e 's|XX_libexecdir[@]|$(libexecdir)|g' \
+		-e 's|XX_pkglibexecdir[@]|$(pkglibexecdir)|g' \
 		-e 's|XX_perldir[@]|$(perldir)|g' \
 		$< >$@.tmp
 	chmod +x $@.tmp

diff --git a/ufed.pl.in b/ufed.pl.in
index fdcdf18..4cd2484 100644
--- a/ufed.pl.in
+++ b/ufed.pl.in
@@ -22,7 +22,7 @@ my $gdb       = "gdb -ex run ufed-curses";
 my $memcheck  = "/usr/bin/valgrind -v --trace-children=yes --tool=memcheck"
               . " --track-origins=yes --leak-check=full --show-reachable=no"
               . " --read-var-info=yes"
-              . " XX_libexecdir@/ufed-curses 2>/tmp/ufed_memcheck.log";
+              . " XX_pkglibexecdir@/ufed-curses 2>/tmp/ufed_memcheck.log";
 
 sub finalise;
 sub flags_dialog;
@@ -67,7 +67,7 @@ sub flags_dialog {
 		POSIX::dup2 $owrite, 4;
 		POSIX::close $owrite;
 		if (0 == EXEC) {
-			exec { "XX_libexecdir@/$interface" } $interface or
+			exec { "XX_pkglibexecdir@/$interface" } $interface or
 			do { print STDERR "Couldn't launch $interface\n"; exit 3 }
 		} elsif (1 == EXEC) {
 			exec $gdb or


^ permalink raw reply related	[flat|nested] 238+ messages in thread
* [gentoo-commits] proj/ufed:master commit in: /
@ 2019-04-07 13:19 David Seifert
  0 siblings, 0 replies; 238+ messages in thread
From: David Seifert @ 2019-04-07 13:19 UTC (permalink / raw
  To: gentoo-commits

commit:     37a9949c0e16fe3356b3db68a5b7bf3d3cdf53ce
Author:     David Seifert <soap <AT> gentoo <DOT> org>
AuthorDate: Sun Apr  7 13:19:20 2019 +0000
Commit:     David Seifert <soap <AT> gentoo <DOT> org>
CommitDate: Sun Apr  7 13:19:20 2019 +0000
URL:        https://gitweb.gentoo.org/proj/ufed.git/commit/?id=37a9949c

Modernize Autotools

Signed-off-by: David Seifert <soap <AT> gentoo.org>

 Makefile.am  | 30 +++++++++++++++---------------
 configure.ac | 22 +++++++++-------------
 2 files changed, 24 insertions(+), 28 deletions(-)

diff --git a/Makefile.am b/Makefile.am
index 954f36b..f8f5999 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,6 +1,4 @@
-PACKAGE_VERSION = @PACKAGE_VERSION@
-PERL = @PERL@
-perldir = @datadir@/@PACKAGE@
+perldir = $(pkgdatadir)
 E_PREFIX := $(shell portageq envvar EPREFIX 2>/dev/null)
 
 sbin_SCRIPTS = ufed
@@ -26,21 +24,23 @@ noinst_HEADERS = \
 dist_man_MANS = ufed.8
 EXTRA_DIST = ufed.pl.in ufed.8.in
 
-ufed: ufed.pl.in
-	rm -f $@.tmp
-	sed \
+ufed: $(top_srcdir)/ufed.pl.in
+	cd $(top_srcdir) && \
+	rm -f ufed.tmp && \
+	$(SED) \
 		-e 's|XX_PACKAGE_VERSION[@]|$(PACKAGE_VERSION)|g' \
 		-e 's|XX_PERL[@]|$(PERL)|g' \
 		-e 's|XX_pkglibexecdir[@]|$(pkglibexecdir)|g' \
 		-e 's|XX_perldir[@]|$(perldir)|g' \
-		$< >$@.tmp
-	chmod +x $@.tmp
-	mv $@.tmp $@
+		ufed.pl.in >ufed.tmp && \
+	chmod +x ufed.tmp && \
+	mv ufed.tmp ufed
 
-ufed.8: ufed.8.in
-	rm -f $@.tmp
-	sed \
+ufed.8: $(top_srcdir)/ufed.8.in
+	cd $(top_srcdir) && \
+	rm -f ufed.8.tmp && \
+	$(SED) \
 		-e 's|@GENTOO_PORTAGE_EPREFIX@|$(E_PREFIX)|g' \
-		$< >$@.tmp
-	chmod +x $@.tmp
-	mv $@.tmp $@
+		ufed.8.in >ufed.8.tmp && \
+	chmod +x ufed.8.tmp && \
+	mv ufed.8.tmp ufed.8

diff --git a/configure.ac b/configure.ac
index a3308b9..736d06a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,23 +1,19 @@
-AC_PREREQ(2.68)
+AC_PREREQ([2.69])
 AC_INIT([ufed],[git],[https://bugs.gentoo.org/])
-AM_INIT_AUTOMAKE([foreign])
+AM_INIT_AUTOMAKE([foreign subdir-objects])
 AC_CONFIG_SRCDIR([ufed-curses.c])
 AC_CONFIG_HEADERS([config.h])
 
 AC_PROG_CC
 AC_PROG_CC_C99
-if test "$ac_cv_prog_cc_c99" != no
-then
-	CFLAGS="$CFLAGS -Wall -Wextra -pedantic"
-	CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE=600"
-else
-	AC_PROG_CC_C89
-	AC_C_INLINE
-	CFLAGS="$CFLAGS -Wall -W"
-	CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE=500"
-fi
-CFLAGS="${CFLAGS} -Wmissing-prototypes -Wstrict-prototypes"
+AS_IF([test "x$ac_cv_prog_cc_c99" = "xno"], [
+	AC_MSG_ERROR([ufed requires a C99 capable compiler!])
+])
+
+CPPFLAGS="${CPPFLAGS} -D_XOPEN_SOURCE=600"
+CFLAGS="${CFLAGS} -Wall -Wextra -Wmissing-prototypes -Wstrict-prototypes -pedantic"
 
+AC_PROG_SED
 PKG_PROG_PKG_CONFIG
 
 AC_TYPE_SIZE_T


^ permalink raw reply related	[flat|nested] 238+ messages in thread
* [gentoo-commits] proj/ufed:master commit in: /
@ 2019-04-07 13:19 David Seifert
  0 siblings, 0 replies; 238+ messages in thread
From: David Seifert @ 2019-04-07 13:19 UTC (permalink / raw
  To: gentoo-commits

commit:     c524303a1c156b83eb172d8045de683a6b7880a3
Author:     David Seifert <soap <AT> gentoo <DOT> org>
AuthorDate: Sun Apr  7 13:19:26 2019 +0000
Commit:     David Seifert <soap <AT> gentoo <DOT> org>
CommitDate: Sun Apr  7 13:19:26 2019 +0000
URL:        https://gitweb.gentoo.org/proj/ufed.git/commit/?id=c524303a

Replace GNU `__FUNCTION__` by C99 `__func__`

Signed-off-by: David Seifert <soap <AT> gentoo.org>

 ufed-curses-debug.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/ufed-curses-debug.h b/ufed-curses-debug.h
index 67bbf2c..d4a8716 100644
--- a/ufed-curses-debug.h
+++ b/ufed-curses-debug.h
@@ -19,7 +19,7 @@
 #  define ERROR_EXIT(code, fmt, ...) { \
 	cursesdone(); \
 	fprintf(stderr, "\nERROR in %s:%d (%s): \n -> ", \
-		__FILE__, __LINE__, __FUNCTION__); \
+		__FILE__, __LINE__, __func__); \
 	fprintf(stderr, fmt, __VA_ARGS__); \
 	exit(code); \
 }
@@ -30,7 +30,7 @@
 // DEBUG_TRACE -> TRACE macro
 #if defined(DEBUG_TRACE)
 # define TRACE { \
-	fprintf(stderr, "(TRACE) %s:%d - %s\n", __FILE__, __LINE__, __FUNCTION__); \
+	fprintf(stderr, "(TRACE) %s:%d - %s\n", __FILE__, __LINE__, __func__); \
 }
 #else
 # define TRACE


^ permalink raw reply related	[flat|nested] 238+ messages in thread
* [gentoo-commits] proj/ufed:master commit in: /
@ 2015-02-12 15:47 Sven Eden
  0 siblings, 0 replies; 238+ messages in thread
From: Sven Eden @ 2015-02-12 15:47 UTC (permalink / raw
  To: gentoo-commits

commit:     61532b5a6b52ba7371f45109769718164ce4a4fc
Author:     Sven Eden <seden <AT> havi <DOT> de>
AuthorDate: Thu Feb 12 15:47:01 2015 +0000
Commit:     Sven Eden <sven.eden <AT> gmx <DOT> de>
CommitDate: Thu Feb 12 15:47:01 2015 +0000
URL:        http://sources.gentoo.org/gitweb/?p=proj/ufed.git;a=commit;h=61532b5a

Fix truncation of -* if set in make.conf.

---
 Portage.pm | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/Portage.pm b/Portage.pm
index d90be5e..a86e5bb 100644
--- a/Portage.pm
+++ b/Portage.pm
@@ -431,19 +431,19 @@ sub _determine_profiles
 # No parameters accepted
 sub _final_cleaning
 {
-	# The "disable all" flag is truncated to '*' by the parsing, but it
-	# has to read '-*'.
+	# The "disable all" flag is truncated to '*' by the parsing, but
+	# it has to read '-*'.
 	_add_temp("-*", "global");
 
 	$_use_temp->{'-*'}{global}{descr} = "{Never enable any flags other than those specified in make.conf}";
 	$_use_temp->{'-*'}{global}{conf} = 0; ## Can never be -1
-	
+
 	# Set it from the truncated config:
 	if (defined($_use_temp->{'*'}{global})) {
-		$_use_temp->{'*'}{global}{conf} > 0
+		$_use_temp->{'*'}{global}{conf} > -1
 			and $_use_temp->{'-*'}{global}{conf} = 1;
 	}
-	
+
 	# The following use flags are dangerous or internal only
 	# and must no be available using ufed:
 	defined($_use_temp->{"*"})         and delete($_use_temp->{"*"});
@@ -863,7 +863,9 @@ sub _read_make_conf {
 
 		$oldEnv{USE}{$flag}
 			and $_use_temp->{$flag}{global}{conf} = 1
-			or  $_use_temp->{$flag}{global}{conf} = -1;
+			 or $flag eq '*'
+			and $_use_temp->{$flag}{global}{conf} = 1
+			 or $_use_temp->{$flag}{global}{conf} = -1;
 	}
 	
 	# Add PORTDIR and overlays to @_profiles


^ permalink raw reply related	[flat|nested] 238+ messages in thread
* [gentoo-commits] proj/ufed:master commit in: /
@ 2015-02-11  9:03 Sven Eden
  0 siblings, 0 replies; 238+ messages in thread
From: Sven Eden @ 2015-02-11  9:03 UTC (permalink / raw
  To: gentoo-commits

commit:     7816796df99454603bd978dc1ea15d7a5b6abd9a
Author:     Sven Eden <seden <AT> havi <DOT> de>
AuthorDate: Wed Feb 11 09:03:22 2015 +0000
Commit:     Sven Eden <sven.eden <AT> gmx <DOT> de>
CommitDate: Wed Feb 11 09:03:22 2015 +0000
URL:        http://sources.gentoo.org/gitweb/?p=proj/ufed.git;a=commit;h=7816796d

Portage.pm: Fixed a possible "Use of uninitialized value" if a read file is empty. (Bug #539682)

---
 Portage.pm | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/Portage.pm b/Portage.pm
index 534de52..d90be5e 100644
--- a/Portage.pm
+++ b/Portage.pm
@@ -418,7 +418,8 @@ sub _determine_profiles
 	@_profiles = -l $mp_path ? _norm_path('/etc', $mp) : $mp;
 	for (my $i = -1; $i >= -@_profiles; $i--) {
 		for(_noncomments("${_profiles[$i]}/parent")) {
-			splice(@_profiles, $i, 0, _norm_path(${_profiles[$i]}, $_));
+			length($_)
+				and splice(@_profiles, $i, 0, _norm_path(${_profiles[$i]}, $_));
 		}
 	}
 	return;
@@ -723,9 +724,10 @@ sub _noncomments {
 		local $/;
 		if(open my $file, '<', $fname) {
 			binmode( $file, ":encoding(UTF-8)" );
-			@result = split /(?:[^\S\n]*(?:#.*)?\n)+/, <$file>."\n";
-			shift @result if @result>0 && $result[0] eq '';
+			my $content = <$file> || "";
 			close $file;
+			@result = split /(?:[^\S\n]*(?:#.*)?\n)+/, "$content\n";
+			shift @result while ( (@result > 0) && !length($result[0]) );
 		}
 	}
 
@@ -766,7 +768,8 @@ sub _read_archs {
 	for my $dir(@_profiles) {
 		next unless (-r "$dir/arch.list");
 		for my $arch (_noncomments("$dir/arch.list")) {
-			defined($_use_temp->{$arch})
+			length($arch)
+				and defined($_use_temp->{$arch})
 				and delete($_use_temp->{$arch});
 		}
 	}


^ permalink raw reply related	[flat|nested] 238+ messages in thread
* [gentoo-commits] proj/ufed:master commit in: /
@ 2014-11-10  9:59 Sven Eden
  0 siblings, 0 replies; 238+ messages in thread
From: Sven Eden @ 2014-11-10  9:59 UTC (permalink / raw
  To: gentoo-commits

commit:     90ac21c824364ac0a18681b88bbeb2d25a7456be
Author:     Sven Eden <seden <AT> havi <DOT> de>
AuthorDate: Mon Nov 10 09:59:13 2014 +0000
Commit:     Sven Eden <sven.eden <AT> gmx <DOT> de>
CommitDate: Mon Nov 10 09:59:13 2014 +0000
URL:        http://sources.gentoo.org/gitweb/?p=proj/ufed.git;a=commit;h=90ac21c8

Portage.pm : Enhanced eix detection code and added an optional debug message to print the found location.

---
 Portage.pm | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/Portage.pm b/Portage.pm
index 5aacd42..534de52 100644
--- a/Portage.pm
+++ b/Portage.pm
@@ -153,8 +153,11 @@ INIT {
 	$_eix_cmd = qx{which eix 2>/dev/null};
 	defined($_eix_cmd)
         and chomp $_eix_cmd
+        and length($_eix_cmd)
         and -x $_eix_cmd
-        and $_has_eix = 1;
+        and $_has_eix = 1
+        and debugMsg("Found eix in \"$_eix_cmd\"")
+         or $_has_eix = 0;
 	
 	# Initialize basics
 	_determine_eprefix_portdir;
@@ -211,9 +214,9 @@ INIT {
 sub debugMsg
 {
 	my ($msg) = @_;
-	DEBUG or return;
+	DEBUG or return 1;
 	print STDERR "$msg\n";
-	return;
+	return 1;
 }
 
 # --- private methods implementations ---


^ permalink raw reply related	[flat|nested] 238+ messages in thread
* [gentoo-commits] proj/ufed:master commit in: /
@ 2014-10-28 11:43 Sven Eden
  0 siblings, 0 replies; 238+ messages in thread
From: Sven Eden @ 2014-10-28 11:43 UTC (permalink / raw
  To: gentoo-commits

commit:     59aa35d0fa3edf777e51c611a8d65bbc6799cf49
Author:     Sven Eden <seden <AT> havi <DOT> de>
AuthorDate: Tue Oct 28 11:44:09 2014 +0000
Commit:     Sven Eden <sven.eden <AT> gmx <DOT> de>
CommitDate: Tue Oct 28 11:44:09 2014 +0000
URL:        http://sources.gentoo.org/gitweb/?p=proj/ufed.git;a=commit;h=59aa35d0

Portage.pm : Added fix by Martin Väth from Bug 525876 to allow the reading of directories that used to be files.

---
 Portage.pm | 26 +++++++++++++++++---------
 1 file changed, 17 insertions(+), 9 deletions(-)

diff --git a/Portage.pm b/Portage.pm
index 229ebba..5aacd42 100644
--- a/Portage.pm
+++ b/Portage.pm
@@ -705,19 +705,27 @@ sub _merge_env {
 }
 
 
-# returns a list of all lines of a given file
+# returns a list of all lines of a given file/dir
 # that are no pure comments
-# Parameter 1: filename
+# Parameter 1: filename/dirname
 sub _noncomments {
 	my ($fname) = @_;
-	my @result;
-	local $/;
-	if(open my $file, '<', $fname) {
-		binmode( $file, ":encoding(UTF-8)" );
-		@result = split /(?:[^\S\n]*(?:#.*)?\n)+/, <$file>."\n";
-		shift @result if @result>0 && $result[0] eq '';
-		close $file;
+	my @result  = ();
+
+	if(-d $fname) {
+		for my $i (_get_files_from_dir($fname)) {
+			(-f $i) && push @result, _noncomments($i);
+		}
+	} else {
+		local $/;
+		if(open my $file, '<', $fname) {
+			binmode( $file, ":encoding(UTF-8)" );
+			@result = split /(?:[^\S\n]*(?:#.*)?\n)+/, <$file>."\n";
+			shift @result if @result>0 && $result[0] eq '';
+			close $file;
+		}
 	}
+
 	return @result;
 }
 


^ permalink raw reply related	[flat|nested] 238+ messages in thread
* [gentoo-commits] proj/ufed:master commit in: /
@ 2014-02-26 10:26 Sven Eden
  0 siblings, 0 replies; 238+ messages in thread
From: Sven Eden @ 2014-02-26 10:26 UTC (permalink / raw
  To: gentoo-commits

commit:     bde7d03f66e8a4f2cb9c4973577931b983aae39d
Author:     Sven Eden <yamakuzure <AT> gmx <DOT> net>
AuthorDate: Wed Feb 26 09:49:03 2014 +0000
Commit:     Sven Eden <sven.eden <AT> gmx <DOT> de>
CommitDate: Wed Feb 26 09:49:03 2014 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/ufed.git;a=commit;h=bde7d03f

TODO: Added plan to support package.use editing.

---
 TODO | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/TODO b/TODO
index 0b74593..e2e2d82 100644
--- a/TODO
+++ b/TODO
@@ -19,6 +19,8 @@ These ideas for the (far far away) future
   the tree (metadata.xml!) and store the findings in a database file. Parsing
   the tree like that is too much for each startup. Therefore such a db caching
   would enable ufed to be no longer restricted to the profiles and /var/db/pkg.
+- Once the sqlite support is added, supporting the editing of
+  /etc/portage/package.use can be added as well. I bet many would like that.
 
 ------------
 --- DONE ---


^ permalink raw reply related	[flat|nested] 238+ messages in thread
* [gentoo-commits] proj/ufed:master commit in: /
@ 2014-02-26 10:26 Sven Eden
  0 siblings, 0 replies; 238+ messages in thread
From: Sven Eden @ 2014-02-26 10:26 UTC (permalink / raw
  To: gentoo-commits

commit:     480c846b9efe02fc772193d36b24de0ba452c3e6
Author:     Sven Eden <yamakuzure <AT> gmx <DOT> net>
AuthorDate: Wed Feb 26 09:05:36 2014 +0000
Commit:     Sven Eden <sven.eden <AT> gmx <DOT> de>
CommitDate: Wed Feb 26 09:05:36 2014 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/ufed.git;a=commit;h=480c846b

Updated the documentation for 0.91 release.

---
 TODO               |  4 ++--
 ufed-curses-help.c | 15 +++++++++++----
 ufed.8.in          | 24 ++++++++++++++++--------
 3 files changed, 29 insertions(+), 14 deletions(-)

diff --git a/TODO b/TODO
index f1d5283..0b74593 100644
--- a/TODO
+++ b/TODO
@@ -46,7 +46,7 @@ These have been finished :
     Compilation failed in require at /usr/sbin/ufed line 9.
     BEGIN failed--compilation aborted at /usr/sbin/ufed line 9.
 - (0.90) Filter masked flags reliably.
-- (0.90) Add an option to re-show masked USE flags, but in parantheses.
+- (0.90) Add an option to re-show masked USE flags, but in parentheses.
 - (0.90) Add toggling package list display.
 - (0.90) Handle setups where /etc/portage/make.conf is a directory.
 - (0.90) Read PORTDIR and PORTDIR_OVERLAY from portageq, too.
@@ -56,6 +56,6 @@ These have been finished :
 - (0.91) Make key help buttons dynamic (text, placement and width).
 - (0.91) Replace status indicator with dynamic status line.
 - (0.91) ufed does not error out when USE in make.conf is exceptionally large.
-- (0.91) The deprecated 'portageq envvar' is no longer used for to determine
+- (0.91) The deprecated 'portageq envvar' is no longer used to determine
          PORTDIR and PORTDIR_OVERLAY, eix is used if available and portageq
          with the get_repo(s|_path) command as a fallback.

diff --git a/ufed-curses-help.c b/ufed-curses-help.c
index ea0c586..e627166 100644
--- a/ufed-curses-help.c
+++ b/ufed-curses-help.c
@@ -120,7 +120,9 @@ static void init_lines(void)
 "",
 "ufed will present you with a list of descriptions for each USE flag. If a "
 "description is too long to fit on your screen, you can use the Left and Right "
-"arrow keys to scroll the descriptions.",
+"arrow keys to scroll the descriptions. Alternatively you can change the "
+"description to show a reduced variant using the F10 key, or change the "
+"display to wrap long lines into multiple lines using the F11 key.",
 "",
 "Use the Up and Down arrow keys, the Page Up and Page Down keys, the Home and "
 "End keys, or start typing the name of a flag to select it.",
@@ -147,6 +149,8 @@ static void init_lines(void)
 "",
 " F10: Toggle whether to display the full description or a stripped version.",
 "",
+" F11: Enable / disable wrapping of long lines.",
+"",
 "The stripped version has various wordings like \"Enables support for\" or "
 "\"Build and install the\" at the beginning of the description removed.",
 "Although somewhat crippled, the descriptions key information then needs "
@@ -154,13 +158,13 @@ static void init_lines(void)
 "description, to determine a flags meaning without scrolling the text in most "
 "cases; even on low resolution displays.",
 "",
-"The default is to display the full description preceeded by the list of "
+"The default is to display the full description preceded by the list of "
 "affected packages.",
 "",
 "Below the list of descriptions an indicator line is displayed that shows the "
 "current setting of all filters and settings.",
 "The order and layout is:",
-"[Scope|State|Mask|Order|Description] with",
+"[Scope|State|Mask|Order|Description|Wrapping] with",
 "Scope:",
 "  glob : Global USE flags are shown.",
 "  loca : Local USE flags are shown.",
@@ -179,6 +183,9 @@ static void init_lines(void)
 "Description:",
 "  orig : The original full description is shown.",
 "  stri : The stripped version of the description is shown.",
+"Wrapping:",
+"  long : The original one-line layout with horizontal scrolling.",
+"  wrap : Wrapped lines that do not need horizontal scrolling.",
 "",
 "If ncurses is installed with the \"gpm\" use flag enabled, you can use your "
 "mouse to navigate and to toggle the settings, too.",
@@ -246,7 +253,7 @@ static void init_lines(void)
 "file(s) and if it is a - then that flag was unset in that file(s).",
 "",
 "Flags marked as [+] or [-] will be saved in your make.conf when you leave "
-"the program with an Enter.",
+"the program by hitting the 'Enter' key",
 "",
 "You can change the order of the (packages) and the description with the F9 "
 "key.",

diff --git a/ufed.8.in b/ufed.8.in
index 59cbfaa..6ed3cc1 100644
--- a/ufed.8.in
+++ b/ufed.8.in
@@ -1,12 +1,12 @@
-.TH "UFED" "8" "09 Apr 2013" "UFED 0.90" "UFED"
+.TH "UFED" "8" "26 Feb 2014" "UFED 0.91" "UFED"
 .SH "NAME"
 ufed \- Gentoo Linux USE flags editor
 .SH "SYNOPSIS"
 .B ufed 
 .SH "INTRODUCTION"
-UFED is a simple program designed to help you configure the
-systems USE flags (see below) to your liking. To enable or
-disable a flag highlight it and hit space.
+UFED is a simple program designed to help you configure the systems USE flags
+(see below) to your liking. To enable or disable a flag highlight it and hit
+space.
 
 ufed edits the USE flag settings in your make.conf file only. It can not be
 used to edit your package.use file.
@@ -91,7 +91,9 @@ or 'f' in the defaults column (see "Display layout" below) indicates this.
 
 ufed will present you with a list of descriptions for each USE flag. If a
 description is too long to fit on your screen, you can use the Left and Right
-arrow keys to scroll the descriptions.
+arrow keys to scroll the descriptions. Alternatively you can change the
+description to show a reduced variant using the F10 key, or change the display
+to wrap long lines into multiple lines using the F11 key.
 
 Use the Up and Down arrow keys, the Page Up and Page Down keys, the Home and
 End keys, or start typing the name of a flag to select it.
@@ -117,6 +119,8 @@ will change to.
 F9: Toggle the order of the affected package list and the description.
 .br
 F10: Toggle whether to display the full description or a stripped version.
+.br
+F11: Enable / disable wrapping of long lines.
 
 The stripped version has various wordings like "Enables support for" or
 "Build and install the" at the beginning of the description removed.
@@ -125,7 +129,7 @@ less space and allows, with switched order of the package list and the
 description, to determine a flags meaning without scrolling the text in most
 cases; even on low resolution displays.
 
-The default is to display the full description preceeded by the list of
+The default is to display the full description preceded by the list of
 affected packages.
 
 Below the list of descriptions an indicator line is displayed that shows the
@@ -133,7 +137,7 @@ current setting of all filters and settings.
 .br
 The order and layout is:
 .br
-[Scope|State|Mask|Order|Description] with
+[Scope|State|Mask|Order|Description|Wrapping] with
 .br
 Scope:
   glob : Global USE flags are shown.
@@ -157,6 +161,10 @@ Order:
 Description:
   orig : The original full description is shown.
   stri : The stripped version of the description is shown.
+.br
+Wrapping:
+  long : The original one-line layout with horizontal scrolling.
+  wrap : Wrapped lines that do not need horizontal scrolling.
 
 If ncurses is installed with the "gpm" use flag enabled, you can use your
 mouse to navigate and to toggle the settings, too.
@@ -230,7 +238,7 @@ set in that file(s), if it is a space then the flag was not mentioned in that
 file(s) and if it is a - then that flag was unset in that file(s).
 
 Flags marked as [+] or [-] will be saved in your make.conf when you leave the
-program with an Enter.
+program by hitting the 'Enter' key.
 
 You can change the order of the (packages) and the description with the F9 key.
 


^ permalink raw reply related	[flat|nested] 238+ messages in thread
* [gentoo-commits] proj/ufed:master commit in: /
@ 2014-02-26 10:26 Sven Eden
  0 siblings, 0 replies; 238+ messages in thread
From: Sven Eden @ 2014-02-26 10:26 UTC (permalink / raw
  To: gentoo-commits

commit:     9e724f7824c11527316f822283242260be12c3d7
Author:     Sven Eden <yamakuzure <AT> gmx <DOT> net>
AuthorDate: Tue Feb 25 18:15:22 2014 +0000
Commit:     Sven Eden <sven.eden <AT> gmx <DOT> de>
CommitDate: Tue Feb 25 18:15:22 2014 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/ufed.git;a=commit;h=9e724f78

Portage.pm: /etc/portage/make.profile does no longer need to be a symlink and can be a driectory as well now.

---
 Portage.pm | 26 ++++++++++++++++----------
 1 file changed, 16 insertions(+), 10 deletions(-)

diff --git a/Portage.pm b/Portage.pm
index 5d42860..71cada0 100644
--- a/Portage.pm
+++ b/Portage.pm
@@ -386,22 +386,28 @@ sub _determine_make_conf
 }
 
 
-# read /etc/make.profile and /etc/portage/make.profile and
-# analyze the complete profile tree using the found parent
-# files. Add all found paths to @profiles.
+# read /etc/make.profile and /etc/portage/make.profile and analyze the complete
+# profile tree using the found parent files. Add all found paths to @profiles.
+
 # No parameters accepted.
 sub _determine_profiles
 {
-	my $mp = readlink "${_EPREFIX}/etc/portage/make.profile";
-	defined($mp)
-		or $mp = readlink "${_EPREFIX}/etc/make.profile";
+	my $mp_path = "${_EPREFIX}/etc/portage/make.profile";
+	-e $mp_path or $mp_path = "${_EPREFIX}/etc/make.profile";
+	
+	-e $mp_path
+		or die("make.profile can not be found");
 
-	# make.profile is mandatory and must be a link
+	my $mp = undef;
+	   (-l $mp_path and $mp = readlink $mp_path)
+	or (-d $mp_path and $mp = $mp_path);
+	
+	# make.profile is mandatory and must be a link or directory
 	defined($mp)
-		or die "${_EPREFIX}/etc\{,/portage\}/make.profile is not a symlink\n";
+		or die "$mp_path is neither symlink nor directory\n";
 
-	# Start with the linked path, it is the deepest profile child.
-	@_profiles = _norm_path('/etc', $mp);
+	# Start with the found path, it is the deepest profile child.
+	@_profiles = -l $mp_path ? _norm_path('/etc', $mp) : $mp;
 	for (my $i = -1; $i >= -@_profiles; $i--) {
 		for(_noncomments("${_profiles[$i]}/parent")) {
 			splice(@_profiles, $i, 0, _norm_path(${_profiles[$i]}, $_));


^ permalink raw reply related	[flat|nested] 238+ messages in thread
* [gentoo-commits] proj/ufed:master commit in: /
@ 2014-02-26 10:26 Sven Eden
  0 siblings, 0 replies; 238+ messages in thread
From: Sven Eden @ 2014-02-26 10:26 UTC (permalink / raw
  To: gentoo-commits

commit:     197a876f4bd29f01732bc0657c9764c2e9d35fae
Author:     Sven Eden <yamakuzure <AT> gmx <DOT> net>
AuthorDate: Tue Feb 25 18:00:58 2014 +0000
Commit:     Sven Eden <sven.eden <AT> gmx <DOT> de>
CommitDate: Tue Feb 25 18:00:58 2014 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/ufed.git;a=commit;h=197a876f

Portage.pm: Some comment cleanup and one minor bugfix.

---
 Portage.pm | 146 ++++++++++++++++++++++++++++++++-----------------------------
 1 file changed, 76 insertions(+), 70 deletions(-)

diff --git a/Portage.pm b/Portage.pm
index 5471e73..5d42860 100644
--- a/Portage.pm
+++ b/Portage.pm
@@ -1,6 +1,6 @@
 package Portage;
 
-# Copyright 1999-2013 Gentoo Foundation
+# Copyright 1999-2014 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 # $Header: $
 
@@ -20,13 +20,20 @@ BEGIN {
 
 # Set this to 1 to get debugging output
 use constant { DEBUG => 0 };
+## Note: Although use constant is deprecated as of page 55 of PBP
+# [ValuesAndExpressions::ProhibitConstantPragma] and should be replaced by
+# ReadOnly, I do not see any gain in adding a dependency to dev-perl/Readonly
+# just for one value that is used when debugging only. - sed
+
 
 # $use_flags - hashref that represents the combined and
 # consolidated data about all valid use flags
 # Layout of $use_flags->{flag_name}:
 # {count}  = number of different description lines
-#  Note: +1 for the list of affected packages, and +1 for each descriptionless package with settings differing from global.
-# {global} = hashref for the global paramters if the flag has a description in use.desc, otherwise undefined
+#  Note: +1 for the list of affected packages, and +1 for each descriptionless
+#        package with settings differing from global.
+# {global} = hashref for the global paramters if the flag has a description in
+#            use.desc, otherwise undefined
 #   ->{conf}      = The flag is disabled (-1), enabled (1) or not set (0) in make.conf
 #   ->{default}   = The flag is disabled (-1), enabled (1) or not set (0) by default
 #   ->{descr}     = Global description
@@ -34,16 +41,24 @@ use constant { DEBUG => 0 };
 #   ->{forced}    = The flag is globally force enabled (and masked) (0,1)
 #   ->{installed} = At least one affected package is installed (0,1)
 #   ->{masked}    = The flag is globally masked (0,1)
-#     Note: When a flag is forced, {masked} is set to one, but can be reset to 0 by any later use.mask file.
+#     Note: When a flag is forced, {masked} is set to one, but can be reset to
+#           0 by any later use.mask file.
 # {"local"}->{package} = hashref for per package settings
-#   ->{descr}     = Description from use.local.desc or empty if there is no individual description
-#     Note: Packages without description are only listed here if their settings differ from the global
-#   ->{forced}    = The flag is explicitly unforced (-1), default (0) or explicitly force enabled (1) for this package
+#   ->{descr}     = Description from use.local.desc or empty if there is no
+#                   individual description.
+#     Note: Packages without description are only listed here if their settings
+#           differ from the global.
+#   ->{forced}    = The flag is explicitly unforced (-1), default (0) or
+#                   explicitly force enabled (1) for this package
 #   ->{installed} = This package is installed
-#   ->{masked}    = The flag is explicitly unmasked (-1), default (0) or masked (1) for this package
-#   ->{package}   = The flag is explicitly disabled (-1), default (0) or enabled (1) for this package by (profiles)/package.use
-#   ->{pkguse}    = The flag is explicitly disabled (-1), default (0) or enabled(1) for this package by /etc/portage/package.use
-#     Note: This is a combination of the ebuilds IUSE and the installation PKGUSE and only set for installed packages.
+#   ->{masked}    = The flag is explicitly unmasked (-1), default (0) or
+#                   masked (1) for this package
+#   ->{package}   = The flag is explicitly disabled (-1), default (0) or
+#                   enabled (1) for this package by (profiles)/package.use
+#   ->{pkguse}    = The flag is explicitly disabled (-1), default (0) or
+#                   enabled(1) for this package by /etc/portage/package.use
+#     Note: This is a combination of the ebuilds IUSE and the installation
+#           PKGUSE and only set for installed packages.
 our $use_flags;
 
 # $used_make_conf - path of the used make.conf
@@ -64,23 +79,28 @@ my @_profiles        = ();
 my %_use_eh_safe     = (); ## USE_EXPAND_HIDDEN safe hash. See _read_make_defaults()
 my %_use_order       = ();
 
-# $_use_temp - hashref that represents the current state of
-# all known flags. This is for data gathering, the public
-# $use_flags is generated out of this by _gen_use_flags()
+# $_use_temp - hashref that represents the current state of all known flags.
+# This is for data gathering, the public $use_flags is generated out of this
+# by _gen_use_flags().
 # Layout of $_use_temp->{flag_name}:
 # {global}  = conf hash for global settings
 # {"local"}-> {package} = conf hash for per package settings
 # global and per package settings:
 # ->{conf}      Is either disabled, left alone or enabled by make.conf (-1, 0, 1)
-# ->{default}   Is either disabled, left alone or enabled by make.defaults (-1, 0, 1) (global) or installed packages IUSE (local)
-# ->{descr}     Description from use.desc ({global}) or use.local.desc {cat/pkg} (string)
+# ->{default}   Is either disabled, left alone or enabled by make.defaults
+#               (-1, 0, 1) (global) or installed packages IUSE (local)
+# ->{descr}     Description from use.desc ({global}) or use.local.desc {cat/pkg}
 # ->{forced}    Is force enabled (implies {masked}=1) in any *use.force
-#               For packages this is only set to -1 (explicitly unforced) or +1 (explicitly forced). 0 means "left alone".
-# ->{installed} Has one installed package ({global}) or is installed {cat/pkg} (0,1)
+#               For packages this is only set to -1 (explicitly unforced) or
+#               +1 (explicitly forced). 0 means "left alone".
+# ->{installed} Has one installed package ({global}) or is installed {cat/pkg}
 # ->{masked}    Is masked by any *use.mask (0,1)
-#               For packages this is only set to -1 (explicitly unmasked) or +1 (explicitly masked). 0 means "left alone".
-# ->{package}   Is either disabled, left alone or enabled by the profiles package.use files
-# ->{pkguse}    Is either disabled, left alone or enabled by the users package.use file
+#               For packages this is only set to -1 (explicitly unmasked) or +1
+#               (explicitly masked). 0 means "left alone".
+# ->{package}   Is either disabled, left alone or enabled by the profiles
+#               package.use files
+# ->{pkguse}    Is either disabled, left alone or enabled by the users
+#               package.use file
 
 my $_use_temp = undef;
 my $_use_template = {
@@ -391,9 +411,8 @@ sub _determine_profiles
 }
 
 
-# This method does a final cleanup of $_use_temp
-# Everything that is to be done _after_ all
-# configs are parsed goes in here.
+# This method does a final cleanup of $_use_temp.
+# Everything that is to be done _after_ all configs are parsed goes in here.
 # No parameters accepted
 sub _final_cleaning
 {
@@ -423,14 +442,13 @@ sub _final_cleaning
 
 
 # This function fixes two aspects of the temporary flag hash:
-# A) The {"default"} flag settings of packages might have to be
-#    overridden by the {"global"} ones.
+# A) The {"default"} flag settings of packages might have to be overridden by
+#    the {"global"} ones.
 #    (see USE_ORDER in man make.conf)
-# B) All flags that are specific to explicit versioning have no
-#    descriptions yet. This must be enriched from the versionless
-#    package setting.
-# C) Further flags that have no proper description get the
-#    string "(Unknown)" as a description
+# B) All flags that are specific to explicit versioning have no descriptions
+#    yet. This must be enriched from the versionless package setting.
+# C) Further flags that have no proper description get the string "(Unknown)"
+#    as a description
 sub _fix_flags
 {
 	for my $flag (keys %{$_use_temp}) {
@@ -448,7 +466,7 @@ sub _fix_flags
 				$gDefault = $globRef->{"default"};
 			} elsif ( $globRef->{conf}
 				   || $globRef->{"default"}
-				   || $globRef->{forcded}
+				   || $globRef->{forced}
 				   || $globRef->{masked} ) {
 			    ## The flag is definitely set somewhere
 			    $globRef->{descr} = $gDesc;
@@ -486,9 +504,8 @@ sub _fix_flags
 			}
 		} ## End of looping packages
 
-		# Finally remove the global description if it is
-		# (Unknown) with at least one local representation
-		# present.
+		# Finally remove the global description if it is (Unknown) with at
+		# least one local representation present.
 		if ($hasLocal && ("(Unknown)" eq $gDesc)) {
 			$globRef->{descr} = "";
 		}
@@ -498,8 +515,7 @@ sub _fix_flags
 }
 
 
-# Once $_use_temp  is ready, this method builds
-# the final $use_flags hashref.
+# Once $_use_temp  is ready, this method builds the final $use_flags hashref.
 # No parameters accepted
 sub _gen_use_flags
 {
@@ -721,8 +737,8 @@ sub _norm_path {
 }
 
 
-# reads all found arch.list and erase all found archs
-# from $_use_temp. Archs are not setable.
+# reads all found arch.list and erase all found archs from $_use_temp. Archs
+# are not setable.
 # No parameters accepted
 sub _read_archs {
 	for my $dir(@_profiles) {
@@ -736,8 +752,7 @@ sub _read_archs {
 }
 
 
-# reads all use.desc and use.local.desc and updates
-# $_use_temp accordingly.
+# reads all use.desc and use.local.desc and updates $_use_temp accordingly.
 # No parameters accepted
 sub _read_descriptions
 {
@@ -768,17 +783,13 @@ sub _read_descriptions
 }
 
 
-# read make.conf and record the state of all set use
-# flags.
-# Additionally add all set portage directories (plus
-# overlays) to @_profiles.
-# The last added profile directory, if it exists, is
-# /etc/portage/profile to allow recognition of user
-# overrides.
-# If either of the make.conf paths is a directory, all
-# files are read in alphanumerical order. The file
-# changes are written to will be the last file that
-# contains a USE assignement.
+# read make.conf and record the state of all set use flags.
+# Additionally add all set portage directories (plus overlays) to @_profiles.
+# The last added profile directory, if it exists, is /etc/portage/profile to
+# allow recognition of user overrides.
+# If either of the make.conf paths is a directory, all files are read in
+# alphanumerical order. The file changes are written to will be the last file
+# that contains a USE assignement.
 # No parameters accepted.
 sub _read_make_conf {
 	my ($stOldPath, $stNewPath) = (	"${_EPREFIX}/etc/make.conf",
@@ -876,9 +887,8 @@ sub _read_make_defaults {
 }
 
 
-# read all found make.globals and merge their
-# settings into %environment. This is done to
-# get the final "PORTDIR" and "USE_ORDER"
+# read all found make.globals and merge their settings into %environment. This
+# is done to get the final "PORTDIR" and "USE_ORDER"
 # No parameters accepted
 sub _read_make_globals {
 	for my $dir(@_profiles, "${_EPREFIX}/usr/share/portage/config") {
@@ -888,8 +898,8 @@ sub _read_make_globals {
 }
 
 
-# read all found package.use files and merge their values into
-# env, adding flag parameters to $_use_tmp.
+# read all found package.use files and merge their values into env, adding flag
+# parameters to $_use_tmp.
 # No parameters accepted.
 sub _read_package_use
 {
@@ -917,10 +927,9 @@ sub _read_package_use
 }
 
 
-# Analyze EPREFIX/var/db/pkg and analyze all installed
-# packages. The contents of the file IUSE are used to
-# enrich the information of the {default} part and to
-# determine which packages are installed.
+# Analyze EPREFIX/var/db/pkg and analyze all installed packages. The contents
+# of the file IUSE are used to enrich the information of the {default} part and
+# to determine which packages are installed.
 sub _read_packages {
 	my $pkgdir = undef;
 	opendir($pkgdir, "${_EPREFIX}/var/db/pkg")
@@ -972,9 +981,8 @@ sub _read_packages {
 
 
 # reads the given file and parses it for key=value pairs.
-# "source" entries are added to the file and parsed as
-# well. The results of the parsing are merged into
-# %environment.
+# "source" entries are added to the file and parsed as well. The results of the
+# parsing are merged into %environment.
 # Parameter 1: The path of the file to parse.
 # In a non-scalar context the function returns the found values.
 sub _read_sh {
@@ -1060,9 +1068,8 @@ sub _read_sh {
 }
 
 
-# read all enforced flags from all found use.force
-# and package.use.force files. Save the found
-# masks in %use_flags.
+# read all enforced flags from all found use.force and package.use.force files.
+# Save the found masks in %use_flags.
 # No parameters accepted.
 sub _read_use_force {
 	for my $dir(@_profiles) {
@@ -1103,9 +1110,8 @@ sub _read_use_force {
 }
 
 
-# read all masked flags from all found use.mask
-# and package.use.mask files. Save the found
-# masks in %use_flags.
+# read all masked flags from all found use.mask and package.use.mask files.
+# Save the found masks in %use_flags.
 # No parameters accepted.
 sub _read_use_mask {
 	for my $dir(@_profiles) {


^ permalink raw reply related	[flat|nested] 238+ messages in thread
* [gentoo-commits] proj/ufed:master commit in: /
@ 2014-02-26 10:26 Sven Eden
  0 siblings, 0 replies; 238+ messages in thread
From: Sven Eden @ 2014-02-26 10:26 UTC (permalink / raw
  To: gentoo-commits

commit:     e495cb7fd8980b2c3dcef28426187c51a1d9de9e
Author:     Sven Eden <yamakuzure <AT> gmx <DOT> net>
AuthorDate: Wed Feb 26 09:48:48 2014 +0000
Commit:     Sven Eden <sven.eden <AT> gmx <DOT> de>
CommitDate: Wed Feb 26 09:48:48 2014 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/ufed.git;a=commit;h=e495cb7f

Portage.pm: Determining the make.profile is now secure of make.profile being a file.

---
 Portage.pm | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/Portage.pm b/Portage.pm
index 71cada0..229ebba 100644
--- a/Portage.pm
+++ b/Portage.pm
@@ -400,11 +400,16 @@ sub _determine_profiles
 
 	my $mp = undef;
 	   (-l $mp_path and $mp = readlink $mp_path)
-	or (-d $mp_path and $mp = $mp_path);
+	or (-d $mp_path and $mp = $mp_path)
+		# Be sure it is not a file either:
+	or (-f $mp_path and die(
+		  "\n$mp_path is a file.\n"
+		. " This is an odd setup.\n"
+		. " Please report this incident!\n"));
 	
 	# make.profile is mandatory and must be a link or directory
 	defined($mp)
-		or die "$mp_path is neither symlink nor directory\n";
+		or die("\n$mp_path is neither symlink nor directory\n");
 
 	# Start with the found path, it is the deepest profile child.
 	@_profiles = -l $mp_path ? _norm_path('/etc', $mp) : $mp;


^ permalink raw reply related	[flat|nested] 238+ messages in thread
* [gentoo-commits] proj/ufed:master commit in: /
@ 2014-02-26 10:26 Sven Eden
  0 siblings, 0 replies; 238+ messages in thread
From: Sven Eden @ 2014-02-26 10:26 UTC (permalink / raw
  To: gentoo-commits

commit:     0d2941afbeb5b812949fe85895558d9015c06e9e
Author:     Sven Eden <yamakuzure <AT> gmx <DOT> net>
AuthorDate: Wed Feb 26 09:48:22 2014 +0000
Commit:     Sven Eden <sven.eden <AT> gmx <DOT> de>
CommitDate: Wed Feb 26 09:48:22 2014 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/ufed.git;a=commit;h=0d2941af

ufed.pl.in: Minor updates to the documentation.

---
 ufed.pl.in | 18 ++++++++++--------
 1 file changed, 10 insertions(+), 8 deletions(-)

diff --git a/ufed.pl.in b/ufed.pl.in
index 17f4c7a..fdcdf18 100644
--- a/ufed.pl.in
+++ b/ufed.pl.in
@@ -2,7 +2,7 @@
 use strict;
 use warnings;
 
-# Copyright 1999-2013 Gentoo Foundation
+# Copyright 1999-2014 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 # $
 
@@ -11,6 +11,9 @@ use Portage;
 
 # 0 = normal, 1 = gdb, 2 = valgrind
 use constant { EXEC => 0 };
+# Note on PBP: Like Portage.pm one single value for debugging purposes is not
+#              enough to justify an additional dependency, so this stays being
+#              a (discouraged) constant.
 
 my $version = 'XX_PACKAGE_VERSION@';
 
@@ -30,8 +33,8 @@ flags_dialog;
 
 
 # Take a list and return it ordered the following way:
-# Put "-*" first, followed by enabling flags and put
-# disabling flags to the end.
+# Put "-*" first, followed by enabling flags and put disabling flags to the
+# end.
 # Parameters: list of flags
 sub finalise {
 	my @arg = @_;
@@ -45,9 +48,8 @@ sub finalise {
 	return @result;
 }
 
-# Launch the curses interface. Communication is done using
-# pipes. Waiting for pipe read/write to finish is done
-# automatically.
+# Launch the curses interface. Communication is done using pipes. Waiting for
+# pipe read/write to finish is done automatically.
 # No parameters accepted.
 sub flags_dialog {
 	use POSIX ();
@@ -165,8 +167,8 @@ sub flags_dialog {
 }
 
 
-# Write given list of flags back to make.conf if
-# the file has not been changed since reading it.
+# Write given list of flags back to make.conf if the file has not been changed
+# since reading it.
 # Parameters: list of flags
 sub save_flags {
 	my (@flags) = @_;


^ permalink raw reply related	[flat|nested] 238+ messages in thread
* [gentoo-commits] proj/ufed:master commit in: /
@ 2014-02-25  8:18 Sven Eden
  0 siblings, 0 replies; 238+ messages in thread
From: Sven Eden @ 2014-02-25  8:18 UTC (permalink / raw
  To: gentoo-commits

commit:     1d8145a8c1936ee46ea14caeba47e93f2db4c474
Author:     Sven Eden <yamakuzure <AT> gmx <DOT> net>
AuthorDate: Tue Feb 25 06:58:02 2014 +0000
Commit:     Sven Eden <sven.eden <AT> gmx <DOT> de>
CommitDate: Tue Feb 25 06:58:02 2014 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/ufed.git;a=commit;h=1d8145a8

File TODO: Some cleanup and recent additions.

---
 TODO | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/TODO b/TODO
index 321ec59..f1d5283 100644
--- a/TODO
+++ b/TODO
@@ -9,7 +9,6 @@ When a feature is officially released (no rc-ebuild!), it is removed.
 --- TODO ---
 ------------
 These are mandatory for the next release cycle:
-- ufed must not error out when USE in make.conf is exceptionally large. 
 
 These are planned:
 - Add package filter per command line argument
@@ -24,7 +23,8 @@ These ideas for the (far far away) future
 ------------
 --- DONE ---
 ------------
-These have been finished
+These have been finished :
+
 - (0.90) Add Filter local/global.
 - (0.90) Add Filter installed/all.
 - (0.90) Add parsing of /etc/make.profile/package.use for command line
@@ -51,6 +51,11 @@ These have been finished
 - (0.90) Handle setups where /etc/portage/make.conf is a directory.
 - (0.90) Read PORTDIR and PORTDIR_OVERLAY from portageq, too.
 - (0.90) Make searching and cursor placement reliable.
+
 - (0.91) Add line wrapping.
 - (0.91) Make key help buttons dynamic (text, placement and width).
 - (0.91) Replace status indicator with dynamic status line.
+- (0.91) ufed does not error out when USE in make.conf is exceptionally large.
+- (0.91) The deprecated 'portageq envvar' is no longer used for to determine
+         PORTDIR and PORTDIR_OVERLAY, eix is used if available and portageq
+         with the get_repo(s|_path) command as a fallback.


^ permalink raw reply related	[flat|nested] 238+ messages in thread
* [gentoo-commits] proj/ufed:master commit in: /
@ 2014-02-25  8:18 Sven Eden
  0 siblings, 0 replies; 238+ messages in thread
From: Sven Eden @ 2014-02-25  8:18 UTC (permalink / raw
  To: gentoo-commits

commit:     046e0b873ec163012780176597e6510ce026a16e
Author:     Sven Eden <yamakuzure <AT> gmx <DOT> net>
AuthorDate: Tue Feb 25 07:03:54 2014 +0000
Commit:     Sven Eden <sven.eden <AT> gmx <DOT> de>
CommitDate: Tue Feb 25 07:03:54 2014 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/ufed.git;a=commit;h=046e0b87

Portage.pm: Changed determination of PORTDIR and PORTDIR_OVERLAY to use eix if available with portageq get_repo(s|_path) as a fallback.

---
 Portage.pm | 85 ++++++++++++++++++++++++++++++++++++++++++++++----------------
 1 file changed, 63 insertions(+), 22 deletions(-)

diff --git a/Portage.pm b/Portage.pm
index fc8ddd7..6eed5e2 100644
--- a/Portage.pm
+++ b/Portage.pm
@@ -93,6 +93,8 @@ my $_use_template = {
 	"package" => 0,
 	pkguse    => 0
 };
+my $_has_eix = 0; # Set to 1 by INIT if eix can be found.
+my $_eix_cmd = "";
 
 # --- public methods ---
 sub debugMsg;
@@ -126,6 +128,15 @@ sub _remove_expands;
 # --- Package initialization ---
 INIT {
 	$_environment{$_} = {} for qw{USE USE_EXPAND USE_EXPAND_HIDDEN};
+	
+	# See if eix is available
+	$_eix_cmd = qx{which eix 2>/dev/null};
+	defined($_eix_cmd)
+        and chomp $_eix_cmd
+        and -x $_eix_cmd
+        and $_has_eix = 1;
+	
+	# Initialize basics
 	_determine_eprefix_portdir;
 	_determine_make_conf;
 	_determine_profiles;
@@ -264,34 +275,57 @@ sub _add_temp
 }
 
 
-# Determine the values for EPREFIX, PORTDIR
-# and PORTDIR_OVERLAY. These are saved in
-# $_EPREFIX, $_PORTDIR and $_PORTDIR_OVERLAY.
-# This is done using 'portageq'.
-# Other output from portageq is printed on
-# STDERR.
+# Determine the values for EPREFIX, PORTDIR and PORTDIR_OVERLAY. These are
+# saved in $_EPREFIX, $_PORTDIR and $_PORTDIR_OVERLAY.
+# This is done using 'eix' with 'portageq' as a fallback.
+# Other output from portageq is printed on STDERR.
 # No parameters accepted.
 sub _determine_eprefix_portdir {
 	my $tmp = "/tmp/ufed_$$.tmp";
-	my @res = map {
-		my $x = $_;
-		chomp $x;
-		$x =~ s/'//g;
-		$x
-	} qx{portageq envvar -v EPREFIX PORTDIR PORTDIR_OVERLAY 2>$tmp};
+
+	$_EPREFIX = qx{portageq envvar EPREFIX 2>$tmp};
+	defined($_EPREFIX) and chomp $_EPREFIX or $_EPREFIX="";
 	
-	while (my $res = shift @res) {
-		if ($res =~ /^(.*)=(.*)$/) {
-			"EPREFIX"         eq $1 and $_EPREFIX         = $2;
-			"PORTDIR"         eq $1 and $_PORTDIR         = $2;
-			"PORTDIR_OVERLAY" eq $1 and $_PORTDIR_OVERLAY = $2;
-		}
-		debugMsg("EPREFIX='${_EPREFIX}'");
-		debugMsg("PORTDIR='${_PORTDIR}'");
-		debugMsg("PORTDIR_OVERLAY='${_PORTDIR_OVERLAY}'");
+	# Prefer eix over portageq if it is available
+	if ($_has_eix) {
+		debugMsg("Using eix...");
+		
+		local $ENV{PRINT_APPEND}='';
+		$_PORTDIR         = qx{$_eix_cmd --print PORTDIR 2>>$tmp};
+		$_PORTDIR_OVERLAY = qx{$_eix_cmd --print PORTDIR_OVERLAY 2>>$tmp};
+		
+		# eix ends PORTDIR with a slash that must be removed
+		$_PORTDIR =~ s,/+$,,;
+	} else {
+		debugMsg("Using portageq fallback...");
+
+		my $eroot = qx{portageq envvar EROOT 2>>$tmp};
+		defined($eroot) and chomp $eroot or $eroot="/";
+		
+		# Remove 'gentoo', this is PORTDIR, the others are PORTDIR_OVERLAY.
+		my $repos = join(' ', map {
+			my $x = $_;
+			$x =~ s/^gentoo$//;
+			$x
+		} split(' ', qx{portageq get_repos $eroot 2>>$tmp}) );
+		chomp $repos;
+		
+		# Now the paths can be determined:
+		$_PORTDIR         = qx{portageq get_repo_path $eroot gentoo 2>>$tmp};
+		$_PORTDIR_OVERLAY = join(' ', map {
+			my $x = $_;
+			$x =~ s/^\s*(\S+)\s*$/$1/mg;
+			$x
+		} split('\n', qx{portageq get_repo_path $eroot $repos 2>>$tmp} ));
+		defined($_PORTDIR) and chomp $_PORTDIR;
+		defined($_PORTDIR_OVERLAY) and chomp $_PORTDIR_OVERLAY;
 	}
-	die "Couldn't determine EPREFIX and PORTDIR from Portage" if $? != 0;
+	
+	debugMsg("EPREFIX='${_EPREFIX}'");
+	debugMsg("PORTDIR='${_PORTDIR}'");
+	debugMsg("PORTDIR_OVERLAY='${_PORTDIR_OVERLAY}'");
 
+	# Print error messages if any:
 	if ( -s $tmp ) {
 		if (open (my $fTmp, "<", $tmp)) {
 			print STDERR "$_" while (<$fTmp>);
@@ -300,6 +334,13 @@ sub _determine_eprefix_portdir {
 	}
 	-e $tmp and unlink $tmp;
 
+	# Die unless this is sane
+	defined($_EPREFIX)
+		and defined($_PORTDIR)
+		and length($_PORTDIR)
+		and defined($_PORTDIR_OVERLAY)
+		 or die "\nCouldn't determine EPREFIX and PORTDIR from Portage\n";
+
 	return;
 }
 


^ permalink raw reply related	[flat|nested] 238+ messages in thread
* [gentoo-commits] proj/ufed:master commit in: /
@ 2014-02-25  8:18 Sven Eden
  0 siblings, 0 replies; 238+ messages in thread
From: Sven Eden @ 2014-02-25  8:18 UTC (permalink / raw
  To: gentoo-commits

commit:     d927069b8bf885a331ec1112726bc6d2905ee718
Author:     Sven Eden <yamakuzure <AT> gmx <DOT> net>
AuthorDate: Tue Feb 25 07:15:26 2014 +0000
Commit:     Sven Eden <sven.eden <AT> gmx <DOT> de>
CommitDate: Tue Feb 25 07:15:26 2014 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/ufed.git;a=commit;h=d927069b

Portage.pm : Just a minor addition to the debugging output after description stripping. (Makes finding '(Unknown)' description causes easier)

---
 Portage.pm | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Portage.pm b/Portage.pm
index 6eed5e2..5471e73 100644
--- a/Portage.pm
+++ b/Portage.pm
@@ -224,7 +224,7 @@ sub _add_flag
 			my $POST   = "(?:in|for|the|on|with|a|to)?";
 			$descr_alt =~ s/^$VERB\s*$BIND\s*$WHAT\s*$POST\s*$POST\s+//mig;
 			
-			debugMsg("   \"$descr\"\n-> \"$descr_alt\"");
+			debugMsg("$flag : [$pkg]\n   \"$descr\"\n-> \"$descr_alt\"");
 		}
 
 		$data{descr}     = $descr;


^ permalink raw reply related	[flat|nested] 238+ messages in thread
* [gentoo-commits] proj/ufed:master commit in: /
@ 2014-02-25  8:18 Sven Eden
  0 siblings, 0 replies; 238+ messages in thread
From: Sven Eden @ 2014-02-25  8:18 UTC (permalink / raw
  To: gentoo-commits

commit:     70bcee74470341afd6f84c420fbb882cd7d4ef92
Author:     Sven Eden <yamakuzure <AT> gmx <DOT> net>
AuthorDate: Fri Dec  6 09:35:11 2013 +0000
Commit:     Sven Eden <sven.eden <AT> gmx <DOT> de>
CommitDate: Fri Dec  6 09:35:11 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/ufed.git;a=commit;h=70bcee74

Added test files and folders to .gitgnore

---
 .gitignore | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/.gitignore b/.gitignore
index 789d647..9ac0d82 100644
--- a/.gitignore
+++ b/.gitignore
@@ -17,4 +17,6 @@ ufed
 ufed-curses
 testflags.txt
 ufed.8
-0.90_get_portdir_from_portageq.patch.gz
+patches/
+*.tar.bz2
+ufed-?.*/


^ permalink raw reply related	[flat|nested] 238+ messages in thread
* [gentoo-commits] proj/ufed:master commit in: /
@ 2013-11-25 21:43 Sven Eden
  0 siblings, 0 replies; 238+ messages in thread
From: Sven Eden @ 2013-11-25 21:43 UTC (permalink / raw
  To: gentoo-commits

commit:     ea1cc83f1b99f71b3a8b75326579dc7d544c2c47
Author:     Sven Eden <yamakuzure <AT> gmx <DOT> net>
AuthorDate: Mon Nov 25 07:20:41 2013 +0000
Commit:     Sven Eden <sven.eden <AT> gmx <DOT> de>
CommitDate: Mon Nov 25 07:20:41 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/ufed.git;a=commit;h=ea1cc83f

ufed.pl.in: Fixed a typo

---
 ufed.pl.in | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/ufed.pl.in b/ufed.pl.in
index 58e4d9c..be20b02 100644
--- a/ufed.pl.in
+++ b/ufed.pl.in
@@ -45,7 +45,7 @@ sub finalise {
 	return @result;
 }
 
-# Launch the curses inteface. Communication is done using
+# Launch the curses interface. Communication is done using
 # pipes. Waiting for pipe read/write to finish is done
 # automatically.
 # No parameters accepted.


^ permalink raw reply related	[flat|nested] 238+ messages in thread
* [gentoo-commits] proj/ufed:master commit in: /
@ 2013-11-25 21:43 Sven Eden
  0 siblings, 0 replies; 238+ messages in thread
From: Sven Eden @ 2013-11-25 21:43 UTC (permalink / raw
  To: gentoo-commits

commit:     5762ce745351658babc388cd62a7f9ed5dfcb5c3
Author:     Sven Eden <yamakuzure <AT> gmx <DOT> net>
AuthorDate: Mon Nov 25 18:37:05 2013 +0000
Commit:     Sven Eden <sven.eden <AT> gmx <DOT> de>
CommitDate: Mon Nov 25 18:37:05 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/ufed.git;a=commit;h=5762ce74

Extended the regular expressions used to parse found files following
a hint I got from perlmonks.

---
 Portage.pm | 19 +++++++++++++++----
 ufed.pl.in | 31 ++++++++++++++++++++++++++-----
 2 files changed, 41 insertions(+), 9 deletions(-)

diff --git a/Portage.pm b/Portage.pm
index d3bed35..fc8ddd7 100644
--- a/Portage.pm
+++ b/Portage.pm
@@ -941,9 +941,20 @@ sub _read_sh {
 	my $BLANK = qr{(?:[ \n\t]+|#.*)+};         # whitespace and comments
 	my $IDENT = qr{([^ \\\n\t'"{}=#]+)};       # identifiers
 	my $ASSIG = qr{=};                         # assignment operator
-	my $UQVAL = qr{((?:[^ \\\n\t'"#]+|\\.)+)}s;# unquoted value
-	my $SQVAL = qr{'([^']*)'};                 # singlequoted value
-	my $DQVAL = qr{"((?:[^\\"]|\\.)*)"}s;      # doublequoted value
+	my $UQVAL = qr{((?:          # guard to extend the character limit
+		[^ \\\n\t'"#]{1,32766} | # max 32766 of regular characters or
+		\\.                      # one escaped character
+		){1,32766}               # extend by 32766 sub matches
+	)}sx;                                      # unquoted value
+	my $SQVAL = qr{'((?:         # guard to extend the character limit
+		[^']{0,32766}            # 0 to 32766 characters ...
+		){0,32766}               # ... up to 32766 times
+	)'}x;                                      # singlequoted value
+	my $DQVAL = qr{"((?:         # guard to extend the character limit
+		[^\\"]{0,32766}        | # max 32766 non-escaped characters or
+		\\.                      # one escaped character
+		){0,32766}               # extend by up to 32766 sub matches
+	)"}sx;                                     # doublequoted value
 
 	my %env;
 	if(open my $file, '<', $fname) {
@@ -957,7 +968,7 @@ sub _read_sh {
 				my $name = $1;
 				/\G$BLANK/gc;
 				if($name ne 'source') {
-				/\G$ASSIG/gc or die "Bare keyword $name detected.";
+				/\G$ASSIG/gc or die "Bare keyword $name (pos " . pos . ") detected.";
 				/\G$BLANK/gc;
 				}
 				pos == length and die "Bumped into unexpected EOF after $name.";

diff --git a/ufed.pl.in b/ufed.pl.in
index 3d1e354..17f4c7a 100644
--- a/ufed.pl.in
+++ b/ufed.pl.in
@@ -177,11 +177,32 @@ sub save_flags {
 		\#.*)+}x;
 	my $IDENT = qr{([^ \\\n\t'"{}=#]+)};            # identifiers
 	my $ASSIG = qr{=};                              # assignment operator
-	my $UQVAL = qr{(?:[^ \\\n\t'"#]+|\\.)+}s;       # unquoted value
-	my $SQVAL = qr{'[^']*'};                        # singlequoted value
-	my $DQVAL = qr{"(?:[^\\"]|\\.)*"}s;             # doublequoted value
-	my $BNUQV = qr{(?:[^ \\\n\t'"#]+|\\\n()|\\.)+}s;# unquoted value (scan for \\\n)
-	my $BNDQV = qr{"(?:[^\\"]|\\\n()|\\.)*"}s;      # doublequoted value (scan for \\\n)
+	my $UQVAL = qr{(?:           # guard to extend the character limit
+		[^ \\\n\t'"#]{1,32766} | # max 32766 of regular characters or
+		\\.                      # one escaped character
+		){1,32766}               # extend by 32766 sub matches
+	}sx;                                            # unquoted value
+	my $SQVAL = qr{'(?:          # guard to extend the character limit
+		[^']{0,32766}            # 0 to 32766 characters ...
+		){0,32766}               # ... up to 32766 times
+	'}x;                                            # singlequoted value
+	my $DQVAL = qr{"(?:          # guard to extend the character limit
+		[^\\"]{0,32766}        | # max 32766 non-escaped characters or
+		\\.                      # one escaped character
+		){0,32766}               # extend by up to 32766 sub matches
+	"}sx;                                           # doublequoted value
+	my $BNUQV = qr{(?:
+		[^ \\\n\t'"#]{1,32766} | # Anything but escapes, quotes and so on
+		\\\n()                 | # or a backslash followed by a newline
+		\\.                      # or any other escape sequence
+		){1,32766}               # extended like above
+	}sx;                                            # unquoted value (scan for \\\n)
+	my $BNDQV = qr{"(?:(?:       # double guard to extend more freely
+		[^\\"]                 | # Anything but a backslash or double quote
+		\\\n()                 | # or a backslash and a newline
+		\\.                      # or any other escaped value
+		){0,32766}){0,32766}     # max 32766*32766 matches.
+	"}sx;                                           # doublequoted value (scan for \\\n)
 
 	my $contents;
 


^ permalink raw reply related	[flat|nested] 238+ messages in thread
* [gentoo-commits] proj/ufed:master commit in: /
@ 2013-11-25 21:43 Sven Eden
  0 siblings, 0 replies; 238+ messages in thread
From: Sven Eden @ 2013-11-25 21:43 UTC (permalink / raw
  To: gentoo-commits

commit:     583d6c70e4e06a60445a0f9e744914c96f14c79a
Author:     Sven Eden <yamakuzure <AT> gmx <DOT> net>
AuthorDate: Mon Nov 25 08:08:22 2013 +0000
Commit:     Sven Eden <sven.eden <AT> gmx <DOT> de>
CommitDate: Mon Nov 25 08:08:22 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/ufed.git;a=commit;h=583d6c70

ufed.pl/Portage.pm: Parsing error messages from eval are now chomp'ed

---
 Portage.pm | 4 ++--
 ufed.pl.in | 3 ++-
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/Portage.pm b/Portage.pm
index e9edaab..d3bed35 100644
--- a/Portage.pm
+++ b/Portage.pm
@@ -999,8 +999,8 @@ sub _read_sh {
 				}
 			}
 		};
-		defined($@) and length($@) and
-			die "Parse error in $fname\n - Error: \"$@\"\n";
+		defined($@) and length($@) and chomp $@
+			and die "Parse error in $fname\n - Error: \"$@\"\n";
 	}
 	_merge_env(\%env);
 	return %env if wantarray;

diff --git a/ufed.pl.in b/ufed.pl.in
index 37f7957..3d1e354 100644
--- a/ufed.pl.in
+++ b/ufed.pl.in
@@ -335,7 +335,8 @@ sub save_flags {
 			}
 		}
 	};
-	defined($@) and length($@) and die "\nParse error when writing make.conf"
+	defined($@) and length($@) and chomp $@
+		and die "\nParse error when writing make.conf"
 		. " - did you modify it while ufed was running?\n"
 		. " - Error: \"$@\"\n";
 


^ permalink raw reply related	[flat|nested] 238+ messages in thread
* [gentoo-commits] proj/ufed:master commit in: /
@ 2013-11-25 21:43 Sven Eden
  0 siblings, 0 replies; 238+ messages in thread
From: Sven Eden @ 2013-11-25 21:43 UTC (permalink / raw
  To: gentoo-commits

commit:     49b8c6c96781d7d70662231b1a699701b3e4be15
Author:     Sven Eden <yamakuzure <AT> gmx <DOT> net>
AuthorDate: Mon Nov 25 08:03:59 2013 +0000
Commit:     Sven Eden <sven.eden <AT> gmx <DOT> de>
CommitDate: Mon Nov 25 08:03:59 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/ufed.git;a=commit;h=49b8c6c9

Added error messages and reporting of those if the file parsing failes.

---
 Portage.pm | 13 +++++++------
 ufed.pl.in | 43 ++++++++++++++++++++++++++++++-------------
 2 files changed, 37 insertions(+), 19 deletions(-)

diff --git a/Portage.pm b/Portage.pm
index dc7b964..e9edaab 100644
--- a/Portage.pm
+++ b/Portage.pm
@@ -953,14 +953,14 @@ sub _read_sh {
 			for(;;) {
 				/\G$BLANK/gc;
 				last if ((pos || 0) == (length || 0));
-				/\G$IDENT/gc or die;
+				/\G$IDENT/gc or die "Empty file detected, no identifier found.";
 				my $name = $1;
 				/\G$BLANK/gc;
 				if($name ne 'source') {
-				/\G$ASSIG/gc or die;
+				/\G$ASSIG/gc or die "Bare keyword $name detected.";
 				/\G$BLANK/gc;
 				}
-				die if pos == length;
+				pos == length and die "Bumped into unexpected EOF after $name.";
 				my $value = '';
 				for(;;) {
 					if(/\G$UQVAL/gc || /\G$DQVAL/gc) {
@@ -989,17 +989,18 @@ sub _read_sh {
 					substr($_, pos, 0) = do {
 						local $/;
 						my $text = <$f>;
-						die if not defined $text;
+						defined $text or die "Error parsing $value";
 						$text;
 					};
 					pos = $pos;
-					close $f or die "Unable to open $value\n$!\n";
+					close $f or die "Unable to close $value\n$!\n";
 				} else {
 				$env{$name} = $value;
 				}
 			}
 		};
-		die "Parse error in $fname\n" if $@;
+		defined($@) and length($@) and
+			die "Parse error in $fname\n - Error: \"$@\"\n";
 	}
 	_merge_env(\%env);
 	return %env if wantarray;

diff --git a/ufed.pl.in b/ufed.pl.in
index be20b02..37f7957 100644
--- a/ufed.pl.in
+++ b/ufed.pl.in
@@ -213,31 +213,36 @@ sub save_flags {
 				my $line = substr($_, $linestart, pos()-$linestart);
 				$line !~ /[^ \t]/;
 			};
-			/\G$IDENT/gc or die;
+			/\G$IDENT/gc or die "No identifier found to start with.";
 			my $name = $1;
 			/\G$BLANK/gc;
 			if($name ne 'source') {
-			/\G$ASSIG/gc or die;
-			/\G$BLANK/gc;
+				/\G$ASSIG/gc or die "Identifier $name without assignement detected.";
+				/\G$BLANK/gc;
 			} else {
 				$sourcing = 1;
 			}
-			die if pos == length;
+			pos == length and die "Bumped into early EOF.";
 			if($name ne 'USE') {
-				/\G(?:$UQVAL|$SQVAL|$DQVAL)+/gc or die;
+				/\G(?:$UQVAL|$SQVAL|$DQVAL)+/gc or die "Blank assignement for $name detected.";
 			} else {
 				my $start = pos;
-				/\G(?:$BNUQV|$SQVAL|$BNDQV)+/gc or die;
+				m/\G(?:$BNUQV|$SQVAL|$BNDQV)+/gc or die "Empty USE assignement detected.";
 				my $end = pos;
+
 				# save whether user uses backslash-newline
 				my $bsnl = defined $1 || defined $2;
+
 				# start of the line is one past the last newline; also handles first line
 				my $linestart = 1+rindex $_, "\n", $start-1;
+
 				# everything on the current line before the USE flags, plus one for the "
 				my $line = substr($_, $linestart, $start-$linestart).' ';
+
 				# only indent if USE starts a line
 				my $blank = $flagatstartofline ? $line : "";
 				$blank =~ s/[^ \t]/ /g;
+
 				# word wrap
 				if(@flags != 0) {
 					my $length = 0;
@@ -251,10 +256,12 @@ sub save_flags {
 						}
 					}
 					my $blanklength = $blank ne '' ? $length : 0;
+
 					# new line, using backslash-newline if the user did that
 					my $nl = ($bsnl ? " \\\n" : "\n").$blank;
 					my $linelength = $bsnl ? 76 : 78;
 					my $flag = $flags[0];
+
 					if($blanklength != 0 || length $flag <= $linelength) {
 						$flags   = $flag;
 						$length += length $flag;
@@ -272,16 +279,22 @@ sub save_flags {
 						}
 					}
 				}
+
 				# replace the current USE flags with the modified ones
 				substr($_, $start, $end-$start) = "\"$flags\"";
+
 				# and have the next search start after our new flags
 				pos = $start + 2 + length $flags;
+
 				# and end this
 				undef $flags;
 				last;
 			}
 		}
-		if(defined $flags) { # if we didn't replace the flags, tack them after the last #USE= or at the end
+
+		if(defined $flags) {
+
+			# if we didn't replace the flags, tack them after the last #USE= or at the end
 			$flags = '';
 			if(@flags != 0) {
 				$flags = $flags[0];
@@ -297,21 +310,23 @@ sub save_flags {
 				}
 			}
 			substr($_, $ucs, $uce-$ucs) = "\nUSE=\"$flags\"\n";
-		} else { # if we replaced the flags, delete any further overrides
+		} else {
+
+			# if we replaced the flags, delete any further overrides
 			for(;;) {
 				my $start = pos;
 				/\G$BLANK/gc;
 				last if pos == length;
-				/\G$IDENT/gc or die;
+				/\G$IDENT/gc or die "Identifier detection failed.";
 				my $name = $1;
 				/\G$BLANK/gc;
 				if($name ne 'source') {
-				/\G$ASSIG/gc or die;
-				/\G$BLANK/gc;
+					/\G$ASSIG/gc or die "Identifier $name without assignement detected.";
+					/\G$BLANK/gc;
 				} else {
 					$sourcing = 1;
 				}
-				/\G(?:$UQVAL|$SQVAL|$DQVAL)+/gc or die;
+				m/\G(?:$UQVAL|$SQVAL|$DQVAL)+/gc or die "Empty assignement for $name detected.";
 				my $end = pos;
 				if($name eq 'USE') {
 					substr($_, $start, $end-$start) = '';
@@ -320,7 +335,9 @@ sub save_flags {
 			}
 		}
 	};
-	die "Parse error when writing make.conf - did you modify it while ufed was running?\n" if $@;
+	defined($@) and length($@) and die "\nParse error when writing make.conf"
+		. " - did you modify it while ufed was running?\n"
+		. " - Error: \"$@\"\n";
 
 	print STDERR <<EOF if $sourcing;
 Warning: source command found in $makeconf_name. Flags may


^ permalink raw reply related	[flat|nested] 238+ messages in thread
* [gentoo-commits] proj/ufed:master commit in: /
@ 2013-11-25 21:43 Sven Eden
  0 siblings, 0 replies; 238+ messages in thread
From: Sven Eden @ 2013-11-25 21:43 UTC (permalink / raw
  To: gentoo-commits

commit:     c76f963cac4096cb14bfe46a57d318773f14cc49
Author:     Sven Eden <yamakuzure <AT> gmx <DOT> net>
AuthorDate: Mon Nov 25 07:20:19 2013 +0000
Commit:     Sven Eden <sven.eden <AT> gmx <DOT> de>
CommitDate: Mon Nov 25 07:20:19 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/ufed.git;a=commit;h=c76f963c

TODO: Added mandatory fix of current problem with overlong USE flags in make.conf

---
 TODO | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/TODO b/TODO
index ede1693..321ec59 100644
--- a/TODO
+++ b/TODO
@@ -8,6 +8,9 @@ When a feature is officially released (no rc-ebuild!), it is removed.
 ------------
 --- TODO ---
 ------------
+These are mandatory for the next release cycle:
+- ufed must not error out when USE in make.conf is exceptionally large. 
+
 These are planned:
 - Add package filter per command line argument
 - Handle USE_EXPAND and USE_EXPAND_HIDDEN flags


^ permalink raw reply related	[flat|nested] 238+ messages in thread
* [gentoo-commits] proj/ufed:master commit in: /
@ 2013-09-20  8:30 Sven Eden
  0 siblings, 0 replies; 238+ messages in thread
From: Sven Eden @ 2013-09-20  8:30 UTC (permalink / raw
  To: gentoo-commits

commit:     5b527ddbd050f6ec0a5cdf6b5ecce8f923e00683
Author:     Sven Eden <yamakuzure <AT> gmx <DOT> net>
AuthorDate: Fri Sep 20 07:13:03 2013 +0000
Commit:     Sven Eden <sven.eden <AT> gmx <DOT> de>
CommitDate: Fri Sep 20 07:13:03 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/ufed.git;a=commit;h=5b527ddb

calculateDescWrap(): Cleaned the code up and made it more robust. The code can now correctly break any situation but one. The missing one is a one line affected package, that, although it is broken in time, it is broken 2-3 characters early then if the available space is just not enough. Hoewever, I believe everybody can live with this.

---
 ufed-curses-types.c | 42 ++++++++++++++++++++++++------------------
 1 file changed, 24 insertions(+), 18 deletions(-)

diff --git a/ufed-curses-types.c b/ufed-curses-types.c
index 1a30392..b3eb012 100644
--- a/ufed-curses-types.c
+++ b/ufed-curses-types.c
@@ -532,7 +532,7 @@ static void calculateDescWrap(sDesc* desc)
 		size_t dLen  = pDesc ? strlen(pDesc) : 0;
 		size_t pLen  = pPkg ? strlen(pPkg) : 0;
 		size_t left  = dLen + pLen;
-		size_t wLen  = eOrder_left == desc->wrapOrder ? pLen : dLen;
+		size_t wLen  = (eOrder_left == desc->wrapOrder ? pLen : dLen) - 1;
 		size_t oLen  = 0; // Set to the first part to be added to pos on the second
 		// part, so drawflag knows from where to start taking in the unified desc.
 
@@ -562,7 +562,7 @@ static void calculateDescWrap(sDesc* desc)
 		 */
 		if (NULL == pch) {
 			pch  = pDesc;
-			wLen = dLen;
+			wLen = dLen - 1;
 			left = dLen;
 		}
 
@@ -581,19 +581,28 @@ static void calculateDescWrap(sDesc* desc)
 			// and two spaces less in their last line, because another
 			// bracked is postfixed and the leading whitespace is
 			// skipped below.
+			bool isEnd   = (end >= wLen);
+			bool isStart = (!start || (start == oLen));
 			if (pch == pPkg) {
-				if (!start || (start == oLen))
+				// Add one space for leading bracket on pure starts
+				if (isStart)
 					--end;
-				else if (end >= (wLen - 1))
+
+				// Add two spaces for leading whitespace and closing bracket
+				// on pure end, or both brackets if this is start and end
+				if (isEnd)
 					end -= 2;
 			}
 
 			// Don't shoot over the target!
-			if (end >= wLen)
-				end = wLen - 1;
+			if (end > wLen) {
+				end = wLen;
+				isEnd = true;
+			} else
+				isEnd = (end == wLen);
 
 			// Step 2: Find last space character before end+1
-			if ((end > start) && (end < (wLen - 1)) && (' ' != pch[end])) {
+			if ((end > start) && !isEnd && (' ' != pch[end])) {
 				size_t newEnd = end;
 				for (; (newEnd > start) && (' ' != pch[newEnd]) ; --newEnd) ;
 				if (newEnd > start)
@@ -602,13 +611,13 @@ static void calculateDescWrap(sDesc* desc)
 
 			// Step 3: Note values and increase start
 			curr->pos = start + oLen;
-			curr->len = end - start + (end == (wLen - 1) ? 1 : 0);
+			curr->len = end - start + (isEnd ? 1 : 0);
 			start += curr->len;
 			left  -= curr->len;
 			++desc->wrapCount;
 
 			// skip white space
-			while (left && (start < wLen) && (' ' == pch[start])) {
+			while (left && (start <= wLen) && (' ' == pch[start])) {
 				++start;
 				--left;
 			}
@@ -617,28 +626,25 @@ static void calculateDescWrap(sDesc* desc)
 			// Note: in drawflag() the string is pre- and postfixed with '(' / ')'
 			if (pch == pPkg) {
 				// And one to start
-				if (oLen == curr->pos)
-					++curr->len;
+				if (isStart)	++curr->len;
 				// Add one to the end
-				if (end >= (wLen - 1))
-					++curr->len;
+				if (isEnd)		++curr->len;
 				// If this is not the first line, add one to pos:
-				if (curr->pos && (oLen != curr->pos))
-					++curr->pos;
+				if (!isStart)	++curr->pos;
 			}
 
 
 			// Step 4: Switch if the current string is exhausted:
-			if (left && (!wLen || (end >= (wLen - 1)) || (start >= wLen) ) ) {
+			if (left && (isEnd || (start > wLen) ) ) {
 				if (eOrder_left == desc->wrapOrder) {
 					// Switch from pkg to desc
 					pch  = pDesc;
-					wLen = dLen;
+					wLen = dLen - 1;
 					oLen = pLen + 3; // +2 for the brackets, + 1 for leading space
 				} else {
 					// Switch from desc to pkg
 					pch  = pPkg;
-					wLen = pLen;
+					wLen = pLen - 1;
 					oLen = dLen + 1; // +1 for leading space
 				}
 				start = 0;


^ permalink raw reply related	[flat|nested] 238+ messages in thread
* [gentoo-commits] proj/ufed:master commit in: /
@ 2013-09-20  8:30 Sven Eden
  0 siblings, 0 replies; 238+ messages in thread
From: Sven Eden @ 2013-09-20  8:30 UTC (permalink / raw
  To: gentoo-commits

commit:     c69b9f7f923729e1663d75d9ab3378c4ec67e5ad
Author:     Sven Eden <yamakuzure <AT> gmx <DOT> net>
AuthorDate: Thu Sep 19 17:36:16 2013 +0000
Commit:     Sven Eden <sven.eden <AT> gmx <DOT> de>
CommitDate: Thu Sep 19 17:36:16 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/ufed.git;a=commit;h=c69b9f7f

calculateDescWrap(): Take later pre-/postfixing of brackets of the package list into account when setting the next wrap part.

---
 ufed-curses-types.c | 22 ++++++++++++++++++++--
 1 file changed, 20 insertions(+), 2 deletions(-)

diff --git a/ufed-curses-types.c b/ufed-curses-types.c
index fad7b2d..1a30392 100644
--- a/ufed-curses-types.c
+++ b/ufed-curses-types.c
@@ -570,7 +570,25 @@ static void calculateDescWrap(sDesc* desc)
 		while (left) {
 
 			// Step 1: Set current wrap part end
-			end = start + width + (curr == desc->wrap ? 2 : 0);
+			end = start + width;
+
+			// First line has two more spaces:
+			if (curr == desc->wrap)
+				end += 2;
+
+			// Package lists have one space less in their first line,
+			// because an opening bracket is prefixed by drawflag(),
+			// and two spaces less in their last line, because another
+			// bracked is postfixed and the leading whitespace is
+			// skipped below.
+			if (pch == pPkg) {
+				if (!start || (start == oLen))
+					--end;
+				else if (end >= (wLen - 1))
+					end -= 2;
+			}
+
+			// Don't shoot over the target!
 			if (end >= wLen)
 				end = wLen - 1;
 
@@ -584,7 +602,7 @@ static void calculateDescWrap(sDesc* desc)
 
 			// Step 3: Note values and increase start
 			curr->pos = start + oLen;
-			curr->len = end - start + (' ' == pch[end] ? 0 : 1);
+			curr->len = end - start + (end == (wLen - 1) ? 1 : 0);
 			start += curr->len;
 			left  -= curr->len;
 			++desc->wrapCount;


^ permalink raw reply related	[flat|nested] 238+ messages in thread
* [gentoo-commits] proj/ufed:master commit in: /
@ 2013-09-20  8:30 Sven Eden
  0 siblings, 0 replies; 238+ messages in thread
From: Sven Eden @ 2013-09-20  8:30 UTC (permalink / raw
  To: gentoo-commits

commit:     db3f54591bfa6b42a9977a0a7469b3eb7d7d49ba
Author:     Sven Eden <yamakuzure <AT> gmx <DOT> net>
AuthorDate: Thu Sep 19 16:10:15 2013 +0000
Commit:     Sven Eden <sven.eden <AT> gmx <DOT> de>
CommitDate: Thu Sep 19 16:10:15 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/ufed.git;a=commit;h=db3f5459

Really add wrapped/long description state to the status line. The space calculation wasn't updated, yet.

---
 ufed-curses.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/ufed-curses.c b/ufed-curses.c
index f6b2531..65902fc 100644
--- a/ufed-curses.c
+++ b/ufed-curses.c
@@ -338,7 +338,7 @@ void drawStatus(bool withSep)
 		 * + 4 pipes    = 26
 		*/
 		sprintf(buf, "%*s%-4s|%-4s|%-4s|%-4s|%-4s|%-4s] ",
-			max(2, iWidth - 33 - minwidth), " [",
+			max(2, iWidth - 38 - minwidth), " [",
 			eScope_global         == e_scope ? "glob"
 			: eScope_local        == e_scope ? "loca" : "all",
 			eState_installed      == e_state ? "inst"


^ permalink raw reply related	[flat|nested] 238+ messages in thread
* [gentoo-commits] proj/ufed:master commit in: /
@ 2013-09-20  8:30 Sven Eden
  0 siblings, 0 replies; 238+ messages in thread
From: Sven Eden @ 2013-09-20  8:30 UTC (permalink / raw
  To: gentoo-commits

commit:     fa689377c760bebb6e902fc6ee8ab8f1ae6ebf55
Author:     Sven Eden <yamakuzure <AT> gmx <DOT> net>
AuthorDate: Fri Sep 20 07:28:27 2013 +0000
Commit:     Sven Eden <sven.eden <AT> gmx <DOT> de>
CommitDate: Fri Sep 20 07:28:27 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/ufed.git;a=commit;h=fa689377

Added (far away future) idea about full metadata.xml parsing to TODO list.

---
 TODO | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/TODO b/TODO
index 0d4c08a..ede1693 100644
--- a/TODO
+++ b/TODO
@@ -12,6 +12,11 @@ These are planned:
 - Add package filter per command line argument
 - Handle USE_EXPAND and USE_EXPAND_HIDDEN flags
 
+These ideas for the (far far away) future
+- Add an optional sqlite3 backend. This could then be used to have ufed parse
+  the tree (metadata.xml!) and store the findings in a database file. Parsing
+  the tree like that is too much for each startup. Therefore such a db caching
+  would enable ufed to be no longer restricted to the profiles and /var/db/pkg.
 
 ------------
 --- DONE ---


^ permalink raw reply related	[flat|nested] 238+ messages in thread
* [gentoo-commits] proj/ufed:master commit in: /
@ 2013-09-20  8:30 Sven Eden
  0 siblings, 0 replies; 238+ messages in thread
From: Sven Eden @ 2013-09-20  8:30 UTC (permalink / raw
  To: gentoo-commits

commit:     544ec331b96afbad00ce8435fc94f958a857e827
Author:     Sven Eden <yamakuzure <AT> gmx <DOT> net>
AuthorDate: Fri Sep 20 07:25:12 2013 +0000
Commit:     Sven Eden <sven.eden <AT> gmx <DOT> de>
CommitDate: Fri Sep 20 07:25:12 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/ufed.git;a=commit;h=544ec331

Removed TODO file from .gitignore, I think it is better to offer an easy possibility for curious users to see what is planned, done and in progress.

---
 .gitignore |  1 -
 TODO       | 48 ++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 48 insertions(+), 1 deletion(-)

diff --git a/.gitignore b/.gitignore
index 758f804..789d647 100644
--- a/.gitignore
+++ b/.gitignore
@@ -6,7 +6,6 @@ Makefile
 Makefile.in
 run
 .??*
-TODO
 *~
 *.bak
 *.old

diff --git a/TODO b/TODO
new file mode 100644
index 0000000..0d4c08a
--- /dev/null
+++ b/TODO
@@ -0,0 +1,48 @@
+Personal todo list:
+===================
+
+New items are added under "TODO", everything that is finished is moved under
+"DONE", with the planned release version in brackets.
+When a feature is officially released (no rc-ebuild!), it is removed.
+
+------------
+--- TODO ---
+------------
+These are planned:
+- Add package filter per command line argument
+- Handle USE_EXPAND and USE_EXPAND_HIDDEN flags
+
+
+------------
+--- DONE ---
+------------
+These have been finished
+- (0.90) Add Filter local/global.
+- (0.90) Add Filter installed/all.
+- (0.90) Add parsing of /etc/make.profile/package.use for command line
+         packages.
+- (0.90) Comment code.
+- (0.90) Add profile /etc/portage/profile as last profile if not there.
+         (User overrides)
+- (0.90) Parse profiles: use.force and package.use.force.
+    These are added as masked but enabled flags.
+    Prefix '-' reverts the masking and the forced enabling
+- (0.90) Parse profiles: use.mask and package.use.mask.
+    These are added as masked but disabled flags.
+    Prefix '-' reverts the masking
+- (0.90) Remove obsolete file references.
+- (0.90) Update documentation.
+- (0.90) Do not break if FEATURES contain invalid values:
+    Couldn't read FEATURES variable contains unknown value(s): inv
+    /var/db/pkg
+    Compilation failed in require at /usr/sbin/ufed line 9.
+    BEGIN failed--compilation aborted at /usr/sbin/ufed line 9.
+- (0.90) Filter masked flags reliably.
+- (0.90) Add an option to re-show masked USE flags, but in parantheses.
+- (0.90) Add toggling package list display.
+- (0.90) Handle setups where /etc/portage/make.conf is a directory.
+- (0.90) Read PORTDIR and PORTDIR_OVERLAY from portageq, too.
+- (0.90) Make searching and cursor placement reliable.
+- (0.91) Add line wrapping.
+- (0.91) Make key help buttons dynamic (text, placement and width).
+- (0.91) Replace status indicator with dynamic status line.


^ permalink raw reply related	[flat|nested] 238+ messages in thread
* [gentoo-commits] proj/ufed:master commit in: /
@ 2013-09-20  8:30 Sven Eden
  0 siblings, 0 replies; 238+ messages in thread
From: Sven Eden @ 2013-09-20  8:30 UTC (permalink / raw
  To: gentoo-commits

commit:     6c224bde4f19f22c5db934a62282315131ac8ce1
Author:     Sven Eden <yamakuzure <AT> gmx <DOT> net>
AuthorDate: Thu Sep 19 15:56:27 2013 +0000
Commit:     Sven Eden <sven.eden <AT> gmx <DOT> de>
CommitDate: Thu Sep 19 15:56:27 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/ufed.git;a=commit;h=6c224bde

drawflag(): Advancing the wrapped description part is put to the end of the loop, it is much safer there.

---
 ufed-curses-checklist.c | 22 ++++++++++++++--------
 1 file changed, 14 insertions(+), 8 deletions(-)

diff --git a/ufed-curses-checklist.c b/ufed-curses-checklist.c
index b77a6f7..d457c1c 100644
--- a/ufed-curses-checklist.c
+++ b/ufed-curses-checklist.c
@@ -286,7 +286,7 @@ static int drawflag(sFlag* flag, bool highlight)
 			setFlagWrapDraw(flag, idx, &wrapPart, &pos, &length);
 
 		// The right side of buf can be added now:
-		leftover = rightwidth - (int)length - (newDesc ? 0 : 2) - 1;
+		leftover = rightwidth - (int)length - (newDesc ? 0 : 2);
 		pBuf     = &buf[minwidth + (newDesc ? 8 : 10)];
 		sprintf(pBuf, "%-*.*s",
 			(int)length, (int)length,
@@ -295,7 +295,7 @@ static int drawflag(sFlag* flag, bool highlight)
 
 		// Leftover characters on the right must be blanked:
 		if (leftover > 0)
-			sprintf(pBuf + length, "%-*sX", leftover, " ");
+			sprintf(pBuf + length, "%-*s", leftover, " ");
 
 		/* Set correct color set according to highlighting and status*/
 		if(highlight)
@@ -353,11 +353,19 @@ static int drawflag(sFlag* flag, bool highlight)
 		// Advance counters and possibly description index
 		++line;
 		++usedY;
-		if (NULL == wrapPart) {
+
+		// When wrapping the wrapPart must be advanced and checked
+		if (eWrap_wrap == e_wrap) {
+			wrapPart = wrapPart ? wrapPart->next : NULL;
+			if (wrapPart)
+				newDesc = false;
+			else
+				newDesc = true;
+		}
+
+		if (newDesc)
 			++idx;
-			newDesc = true;
-		} else
-			newDesc = false;
+
 	} // end of looping flag descriptions
 
 	if(highlight)
@@ -766,8 +774,6 @@ static void setFlagWrapDraw(sFlag* flag, int index, sWrap** wrap, size_t* pos, s
 
 	if (NULL == wrapPart)
 		wrapPart = flag->desc[index].wrap;
-	else
-		wrapPart = wrapPart->next;
 
 	// The length and position can be written back already
 	if (wrapPart) {


^ permalink raw reply related	[flat|nested] 238+ messages in thread
* [gentoo-commits] proj/ufed:master commit in: /
@ 2013-09-20  8:30 Sven Eden
  0 siblings, 0 replies; 238+ messages in thread
From: Sven Eden @ 2013-09-20  8:30 UTC (permalink / raw
  To: gentoo-commits

commit:     dd63f08b4cbc0f46e2a8b78e30d631b1032f0361
Author:     Sven Eden <yamakuzure <AT> gmx <DOT> net>
AuthorDate: Thu Sep 19 15:47:28 2013 +0000
Commit:     Sven Eden <sven.eden <AT> gmx <DOT> de>
CommitDate: Thu Sep 19 15:47:28 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/ufed.git;a=commit;h=dd63f08b

calculateDescWrap() Fix offset of second part, this must be aware of the leading space and the surrounding brackets around the package list, too.

---
 ufed-curses-checklist.c | 4 ++--
 ufed-curses-types.c     | 8 ++++----
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/ufed-curses-checklist.c b/ufed-curses-checklist.c
index 9dff8e2..b77a6f7 100644
--- a/ufed-curses-checklist.c
+++ b/ufed-curses-checklist.c
@@ -286,7 +286,7 @@ static int drawflag(sFlag* flag, bool highlight)
 			setFlagWrapDraw(flag, idx, &wrapPart, &pos, &length);
 
 		// The right side of buf can be added now:
-		leftover = rightwidth - (int)length;
+		leftover = rightwidth - (int)length - (newDesc ? 0 : 2) - 1;
 		pBuf     = &buf[minwidth + (newDesc ? 8 : 10)];
 		sprintf(pBuf, "%-*.*s",
 			(int)length, (int)length,
@@ -295,7 +295,7 @@ static int drawflag(sFlag* flag, bool highlight)
 
 		// Leftover characters on the right must be blanked:
 		if (leftover > 0)
-			sprintf(pBuf + length, "%-*.*s", leftover, leftover, " ");
+			sprintf(pBuf + length, "%-*sX", leftover, " ");
 
 		/* Set correct color set according to highlighting and status*/
 		if(highlight)

diff --git a/ufed-curses-types.c b/ufed-curses-types.c
index 14c9313..71d751a 100644
--- a/ufed-curses-types.c
+++ b/ufed-curses-types.c
@@ -304,7 +304,7 @@ int getFlagHeight (const sFlag* flag)
 	int result = 0;
 
 	if (flag) {
-		size_t maxLen = wWidth(List) - (minwidth + 8);;
+		size_t maxLen = wWidth(List) - (minwidth + 8);
 		for (int i = 0; i < flag->ndesc; ++i) {
 			if (isDescLegal(flag, i)) {
 				if (eWrap_normal == e_wrap)
@@ -575,7 +575,7 @@ static void calculateDescWrap(sDesc* desc)
 				end = wLen - 1;
 
 			// Step 2: Find last space character before end+1
-			if ((end > start) && (' ' != pch[end])) {
+			if ((end > start) && (end < (wLen - 1)) && (' ' != pch[end])) {
 				size_t newEnd = end;
 				for (; (newEnd > start) && (' ' != pch[newEnd]) ; --newEnd) ;
 				if (newEnd > start)
@@ -611,12 +611,12 @@ static void calculateDescWrap(sDesc* desc)
 					// Switch from pkg to desc
 					pch  = pDesc;
 					wLen = dLen;
-					oLen = pLen + 2;
+					oLen = pLen + 3; // +2 for the brackets, + 1 for leading space
 				} else {
 					// Switch from desc to pkg
 					pch  = pPkg;
 					wLen = pLen;
-					oLen = dLen + 2;
+					oLen = dLen + 1; // +1 for leading space
 				}
 				start = 0;
 			} // End of having to swap pkg/desc


^ permalink raw reply related	[flat|nested] 238+ messages in thread
* [gentoo-commits] proj/ufed:master commit in: /
@ 2013-09-20  8:30 Sven Eden
  0 siblings, 0 replies; 238+ messages in thread
From: Sven Eden @ 2013-09-20  8:30 UTC (permalink / raw
  To: gentoo-commits

commit:     e7f3fbaf986480b070001b07a3897f2d14cfd4d7
Author:     Sven Eden <yamakuzure <AT> gmx <DOT> net>
AuthorDate: Thu Sep 19 16:08:30 2013 +0000
Commit:     Sven Eden <sven.eden <AT> gmx <DOT> de>
CommitDate: Thu Sep 19 16:08:30 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/ufed.git;a=commit;h=e7f3fbaf

calculateDescWrap(): Position and length correction now work with reversed pkg/desc order, too.

---
 ufed-curses-types.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/ufed-curses-types.c b/ufed-curses-types.c
index 71d751a..fad7b2d 100644
--- a/ufed-curses-types.c
+++ b/ufed-curses-types.c
@@ -595,13 +595,18 @@ static void calculateDescWrap(sDesc* desc)
 				--left;
 			}
 
-			// Correct length if this is the package list
+			// Correct pos and length if this is the package list
 			// Note: in drawflag() the string is pre- and postfixed with '(' / ')'
 			if (pch == pPkg) {
-				if (!curr->pos)
+				// And one to start
+				if (oLen == curr->pos)
 					++curr->len;
+				// Add one to the end
 				if (end >= (wLen - 1))
 					++curr->len;
+				// If this is not the first line, add one to pos:
+				if (curr->pos && (oLen != curr->pos))
+					++curr->pos;
 			}
 
 


^ permalink raw reply related	[flat|nested] 238+ messages in thread
* [gentoo-commits] proj/ufed:master commit in: /
@ 2013-09-20  8:30 Sven Eden
  0 siblings, 0 replies; 238+ messages in thread
From: Sven Eden @ 2013-09-20  8:30 UTC (permalink / raw
  To: gentoo-commits

commit:     be5a88cd3986f81fe3be6fd3381ab7e0449cff7b
Author:     Sven Eden <yamakuzure <AT> gmx <DOT> net>
AuthorDate: Thu Sep 19 13:42:49 2013 +0000
Commit:     Sven Eden <sven.eden <AT> gmx <DOT> de>
CommitDate: Thu Sep 19 13:42:49 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/ufed.git;a=commit;h=be5a88cd

drawing a flag witrh wrapped descriptions does no longer add an offset for the second part. The calculation does this now, which simplifies things alot.

---
 ufed-curses-checklist.c | 57 +++++++++++++++++--------------------------------
 ufed-curses-types.c     |  8 ++++---
 2 files changed, 24 insertions(+), 41 deletions(-)

diff --git a/ufed-curses-checklist.c b/ufed-curses-checklist.c
index e5506c4..b82e9f0 100644
--- a/ufed-curses-checklist.c
+++ b/ufed-curses-checklist.c
@@ -19,11 +19,11 @@ static char*   lineBuf         = NULL;
 static sFlag*  flags           = NULL;
 
 /* internal prototypes */
-static int  findFlagStart(sFlag* flag, int* index, sWrap** wrap, int* line, bool* isFirstWrap);
+static int  findFlagStart(sFlag* flag, int* index, sWrap** wrap, int* line);
 static void free_flags(void);
 static char getFlagSpecialChar(sFlag* flag, int index);
 static void printFlagInfo(char* buf, sFlag* flag, int index, bool printFlagName, bool printFlagState);
-static void setFlagWrapDraw(sFlag* flag, int index, sWrap** wrap, size_t* pos, size_t* len, bool* isFirstWrap);
+static void setFlagWrapDraw(sFlag* flag, int index, sWrap** wrap, size_t* pos, size_t* len);
 
 
 /* static functions */
@@ -197,10 +197,9 @@ static int drawflag(sFlag* flag, bool highlight)
 	int    line      = flag->currline;
 	int    usedY     = 0;    // Counts how many lines this flag really needs to display
 	sWrap* wrapPart  = NULL; // Wrap part to begin with/draw
-	bool   wrapFirst = true; // The first part, pkg or desc
 
 	// Get the starting description/wrapped line of the flag
-	usedY = findFlagStart(flag, &idx, &wrapPart, &line, &wrapFirst);
+	usedY = findFlagStart(flag, &idx, &wrapPart, &line);
 
 	// findFlagStart returns -1 if the flag is out of the screen
 	if (0 > usedY)
@@ -289,12 +288,8 @@ static int drawflag(sFlag* flag, bool highlight)
 
 		// For normal descriptions, pos and length are already set, but
 		// not so for wrapped lines, these must be set for each line:
-		if (eWrap_wrap == e_wrap) {
-			setFlagWrapDraw(flag, idx, &wrapPart, &pos, &length, &wrapFirst);
-			wrapPart = wrapPart->next;
-			if (newDesc && wrapPart)
-				newDesc = false;
-		}
+		if (eWrap_wrap == e_wrap)
+			setFlagWrapDraw(flag, idx, &wrapPart, &pos, &length);
 
 		// The right side of buf can be added now:
 		leftover = rightwidth - (int)length;
@@ -367,7 +362,8 @@ static int drawflag(sFlag* flag, bool highlight)
 		if (NULL == wrapPart) {
 			++idx;
 			newDesc = true;
-		}
+		} else
+			newDesc = false;
 	} // end of looping flag descriptions
 
 	if(highlight)
@@ -644,7 +640,7 @@ static int callback(sFlag** curr, int key)
   * until wrapPart is either NULL, or a part on the screen is
   * reached.
 **/
-static int findFlagStart(sFlag* flag, int* index, sWrap** wrap, int* line, bool* isFirstWrap)
+static int findFlagStart(sFlag* flag, int* index, sWrap** wrap, int* line)
 {
 	int    usedLines  = 0;
 	int    flagHeight = getFlagHeight(flag); // Will recalculate wrap parts if needed
@@ -676,17 +672,12 @@ static int findFlagStart(sFlag* flag, int* index, sWrap** wrap, int* line, bool*
 					 */
 					int wrapCount = flag->desc[*index].wrapCount;
 					wrapPart      = flag->desc[*index].wrap;
-					*isFirstWrap  = true;
 					if (wrapPart && wrapCount && (-(*line) < wrapCount)) {
 						// Situation b) This description enters screen
 						while (wrapPart && (*line < 0)) {
 							++(*line);
 							++usedLines;
 							wrapPart = wrapPart->next;
-							if (wrapPart && !wrapPart->pos)
-								*isFirstWrap = false;
-							// Note: The wrap parts are already calculated
-							//       to resemble the current order.
 						}
 					} else {
 						// Situation a) Fast forward
@@ -775,32 +766,22 @@ static void printFlagInfo(char* buf, sFlag* flag, int index, bool printFlagName,
 	}
 }
 
-static void setFlagWrapDraw(sFlag* flag, int index, sWrap** wrap, size_t* pos, size_t* len, bool* isFirstWrap)
+static void setFlagWrapDraw(sFlag* flag, int index, sWrap** wrap, size_t* pos, size_t* len)
 {
 	sWrap* wrapPart = *wrap;
 
-	if (NULL == wrapPart) {
-		wrapPart     = flag->desc[index].wrap;
-		*isFirstWrap = true;
-	} else if (*isFirstWrap
-			&& (flag->desc[index].wrap != wrapPart)
-			&& !wrapPart->pos)
-		*isFirstWrap = false;
+	if (NULL == wrapPart)
+		wrapPart = flag->desc[index].wrap;
+	else
+		wrapPart = wrapPart->next;
 
 	// The length and position can be written back already
-	*pos = wrapPart->pos;
-	*len = wrapPart->len;
-
-	// If this is the second part, the length of the first
-	// must be added to the position, or drawflag() will
-	// start all over again.
-	if (false == *isFirstWrap) {
-		if (eOrder_left == e_order)
-			*pos += sizeof(flag->desc[index].pkg);
-		else
-			*pos += eDesc_ori == e_desc
-				  ? sizeof(flag->desc[index].desc)
-				  : sizeof(flag->desc[index].desc_alt);
+	if (wrapPart) {
+		*pos = wrapPart->pos;
+		*len = wrapPart->len;
+	} else {
+		*pos = 0;
+		*len = 0;
 	}
 
 	// Write back wrap part pointer

diff --git a/ufed-curses-types.c b/ufed-curses-types.c
index e6b1139..4a5445f 100644
--- a/ufed-curses-types.c
+++ b/ufed-curses-types.c
@@ -533,6 +533,8 @@ static void calculateDescWrap(sDesc* desc)
 		size_t pLen  = pPkg ? strlen(pPkg) : 0;
 		size_t left  = dLen + pLen;
 		size_t wLen  = eOrder_left == desc->wrapOrder ? pLen : dLen;
+		size_t oLen  = 0; // Set to the first part to be added to pos on the second
+		// part, so drawflag knows from where to start taking in the unified desc.
 
 		/* A valid curr is needed first */
 		if (NULL == curr) {
@@ -581,7 +583,7 @@ static void calculateDescWrap(sDesc* desc)
 			}
 
 			// Step 3: Note values and increase start
-			curr->pos = start;
+			curr->pos = start + oLen;
 			curr->len = end - start + (' ' == pch[end] ? 0 : 1);
 			start += curr->len;
 			left  -= curr->len;
@@ -600,12 +602,12 @@ static void calculateDescWrap(sDesc* desc)
 					// Switch from pkg to desc
 					pch  = pDesc;
 					wLen = dLen;
-					left = dLen;
+					oLen = pLen + 2;
 				} else {
 					// Switch from desc to pkg
 					pch  = pPkg;
 					wLen = pLen;
-					left = pLen;
+					oLen = dLen + 2;
 				}
 				start = 0;
 			} // End of having to swap pkg/desc


^ permalink raw reply related	[flat|nested] 238+ messages in thread
* [gentoo-commits] proj/ufed:master commit in: /
@ 2013-09-20  8:30 Sven Eden
  0 siblings, 0 replies; 238+ messages in thread
From: Sven Eden @ 2013-09-20  8:30 UTC (permalink / raw
  To: gentoo-commits

commit:     af1f923685f26a000dc191a3db9c6ec85ff8557c
Author:     Sven Eden <yamakuzure <AT> gmx <DOT> net>
AuthorDate: Thu Sep 19 15:31:43 2013 +0000
Commit:     Sven Eden <sven.eden <AT> gmx <DOT> de>
CommitDate: Thu Sep 19 15:31:43 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/ufed.git;a=commit;h=af1f9236

calculateDescWrap() is no aware of the brackets that are drawn around the package lists

---
 ufed-curses-checklist.c | 18 ++++++------------
 ufed-curses-types.c     |  9 +++++++++
 2 files changed, 15 insertions(+), 12 deletions(-)

diff --git a/ufed-curses-checklist.c b/ufed-curses-checklist.c
index b82e9f0..9dff8e2 100644
--- a/ufed-curses-checklist.c
+++ b/ufed-curses-checklist.c
@@ -220,8 +220,6 @@ static int drawflag(sFlag* flag, bool highlight)
 	desc[maxDescWidth] = 0x0;
 
 	// Description and wrapped lines state values
-	bool   hasBlankLeft  = false;                 // Set to true once the left side is blanked
-	bool   hasBlankRight = false;                 // Set to true once the right (state) side is blanked
 	bool   hasHead       = false;                 // Set to true once the left side (flag name and states) are printed
 	int    rightwidth    = lWidth - minwidth - 8; // Space on the right to print descriptions
 	size_t length        = rightwidth;            // Characters to print when not wrapping
@@ -246,17 +244,16 @@ static int drawflag(sFlag* flag, bool highlight)
 			continue;
 		}
 
-		// If the flag name and state are drawn, following lines
-		// need to start with spaces
-		if (hasHead && !hasBlankLeft) {
-			memset(buf, ' ', minwidth);
-			hasBlankLeft = true;
-		}
+		// Always start with a blanked buffer
+		memset(buf,  ' ', sizeof(char) * lWidth);
 
 		// Prepare new description or blank on wrapped parts
 		if (newDesc) {
 			special = getFlagSpecialChar(flag, idx);
 
+			// Always start with a blank description buffer
+			memset(desc, ' ', sizeof(char) * maxDescWidth);
+
 			// Wrapped and not wrapped lines are unified here
 			// to simplify the usage of different ordering and
 			// stripped descriptions versus original descriptions
@@ -272,9 +269,6 @@ static int drawflag(sFlag* flag, bool highlight)
 							  flag->desc[idx].pkg);
 			} else
 				sprintf(desc, "%s", flag->desc[idx].desc);
-		} else if (!hasBlankRight) {
-			memset(buf + minwidth, ' ', 10);
-			hasBlankRight = true;
 		}
 
 		/* --- Preparations done --- */
@@ -293,7 +287,7 @@ static int drawflag(sFlag* flag, bool highlight)
 
 		// The right side of buf can be added now:
 		leftover = rightwidth - (int)length;
-		pBuf     = buf + minwidth + (newDesc ? 8 : 10);
+		pBuf     = &buf[minwidth + (newDesc ? 8 : 10)];
 		sprintf(pBuf, "%-*.*s",
 			(int)length, (int)length,
 			strlen(desc) > pos ? &desc[pos] : " ");

diff --git a/ufed-curses-types.c b/ufed-curses-types.c
index 4a5445f..14c9313 100644
--- a/ufed-curses-types.c
+++ b/ufed-curses-types.c
@@ -595,6 +595,15 @@ static void calculateDescWrap(sDesc* desc)
 				--left;
 			}
 
+			// Correct length if this is the package list
+			// Note: in drawflag() the string is pre- and postfixed with '(' / ')'
+			if (pch == pPkg) {
+				if (!curr->pos)
+					++curr->len;
+				if (end >= (wLen - 1))
+					++curr->len;
+			}
+
 
 			// Step 4: Switch if the current string is exhausted:
 			if (left && (!wLen || (end >= (wLen - 1)) || (start >= wLen) ) ) {


^ permalink raw reply related	[flat|nested] 238+ messages in thread
* [gentoo-commits] proj/ufed:master commit in: /
@ 2013-09-20  8:30 Sven Eden
  0 siblings, 0 replies; 238+ messages in thread
From: Sven Eden @ 2013-09-20  8:30 UTC (permalink / raw
  To: gentoo-commits

commit:     5780308f888c5a821c0d328bb1f94f5a96a3fac0
Author:     Sven Eden <yamakuzure <AT> gmx <DOT> net>
AuthorDate: Thu Sep 19 08:16:06 2013 +0000
Commit:     Sven Eden <sven.eden <AT> gmx <DOT> de>
CommitDate: Thu Sep 19 08:16:19 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/ufed.git;a=commit;h=5780308f

New descriptions now start unindented when description wrapping is turned on.

---
 ufed-curses-checklist.c | 23 ++++++++++++++++-------
 1 file changed, 16 insertions(+), 7 deletions(-)

diff --git a/ufed-curses-checklist.c b/ufed-curses-checklist.c
index c1c39e6..48e6606 100644
--- a/ufed-curses-checklist.c
+++ b/ufed-curses-checklist.c
@@ -212,9 +212,9 @@ static int drawflag(sFlag* flag, bool highlight)
 	int     lWidth  = wWidth(List);
 
 	// Set up needed buffers
-	char   buf[lWidth + 1];       // Buffer for the line to print
-	char   desc[maxDescWidth];    // Buffer to assemble the description accoring to e_order and e_desc
-	char   special;               // force/mask/none character
+	char   buf[lWidth + 1];    // Buffer for the line to print
+	char   desc[maxDescWidth]; // Buffer to assemble the description accoring to e_order and e_desc
+	char   special, *pBuf;     // force/mask/none character, Helper to fill buf
 	memset(buf,  0, sizeof(char) * (lWidth + 1));
 	memset(desc, 0, sizeof(char) * maxDescWidth);
 
@@ -222,16 +222,17 @@ static int drawflag(sFlag* flag, bool highlight)
 	bool   hasBlankLeft  = false;                 // Set to true once the left side is blanked
 	bool   hasBlankRight = false;                 // Set to true once the right (state) side is blanked
 	bool   hasHead       = false;                 // Set to true once the left side (flag name and states) are printed
-	size_t length        = lWidth - minwidth - 8; // Characters to print
+	int    maxDescWidth  = lWidth - minwidth - 8; // Space on the right to print descriptions
+	size_t length        = maxDescWidth;          // Characters to print when not wrapping
 	bool   newDesc       = true;                  // Set to fals when wrapped parts advance
 	size_t pos           = descriptionleft;       // position in desc to start printing on
+	int    leftover      = 0;                     // When wrapping lines, this is left on the right
 
 	// Safety check: Put in blank line if idx ended up too large
 	if (idx >= flag->ndesc) {
 		// This can happen when filters reduce the list too much
 		// so blank lines must be displayed
 		memset(buf, ' ', lWidth - 1);
-		buf[lWidth] = '\0';
 		waddstr(wLst, buf);
 	}
 
@@ -294,11 +295,17 @@ static int drawflag(sFlag* flag, bool highlight)
 		}
 
 		// The right side of buf can be added now:
-		sprintf(buf + minwidth + (newDesc ? 8 : 10), "%-*.*s",
+		leftover = maxDescWidth - (int)length;
+		pBuf     = buf + minwidth + (newDesc ? 8 : 10);
+		sprintf(pBuf, "%-*.*s",
 			(int)length, (int)length,
 			strlen(desc) > pos ? &desc[pos] : "");
 		// Note: Follow up lines of wrapped descriptions are indented by 2
 
+		// Leftover characters on the right must be blanked:
+		if (leftover > 0)
+			sprintf(pBuf + length, "%-*s", leftover, " ");
+
 		/* Set correct color set according to highlighting and status*/
 		if(highlight)
 			wattrset(wLst, COLOR_PAIR(3) | A_BOLD | A_REVERSE);
@@ -355,8 +362,10 @@ static int drawflag(sFlag* flag, bool highlight)
 		// Advance counters and possibly description index
 		++line;
 		++usedY;
-		if (NULL == wrapPart)
+		if (NULL == wrapPart) {
 			++idx;
+			newDesc = true;
+		}
 	} // end of looping flag descriptions
 
 	if(highlight)


^ permalink raw reply related	[flat|nested] 238+ messages in thread
* [gentoo-commits] proj/ufed:master commit in: /
@ 2013-09-20  8:30 Sven Eden
  0 siblings, 0 replies; 238+ messages in thread
From: Sven Eden @ 2013-09-20  8:30 UTC (permalink / raw
  To: gentoo-commits

commit:     b711b2f7379554621ad78990bc4f74ac8e034d5a
Author:     Sven Eden <yamakuzure <AT> gmx <DOT> net>
AuthorDate: Thu Sep 19 12:12:31 2013 +0000
Commit:     Sven Eden <sven.eden <AT> gmx <DOT> de>
CommitDate: Thu Sep 19 12:12:31 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/ufed.git;a=commit;h=b711b2f7

The length of the first part must always be added to the position in the second wrapped part.

---
 ufed-curses-checklist.c | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)

diff --git a/ufed-curses-checklist.c b/ufed-curses-checklist.c
index 48e6606..6a48ba7 100644
--- a/ufed-curses-checklist.c
+++ b/ufed-curses-checklist.c
@@ -781,16 +781,14 @@ static void setFlagWrapDraw(sFlag* flag, int index, sWrap** wrap, size_t* pos, s
 			&& !wrapPart->pos)
 		*isFirstWrap = false;
 
-	// Position and length can be written back already
+	// The length and position can be written back already
 	*pos = wrapPart->pos;
 	*len = wrapPart->len;
 
-	// If this was switched, add the first length
-	if ((false == *isFirstWrap) && (0 == *pos)) {
-		// Add the length of either the package list or the
-		// description (stripped or normal) or drawFlag will
-		// end up reprinting from the beginning due to the
-		// unified description string.
+	// If this is the second part, the length of the first
+	// must be added to the position, or drawflag() will
+	// start all over again.
+	if (false == *isFirstWrap) {
 		if (eOrder_left == e_order)
 			*pos += sizeof(flag->desc[index].pkg);
 		else


^ permalink raw reply related	[flat|nested] 238+ messages in thread
* [gentoo-commits] proj/ufed:master commit in: /
@ 2013-09-20  8:30 Sven Eden
  0 siblings, 0 replies; 238+ messages in thread
From: Sven Eden @ 2013-09-20  8:30 UTC (permalink / raw
  To: gentoo-commits

commit:     a42e79a4cab19cedb9995eda1e557ee491a74355
Author:     Sven Eden <yamakuzure <AT> gmx <DOT> net>
AuthorDate: Thu Sep 19 07:38:29 2013 +0000
Commit:     Sven Eden <sven.eden <AT> gmx <DOT> de>
CommitDate: Thu Sep 19 07:38:29 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/ufed.git;a=commit;h=a42e79a4

Fixed calculateDescWrap() to ensure clean wrapped parts chains.

---
 ufed-curses-types.c | 73 ++++++++++++++++++++++++++++++++++++++---------------
 1 file changed, 53 insertions(+), 20 deletions(-)

diff --git a/ufed-curses-types.c b/ufed-curses-types.c
index b61ec38..9d59234 100644
--- a/ufed-curses-types.c
+++ b/ufed-curses-types.c
@@ -528,13 +528,13 @@ static void calculateDescWrap(sDesc* desc)
 		char*  pch   = eOrder_left == desc->wrapOrder ? pPkg : pDesc;
 		size_t start = 0;
 		size_t end   = 0;
-		size_t width = desc->wrapWidth - 2; // Foloow-up lines are indented
-		size_t dLen  = strlen(pDesc);
-		size_t pLen  = strlen(pPkg);
+		size_t width = desc->wrapWidth - 2; // Follow-up lines are indented
+		size_t dLen  = pDesc ? strlen(pDesc) : 0;
+		size_t pLen  = pPkg ? strlen(pPkg) : 0;
 		size_t left  = dLen + pLen;
 		size_t wLen  = eOrder_left == desc->wrapOrder ? pLen : dLen;
 
-		/* To go by next a valid curr is needed first */
+		/* A valid curr is needed first */
 		if (NULL == curr) {
 			curr = (sWrap*)malloc(sizeof(sWrap));
 			if (curr) {
@@ -543,10 +543,28 @@ static void calculateDescWrap(sDesc* desc)
 				curr->pos  = 0;
 				desc->wrap = curr;
 			} else
-				ERROR_EXIT(-1, "Unable to allocate %lu bytes for sWrap_ struct\n", sizeof(sWrap))
+				ERROR_EXIT(-1,
+					"Unable to allocate %lu bytes for sWrap_ struct\n",
+					sizeof(sWrap))
 		}
 
-		/* Now distribute all characters */
+		// The description starts without a valid wrap now
+		desc->wrapCount = 0;
+
+		/* When starting there are two possible situations.
+		 * a) A global flag with order left, so desc->pkg and therefore
+		 *    pch also are NULL
+		 * b) any other combination.
+		 * Any other is just fine, but situation a must be caught and handled
+		 * before going any further.
+		 */
+		if (NULL == pch) {
+			pch  = pDesc;
+			wLen = dLen;
+			left = dLen;
+		}
+
+		// Now distribute all characters
 		while (left) {
 
 			// Step 1: Set current wrap part end
@@ -555,7 +573,7 @@ static void calculateDescWrap(sDesc* desc)
 				end = wLen - 1;
 
 			// Step 2: Find last space character before end+1
-			if (' ' != pch[end]) {
+			if ((end > start) && (end < (wLen - 1)) && (' ' != pch[end])) {
 				size_t newEnd = end;
 				for (; (newEnd > start) && (' ' != pch[newEnd]) ; --newEnd) ;
 				if (newEnd > start)
@@ -564,35 +582,49 @@ static void calculateDescWrap(sDesc* desc)
 
 			// Step 3: Note values and increase start
 			curr->pos = start;
-			curr->len = end - start;
+			curr->len = end - start + (' ' == pch[end] ? 0 : 1);
 			start += curr->len;
 			left  -= curr->len;
+			++desc->wrapCount;
+
+			// skip white space
+			while (left && (start < wLen) && (' ' == pch[start])) {
+				++start;
+				--left;
+			}
+
 
 			// Step 4: Switch if the current string is exhausted:
-			if (left && (end == (wLen - 1))) {
+			if (left && (!wLen || (end >= (wLen - 1)) || (start >= wLen) ) ) {
 				if (eOrder_left == desc->wrapOrder) {
 					// Switch from pkg to desc
 					pch  = pDesc;
 					wLen = dLen;
+					left = dLen;
 				} else {
 					// Switch from desc to pkg
 					pch  = pPkg;
 					wLen = pLen;
+					left = pLen;
 				}
 				start = 0;
 			} // End of having to swap pkg/desc
 
 			// Step 5: Extend if needed
-			next = curr->next;
-			if (left && !next) {
-				next = (sWrap*)malloc(sizeof(sWrap));
-				if (next) {
-					next->len  = 0;
-					next->next = NULL;
-					next->pos  = 0;
-					curr->next = next;
-				} else
-					ERROR_EXIT(-1, "Unable to allocate %lu bytes for sWrap_ struct\n", sizeof(sWrap))
+			if (curr->len) {
+				next = curr->next;
+				if (left && !next) {
+					next = (sWrap*)malloc(sizeof(sWrap));
+					if (next) {
+						next->len  = 0;
+						next->next = NULL;
+						next->pos  = 0;
+						curr->next = next;
+					} else
+						ERROR_EXIT(-1,
+							"Unable to allocate %lu bytes for sWrap_ struct\n",
+							sizeof(sWrap))
+				}
 			}
 
 			// Step 6: Clean up if done
@@ -603,7 +635,8 @@ static void calculateDescWrap(sDesc* desc)
 			}
 
 			// Step 7: Advance
-			curr = next;
+			if (curr->len)
+				curr = next;
 		} // End of having characters left to distribute
 	} // End of having a not NULL pointer
 }


^ permalink raw reply related	[flat|nested] 238+ messages in thread
* [gentoo-commits] proj/ufed:master commit in: /
@ 2013-09-20  8:30 Sven Eden
  0 siblings, 0 replies; 238+ messages in thread
From: Sven Eden @ 2013-09-20  8:30 UTC (permalink / raw
  To: gentoo-commits

commit:     4b9ab8907b572bed58978b92c142d20c230ed3e2
Author:     Sven Eden <yamakuzure <AT> gmx <DOT> net>
AuthorDate: Wed Sep 18 20:03:56 2013 +0000
Commit:     Sven Eden <sven.eden <AT> gmx <DOT> de>
CommitDate: Wed Sep 18 20:03:56 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/ufed.git;a=commit;h=4b9ab890

Enabled F11 key to toggle line wrapping and fixed a possible segfault.

---
 ufed-curses-checklist.c | 44 ++++++++++++++++++++++++++++++++------------
 1 file changed, 32 insertions(+), 12 deletions(-)

diff --git a/ufed-curses-checklist.c b/ufed-curses-checklist.c
index 8a3e9e1..c1c39e6 100644
--- a/ufed-curses-checklist.c
+++ b/ufed-curses-checklist.c
@@ -200,8 +200,10 @@ static int drawflag(sFlag* flag, bool highlight)
 	bool   wrapFirst = true; // The first part, pkg or desc
 
 	// Get the starting description/wrapped line of the flag
-	if ((line < 0)
-	  && (0 == (usedY = findFlagStart(flag, &idx, &wrapPart, &line, &wrapFirst))) )
+	usedY = findFlagStart(flag, &idx, &wrapPart, &line, &wrapFirst);
+
+	// findFlagStart returns -1 if the flag is out of the screen
+	if (0 > usedY)
 		return 0;
 
 	// Window values (aka shortcuts)
@@ -448,17 +450,21 @@ static int callback(sFlag** curr, int key)
 				drawFlags();
 			break;
 		case KEY_LEFT:
-			if(descriptionleft > 0)
-				descriptionleft -= min(descriptionleft, (wWidth(List) - minwidth) * 2 / 3);
-			drawflag(*curr, TRUE);
-			wmove(wLst, (*curr)->currline, 2);
-			wrefresh(wLst);
+			if (eWrap_normal == e_wrap) {
+				if(descriptionleft > 0)
+					descriptionleft -= min(descriptionleft, (wWidth(List) - minwidth) * 2 / 3);
+				drawflag(*curr, TRUE);
+				wmove(wLst, (*curr)->currline, 2);
+				wrefresh(wLst);
+			}
 			break;
 		case KEY_RIGHT:
-			descriptionleft += (wWidth(List) - minwidth) * 2 / 3;
-			drawflag(*curr, TRUE);
-			wmove(wLst, (*curr)->currline, 2);
-			wrefresh(wLst);
+			if (eWrap_normal == e_wrap) {
+				descriptionleft += (wWidth(List) - minwidth) * 2 / 3;
+				drawflag(*curr, TRUE);
+				wmove(wLst, (*curr)->currline, 2);
+				wrefresh(wLst);
+			}
 			break;
 
 		case KEY_F(5):
@@ -523,6 +529,15 @@ static int callback(sFlag** curr, int key)
 			draw(true);
 			break;
 
+		case KEY_F(11):
+			if (eWrap_normal == e_wrap) {
+				e_wrap = eWrap_wrap;
+				descriptionleft = 0;
+			} else
+				e_wrap = eWrap_normal;
+			draw(true);
+			break;
+
 #ifdef NCURSES_MOUSE_VERSION
 		case KEY_MOUSE:
 			// Masked flags can be turned off, nothing else
@@ -624,8 +639,13 @@ static int findFlagStart(sFlag* flag, int* index, sWrap** wrap, int* line, bool*
 	int    flagHeight = getFlagHeight(flag); // Will recalculate wrap parts if needed
 	sWrap* wrapPart = NULL;
 
-	if ( (*line < 0) && (-(*line) < flagHeight) ){
+	if (*line < 0) {
+
+		// Only do anything if the flag can reach the screen:
+		if (-(*line) >= flagHeight)
+			return -1;
 
+		// Now loop until the screen is entered (line == 0)
 		while (*line < 0) {
 			if (isDescLegal(flag, *index)) {
 				if (eWrap_normal == e_wrap) {


^ permalink raw reply related	[flat|nested] 238+ messages in thread
* [gentoo-commits] proj/ufed:master commit in: /
@ 2013-09-20  8:30 Sven Eden
  0 siblings, 0 replies; 238+ messages in thread
From: Sven Eden @ 2013-09-20  8:30 UTC (permalink / raw
  To: gentoo-commits

commit:     7f75f89ccdb4a80ed469db1a2fe81a12bad49450
Author:     Sven Eden <yamakuzure <AT> gmx <DOT> net>
AuthorDate: Thu Sep 19 12:36:39 2013 +0000
Commit:     Sven Eden <sven.eden <AT> gmx <DOT> de>
CommitDate: Thu Sep 19 12:36:39 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/ufed.git;a=commit;h=7f75f89c

Fixed stray 0-bytes that the wrapped description display accidently inserted.

---
 ufed-curses-checklist.c | 30 ++++++++++++++++++------------
 ufed-curses-types.c     |  2 +-
 2 files changed, 19 insertions(+), 13 deletions(-)

diff --git a/ufed-curses-checklist.c b/ufed-curses-checklist.c
index 6a48ba7..e5506c4 100644
--- a/ufed-curses-checklist.c
+++ b/ufed-curses-checklist.c
@@ -212,18 +212,20 @@ static int drawflag(sFlag* flag, bool highlight)
 	int     lWidth  = wWidth(List);
 
 	// Set up needed buffers
-	char   buf[lWidth + 1];    // Buffer for the line to print
-	char   desc[maxDescWidth]; // Buffer to assemble the description accoring to e_order and e_desc
-	char   special, *pBuf;     // force/mask/none character, Helper to fill buf
-	memset(buf,  0, sizeof(char) * (lWidth + 1));
-	memset(desc, 0, sizeof(char) * maxDescWidth);
+	char   buf[lWidth + 1];        // Buffer for the line to print
+	char   desc[maxDescWidth + 1]; // Buffer to assemble the description accoring to e_order and e_desc
+	char   special, *pBuf;         // force/mask/none character, Helper to fill buf
+	memset(buf,  ' ', sizeof(char) * lWidth);
+	memset(desc, ' ', sizeof(char) * maxDescWidth);
+	buf[lWidth]        = 0x0;
+	desc[maxDescWidth] = 0x0;
 
 	// Description and wrapped lines state values
 	bool   hasBlankLeft  = false;                 // Set to true once the left side is blanked
 	bool   hasBlankRight = false;                 // Set to true once the right (state) side is blanked
 	bool   hasHead       = false;                 // Set to true once the left side (flag name and states) are printed
-	int    maxDescWidth  = lWidth - minwidth - 8; // Space on the right to print descriptions
-	size_t length        = maxDescWidth;          // Characters to print when not wrapping
+	int    rightwidth    = lWidth - minwidth - 8; // Space on the right to print descriptions
+	size_t length        = rightwidth;            // Characters to print when not wrapping
 	bool   newDesc       = true;                  // Set to fals when wrapped parts advance
 	size_t pos           = descriptionleft;       // position in desc to start printing on
 	int    leftover      = 0;                     // When wrapping lines, this is left on the right
@@ -295,16 +297,16 @@ static int drawflag(sFlag* flag, bool highlight)
 		}
 
 		// The right side of buf can be added now:
-		leftover = maxDescWidth - (int)length;
+		leftover = rightwidth - (int)length;
 		pBuf     = buf + minwidth + (newDesc ? 8 : 10);
 		sprintf(pBuf, "%-*.*s",
 			(int)length, (int)length,
-			strlen(desc) > pos ? &desc[pos] : "");
+			strlen(desc) > pos ? &desc[pos] : " ");
 		// Note: Follow up lines of wrapped descriptions are indented by 2
 
 		// Leftover characters on the right must be blanked:
 		if (leftover > 0)
-			sprintf(pBuf + length, "%-*s", leftover, " ");
+			sprintf(pBuf + length, "%-*.*s", leftover, leftover, " ");
 
 		/* Set correct color set according to highlighting and status*/
 		if(highlight)
@@ -736,7 +738,7 @@ static char getFlagSpecialChar(sFlag* flag, int index)
 
 static void printFlagInfo(char* buf, sFlag* flag, int index, bool printFlagName, bool printFlagState)
 {
-	if (printFlagName)
+	if (printFlagName) {
 		sprintf(buf, " %c%c%c %s%s%s%-*s ",
 			/* State of selection */
 			flag->stateConf == ' ' ? '(' : '[',
@@ -750,8 +752,10 @@ static void printFlagInfo(char* buf, sFlag* flag, int index, bool printFlagName,
 			(int)(minwidth
 				- (flag->globalForced ? 3 : flag->globalMasked ? 2 : 5)
 				- strlen(flag->name)), " ");
+		buf[minwidth] = ' '; // No automatic \0, please!
+	}
 
-	if (printFlagState)
+	if (printFlagState) {
 		/* Display flag state
 		 * The order in which the states are to be displayed is:
 		 * 1. [D]efaults (make.defaults, IUSE, package.mask, package.force)
@@ -767,6 +771,8 @@ static void printFlagInfo(char* buf, sFlag* flag, int index, bool printFlagName,
 				flag->stateConf : flag->desc[index].statePkgUse,
 			flag->desc[index].isGlobal ? ' ' : 'L',
 			flag->desc[index].isInstalled ? 'i' : ' ');
+		buf[minwidth + 8] = ' '; // No automatic \0, please!
+	}
 }
 
 static void setFlagWrapDraw(sFlag* flag, int index, sWrap** wrap, size_t* pos, size_t* len, bool* isFirstWrap)

diff --git a/ufed-curses-types.c b/ufed-curses-types.c
index 9d59234..e6b1139 100644
--- a/ufed-curses-types.c
+++ b/ufed-curses-types.c
@@ -573,7 +573,7 @@ static void calculateDescWrap(sDesc* desc)
 				end = wLen - 1;
 
 			// Step 2: Find last space character before end+1
-			if ((end > start) && (end < (wLen - 1)) && (' ' != pch[end])) {
+			if ((end > start) && (' ' != pch[end])) {
 				size_t newEnd = end;
 				for (; (newEnd > start) && (' ' != pch[newEnd]) ; --newEnd) ;
 				if (newEnd > start)


^ permalink raw reply related	[flat|nested] 238+ messages in thread
* [gentoo-commits] proj/ufed:master commit in: /
@ 2013-09-20  8:30 Sven Eden
  0 siblings, 0 replies; 238+ messages in thread
From: Sven Eden @ 2013-09-20  8:30 UTC (permalink / raw
  To: gentoo-commits

commit:     5e74a1084a35f8ebe312c4af63e13a468f410886
Author:     Sven Eden <yamakuzure <AT> gmx <DOT> net>
AuthorDate: Wed Sep 18 19:22:49 2013 +0000
Commit:     Sven Eden <sven.eden <AT> gmx <DOT> de>
CommitDate: Wed Sep 18 19:22:49 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/ufed.git;a=commit;h=5e74a108

drawFlag() fixed a definite endless loop

---
 ufed-curses-checklist.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/ufed-curses-checklist.c b/ufed-curses-checklist.c
index b5eef00..2ac712b 100644
--- a/ufed-curses-checklist.c
+++ b/ufed-curses-checklist.c
@@ -185,6 +185,7 @@ static void read_flags(void)
 	bottomline = lineNum;
 }
 
+
 static int drawflag(sFlag* flag, bool highlight)
 {
 	// Return early if there is nothing to display:
@@ -236,8 +237,10 @@ static int drawflag(sFlag* flag, bool highlight)
 	while ( (idx < flag->ndesc) && (line < lHeight) ) {
 
 		// Continue if any of the filters apply:
-		if (newDesc && !isDescLegal(flag, idx))
+		if (newDesc && !isDescLegal(flag, idx)) {
+			++idx;
 			continue;
+		}
 
 		// If the flag name and state are drawn, following lines
 		// need to start with spaces
@@ -274,7 +277,7 @@ static int drawflag(sFlag* flag, bool highlight)
 
 		// 1: Print left side info
 		if (!hasHead || newDesc)
-			// Note: If either is false, the buffer is blanked already
+			// Note: If both are false, the buffer is blanked already
 			printFlagInfo(buf, flag, idx, !hasHead, newDesc);
 
 		// At this point buf is guaranteed to be filled up to minwidth + 8
@@ -284,6 +287,8 @@ static int drawflag(sFlag* flag, bool highlight)
 		if (eWrap_wrap == e_wrap) {
 			setFlagWrapDraw(flag, idx, &wrapPart, &pos, &length, &wrapFirst);
 			wrapPart = wrapPart->next;
+			if (newDesc && wrapPart)
+				newDesc = false;
 		}
 
 		// The right side of buf can be added now:


^ permalink raw reply related	[flat|nested] 238+ messages in thread
* [gentoo-commits] proj/ufed:master commit in: /
@ 2013-09-20  8:30 Sven Eden
  0 siblings, 0 replies; 238+ messages in thread
From: Sven Eden @ 2013-09-20  8:30 UTC (permalink / raw
  To: gentoo-commits

commit:     b05730c5e293ea18745fe88c2885ce9f902a50ad
Author:     Sven Eden <yamakuzure <AT> gmx <DOT> net>
AuthorDate: Wed Sep 18 19:29:52 2013 +0000
Commit:     Sven Eden <sven.eden <AT> gmx <DOT> de>
CommitDate: Wed Sep 18 19:29:52 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/ufed.git;a=commit;h=b05730c5

findFlagStart() Fixed another potential endless loop

---
 ufed-curses-checklist.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/ufed-curses-checklist.c b/ufed-curses-checklist.c
index 2ac712b..8a3e9e1 100644
--- a/ufed-curses-checklist.c
+++ b/ufed-curses-checklist.c
@@ -630,8 +630,8 @@ static int findFlagStart(sFlag* flag, int* index, sWrap** wrap, int* line, bool*
 			if (isDescLegal(flag, *index)) {
 				if (eWrap_normal == e_wrap) {
 					++(*line);
-					++usedLines;
 					++(*index);
+					++usedLines;
 				} else {
 					/* With wrapped descriptions there are two possible
 					 * situations:
@@ -665,6 +665,8 @@ static int findFlagStart(sFlag* flag, int* index, sWrap** wrap, int* line, bool*
 					}
 				} // End of handling wrapped lines
 			} // End of having a legal flag
+			else
+				++(*index);
 		} // end of moving to line 0
 
 		// Write back wrapPart:


^ permalink raw reply related	[flat|nested] 238+ messages in thread
* [gentoo-commits] proj/ufed:master commit in: /
@ 2013-09-20  8:30 Sven Eden
  0 siblings, 0 replies; 238+ messages in thread
From: Sven Eden @ 2013-09-20  8:30 UTC (permalink / raw
  To: gentoo-commits

commit:     4b8cd2970af58ba9043c1291312df8fc0d71454d
Author:     Sven Eden <yamakuzure <AT> gmx <DOT> net>
AuthorDate: Wed Sep 18 17:44:38 2013 +0000
Commit:     Sven Eden <sven.eden <AT> gmx <DOT> de>
CommitDate: Wed Sep 18 17:44:38 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/ufed.git;a=commit;h=4b8cd297

Rewrote drawFlag() and added some helper functions. The mess is consideratly cleared now and the function is much cleaner and more maintainable.

---
 ufed-curses-checklist.c | 406 ++++++++++++++++++++++++++----------------------
 1 file changed, 218 insertions(+), 188 deletions(-)

diff --git a/ufed-curses-checklist.c b/ufed-curses-checklist.c
index 8425997..b5eef00 100644
--- a/ufed-curses-checklist.c
+++ b/ufed-curses-checklist.c
@@ -21,6 +21,9 @@ static sFlag*  flags           = NULL;
 /* internal prototypes */
 static int  findFlagStart(sFlag* flag, int* index, sWrap** wrap, int* line, bool* isFirstWrap);
 static void free_flags(void);
+static char getFlagSpecialChar(sFlag* flag, int index);
+static void printFlagInfo(char* buf, sFlag* flag, int index, bool printFlagName, bool printFlagState);
+static void setFlagWrapDraw(sFlag* flag, int index, sWrap** wrap, size_t* pos, size_t* len, bool* isFirstWrap);
 
 
 /* static functions */
@@ -182,126 +185,74 @@ static void read_flags(void)
 	bottomline = lineNum;
 }
 
-static void free_flags(void)
-{
-	sFlag* flag = flags->prev;
-
-	// Clear all flags
-	while (flags) {
-		if (flag)
-			destroyFlag(&flags, &flag);
-		else
-			destroyFlag(&flags, &flags);
-		flag = flags ? flags->prev ? flags->prev : flags : NULL;
-	}
-
-	// Clear line buffer
-	if (lineBuf)
-		free(lineBuf);
-}
-
-
 static int drawflag(sFlag* flag, bool highlight)
 {
 	// Return early if there is nothing to display:
 	if (!isFlagLegal(flag))
 		return 0;
 
-	// Get the starting description/wrapped line of the flag
+	// Basic values for the flag display
 	int    idx       = 0;    // The description index to start with
 	int    line      = flag->currline;
 	int    usedY     = 0;    // Counts how many lines this flag really needs to display
 	sWrap* wrapPart  = NULL; // Wrap part to begin with/draw
 	bool   wrapFirst = true; // The first part, pkg or desc
 
+	// Get the starting description/wrapped line of the flag
 	if ((line < 0)
 	  && (0 == (usedY = findFlagStart(flag, &idx, &wrapPart, &line, &wrapFirst))) )
 		return 0;
 
-
-	char   buf[wWidth(List)+1];
-	char   desc[maxDescWidth];
-
-
-
-	memset(buf, 0, sizeof(char) * (wWidth(List)+1));
+	// Window values (aka shortcuts)
+	WINDOW* wLst    = win(List);
+	int     lHeight = wHeight(List);
+	int     lWidth  = wWidth(List);
+
+	// Set up needed buffers
+	char   buf[lWidth + 1];       // Buffer for the line to print
+	char   desc[maxDescWidth];    // Buffer to assemble the description accoring to e_order and e_desc
+	char   special;               // force/mask/none character
+	memset(buf,  0, sizeof(char) * (lWidth + 1));
+	memset(desc, 0, sizeof(char) * maxDescWidth);
+
+	// Description and wrapped lines state values
+	bool   hasBlankLeft  = false;                 // Set to true once the left side is blanked
+	bool   hasBlankRight = false;                 // Set to true once the right (state) side is blanked
+	bool   hasHead       = false;                 // Set to true once the left side (flag name and states) are printed
+	size_t length        = lWidth - minwidth - 8; // Characters to print
+	bool   newDesc       = true;                  // Set to fals when wrapped parts advance
+	size_t pos           = descriptionleft;       // position in desc to start printing on
+
+	// Safety check: Put in blank line if idx ended up too large
+	if (idx >= flag->ndesc) {
+		// This can happen when filters reduce the list too much
+		// so blank lines must be displayed
+		memset(buf, ' ', lWidth - 1);
+		buf[lWidth] = '\0';
+		waddstr(wLst, buf);
+	}
 
 	// print descriptions according to filters
-	if(idx < flag->ndesc) {
-		WINDOW* wLst      = win(List);
-		int     lHeight   = wHeight(List);
-		bool    hasHead   = false;
-		size_t  pos       = descriptionleft;
-		size_t  length    = wWidth(List) - (minwidth + 8);
-		bool    newDesc   = true; // Set to false when advanceing wrapped descriptions
-		char *p, special, *leftend;
-
-		while ( (idx < flag->ndesc) && (line < lHeight) ) {
-			// Continue if any of the filters apply:
-			if (newDesc && !isDescLegal(flag, idx))
-				continue;
-
-			if (hasHead) {
-				// Add spaces under the flag display
-				leftend = newDesc ? buf + minwidth : buf + minwidth + 8;
-				for(p = buf; p != leftend; ++p)
-					*p = ' ';
-			}
+	while ( (idx < flag->ndesc) && (line < lHeight) ) {
 
-			// Preparations when a new description line is started
-			if (newDesc) {
-				// Set special character if needed:
-				if (isDescForced(flag, idx))
-					special = 'f';
-				else if (isDescMasked(flag, idx))
-					special = 'm';
-				else
-					special = ' ';
-
-				// If this is the very first line, the flag data must be written
-				if (!hasHead) {
-					/* print the selection, name and state of the flag */
-					sprintf(buf, " %c%c%c %s%s%s%-*s ",
-						/* State of selection */
-						flag->stateConf == ' ' ? '(' : '[',
-						' ', // Filled in later
-						flag->stateConf == ' ' ? ')' : ']',
-						/* name */
-						flag->globalForced ? "(" : flag->globalMasked ? "(-" : "",
-						flag->name,
-						(flag->globalForced || flag->globalMasked) ? ")" : "",
-						/* distance */
-						(int)(minwidth
-							- (flag->globalForced ? 3 : flag->globalMasked ? 2 : 5)
-							- strlen(flag->name)), " ");
-				} // End of generating left side mask display
-
-				// At this point buf is filled up to minwidth
-
-				/* Display flag state
-				 * The order in which the states are to be displayed is:
-				 * 1. [D]efaults (make.defaults, IUSE, package.mask, package.force)
-				 *    Note: Filled in later
-				 * 2. [P]rofile package.use files
-				 * 3. [C]onfiguration (make.conf, users package.use)
-				 * 4. global/local
-				 * 5. installed/not installed
-				 */
-				sprintf(buf + minwidth, "  %c%c %c%c ",
-					flag->desc[idx].statePackage,
-					' ' == flag->desc[idx].statePkgUse ?
-						flag->stateConf : flag->desc[idx].statePkgUse,
-					flag->desc[idx].isGlobal ? ' ' : 'L',
-					flag->desc[idx].isInstalled ? 'i' : ' ');
-			} // End of preparing a new description line
+		// Continue if any of the filters apply:
+		if (newDesc && !isDescLegal(flag, idx))
+			continue;
 
-			// At this point buf is guaranteed to be filled up to minwidth + 8
+		// If the flag name and state are drawn, following lines
+		// need to start with spaces
+		if (hasHead && !hasBlankLeft) {
+			memset(buf, ' ', minwidth);
+			hasBlankLeft = true;
+		}
 
-			memset(desc, 0, maxDescWidth * sizeof(char));
+		// Prepare new description or blank on wrapped parts
+		if (newDesc) {
+			special = getFlagSpecialChar(flag, idx);
 
 			// Wrapped and not wrapped lines are unified here
 			// to simplify the usage of different ordering and
-			// stripped versus original descriptions
+			// stripped descriptions versus original descriptions
 			if (flag->desc[idx].pkg) {
 				if (e_order == eOrder_left)
 					sprintf(desc, "(%s) %s", flag->desc[idx].pkg, e_desc == eDesc_ori
@@ -314,111 +265,92 @@ static int drawflag(sFlag* flag, bool highlight)
 							  flag->desc[idx].pkg);
 			} else
 				sprintf(desc, "%s", flag->desc[idx].desc);
+		} else if (!hasBlankRight) {
+			memset(buf + minwidth, ' ', 10);
+			hasBlankRight = true;
+		}
 
-			/* Now display the description line according to either
-			 * its horizontal position or the wrapPart.
-			 *
-			 * With wrapped lines there are a total of three possible
-			 * situations here.
-			 * a) The line is not wrapped. In this case pos is simply
-			 *    descriptionleft and length is number of characters that
-			 *    can be displayed. (both are already set to this)
-			 * b) A new wrapped description starts. In this case wrapPart
-			 *    must be set, pos and length is taken from there.
-			 * c) A wrapped description is displayed, pos and length are
-			 *    taken from there.
-			 * As a) is already set, only b) and c) must be handled.
-			 */
-			if (eWrap_wrap == e_wrap) {
-				if (NULL == wrapPart) {
-					wrapPart  = flag->desc[idx].wrap;
-					wrapFirst = true;
-				} else if (wrapFirst
-						&& (flag->desc[idx].wrap != wrapPart)
-						&& !wrapPart->pos)
-					wrapFirst = false;
-				pos    = wrapPart->pos;
-				length = wrapPart->len;
-				// If this was switched, add the first length
-				if (!wrapFirst && !pos)
-					pos += eOrder_left == e_order
-							? strlen(flag->desc[idx].pkg)
-							: eDesc_ori == e_desc
-							  ? strlen(flag->desc[idx].desc)
-							  : strlen(flag->desc[idx].desc_alt)
-						 + 1;
-				wrapPart = wrapPart->next;
-			}
+		/* --- Preparations done --- */
 
-			// aaaaand go:
-			sprintf(buf + minwidth + (newDesc ? 8 : 10), "%-*.*s", (int)length, (int)length,
-				strlen(desc) > pos
-					? &desc[pos]
-					: "");
+		// 1: Print left side info
+		if (!hasHead || newDesc)
+			// Note: If either is false, the buffer is blanked already
+			printFlagInfo(buf, flag, idx, !hasHead, newDesc);
 
-			/* Set correct color set according to highlighting and status*/
-			if(highlight)
-				wattrset(wLst, COLOR_PAIR(3) | A_BOLD | A_REVERSE);
-			else
-				wattrset(wLst, COLOR_PAIR(3));
-
-			// Put the line on the screen
-			mvwaddstr(wLst, line, 0, buf);
-			mvwaddch(wLst, line, minwidth,     ACS_VLINE); // Before state
-			mvwaddch(wLst, line, minwidth + 4, ACS_VLINE); // Between state and scope
-			mvwaddch(wLst, line, minwidth + 7, ACS_VLINE); // After scope
-
-			// Add (default) selection if this is the header line
-			if (!hasHead) {
-				hasHead = true;
-				if (flag->globalForced) {
-					if(highlight)
-						wattrset(wLst, COLOR_PAIR(5) | A_REVERSE);
-					else
-						wattrset(wLst, COLOR_PAIR(5) | A_BOLD);
-					mvwaddch(wLst, line, 2, '+');
-				} else if (flag->globalMasked) {
-					if(highlight)
-						wattrset(wLst, COLOR_PAIR(4) | A_REVERSE);
-					else
-						wattrset(wLst, COLOR_PAIR(4) | A_BOLD);
-					mvwaddch(wLst, line, 2, '-');
-				} else if (' ' == flag->stateConf)
-					mvwaddch(wLst, line, 2, flag->stateDefault);
-				else
-					mvwaddch(wLst, line, 2, flag->stateConf);
-			}
+		// At this point buf is guaranteed to be filled up to minwidth + 8
+
+		// For normal descriptions, pos and length are already set, but
+		// not so for wrapped lines, these must be set for each line:
+		if (eWrap_wrap == e_wrap) {
+			setFlagWrapDraw(flag, idx, &wrapPart, &pos, &length, &wrapFirst);
+			wrapPart = wrapPart->next;
+		}
 
-			// Add [D]efault column content
-			if ('f' == special) {
+		// The right side of buf can be added now:
+		sprintf(buf + minwidth + (newDesc ? 8 : 10), "%-*.*s",
+			(int)length, (int)length,
+			strlen(desc) > pos ? &desc[pos] : "");
+		// Note: Follow up lines of wrapped descriptions are indented by 2
+
+		/* Set correct color set according to highlighting and status*/
+		if(highlight)
+			wattrset(wLst, COLOR_PAIR(3) | A_BOLD | A_REVERSE);
+		else
+			wattrset(wLst, COLOR_PAIR(3));
+
+		// Put the line on the screen
+		mvwaddstr(wLst, line, 0, buf);
+		mvwaddch(wLst, line, minwidth,     ACS_VLINE); // Before state
+		mvwaddch(wLst, line, minwidth + 4, ACS_VLINE); // Between state and scope
+		mvwaddch(wLst, line, minwidth + 7, ACS_VLINE); // After scope
+
+		// Add (default) selection if this is the header line
+		if (!hasHead) {
+			hasHead = true;
+			if (flag->globalForced) {
 				if(highlight)
 					wattrset(wLst, COLOR_PAIR(5) | A_REVERSE);
 				else
 					wattrset(wLst, COLOR_PAIR(5) | A_BOLD);
-				mvwaddch(wLst, line, minwidth + 1, special);
-			} else if ('m' == special) {
+				mvwaddch(wLst, line, 2, '+');
+			} else if (flag->globalMasked) {
 				if(highlight)
 					wattrset(wLst, COLOR_PAIR(4) | A_REVERSE);
 				else
 					wattrset(wLst, COLOR_PAIR(4) | A_BOLD);
-				mvwaddch(wLst, line, minwidth + 1, special);
-			} else {
-				if (' ' == flag->desc[idx].stateDefault)
-					mvwaddch(wLst, line, minwidth + 1, flag->stateDefault);
-				else
-					mvwaddch(wLst, line, minwidth + 1, flag->desc[idx].stateDefault);
-			}
+				mvwaddch(wLst, line, 2, '-');
+			} else if (' ' == flag->stateConf)
+				mvwaddch(wLst, line, 2, flag->stateDefault);
+			else
+				mvwaddch(wLst, line, 2, flag->stateConf);
+		}
 
-			++line;
-			++usedY;
-			if (NULL == wrapPart)
-				++idx;
-		} // End of looping descriptions while there are lines left
-	} else {
-		memset(buf+minwidth, ' ', wWidth(List)-minwidth);
-		buf[wWidth(List)] = '\0';
-		waddstr(win(List), buf);
-	}
+		// Add [D]efault column content
+		if ('f' == special) {
+			if(highlight)
+				wattrset(wLst, COLOR_PAIR(5) | A_REVERSE);
+			else
+				wattrset(wLst, COLOR_PAIR(5) | A_BOLD);
+			mvwaddch(wLst, line, minwidth + 1, special);
+		} else if ('m' == special) {
+			if(highlight)
+				wattrset(wLst, COLOR_PAIR(4) | A_REVERSE);
+			else
+				wattrset(wLst, COLOR_PAIR(4) | A_BOLD);
+			mvwaddch(wLst, line, minwidth + 1, special);
+		} else {
+			if (' ' == flag->desc[idx].stateDefault)
+				mvwaddch(wLst, line, minwidth + 1, flag->stateDefault);
+			else
+				mvwaddch(wLst, line, minwidth + 1, flag->desc[idx].stateDefault);
+		}
+
+		// Advance counters and possibly description index
+		++line;
+		++usedY;
+		if (NULL == wrapPart)
+			++idx;
+	} // end of looping flag descriptions
 
 	if(highlight)
 		wmove(win(List), max(flag->currline, 0), 2);
@@ -737,6 +669,104 @@ static int findFlagStart(sFlag* flag, int* index, sWrap** wrap, int* line, bool*
 	return usedLines;
 }
 
+static void free_flags(void)
+{
+	sFlag* flag = flags->prev;
+
+	// Clear all flags
+	while (flags) {
+		if (flag)
+			destroyFlag(&flags, &flag);
+		else
+			destroyFlag(&flags, &flags);
+		flag = flags ? flags->prev ? flags->prev : flags : NULL;
+	}
+
+	// Clear line buffer
+	if (lineBuf)
+		free(lineBuf);
+}
+
+static char getFlagSpecialChar(sFlag* flag, int index)
+{
+	// Return special character if needed:
+	if (isDescForced(flag, index))
+		return 'f';
+	else if (isDescMasked(flag, index))
+		return 'm';
+	return ' ';
+}
+
+
+static void printFlagInfo(char* buf, sFlag* flag, int index, bool printFlagName, bool printFlagState)
+{
+	if (printFlagName)
+		sprintf(buf, " %c%c%c %s%s%s%-*s ",
+			/* State of selection */
+			flag->stateConf == ' ' ? '(' : '[',
+			' ', // Filled in later
+			flag->stateConf == ' ' ? ')' : ']',
+			/* name */
+			flag->globalForced ? "(" : flag->globalMasked ? "(-" : "",
+			flag->name,
+			(flag->globalForced || flag->globalMasked) ? ")" : "",
+			/* distance */
+			(int)(minwidth
+				- (flag->globalForced ? 3 : flag->globalMasked ? 2 : 5)
+				- strlen(flag->name)), " ");
+
+	if (printFlagState)
+		/* Display flag state
+		 * The order in which the states are to be displayed is:
+		 * 1. [D]efaults (make.defaults, IUSE, package.mask, package.force)
+		 *    Note: Filled in later
+		 * 2. [P]rofile package.use files
+		 * 3. [C]onfiguration (make.conf, users package.use)
+		 * 4. global/local
+		 * 5. installed/not installed
+		 */
+		sprintf(buf + minwidth, "  %c%c %c%c ",
+			flag->desc[index].statePackage,
+			' ' == flag->desc[index].statePkgUse ?
+				flag->stateConf : flag->desc[index].statePkgUse,
+			flag->desc[index].isGlobal ? ' ' : 'L',
+			flag->desc[index].isInstalled ? 'i' : ' ');
+}
+
+static void setFlagWrapDraw(sFlag* flag, int index, sWrap** wrap, size_t* pos, size_t* len, bool* isFirstWrap)
+{
+	sWrap* wrapPart = *wrap;
+
+	if (NULL == wrapPart) {
+		wrapPart     = flag->desc[index].wrap;
+		*isFirstWrap = true;
+	} else if (*isFirstWrap
+			&& (flag->desc[index].wrap != wrapPart)
+			&& !wrapPart->pos)
+		*isFirstWrap = false;
+
+	// Position and length can be written back already
+	*pos = wrapPart->pos;
+	*len = wrapPart->len;
+
+	// If this was switched, add the first length
+	if ((false == *isFirstWrap) && (0 == *pos)) {
+		// Add the length of either the package list or the
+		// description (stripped or normal) or drawFlag will
+		// end up reprinting from the beginning due to the
+		// unified description string.
+		if (eOrder_left == e_order)
+			*pos += sizeof(flag->desc[index].pkg);
+		else
+			*pos += eDesc_ori == e_desc
+				  ? sizeof(flag->desc[index].desc)
+				  : sizeof(flag->desc[index].desc_alt);
+	}
+
+	// Write back wrap part pointer
+	*wrap = wrapPart;
+}
+
 
 int main(void)
 {


^ permalink raw reply related	[flat|nested] 238+ messages in thread
* [gentoo-commits] proj/ufed:master commit in: /
@ 2013-09-20  8:30 Sven Eden
  0 siblings, 0 replies; 238+ messages in thread
From: Sven Eden @ 2013-09-20  8:30 UTC (permalink / raw
  To: gentoo-commits

commit:     36b801f881268661d78db3ec3b34d3f69f111281
Author:     Sven Eden <yamakuzure <AT> gmx <DOT> net>
AuthorDate: Wed Sep 18 17:47:24 2013 +0000
Commit:     Sven Eden <sven.eden <AT> gmx <DOT> de>
CommitDate: Wed Sep 18 17:47:24 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/ufed.git;a=commit;h=36b801f8

Added wrapped selection to status line

---
 ufed-curses.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/ufed-curses.c b/ufed-curses.c
index 70a0ac7..f6b2531 100644
--- a/ufed-curses.c
+++ b/ufed-curses.c
@@ -337,7 +337,7 @@ void drawStatus(bool withSep)
 		 * + 2 brackets = 22
 		 * + 4 pipes    = 26
 		*/
-		sprintf(buf, "%*s%-4s|%-4s|%-4s|%-4s|%-4s] ",
+		sprintf(buf, "%*s%-4s|%-4s|%-4s|%-4s|%-4s|%-4s] ",
 			max(2, iWidth - 33 - minwidth), " [",
 			eScope_global         == e_scope ? "glob"
 			: eScope_local        == e_scope ? "loca" : "all",
@@ -346,7 +346,8 @@ void drawStatus(bool withSep)
 			eMask_masked          == e_mask  ? "mask"
 			: eMask_unmasked      == e_mask  ? "norm" : "all",
 			eOrder_left           == e_order ? "left" : "righ",
-			eDesc_ori             == e_desc  ? "orig" : "stri");
+			eDesc_ori             == e_desc  ? "orig" : "stri",
+			eWrap_normal          == e_wrap  ? "long" : "wrap");
 		waddstr(w, buf);
 	}
 


^ permalink raw reply related	[flat|nested] 238+ messages in thread
* [gentoo-commits] proj/ufed:master commit in: /
@ 2013-09-20  8:30 Sven Eden
  0 siblings, 0 replies; 238+ messages in thread
From: Sven Eden @ 2013-09-20  8:30 UTC (permalink / raw
  To: gentoo-commits

commit:     ad10facbf3648567ecd7cde95a58163413a957ee
Author:     Sven Eden <yamakuzure <AT> gmx <DOT> net>
AuthorDate: Fri Sep 13 05:22:23 2013 +0000
Commit:     Sven Eden <sven.eden <AT> gmx <DOT> de>
CommitDate: Fri Sep 13 05:22:23 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/ufed.git;a=commit;h=ad10facb

destroyFlag(): Included destruction of the new sWrap chains if present

---
 ufed-curses-types.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/ufed-curses-types.c b/ufed-curses-types.c
index a09336b..2ccfa9a 100644
--- a/ufed-curses-types.c
+++ b/ufed-curses-types.c
@@ -219,6 +219,16 @@ void destroyFlag (sFlag** root, sFlag** flag)
 				free (xFlag->desc[i].desc);
 			if (xFlag->desc[i].desc_alt)
 				free (xFlag->desc[i].desc_alt);
+			if (xFlag->desc[i].wrap) {
+				sWrap* wrapRoot = xFlag->desc[i].wrap;
+				sWrap* wrapNext = wrapRoot ? wrapRoot->next : NULL;
+				xFlag->desc[i].wrap = NULL;
+				while (wrapRoot) {
+					free (wrapRoot);
+					wrapRoot = wrapNext;
+					wrapNext = wrapRoot ? wrapRoot->next : NULL;
+				}
+			}
 		}
 		if (xFlag->desc)
 			free (xFlag->desc);


^ permalink raw reply related	[flat|nested] 238+ messages in thread
* [gentoo-commits] proj/ufed:master commit in: /
@ 2013-09-20  8:30 Sven Eden
  0 siblings, 0 replies; 238+ messages in thread
From: Sven Eden @ 2013-09-20  8:30 UTC (permalink / raw
  To: gentoo-commits

commit:     6fb0c7daf5e135f18eeb58cf8fb3331bcc31f029
Author:     Sven Eden <yamakuzure <AT> gmx <DOT> net>
AuthorDate: Tue Sep 17 17:17:33 2013 +0000
Commit:     Sven Eden <sven.eden <AT> gmx <DOT> de>
CommitDate: Tue Sep 17 17:17:33 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/ufed.git;a=commit;h=6fb0c7da

drawFlag(): The function is now aware of wrapped descriptions. However, the whole function is a mess now and should be rewritten, possibly in two distinct functions leaving drawFlag to prepare and distribute only.

---
 ufed-curses-checklist.c | 182 +++++++++++++++++++++++++++++++-----------------
 1 file changed, 119 insertions(+), 63 deletions(-)

diff --git a/ufed-curses-checklist.c b/ufed-curses-checklist.c
index 9aaf35f..ee11b10 100644
--- a/ufed-curses-checklist.c
+++ b/ufed-curses-checklist.c
@@ -202,12 +202,13 @@ static void free_flags(void)
 
 static int drawflag(sFlag* flag, bool highlight)
 {
-	int    idx     = 0;
-	int    usedY   = 0;
-	int    line    = flag->currline;
+	int    idx       = 0;
+	int    usedY     = 0;
+	int    line      = flag->currline;
 	char   buf[wWidth(List)+1];
 	char   desc[maxDescWidth];
-	sWrap* wrapPart = NULL;
+	sWrap* wrapPart  = NULL;
+	bool   wrapFirst = true; // The first part, pkg or desc
 
 	// Return early if there is nothing to display:
 	if (!isFlagLegal(flag))
@@ -248,6 +249,10 @@ static int drawflag(sFlag* flag, bool highlight)
 								++line;
 								++usedY;
 								wrapPart = wrapPart->next;
+								if (wrapPart && !wrapPart->pos)
+									wrapFirst = false;
+								// Note: The wrap parts are already calculated
+								//       to resemble the current order.
 							}
 						} else {
 							// Situation a) Fast forward
@@ -267,65 +272,80 @@ static int drawflag(sFlag* flag, bool highlight)
 
 	// print descriptions according to filters
 	if(idx < flag->ndesc) {
-		WINDOW* wLst = win(List);
-		int  lHeight = wHeight(List);
-		int  descLen = wWidth(List) - (minwidth + 8);
-		bool hasHead = false;
-		char *p, special;
-
-		for( ; (idx < flag->ndesc) && (line < lHeight); ++idx) {
+		WINDOW* wLst      = win(List);
+		int     lHeight   = wHeight(List);
+		bool    hasHead   = false;
+		size_t  pos       = descriptionleft;
+		size_t  length    = wWidth(List) - (minwidth + 8);
+		bool    newDesc   = true; // Set to false when advanceing wrapped descriptions
+		char *p, special, *leftend;
+
+		while ( (idx < flag->ndesc) && (line < lHeight) ) {
 			// Continue if any of the filters apply:
-			if (!isDescLegal(flag, idx))
+			if (newDesc && !isDescLegal(flag, idx))
 				continue;
 
-			// Set special character if needed:
-			if (isDescForced(flag, idx))
-				special = 'f';
-			else if (isDescMasked(flag, idx))
-				special = 'm';
-			else
-				special = ' ';
-
 			if (hasHead) {
 				// Add spaces under the flag display
-				for(p = buf; p != buf + minwidth; ++p)
+				leftend = newDesc ? buf + minwidth : buf + minwidth + 8;
+				for(p = buf; p != leftend; ++p)
 					*p = ' ';
-			} else {
-				/* print the selection, name and state of the flag */
-				sprintf(buf, " %c%c%c %s%s%s%-*s ",
-					/* State of selection */
-					flag->stateConf == ' ' ? '(' : '[',
-					' ', // Filled in later
-					flag->stateConf == ' ' ? ')' : ']',
-					/* name */
-					flag->globalForced ? "(" : flag->globalMasked ? "(-" : "",
-					flag->name,
-					(flag->globalForced || flag->globalMasked) ? ")" : "",
-					/* distance */
-					(int)(minwidth
-						- (flag->globalForced ? 3 : flag->globalMasked ? 2 : 5)
-						- strlen(flag->name)), " ");
-					// At this point buf is filled up to minwidth
-			} // End of generating left side mask display
-
-			/* Display flag state
-			 * The order in which the states are to be displayed is:
-			 * 1. [D]efaults (make.defaults, IUSE, package.mask, package.force)
-			 *    Note: Filled in later
-			 * 2. [P]rofile package.use files
-			 * 3. [C]onfiguration (make.conf, users package.use)
-			 * 4. global/local
-			 * 5. installed/not installed
-			 */
-			sprintf(buf + minwidth, "  %c%c %c%c ",
-				flag->desc[idx].statePackage,
-				' ' == flag->desc[idx].statePkgUse ?
-					flag->stateConf : flag->desc[idx].statePkgUse,
-				flag->desc[idx].isGlobal ? ' ' : 'L',
-				flag->desc[idx].isInstalled ? 'i' : ' ');
-
-			// Assemble description line:
+			}
+
+			// Preparations when a new description line is started
+			if (newDesc) {
+				// Set special character if needed:
+				if (isDescForced(flag, idx))
+					special = 'f';
+				else if (isDescMasked(flag, idx))
+					special = 'm';
+				else
+					special = ' ';
+
+				// If this is the very first line, the flag data must be written
+				if (!hasHead) {
+					/* print the selection, name and state of the flag */
+					sprintf(buf, " %c%c%c %s%s%s%-*s ",
+						/* State of selection */
+						flag->stateConf == ' ' ? '(' : '[',
+						' ', // Filled in later
+						flag->stateConf == ' ' ? ')' : ']',
+						/* name */
+						flag->globalForced ? "(" : flag->globalMasked ? "(-" : "",
+						flag->name,
+						(flag->globalForced || flag->globalMasked) ? ")" : "",
+						/* distance */
+						(int)(minwidth
+							- (flag->globalForced ? 3 : flag->globalMasked ? 2 : 5)
+							- strlen(flag->name)), " ");
+				} // End of generating left side mask display
+
+				// At this point buf is filled up to minwidth
+
+				/* Display flag state
+				 * The order in which the states are to be displayed is:
+				 * 1. [D]efaults (make.defaults, IUSE, package.mask, package.force)
+				 *    Note: Filled in later
+				 * 2. [P]rofile package.use files
+				 * 3. [C]onfiguration (make.conf, users package.use)
+				 * 4. global/local
+				 * 5. installed/not installed
+				 */
+				sprintf(buf + minwidth, "  %c%c %c%c ",
+					flag->desc[idx].statePackage,
+					' ' == flag->desc[idx].statePkgUse ?
+						flag->stateConf : flag->desc[idx].statePkgUse,
+					flag->desc[idx].isGlobal ? ' ' : 'L',
+					flag->desc[idx].isInstalled ? 'i' : ' ');
+			} // End of preparing a new description line
+
+			// At this point buf is guaranteed to be filled up to minwidth + 8
+
 			memset(desc, 0, maxDescWidth * sizeof(char));
+
+			// Wrapped and not wrapped lines are unified here
+			// to simplify the usage of different ordering and
+			// stripped versus original descriptions
 			if (flag->desc[idx].pkg) {
 				if (e_order == eOrder_left)
 					sprintf(desc, "(%s) %s", flag->desc[idx].pkg, e_desc == eDesc_ori
@@ -336,14 +356,48 @@ static int drawflag(sFlag* flag, bool highlight)
 							? flag->desc[idx].desc
 							: flag->desc[idx].desc_alt,
 							  flag->desc[idx].pkg);
-			}
-			else
+			} else
 				sprintf(desc, "%s", flag->desc[idx].desc);
 
-			// Now display the description line according to its horizontal position
-			sprintf(buf + minwidth + 8, "%-*.*s", descLen, descLen,
-				strlen(desc) > (size_t)descriptionleft
-					? &desc[descriptionleft]
+			/* Now display the description line according to either
+			 * its horizontal position or the wrapPart.
+			 *
+			 * With wrapped lines there are a total of three possible
+			 * situations here.
+			 * a) The line is not wrapped. In this case pos is simply
+			 *    descriptionleft and length is number of characters that
+			 *    can be displayed. (both are already set to this)
+			 * b) A new wrapped description starts. In this case wrapPart
+			 *    must be set, pos and length is taken from there.
+			 * c) A wrapped description is displayed, pos and length are
+			 *    taken from there.
+			 * As a) is already set, only b) and c) must be handled.
+			 */
+			if (eWrap_wrap == e_wrap) {
+				if (NULL == wrapPart) {
+					wrapPart  = flag->desc[idx].wrap;
+					wrapFirst = true;
+				} else if (wrapFirst
+						&& (flag->desc[idx].wrap != wrapPart)
+						&& !wrapPart->pos)
+					wrapFirst = false;
+				pos    = wrapPart->pos;
+				length = wrapPart->len;
+				// If this was switched, add the first length
+				if (!wrapFirst && !pos)
+					pos += eOrder_left == e_order
+							? strlen(flag->desc[idx].pkg)
+							: eDesc_ori == e_desc
+							  ? strlen(flag->desc[idx].desc)
+							  : strlen(flag->desc[idx].desc_alt)
+						 + 1;
+				wrapPart = wrapPart->next;
+			}
+
+			// aaaaand go:
+			sprintf(buf + minwidth + (newDesc ? 8 : 10), "%-*.*s", (int)length, (int)length,
+				strlen(desc) > pos
+					? &desc[pos]
 					: "");
 
 			/* Set correct color set according to highlighting and status*/
@@ -401,7 +455,9 @@ static int drawflag(sFlag* flag, bool highlight)
 
 			++line;
 			++usedY;
-		}
+			if (NULL == wrapPart)
+				++idx;
+		} // End of looping descriptions while there are lines left
 	} else {
 		memset(buf+minwidth, ' ', wWidth(List)-minwidth);
 		buf[wWidth(List)] = '\0';


^ permalink raw reply related	[flat|nested] 238+ messages in thread
* [gentoo-commits] proj/ufed:master commit in: /
@ 2013-09-20  8:30 Sven Eden
  0 siblings, 0 replies; 238+ messages in thread
From: Sven Eden @ 2013-09-20  8:30 UTC (permalink / raw
  To: gentoo-commits

commit:     dd3865c8e95cf5ee10fef1c6a0c4ad1b0fbf02cc
Author:     Sven Eden <yamakuzure <AT> gmx <DOT> net>
AuthorDate: Tue Sep 17 06:50:54 2013 +0000
Commit:     Sven Eden <sven.eden <AT> gmx <DOT> de>
CommitDate: Tue Sep 17 06:50:54 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/ufed.git;a=commit;h=dd3865c8

drawFlag(): Added skipping of individual wrapped description parts when searching the start of a flag with enabled description wrapping.

---
 ufed-curses-checklist.c | 53 +++++++++++++++++++++++++++++++++++++++----------
 1 file changed, 43 insertions(+), 10 deletions(-)

diff --git a/ufed-curses-checklist.c b/ufed-curses-checklist.c
index f55cf66..9aaf35f 100644
--- a/ufed-curses-checklist.c
+++ b/ufed-curses-checklist.c
@@ -202,11 +202,12 @@ static void free_flags(void)
 
 static int drawflag(sFlag* flag, bool highlight)
 {
-	int  idx     = 0;
-	int  usedY   = 0;
-	int  line    = flag->currline;
-	char buf[wWidth(List)+1];
-	char desc[maxDescWidth];
+	int    idx     = 0;
+	int    usedY   = 0;
+	int    line    = flag->currline;
+	char   buf[wWidth(List)+1];
+	char   desc[maxDescWidth];
+	sWrap* wrapPart = NULL;
 
 	// Return early if there is nothing to display:
 	if (!isFlagLegal(flag))
@@ -216,15 +217,47 @@ static int drawflag(sFlag* flag, bool highlight)
 	 * Overly long description lists might not fit on one screen,
 	 * and therefore must be scrolled instead of the flags
 	 * themselves.
+	 * If descriptions are wrapped, any description must be held
+	 * until wrapPart is either NULL, or a part on the screen is
+	 * reached.
 	 */
 	if (line < 0) {
 		if (-line < getFlagHeight(flag)) {
 			while (line < 0) {
-				if (isDescLegal(flag, idx++)) {
-					++line;
-					++usedY;
-				}
-			}
+				if (isDescLegal(flag, idx)) {
+					if (eWrap_normal == e_wrap) {
+						++line;
+						++usedY;
+						++idx;
+					} else {
+						/* With wrapped descriptions there are two possible
+						 * situations:
+						 * a) The list of wrapped lines is shorter than the
+						 *    lines to be skipped to get this description on
+						 *    the screen. In this case the full description
+						 *    can be fast forwareded.
+						 * b) The number of lines above the screen is less
+						 *    than the number of wrapped parts. In this case
+						 *    the first on screen part must be found.
+						 */
+						int wrapCount = flag->desc[idx].wrapCount;
+						wrapPart = flag->desc[idx].wrap;
+						if (wrapPart && wrapCount && (-line < wrapCount)) {
+							// Situation b) This description enters screen
+							while (wrapPart && (line < 0)) {
+								++line;
+								++usedY;
+								wrapPart = wrapPart->next;
+							}
+						} else {
+							// Situation a) Fast forward
+							line += wrapCount;
+							usedY += wrapCount;
+							++idx;
+						}
+					} // End of handling wrapped lines
+				} // End of having a legal flag
+			} // end of moving to line 0
 		} else
 			// Otherwise this item is out of the display area
 			return 0;


^ permalink raw reply related	[flat|nested] 238+ messages in thread
* [gentoo-commits] proj/ufed:master commit in: /
@ 2013-09-20  8:30 Sven Eden
  0 siblings, 0 replies; 238+ messages in thread
From: Sven Eden @ 2013-09-20  8:30 UTC (permalink / raw
  To: gentoo-commits

commit:     960cc1b3587cf63bc99e1a8976c10b110aafb5d1
Author:     Sven Eden <yamakuzure <AT> gmx <DOT> net>
AuthorDate: Mon Sep 16 06:35:37 2013 +0000
Commit:     Sven Eden <sven.eden <AT> gmx <DOT> de>
CommitDate: Mon Sep 16 06:35:37 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/ufed.git;a=commit;h=960cc1b3

types: Added calculation of wrapped description parameters.

---
 ufed-curses-checklist.c |   6 +-
 ufed-curses-types.c     | 154 ++++++++++++++++++++++++++++++++++++++++++++----
 2 files changed, 144 insertions(+), 16 deletions(-)

diff --git a/ufed-curses-checklist.c b/ufed-curses-checklist.c
index 61e0de5..f55cf66 100644
--- a/ufed-curses-checklist.c
+++ b/ufed-curses-checklist.c
@@ -202,11 +202,11 @@ static void free_flags(void)
 
 static int drawflag(sFlag* flag, bool highlight)
 {
+	int  idx     = 0;
+	int  usedY   = 0;
+	int  line    = flag->currline;
 	char buf[wWidth(List)+1];
 	char desc[maxDescWidth];
-	int idx   = 0;
-	int usedY = 0;
-	int line  = flag->currline;
 
 	// Return early if there is nothing to display:
 	if (!isFlagLegal(flag))

diff --git a/ufed-curses-types.c b/ufed-curses-types.c
index 2ccfa9a..b61ec38 100644
--- a/ufed-curses-types.c
+++ b/ufed-curses-types.c
@@ -21,6 +21,10 @@ extern eMask  e_mask;
 extern eScope e_scope;
 extern eState e_state;
 
+/* internal prototypes of functions only used here */
+static void calculateDescWrap(sDesc* desc);
+static void destroyWrapList(sWrap* wrap);
+
 /* function implementations */
 
 /** @brief create a new flag without description lines
@@ -219,16 +223,7 @@ void destroyFlag (sFlag** root, sFlag** flag)
 				free (xFlag->desc[i].desc);
 			if (xFlag->desc[i].desc_alt)
 				free (xFlag->desc[i].desc_alt);
-			if (xFlag->desc[i].wrap) {
-				sWrap* wrapRoot = xFlag->desc[i].wrap;
-				sWrap* wrapNext = wrapRoot ? wrapRoot->next : NULL;
-				xFlag->desc[i].wrap = NULL;
-				while (wrapRoot) {
-					free (wrapRoot);
-					wrapRoot = wrapNext;
-					wrapNext = wrapRoot ? wrapRoot->next : NULL;
-				}
-			}
+			destroyWrapList(xFlag->desc[i].wrap);
 		}
 		if (xFlag->desc)
 			free (xFlag->desc);
@@ -298,6 +293,8 @@ void genFlagStats (sFlag* flag)
 /** @brief determine the number of lines used by @a flag
  *  This method checks the flag and its description line(s)
  *  settings against the globally active filters.
+ *  If line wrapping is active, the wrap settings are
+ *  recalculated if neccessary.
  *  If @a flag is NULL, the result will be 0.
  *  @param[in] flag pointer to the flag to check.
  *  @return number of lines needed to display the line *without* possible line wrapping.
@@ -307,9 +304,31 @@ int getFlagHeight (const sFlag* flag)
 	int result = 0;
 
 	if (flag) {
-		for (int i = 0; i < flag->ndesc; ++i)
-			result += isDescLegal(flag, i) ? 1 : 0;
-	}
+		size_t maxLen = wWidth(List) - (minwidth + 8);;
+		for (int i = 0; i < flag->ndesc; ++i) {
+			if (isDescLegal(flag, i)) {
+				if (eWrap_normal == e_wrap)
+					++result;
+				else {
+					/* Check settings. The calculations must not
+					 * be done unless neccessary to not cripple
+					 * performance.
+					 */
+					sDesc* desc = &(flag->desc[i]);
+					if ( !desc->wrap
+					  || (desc->wrapWidth != maxLen)
+					  || (desc->wrapOrder != e_order)
+					  || (desc->wrapStripped != e_desc) ) {
+						desc->wrapWidth    = maxLen;
+						desc->wrapOrder    = e_order;
+						desc->wrapStripped = e_desc;
+						calculateDescWrap(desc);
+					}
+					result += desc->wrapCount;
+				}
+			} // End of having a legal flag
+		} // End of looping descriptions
+	} // End of having a flag
 
 	return result;
 }
@@ -494,3 +513,112 @@ void setKeyDispLen(sKey* keys, size_t dispWidth)
 		} // End of having a key
 	} // End of setting button display lengths
 }
+
+
+/* === Internal functions only used here === */
+
+/// @brief calculate the current wrap chain for description @a desc
+static void calculateDescWrap(sDesc* desc)
+{
+	if (desc) {
+		sWrap* curr  = desc->wrap;
+		sWrap* next  = NULL;
+		char*  pDesc = eDesc_ori == desc->wrapStripped ? desc->desc : desc->desc_alt;
+		char*  pPkg  = desc->pkg;
+		char*  pch   = eOrder_left == desc->wrapOrder ? pPkg : pDesc;
+		size_t start = 0;
+		size_t end   = 0;
+		size_t width = desc->wrapWidth - 2; // Foloow-up lines are indented
+		size_t dLen  = strlen(pDesc);
+		size_t pLen  = strlen(pPkg);
+		size_t left  = dLen + pLen;
+		size_t wLen  = eOrder_left == desc->wrapOrder ? pLen : dLen;
+
+		/* To go by next a valid curr is needed first */
+		if (NULL == curr) {
+			curr = (sWrap*)malloc(sizeof(sWrap));
+			if (curr) {
+				curr->len  = 0;
+				curr->next = NULL;
+				curr->pos  = 0;
+				desc->wrap = curr;
+			} else
+				ERROR_EXIT(-1, "Unable to allocate %lu bytes for sWrap_ struct\n", sizeof(sWrap))
+		}
+
+		/* Now distribute all characters */
+		while (left) {
+
+			// Step 1: Set current wrap part end
+			end = start + width + (curr == desc->wrap ? 2 : 0);
+			if (end >= wLen)
+				end = wLen - 1;
+
+			// Step 2: Find last space character before end+1
+			if (' ' != pch[end]) {
+				size_t newEnd = end;
+				for (; (newEnd > start) && (' ' != pch[newEnd]) ; --newEnd) ;
+				if (newEnd > start)
+					end = newEnd;
+			}
+
+			// Step 3: Note values and increase start
+			curr->pos = start;
+			curr->len = end - start;
+			start += curr->len;
+			left  -= curr->len;
+
+			// Step 4: Switch if the current string is exhausted:
+			if (left && (end == (wLen - 1))) {
+				if (eOrder_left == desc->wrapOrder) {
+					// Switch from pkg to desc
+					pch  = pDesc;
+					wLen = dLen;
+				} else {
+					// Switch from desc to pkg
+					pch  = pPkg;
+					wLen = pLen;
+				}
+				start = 0;
+			} // End of having to swap pkg/desc
+
+			// Step 5: Extend if needed
+			next = curr->next;
+			if (left && !next) {
+				next = (sWrap*)malloc(sizeof(sWrap));
+				if (next) {
+					next->len  = 0;
+					next->next = NULL;
+					next->pos  = 0;
+					curr->next = next;
+				} else
+					ERROR_EXIT(-1, "Unable to allocate %lu bytes for sWrap_ struct\n", sizeof(sWrap))
+			}
+
+			// Step 6: Clean up if done
+			if (!left && next) {
+				curr->next = NULL;
+				destroyWrapList(next);
+				next = NULL;
+			}
+
+			// Step 7: Advance
+			curr = next;
+		} // End of having characters left to distribute
+	} // End of having a not NULL pointer
+}
+
+
+/// @brief destroy one sWrap singly linked list
+static void destroyWrapList(sWrap* wrap)
+{
+	if (wrap) {
+		sWrap* wrapRoot = wrap;
+		sWrap* wrapNext = wrapRoot ? wrapRoot->next : NULL;
+		while (wrapRoot) {
+			free (wrapRoot);
+			wrapRoot = wrapNext;
+			wrapNext = wrapRoot ? wrapRoot->next : NULL;
+		}
+	}
+}


^ permalink raw reply related	[flat|nested] 238+ messages in thread
* [gentoo-commits] proj/ufed:master commit in: /
@ 2013-09-20  8:30 Sven Eden
  0 siblings, 0 replies; 238+ messages in thread
From: Sven Eden @ 2013-09-20  8:30 UTC (permalink / raw
  To: gentoo-commits

commit:     c1c2d4e2581a150a267a8d9851d4492bae8c4f34
Author:     Sven Eden <yamakuzure <AT> gmx <DOT> net>
AuthorDate: Wed Sep 18 06:48:36 2013 +0000
Commit:     Sven Eden <sven.eden <AT> gmx <DOT> de>
CommitDate: Wed Sep 18 06:48:36 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/ufed.git;a=commit;h=c1c2d4e2

drawFlag(): Moved finding the starting description / wrapped line out of the function into the new static function findFlagStart()

---
 ufed-curses-checklist.c | 143 ++++++++++++++++++++++++++++--------------------
 1 file changed, 83 insertions(+), 60 deletions(-)

diff --git a/ufed-curses-checklist.c b/ufed-curses-checklist.c
index ee11b10..8425997 100644
--- a/ufed-curses-checklist.c
+++ b/ufed-curses-checklist.c
@@ -19,6 +19,7 @@ static char*   lineBuf         = NULL;
 static sFlag*  flags           = NULL;
 
 /* internal prototypes */
+static int  findFlagStart(sFlag* flag, int* index, sWrap** wrap, int* line, bool* isFirstWrap);
 static void free_flags(void);
 
 
@@ -202,71 +203,26 @@ static void free_flags(void)
 
 static int drawflag(sFlag* flag, bool highlight)
 {
-	int    idx       = 0;
-	int    usedY     = 0;
+	// Return early if there is nothing to display:
+	if (!isFlagLegal(flag))
+		return 0;
+
+	// Get the starting description/wrapped line of the flag
+	int    idx       = 0;    // The description index to start with
 	int    line      = flag->currline;
-	char   buf[wWidth(List)+1];
-	char   desc[maxDescWidth];
-	sWrap* wrapPart  = NULL;
+	int    usedY     = 0;    // Counts how many lines this flag really needs to display
+	sWrap* wrapPart  = NULL; // Wrap part to begin with/draw
 	bool   wrapFirst = true; // The first part, pkg or desc
 
-	// Return early if there is nothing to display:
-	if (!isFlagLegal(flag))
+	if ((line < 0)
+	  && (0 == (usedY = findFlagStart(flag, &idx, &wrapPart, &line, &wrapFirst))) )
 		return 0;
 
-	/* Determine with which description to start.
-	 * Overly long description lists might not fit on one screen,
-	 * and therefore must be scrolled instead of the flags
-	 * themselves.
-	 * If descriptions are wrapped, any description must be held
-	 * until wrapPart is either NULL, or a part on the screen is
-	 * reached.
-	 */
-	if (line < 0) {
-		if (-line < getFlagHeight(flag)) {
-			while (line < 0) {
-				if (isDescLegal(flag, idx)) {
-					if (eWrap_normal == e_wrap) {
-						++line;
-						++usedY;
-						++idx;
-					} else {
-						/* With wrapped descriptions there are two possible
-						 * situations:
-						 * a) The list of wrapped lines is shorter than the
-						 *    lines to be skipped to get this description on
-						 *    the screen. In this case the full description
-						 *    can be fast forwareded.
-						 * b) The number of lines above the screen is less
-						 *    than the number of wrapped parts. In this case
-						 *    the first on screen part must be found.
-						 */
-						int wrapCount = flag->desc[idx].wrapCount;
-						wrapPart = flag->desc[idx].wrap;
-						if (wrapPart && wrapCount && (-line < wrapCount)) {
-							// Situation b) This description enters screen
-							while (wrapPart && (line < 0)) {
-								++line;
-								++usedY;
-								wrapPart = wrapPart->next;
-								if (wrapPart && !wrapPart->pos)
-									wrapFirst = false;
-								// Note: The wrap parts are already calculated
-								//       to resemble the current order.
-							}
-						} else {
-							// Situation a) Fast forward
-							line += wrapCount;
-							usedY += wrapCount;
-							++idx;
-						}
-					} // End of handling wrapped lines
-				} // End of having a legal flag
-			} // end of moving to line 0
-		} else
-			// Otherwise this item is out of the display area
-			return 0;
-	}
+
+	char   buf[wWidth(List)+1];
+	char   desc[maxDescWidth];
+
+
 
 	memset(buf, 0, sizeof(char) * (wWidth(List)+1));
 
@@ -715,6 +671,73 @@ static int callback(sFlag** curr, int key)
 	return -1;
 }
 
+/** @brief find the first description/wrapped part drawn on line 0.
+  *
+  * Determine with which description to start.
+  * Overly long description lists might not fit on one screen,
+  * and therefore must be scrolled instead of the flags
+  * themselves.
+  * If descriptions are wrapped, any description must be held
+  * until wrapPart is either NULL, or a part on the screen is
+  * reached.
+**/
+static int findFlagStart(sFlag* flag, int* index, sWrap** wrap, int* line, bool* isFirstWrap)
+{
+	int    usedLines  = 0;
+	int    flagHeight = getFlagHeight(flag); // Will recalculate wrap parts if needed
+	sWrap* wrapPart = NULL;
+
+	if ( (*line < 0) && (-(*line) < flagHeight) ){
+
+		while (*line < 0) {
+			if (isDescLegal(flag, *index)) {
+				if (eWrap_normal == e_wrap) {
+					++(*line);
+					++usedLines;
+					++(*index);
+				} else {
+					/* With wrapped descriptions there are two possible
+					 * situations:
+					 * a) The list of wrapped lines is shorter than the
+					 *    lines to be skipped to get this description on
+					 *    the screen. In this case the full description
+					 *    can be fast forwareded.
+					 * b) The number of lines above the screen is less
+					 *    than the number of wrapped parts. In this case
+					 *    the first on screen part must be found.
+					 */
+					int wrapCount = flag->desc[*index].wrapCount;
+					wrapPart      = flag->desc[*index].wrap;
+					*isFirstWrap  = true;
+					if (wrapPart && wrapCount && (-(*line) < wrapCount)) {
+						// Situation b) This description enters screen
+						while (wrapPart && (*line < 0)) {
+							++(*line);
+							++usedLines;
+							wrapPart = wrapPart->next;
+							if (wrapPart && !wrapPart->pos)
+								*isFirstWrap = false;
+							// Note: The wrap parts are already calculated
+							//       to resemble the current order.
+						}
+					} else {
+						// Situation a) Fast forward
+						*line     += wrapCount;
+						usedLines += wrapCount;
+						++(*index);
+					}
+				} // End of handling wrapped lines
+			} // End of having a legal flag
+		} // end of moving to line 0
+
+		// Write back wrapPart:
+		*wrap = wrapPart;
+	}
+
+	return usedLines;
+}
+
+
 int main(void)
 {
 	int result = EXIT_SUCCESS;


^ permalink raw reply related	[flat|nested] 238+ messages in thread
* [gentoo-commits] proj/ufed:master commit in: /
@ 2013-09-20  8:30 Sven Eden
  0 siblings, 0 replies; 238+ messages in thread
From: Sven Eden @ 2013-09-20  8:30 UTC (permalink / raw
  To: gentoo-commits

commit:     935d0d8e9eba3278823099f5d8762c9afb879847
Author:     Sven Eden <yamakuzure <AT> gmx <DOT> net>
AuthorDate: Fri Sep 13 05:17:11 2013 +0000
Commit:     Sven Eden <sven.eden <AT> gmx <DOT> de>
CommitDate: Fri Sep 13 05:17:11 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/ufed.git;a=commit;h=935d0d8e

Enabled new key button F11 to toggle line wrapping

---
 ufed-curses-checklist.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/ufed-curses-checklist.c b/ufed-curses-checklist.c
index 8511a87..61e0de5 100644
--- a/ufed-curses-checklist.c
+++ b/ufed-curses-checklist.c
@@ -663,8 +663,9 @@ int main(void)
 
 		/* Row 0 right - Display style (description) */
 		MAKE_KEY(-1, "  ", "", "", "", NULL, 0),
-		MAKE_KEY(KEY_F( 9), "F9:",  "Pkg right",  "Pkg left",  "", (int*)&e_order, 0),
-		MAKE_KEY(KEY_F(10), "F10:", "Strip desc", "Full desc", "", (int*)&e_desc,  0),
+		MAKE_KEY(KEY_F( 9), "F9:",  "Pkg right",  "Pkg left",    "", (int*)&e_order, 0),
+		MAKE_KEY(KEY_F(10), "F10:", "Strip desc", "Full desc",   "", (int*)&e_desc,  0),
+		MAKE_KEY(KEY_F(11), "F11:", "Wrap desc",  "Unwrap desc", "", (int*)&e_wrap,  0),
 
 		/* Row 1 - Filter settings */
 		MAKE_KEY(-1, "Filter: ", "", "", "", NULL, 1),
@@ -674,8 +675,7 @@ int main(void)
 		MAKE_KEY(0, "", "", "", "", NULL, 0), /* processing stops here (row _MUST_ be 0 here!) */
 
 		/* future keys, that are planned */
-		MAKE_KEY(KEY_F( 8), "F8:",  "Unknown flags", "Known flags", "all", NULL, 1),
-		MAKE_KEY(KEY_F(11), "F11:", "Wrap desc", "Unwrap desc", "", NULL, 0)
+		MAKE_KEY(KEY_F( 8), "F8:",  "Unknown flags", "Known flags", "all", NULL, 1)
 	};
 
 	result = maineventloop(ro_mode ? subtitle_ro : subtitle_rw,


^ permalink raw reply related	[flat|nested] 238+ messages in thread
* [gentoo-commits] proj/ufed:master commit in: /
@ 2013-09-11  7:09 Sven Eden
  0 siblings, 0 replies; 238+ messages in thread
From: Sven Eden @ 2013-09-11  7:09 UTC (permalink / raw
  To: gentoo-commits

commit:     8912c242402f6a14ae31857bb4b75d950a371b06
Author:     Sven Eden <yamakuzure <AT> gmx <DOT> net>
AuthorDate: Wed Sep 11 07:09:15 2013 +0000
Commit:     Sven Eden <sven.eden <AT> gmx <DOT> de>
CommitDate: Wed Sep 11 07:09:15 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/ufed.git;a=commit;h=8912c242

Updated the fix for bug #478318 - It is more reliable now.

---
 Portage.pm | 21 ++++++++++++---------
 1 file changed, 12 insertions(+), 9 deletions(-)

diff --git a/Portage.pm b/Portage.pm
index a010186..dc7b964 100644
--- a/Portage.pm
+++ b/Portage.pm
@@ -264,24 +264,28 @@ sub _add_temp
 }
 
 
-# Determine the value for EPREFIX and save it
-# in $_EPREFIX. This is done using 'portageq'.
+# Determine the values for EPREFIX, PORTDIR
+# and PORTDIR_OVERLAY. These are saved in
+# $_EPREFIX, $_PORTDIR and $_PORTDIR_OVERLAY.
+# This is done using 'portageq'.
 # Other output from portageq is printed on
 # STDERR.
 # No parameters accepted.
 sub _determine_eprefix_portdir {
 	my $tmp = "/tmp/ufed_$$.tmp";
 	my @res = map {
-		my $x=$_;
+		my $x = $_;
 		chomp $x;
-		$x =~ s/^.*'([^']*)'.*$/$1/;
+		$x =~ s/'//g;
 		$x
 	} qx{portageq envvar -v EPREFIX PORTDIR PORTDIR_OVERLAY 2>$tmp};
 	
-	if (scalar @res) {
-		$_EPREFIX         = $res[0];
-		$_PORTDIR         = $res[1];
-		$_PORTDIR_OVERLAY = $res[2];
+	while (my $res = shift @res) {
+		if ($res =~ /^(.*)=(.*)$/) {
+			"EPREFIX"         eq $1 and $_EPREFIX         = $2;
+			"PORTDIR"         eq $1 and $_PORTDIR         = $2;
+			"PORTDIR_OVERLAY" eq $1 and $_PORTDIR_OVERLAY = $2;
+		}
 		debugMsg("EPREFIX='${_EPREFIX}'");
 		debugMsg("PORTDIR='${_PORTDIR}'");
 		debugMsg("PORTDIR_OVERLAY='${_PORTDIR_OVERLAY}'");
@@ -296,7 +300,6 @@ sub _determine_eprefix_portdir {
 	}
 	-e $tmp and unlink $tmp;
 
-	chomp($_EPREFIX);
 	return;
 }
 


^ permalink raw reply related	[flat|nested] 238+ messages in thread
* [gentoo-commits] proj/ufed:master commit in: /
@ 2013-09-11  6:31 Sven Eden
  0 siblings, 0 replies; 238+ messages in thread
From: Sven Eden @ 2013-09-11  6:31 UTC (permalink / raw
  To: gentoo-commits

commit:     d7dfe626236b0c561da552f6644cd7e38f52c39f
Author:     Sven Eden <yamakuzure <AT> gmx <DOT> net>
AuthorDate: Wed Sep 11 06:31:47 2013 +0000
Commit:     Sven Eden <sven.eden <AT> gmx <DOT> de>
CommitDate: Wed Sep 11 06:31:47 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/ufed.git;a=commit;h=d7dfe626

Portage.pm: Use portageq to determine not only EPREFIX, but PORTDIR and PORTDIR_OVERLAY, too.

---
 Portage.pm | 46 ++++++++++++++++++++++++++++++----------------
 1 file changed, 30 insertions(+), 16 deletions(-)

diff --git a/Portage.pm b/Portage.pm
index e0d08a8..a010186 100644
--- a/Portage.pm
+++ b/Portage.pm
@@ -56,11 +56,13 @@ our $used_make_conf = "";
 our $ro_mode = 0;
 
 # --- private members ---
-my %_environment  = ();
-my $_EPREFIX        = "";
-my @_profiles     = ();
-my %_use_eh_safe  = (); ## USE_EXPAND_HIDDEN safe hash. See _read_make_defaults()
-my %_use_order    = ();
+my %_environment     = ();
+my $_EPREFIX         = "";
+my $_PORTDIR         = "";
+my $_PORTDIR_OVERLAY = "";
+my @_profiles        = ();
+my %_use_eh_safe     = (); ## USE_EXPAND_HIDDEN safe hash. See _read_make_defaults()
+my %_use_order       = ();
 
 # $_use_temp - hashref that represents the current state of
 # all known flags. This is for data gathering, the public
@@ -98,7 +100,7 @@ sub debugMsg;
 # --- private methods ---
 sub _add_flag;
 sub _add_temp;
-sub _determine_eprefix;
+sub _determine_eprefix_portdir;
 sub _determine_make_conf;
 sub _determine_profiles;
 sub _final_cleaning;
@@ -124,7 +126,7 @@ sub _remove_expands;
 # --- Package initialization ---
 INIT {
 	$_environment{$_} = {} for qw{USE USE_EXPAND USE_EXPAND_HIDDEN};
-	_determine_eprefix;
+	_determine_eprefix_portdir;
 	_determine_make_conf;
 	_determine_profiles;
 	_read_make_globals;
@@ -267,10 +269,24 @@ sub _add_temp
 # Other output from portageq is printed on
 # STDERR.
 # No parameters accepted.
-sub _determine_eprefix {
+sub _determine_eprefix_portdir {
 	my $tmp = "/tmp/ufed_$$.tmp";
-	$_EPREFIX = qx{portageq envvar EPREFIX 2>$tmp};
-	die "Couldn't determine EPREFIX from Portage" if $? != 0;
+	my @res = map {
+		my $x=$_;
+		chomp $x;
+		$x =~ s/^.*'([^']*)'.*$/$1/;
+		$x
+	} qx{portageq envvar -v EPREFIX PORTDIR PORTDIR_OVERLAY 2>$tmp};
+	
+	if (scalar @res) {
+		$_EPREFIX         = $res[0];
+		$_PORTDIR         = $res[1];
+		$_PORTDIR_OVERLAY = $res[2];
+		debugMsg("EPREFIX='${_EPREFIX}'");
+		debugMsg("PORTDIR='${_PORTDIR}'");
+		debugMsg("PORTDIR_OVERLAY='${_PORTDIR_OVERLAY}'");
+	}
+	die "Couldn't determine EPREFIX and PORTDIR from Portage" if $? != 0;
 
 	if ( -s $tmp ) {
 		if (open (my $fTmp, "<", $tmp)) {
@@ -771,13 +787,11 @@ sub _read_make_conf {
 	}
 	
 	# Add PORTDIR and overlays to @_profiles
-	defined ($_environment{PORTDIR})
-		and push @_profiles, "$_environment{PORTDIR}/profiles"
+	length ($_PORTDIR)
+		and push @_profiles, "${_PORTDIR}/profiles"
 		or  die("Unable to determine PORTDIR!\nSomething is seriously broken here!\n");
-	defined ($_environment{PORTDIR_OVERLAY})
-		and push @_profiles,
-				map { my $x=$_; $x =~ s/^\s*(\S+)\s*$/$1\/profiles/mg ; $x }
-				split('\n', $_environment{PORTDIR_OVERLAY});
+	length ($_PORTDIR_OVERLAY)
+		and push @_profiles, split(' ', $_PORTDIR_OVERLAY);
 	-e "${_EPREFIX}/etc/portage/profile"
 		and push @_profiles, "${_EPREFIX}/etc/portage/profile";
 	return;


^ permalink raw reply related	[flat|nested] 238+ messages in thread
* [gentoo-commits] proj/ufed:master commit in: /
@ 2013-09-11  6:04 Sven Eden
  0 siblings, 0 replies; 238+ messages in thread
From: Sven Eden @ 2013-09-11  6:04 UTC (permalink / raw
  To: gentoo-commits

commit:     43c4bad5f7147c07e08da6c168db940dee79c096
Author:     Sven Eden <yamakuzure <AT> gmx <DOT> net>
AuthorDate: Wed Sep 11 05:33:18 2013 +0000
Commit:     Sven Eden <sven.eden <AT> gmx <DOT> de>
CommitDate: Wed Sep 11 05:33:18 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/ufed.git;a=commit;h=43c4bad5

Added all addition/changes about the buttons, the new filter F10 and the new layout of the indicator line to the man page.

---
 ufed.8.in | 31 +++++++++++++++++++++++++++++++
 1 file changed, 31 insertions(+)

diff --git a/ufed.8.in b/ufed.8.in
index 2f4d19d..59cbfaa 100644
--- a/ufed.8.in
+++ b/ufed.8.in
@@ -117,6 +117,7 @@ will change to.
 F9: Toggle the order of the affected package list and the description.
 .br
 F10: Toggle whether to display the full description or a stripped version.
+
 The stripped version has various wordings like "Enables support for" or
 "Build and install the" at the beginning of the description removed.
 Although somewhat crippled, the descriptions key information then needs
@@ -127,6 +128,36 @@ cases; even on low resolution displays.
 The default is to display the full description preceeded by the list of
 affected packages.
 
+Below the list of descriptions an indicator line is displayed that shows the
+current setting of all filters and settings.
+.br
+The order and layout is:
+.br
+[Scope|State|Mask|Order|Description] with
+.br
+Scope:
+  glob : Global USE flags are shown.
+  loca : Local USE flags are shown.
+  all  : All USE flags are shown.
+.br
+State:
+  inst : USE flags affecting installed packages are shown.
+  noti : USE flags affecting not installed packages are shown.
+  all  : All USE flags are shown
+.br
+Mask:
+  mask : Masked and forced USE flags are shown
+  norm : USE flags that are neither masked nor forced are shown.
+  all  : All USE flags are shown.
+.br
+Order:
+  left : The list of affected packages is shown left of the description.
+  righ : The list of affected packages is shown right of the description.
+.br
+Description:
+  orig : The original full description is shown.
+  stri : The stripped version of the description is shown.
+
 If ncurses is installed with the "gpm" use flag enabled, you can use your
 mouse to navigate and to toggle the settings, too.
 


^ permalink raw reply related	[flat|nested] 238+ messages in thread
* [gentoo-commits] proj/ufed:master commit in: /
@ 2013-09-11  6:04 Sven Eden
  0 siblings, 0 replies; 238+ messages in thread
From: Sven Eden @ 2013-09-11  6:04 UTC (permalink / raw
  To: gentoo-commits

commit:     fef9b535c214a126c291cb3b0b2dc06b5dea180e
Author:     Sven Eden <yamakuzure <AT> gmx <DOT> net>
AuthorDate: Wed Sep 11 05:37:47 2013 +0000
Commit:     Sven Eden <sven.eden <AT> gmx <DOT> de>
CommitDate: Wed Sep 11 05:37:47 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/ufed.git;a=commit;h=fef9b535

ufed.pl.in: Fixed a typo.

---
 ufed.pl.in | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/ufed.pl.in b/ufed.pl.in
index b7d8323..58e4d9c 100644
--- a/ufed.pl.in
+++ b/ufed.pl.in
@@ -16,9 +16,9 @@ my $version = 'XX_PACKAGE_VERSION@';
 
 my $interface = 'ufed-curses';
 my $gdb       = "gdb -ex run ufed-curses";
-my $memcheck  = "/usr/bin/valgrnd -v --trace-children=yes --tool=memcheck"
-			  . " --track-origins=yes --leak-check=full --show-reachable=no"
-			  . " --read-var-info=yes"
+my $memcheck  = "/usr/bin/valgrind -v --trace-children=yes --tool=memcheck"
+              . " --track-origins=yes --leak-check=full --show-reachable=no"
+              . " --read-var-info=yes"
               . " XX_libexecdir@/ufed-curses 2>/tmp/ufed_memcheck.log";
 
 sub finalise;


^ permalink raw reply related	[flat|nested] 238+ messages in thread
* [gentoo-commits] proj/ufed:master commit in: /
@ 2013-09-11  6:04 Sven Eden
  0 siblings, 0 replies; 238+ messages in thread
From: Sven Eden @ 2013-09-11  6:04 UTC (permalink / raw
  To: gentoo-commits

commit:     a63840b03f654a51a00bde898221310ac6aae4c2
Author:     Sven Eden <yamakuzure <AT> gmx <DOT> net>
AuthorDate: Wed Sep 11 05:32:59 2013 +0000
Commit:     Sven Eden <sven.eden <AT> gmx <DOT> de>
CommitDate: Wed Sep 11 05:32:59 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/ufed.git;a=commit;h=a63840b0

Added all addition/changes about the buttons, the new filter F10 and the new layout of the indicator line to the help screen text.

---
 ufed-curses-help.c | 34 +++++++++++++++++++++++++++++-----
 1 file changed, 29 insertions(+), 5 deletions(-)

diff --git a/ufed-curses-help.c b/ufed-curses-help.c
index eddedf4..ea0c586 100644
--- a/ufed-curses-help.c
+++ b/ufed-curses-help.c
@@ -129,12 +129,12 @@ static void init_lines(void)
 "You can apply various filters on the flags to display. The text of the bottom "
 "line buttons show, which filter the button (or key press) will switch to.",
 "",
-" F5: Toggle display of local / global / all flag descriptions.",
+" F5 : Toggle display of local / global / all flag descriptions.",
 "",
-" F6: Toggle display of flags supported by at least one installed "
+" F6 : Toggle display of flags supported by at least one installed "
 "package / supported by no installed package / all flags.",
 "",
-" F7: Toggle display of masked and forced flags / flags that are "
+" F7 : Toggle display of masked and forced flags / flags that are "
 "neither masked nor forced / all flags."
 "",
 "The default is to display all flags that are neither masked nor forced.",
@@ -143,9 +143,10 @@ static void init_lines(void)
 "bottom line buttons show, which way the button (or key press) the display "
 "will change to.",
 "",
-" F9: Toggle the order of the affected package list and the description.",
+" F9 : Toggle the order of the affected package list and the description.",
+"",
+" F10: Toggle whether to display the full description or a stripped version.",
 "",
-" F10: Toggle whether to display the full description or a stripped version. "
 "The stripped version has various wordings like \"Enables support for\" or "
 "\"Build and install the\" at the beginning of the description removed.",
 "Although somewhat crippled, the descriptions key information then needs "
@@ -156,6 +157,29 @@ static void init_lines(void)
 "The default is to display the full description preceeded by the list of "
 "affected packages.",
 "",
+"Below the list of descriptions an indicator line is displayed that shows the "
+"current setting of all filters and settings.",
+"The order and layout is:",
+"[Scope|State|Mask|Order|Description] with",
+"Scope:",
+"  glob : Global USE flags are shown.",
+"  loca : Local USE flags are shown.",
+"  all  : All USE flags are shown.",
+"State:",
+"  inst : USE flags affecting installed packages are shown.",
+"  noti : USE flags affecting not installed packages are shown.",
+"  all  : All USE flags are shown",
+"Mask:",
+"  mask : Masked and forced USE flags are shown",
+"  norm : USE flags that are neither masked nor forced are shown.",
+"  all  : All USE flags are shown.",
+"Order:",
+"  left : The list of affected packages is shown left of the description.",
+"  righ : The list of affected packages is shown right of the description.",
+"Description:",
+"  orig : The original full description is shown.",
+"  stri : The stripped version of the description is shown.",
+"",
 "If ncurses is installed with the \"gpm\" use flag enabled, you can use your "
 "mouse to navigate and to toggle the settings, too.",
 "",


^ permalink raw reply related	[flat|nested] 238+ messages in thread
* [gentoo-commits] proj/ufed:master commit in: /
@ 2013-09-11  6:04 Sven Eden
  0 siblings, 0 replies; 238+ messages in thread
From: Sven Eden @ 2013-09-11  6:04 UTC (permalink / raw
  To: gentoo-commits

commit:     11c00030ffec04f7007f3c1562fb4cc36cccf748
Author:     Sven Eden <yamakuzure <AT> gmx <DOT> net>
AuthorDate: Wed Sep 11 05:31:23 2013 +0000
Commit:     Sven Eden <sven.eden <AT> gmx <DOT> de>
CommitDate: Wed Sep 11 05:31:23 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/ufed.git;a=commit;h=11c00030

Toggling description display using F9/F10 needs a full draw()

---
 ufed-curses-checklist.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/ufed-curses-checklist.c b/ufed-curses-checklist.c
index 39f4a8d..a512869 100644
--- a/ufed-curses-checklist.c
+++ b/ufed-curses-checklist.c
@@ -529,9 +529,7 @@ static int callback(sFlag** curr, int key)
 			else
 				e_order = eOrder_left;
 
-			drawFlags();
-			drawBottom(true);
-			wmove(wInp, 0, strlen(fayt));
+			draw(true);
 			break;
 
 		case KEY_F(10):
@@ -540,9 +538,7 @@ static int callback(sFlag** curr, int key)
 			else
 				e_desc = eDesc_ori;
 
-			drawFlags();
-			drawBottom(true);
-			wmove(wInp, 0, strlen(fayt));
+			draw(true);
 			break;
 
 #ifdef NCURSES_MOUSE_VERSION


^ permalink raw reply related	[flat|nested] 238+ messages in thread
* [gentoo-commits] proj/ufed:master commit in: /
@ 2013-09-11  6:04 Sven Eden
  0 siblings, 0 replies; 238+ messages in thread
From: Sven Eden @ 2013-09-11  6:04 UTC (permalink / raw
  To: gentoo-commits

commit:     e40b5a85d8ad6e97828b989164db3fcb5264c31b
Author:     Sven Eden <yamakuzure <AT> gmx <DOT> net>
AuthorDate: Wed Sep 11 05:32:14 2013 +0000
Commit:     Sven Eden <sven.eden <AT> gmx <DOT> de>
CommitDate: Wed Sep 11 05:32:14 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/ufed.git;a=commit;h=e40b5a85

Changed the indicator to show F9/F10 state as well, now in a condensed 4-char-limited line that needs less space.

---
 ufed-curses.c | 27 ++++++++++++++++++---------
 1 file changed, 18 insertions(+), 9 deletions(-)

diff --git a/ufed-curses.c b/ufed-curses.c
index 8441c56..2428cfd 100644
--- a/ufed-curses.c
+++ b/ufed-curses.c
@@ -331,15 +331,24 @@ void drawStatus(bool withSep)
 		mvwaddstr(w, 0, minwidth + 5, "Si");      // Scope, installed
 		mvwaddch (w, 0, minwidth + 7, ACS_VLINE); // After scope
 
-		// Use the unused right side to show the filter status
-		sprintf(buf, "%*s%-6s / %-13s / %-6s] ",
-			max(2, iWidth - 40 - minwidth), " [",
-			eScope_global       == e_scope ? "global" :
-			eScope_local        == e_scope ? "local" : "all",
-			eState_installed    == e_state ? "installed" :
-			eState_notinstalled == e_state ? "not installed" : "all",
-			eMask_masked        == e_mask  ? "masked" :
-			eMask_unmasked      == e_mask  ? "normal" : "all");
+		/* Use the unused right side to show the filter status
+		 * The Order and layout is:
+		 * [Scope|State|Mask|Order|Desc] with
+		 * all items limited to four characters.
+		 * 5 * 4 = 20
+		 * + 2 brackets = 22
+		 * + 4 pipes    = 26
+		*/
+		sprintf(buf, "%*s%-4s|%-4s|%-4s|%-4s|%-4s] ",
+			max(2, iWidth - 33 - minwidth), " [",
+			eScope_global         == e_scope ? "glob"
+			: eScope_local        == e_scope ? "loca" : "all",
+			eState_installed      == e_state ? "inst"
+			: eState_notinstalled == e_state ? "noti" : "all",
+			eMask_masked          == e_mask  ? "mask"
+			: eMask_unmasked      == e_mask  ? "norm" : "all",
+			eOrder_left           == e_order ? "left" : "righ",
+			eDesc_ori             == e_desc  ? "orig" : "stri");
 		waddstr(w, buf);
 	}
 


^ permalink raw reply related	[flat|nested] 238+ messages in thread
* [gentoo-commits] proj/ufed:master commit in: /
@ 2013-09-11  6:04 Sven Eden
  0 siblings, 0 replies; 238+ messages in thread
From: Sven Eden @ 2013-09-11  6:04 UTC (permalink / raw
  To: gentoo-commits

commit:     8dc2052a4bbdcfbb5c54c1374e27b95d107ab644
Author:     Sven Eden <yamakuzure <AT> gmx <DOT> net>
AuthorDate: Tue Sep 10 20:42:38 2013 +0000
Commit:     Sven Eden <sven.eden <AT> gmx <DOT> de>
CommitDate: Tue Sep 10 20:42:38 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/ufed.git;a=commit;h=8dc2052a

types: Changed enums to explicit numbers and added values to sKey to hold a seaprate name and up to three explanations.

---
 ufed-curses-types.c |  7 +++++++
 ufed-curses-types.h | 48 +++++++++++++++++++++++++++++++-----------------
 2 files changed, 38 insertions(+), 17 deletions(-)

diff --git a/ufed-curses-types.c b/ufed-curses-types.c
index 7e72967..4ca2516 100644
--- a/ufed-curses-types.c
+++ b/ufed-curses-types.c
@@ -4,11 +4,18 @@
  *  Created on: 28.01.2013
  *      Author: Sven Eden
  */
+
+
 #include "ufed-curses-types.h"
 #include "ufed-curses.h"
 #include <stdlib.h>
 #include <string.h>
 
+/* internal zero index sentry, replaces
+ * NULL argument for idx in MAKE_KEY
+ */
+int IDX_NULL_SENTRY = 0;
+
 /* external members */
 extern eMask  e_mask;
 extern eScope e_scope;

diff --git a/ufed-curses-types.h b/ufed-curses-types.h
index 3f04650..450d6a3 100644
--- a/ufed-curses-types.h
+++ b/ufed-curses-types.h
@@ -42,17 +42,17 @@
  * @brief determine whether to display the original/alternative description
 **/
 typedef enum eDesc_ {
-	eDesc_ori,
-	eDesc_alt
+	eDesc_ori = 0,
+	eDesc_alt = 1
 } eDesc;
 
 /** @enum eMask_
  *  @brief determine which flags are shown concerning masked status
 **/
 typedef enum eMask_ {
-	eMask_unmasked,
-	eMask_both,
-	eMask_masked
+	eMask_unmasked = 0,
+	eMask_masked   = 1,
+	eMask_both     = 2
 } eMask;
 
 
@@ -60,8 +60,8 @@ typedef enum eMask_ {
  *  @brief determine whether package lists are shown left or right of the description
 **/
 typedef enum eOrder_ {
-	eOrder_left,
-	eOrder_right
+	eOrder_left  = 0,
+	eOrder_right = 1
 } eOrder;
 
 
@@ -69,9 +69,9 @@ typedef enum eOrder_ {
  *  @brief determine whether global, local or all flags are listed
 **/
 typedef enum eScope_ {
-	eScope_all,
-	eScope_global,
-	eScope_local
+	eScope_all    = 0,
+	eScope_global = 1,
+	eScope_local  = 2
 } eScope;
 
 
@@ -79,9 +79,9 @@ typedef enum eScope_ {
  *  @brief determine whether installed, not installed or all packages are listed
 **/
 typedef enum eState_ {
-	eState_all,
-	eState_installed,
-	eState_notinstalled
+	eState_all          = 0,
+	eState_installed    = 1,
+	eState_notinstalled = 2
 } eState;
 
 
@@ -154,12 +154,26 @@ typedef struct sListStats_ {
  *  @brief describe one main control key
 **/
 typedef struct sKey_ {
-	int key;           //!< curses key or -1 if no key shall be used
-	const char *descr; //!< Help text to display
-	size_t length;     //!< length of the description
-	int row;           //!< On which row this key is to be displayed, 0 or 1
+	int key;              //!< curses key or -1 if no key shall be used
+	const char *name;     //!< The name of the key, like "Esc" or "F10"
+	size_t      name_len; //!< length of the name
+	const char *desc[3];  //!< Help text to display, index is the relevant enum
+	size_t      desc_len; //!< length of the (longest) description
+	int        *idx;      //!< index of descr to currently show (points to the relevant enum)
+	int         row;      //!< On which row this key is to be displayed, 0 or 1
 } sKey;
 
+/// Helper macro to initialize sKey entries
+extern int IDX_NULL_SENTRY;
+#define MAKE_KEY(key, name, d1, d2, d3, idx, row) { \
+	key, \
+	name, \
+	sizeof(name), \
+	{ d1, d2, d3 }, \
+	max(max(sizeof(d1), sizeof(d2)), sizeof(d3)), \
+	NULL != (idx) ? idx : &IDX_NULL_SENTRY, \
+	row \
+}
 
 /** @struct sWindow_
  *  @brief describe one curses window dimensions


^ permalink raw reply related	[flat|nested] 238+ messages in thread
* [gentoo-commits] proj/ufed:master commit in: /
@ 2013-09-11  6:04 Sven Eden
  0 siblings, 0 replies; 238+ messages in thread
From: Sven Eden @ 2013-09-11  6:04 UTC (permalink / raw
  To: gentoo-commits

commit:     2d2b693bc6b4d00227c8fa1a3fe1c2dad9a871d5
Author:     Sven Eden <yamakuzure <AT> gmx <DOT> net>
AuthorDate: Tue Sep 10 18:23:19 2013 +0000
Commit:     Sven Eden <sven.eden <AT> gmx <DOT> de>
CommitDate: Tue Sep 10 18:23:19 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/ufed.git;a=commit;h=2d2b693b

Added new F10 key short help

---
 ufed-curses-checklist.c | 26 +++++++++++++++-----------
 1 file changed, 15 insertions(+), 11 deletions(-)

diff --git a/ufed-curses-checklist.c b/ufed-curses-checklist.c
index f51e07b..8a39fac 100644
--- a/ufed-curses-checklist.c
+++ b/ufed-curses-checklist.c
@@ -524,6 +524,7 @@ static int callback(sFlag** curr, int key)
 			else                        e_order = eOrder_left;
 
 			drawFlags();
+			drawBottom(true);
 			wmove(wInp, 0, strlen(fayt));
 			break;
 
@@ -532,6 +533,7 @@ static int callback(sFlag** curr, int key)
 			else                     e_desc = eDesc_ori;
 
 			drawFlags();
+			drawBottom(true);
 			wmove(wInp, 0, strlen(fayt));
 			break;
 
@@ -639,19 +641,21 @@ int main(void)
 	/* The keys to use differ whether ro_mode is true or false */
 #define mkKey(x) x, sizeof(x)-1
 	sKey keys[] = {
-		{ '?',      mkKey("?: Help"),            0 },
-		{ '\n',     mkKey(ro_mode ?
+		{ '?',       mkKey("?: Help"),            0 },
+		{ '\n',      mkKey(ro_mode ?
 							"Enter: Exit"
-						:	"Enter: Save"),      0 },
-		{ '\033',   mkKey(ro_mode ?
+						:	"Enter: Save"),       0 },
+		{ '\033',    mkKey(ro_mode ?
 							"Esc: Exit"
-						:	"Esc: Cancel"),      0 },
-		{ -1,       mkKey("Toggle"),             1 },
-		{ KEY_F(5), mkKey("F5: Local/Global"),   1 },
-		{ KEY_F(6), mkKey("F6: Installed"),      1 },
-		{ KEY_F(7), mkKey("F7: Masked/Forced"),  1 },
-		{ KEY_F(9), mkKey("F9: Pkg/Desc Order"), 1 },
-		{ '\0',     mkKey(""),                   0 }
+						:	"Esc: Cancel"),       0 },
+		{ -1,        mkKey("Toggle"),             1 },
+		{ KEY_F( 5), mkKey("F5: Local/Global"),   1 },
+		{ KEY_F( 6), mkKey("F6: Installed"),      1 },
+		{ KEY_F( 7), mkKey("F7: Masked/Forced"),  1 },
+		{ -1,        mkKey("      "),             2 },
+		{ KEY_F( 9), mkKey("F9: Swap Pkg/Desc"),  2 },
+		{ KEY_F(10), mkKey("F10: Strip Desc"),    2 },
+		{ '\0',      mkKey(""),                   0 }
 	};
 #undef mkKey
 


^ permalink raw reply related	[flat|nested] 238+ messages in thread
* [gentoo-commits] proj/ufed:master commit in: /
@ 2013-09-11  6:04 Sven Eden
  0 siblings, 0 replies; 238+ messages in thread
From: Sven Eden @ 2013-09-11  6:04 UTC (permalink / raw
  To: gentoo-commits

commit:     34427f9210ac25157b70327d3aa8c478ec223a70
Author:     Sven Eden <yamakuzure <AT> gmx <DOT> net>
AuthorDate: Tue Sep 10 20:43:08 2013 +0000
Commit:     Sven Eden <sven.eden <AT> gmx <DOT> de>
CommitDate: Tue Sep 10 20:43:08 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/ufed.git;a=commit;h=34427f92

Changed the help page to support the new sKey layout

---
 ufed-curses-help.c | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/ufed-curses-help.c b/ufed-curses-help.c
index 8fce938..a7781c5 100644
--- a/ufed-curses-help.c
+++ b/ufed-curses-help.c
@@ -289,12 +289,6 @@ static void free_lines(void)
 	}
 }
 
-#define key(x) x, sizeof(x)-1
-static const sKey keys[] = {
-	{ '\033', key("Back (Esc)"), 0 },
-	{ '\0',   key(""), 0         }
-};
-#undef key
 
 static int drawline(sFlag* line, bool highlight)
 {
@@ -341,6 +335,11 @@ static int callback(sFlag** curr, int key)
 
 void help(void)
 {
+	sKey keys[] = {
+		MAKE_KEY('\033', "Esc", "Back", "", "", NULL, 0),
+		MAKE_KEY('\0',   "",    "",     "", "", NULL, 0)
+	};
+
 	if ( ((int)helpheight != wHeight(List))
 	  || ((int)helpwidth  != wWidth(List)) ) {
 		if(lines!=NULL)


^ permalink raw reply related	[flat|nested] 238+ messages in thread
* [gentoo-commits] proj/ufed:master commit in: /
@ 2013-09-11  6:04 Sven Eden
  0 siblings, 0 replies; 238+ messages in thread
From: Sven Eden @ 2013-09-11  6:04 UTC (permalink / raw
  To: gentoo-commits

commit:     fdf1955bd47e411670aacd1c67db5e0097c564e2
Author:     Sven Eden <yamakuzure <AT> gmx <DOT> net>
AuthorDate: Wed Sep 11 04:27:31 2013 +0000
Commit:     Sven Eden <sven.eden <AT> gmx <DOT> de>
CommitDate: Wed Sep 11 04:27:31 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/ufed.git;a=commit;h=fdf1955b

Updated the help text and man page to include information about the new F10 key and the change to indicate the next state via button text instead of an indicator line.

---
 ufed-curses-help.c | 26 ++++++++++++++++++++++++--
 ufed.8.in          | 26 ++++++++++++++++++++++++--
 2 files changed, 48 insertions(+), 4 deletions(-)

diff --git a/ufed-curses-help.c b/ufed-curses-help.c
index a7781c5..eddedf4 100644
--- a/ufed-curses-help.c
+++ b/ufed-curses-help.c
@@ -39,6 +39,11 @@ static void init_lines(void)
 "ufed reads the first, overrides its settings with the second, and writes "
 "changes to the second.",
 "",
+"If /etc/portage/make.conf is a directory, ufed will parse all files in this "
+"directory recursively, omitting files that begin with a '.' or end with a "
+"'~', and will read all USE flag settings that can be found. Changes are "
+"written to the last file found, overriding all others.",
+"",
 "--- What Are USE Flags? ---",
 "",
 "The USE settings system is a flexible way to enable or disable various "
@@ -121,8 +126,8 @@ static void init_lines(void)
 "End keys, or start typing the name of a flag to select it.",
 "Use the space bar to toggle the setting.",
 "",
-"You can apply various filters on the flags to display. A status line on the "
-"bottom right will show you which filters are in effect.",
+"You can apply various filters on the flags to display. The text of the bottom "
+"line buttons show, which filter the button (or key press) will switch to.",
 "",
 " F5: Toggle display of local / global / all flag descriptions.",
 "",
@@ -134,6 +139,23 @@ static void init_lines(void)
 "",
 "The default is to display all flags that are neither masked nor forced.",
 "",
+"You can change the way the descriptions are displayed. The text of the "
+"bottom line buttons show, which way the button (or key press) the display "
+"will change to.",
+"",
+" F9: Toggle the order of the affected package list and the description.",
+"",
+" F10: Toggle whether to display the full description or a stripped version. "
+"The stripped version has various wordings like \"Enables support for\" or "
+"\"Build and install the\" at the beginning of the description removed.",
+"Although somewhat crippled, the descriptions key information then needs "
+"less space and allows, with switched order of the package list and the "
+"description, to determine a flags meaning without scrolling the text in most "
+"cases; even on low resolution displays.",
+"",
+"The default is to display the full description preceeded by the list of "
+"affected packages.",
+"",
 "If ncurses is installed with the \"gpm\" use flag enabled, you can use your "
 "mouse to navigate and to toggle the settings, too.",
 "",

diff --git a/ufed.8.in b/ufed.8.in
index c916bf2..2f4d19d 100644
--- a/ufed.8.in
+++ b/ufed.8.in
@@ -15,6 +15,11 @@ If you have two make.conf files, @GENTOO_PORTAGE_EPREFIX@/etc/make.conf and
 @GENTOO_PORTAGE_EPREFIX@/etc/portage/make.conf, ufed reads the first, overrides
 its settings with the second, and writes changes to the second.
 
+If @GENTOO_PORTAGE_EPREFIX@/etc/portage/make.conf is a directory, ufed will
+parse all files in this directory recursively, omitting files that begin with a
+'.' or end with a '~', and will read all USE flag settings that can be found.
+Changes are written to the last file found, overriding all others.
+
 .B What are USE flags?
 
 The USE settings system is a flexible way to enable or disable various features
@@ -92,8 +97,8 @@ Use the Up and Down arrow keys, the Page Up and Page Down keys, the Home and
 End keys, or start typing the name of a flag to select it.
 Use the space bar to toggle the setting.
 
-You can apply various filters on the flags to display. A status line on the
-bottom right will show you which filters are in effect.
+You can apply various filters on the flags to display. The text of the bottom
+line buttons show, which filter the button (or key press) will switch to.
 
 F5: Toggle display of local / global / all flag descriptions.
 .br
@@ -105,6 +110,23 @@ neither masked nor forced / all flags.
 
 The default is to display all flags that are neither masked nor forced.
 
+You can change the way the descriptions are displayed. The text of the
+bottom line buttons show, which way the button (or key press) the display
+will change to.
+
+F9: Toggle the order of the affected package list and the description.
+.br
+F10: Toggle whether to display the full description or a stripped version.
+The stripped version has various wordings like "Enables support for" or
+"Build and install the" at the beginning of the description removed.
+Although somewhat crippled, the descriptions key information then needs
+less space and allows, with switched order of the package list and the
+description, to determine a flags meaning without scrolling the text in most
+cases; even on low resolution displays.
+
+The default is to display the full description preceeded by the list of
+affected packages.
+
 If ncurses is installed with the "gpm" use flag enabled, you can use your
 mouse to navigate and to toggle the settings, too.
 


^ permalink raw reply related	[flat|nested] 238+ messages in thread
* [gentoo-commits] proj/ufed:master commit in: /
@ 2013-09-11  6:04 Sven Eden
  0 siblings, 0 replies; 238+ messages in thread
From: Sven Eden @ 2013-09-11  6:04 UTC (permalink / raw
  To: gentoo-commits

commit:     3e73393774bc02d67915fbb77854ac9489084ee1
Author:     Sven Eden <yamakuzure <AT> gmx <DOT> net>
AuthorDate: Tue Sep 10 20:43:35 2013 +0000
Commit:     Sven Eden <sven.eden <AT> gmx <DOT> de>
CommitDate: Tue Sep 10 20:43:35 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/ufed.git;a=commit;h=3e733937

Changed key help display to show the next state instead of a fixed text.

---
 ufed-curses-checklist.c | 63 +++++++++++++++++++++++---------------------
 ufed-curses.c           | 69 +++++++++++++++++++++++++++++++++++--------------
 2 files changed, 83 insertions(+), 49 deletions(-)

diff --git a/ufed-curses-checklist.c b/ufed-curses-checklist.c
index 8a39fac..39f4a8d 100644
--- a/ufed-curses-checklist.c
+++ b/ufed-curses-checklist.c
@@ -480,9 +480,10 @@ static int callback(sFlag** curr, int key)
 			break;
 
 		case KEY_F(5):
-			if      (eScope_local  == e_scope) e_scope = eScope_all;
-			else if (eScope_global == e_scope) e_scope = eScope_local;
-			else                               e_scope = eScope_global;
+			if (eScope_local  == e_scope)
+				e_scope = eScope_all;
+			else
+				++e_scope;
 
 			if ( !isFlagLegal(*curr)
 			  && !setNextItem(0, true)
@@ -493,9 +494,11 @@ static int callback(sFlag** curr, int key)
 			break;
 
 		case KEY_F(6):
-			if      (eState_installed    == e_state) e_state = eState_notinstalled;
-			else if (eState_notinstalled == e_state) e_state = eState_all;
-			else                                     e_state = eState_installed;
+			if (eState_notinstalled == e_state)
+				e_state = eState_all;
+			else
+				++e_state;
+
 
 			if ( !isFlagLegal(*curr)
 			  && !setNextItem(0, true)
@@ -506,9 +509,10 @@ static int callback(sFlag** curr, int key)
 			break;
 
 		case KEY_F(7):
-			if      (eMask_masked   == e_mask) e_mask = eMask_unmasked;
-			else if (eMask_unmasked == e_mask) e_mask = eMask_both;
-			else                               e_mask = eMask_masked;
+			if      (eMask_both   == e_mask)
+				e_mask = eMask_unmasked;
+			else
+				++e_mask;
 
 			if ( !isFlagLegal(*curr)
 			  && !setNextItem(0, true)
@@ -520,8 +524,10 @@ static int callback(sFlag** curr, int key)
 			break;
 
 		case KEY_F(9):
-			if (eOrder_left == e_order) e_order = eOrder_right;
-			else                        e_order = eOrder_left;
+			if (eOrder_left == e_order)
+				e_order = eOrder_right;
+			else
+				e_order = eOrder_left;
 
 			drawFlags();
 			drawBottom(true);
@@ -529,8 +535,10 @@ static int callback(sFlag** curr, int key)
 			break;
 
 		case KEY_F(10):
-			if (eDesc_ori == e_desc) e_desc = eDesc_alt;
-			else                     e_desc = eDesc_ori;
+			if (eDesc_ori == e_desc)
+				e_desc = eDesc_alt;
+			else
+				e_desc = eDesc_ori;
 
 			drawFlags();
 			drawBottom(true);
@@ -639,25 +647,20 @@ int main(void)
 	initcurses();
 
 	/* The keys to use differ whether ro_mode is true or false */
-#define mkKey(x) x, sizeof(x)-1
 	sKey keys[] = {
-		{ '?',       mkKey("?: Help"),            0 },
-		{ '\n',      mkKey(ro_mode ?
-							"Enter: Exit"
-						:	"Enter: Save"),       0 },
-		{ '\033',    mkKey(ro_mode ?
-							"Esc: Exit"
-						:	"Esc: Cancel"),       0 },
-		{ -1,        mkKey("Toggle"),             1 },
-		{ KEY_F( 5), mkKey("F5: Local/Global"),   1 },
-		{ KEY_F( 6), mkKey("F6: Installed"),      1 },
-		{ KEY_F( 7), mkKey("F7: Masked/Forced"),  1 },
-		{ -1,        mkKey("      "),             2 },
-		{ KEY_F( 9), mkKey("F9: Swap Pkg/Desc"),  2 },
-		{ KEY_F(10), mkKey("F10: Strip Desc"),    2 },
-		{ '\0',      mkKey(""),                   0 }
+		/* Row 0 - General keys */
+		MAKE_KEY('?',    "?:",     "Help",   "",     "", NULL,           0),
+		MAKE_KEY('\n',   "Enter:", "Save",   "Exit", "", (int*)&ro_mode, 0),
+		MAKE_KEY('\033', "Esc:",   "Cancel", "Exit", "", (int*)&ro_mode, 0),
+
+		/* Row 1 - F-KEy toggles */
+		MAKE_KEY(KEY_F( 5), "F5:",  "global",    "local",         "all",      (int*)&e_scope, 1),
+		MAKE_KEY(KEY_F( 6), "F6:",  "installed", "not installed", "all",      (int*)&e_state, 1),
+		MAKE_KEY(KEY_F( 7), "F7:",  "masked",    "all",           "unmasked", (int*)&e_mask,  1),
+		MAKE_KEY(KEY_F( 9), "F9:",  "desc left", "desc right",    "",         (int*)&e_order, 1),
+		MAKE_KEY(KEY_F(10), "F10:", "stripped",  "full",          "",         (int*)&e_desc,  1),
+		MAKE_KEY('\0', "", "", "", "", NULL, 0)
 	};
-#undef mkKey
 
 	result = maineventloop(ro_mode ? subtitle_ro : subtitle_rw,
 				&callback, &drawflag, flags, keys, true);

diff --git a/ufed-curses.c b/ufed-curses.c
index 1c1970b..8441c56 100644
--- a/ufed-curses.c
+++ b/ufed-curses.c
@@ -142,9 +142,12 @@ void drawBottom(bool withSep)
 
 	if (keys) {
 		const sKey* key = keys;
-		int pos   = 2;
-		int row   = 0;
-		int len   = 0;
+		char buf[COLS + 1];
+		int  pos   = 2;
+		int  row   = 0;
+		int  len_full = 0;
+		int  len_name = 0;
+		int  len_desc = 0;
 
 		while (key->key != '\0') {
 			if (row != key->row) {
@@ -152,19 +155,35 @@ void drawBottom(bool withSep)
 				pos = 2;
 			}
 
-			len = strlen(key->descr);
+			len_name = key->name_len;
+			len_desc = key->desc_len;
+			len_full = len_name + len_desc;
 
 			if (pos < (bWidth - 2)) {
-				if (len > (bWidth - 2 - pos))
-					len = bWidth - 2 - pos;
-				if (key->key > 0)
+				if (len_full > (bWidth - 2 - pos))
+					len_full = bWidth - 2 - pos;
+
+				/* Write name of the key */
+				if (len_name > len_full)
+					len_name = len_full;
+				len_full -= len_name;
+				wattrset(w, COLOR_PAIR(3));
+				mvwaddnstr(w, row + 1, pos, key->name, len_name);
+				pos += len_name;
+
+				/* Add description (button) if possible */
+				if (len_full) {
+					if (len_desc > len_full)
+						len_desc = len_full;
+					len_full -= len_desc;
+
+					sprintf(buf, "%-*.*s", len_desc - 1, len_desc - 1, key->desc[*key->idx]);
 					wattrset(w, COLOR_PAIR(6));
-				else
-					wattrset(w, COLOR_PAIR(3));
+					mvwaddstr(w, row + 1, pos, buf);
 
-				mvwaddnstr(w, row + 1, pos, key->descr, len);
+					pos += len_desc;
+				}
 			}
-			pos += len + 1;
 			++key;
 		}
 	}
@@ -645,8 +664,11 @@ int maineventloop(
 					if( (event.bstate & (BUTTON1_CLICKED | BUTTON1_DOUBLE_CLICKED))
 					 && (event.y >= 1) && (event.y <= 2)) {
 						const sKey* key = keys;
-						int x   = event.x;
-						int y   = event.y;
+						char  buf[COLS + 1];
+						int x        = event.x;
+						int y        = event.y;
+						int len_name = 0;
+						int len_desc = 0;
 						if((x < 2) || (y < 1) || (y > 2))
 							continue;
 						x -= 2;
@@ -657,20 +679,29 @@ int maineventloop(
 
 						// Check key
 						for ( ; (key->row == y) && (x >= 0) && (key->key != '\0'); key++) {
-							if ((key->key > 0) && ((size_t)x < key->length) ) {
-								event.x -= x;
-								wattrset(win(Bottom), COLOR_PAIR(6) | A_BOLD | A_REVERSE);
-								mvwaddstr(win(Bottom), event.y, event.x, key->descr);
+							len_name = key->name_len;
+							len_desc = key->desc_len;
+							if ( (key->key > 0)
+							  && (x > len_name)
+							  && (x < (len_name + len_desc) ) ) {
+								event.x -= x - len_name;
+
+								sprintf(buf, "%-*.*s", len_desc - 1, len_desc - 1, key->desc[*key->idx]);
+								wattrset(win(Bottom), COLOR_PAIR(7) | A_BOLD);
+								mvwaddstr(win(Bottom), event.y, event.x, buf);
+
 								wmove(win(Bottom), event.y, event.x);
 								wrefresh(win(Bottom));
 								usleep(100000);
+
 								wattrset(win(Bottom), COLOR_PAIR(6));
-								waddstr(win(Bottom), key->descr);
+								waddstr(win(Bottom), buf);
+
 								wnoutrefresh(win(Bottom));
 								c = key->key;
 								goto check_key;
 							}
-							x -= key->length + 1;
+							x -= len_name + len_desc;
 						}
 					}
 				}


^ permalink raw reply related	[flat|nested] 238+ messages in thread
* [gentoo-commits] proj/ufed:master commit in: /
@ 2013-09-11  6:04 Sven Eden
  0 siblings, 0 replies; 238+ messages in thread
From: Sven Eden @ 2013-09-11  6:04 UTC (permalink / raw
  To: gentoo-commits

commit:     9b74257370da8926d774e6ffd380805d7a053e28
Author:     Sven Eden <yamakuzure <AT> gmx <DOT> net>
AuthorDate: Tue Sep 10 20:41:45 2013 +0000
Commit:     Sven Eden <sven.eden <AT> gmx <DOT> de>
CommitDate: Tue Sep 10 20:41:45 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/ufed.git;a=commit;h=9b742573

ufed.pl: Added a constant for easier setting on how to start the curses interface. (Useful in development)

---
 ufed.pl.in | 29 +++++++++++++++++++++--------
 1 file changed, 21 insertions(+), 8 deletions(-)

diff --git a/ufed.pl.in b/ufed.pl.in
index 09c0508..b7d8323 100644
--- a/ufed.pl.in
+++ b/ufed.pl.in
@@ -9,13 +9,17 @@ use warnings;
 use lib qw{XX_perldir@};
 use Portage;
 
+# 0 = normal, 1 = gdb, 2 = valgrind
+use constant { EXEC => 0 };
+
 my $version = 'XX_PACKAGE_VERSION@';
 
 my $interface = 'ufed-curses';
-#my $memcheck  = "/usr/bin/valgrind -v --trace-children=yes --tool=memcheck"
-#			  . " --track-origins=yes --leak-check=full --show-reachable=no"
-#			  . " --read-var-info=yes"
-#              . " XX_libexecdir@/ufed-curses 2>/tmp/ufed_memcheck.log";
+my $gdb       = "gdb -ex run ufed-curses";
+my $memcheck  = "/usr/bin/valgrnd -v --trace-children=yes --tool=memcheck"
+			  . " --track-origins=yes --leak-check=full --show-reachable=no"
+			  . " --read-var-info=yes"
+              . " XX_libexecdir@/ufed-curses 2>/tmp/ufed_memcheck.log";
 
 sub finalise;
 sub flags_dialog;
@@ -60,10 +64,19 @@ sub flags_dialog {
 		POSIX::close $iread;
 		POSIX::dup2 $owrite, 4;
 		POSIX::close $owrite;
-		exec { "XX_libexecdir@/$interface" } $interface or
-		do { print STDERR "Couldn't launch $interface\n"; exit 3 }
-#		exec $memcheck or
-#		do { print STDERR "Couldn't launch valgrind\n$!\n"; exit 3 }
+		if (0 == EXEC) {
+			exec { "XX_libexecdir@/$interface" } $interface or
+			do { print STDERR "Couldn't launch $interface\n"; exit 3 }
+		} elsif (1 == EXEC) {
+			exec $gdb or
+			do { print STDERR "Couldn't launch $interface\n"; exit 3 }
+		} elsif (2 == EXEC) {
+			exec $memcheck or
+			do { print STDERR "Couldn't launch $interface\n"; exit 3 }
+		} else {
+			print STDERR "Value " . EXEC . " unknown for EXEC\n";
+			exit 4;
+		}
 	}
 	POSIX::close $iread;
 	POSIX::close $owrite;


^ permalink raw reply related	[flat|nested] 238+ messages in thread
* [gentoo-commits] proj/ufed:master commit in: /
@ 2013-09-11  6:04 Sven Eden
  0 siblings, 0 replies; 238+ messages in thread
From: Sven Eden @ 2013-09-11  6:04 UTC (permalink / raw
  To: gentoo-commits

commit:     7fe7d5d8618b1adfcd5f95b529dfcb4843f5b363
Author:     Sven Eden <yamakuzure <AT> gmx <DOT> net>
AuthorDate: Tue Sep 10 06:19:00 2013 +0000
Commit:     Sven Eden <sven.eden <AT> gmx <DOT> de>
CommitDate: Tue Sep 10 06:19:00 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/ufed.git;a=commit;h=7fe7d5d8

Added reading of the new incoming alternative description line and its addition to the flag descriptions.

---
 ufed-curses-checklist.c | 23 ++++++++++++++---------
 ufed-curses-help.c      |  4 ++--
 2 files changed, 16 insertions(+), 11 deletions(-)

diff --git a/ufed-curses-checklist.c b/ufed-curses-checklist.c
index 5d7179e..978e2f5 100644
--- a/ufed-curses-checklist.c
+++ b/ufed-curses-checklist.c
@@ -91,7 +91,7 @@ static void read_flags(void)
 	size_t fullWidth = 0;
 	struct {
 		int start, end;
-	} name, desc, pkg, state;
+	} name, desc, desc_alt, pkg, state;
 
 	if(input == NULL)
 		ERROR_EXIT(-1, "fdopen failed with error %d\n", errno);
@@ -126,15 +126,17 @@ static void read_flags(void)
 
 		/* read description(s) and determine flag status */
 		for (int i = 0; i < ndescr; ++i) {
-			desc.start  = desc.end  = -1;
-			pkg.start   = pkg.end   = -1;
-			state.start = state.end = -1;
+			desc.start     = desc.end     = -1;
+			desc_alt.start = desc_alt.end = -1;
+			pkg.start      = pkg.end      = -1;
+			state.start    = state.end    = -1;
 
 			line = getline(input);
 			if (!line) break;
 
-			if ( (sscanf(line, "\t%n%*[^\t]%n\t (%n%*[^)]%n) [%n%*[ +-]%n%c",
+			if ( (sscanf(line, "\t%n%*[^\t]%n\t%n%*[^\t]%n\t (%n%*[^)]%n) [%n%*[ +-]%n%c",
 					&desc.start,  &desc.end,
+					&desc_alt.start,  &desc_alt.end,
 					&pkg.start,   &pkg.end,
 					&state.start, &state.end,
 					&endChar) != 1)
@@ -146,13 +148,16 @@ static void read_flags(void)
 				ERROR_EXIT(-1, "Illegal description stats on line %d:\n\"%s\"\n", lineNum + 1, line);
 
 			// Add description line to flag:
-			line[desc.end]  = '\0';
-			line[state.end] = '\0';
+			line[desc.end]     = '\0';
+			line[desc_alt.end] = '\0';
+			line[state.end]    = '\0';
 			if ( (pkg.end - pkg.start) > 1) {
 				line[pkg.end]   = '\0';
-				fullWidth = addFlagDesc(newFlag, &line[pkg.start], &line[desc.start], &line[state.start]);
+				fullWidth = addFlagDesc(newFlag, &line[pkg.start], &line[desc.start],
+										&line[desc_alt.start], &line[state.start]);
 			} else
-				fullWidth = addFlagDesc(newFlag, NULL, &line[desc.start], &line[state.start]);
+				fullWidth = addFlagDesc(newFlag, NULL, &line[desc.start],
+										&line[desc_alt.start], &line[state.start]);
 
 			// Note new max length if this line is longest:
 			if (fullWidth > maxDescWidth)

diff --git a/ufed-curses-help.c b/ufed-curses-help.c
index 7dfbf93..8fce938 100644
--- a/ufed-curses-help.c
+++ b/ufed-curses-help.c
@@ -258,9 +258,9 @@ static void init_lines(void)
 		if (n) {
 			memcpy(buf, word, n);
 			buf[n++] = '\0';
-			addFlagDesc(line, NULL, buf, "+      ");
+			addFlagDesc(line, NULL, buf, NULL, "+      ");
 		} else
-			addFlagDesc(line, NULL, " ", "+      ");
+			addFlagDesc(line, NULL, " ", NULL, "+      ");
 
 		// Advance behind current spaces
 		while (word[n] == ' ')


^ permalink raw reply related	[flat|nested] 238+ messages in thread
* [gentoo-commits] proj/ufed:master commit in: /
@ 2013-09-11  6:04 Sven Eden
  0 siblings, 0 replies; 238+ messages in thread
From: Sven Eden @ 2013-09-11  6:04 UTC (permalink / raw
  To: gentoo-commits

commit:     7e332d1f8e099069cbb238cba7914141e9b82ae1
Author:     Sven Eden <yamakuzure <AT> gmx <DOT> net>
AuthorDate: Tue Sep 10 13:17:37 2013 +0000
Commit:     Sven Eden <sven.eden <AT> gmx <DOT> de>
CommitDate: Tue Sep 10 13:17:37 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/ufed.git;a=commit;h=7e332d1f

ufed-curses-globals.[hc]: Added e_desc global to switch between original and alternative description.

---
 ufed-curses-globals.c | 1 +
 ufed-curses-globals.h | 1 +
 2 files changed, 2 insertions(+)

diff --git a/ufed-curses-globals.c b/ufed-curses-globals.c
index 8c348d0..7176c8a 100644
--- a/ufed-curses-globals.c
+++ b/ufed-curses-globals.c
@@ -12,6 +12,7 @@ bool       configDone     = false;
 int        minwidth       = 0;
 int        ro_mode        = false;
 int        topline        = 0;
+eDesc      e_desc         = eDesc_ori;
 eMask      e_mask         = eMask_unmasked;
 eOrder     e_order        = eOrder_left;
 eScope     e_scope        = eScope_all;

diff --git a/ufed-curses-globals.h b/ufed-curses-globals.h
index 54f2cf2..9fd7419 100644
--- a/ufed-curses-globals.h
+++ b/ufed-curses-globals.h
@@ -12,6 +12,7 @@
 
 extern int        bottomline;
 extern bool       configDone;
+extern eDesc      e_desc;
 extern eMask      e_mask;
 extern eOrder     e_order;
 extern eScope     e_scope;


^ permalink raw reply related	[flat|nested] 238+ messages in thread
* [gentoo-commits] proj/ufed:master commit in: /
@ 2013-09-11  6:04 Sven Eden
  0 siblings, 0 replies; 238+ messages in thread
From: Sven Eden @ 2013-09-11  6:04 UTC (permalink / raw
  To: gentoo-commits

commit:     bc001f8f814e6984a31c803888b70ac77236b53e
Author:     Sven Eden <yamakuzure <AT> gmx <DOT> net>
AuthorDate: Tue Sep 10 13:18:07 2013 +0000
Commit:     Sven Eden <sven.eden <AT> gmx <DOT> de>
CommitDate: Tue Sep 10 13:18:07 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/ufed.git;a=commit;h=bc001f8f

Added handling for F10 to siwtch description display between original and alternative.

---
 ufed-curses-checklist.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/ufed-curses-checklist.c b/ufed-curses-checklist.c
index 978e2f5..f83e9ed 100644
--- a/ufed-curses-checklist.c
+++ b/ufed-curses-checklist.c
@@ -522,6 +522,14 @@ static int callback(sFlag** curr, int key)
 			wmove(wInp, 0, strlen(fayt));
 			break;
 
+		case KEY_F(10):
+			if (eDesc_ori == e_desc) e_desc = eDesc_alt;
+			else                     e_desc = eDesc_ori;
+
+			drawFlags();
+			wmove(wInp, 0, strlen(fayt));
+			break;
+
 #ifdef NCURSES_MOUSE_VERSION
 		case KEY_MOUSE:
 			// Masked flags can be turned off, nothing else


^ permalink raw reply related	[flat|nested] 238+ messages in thread
* [gentoo-commits] proj/ufed:master commit in: /
@ 2013-09-11  6:04 Sven Eden
  0 siblings, 0 replies; 238+ messages in thread
From: Sven Eden @ 2013-09-11  6:04 UTC (permalink / raw
  To: gentoo-commits

commit:     9b8e19212eb77e19df82315eea333de340f69a9a
Author:     Sven Eden <yamakuzure <AT> gmx <DOT> net>
AuthorDate: Tue Sep 10 13:37:59 2013 +0000
Commit:     Sven Eden <sven.eden <AT> gmx <DOT> de>
CommitDate: Tue Sep 10 13:37:59 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/ufed.git;a=commit;h=9b8e1921

F10 now really toggles the description between original and alternative

---
 ufed-curses-checklist.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/ufed-curses-checklist.c b/ufed-curses-checklist.c
index f83e9ed..f51e07b 100644
--- a/ufed-curses-checklist.c
+++ b/ufed-curses-checklist.c
@@ -295,9 +295,14 @@ static int drawflag(sFlag* flag, bool highlight)
 			memset(desc, 0, maxDescWidth * sizeof(char));
 			if (flag->desc[idx].pkg) {
 				if (e_order == eOrder_left)
-					sprintf(desc, "(%s) %s", flag->desc[idx].pkg, flag->desc[idx].desc);
+					sprintf(desc, "(%s) %s", flag->desc[idx].pkg, e_desc == eDesc_ori
+							? flag->desc[idx].desc
+							: flag->desc[idx].desc_alt);
 				else
-					sprintf(desc, "%s (%s)", flag->desc[idx].desc, flag->desc[idx].pkg);
+					sprintf(desc, "%s (%s)", e_desc == eDesc_ori
+							? flag->desc[idx].desc
+							: flag->desc[idx].desc_alt,
+							  flag->desc[idx].pkg);
 			}
 			else
 				sprintf(desc, "%s", flag->desc[idx].desc);


^ permalink raw reply related	[flat|nested] 238+ messages in thread
* [gentoo-commits] proj/ufed:master commit in: /
@ 2013-09-11  6:04 Sven Eden
  0 siblings, 0 replies; 238+ messages in thread
From: Sven Eden @ 2013-09-11  6:04 UTC (permalink / raw
  To: gentoo-commits

commit:     40396c7b5ae54c114321782bf3141a2cdf5789bb
Author:     Sven Eden <yamakuzure <AT> gmx <DOT> net>
AuthorDate: Tue Sep 10 13:57:12 2013 +0000
Commit:     Sven Eden <sven.eden <AT> gmx <DOT> de>
CommitDate: Tue Sep 10 13:57:12 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/ufed.git;a=commit;h=40396c7b

Portage.pm: Enhanced Stripping of descriptions to build the alternative variant.

---
 Portage.pm | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/Portage.pm b/Portage.pm
index 0144068..e0d08a8 100644
--- a/Portage.pm
+++ b/Portage.pm
@@ -203,7 +203,16 @@ sub _add_flag
 		# where various words are stripped, as they do not
 		# bear much information.
 		my $descr_alt = $descr;
-		$descr_alt =~ s/^(?:include|enable|add)(?:s)?\s+(?:support\s+for\s+)?//mig;
+		
+		if (length($descr)) {
+			my $VERB   = "(?:build|include|enable|add|support|use|be|install)(?:s)?";
+			my $BIND   = "(?:and|for|in|the|a)?";
+			my $WHAT   = "(?:install|support|build|include|able)?(?:s|ing|ed)?";
+			my $POST   = "(?:in|for|the|on|with|a|to)?";
+			$descr_alt =~ s/^$VERB\s*$BIND\s*$WHAT\s*$POST\s*$POST\s+//mig;
+			
+			debugMsg("   \"$descr\"\n-> \"$descr_alt\"");
+		}
 
 		$data{descr}     = $descr;
 		$data{descr_alt} = $descr_alt;


^ permalink raw reply related	[flat|nested] 238+ messages in thread
* [gentoo-commits] proj/ufed:master commit in: /
@ 2013-09-11  6:04 Sven Eden
  0 siblings, 0 replies; 238+ messages in thread
From: Sven Eden @ 2013-09-11  6:04 UTC (permalink / raw
  To: gentoo-commits

commit:     6c416b97725986f5bf122c7690ab3006c70a6ff2
Author:     Sven Eden <yamakuzure <AT> gmx <DOT> net>
AuthorDate: Tue Sep 10 12:40:16 2013 +0000
Commit:     Sven Eden <sven.eden <AT> gmx <DOT> de>
CommitDate: Tue Sep 10 12:40:16 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/ufed.git;a=commit;h=6c416b97

Merge branch 'master' into altdesc to have recent development there as well.


 Portage.pm | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)


^ permalink raw reply	[flat|nested] 238+ messages in thread
* [gentoo-commits] proj/ufed:master commit in: /
@ 2013-09-11  6:04 Sven Eden
  0 siblings, 0 replies; 238+ messages in thread
From: Sven Eden @ 2013-09-11  6:04 UTC (permalink / raw
  To: gentoo-commits

commit:     768337176fe08810ca18aa643c4097486c41393b
Author:     Sven Eden <yamakuzure <AT> gmx <DOT> net>
AuthorDate: Tue Sep 10 13:16:39 2013 +0000
Commit:     Sven Eden <sven.eden <AT> gmx <DOT> de>
CommitDate: Tue Sep 10 13:16:39 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/ufed.git;a=commit;h=76833717

eDesc: Added enum to determine whether the original or the alternative description is displayed

---
 ufed-curses-types.h | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/ufed-curses-types.h b/ufed-curses-types.h
index 1fe52d6..3f04650 100644
--- a/ufed-curses-types.h
+++ b/ufed-curses-types.h
@@ -38,6 +38,14 @@
  * =============
  */
 
+/** @enum eDesc_
+ * @brief determine whether to display the original/alternative description
+**/
+typedef enum eDesc_ {
+	eDesc_ori,
+	eDesc_alt
+} eDesc;
+
 /** @enum eMask_
  *  @brief determine which flags are shown concerning masked status
 **/


^ permalink raw reply related	[flat|nested] 238+ messages in thread
* [gentoo-commits] proj/ufed:master commit in: /
@ 2013-09-11  6:04 Sven Eden
  0 siblings, 0 replies; 238+ messages in thread
From: Sven Eden @ 2013-09-11  6:04 UTC (permalink / raw
  To: gentoo-commits

commit:     b3bff5c75a7c4b289e627ee4f27cb6856b038968
Author:     Sven Eden <yamakuzure <AT> gmx <DOT> net>
AuthorDate: Tue Sep 10 06:18:24 2013 +0000
Commit:     Sven Eden <sven.eden <AT> gmx <DOT> de>
CommitDate: Tue Sep 10 06:18:24 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/ufed.git;a=commit;h=b3bff5c7

The new alternative description line is now freed when a flag gets destroyed.

---
 ufed-curses-types.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/ufed-curses-types.c b/ufed-curses-types.c
index b604b6d..7e72967 100644
--- a/ufed-curses-types.c
+++ b/ufed-curses-types.c
@@ -206,6 +206,8 @@ void destroyFlag (sFlag** root, sFlag** flag)
 				free (xFlag->desc[i].pkg);
 			if (xFlag->desc[i].desc)
 				free (xFlag->desc[i].desc);
+			if (xFlag->desc[i].desc_alt)
+				free (xFlag->desc[i].desc_alt);
 		}
 		if (xFlag->desc)
 			free (xFlag->desc);


^ permalink raw reply related	[flat|nested] 238+ messages in thread
* [gentoo-commits] proj/ufed:master commit in: /
@ 2013-09-11  6:04 Sven Eden
  0 siblings, 0 replies; 238+ messages in thread
From: Sven Eden @ 2013-09-11  6:04 UTC (permalink / raw
  To: gentoo-commits

commit:     25855d71b93e2de599cc9b3f5217af84f70c2b2b
Author:     Sven Eden <yamakuzure <AT> gmx <DOT> net>
AuthorDate: Tue Sep 10 06:07:00 2013 +0000
Commit:     Sven Eden <sven.eden <AT> gmx <DOT> de>
CommitDate: Tue Sep 10 06:07:00 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/ufed.git;a=commit;h=25855d71

udfed.pl: Send alternative text to interface

---
 ufed.pl.in | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/ufed.pl.in b/ufed.pl.in
index 17ffd8e..09c0508 100644
--- a/ufed.pl.in
+++ b/ufed.pl.in
@@ -84,8 +84,9 @@ sub flags_dialog {
 
 		# Print global description first (if available)
 		if (defined($conf->{global}) && length($conf->{global}{descr})) {
-			$outTxt .= sprintf("\t%s\t ( ) [+%s%s%s   ]\n",
+			$outTxt .= sprintf("\t%s\t%s\t ( ) [+%s%s%s   ]\n",
 						$conf->{global}{descr},
+						$conf->{global}{descr_alt},
 						$conf->{global}{installed} ? '+' : ' ',
 						$conf->{global}{forced} ? '+' : ' ',
 						$conf->{global}{masked} ? '+' : ' ');
@@ -93,8 +94,9 @@ sub flags_dialog {
 
 		# Finally print the local description lines
 		for my $pkg (sort keys %{$conf->{"local"}}) {
-			$outTxt .= sprintf("\t%s\t (%s) [ %s%s%s%s%s%s]\n",
+			$outTxt .= sprintf("\t%s\t%s\t (%s) [ %s%s%s%s%s%s]\n",
 						$conf->{"local"}{$pkg}{descr},
+						$conf->{"local"}{$pkg}{descr_alt},
 						$pkg,
 						$conf->{"local"}{$pkg}{installed} > 0 ? '+' :
 						$conf->{"local"}{$pkg}{installed} < 0 ? '-' : ' ',


^ permalink raw reply related	[flat|nested] 238+ messages in thread
* [gentoo-commits] proj/ufed:master commit in: /
@ 2013-09-11  6:04 Sven Eden
  0 siblings, 0 replies; 238+ messages in thread
From: Sven Eden @ 2013-09-11  6:04 UTC (permalink / raw
  To: gentoo-commits

commit:     8d940b199f830d1686a67f5cec88aa6b2c1e8a45
Author:     Sven Eden <yamakuzure <AT> gmx <DOT> net>
AuthorDate: Tue Sep 10 06:17:22 2013 +0000
Commit:     Sven Eden <sven.eden <AT> gmx <DOT> de>
CommitDate: Tue Sep 10 06:17:22 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/ufed.git;a=commit;h=8d940b19

types: Added altenative description to sFlag

---
 ufed-curses-types.c | 8 +++++---
 ufed-curses-types.h | 3 ++-
 2 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/ufed-curses-types.c b/ufed-curses-types.c
index a3bc79e..b604b6d 100644
--- a/ufed-curses-types.c
+++ b/ufed-curses-types.c
@@ -99,10 +99,11 @@ sFlag* addFlag (sFlag** root, const char* name, int line, int ndesc, const char
  *  @param[in,out] flag pointer to the flag to manipulate. Must not be NULL
  *  @param[in] pkg list of affected packages or NULL if no packages are affected
  *  @param[in] desc description line
+ *  @param[in] desc_alt alternative description line
  *  @param[in] state '+','-',' ' for global, installed, forced, masked, package - in that order.
  *  @return the full length of the description including package list and separators
 **/
-size_t addFlagDesc (sFlag* flag, const char* pkg, const char* desc, const char state[7])
+size_t addFlagDesc (sFlag* flag, const char* pkg, const char* desc, const char* desc_alt, const char state[7])
 {
 	size_t result = 3; // space and brackets.
 	if (flag) {
@@ -118,8 +119,9 @@ size_t addFlagDesc (sFlag* flag, const char* pkg, const char* desc, const char s
 			}
 
 			// Now apply.
-			if (pkg)  flag->desc[idx].pkg  = strdup(pkg);
-			if (desc) flag->desc[idx].desc = strdup(desc);
+			if (pkg)      flag->desc[idx].pkg      = strdup(pkg);
+			if (desc)     flag->desc[idx].desc     = strdup(desc);
+			if (desc_alt) flag->desc[idx].desc_alt = strdup(desc_alt);
 			if ('+' == state[0]) flag->desc[idx].isGlobal    = true;
 			if ('+' == state[1]) flag->desc[idx].isInstalled = true;
 			flag->desc[idx].stateForced  = state[2];

diff --git a/ufed-curses-types.h b/ufed-curses-types.h
index af7deec..1fe52d6 100644
--- a/ufed-curses-types.h
+++ b/ufed-curses-types.h
@@ -97,6 +97,7 @@ typedef enum eWin_ {
 **/
 typedef struct sDesc_ {
 	char* desc;         //!< The description line
+	char* desc_alt;     //!< The alternative description line
 	bool  isGlobal;     //!< true if this is the global description and setting
 	bool  isInstalled;  //!< global: at least one pkg is installed, local: all in *pkg are installed.
 	char* pkg;          //!< affected packages
@@ -166,7 +167,7 @@ typedef struct sWindow_ {
  * =======================================
  */
 sFlag* addFlag      (sFlag** root, const char* name, int line, int ndesc, const char state[2]);
-size_t addFlagDesc  (sFlag* flag, const char* pkg, const char* desc, const char state[6]);
+size_t addFlagDesc  (sFlag* flag, const char* pkg, const char* desc, const char* desc_alt, const char state[6]);
 void   addLineStats (const sFlag* flag, sListStats* stats);
 void   destroyFlag  (sFlag** root, sFlag** flag);
 void   genFlagStats (sFlag* flag);


^ permalink raw reply related	[flat|nested] 238+ messages in thread
* [gentoo-commits] proj/ufed:master commit in: /
@ 2013-09-11  6:04 Sven Eden
  0 siblings, 0 replies; 238+ messages in thread
From: Sven Eden @ 2013-09-11  6:04 UTC (permalink / raw
  To: gentoo-commits

commit:     3e92f58ad64a2f6c76386fc2242181b8feeecd86
Author:     Sven Eden <yamakuzure <AT> gmx <DOT> net>
AuthorDate: Tue Sep 10 06:06:28 2013 +0000
Commit:     Sven Eden <sven.eden <AT> gmx <DOT> de>
CommitDate: Tue Sep 10 06:06:28 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/ufed.git;a=commit;h=3e92f58a

Portage.pm: Added an alternative description with stripped "<include|enable|add>[s][ support for]" prefix stripped.

---
 Portage.pm | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/Portage.pm b/Portage.pm
index b909092..f23243c 100644
--- a/Portage.pm
+++ b/Portage.pm
@@ -31,6 +31,7 @@ Readonly our $DEBUG => 0;
 #   ->{conf}      = The flag is disabled (-1), enabled (1) or not set (0) in make.conf
 #   ->{default}   = The flag is disabled (-1), enabled (1) or not set (0) by default
 #   ->{descr}     = Global description
+#   ->{descr_alt} = Alternative description with stripped words like "Enables support for"
 #   ->{forced}    = The flag is globally force enabled (and masked) (0,1)
 #   ->{installed} = At least one affected package is installed (0,1)
 #   ->{masked}    = The flag is globally masked (0,1)
@@ -199,7 +200,14 @@ sub _add_flag
 			= ($1, $2, $3, $4, $5, $6, $7, $8);
 		my %data = ();
 
+		# An alternate form of the description is a version
+		# where various words are stripped, as they do not
+		# bear much information.
+		my $descr_alt = $descr;
+		$descr_alt =~ s/^(?:include|enable|add)(?:s)?\s+(?:support\s+for\s+)?//mig;
+
 		$data{descr}     = $descr;
+		$data{descr_alt} = $descr_alt;
 		$data{forced}    = $forced;
 		$data{installed} = $installed;
 		$data{masked}    = $masked;


^ permalink raw reply related	[flat|nested] 238+ messages in thread
* [gentoo-commits] proj/ufed:master commit in: /
@ 2013-09-10 12:37 Sven Eden
  0 siblings, 0 replies; 238+ messages in thread
From: Sven Eden @ 2013-09-10 12:37 UTC (permalink / raw
  To: gentoo-commits

commit:     4542ee856289204b356a517fd28444572ed5e015
Author:     Sven Eden <yamakuzure <AT> gmx <DOT> net>
AuthorDate: Tue Sep 10 12:37:58 2013 +0000
Commit:     Sven Eden <sven.eden <AT> gmx <DOT> de>
CommitDate: Tue Sep 10 12:37:58 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/ufed.git;a=commit;h=4542ee85

Change the usage of Readonly (unneccessary dependency) to pragma constant (no external dependency). It is only used for DEBUG, which is only questioned _once_.

---
 Portage.pm | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/Portage.pm b/Portage.pm
index b909092..6cdab98 100644
--- a/Portage.pm
+++ b/Portage.pm
@@ -6,7 +6,6 @@ package Portage;
 
 use strict;
 use warnings;
-use Readonly;
 
 BEGIN {
     use Exporter ();
@@ -20,7 +19,7 @@ BEGIN {
 # --- public members ---
 
 # Set this to 1 to get debugging output
-Readonly our $DEBUG => 0;
+use constant { DEBUG => 0 };
 
 # $use_flags - hashref that represents the combined and
 # consolidated data about all valid use flags
@@ -172,13 +171,13 @@ INIT {
 # --- public methods implementations ---
 
 # Write a given message to STDERR adding a newline at the end
-# This function does nothing unless $DEBUG is set to something
+# This function does nothing unless DEBUG is set to something
 # different than zero
 # Parameter 1: The message
 sub debugMsg
 {
 	my ($msg) = @_;
-	$DEBUG or return;
+	DEBUG or return;
 	print STDERR "$msg\n";
 	return;
 }


^ permalink raw reply related	[flat|nested] 238+ messages in thread
* [gentoo-commits] proj/ufed:master commit in: /
@ 2013-09-10  6:36 Sven Eden
  0 siblings, 0 replies; 238+ messages in thread
From: Sven Eden @ 2013-09-10  6:36 UTC (permalink / raw
  To: gentoo-commits

commit:     5f5e7e3b80f211c76d2f3872f063c288f34fa780
Author:     Sven Eden <yamakuzure <AT> gmx <DOT> net>
AuthorDate: Tue Sep 10 05:28:05 2013 +0000
Commit:     Sven Eden <sven.eden <AT> gmx <DOT> de>
CommitDate: Tue Sep 10 05:28:05 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/ufed.git;a=commit;h=5f5e7e3b

If read only mode is set, both Enter and ESC help show "Exit" and the key presses show a correct prompt.

---
 ufed-curses-checklist.c | 44 +++++++++++++++++++++++++++-----------------
 1 file changed, 27 insertions(+), 17 deletions(-)

diff --git a/ufed-curses-checklist.c b/ufed-curses-checklist.c
index 1586263..5d7179e 100644
--- a/ufed-curses-checklist.c
+++ b/ufed-curses-checklist.c
@@ -18,21 +18,6 @@ static size_t  maxDescWidth    = 0;
 static char*   lineBuf         = NULL;
 static sFlag*  flags           = NULL;
 
-#define mkKey(x) x, sizeof(x)-1
-static const sKey keys[] = {
-	{ '?',      mkKey("?: Help"),            0 },
-	{ '\n',     mkKey("Enter: Save"),        0 },
-	{ '\033',   mkKey("Esc: Cancel"),        0 },
-	{ -1,       mkKey("Toggle"),             1 },
-	{ KEY_F(5), mkKey("F5: Local/Global"),   1 },
-	{ KEY_F(6), mkKey("F6: Installed"),      1 },
-	{ KEY_F(7), mkKey("F7: Masked/Forced"),  1 },
-	{ KEY_F(9), mkKey("F9: Pkg/Desc Order"), 1 },
-	{ '\0',     mkKey(""),                   0 }
-};
-#undef mkKey
-
-
 /* internal prototypes */
 static void free_flags(void);
 
@@ -432,11 +417,17 @@ static int callback(sFlag** curr, int key)
 			break;
 		case '\n':
 		case KEY_ENTER:
-			if(yesno("Save and exit? (Y/N) "))
+			if (ro_mode) {
+				if (yesno("Exit? (Y/N) "))
+					return 0;
+			} else if (yesno("Save and exit? (Y/N) "))
 				return 0;
 			break;
 		case '\033':
-			if(yesno("Cancel? (Y/N) "))
+			if (ro_mode) {
+				if (yesno("Exit? (Y/N) "))
+					return 0;
+			} else if (yesno("Cancel? (Y/N) "))
 				return 1;
 			break;
 		case ' ':
@@ -627,6 +618,25 @@ int main(void)
 
 	initcurses();
 
+	/* The keys to use differ whether ro_mode is true or false */
+#define mkKey(x) x, sizeof(x)-1
+	sKey keys[] = {
+		{ '?',      mkKey("?: Help"),            0 },
+		{ '\n',     mkKey(ro_mode ?
+							"Enter: Exit"
+						:	"Enter: Save"),      0 },
+		{ '\033',   mkKey(ro_mode ?
+							"Esc: Exit"
+						:	"Esc: Cancel"),      0 },
+		{ -1,       mkKey("Toggle"),             1 },
+		{ KEY_F(5), mkKey("F5: Local/Global"),   1 },
+		{ KEY_F(6), mkKey("F6: Installed"),      1 },
+		{ KEY_F(7), mkKey("F7: Masked/Forced"),  1 },
+		{ KEY_F(9), mkKey("F9: Pkg/Desc Order"), 1 },
+		{ '\0',     mkKey(""),                   0 }
+	};
+#undef mkKey
+
 	result = maineventloop(ro_mode ? subtitle_ro : subtitle_rw,
 				&callback, &drawflag, flags, keys, true);
 


^ permalink raw reply related	[flat|nested] 238+ messages in thread
* [gentoo-commits] proj/ufed:master commit in: /
@ 2013-09-10  6:36 Sven Eden
  0 siblings, 0 replies; 238+ messages in thread
From: Sven Eden @ 2013-09-10  6:36 UTC (permalink / raw
  To: gentoo-commits

commit:     456a9d34fff548856cc1876253ca66db9abd0898
Author:     Sven Eden <yamakuzure <AT> gmx <DOT> net>
AuthorDate: Tue Sep 10 05:16:08 2013 +0000
Commit:     Sven Eden <sven.eden <AT> gmx <DOT> de>
CommitDate: Tue Sep 10 05:16:08 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/ufed.git;a=commit;h=456a9d34

Made the subtitle more descriptive presenting a possible read-only mode

---
 ufed-curses-checklist.c | 6 ++++--
 ufed-curses.c           | 6 +++---
 2 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/ufed-curses-checklist.c b/ufed-curses-checklist.c
index 4a12968..1586263 100644
--- a/ufed-curses-checklist.c
+++ b/ufed-curses-checklist.c
@@ -613,7 +613,9 @@ static int callback(sFlag** curr, int key)
 
 int main(void)
 {
-	int result;
+	int result = EXIT_SUCCESS;
+	const char subtitle_ro[] = "USE flags can be browsed, but changes will NOT be saved!";
+	const char subtitle_rw[] = "Select desired USE flags from the list below:";
 
 	read_flags();
 	fayt     = (char*)  calloc(minwidth, sizeof(*fayt));
@@ -625,7 +627,7 @@ int main(void)
 
 	initcurses();
 
-	result = maineventloop("Select desired USE flags from the list below:",
+	result = maineventloop(ro_mode ? subtitle_ro : subtitle_rw,
 				&callback, &drawflag, flags, keys, true);
 
 	cursesdone();

diff --git a/ufed-curses.c b/ufed-curses.c
index 6870e66..1c1970b 100644
--- a/ufed-curses.c
+++ b/ufed-curses.c
@@ -341,8 +341,8 @@ void drawTop(bool withSep)
 
 	if (ro_mode) {
 		wattrset(w, COLOR_PAIR(4) | A_BOLD | A_REVERSE);
-		sprintf(buf, "%-*.*s", wWidth(Top), wWidth(Top),
-			"(RO) Gentoo USE flags editor " PACKAGE_VERSION " (RO)");
+		sprintf(buf, " READ ONLY %-*.*s READ ONLY ", wWidth(Top) - 22, wWidth(Top) - 22,
+			"Gentoo USE flags editor " PACKAGE_VERSION);
 	} else {
 		wattrset(w, COLOR_PAIR(1) | A_BOLD);
 		sprintf(buf, "%-*.*s", wWidth(Top), wWidth(Top), "Gentoo USE flags editor " PACKAGE_VERSION);
@@ -360,7 +360,7 @@ void drawTop(bool withSep)
 	waddch(w, ACS_VLINE);
 	if (ro_mode) {
 		wattrset(w, COLOR_PAIR(4) | A_REVERSE);
-		sprintf(buf, " READ-ONLY MODE! %-*.*s READ-ONLY MODE! ", wWidth(Top)-36, wWidth(Top)-36, subtitle);
+		sprintf(buf, " READ ONLY %-*.*s READ ONLY ", wWidth(Top)-24, wWidth(Top)-24, subtitle);
 	} else {
 		wattrset(w, COLOR_PAIR(3));
 		sprintf(buf, " %-*.*s ", wWidth(Top)-4, wWidth(Top)-4, subtitle);


^ permalink raw reply related	[flat|nested] 238+ messages in thread
* [gentoo-commits] proj/ufed:master commit in: /
@ 2013-09-10  6:36 Sven Eden
  0 siblings, 0 replies; 238+ messages in thread
From: Sven Eden @ 2013-09-10  6:36 UTC (permalink / raw
  To: gentoo-commits

commit:     153bac578626dcf5809443cd759bd5c2c67c14e8
Author:     Sven Eden <yamakuzure <AT> gmx <DOT> net>
AuthorDate: Mon Sep  9 13:46:22 2013 +0000
Commit:     Sven Eden <sven.eden <AT> gmx <DOT> de>
CommitDate: Mon Sep  9 13:46:22 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/ufed.git;a=commit;h=153bac57

The warning issued when make.conf is not writable is now prefixed with a "WARNING". Should be obvious now.

---
 Portage.pm | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/Portage.pm b/Portage.pm
index 5d21edf..0b6cace 100644
--- a/Portage.pm
+++ b/Portage.pm
@@ -740,8 +740,8 @@ sub _read_make_conf {
 		my $egid = $);
 		$egid =~ s/\s+.*$//; 
 		$ro_mode = 1;
-		print "$used_make_conf not writable by uid/gid $>/$egid\n";
-		print "ufed will run in read-only-mode!\n";
+		print "WARNING: $used_make_conf not writable by uid/gid $>/$egid\n";
+		print "WARNING: ufed will run in read-only-mode!\n";
 	}
 
 	# Note the conf state of the read flags:


^ permalink raw reply related	[flat|nested] 238+ messages in thread
* [gentoo-commits] proj/ufed:master commit in: /
@ 2013-09-10  6:36 Sven Eden
  0 siblings, 0 replies; 238+ messages in thread
From: Sven Eden @ 2013-09-10  6:36 UTC (permalink / raw
  To: gentoo-commits

commit:     ddbb4ba7b3cadc9dd1f237fa79da058fdc201e2b
Author:     Sven Eden <yamakuzure <AT> gmx <DOT> net>
AuthorDate: Mon Sep  9 13:45:25 2013 +0000
Commit:     Sven Eden <sven.eden <AT> gmx <DOT> de>
CommitDate: Mon Sep  9 13:45:25 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/ufed.git;a=commit;h=ddbb4ba7

ufed no longer tries to write out use flags if the new $Portage::ro_mode is not set to 0.

---
 ufed.pl.in | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/ufed.pl.in b/ufed.pl.in
index 5f10a22..a922109 100644
--- a/ufed.pl.in
+++ b/ufed.pl.in
@@ -128,12 +128,12 @@ sub flags_dialog {
 	wait;
 	if(POSIX::WIFEXITED($?)) {
 		my $rc = POSIX::WEXITSTATUS($?);
-		if($rc==0) {
+		if( (0 == $rc) && (0 == $Portage::ro_mode) ) {
 			open my $fh, '<&=', $oread or die "Couldn't read output.\n";
 			my @flags = grep { $_ ne '--*' } do { local $/; split /\n/, <$fh> };
 			close $fh;
 			save_flags finalise @flags;
-		} elsif($rc==1) {
+		} elsif( 1 == $rc ) {
 			print "Cancelled, not saving changes.\n";
 		}
 		exit $rc;
@@ -169,7 +169,7 @@ sub save_flags {
 	my $makeconf_name = $Portage::used_make_conf;
 	{
 		open my $makeconf, '<', $makeconf_name or die "Couldn't open $makeconf_name\n";
-		open my $makeconfold, '>', $makeconf_name . '.old' or die "Couldn't open $makeconf_name.old\n";
+		open my $makeconfold, '>', $makeconf_name . '~' or die "Couldn't open ${makeconf_name}~\n";
 		local $/;
 		$_ = <$makeconf>;
 		print $makeconfold $_;


^ permalink raw reply related	[flat|nested] 238+ messages in thread
* [gentoo-commits] proj/ufed:master commit in: /
@ 2013-09-10  6:36 Sven Eden
  0 siblings, 0 replies; 238+ messages in thread
From: Sven Eden @ 2013-09-10  6:36 UTC (permalink / raw
  To: gentoo-commits

commit:     b9be614d316b878b308b9a06dfa46427af153c91
Author:     Sven Eden <yamakuzure <AT> gmx <DOT> net>
AuthorDate: Tue Sep 10 04:15:17 2013 +0000
Commit:     Sven Eden <sven.eden <AT> gmx <DOT> de>
CommitDate: Tue Sep 10 04:15:17 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/ufed.git;a=commit;h=b9be614d

Portage.pm: When scanning a make.conf directory, only skip files beginning with . or ending with ~.

---
 Portage.pm | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/Portage.pm b/Portage.pm
index 0b6cace..b909092 100644
--- a/Portage.pm
+++ b/Portage.pm
@@ -528,9 +528,10 @@ sub _get_files_from_dir {
 	defined($isRecursive) or $isRecursive = 0;
 
 	for my $confFile (glob("$search_path/*")) {
-		# Skip hidden, backup and temporary files
+		
+		# Skip hidden and backup files
 		if ( (-f $confFile )
-		  && ( ($confFile =~ /(?:\.bak|~|\.old|\.tmp)$/)
+		  && ( ($confFile =~ /~$/)
 		    || ($confFile =~ /^\./) ) ) {
 			debugMsg("Skipping file $confFile");
 			next;


^ permalink raw reply related	[flat|nested] 238+ messages in thread
* [gentoo-commits] proj/ufed:master commit in: /
@ 2013-09-10  6:36 Sven Eden
  0 siblings, 0 replies; 238+ messages in thread
From: Sven Eden @ 2013-09-10  6:36 UTC (permalink / raw
  To: gentoo-commits

commit:     3746f56e9fda85c5e3329e138e314c8fbffb9046
Author:     Sven Eden <yamakuzure <AT> gmx <DOT> net>
AuthorDate: Mon Sep  9 13:44:19 2013 +0000
Commit:     Sven Eden <sven.eden <AT> gmx <DOT> de>
CommitDate: Mon Sep  9 13:44:19 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/ufed.git;a=commit;h=3746f56e

If the determined make.conf is not writable by the effective uid/gid, a warning is issued and the new shared variable $ro_mode is set to 1.

---
 Portage.pm | 23 +++++++++++++++++++----
 1 file changed, 19 insertions(+), 4 deletions(-)

diff --git a/Portage.pm b/Portage.pm
index e8c3c15..5d21edf 100644
--- a/Portage.pm
+++ b/Portage.pm
@@ -51,6 +51,10 @@ our $use_flags;
 # points to the file the last USE settings are found in.
 our $used_make_conf = "";
 
+# If the found make.conf can not be changed by the effective
+# uid/gid of the caller, this value is set to 1
+our $ro_mode = 0;
+
 # --- private members ---
 my %_environment  = ();
 my $_EPREFIX        = "";
@@ -274,11 +278,13 @@ sub _determine_make_conf
 		or $used_make_conf = "${_EPREFIX}/etc/make.conf";
 	
 	# If $used_make_conf points to a directory now,
-	# it is emptied so _read_make_conf will determine
-	# the later used value
+	# or if it is simply not present, it is emptied so
+	# _read_make_conf will determine the later used
+	# value
 	
-	( -d $used_make_conf)
-		and $used_make_conf = "";
+	if ( (! -e $used_make_conf) || (-d $used_make_conf) ) {
+		$used_make_conf = "";
+	}
 		
 	return; 
 }
@@ -729,6 +735,15 @@ sub _read_make_conf {
 	}
 	debugMsg("$used_make_conf will be used to store changes");
 
+	# If the make.conf is not writable, enable read-only-mode
+	if (! -w $used_make_conf ) {
+		my $egid = $);
+		$egid =~ s/\s+.*$//; 
+		$ro_mode = 1;
+		print "$used_make_conf not writable by uid/gid $>/$egid\n";
+		print "ufed will run in read-only-mode!\n";
+	}
+
 	# Note the conf state of the read flags:
 	for my $flag ( keys %{$oldEnv{USE}}) {
 		_add_temp($flag, "global");


^ permalink raw reply related	[flat|nested] 238+ messages in thread
* [gentoo-commits] proj/ufed:master commit in: /
@ 2013-09-10  6:36 Sven Eden
  0 siblings, 0 replies; 238+ messages in thread
From: Sven Eden @ 2013-09-10  6:36 UTC (permalink / raw
  To: gentoo-commits

commit:     b474c18106323db3d7dfe867c7598defe3f2ddd9
Author:     Sven Eden <yamakuzure <AT> gmx <DOT> net>
AuthorDate: Mon Sep  9 14:55:18 2013 +0000
Commit:     Sven Eden <sven.eden <AT> gmx <DOT> de>
CommitDate: Mon Sep  9 14:55:18 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/ufed.git;a=commit;h=b474c181

Added prefixing of predefined configuration values and added read-only-mode as the first in use. When read-only-mode is set, the interface now changes both header lines to other colors and to show the user that flags are not saved.

---
 ufed-curses-checklist.c | 18 ++++++++++++++++++
 ufed-curses-globals.c   |  2 ++
 ufed-curses-globals.h   |  2 ++
 ufed-curses.c           | 19 +++++++++++++++----
 ufed.pl.in              |  6 +++++-
 5 files changed, 42 insertions(+), 5 deletions(-)

diff --git a/ufed-curses-checklist.c b/ufed-curses-checklist.c
index 003fc9a..4a12968 100644
--- a/ufed-curses-checklist.c
+++ b/ufed-curses-checklist.c
@@ -51,6 +51,24 @@ static char *getline(FILE *fp)
 	if(fgets(lineBuf, size, fp) == NULL)
 		return NULL;
 	else {
+
+		/* See to configuration bytes if not read already */
+		if (!configDone) {
+			/* Byte 1: Whether read-only-mode is set or not */
+			if ( '0' != lineBuf[0] )
+				ro_mode = true;
+
+			configDone = true;
+
+			/* Remove the leading bytes transporting configuration values */
+			char *oldLine = lineBuf;
+			lineBuf = malloc(size);
+			if (NULL == lineBuf)
+				ERROR_EXIT(-1, "Can not allocate %lu bytes for line buffer\n", sizeof(char) * size);
+			memcpy(lineBuf, oldLine + 1, size - 1);
+			free(oldLine);
+		} /* End of having to read configuration bytes */
+
 		char *p = strchr(lineBuf, '\n');
 		if(p != NULL) {
 			*p = '\0';

diff --git a/ufed-curses-globals.c b/ufed-curses-globals.c
index ad9b66d..8c348d0 100644
--- a/ufed-curses-globals.c
+++ b/ufed-curses-globals.c
@@ -8,7 +8,9 @@
 #include "ufed-curses-types.h"
 
 int        bottomline     = 0;
+bool       configDone     = false;
 int        minwidth       = 0;
+int        ro_mode        = false;
 int        topline        = 0;
 eMask      e_mask         = eMask_unmasked;
 eOrder     e_order        = eOrder_left;

diff --git a/ufed-curses-globals.h b/ufed-curses-globals.h
index 514563e..54f2cf2 100644
--- a/ufed-curses-globals.h
+++ b/ufed-curses-globals.h
@@ -11,6 +11,7 @@
 #include "ufed-curses-types.h"
 
 extern int        bottomline;
+extern bool       configDone;
 extern eMask      e_mask;
 extern eOrder     e_order;
 extern eScope     e_scope;
@@ -18,6 +19,7 @@ extern eState     e_state;
 extern char*      fayt;
 extern sListStats listStats;
 extern int        minwidth;
+extern bool       ro_mode;
 extern int        topline;
 extern sWindow    window[wCount];
 

diff --git a/ufed-curses.c b/ufed-curses.c
index 1948f99..6870e66 100644
--- a/ufed-curses.c
+++ b/ufed-curses.c
@@ -339,8 +339,14 @@ void drawTop(bool withSep)
 	WINDOW* w = win(Top);
 	char buf[COLS + 1];
 
-	wattrset(w, COLOR_PAIR(1) | A_BOLD);
-	sprintf(buf, "%-*.*s", wWidth(Top), wWidth(Top), "Gentoo USE flags editor " PACKAGE_VERSION);
+	if (ro_mode) {
+		wattrset(w, COLOR_PAIR(4) | A_BOLD | A_REVERSE);
+		sprintf(buf, "%-*.*s", wWidth(Top), wWidth(Top),
+			"(RO) Gentoo USE flags editor " PACKAGE_VERSION " (RO)");
+	} else {
+		wattrset(w, COLOR_PAIR(1) | A_BOLD);
+		sprintf(buf, "%-*.*s", wWidth(Top), wWidth(Top), "Gentoo USE flags editor " PACKAGE_VERSION);
+	}
 	mvwaddstr(w, 0, 0, buf);
 
 	/// REMOVEME: Stop wasting space
@@ -352,8 +358,13 @@ void drawTop(bool withSep)
 	mvwaddch(w, 1, wWidth(Top)-1, ACS_URCORNER);
 
 	waddch(w, ACS_VLINE);
-	wattrset(w, COLOR_PAIR(3));
-	sprintf(buf, " %-*.*s ", wWidth(Top)-4, wWidth(Top)-4, subtitle);
+	if (ro_mode) {
+		wattrset(w, COLOR_PAIR(4) | A_REVERSE);
+		sprintf(buf, " READ-ONLY MODE! %-*.*s READ-ONLY MODE! ", wWidth(Top)-36, wWidth(Top)-36, subtitle);
+	} else {
+		wattrset(w, COLOR_PAIR(3));
+		sprintf(buf, " %-*.*s ", wWidth(Top)-4, wWidth(Top)-4, subtitle);
+	}
 	waddstr(w, buf);
 	wattrset(w, COLOR_PAIR(2) | A_BOLD);
 	waddch(w, ACS_VLINE);

diff --git a/ufed.pl.in b/ufed.pl.in
index a922109..17ffd8e 100644
--- a/ufed.pl.in
+++ b/ufed.pl.in
@@ -119,7 +119,11 @@ sub flags_dialog {
 	# Now let the interface know of the result
 	if (open my $fh, '>&=', $iwrite) {
 		binmode( $fh, ":encoding(ISO-8859-1)" );
-		print $fh $outTxt;
+
+		# Fixed config:
+		# byte 1: Read only 0/1
+		# Rest: The flags configuration
+		print $fh "$Portage::ro_mode$outTxt";
 		close $fh;
 	} else {
 		die "Couldn't let interface know of flags\n";


^ permalink raw reply related	[flat|nested] 238+ messages in thread
* [gentoo-commits] proj/ufed:master commit in: /
@ 2013-07-22  9:34 Sven Eden
  0 siblings, 0 replies; 238+ messages in thread
From: Sven Eden @ 2013-07-22  9:34 UTC (permalink / raw
  To: gentoo-commits

commit:     09baec6ff972e6b7f7c7ac4d99dd58566637fe48
Author:     Sven Eden <yamakuzure <AT> gmx <DOT> net>
AuthorDate: Mon Jul 22 09:35:06 2013 +0000
Commit:     Sven Eden <sven.eden <AT> gmx <DOT> de>
CommitDate: Mon Jul 22 09:35:06 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/ufed.git;a=commit;h=09baec6f

Changed the search for files if make.conf is a directory to be done by a recursive function. Known items to skip are now skipped correctly:

---
 Portage.pm | 63 ++++++++++++++++++++++++++++++++++++++++++++++++++++++--------
 1 file changed, 55 insertions(+), 8 deletions(-)

diff --git a/Portage.pm b/Portage.pm
index 8d37c38..e8c3c15 100644
--- a/Portage.pm
+++ b/Portage.pm
@@ -20,7 +20,7 @@ BEGIN {
 # --- public members ---
 
 # Set this to 1 to get debugging output
-Readonly our $DEBUG => 1;
+Readonly our $DEBUG => 0;
 
 # $use_flags - hashref that represents the combined and
 # consolidated data about all valid use flags
@@ -100,6 +100,7 @@ sub _determine_profiles;
 sub _final_cleaning;
 sub _fix_flags;
 sub _gen_use_flags;
+sub _get_files_from_dir;
 sub _merge;
 sub _merge_env;
 sub _noncomments;
@@ -214,7 +215,7 @@ sub _add_flag
 		die ("\n\"$flag\" ($pkg) Description Hash Key\n  \"$descKey\"\nis illegal!\n");
 	}
 
-	return;	
+	return 1;	
 }
 
 
@@ -505,6 +506,56 @@ sub _gen_use_flags
 }
 
 
+# Get an alphabetical case insensitive list of files
+# from a path (_not_ depth first!) and return it
+# Param 1: the path to search in
+# Param 2: recursive calls should set this to 1
+sub _get_files_from_dir {
+	my ($search_path, $isRecursive) = @_;
+	my @result        = ();
+	
+	# Nothing to do if the search path is empty
+	(	defined($search_path)
+	 &&	length($search_path) )
+	 or return @result; 
+	 
+	defined($isRecursive) or $isRecursive = 0;
+
+	for my $confFile (glob("$search_path/*")) {
+		# Skip hidden, backup and temporary files
+		if ( (-f $confFile )
+		  && ( ($confFile =~ /(?:\.bak|~|\.old|\.tmp)$/)
+		    || ($confFile =~ /^\./) ) ) {
+			debugMsg("Skipping file $confFile");
+			next;
+		}
+		
+		# Skip special directories CVS, RCS and SCCS
+		if ( (-d $confFile)
+		  && ($confFile =~ /\/(?:CVS|RCS|SCCS)$/ ) ) {
+			debugMsg("Skipping directory $confFile");
+			next;
+		}
+		
+		# recurse if this is a directory:
+		if (-d $confFile) {
+			push @result, _get_files_from_dir($confFile, 1);
+			next;
+		}
+		
+		# Otherwise just add to result list
+		push @result, $confFile;
+	}
+
+	# return plain list if this is a recursive call
+	$isRecursive and return @result;
+
+	# return an alphabetically sorted list:
+	my @sorted = sort {lc($a) cmp lc($b)} @result;
+	return @sorted;
+}
+
+
 # merges two hashes into the first.
 # Parameter 1: reference of the destination hash
 # Parameter 2: reference of the source hash
@@ -654,12 +705,8 @@ sub _read_make_conf {
 	
 	for my $confPath ($stOldPath, $stNewPath) {
 		if ( -d $confPath) {
-			for my $confFile (sort {lc($a) cmp lc($b)} glob("$confPath/*")) {
-				# Skip backup and temporary files
-				$confFile =~ /(?:\.bak|~|\.old|\.tmp)$/
-					and next;
-				
-				# Now read the file and merge its content
+			my @confFileList = _get_files_from_dir($confPath);
+			for my $confFile (@confFileList) {
 				debugMsg("Reading $confFile");
 				%newEnv = _read_sh($confFile);
 				_merge (\%oldEnv, \%newEnv);


^ permalink raw reply related	[flat|nested] 238+ messages in thread
* [gentoo-commits] proj/ufed:master commit in: /
@ 2013-07-22  6:09 Sven Eden
  0 siblings, 0 replies; 238+ messages in thread
From: Sven Eden @ 2013-07-22  6:09 UTC (permalink / raw
  To: gentoo-commits

commit:     4d1818f095f4b0039b484aa12f11aa1b78f8531a
Author:     Sven Eden <yamakuzure <AT> gmx <DOT> net>
AuthorDate: Mon Jul 22 05:51:14 2013 +0000
Commit:     Sven Eden <sven.eden <AT> gmx <DOT> de>
CommitDate: Mon Jul 22 05:51:14 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/ufed.git;a=commit;h=4d1818f0

Changed file search in make.conf directory parsing to be case insensitive.

---
 Portage.pm | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Portage.pm b/Portage.pm
index a254695..8d37c38 100644
--- a/Portage.pm
+++ b/Portage.pm
@@ -654,7 +654,7 @@ sub _read_make_conf {
 	
 	for my $confPath ($stOldPath, $stNewPath) {
 		if ( -d $confPath) {
-			for my $confFile (sort glob("$confPath/*")) {
+			for my $confFile (sort {lc($a) cmp lc($b)} glob("$confPath/*")) {
 				# Skip backup and temporary files
 				$confFile =~ /(?:\.bak|~|\.old|\.tmp)$/
 					and next;


^ permalink raw reply related	[flat|nested] 238+ messages in thread
* [gentoo-commits] proj/ufed:master commit in: /
@ 2013-07-22  6:09 Sven Eden
  0 siblings, 0 replies; 238+ messages in thread
From: Sven Eden @ 2013-07-22  6:09 UTC (permalink / raw
  To: gentoo-commits

commit:     018d9cd1d6185511b539cd25f1473a567c62b952
Author:     Sven Eden <yamakuzure <AT> gmx <DOT> net>
AuthorDate: Mon Jul 22 05:42:16 2013 +0000
Commit:     Sven Eden <sven.eden <AT> gmx <DOT> de>
CommitDate: Mon Jul 22 05:42:16 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/ufed.git;a=commit;h=018d9cd1

Added parsing of files in a possible make.conf directory, skipping backup and temporary files. The last found file with a USE assignement is used to store changes.

---
 COPYING    | 10 ++++-----
 Portage.pm | 75 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++------
 ufed.pl.in | 20 ++++++++++-------
 3 files changed, 85 insertions(+), 20 deletions(-)

diff --git a/COPYING b/COPYING
index 5b6e7c6..dcfa4c2 100644
--- a/COPYING
+++ b/COPYING
@@ -55,7 +55,7 @@ patent must be licensed for everyone's free use or not licensed at all.
 
   The precise terms and conditions for copying, distribution and
 modification follow.
-\f
+
 		    GNU GENERAL PUBLIC LICENSE
    TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
 
@@ -110,7 +110,7 @@ above, provided that you also meet all of these conditions:
     License.  (Exception: if the Program itself is interactive but
     does not normally print such an announcement, your work based on
     the Program is not required to print an announcement.)
-\f
+
 These requirements apply to the modified work as a whole.  If
 identifiable sections of that work are not derived from the Program,
 and can be reasonably considered independent and separate works in
@@ -168,7 +168,7 @@ access to copy from a designated place, then offering equivalent
 access to copy the source code from the same place counts as
 distribution of the source code, even though third parties are not
 compelled to copy the source along with the object code.
-\f
+
   4. You may not copy, modify, sublicense, or distribute the Program
 except as expressly provided under this License.  Any attempt
 otherwise to copy, modify, sublicense or distribute the Program is
@@ -225,7 +225,7 @@ impose that choice.
 
 This section is intended to make thoroughly clear what is believed to
 be a consequence of the rest of this License.
-\f
+
   8. If the distribution and/or use of the Program is restricted in
 certain countries either by patents or by copyrighted interfaces, the
 original copyright holder who places the Program under this License
@@ -278,7 +278,7 @@ PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
 POSSIBILITY OF SUCH DAMAGES.
 
 		     END OF TERMS AND CONDITIONS
-\f
+
 	    How to Apply These Terms to Your New Programs
 
   If you develop a new program, and you want it to be of the greatest

diff --git a/Portage.pm b/Portage.pm
index ecf39ca..a254695 100644
--- a/Portage.pm
+++ b/Portage.pm
@@ -1,11 +1,12 @@
 package Portage;
 
-# Copyright 1999-2005 Gentoo Foundation
+# Copyright 1999-2013 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-src/ufed/Portage.pm,v 1.3 2005/11/13 00:28:17 truedfx Exp $
+# $Header: $
 
 use strict;
 use warnings;
+use Readonly;
 
 BEGIN {
     use Exporter ();
@@ -18,6 +19,9 @@ BEGIN {
 
 # --- public members ---
 
+# Set this to 1 to get debugging output
+Readonly our $DEBUG => 1;
+
 # $use_flags - hashref that represents the combined and
 # consolidated data about all valid use flags
 # Layout of $use_flags->{flag_name}:
@@ -43,6 +47,8 @@ BEGIN {
 our $use_flags;
 
 # $used_make_conf - path of the used make.conf
+# If PREFIX/etc/[portage/]make.conf is a directory, $used_make_conf
+# points to the file the last USE settings are found in.
 our $used_make_conf = "";
 
 # --- private members ---
@@ -83,6 +89,7 @@ my $_use_template = {
 };
 
 # --- public methods ---
+sub debugMsg;
 
 # --- private methods ---
 sub _add_flag;
@@ -159,6 +166,17 @@ INIT {
 
 # --- public methods implementations ---
 
+# Write a given message to STDERR adding a newline at the end
+# This function does nothing unless $DEBUG is set to something
+# different than zero
+# Parameter 1: The message
+sub debugMsg
+{
+	my ($msg) = @_;
+	$DEBUG or return;
+	print STDERR "$msg\n";
+	return;
+}
 
 # --- private methods implementations ---
 
@@ -251,8 +269,16 @@ sub _determine_eprefix {
 sub _determine_make_conf
 {
 	$used_make_conf = "${_EPREFIX}/etc/portage/make.conf";
-	(! -r $used_make_conf)
-		and $used_make_conf = "${_EPREFIX}/etc/make.conf";
+	(-r $used_make_conf)
+		or $used_make_conf = "${_EPREFIX}/etc/make.conf";
+	
+	# If $used_make_conf points to a directory now,
+	# it is emptied so _read_make_conf will determine
+	# the later used value
+	
+	( -d $used_make_conf)
+		and $used_make_conf = "";
+		
 	return; 
 }
 
@@ -615,11 +641,46 @@ sub _read_descriptions
 # The last added profile directory, if it exists, is
 # /etc/portage/profile to allow recognition of user
 # overrides.
+# If either of the make.conf paths is a directory, all
+# files are read in alphanumerical order. The file
+# changes are written to will be the last file that
+# contains a USE assignement.
 # No parameters accepted.
 sub _read_make_conf {
-	my %oldEnv = _read_sh("${_EPREFIX}/etc/make.conf");
-	my %newEnv = _read_sh("${_EPREFIX}/etc/portage/make.conf");
-	_merge (\%oldEnv, \%newEnv);
+	my ($stOldPath, $stNewPath) = (	"${_EPREFIX}/etc/make.conf",
+									"${_EPREFIX}/etc/portage/make.conf" );
+	my (%oldEnv, %newEnv)		= ([], []);
+	my $lastUSEFile				= "";
+	
+	for my $confPath ($stOldPath, $stNewPath) {
+		if ( -d $confPath) {
+			for my $confFile (sort glob("$confPath/*")) {
+				# Skip backup and temporary files
+				$confFile =~ /(?:\.bak|~|\.old|\.tmp)$/
+					and next;
+				
+				# Now read the file and merge its content
+				debugMsg("Reading $confFile");
+				%newEnv = _read_sh($confFile);
+				_merge (\%oldEnv, \%newEnv);
+				defined($newEnv{USE})
+					and $lastUSEFile = $confFile
+					and debugMsg(" -> USE flags found");
+			}
+		} else {
+			%newEnv = _read_sh($confPath);
+			_merge (\%oldEnv, \%newEnv);
+			$lastUSEFile = $confPath;
+		}
+	}
+	
+	# If there is no used make.conf found, yet, save it:
+	if ( 0 == length($used_make_conf) ) {
+		$used_make_conf = $lastUSEFile;
+		$used_make_conf =~ /\/make\.conf$/
+			or print "Using $used_make_conf as USE flags file\n";
+	}
+	debugMsg("$used_make_conf will be used to store changes");
 
 	# Note the conf state of the read flags:
 	for my $flag ( keys %{$oldEnv{USE}}) {

diff --git a/ufed.pl.in b/ufed.pl.in
index 3bc048a..5f10a22 100644
--- a/ufed.pl.in
+++ b/ufed.pl.in
@@ -2,9 +2,9 @@
 use strict;
 use warnings;
 
-# Copyright 1999-2005 Gentoo Foundation
+# Copyright 1999-2013 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-src/ufed/ufed.pl,v 1.45 2005/10/18 11:14:33 truedfx Exp $
+# $
 
 use lib qw{XX_perldir@};
 use Portage;
@@ -133,13 +133,15 @@ sub flags_dialog {
 			my @flags = grep { $_ ne '--*' } do { local $/; split /\n/, <$fh> };
 			close $fh;
 			save_flags finalise @flags;
-		} elsif($rc==1)
-		{ print "Cancelled, not saving changes.\n" }
+		} elsif($rc==1) {
+			print "Cancelled, not saving changes.\n";
+		}
 		exit $rc;
-	} elsif(POSIX::WIFSIGNALED($?))
-	{ kill POSIX::WTERMSIG($?), $$ }
-	else
-	{ exit 127 }
+	} elsif(POSIX::WIFSIGNALED($?)) {
+		kill (POSIX::WTERMSIG($?), $$);
+	} else {
+		exit 127;
+	}
 	return;
 }
 
@@ -309,6 +311,8 @@ EOF
 		open my $makeconf, '>', $makeconf_name or die "Couldn't open $makeconf_name\n";
 		print $makeconf $_;
 		close $makeconf;
+		$makeconf_name =~ /\/make\.conf$/
+			or print "USE flags written to $makeconf_name\n";
 	}
 	
 	return;


^ permalink raw reply related	[flat|nested] 238+ messages in thread
* [gentoo-commits] proj/ufed:master commit in: /
@ 2013-04-09  7:22 Sven Eden
  0 siblings, 0 replies; 238+ messages in thread
From: Sven Eden @ 2013-04-09  7:22 UTC (permalink / raw
  To: gentoo-commits

commit:     b7fbeb16a378a09db59b2c23e18d977ab772af16
Author:     Sven Eden <sven.eden <AT> gmx <DOT> de>
AuthorDate: Tue Apr  9 07:23:24 2013 +0000
Commit:     Sven Eden <sven.eden <AT> gmx <DOT> de>
CommitDate: Tue Apr  9 07:23:24 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/ufed.git;a=commit;h=b7fbeb16

Added a "thank you" section to the documentation.

---
 ufed-curses-help.c |    6 ++++++
 ufed.8.in          |    7 ++++++-
 2 files changed, 12 insertions(+), 1 deletions(-)

diff --git a/ufed-curses-help.c b/ufed-curses-help.c
index 981f946..7dfbf93 100644
--- a/ufed-curses-help.c
+++ b/ufed-curses-help.c
@@ -220,6 +220,12 @@ static void init_lines(void)
 "ufed is currently maintained by",
 " Sven Eden <yamakuzure@gmx.net>.",
 "",
+"--- Thanks ---",
+" Paul Varner - for proxy maintaining and support.",
+" Roman Zilka - for ideas, testing and a lot of patience.",
+"",
+"--------------",
+"",
 "Copyright 1999-2013 Gentoo Foundation",
 "Distributed under the terms of the GNU General Public License v2"
 };

diff --git a/ufed.8.in b/ufed.8.in
index 7755b6d..c916bf2 100644
--- a/ufed.8.in
+++ b/ufed.8.in
@@ -1,4 +1,4 @@
-.TH "UFED" "8" "15 Feb 2013" "UFED 0.90" "UFED"
+.TH "UFED" "8" "09 Apr 2013" "UFED 0.90" "UFED"
 .SH "NAME"
 ufed \- Gentoo Linux USE flags editor
 .SH "SYNOPSIS"
@@ -236,3 +236,8 @@ ufed was previously maintained by
 ufed is currently maintained by
 .br
  Sven Eden <yamakuzure@gmx.net>.
+
+.SH Thanks
+Paul Varner - for proxy maintaining and support.
+.br
+Roman Zilka - for ideas, testing and a lot of patience.


^ permalink raw reply related	[flat|nested] 238+ messages in thread
* [gentoo-commits] proj/ufed:master commit in: /
@ 2013-04-09  7:22 Sven Eden
  0 siblings, 0 replies; 238+ messages in thread
From: Sven Eden @ 2013-04-09  7:22 UTC (permalink / raw
  To: gentoo-commits

commit:     e7cd472cd9fddb8b10b53edcab0401ae586717f6
Author:     Sven Eden <sven.eden <AT> gmx <DOT> de>
AuthorDate: Tue Apr  9 05:52:02 2013 +0000
Commit:     Sven Eden <sven.eden <AT> gmx <DOT> de>
CommitDate: Tue Apr  9 05:52:02 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/ufed.git;a=commit;h=e7cd472c

The cursor is now invisible on the help screen.

---
 ufed-curses-help.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/ufed-curses-help.c b/ufed-curses-help.c
index 7254a9d..981f946 100644
--- a/ufed-curses-help.c
+++ b/ufed-curses-help.c
@@ -342,5 +342,7 @@ void help(void)
 		init_lines();
 	}
 
+	int oldVis = curs_set(0);
 	maineventloop("", &callback, &drawline, lines, keys, false);
+	curs_set(oldVis);
 }


^ permalink raw reply related	[flat|nested] 238+ messages in thread
* [gentoo-commits] proj/ufed:master commit in: /
@ 2013-04-09  7:22 Sven Eden
  0 siblings, 0 replies; 238+ messages in thread
From: Sven Eden @ 2013-04-09  7:22 UTC (permalink / raw
  To: gentoo-commits

commit:     2d3cfe269b26b5404589c9b3d12ff024f09bbc94
Author:     Sven Eden <sven.eden <AT> gmx <DOT> de>
AuthorDate: Tue Apr  9 05:50:11 2013 +0000
Commit:     Sven Eden <sven.eden <AT> gmx <DOT> de>
CommitDate: Tue Apr  9 05:50:11 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/ufed.git;a=commit;h=2d3cfe26

Changed the colors of highlighted lines in the help screen to make them better recognizable.

---
 ufed-curses-help.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/ufed-curses-help.c b/ufed-curses-help.c
index 7a9115d..7254a9d 100644
--- a/ufed-curses-help.c
+++ b/ufed-curses-help.c
@@ -303,7 +303,7 @@ static int drawline(sFlag* line, bool highlight)
 			wattrset(win(List), COLOR_PAIR(5) | A_BOLD);
 	} else {
 		if (highlight)
-			wattrset(win(List), COLOR_PAIR(2) | A_BOLD | A_REVERSE);
+			wattrset(win(List), COLOR_PAIR(6) | A_BOLD);
 		else
 			wattrset(win(List), COLOR_PAIR(3));
 	}


^ permalink raw reply related	[flat|nested] 238+ messages in thread
* [gentoo-commits] proj/ufed:master commit in: /
@ 2013-04-08  7:18 Sven Eden
  0 siblings, 0 replies; 238+ messages in thread
From: Sven Eden @ 2013-04-08  7:18 UTC (permalink / raw
  To: gentoo-commits

commit:     bbfb51392ce096916aaba9f419b40aacc17ae6e7
Author:     Sven Eden <sven.eden <AT> gmx <DOT> de>
AuthorDate: Mon Apr  8 07:19:15 2013 +0000
Commit:     Sven Eden <sven.eden <AT> gmx <DOT> de>
CommitDate: Mon Apr  8 07:19:15 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/ufed.git;a=commit;h=bbfb5139

Safe USE_EXPAND_HIDDEN separaterly and merge them into USE_EXPAND if the former has been set to "-*" in make.conf

---
 Portage.pm |   17 +++++++++++++++++
 1 files changed, 17 insertions(+), 0 deletions(-)

diff --git a/Portage.pm b/Portage.pm
index 97ba400..ecf39ca 100644
--- a/Portage.pm
+++ b/Portage.pm
@@ -49,6 +49,7 @@ our $used_make_conf = "";
 my %_environment  = ();
 my $_EPREFIX        = "";
 my @_profiles     = ();
+my %_use_eh_safe  = (); ## USE_EXPAND_HIDDEN safe hash. See _read_make_defaults()
 my %_use_order    = ();
 
 # $_use_temp - hashref that represents the current state of
@@ -664,6 +665,12 @@ sub _read_make_defaults {
 					and $_use_temp->{$flag}{global}{"default"} = 1
 					or  $_use_temp->{$flag}{global}{"default"} = -1;
 			}
+			
+			# Safe USE_EXPAND_HIDDEN if set. This is done because a user might
+			# set it to "-*" in make.conf, which does not disable flags but only
+			# the hidden status making them visible.
+			_merge(\%_use_eh_safe, $env{USE_EXPAND_HIDDEN})
+				if (defined($env{USE_EXPAND_HIDDEN}));
 		}
 	} ## End of reading make.defaults
 
@@ -944,11 +951,21 @@ sub _read_use_mask {
 #
 # Note2: It might be a good idea to leave this function and just reduce it to kill
 #        USE_EXPAND_HIDDEN flags, as they must not be seen anyway.
+#
+# Note3: It can happen, that a user sets USE_EXPAND_HIDDEN to "-*" - which then moves
+#        all entries to MOVE_EXPAND making them visible.
 sub _remove_expands {
 
 	my $expands = $_environment{USE_EXPAND} || {};
 	my $hidden  = $_environment{USE_EXPAND_HIDDEN} || {};
 
+	# If USE_EXPAND_HIDDEN is set to "-*", the safed flags have to be merged
+	# into USE_EXPAND
+	if (defined($hidden->{"*"})) {
+		_merge($expands, \%_use_eh_safe);
+		$hidden = {};
+	}
+
 	for my $key (map {my $x=lc($_)."_"; $x } keys %$expands) {
 		for my $flag (keys %$_use_temp) {
 			if ($flag =~ /^$key/ ) {


^ permalink raw reply related	[flat|nested] 238+ messages in thread
* [gentoo-commits] proj/ufed:master commit in: /
@ 2013-04-03 13:39 Sven Eden
  0 siblings, 0 replies; 238+ messages in thread
From: Sven Eden @ 2013-04-03 13:39 UTC (permalink / raw
  To: gentoo-commits

commit:     1827b95160b29d5b53393add21b54bdab2cbc8e0
Author:     Sven Eden <sven.eden <AT> gmx <DOT> de>
AuthorDate: Wed Apr  3 13:40:01 2013 +0000
Commit:     Sven Eden <sven.eden <AT> gmx <DOT> de>
CommitDate: Wed Apr  3 13:40:01 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/ufed.git;a=commit;h=1827b951

Use pkg-config to check for ncurses. this should fix bug #464328

---
 Makefile.am  |    2 ++
 configure.ac |   28 +++++++++++++++++++++++++---
 2 files changed, 27 insertions(+), 3 deletions(-)

diff --git a/Makefile.am b/Makefile.am
index aaf93cd..2e92da4 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -15,6 +15,8 @@ ufed_curses_SOURCES = \
 	ufed-curses-globals.c \
 	ufed-curses-types.c
 
+ufed_curses_LDADD = $(NCURSES_LIBS)
+
 noinst_HEADERS = \
 	ufed-curses.h \
 	ufed-curses-debug.h \

diff --git a/configure.ac b/configure.ac
index 1f47b68..a3308b9 100644
--- a/configure.ac
+++ b/configure.ac
@@ -18,14 +18,36 @@ else
 fi
 CFLAGS="${CFLAGS} -Wmissing-prototypes -Wstrict-prototypes"
 
+PKG_PROG_PKG_CONFIG
+
 AC_TYPE_SIZE_T
 AC_CHECK_HEADER_STDBOOL
 
+curses="default"
+HAVE_CURSES=0
+
 AC_ARG_WITH([curses],
 	[AS_HELP_STRING([--with-curses], [override default curses library (ncursesw ncurses curses)])],
-	[curses=$withval],
-	[curses="ncursesw ncurses curses"])
-AC_SEARCH_LIBS([initscr], [$curses], [], [AC_MSG_ERROR([curses library not found])])
+	[curses=$withval])
+
+dnl try user option first
+dnl ---------------------
+
+AS_IF([test "x$curses" != "xdefault"], [
+	PKG_CHECK_MODULES([NCURSES], [$curses], [HAVE_CURSES=1])
+])
+
+dnl otherwise check the defaults
+dnl ----------------------------
+
+AS_IF([test "x$HAVE_CURSES" = "x0"], [
+	PKG_CHECK_MODULES([NCURSES], [ncursesw], [HAVE_CURSES=1], [
+	PKG_CHECK_MODULES([NCURSES], [ncurses],  [HAVE_CURSES=1], [
+	PKG_CHECK_MODULES([NCURSES], [curses], [HAVE_CURSES=1], [
+	AC_MSG_ERROR([No valid ncurses installation found])])
+		])
+	])
+])
 
 AC_PATH_PROG([PERL], [perl], [])
 


^ permalink raw reply related	[flat|nested] 238+ messages in thread
* [gentoo-commits] proj/ufed:master commit in: /
@ 2013-03-05 16:53 Sven Eden
  0 siblings, 0 replies; 238+ messages in thread
From: Sven Eden @ 2013-03-05 16:53 UTC (permalink / raw
  To: gentoo-commits

commit:     6bbc50cccdfad7790be9135778f66308dfbdcd49
Author:     Sven Eden <sven.eden <AT> gmx <DOT> de>
AuthorDate: Tue Mar  5 16:54:52 2013 +0000
Commit:     Sven Eden <sven.eden <AT> gmx <DOT> de>
CommitDate: Tue Mar  5 16:54:52 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/ufed.git;a=commit;h=6bbc50cc

Fixed a typo: package/description order toggle is F9, not F8.

---
 ufed-curses-checklist.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/ufed-curses-checklist.c b/ufed-curses-checklist.c
index 6eb2d6f..003fc9a 100644
--- a/ufed-curses-checklist.c
+++ b/ufed-curses-checklist.c
@@ -27,7 +27,7 @@ static const sKey keys[] = {
 	{ KEY_F(5), mkKey("F5: Local/Global"),   1 },
 	{ KEY_F(6), mkKey("F6: Installed"),      1 },
 	{ KEY_F(7), mkKey("F7: Masked/Forced"),  1 },
-	{ KEY_F(9), mkKey("F8: Pkg/Desc Order"), 1 },
+	{ KEY_F(9), mkKey("F9: Pkg/Desc Order"), 1 },
 	{ '\0',     mkKey(""),                   0 }
 };
 #undef mkKey


^ permalink raw reply related	[flat|nested] 238+ messages in thread
* [gentoo-commits] proj/ufed:master commit in: /
@ 2013-03-05 16:49 Sven Eden
  0 siblings, 0 replies; 238+ messages in thread
From: Sven Eden @ 2013-03-05 16:49 UTC (permalink / raw
  To: gentoo-commits

commit:     476a4a78f6a9cba9cd189b6fe03d99c27c63698d
Author:     Sven Eden <sven.eden <AT> gmx <DOT> de>
AuthorDate: Tue Mar  5 06:57:32 2013 +0000
Commit:     Sven Eden <sven.eden <AT> gmx <DOT> de>
CommitDate: Tue Mar  5 06:57:32 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/ufed.git;a=commit;h=476a4a78

Changed main keys to fit in 80 characters

---
 ufed-curses-checklist.c |   18 +++++++++---------
 1 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/ufed-curses-checklist.c b/ufed-curses-checklist.c
index 2118c9c..6eb2d6f 100644
--- a/ufed-curses-checklist.c
+++ b/ufed-curses-checklist.c
@@ -20,15 +20,15 @@ static sFlag*  flags           = NULL;
 
 #define mkKey(x) x, sizeof(x)-1
 static const sKey keys[] = {
-	{ '?',      mkKey("Help (?)"),            0 },
-	{ '\n',     mkKey("Save (Enter)"),        0 },
-	{ '\033',   mkKey("Cancel (Esc)"),        0 },
-	{ -1,       mkKey("Toggle :"),            1 },
-	{ KEY_F(5), mkKey("Local/Global (F5)"),   1 },
-	{ KEY_F(6), mkKey("Installed (F6)"),      1 },
-	{ KEY_F(7), mkKey("Masked/Forced (F7)"),  1 },
-	{ KEY_F(9), mkKey("Pkg/Desc Order (F9)"), 1 },
-	{ '\0',     mkKey(""),                    0 }
+	{ '?',      mkKey("?: Help"),            0 },
+	{ '\n',     mkKey("Enter: Save"),        0 },
+	{ '\033',   mkKey("Esc: Cancel"),        0 },
+	{ -1,       mkKey("Toggle"),             1 },
+	{ KEY_F(5), mkKey("F5: Local/Global"),   1 },
+	{ KEY_F(6), mkKey("F6: Installed"),      1 },
+	{ KEY_F(7), mkKey("F7: Masked/Forced"),  1 },
+	{ KEY_F(9), mkKey("F8: Pkg/Desc Order"), 1 },
+	{ '\0',     mkKey(""),                   0 }
 };
 #undef mkKey
 


^ permalink raw reply related	[flat|nested] 238+ messages in thread
* [gentoo-commits] proj/ufed:master commit in: /
@ 2013-03-05 16:49 Sven Eden
  0 siblings, 0 replies; 238+ messages in thread
From: Sven Eden @ 2013-03-05 16:49 UTC (permalink / raw
  To: gentoo-commits

commit:     489db58cb8a16b89650624a3a70b43eb008b8a4c
Author:     Sven Eden <sven.eden <AT> gmx <DOT> de>
AuthorDate: Mon Mar  4 17:58:30 2013 +0000
Commit:     Sven Eden <sven.eden <AT> gmx <DOT> de>
CommitDate: Mon Mar  4 17:58:30 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/ufed.git;a=commit;h=489db58c

Added a new member "row" to the sKey struct to add information about in which row a key is to be displayed.

---
 ufed-curses-checklist.c |   18 +++++++++---------
 ufed-curses-help.c      |    8 ++++----
 ufed-curses-types.h     |    1 +
 3 files changed, 14 insertions(+), 13 deletions(-)

diff --git a/ufed-curses-checklist.c b/ufed-curses-checklist.c
index 7e0f018..2118c9c 100644
--- a/ufed-curses-checklist.c
+++ b/ufed-curses-checklist.c
@@ -20,15 +20,15 @@ static sFlag*  flags           = NULL;
 
 #define mkKey(x) x, sizeof(x)-1
 static const sKey keys[] = {
-	{ '?',      mkKey("Help (?)")             },
-	{ '\n',     mkKey("Save (Enter)")         },
-	{ '\033',   mkKey("Cancel (Esc)")         },
-	{ -1,       mkKey("Toggle :")             },
-	{ KEY_F(5), mkKey("Local/Global (F5)")    },
-	{ KEY_F(6), mkKey("Installed (F6)")       },
-	{ KEY_F(7), mkKey("Masked/Forced (F7)")   },
-	{ KEY_F(9), mkKey("Pkg/Desc Order (F9)")  },
-	{ '\0',     mkKey("")                     }
+	{ '?',      mkKey("Help (?)"),            0 },
+	{ '\n',     mkKey("Save (Enter)"),        0 },
+	{ '\033',   mkKey("Cancel (Esc)"),        0 },
+	{ -1,       mkKey("Toggle :"),            1 },
+	{ KEY_F(5), mkKey("Local/Global (F5)"),   1 },
+	{ KEY_F(6), mkKey("Installed (F6)"),      1 },
+	{ KEY_F(7), mkKey("Masked/Forced (F7)"),  1 },
+	{ KEY_F(9), mkKey("Pkg/Desc Order (F9)"), 1 },
+	{ '\0',     mkKey(""),                    0 }
 };
 #undef mkKey
 

diff --git a/ufed-curses-help.c b/ufed-curses-help.c
index 572ccec..7a9115d 100644
--- a/ufed-curses-help.c
+++ b/ufed-curses-help.c
@@ -283,12 +283,12 @@ static void free_lines(void)
 	}
 }
 
-static const sKey keys[] = {
 #define key(x) x, sizeof(x)-1
-	{ '\033', key("Back (Esc)") },
-	{ '\0',   key("")         }
-#undef key
+static const sKey keys[] = {
+	{ '\033', key("Back (Esc)"), 0 },
+	{ '\0',   key(""), 0         }
 };
+#undef key
 
 static int drawline(sFlag* line, bool highlight)
 {

diff --git a/ufed-curses-types.h b/ufed-curses-types.h
index 7eb7991..af7deec 100644
--- a/ufed-curses-types.h
+++ b/ufed-curses-types.h
@@ -148,6 +148,7 @@ typedef struct sKey_ {
 	int key;           //!< curses key or -1 if no key shall be used
 	const char *descr; //!< Help text to display
 	size_t length;     //!< length of the description
+	int row;           //!< On which row this key is to be displayed, 0 or 1
 } sKey;
 
 


^ permalink raw reply related	[flat|nested] 238+ messages in thread
* [gentoo-commits] proj/ufed:master commit in: /
@ 2013-03-05 16:49 Sven Eden
  0 siblings, 0 replies; 238+ messages in thread
From: Sven Eden @ 2013-03-05 16:49 UTC (permalink / raw
  To: gentoo-commits

commit:     d9051ae17b0d522a4f8ffd203a2b0e7a65b88d88
Author:     Sven Eden <sven.eden <AT> gmx <DOT> de>
AuthorDate: Mon Mar  4 17:58:00 2013 +0000
Commit:     Sven Eden <sven.eden <AT> gmx <DOT> de>
CommitDate: Mon Mar  4 17:58:00 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/ufed.git;a=commit;h=d9051ae1

Removed one superfluous drawn line from the top, so the bottom can have one extra lines to display the new display and filter toggle keys.

---
 ufed-curses-globals.c |   15 ++++++++-------
 ufed-curses.c         |   22 +++++++++++++---------
 2 files changed, 21 insertions(+), 16 deletions(-)

diff --git a/ufed-curses-globals.c b/ufed-curses-globals.c
index dc9a38a..ad9b66d 100644
--- a/ufed-curses-globals.c
+++ b/ufed-curses-globals.c
@@ -16,12 +16,13 @@ eScope     e_scope        = eScope_all;
 eState     e_state        = eState_all;
 char*      fayt           = NULL;
 sListStats listStats      = { 0, 0, 0, 0, 0, 0 };
+// windows: top, left, height width
 sWindow    window[wCount] = {
-	{ NULL,  0,  0,  5,  0 }, /* Top       --- Top ---- */
-	{ NULL,  5,  0, -8,  3 }, /* Left      L+------+S|R */
-	{ NULL,  5,  3, -9, -6 }, /* List      E|      |c|i */
-	{ NULL, -4,  3,  1, -6 }, /* Input     F| List |r|g */
-	{ NULL,  5, -3, -8,  1 }, /* Scrollbar T|______|B|h */
-	{ NULL,  5, -2, -8,  2 }, /* Right     |+Input-+r|t */
-	{ NULL, -3,  0,  3,  0 }, /* Bottom    ---Bottom--- */
+	{ NULL,  0,  0,   4,  0 }, /* Top       --- Top ---- */
+	{ NULL,  4,  0,  -8,  3 }, /* Left      L+------+S|R */
+	{ NULL,  4,  3,  -9, -6 }, /* List      E|      |c|i */
+	{ NULL, -5,  3,   1, -6 }, /* Input     F| List |r|g */
+	{ NULL,  4, -3,  -8,  1 }, /* Scrollbar T|______|B|h */
+	{ NULL,  4, -2,  -8,  2 }, /* Right     |+Input-+r|t */
+	{ NULL, -4,  0,   4,  0 }, /* Bottom    ---Bottom--- */
 };

diff --git a/ufed-curses.c b/ufed-curses.c
index fc262c8..cf97d0c 100644
--- a/ufed-curses.c
+++ b/ufed-curses.c
@@ -133,9 +133,12 @@ void drawBottom(bool withSep)
 	waddch  (w, ACS_VLINE);                   // Left vline on line 1
 	whline  (w, ' ', bWidth - 2);             // Blank line (filled with keys later)
 	mvwaddch(w, 1, bWidth - 1, ACS_VLINE);    // Right vline on line 1
-	mvwaddch(w, 2, 0, ACS_LLCORNER);          // lower left corner on line 2
+	waddch  (w, ACS_VLINE);                   // Left vline on line 2
+	whline  (w, ' ', bWidth - 2);             // Blank line (filled with keys later)
+	mvwaddch(w, 2, bWidth - 1, ACS_VLINE);    // Right vline on line 2
+	mvwaddch(w, 3, 0, ACS_LLCORNER);          // lower left corner on line 3
 	whline  (w, ACS_HLINE, bWidth - 2);       // bottom line
-	mvwaddch(w, 2, bWidth - 1, ACS_LRCORNER); // lower right corner on line 2
+	mvwaddch(w, 3, bWidth - 1, ACS_LRCORNER); // lower right corner on line 3
 
 	if (keys) {
 		const sKey* key = keys;
@@ -330,12 +333,13 @@ void drawTop(bool withSep)
 	sprintf(buf, "%-*.*s", wWidth(Top), wWidth(Top), "Gentoo USE flags editor " PACKAGE_VERSION);
 	mvwaddstr(w, 0, 0, buf);
 
-	whline(w, ACS_HLINE, wWidth(Top));
+	/// REMOVEME: Stop wasting space
+	//whline(w, ACS_HLINE, wWidth(Top));
 
 	wattrset(w, COLOR_PAIR(2) | A_BOLD);
-	mvwaddch(w, 2, 0, ACS_ULCORNER);
+	mvwaddch(w, 1, 0, ACS_ULCORNER);
 	whline(w, ACS_HLINE, wWidth(Top)-2);
-	mvwaddch(w, 2, wWidth(Top)-1, ACS_URCORNER);
+	mvwaddch(w, 1, wWidth(Top)-1, ACS_URCORNER);
 
 	waddch(w, ACS_VLINE);
 	wattrset(w, COLOR_PAIR(3));
@@ -354,11 +358,11 @@ void drawTop(bool withSep)
 	waddch(w, ACS_ULCORNER);
 	whline(w, ACS_HLINE, wWidth(Top)-6);
 	if (withSep) {
-		mvwaddch(w, 4, minwidth + 3, ACS_TTEE); // Before state
-		mvwaddch(w, 4, minwidth + 7, ACS_TTEE); // Between state and scope
-		mvwaddch(w, 4, minwidth + 10, ACS_TTEE); // After scope
+		mvwaddch(w, 3, minwidth + 3, ACS_TTEE); // Before state
+		mvwaddch(w, 3, minwidth + 7, ACS_TTEE); // Between state and scope
+		mvwaddch(w, 3, minwidth + 10, ACS_TTEE); // After scope
 	}
-	mvwaddch(w, 4, wWidth(Top)-3, ACS_URCORNER);
+	mvwaddch(w, 3, wWidth(Top)-3, ACS_URCORNER);
 	waddch(w, ' ');
 	wattrset(w, COLOR_PAIR(2) | A_BOLD);
 	waddch(w, ACS_VLINE);


^ permalink raw reply related	[flat|nested] 238+ messages in thread
* [gentoo-commits] proj/ufed:master commit in: /
@ 2013-03-05 16:49 Sven Eden
  0 siblings, 0 replies; 238+ messages in thread
From: Sven Eden @ 2013-03-05 16:49 UTC (permalink / raw
  To: gentoo-commits

commit:     85458024ce090ca1c7a8c0093156f1f4abb3bc7a
Author:     Sven Eden <sven.eden <AT> gmx <DOT> de>
AuthorDate: Tue Mar  5 06:58:13 2013 +0000
Commit:     Sven Eden <sven.eden <AT> gmx <DOT> de>
CommitDate: Tue Mar  5 06:58:13 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/ufed.git;a=commit;h=85458024

Added rendering and mouse event handling for two lines of keys

---
 ufed-curses.c |   50 ++++++++++++++++++++++++++++++++------------------
 1 files changed, 32 insertions(+), 18 deletions(-)

diff --git a/ufed-curses.c b/ufed-curses.c
index cf97d0c..1948f99 100644
--- a/ufed-curses.c
+++ b/ufed-curses.c
@@ -143,17 +143,27 @@ void drawBottom(bool withSep)
 	if (keys) {
 		const sKey* key = keys;
 		int pos   = 2;
+		int row   = 0;
 		int len   = 0;
 
-		while ((pos < (bWidth - 2)) && (key->key != '\0')) {
+		while (key->key != '\0') {
+			if (row != key->row) {
+				row = key->row;
+				pos = 2;
+			}
+
 			len = strlen(key->descr);
-			if (len > (bWidth - 2 - pos))
-				len = bWidth - 2 - pos;
-			if (key->key > 0)
-				wattrset(w, COLOR_PAIR(6));
-			else
-				wattrset(w, COLOR_PAIR(3));
-			mvwaddnstr(w, 1, pos, key->descr, len);
+
+			if (pos < (bWidth - 2)) {
+				if (len > (bWidth - 2 - pos))
+					len = bWidth - 2 - pos;
+				if (key->key > 0)
+					wattrset(w, COLOR_PAIR(6));
+				else
+					wattrset(w, COLOR_PAIR(3));
+
+				mvwaddnstr(w, row + 1, pos, key->descr, len);
+			}
 			pos += len + 1;
 			++key;
 		}
@@ -622,14 +632,21 @@ int maineventloop(
 					} // End of having a scrollbar
 				} else if(wmouse_trafo(win(Bottom), &event.y, &event.x, FALSE)) {
 					if( (event.bstate & (BUTTON1_CLICKED | BUTTON1_DOUBLE_CLICKED))
-					 && (event.y == 1) ) {
-						const sKey* key;
-						int x = event.x;
-						if(x < 2)
+					 && (event.y >= 1) && (event.y <= 2)) {
+						const sKey* key = keys;
+						int x   = event.x;
+						int y   = event.y;
+						if((x < 2) || (y < 1) || (y > 2))
 							continue;
 						x -= 2;
-						for(key = keys; key->key!='\0'; key++) {
-							if( (key->key > 0) && ((size_t)x < key->length)) {
+						--y;
+
+						// Forward to second row if y is 1
+						for ( ; y > key->row; key++) ;
+
+						// Check key
+						for ( ; (key->row == y) && (x >= 0) && (key->key != '\0'); key++) {
+							if ((key->key > 0) && ((size_t)x < key->length) ) {
 								event.x -= x;
 								wattrset(win(Bottom), COLOR_PAIR(6) | A_BOLD | A_REVERSE);
 								mvwaddstr(win(Bottom), event.y, event.x, key->descr);
@@ -642,10 +659,7 @@ int maineventloop(
 								c = key->key;
 								goto check_key;
 							}
-							x -= key->length;
-							if(x == 0)
-								break;
-							x--;
+							x -= key->length + 1;
 						}
 					}
 				}


^ permalink raw reply related	[flat|nested] 238+ messages in thread
* [gentoo-commits] proj/ufed:master commit in: /
@ 2013-03-05 16:49 Sven Eden
  0 siblings, 0 replies; 238+ messages in thread
From: Sven Eden @ 2013-03-05 16:49 UTC (permalink / raw
  To: gentoo-commits

commit:     f77a865eb07e6889e57c17c25a899d4772fead10
Author:     Sven Eden <sven.eden <AT> gmx <DOT> de>
AuthorDate: Mon Mar  4 17:38:02 2013 +0000
Commit:     Sven Eden <sven.eden <AT> gmx <DOT> de>
CommitDate: Mon Mar  4 17:38:02 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/ufed.git;a=commit;h=f77a865e

Synchronized help text and man page.

---
 ufed-curses-help.c |  127 ++++++++++++++++++++++++++++++++--------------------
 ufed.8.in          |    2 +-
 2 files changed, 79 insertions(+), 50 deletions(-)

diff --git a/ufed-curses-help.c b/ufed-curses-help.c
index 10855b6..572ccec 100644
--- a/ufed-curses-help.c
+++ b/ufed-curses-help.c
@@ -47,16 +47,16 @@ static void init_lines(void)
 "to the optional features which can be compiled into those packages.",
 "",
 "For instance, packages with optional GNOME support can have this support "
-"disabled at compile time by disabling the \"gnome\" USE setting. Enabling the "
-"\"gnome\" USE setting would enable GNOME support in these packages.",
+"disabled at compile time by disabling the \"gnome\" USE flag. Enabling the "
+"\"gnome\" USE flag would enable GNOME support in these packages.",
 "",
-"The effect of USE settings on packages is dependent on whether both the "
-"software itself and the package ebuild supports the USE setting as an "
+"The effect of USE flags on packages is dependent on whether both the "
+"software itself and the package ebuild supports the USE flag as an "
 "optional feature. If the software does not have support for an optional "
-"feature then the corresponding USE setting will obviously have no effect.",
+"feature then the corresponding USE flag will obviously have no effect.",
 "",
 "Also many package dependencies are not considered optional by the software "
-"and thus USE settings will have no effect on those mandatory dependencies.",
+"and thus USE flags will have no effect on those mandatory dependencies.",
 "",
 "A list of USE keywords used by a particular package can be found by checking "
 "the IUSE line in any ebuild file.",
@@ -75,23 +75,23 @@ static void init_lines(void)
 "",
 "--- What are \"global\" and \"local\" USE flags? ---",
 "",
-"From the perspective of any package there is no distinction between \"local\" "
-"and \"global\" flags. A package either listens to a specific flag or it "
-"doesn't.",
+"Global USE flags are called such because they represent functionality that "
+"is found in a wider variety of packages. For example, the global flag "
+"\"cjk\" is about adding / not adding support for Eastern-Asian languages, "
+"which affects a multitude of various packages. Global flags are described in",
+" /usr/portage/profiles/use.desc.",
 "",
-"The difference is the description, and maybe the impact of whether a flag is "
-"set or not. If a package supports a flag that has a global description in "
-"/usr/portage/profiles/use.desc but does make use of the flag differently, "
-"then the package maintainer has to add a local description to the packages "
-"metadata.xml file.",
-"The same applies to flags that have no global description, a local one must "
-"be provided then.",
+"Local USE flags are unique package-wise, because the functionality they "
+"stand for is only found in that particular package and no other.",
+"See",
+" /usr/portage/profiles/use.local.desc",
+"for a full, per-package listing of all local USE flags.",
 "",
-"An example would be a package with the USE flag \"tiff\", that does not only "
-"add support for the TIFF image format, but changes the output format of the "
-"program installed. The USE flag then would have a different impact on the "
-"package than described in the global description; a local description must be "
-"provided then.",
+"It still happens that a flag which is defined as global is also defined as "
+"local for one or more packages. That is because the general definition of "
+"the global flag takes on specialized semantics in some particular package. "
+"It also occurs that multiple packages define a local flag of the same "
+"name - the meaning of the flag differs, however, for each package.",
 "",
 "--- What are \"Masked\" and \"Forced\" flags? ---",
 "",
@@ -99,18 +99,24 @@ static void init_lines(void)
 "forced.",
 "",
 "If a USE flag does not apply to your system, or is highly experimental, it "
-"can be masked, making it impossible to select.",
-"If a USE flag is mandatory for your system or for a specific package, it can "
-"be forced, making it impossible to turn it off.",
+"is masked and can not be enabled.",
+"",
+"If a USE flag is mandatory for your system or for a specific package, it is "
+"forced and can not be disabled.",
 "",
 "Flags that are masked or forced globally have their names displayed in "
 "parentheses, and are prefixed with a '-' if they are masked. If one of these "
 "flags is set in your make.conf, you can remove it with ufed.",
+"",
 "If a flag is only masked or forced for specific packages, a lower case 'm' "
 "or 'f' in the defaults column (see \"Display layout\" below) indicates this.",
 "",
 "--- Navigation and control ---",
 "",
+"ufed will present you with a list of descriptions for each USE flag. If a "
+"description is too long to fit on your screen, you can use the Left and Right "
+"arrow keys to scroll the descriptions.",
+"",
 "Use the Up and Down arrow keys, the Page Up and Page Down keys, the Home and "
 "End keys, or start typing the name of a flag to select it.",
 "Use the space bar to toggle the setting.",
@@ -118,19 +124,21 @@ static void init_lines(void)
 "You can apply various filters on the flags to display. A status line on the "
 "bottom right will show you which filters are in effect.",
 "",
-" F5: Switch between local, global or all flag descriptions.",
-" F6: Switch between flags for which packages are installed that accept this "
-"flag, no packages are installed or all flag descriptions.",
-" F7: Switch between masked and forced flags, flags that are neither masked "
-"nor forced and all flag descriptions."
+" F5: Toggle display of local / global / all flag descriptions.",
+"",
+" F6: Toggle display of flags supported by at least one installed "
+"package / supported by no installed package / all flags.",
+"",
+" F7: Toggle display of masked and forced flags / flags that are "
+"neither masked nor forced / all flags."
 "",
 "The default is to display all flags that are neither masked nor forced.",
 "",
 "If ncurses is installed with the \"gpm\" use flag enabled, you can use your "
 "mouse to navigate and to toggle the settings, too.",
 "",
-"After changing flags, press the Return or Enter key to make this permanent, "
-"or press Escape to revert your changes.",
+"After changing flags, press the Return or Enter key to save your USE flag "
+"setup, or press Escape to revert your changes.",
 "",
 "Note: Depending on your system, you may need to wait a second before ufed "
 "detects the Escape key or mouse clicks; in some cases, you can use the "
@@ -139,10 +147,6 @@ static void init_lines(void)
 "",
 "--- Display layout ---",
 "",
-"ufed will present you with a list of descriptions for each USE flag. If a "
-"description is too long to fit on your screen, you can use the Left and Right "
-"arrow keys to scroll the descriptions.",
-"",
 "ufed attempts to show you where a particular use setting came from, and what "
 "its scope and state is.",
 "",
@@ -150,29 +154,54 @@ static void init_lines(void)
 "",
 " (s) flag  M|DPC|Si| (packages) description",
 "",
-"(s)  : Your selection, either [+] to enable, [-] to disable, or empty to keep "
+"(s)  : Your selection",
+"either [+] to enable, [-] to disable, or empty to keep "
 "the default value. If a flag is enabled or disabled by default, it will be "
 "shown as either (+) or (-).",
-"flag : The name of the flag. If the flag is globally masked, it will be shown "
+"",
+"flag : The name of the flag.",
+"If the flag is globally masked, it will be shown "
 "as (-flag). If the flag is globally forced, it will be shown as (flag).",
-"D    : [D]efault settings from make.defaults or the ebuilds of installed "
-"packages. Masked flags are shown here as 'm', forced flags as 'f'.",
-"P    : [P]rofile package settings from package.use.",
-"C    : [C]onfiguration settings from /etc/make.conf, /etc/portage/package.use "
-"and /etc/portage/package.use.",
-"S    : [S]cope of the description, package specific descriptions have an "
-"'L' for \"local\".",
-"i    : [i]nstalled, indicates with an 'i' if either the listed packages are "
-"installed on your system, or if at least one package that supports this flag "
-"is installed. The latter applies to the global description of the flag.",
-"(packages): List of packages that support this flag with the following "
-"description.",
+"",
+"D    : [D]efault settings",
+"These are read from",
+" /usr/portage/profiles/.../make.defaults",
+"and the ebuild(5) IUSE defaults of installed packages. The settings in "
+"make.defaults, however, take precedence over the ebuild IUSE settings.",
+"Masked flags are shown here as 'm', forced flags as 'f'.",
+"",
+"P    : [P]rofile package settings.",
+"These are read from",
+" /usr/portage/profiles/.../package.use.",
+"These package specific settings take precedence over the [D]efault settings.",
+"",
+"C    : [C]onfiguration settings",
+"These are read from",
+" /etc/make.conf",
+" /etc/portage/make.conf and",
+" /etc/portage/package.use.",
+"These take precedence over the [D]efault and [P]rofile settings, with "
+" package.use overriding settings from make.conf.",
+"",
+"S    : [S]cope of the description",
+"Local flag descriptions have an 'L' for \"local\" here.",
+"",
+"i    : [i]nstalled",
+"Indicates with an 'i' if either the listed packages are installed on your ",
+"system, or if at least one package that supports this flag is installed. ",
+"The latter applies to the global description of the flag.",
+"",
+"(packages): List of packages that support this flag.",
+"",
 "description : The description of the flag from use.desc or use.local.desc.",
 "",
 "If the character in any of the D, P or C column is a + then that USE flag was "
 "set in that file(s), if it is a space then the flag was not mentioned in that "
 "file(s) and if it is a - then that flag was unset in that file(s).",
 "",
+"Flags marked as [+] or [-] will be saved in your make.conf when you leave "
+"the program with an Enter.",
+"",
 "You can change the order of the (packages) and the description with the F9 "
 "key.",
 "",

diff --git a/ufed.8.in b/ufed.8.in
index 5294b65..7755b6d 100644
--- a/ufed.8.in
+++ b/ufed.8.in
@@ -41,7 +41,7 @@ See http://www.gentoo.org/doc/en/handbook/handbook-x86.xml?part=2&chap=2
 for more information on USE flags.
 
 Please also note that if UFED describes a flag (Unknown) it generally means
-that it is either a spelling error in one of the 3 configuration files or
+that it is either a spelling error in one of the three configuration files or
 it is not an officially sanctioned USE flag. Sanctioned USE flags can be found 
 in @GENTOO_PORTAGE_EPREFIX@/usr/portage/profiles/use.desc and
 in @GENTOO_PORTAGE_EPREFIX@/usr/portage/profiles/use.local.desc.


^ permalink raw reply related	[flat|nested] 238+ messages in thread
* [gentoo-commits] proj/ufed:master commit in: /
@ 2013-02-21 10:02 Sven Eden
  0 siblings, 0 replies; 238+ messages in thread
From: Sven Eden @ 2013-02-21 10:02 UTC (permalink / raw
  To: gentoo-commits

commit:     507076c625dd85d82a9dfb15fa095bc0c0cda86b
Author:     Sven Eden <sven.eden <AT> gmx <DOT> de>
AuthorDate: Thu Feb 21 10:03:35 2013 +0000
Commit:     Sven Eden <sven.eden <AT> gmx <DOT> de>
CommitDate: Thu Feb 21 10:03:35 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/ufed.git;a=commit;h=507076c6

Updated man page to contain more (and easier to read) information. Thanks to Roman Zilka, who suggested most of these changes.

---
 ufed.8.in |  123 ++++++++++++++++++++++++++++++++++++------------------------
 1 files changed, 74 insertions(+), 49 deletions(-)

diff --git a/ufed.8.in b/ufed.8.in
index 523cbf4..5294b65 100644
--- a/ufed.8.in
+++ b/ufed.8.in
@@ -3,7 +3,7 @@
 ufed \- Gentoo Linux USE flags editor
 .SH "SYNOPSIS"
 .B ufed 
-.SH "DESCRIPTION"
+.SH "INTRODUCTION"
 UFED is a simple program designed to help you configure the
 systems USE flags (see below) to your liking. To enable or
 disable a flag highlight it and hit space.
@@ -69,11 +69,11 @@ meaning of the flag differs, however, for each package.
 
 ufed allows to view the descriptions of flags that are either masked or forced.
 
-If a USE flag does not apply to your system, or is highly experimental, it can
-be masked, making it impossible to select.
+If a USE flag does not apply to your system, or is highly experimental, it is
+"masked" and can not be enabled.
 .br
-If a USE flag is mandatory for your system or for a specific package, it can be
-forced, making it impossible to turn it off.
+If a USE flag is mandatory for your system or for a specific package, it is
+"forced" and can not be disabled.
 
 Flags that are masked or forced globally have their names displayed in
 parentheses, and are prefixed with a '-' if they are masked. If one of these
@@ -82,7 +82,11 @@ flags is set in your make.conf, you can remove it with ufed.
 If a flag is only masked or forced for specific packages, a lower case 'm'
 or 'f' in the defaults column (see "Display layout" below) indicates this.
 
-.B Navigation and control
+.SH "Navigation and control"
+
+ufed will present you with a list of descriptions for each USE flag. If a
+description is too long to fit on your screen, you can use the Left and Right
+arrow keys to scroll the descriptions.
 
 Use the Up and Down arrow keys, the Page Up and Page Down keys, the Home and
 End keys, or start typing the name of a flag to select it.
@@ -91,72 +95,90 @@ Use the space bar to toggle the setting.
 You can apply various filters on the flags to display. A status line on the
 bottom right will show you which filters are in effect.
 
-F5: Switch between local, global or all flag descriptions.
+F5: Toggle display of local / global / all flag descriptions.
 .br
-F6: Switch between flags for which packages are installed that accept this
-flag, no packages are installed or all flag descriptions.
+F6: Toggle display of flags supported by at least one installed
+package / supported by no installed package / all flags.
 .br
-F7: Switch between masked and forced flags, flags that are neither masked nor
-forced and all flag descriptions.
+F7: Toggle display of masked and forced flags / flags that are
+neither masked nor forced / all flags.
 
 The default is to display all flags that are neither masked nor forced.
 
 If ncurses is installed with the "gpm" use flag enabled, you can use your
 mouse to navigate and to toggle the settings, too.
 
-After changing flags, press the Return or Enter key to make this permanent,
-or press Escape to revert your changes.
+After changing flags, press the Return or Enter key to save your USE flag setup
+to make.conf, or press Escape to revert your changes.
 
 Note: Depending on your system, you may need to wait a second before ufed
 detects the Escape key or mouse clicks; in some cases, you can use the
-ncurses environment variable ESCDELAY to change this. See the ncurses(3X)
-manpage for more info.
+ncurses environment variable ESCDELAY to change this. See \fBncurses\fR(3X)
+for more info.
 
-.B Display layout
-
-ufed will present you with a list of descriptions for each USE flag. If a
-description is too long to fit on your screen, you can use the Left and Right
-arrow keys to scroll the descriptions.
+.SH "Display layout"
 
 ufed attempts to show you where a particular use setting came from, and what
 its scope and state is.
 
-The display consists of the following information:
+Each line consists of the following elements:
 
  (s) flag  |DPC|Si| (packages) description
-
-(s)  : Your selection, either [+] to enable, [-] to disable, or empty to keep
-the default value. If a flag is enabled or disabled by default, it will be
-shown as either (+) or (-). 
+.TP
+\fB(s) : Your selection.\fR
 .br
-flag : The name of the flag. If the flag is globally masked, it will be shown
-as (-flag). If the flag is globally forced, it will be shown as (flag).
+Either [+] to enable, [-] to disable, or empty to keep the default value. If a
+flag is enabled or disabled by default, it will be shown as either (+) or (-). 
+.TP
+\fBflag : The name of the flag.\fR
 .br
-D    : [D]efault settings from make.defaults or the ebuilds of installed
-packages. Masked flags are shown here as 'm', forced flags as 'f'.
+If the flag is globally masked, it will be shown as (-flag). If the flag is
+globally forced, it will be shown as (flag).
+.TP
+\fBD : System [D]efault settings.\fR
 .br
-P    : [P]rofile package settings from package.use.
+These are read from
+@GENTOO_PORTAGE_EPREFIX@/usr/portage/profiles/.../make.defaults and the
+\fBebuild\fR(5) IUSE defaults of installed packages. The settings in make.defaults,
+however, take precedence over the ebuild IUSE settings.
 .br
-C    : [C]onfiguration settings from @GENTOO_PORTAGE_EPREFIX@/etc/make.conf,
-@GENTOO_PORTAGE_EPREFIX@/etc/portage/make.conf and
-@GENTOO_PORTAGE_EPREFIX@/etc/portage/package.use.
+Masked flags are shown here as 'm', forced flags as 'f'.
+.TP
+\fBP : [P]rofile package settings.\fR
 .br
-S    : [S]cope of the description, package specific descriptions have an 'L'
-for "local".
+These are read from
+@GENTOO_PORTAGE_EPREFIX@/usr/portage/profiles/.../package.use. These package
+specific settings take precedence over the [D]efault settings.
+.TP
+\fBC : [C]onfiguration settings.\fR
 .br
-i    : [i]nstalled, indicates with an 'i' if either the listed packages are
-installed on your system, or if at least one package that supports this flag
-is installed. The latter applies to the global description of the flag.
+These are read from @GENTOO_PORTAGE_EPREFIX@/etc/make.conf,
+@GENTOO_PORTAGE_EPREFIX@/etc/portage/make.conf and
+@GENTOO_PORTAGE_EPREFIX@/etc/portage/package.use. These take precedence over
+the [D]efault and [P]rofile settings, with package.use overriding settings
+from make.conf.
+.TP
+\fBS : [S]cope of the description.\fR
 .br
-(packages): List of packages that support this flag with the following
-description.
+Local flag descriptions have an 'L' for "local" here.
+.TP
+\fBi : [i]nstalled.\fR
 .br
-description : The description of the flag from use.desc or use.local.desc.
-
+Indicates with an 'i' if either the listed packages are installed on your
+system, or if at least one package that supports this flag is installed.
+The latter applies to the global description of the flag.
+.TP
+\fB(packages): List of packages that support this flag.\fR
+.TP
+\fBdescription : The description of the flag from use.desc or use.local.desc.\fR
+.PP
 If the character in any of the D, P or C column is a + then that USE flag was
 set in that file(s), if it is a space then the flag was not mentioned in that
 file(s) and if it is a - then that flag was unset in that file(s).
 
+Flags marked as [+] or [-] will be saved in your make.conf when you leave the
+program with an Enter.
+
 You can change the order of the (packages) and the description with the F9 key.
 
 .SH "REPORTING BUGS"
@@ -175,19 +197,22 @@ Contains user specified USE flags
 .br
 This is where ufed places a backup of your make.conf file.
 .TP
-\fB@GENTOO_PORTAGE_EPREFIX@/etc/make.profile/make.defaults\fR
-Contains system default USE flags
+\fB@GENTOO_PORTAGE_EPREFIX@/usr/portage/profiles/.../make.defaults\fR
+Contains system default USE flags. These are the default settings and take
+precedence over \fBebuild\fR(5) IUSE defaults.
 .TP
-\fB@GENTOO_PORTAGE_EPREFIX@/etc/make.profile/package.use\fR
-Contains per package default USE flags
+\fB@GENTOO_PORTAGE_EPREFIX@/usr/portage/profiles/.../package.use\fR
+Contains per package default USE flags. These are per package default settings
+and take precedence over system default USE flags.
 .TP
 \fB@GENTOO_PORTAGE_EPREFIX@/etc/portage/package.use\fR
-Contains user specified USE flags per package
+Contains user specified USE flags per package. These take precedence over all
+system defaults and the settings in your make.conf file.
 .TP
-\fB@GENTOO_PORTAGE_EPREFIX@/etc/make.profile/use.mask\fR
+\fB@GENTOO_PORTAGE_EPREFIX@/usr/portage/profiles/.../use.mask\fR
 Restricted USE flags
 .TP
-\fB@GENTOO_PORTAGE_EPREFIX@/etc/make.profile/use.force\fR
+\fB@GENTOO_PORTAGE_EPREFIX@/usr/portage/profiles/.../use.force\fR
 Enforced USE flags
 .TP
 \fB@GENTOO_PORTAGE_EPREFIX@/usr/portage/profiles/use.desc\fR


^ permalink raw reply related	[flat|nested] 238+ messages in thread
* [gentoo-commits] proj/ufed:master commit in: /
@ 2013-02-19 15:16 Sven Eden
  0 siblings, 0 replies; 238+ messages in thread
From: Sven Eden @ 2013-02-19 15:16 UTC (permalink / raw
  To: gentoo-commits

commit:     d15c370abf49b4267f9ce51c7a011413e6235e61
Author:     Sven Eden <sven.eden <AT> gmx <DOT> de>
AuthorDate: Tue Feb 19 15:17:38 2013 +0000
Commit:     Sven Eden <sven.eden <AT> gmx <DOT> de>
CommitDate: Tue Feb 19 15:17:38 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/ufed.git;a=commit;h=d15c370a

Fixed local/global section in the man page.

---
 ufed.8.in |   33 ++++++++++++++++-----------------
 1 files changed, 16 insertions(+), 17 deletions(-)

diff --git a/ufed.8.in b/ufed.8.in
index 652f973..523cbf4 100644
--- a/ufed.8.in
+++ b/ufed.8.in
@@ -48,23 +48,22 @@ in @GENTOO_PORTAGE_EPREFIX@/usr/portage/profiles/use.local.desc.
 
 .B What are "global" and "local" USE flags?
 
-From the perspective of any package there is no distinction between "local" and
-"global" flags. A package either listens to a specific flag or it doesn't.
-
-The difference is the description, and maybe the impact of whether a flag is
-set or not. If a package supports a flag that has a global description in
-@GENTOO_PORTAGE_EPREFIX@/usr/portage/profiles/use.desc but does make use of
-the flag differently, then the package maintainer has to add a local
-description to the packages metadata.xml file.
-.br
-The same applies to flags that have no global description, a local one must be
-provided then.
-
-An example would be a package with the USE flag "tiff", that does not only add
-support for the TIFF image format, but changes the output format of the
-program installed. The USE flag then would have a different impact on the
-package than described in the global description; a local description must be
-provided then.
+Global USE flags are called such because they represent functionality that is
+found in a wider variety of packages. For example, the global flag "cjk" is
+about adding / not adding support for Eastern-Asian languages, which affects
+a multitude of various packages. Global flags are described in
+@GENTOO_PORTAGE_EPREFIX@/usr/portage/profiles/use.desc.
+
+Local USE flags are unique package-wise, because the functionality they stand
+for is only found in that particular package and no other. See
+@GENTOO_PORTAGE_EPREFIX@/usr/portage/profiles/use.local.desc for a full, 
+per-package listing of all local USE flags.
+
+It still happens that a flag which is defined as global is also defined as
+local for one or more packages. That is because the general definition of the
+global flag takes on specialized semantics in some particular package. It also
+occurs that multiple packages define a local flag of the same name - the
+meaning of the flag differs, however, for each package.
 
 .B What are "Masked" and "Forced" flags?
 


^ permalink raw reply related	[flat|nested] 238+ messages in thread
* [gentoo-commits] proj/ufed:master commit in: /
@ 2013-02-19 13:34 Sven Eden
  0 siblings, 0 replies; 238+ messages in thread
From: Sven Eden @ 2013-02-19 13:34 UTC (permalink / raw
  To: gentoo-commits

commit:     33859fe88664439f2bf272d08b1d9586aaae81dd
Author:     Sven Eden <sven.eden <AT> gmx <DOT> de>
AuthorDate: Tue Feb 19 13:35:53 2013 +0000
Commit:     Sven Eden <sven.eden <AT> gmx <DOT> de>
CommitDate: Tue Feb 19 13:35:53 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/ufed.git;a=commit;h=33859fe8

Fixed an issue with auto-hash not working on perl < 5.16

---
 Portage.pm |   27 +++++++++++++--------------
 1 files changed, 13 insertions(+), 14 deletions(-)

diff --git a/Portage.pm b/Portage.pm
index 9130a37..97ba400 100644
--- a/Portage.pm
+++ b/Portage.pm
@@ -946,23 +946,22 @@ sub _read_use_mask {
 #        USE_EXPAND_HIDDEN flags, as they must not be seen anyway.
 sub _remove_expands {
 
-	if (defined($_environment{USE_EXPAND})) {
-		for my $key (map {my $x=lc($_)."_"; $x } keys $_environment{USE_EXPAND}) {
-			for my $flag (keys %$_use_temp) {
-				if ($flag =~ /^$key/ ) {
-					delete($_use_temp->{$flag});
-				} 
-			}
+	my $expands = $_environment{USE_EXPAND} || {};
+	my $hidden  = $_environment{USE_EXPAND_HIDDEN} || {};
+
+	for my $key (map {my $x=lc($_)."_"; $x } keys %$expands) {
+		for my $flag (keys %$_use_temp) {
+			if ($flag =~ /^$key/ ) {
+				delete($_use_temp->{$flag});
+			} 
 		}
 	} ## Done looping USE_EXPAND
 
-	if (defined($_environment{USE_EXPAND_HIDDEN})) {
-		for my $key (map {my $x=lc($_)."_"; $x } keys $_environment{USE_EXPAND_HIDDEN}) {
-			for my $flag (keys %$_use_temp) {
-				if ($flag =~ /^$key/ ) {
-					delete($_use_temp->{$flag});
-				} 
-			}
+	for my $key (map {my $x=lc($_)."_"; $x } keys %$hidden) {
+		for my $flag (keys %$_use_temp) {
+			if ($flag =~ /^$key/ ) {
+				delete($_use_temp->{$flag});
+			} 
 		}
 	} ## Done looping USE_EXPAND_HIDDEN
 


^ permalink raw reply related	[flat|nested] 238+ messages in thread
* [gentoo-commits] proj/ufed:master commit in: /
@ 2013-02-18  7:22 Sven Eden
  0 siblings, 0 replies; 238+ messages in thread
From: Sven Eden @ 2013-02-18  7:22 UTC (permalink / raw
  To: gentoo-commits

commit:     f64909434026cc5dad9042d0b96355bc27e93712
Author:     Sven Eden <sven.eden <AT> gmx <DOT> de>
AuthorDate: Mon Feb 18 06:10:08 2013 +0000
Commit:     Sven Eden <sven.eden <AT> gmx <DOT> de>
CommitDate: Mon Feb 18 06:10:08 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/ufed.git;a=commit;h=f6490943

Updated the program help page and added some more information to the man page. Both should be in sync now.

---
 ufed-curses-help.c |  162 +++++++++++++++++++++++++++++++++++++---------------
 ufed.8.in          |   10 +++-
 2 files changed, 124 insertions(+), 48 deletions(-)

diff --git a/ufed-curses-help.c b/ufed-curses-help.c
index 5788e1c..10855b6 100644
--- a/ufed-curses-help.c
+++ b/ufed-curses-help.c
@@ -26,57 +26,18 @@ static void init_lines(void);
 static void init_lines(void)
 {
 	static const char * const help[] = {
-"--- What is ufed ? ---",
+"--- What is ufed? ---",
 "",
 "ufed is a simple program designed to help you configure the systems USE "
-"flags (see below) to your liking.",
+"flags (see below) to your liking. To enable or disable a flag highlight it "
+"and hit space.",
 "",
-"--- Navigation and control ---",
-"",
-"Use the Up and Down arrow keys, the Page Up and Page Down keys, the Home and "
-"End keys, or start typing the name of a flag to select it.",
-"Use the space bar to toggle the setting.",
-"",
-"If ncurses is installed with the \"gpm\" use flag enabled, you can use your "
-"mouse to navigate and to toggle the settings, too.",
-"",
-"After changing flags, press the Return or Enter key to make this permanent, "
-"or press Escape to revert your changes.",
-"",
-"Note: Depending on your system, you may need to wait a second before ufed "
-"detects the Escape key or mouse clicks; in some cases, you can use the "
-"ncurses environment variable ESCDELAY to change this. See the ncurses(3X) "
-"manpage for more info.",
-"",
-"--- Display layout ---",
-"",
-"ufed will present you with a list of descriptions for each USE flag. If a "
-"description is too long to fit on your screen, you can use the Left and Right "
-"arrow keys to scroll the descriptions.",
-"",
-"ufed attempts to show you where a particular use setting came from, and what "
-"its scope and state is.",
-"",
-"The display consists of the following information:",
-" (s) flag  M|DPC|Si| (packages) description",
-"",
-"(s)  : Your selection, either '+' to enable, '-' to disable, or empty to keep "
-"the default value.",
-"flag : The name of the flag",
-"M    : Either 'M' for Masked (always disabled), 'F' for Forced (always "
-"enabled) or empty for regular flags.",
-"D    : Default settings from make.defaults.",
-"P    : Package settings from package.use and IUSE for installed packages.",
-"C    : Configration setting from make.conf.",
-"S    : Scope of the description, package specific descriptions have an 'L' "
-"for \"local\".",
-"i    : 'i' if any affected package is installed.",
-"(packages): List of affected packages",
-"description : The description of the flag from use.desc or use.local.desc.",
+"ufed edits the USE flag settings in your make.conf file only. It can not be "
+"used to edit your package.use file.",
 "",
-"If the character in any of the D, P or C column is a + then that USE flag was "
-"set in that file, if it is a space then the flag was not mentioned in that "
-"file and if it is a - then that flag was unset in that file.",
+"If you have two make.conf files, /etc/make.conf and /etc/portage/make.conf, "
+"ufed reads the first, overrides its settings with the second, and writes "
+"changes to the second.",
 "",
 "--- What Are USE Flags? ---",
 "",
@@ -112,6 +73,113 @@ static void init_lines(void)
 "and in",
 " /usr/portage/profiles/use.local.desc",
 "",
+"--- What are \"global\" and \"local\" USE flags? ---",
+"",
+"From the perspective of any package there is no distinction between \"local\" "
+"and \"global\" flags. A package either listens to a specific flag or it "
+"doesn't.",
+"",
+"The difference is the description, and maybe the impact of whether a flag is "
+"set or not. If a package supports a flag that has a global description in "
+"/usr/portage/profiles/use.desc but does make use of the flag differently, "
+"then the package maintainer has to add a local description to the packages "
+"metadata.xml file.",
+"The same applies to flags that have no global description, a local one must "
+"be provided then.",
+"",
+"An example would be a package with the USE flag \"tiff\", that does not only "
+"add support for the TIFF image format, but changes the output format of the "
+"program installed. The USE flag then would have a different impact on the "
+"package than described in the global description; a local description must be "
+"provided then.",
+"",
+"--- What are \"Masked\" and \"Forced\" flags? ---",
+"",
+"ufed allows to view the descriptions of flags that are either masked or "
+"forced.",
+"",
+"If a USE flag does not apply to your system, or is highly experimental, it "
+"can be masked, making it impossible to select.",
+"If a USE flag is mandatory for your system or for a specific package, it can "
+"be forced, making it impossible to turn it off.",
+"",
+"Flags that are masked or forced globally have their names displayed in "
+"parentheses, and are prefixed with a '-' if they are masked. If one of these "
+"flags is set in your make.conf, you can remove it with ufed.",
+"If a flag is only masked or forced for specific packages, a lower case 'm' "
+"or 'f' in the defaults column (see \"Display layout\" below) indicates this.",
+"",
+"--- Navigation and control ---",
+"",
+"Use the Up and Down arrow keys, the Page Up and Page Down keys, the Home and "
+"End keys, or start typing the name of a flag to select it.",
+"Use the space bar to toggle the setting.",
+"",
+"You can apply various filters on the flags to display. A status line on the "
+"bottom right will show you which filters are in effect.",
+"",
+" F5: Switch between local, global or all flag descriptions.",
+" F6: Switch between flags for which packages are installed that accept this "
+"flag, no packages are installed or all flag descriptions.",
+" F7: Switch between masked and forced flags, flags that are neither masked "
+"nor forced and all flag descriptions."
+"",
+"The default is to display all flags that are neither masked nor forced.",
+"",
+"If ncurses is installed with the \"gpm\" use flag enabled, you can use your "
+"mouse to navigate and to toggle the settings, too.",
+"",
+"After changing flags, press the Return or Enter key to make this permanent, "
+"or press Escape to revert your changes.",
+"",
+"Note: Depending on your system, you may need to wait a second before ufed "
+"detects the Escape key or mouse clicks; in some cases, you can use the "
+"ncurses environment variable ESCDELAY to change this. See the ncurses(3X) "
+"manpage for more info.",
+"",
+"--- Display layout ---",
+"",
+"ufed will present you with a list of descriptions for each USE flag. If a "
+"description is too long to fit on your screen, you can use the Left and Right "
+"arrow keys to scroll the descriptions.",
+"",
+"ufed attempts to show you where a particular use setting came from, and what "
+"its scope and state is.",
+"",
+"The display consists of the following information:",
+"",
+" (s) flag  M|DPC|Si| (packages) description",
+"",
+"(s)  : Your selection, either [+] to enable, [-] to disable, or empty to keep "
+"the default value. If a flag is enabled or disabled by default, it will be "
+"shown as either (+) or (-).",
+"flag : The name of the flag. If the flag is globally masked, it will be shown "
+"as (-flag). If the flag is globally forced, it will be shown as (flag).",
+"D    : [D]efault settings from make.defaults or the ebuilds of installed "
+"packages. Masked flags are shown here as 'm', forced flags as 'f'.",
+"P    : [P]rofile package settings from package.use.",
+"C    : [C]onfiguration settings from /etc/make.conf, /etc/portage/package.use "
+"and /etc/portage/package.use.",
+"S    : [S]cope of the description, package specific descriptions have an "
+"'L' for \"local\".",
+"i    : [i]nstalled, indicates with an 'i' if either the listed packages are "
+"installed on your system, or if at least one package that supports this flag "
+"is installed. The latter applies to the global description of the flag.",
+"(packages): List of packages that support this flag with the following "
+"description.",
+"description : The description of the flag from use.desc or use.local.desc.",
+"",
+"If the character in any of the D, P or C column is a + then that USE flag was "
+"set in that file(s), if it is a space then the flag was not mentioned in that "
+"file(s) and if it is a - then that flag was unset in that file(s).",
+"",
+"You can change the order of the (packages) and the description with the F9 "
+"key.",
+"",
+"--- REPORTING BUGS ---",
+"",
+"Please report bugs via http://bugs.gentoo.org/",
+"",
 "--- Credits ---",
 "",
 "ufed was originally written by Maik Schreiber <blizzy@blizzy.de>.",

diff --git a/ufed.8.in b/ufed.8.in
index 8177feb..652f973 100644
--- a/ufed.8.in
+++ b/ufed.8.in
@@ -8,6 +8,13 @@ UFED is a simple program designed to help you configure the
 systems USE flags (see below) to your liking. To enable or
 disable a flag highlight it and hit space.
 
+ufed edits the USE flag settings in your make.conf file only. It can not be
+used to edit your package.use file.
+
+If you have two make.conf files, @GENTOO_PORTAGE_EPREFIX@/etc/make.conf and
+@GENTOO_PORTAGE_EPREFIX@/etc/portage/make.conf, ufed reads the first, overrides
+its settings with the second, and writes changes to the second.
+
 .B What are USE flags?
 
 The USE settings system is a flexible way to enable or disable various features
@@ -131,7 +138,8 @@ packages. Masked flags are shown here as 'm', forced flags as 'f'.
 .br
 P    : [P]rofile package settings from package.use.
 .br
-C    : [C]onfiguration settings from make.conf and
+C    : [C]onfiguration settings from @GENTOO_PORTAGE_EPREFIX@/etc/make.conf,
+@GENTOO_PORTAGE_EPREFIX@/etc/portage/make.conf and
 @GENTOO_PORTAGE_EPREFIX@/etc/portage/package.use.
 .br
 S    : [S]cope of the description, package specific descriptions have an 'L'


^ permalink raw reply related	[flat|nested] 238+ messages in thread
* [gentoo-commits] proj/ufed:master commit in: /
@ 2013-02-15  8:36 Sven Eden
  0 siblings, 0 replies; 238+ messages in thread
From: Sven Eden @ 2013-02-15  8:36 UTC (permalink / raw
  To: gentoo-commits

commit:     412d54c5d8b3bad1ae9e14ba8bca5f9ac2a8e63a
Author:     Sven Eden <sven.eden <AT> gmx <DOT> de>
AuthorDate: Fri Feb 15 07:34:10 2013 +0000
Commit:     Sven Eden <sven.eden <AT> gmx <DOT> de>
CommitDate: Fri Feb 15 07:34:10 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/ufed.git;a=commit;h=412d54c5

Fixed a display issue where the list can get corrupted if a limiting filter is turned off and the "-*" is legal but found on line zero.

---
 ufed-curses.c |   10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/ufed-curses.c b/ufed-curses.c
index 27de1db..fc262c8 100644
--- a/ufed-curses.c
+++ b/ufed-curses.c
@@ -201,10 +201,12 @@ void drawFlags() {
 	 * This can happen if the flag filter is toggled
 	 * and the current flag is the first not filtered.
 	 */
-	if ((flag == flags) && !isFlagLegal(flag)) {
-		flag    = last;
-		topline = last->listline;
-		line    = 0;
+	if (flag == flags) {
+		if (!isFlagLegal(flag)) {
+			flag    = last;
+			topline = last->listline;
+		}
+		line = 0;
 	}
 
 	// The display start line might differ from topline:


^ permalink raw reply related	[flat|nested] 238+ messages in thread
* [gentoo-commits] proj/ufed:master commit in: /
@ 2013-02-15  8:36 Sven Eden
  0 siblings, 0 replies; 238+ messages in thread
From: Sven Eden @ 2013-02-15  8:36 UTC (permalink / raw
  To: gentoo-commits

commit:     d0bfafc5a04aec2dfe222a34af03baf1359337af
Author:     Sven Eden <sven.eden <AT> gmx <DOT> de>
AuthorDate: Fri Feb 15 07:50:05 2013 +0000
Commit:     Sven Eden <sven.eden <AT> gmx <DOT> de>
CommitDate: Fri Feb 15 07:50:05 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/ufed.git;a=commit;h=d0bfafc5

Updated man page to current functionality.

---
 ufed.8.in |  148 ++++++++++++++++++++++++++++++++++++++++++------------------
 1 files changed, 103 insertions(+), 45 deletions(-)

diff --git a/ufed.8.in b/ufed.8.in
index 23886b7..8177feb 100644
--- a/ufed.8.in
+++ b/ufed.8.in
@@ -1,4 +1,4 @@
-.TH "UFED" "8" "05 Feb 2013" "UFED 0.42" "UFED"
+.TH "UFED" "8" "15 Feb 2013" "UFED 0.90" "UFED"
 .SH "NAME"
 ufed \- Gentoo Linux USE flags editor
 .SH "SYNOPSIS"
@@ -8,12 +8,93 @@ UFED is a simple program designed to help you configure the
 systems USE flags (see below) to your liking. To enable or
 disable a flag highlight it and hit space.
 
+.B What are USE flags?
+
+The USE settings system is a flexible way to enable or disable various features
+at package build-time on a global level and for individual packages. This
+allows an administrator to control how packages are built in regards to the
+optional features which can be compiled into those packages.
+
+For instance, packages with optional GNOME support can have this support
+disabled at compile time by disabling the "gnome" USE flag. Enabling the
+"gnome" USE flag would enable GNOME support in these packages.
+
+The effect of USE flags on packages is dependent on whether both the
+software itself and the package ebuild supports the USE flag as an optional
+feature. If the software does not have support for an optional feature then the
+corresponding USE flag will obviously have no effect.
+
+Also many package dependencies are not considered optional by the software and
+thus USE flags will have no effect on those mandatory dependencies.
+
+A list of USE keywords used by a particular package can be found by checking
+the IUSE line in any ebuild file or by using "equery" from gentoolkit.
+
+See http://www.gentoo.org/doc/en/handbook/handbook-x86.xml?part=2&chap=2
+for more information on USE flags.
+
+Please also note that if UFED describes a flag (Unknown) it generally means
+that it is either a spelling error in one of the 3 configuration files or
+it is not an officially sanctioned USE flag. Sanctioned USE flags can be found 
+in @GENTOO_PORTAGE_EPREFIX@/usr/portage/profiles/use.desc and
+in @GENTOO_PORTAGE_EPREFIX@/usr/portage/profiles/use.local.desc.
+
+.B What are "global" and "local" USE flags?
+
+From the perspective of any package there is no distinction between "local" and
+"global" flags. A package either listens to a specific flag or it doesn't.
+
+The difference is the description, and maybe the impact of whether a flag is
+set or not. If a package supports a flag that has a global description in
+@GENTOO_PORTAGE_EPREFIX@/usr/portage/profiles/use.desc but does make use of
+the flag differently, then the package maintainer has to add a local
+description to the packages metadata.xml file.
+.br
+The same applies to flags that have no global description, a local one must be
+provided then.
+
+An example would be a package with the USE flag "tiff", that does not only add
+support for the TIFF image format, but changes the output format of the
+program installed. The USE flag then would have a different impact on the
+package than described in the global description; a local description must be
+provided then.
+
+.B What are "Masked" and "Forced" flags?
+
+ufed allows to view the descriptions of flags that are either masked or forced.
+
+If a USE flag does not apply to your system, or is highly experimental, it can
+be masked, making it impossible to select.
+.br
+If a USE flag is mandatory for your system or for a specific package, it can be
+forced, making it impossible to turn it off.
+
+Flags that are masked or forced globally have their names displayed in
+parentheses, and are prefixed with a '-' if they are masked. If one of these
+flags is set in your make.conf, you can remove it with ufed.
+.br
+If a flag is only masked or forced for specific packages, a lower case 'm'
+or 'f' in the defaults column (see "Display layout" below) indicates this.
+
 .B Navigation and control
 
 Use the Up and Down arrow keys, the Page Up and Page Down keys, the Home and
 End keys, or start typing the name of a flag to select it.
 Use the space bar to toggle the setting.
 
+You can apply various filters on the flags to display. A status line on the
+bottom right will show you which filters are in effect.
+
+F5: Switch between local, global or all flag descriptions.
+.br
+F6: Switch between flags for which packages are installed that accept this
+flag, no packages are installed or all flag descriptions.
+.br
+F7: Switch between masked and forced flags, flags that are neither masked nor
+forced and all flag descriptions.
+
+The default is to display all flags that are neither masked nor forced.
+
 If ncurses is installed with the "gpm" use flag enabled, you can use your
 mouse to navigate and to toggle the settings, too.
 
@@ -35,64 +116,41 @@ ufed attempts to show you where a particular use setting came from, and what
 its scope and state is.
 
 The display consists of the following information:
- (s) flag  M|DPC|Si| (packages) description
 
-(s)  : Your selection, either '+' to enable, '-' to disable, or empty to keep
-the default value.
-.br
-flag : The name of the flag
+ (s) flag  |DPC|Si| (packages) description
+
+(s)  : Your selection, either [+] to enable, [-] to disable, or empty to keep
+the default value. If a flag is enabled or disabled by default, it will be
+shown as either (+) or (-). 
 .br
-M    : Either 'M' for Masked (always disabled), 'F' for Forced (always
-enabled) or empty for regular flags.
+flag : The name of the flag. If the flag is globally masked, it will be shown
+as (-flag). If the flag is globally forced, it will be shown as (flag).
 .br
-D    : Default settings from make.defaults.
+D    : [D]efault settings from make.defaults or the ebuilds of installed
+packages. Masked flags are shown here as 'm', forced flags as 'f'.
 .br
-P    : Package settings from package.use and IUSE for installed packages.
+P    : [P]rofile package settings from package.use.
 .br
-C    : Configration setting from make.conf.
+C    : [C]onfiguration settings from make.conf and
+@GENTOO_PORTAGE_EPREFIX@/etc/portage/package.use.
 .br
-S    : Scope of the description, package specific descriptions have an 'L'
+S    : [S]cope of the description, package specific descriptions have an 'L'
 for "local".
 .br
-i    : 'i' if any affected package is installed.
+i    : [i]nstalled, indicates with an 'i' if either the listed packages are
+installed on your system, or if at least one package that supports this flag
+is installed. The latter applies to the global description of the flag.
 .br
-(packages): List of affected packages
+(packages): List of packages that support this flag with the following
+description.
 .br
 description : The description of the flag from use.desc or use.local.desc.
 
 If the character in any of the D, P or C column is a + then that USE flag was
-set in that file, if it is a space then the flag was not mentioned in that
-file and if it is a - then that flag was unset in that file.
+set in that file(s), if it is a space then the flag was not mentioned in that
+file(s) and if it is a - then that flag was unset in that file(s).
 
-.B What are USE flags?
-
-The USE settings system is a flexible way to enable or disable various features
-at package build-time on a global level and for individual packages. This
-allows an administrator to control how packages are built in regards to the
-optional features which can be compiled into those packages.
-
-For instance, packages with optional GNOME support can have this support
-disabled at compile time by disabling the "gnome" USE flag. Enabling the
-"gnome" USE flag would enable GNOME support in these packages.
-
-The effect of USE flags on packages is dependent on whether both the
-software itself and the package ebuild supports the USE flag as an optional
-feature. If the software does not have support for an optional feature then the
-corresponding USE flag will obviously have no effect.
-
-Also many package dependencies are not considered optional by the software and
-thus USE flags will have no effect on those mandatory dependencies.
-
-A list of USE keywords used by a particular package can be found by checking
-the IUSE line in any ebuild file or by using "equery" from gentoolkit.
-
-See http://www.gentoo.org/doc/en/handbook/handbook-x86.xml?part=2&chap=2
-for more information on USE flags.
-
-Please also note that if UFED describes a flag (Unknown) it generally means
-that it is either a spelling error in one of the 3 configuration files or
-it is not an officially sanctioned USE flag. Sanctioned USE flags can be found 
-in /usr/portage/profiles/use.desc and in /usr/portage/profiles/use.local.desc.
+You can change the order of the (packages) and the description with the F9 key.
 
 .SH "REPORTING BUGS"
 Please report bugs via http://bugs.gentoo.org/


^ permalink raw reply related	[flat|nested] 238+ messages in thread
* [gentoo-commits] proj/ufed:master commit in: /
@ 2013-02-15  8:36 Sven Eden
  0 siblings, 0 replies; 238+ messages in thread
From: Sven Eden @ 2013-02-15  8:36 UTC (permalink / raw
  To: gentoo-commits

commit:     5210deeb7d6c8f4cca79b37a9aae22147216a9ac
Author:     Sven Eden <sven.eden <AT> gmx <DOT> de>
AuthorDate: Fri Feb 15 07:38:31 2013 +0000
Commit:     Sven Eden <sven.eden <AT> gmx <DOT> de>
CommitDate: Fri Feb 15 07:38:31 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/ufed.git;a=commit;h=5210deeb

Make more use of the USE_ORDER content from make.globals. It now allows to have package default settings (IUSE) being overridden by make.defaults.

---
 Portage.pm |  118 +++++++++++++++++++++++++++++++++++++----------------------
 1 files changed, 74 insertions(+), 44 deletions(-)

diff --git a/Portage.pm b/Portage.pm
index 0e758bf..9130a37 100644
--- a/Portage.pm
+++ b/Portage.pm
@@ -49,6 +49,8 @@ our $used_make_conf = "";
 my %_environment  = ();
 my $_EPREFIX        = "";
 my @_profiles     = ();
+my %_use_order    = ();
+
 # $_use_temp - hashref that represents the current state of
 # all known flags. This is for data gathering, the public
 # $use_flags is generated out of this by _gen_use_flags()
@@ -88,7 +90,7 @@ sub _determine_eprefix;
 sub _determine_make_conf;
 sub _determine_profiles;
 sub _final_cleaning;
-sub _fix_descriptions;
+sub _fix_flags;
 sub _gen_use_flags;
 sub _merge;
 sub _merge_env;
@@ -99,6 +101,7 @@ sub _read_descriptions;
 sub _read_make_conf;
 sub _read_make_defaults;
 sub _read_make_globals;
+sub _read_package_use;
 sub _read_packages;
 sub _read_sh;
 sub _read_use_force;
@@ -112,30 +115,43 @@ INIT {
 	_determine_make_conf;
 	_determine_profiles;
 	_read_make_globals;
-	_read_make_conf; ## Needed first to know about overlays
 
-	# Now with the defaults loaded, a check is in order
-	# whether the set USE_ORDER is supported:
+	# make.conf is loaded first to parse for the set overlays
+	# directories, if any. USE flags from make.conf get a
+	# dedicated area {conf}, so there is no harm in loading
+	# it first.
+	_read_make_conf;
+
+	# USE_ORDER must not only be defined, it sets the order in which settings
+	# are loaded overriding each other.
 	defined($_environment{USE_ORDER})
 		or die("Unable to determine USE_ORDER!\nSomething is seriously broken!\n");
-	my $lastorder = "";
+	my $ordNr  = 0;
 	my @use_order = reverse split /:/, $_environment{USE_ORDER};
 	for my $order(@use_order) {
-		$lastorder = $order
-			if( ($order eq 'defaults') || ($order eq 'conf') );
+		"env"         eq $order and next; ## Not used by ufed
+		"pkg"         eq $order and _read_package_use;
+		# "conf" is already loaded
+		"defaults"    eq $order and _read_make_defaults;
+		"pkginternal" eq $order and _read_packages;
+		"repo"        eq $order and next; ## Done in "defaults" and "pkginternal" in the right order
+		"env.d"       eq $order and next; ## Not used by ufed
+		$_use_order{$order} = ++$ordNr;
+	}
+	if ( !defined($_use_order{"defaults"})
+	  || !defined($_use_order{"conf"})
+	  || ($_use_order{"defaults"} > $_use_order{"conf"})) {
+		die("Sorry, USE_ORDER without make.conf overriding global"
+		  . " USE flags are not currently supported by ufed.\n");
 	}
-	$lastorder eq 'conf'
-		or die("Sorry, USE_ORDER without make.conf overriding global"
-			. " USE flags are not currently supported by ufed.\n");
 
-	_read_make_defaults;
-	_read_packages;
+	# Now the rest can be read	
 	_read_use_force; ## Must be before _read_use_mask to not
 	_read_use_mask;  ## unintentionally unmask explicitly masked flags.
 	_read_archs;
 	_read_descriptions;
 	_remove_expands;
-	_fix_descriptions;
+	_fix_flags;
 	_final_cleaning;
 	_gen_use_flags;
 }
@@ -296,24 +312,30 @@ sub _final_cleaning
 }
 
 
-# All flags that are specific to explicit versioning have no
-# descriptions yet. This must be enriched from the versionless
-# package setting.
-# Further flags that have no proper description get the
-# string "(Unknown)" as a description
-sub _fix_descriptions
+# This function fixes two aspects of the temporary flag hash:
+# A) The {"default"} flag settings of packages might have to be
+#    overridden by the {"global"} ones.
+#    (see USE_ORDER in man make.conf)
+# B) All flags that are specific to explicit versioning have no
+#    descriptions yet. This must be enriched from the versionless
+#    package setting.
+# C) Further flags that have no proper description get the
+#    string "(Unknown)" as a description
+sub _fix_flags
 {
 	for my $flag (keys %{$_use_temp}) {
 		my $flagRef  = $_use_temp->{$flag}; ## Shortcut
 		my $globRef  = $flagRef->{global}  || undef;
 		my $locaRef  = $flagRef->{"local"} || undef;
 		my $gDesc    = "(Unknown)";
+		my $gDefault = 0;
 		my $hasLocal = 0;
 
 		# check global part first
 		if (defined($globRef)) {
 			if (length($globRef->{descr})) {
-				$gDesc = $globRef->{descr};
+				$gDesc    = $globRef->{descr};
+				$gDefault = $globRef->{"default"};
 			} elsif ( $globRef->{conf}
 				   || $globRef->{"default"}
 				   || $globRef->{forcded}
@@ -327,7 +349,15 @@ sub _fix_descriptions
 		for my $pkg (sort keys %$locaRef) {
 			$hasLocal = 1;
 			
-			# No action required if a description is present
+			# fix {default} settings if a global one is set
+			# This is make.defaults overriding IUSE settings.
+			if ( $gDefault
+			  && ( !defined($_use_order{"pkginternal"})
+			    || ($_use_order{"defaults"} > $_use_order{"pkginternal"})) ) {
+				$locaRef->{$pkg}{"default"} = $gDefault;
+			}
+
+			# No further action required if a description is present
 			next if (length($locaRef->{$pkg}{descr}));
 			
 			# Otherwise check wether this is worth to be added
@@ -613,8 +643,8 @@ sub _read_make_conf {
 }
 
 
-# read all found make.defaults and package.use files and merge
-# their values into env, adding flag parameters to $_use_tmp.
+# read all found make.defaults merge their values into env,
+# adding flag parameters to $_use_tmp.
 # TODO : use USE_EXPAND to add Expansion parsing. The most
 #        important of these are set with sane defaults here,
 #        too.
@@ -637,20 +667,32 @@ sub _read_make_defaults {
 		}
 	} ## End of reading make.defaults
 
-	# package.use files are parsed next, finished by /etc/portage/package.use
+	return;
+}
+
+
+# read all found make.globals and merge their
+# settings into %environment. This is done to
+# get the final "PORTDIR" and "USE_ORDER"
+# No parameters accepted
+sub _read_make_globals {
+	for my $dir(@_profiles, "${_EPREFIX}/usr/share/portage/config") {
+		_read_sh("$dir/make.globals");
+	}
+	return;
+}
+
+
+# read all found package.use files and merge their values into
+# env, adding flag parameters to $_use_tmp.
+# No parameters accepted.
+sub _read_package_use
+{
 	for my $dir(@_profiles, "${_EPREFIX}/etc/portage") {
 		my $tgt = $dir eq "${_EPREFIX}/etc/portage" ? "pkguse" : "package";
 		for(_noncomments("$dir/package.use") ) {
 			my($pkg, @flags) = split;
 			
-			# There is an important detail: package.use files can limit
-			# their settings to specific package versions.
-			# As ufed is showing a generalized view and can in no
-			# acceptable way determine which versions are relevant,
-			# we have to *skip* all settings that have specific version
-			# and/or slot information limiting their scope.
-# CHECK			$pkg =~ /^[<>=~]/ and next;
-			
 			for my $flag (@flags) {
 				my $state = $flag =~ s/^-// || 0;
 
@@ -666,18 +708,6 @@ sub _read_make_defaults {
 		}
 	} ## End of reading package.use
 
-	return
-}
-
-
-# read all found make.globals and merge their
-# settings into %environment. This is done to
-# get the final "PORTDIR" and "USE_ORDER"
-# No parameters accepted
-sub _read_make_globals {
-	for my $dir(@_profiles, "${_EPREFIX}/usr/share/portage/config") {
-		_read_sh("$dir/make.globals");
-	}
 	return;
 }
 


^ permalink raw reply related	[flat|nested] 238+ messages in thread
* [gentoo-commits] proj/ufed:master commit in: /
@ 2013-02-14  8:35 Sven Eden
  0 siblings, 0 replies; 238+ messages in thread
From: Sven Eden @ 2013-02-14  8:35 UTC (permalink / raw
  To: gentoo-commits

commit:     009dbf3d4103818ac3282a71eec8c1474b03185a
Author:     Sven Eden <sven.eden <AT> gmx <DOT> de>
AuthorDate: Thu Feb 14 07:28:53 2013 +0000
Commit:     Sven Eden <sven.eden <AT> gmx <DOT> de>
CommitDate: Thu Feb 14 07:28:53 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/ufed.git;a=commit;h=009dbf3d

Fixed the ordering of the filter state in the status line to have the same ordering as the function keys.

---
 ufed-curses.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/ufed-curses.c b/ufed-curses.c
index 066a00f..27de1db 100644
--- a/ufed-curses.c
+++ b/ufed-curses.c
@@ -298,14 +298,14 @@ void drawStatus(bool withSep)
 		mvwaddch (w, 0, minwidth + 7, ACS_VLINE); // After scope
 
 		// Use the unused right side to show the filter status
-		sprintf(buf, "%*s%-6s / %-6s / %-13s] ",
+		sprintf(buf, "%*s%-6s / %-13s / %-6s] ",
 			max(2, iWidth - 40 - minwidth), " [",
-			eMask_masked        == e_mask ? "masked" :
-			eMask_unmasked      == e_mask ? "normal" : "all",
 			eScope_global       == e_scope ? "global" :
 			eScope_local        == e_scope ? "local" : "all",
 			eState_installed    == e_state ? "installed" :
-			eState_notinstalled == e_state ? "not installed" : "all");
+			eState_notinstalled == e_state ? "not installed" : "all",
+			eMask_masked        == e_mask  ? "masked" :
+			eMask_unmasked      == e_mask  ? "normal" : "all");
 		waddstr(w, buf);
 	}
 


^ permalink raw reply related	[flat|nested] 238+ messages in thread
* [gentoo-commits] proj/ufed:master commit in: /
@ 2013-02-14  8:35 Sven Eden
  0 siblings, 0 replies; 238+ messages in thread
From: Sven Eden @ 2013-02-14  8:35 UTC (permalink / raw
  To: gentoo-commits

commit:     f96cd4148a7b89a426b1f400598cfcdbe1824fb4
Author:     Sven Eden <sven.eden <AT> gmx <DOT> de>
AuthorDate: Thu Feb 14 07:23:14 2013 +0000
Commit:     Sven Eden <sven.eden <AT> gmx <DOT> de>
CommitDate: Thu Feb 14 07:23:14 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/ufed.git;a=commit;h=f96cd414

Added a new function to Portage.pm that takes care that a) all flags that have no description but are explicitly set get the description "(Unknown)" and are therefore transported into the interface and b) flags with only local meaning get no global "(Unknown)" entry by accident.

---
 Portage.pm |   98 +++++++++++++++++++++++++++++++++++++++++++++--------------
 1 files changed, 74 insertions(+), 24 deletions(-)

diff --git a/Portage.pm b/Portage.pm
index 685d7f7..0e758bf 100644
--- a/Portage.pm
+++ b/Portage.pm
@@ -88,6 +88,7 @@ sub _determine_eprefix;
 sub _determine_make_conf;
 sub _determine_profiles;
 sub _final_cleaning;
+sub _fix_descriptions;
 sub _gen_use_flags;
 sub _merge;
 sub _merge_env;
@@ -134,6 +135,7 @@ INIT {
 	_read_archs;
 	_read_descriptions;
 	_remove_expands;
+	_fix_descriptions;
 	_final_cleaning;
 	_gen_use_flags;
 }
@@ -269,23 +271,6 @@ sub _determine_profiles
 # No parameters accepted
 sub _final_cleaning
 {
-	# All flags that are specific to explicit versioning have no
-	# descriptions yet. This must be enriched from the versionless
-	# package setting, or deleted if none are found.
-	for my $flag (keys %{$_use_temp}) {
-		my $flagRef  = $_use_temp->{$flag}; ## Shortcut
-		for my $pkg (sort keys %{$flagRef->{"local"}}) {
-			next if (length($flagRef->{"local"}{$pkg}{descr}));
-			
-			if ($pkg =~ /^[<>=~]+([^<>=~].+)-\d+(?:\.\d+)*\w?(?:_(?:alpha|beta|pre|rc|p)\d*)*(?:-r\d+)?$/) {
-				defined($flagRef->{"local"}{$1})
-					and $flagRef->{"local"}{$pkg}{descr} = $flagRef->{"local"}{$1}{descr}
-					or  delete($flagRef->{"local"}{$pkg}{descr});
-			}
-			
-		} ## End of looping packages
-	} ## End of looping flags
-	
 	# The "disable all" flag is truncated to '*' by the parsing, but it
 	# has to read '-*'.
 	_add_temp("-*", "global");
@@ -311,6 +296,68 @@ sub _final_cleaning
 }
 
 
+# All flags that are specific to explicit versioning have no
+# descriptions yet. This must be enriched from the versionless
+# package setting.
+# Further flags that have no proper description get the
+# string "(Unknown)" as a description
+sub _fix_descriptions
+{
+	for my $flag (keys %{$_use_temp}) {
+		my $flagRef  = $_use_temp->{$flag}; ## Shortcut
+		my $globRef  = $flagRef->{global}  || undef;
+		my $locaRef  = $flagRef->{"local"} || undef;
+		my $gDesc    = "(Unknown)";
+		my $hasLocal = 0;
+
+		# check global part first
+		if (defined($globRef)) {
+			if (length($globRef->{descr})) {
+				$gDesc = $globRef->{descr};
+			} elsif ( $globRef->{conf}
+				   || $globRef->{"default"}
+				   || $globRef->{forcded}
+				   || $globRef->{masked} ) {
+			    ## The flag is definitely set somewhere
+			    $globRef->{descr} = $gDesc;
+			}
+		}
+
+		# Now check local part
+		for my $pkg (sort keys %$locaRef) {
+			$hasLocal = 1;
+			
+			# No action required if a description is present
+			next if (length($locaRef->{$pkg}{descr}));
+			
+			# Otherwise check wether this is worth to be added
+			if ( $locaRef->{$pkg}{installed}
+			  || $locaRef->{$pkg}{forced}
+			  || $locaRef->{$pkg}{masked}
+			  || $locaRef->{$pkg}{"package"}
+			  || $locaRef->{$pkg}{pkguse}) {
+			    # it is set and/or used by an ebuild
+				if ($pkg =~ /^[<>=~]+([^<>=~].+)-\d+(?:\.\d+)*\w?(?:_(?:alpha|beta|pre|rc|p)\d*)*(?:-r\d+)?$/) {
+					defined($locaRef->{$1})
+						and $locaRef->{$pkg}{descr} = $locaRef->{$1}{descr};
+				}
+				length($locaRef->{$pkg}{descr})
+					or $locaRef->{$pkg}{descr} = $gDesc; ## (Unknown) unless set
+			}
+		} ## End of looping packages
+
+		# Finally remove the global description if it is
+		# (Unknown) with at least one local representation
+		# present.
+		if ($hasLocal && ("(Unknown)" eq $gDesc)) {
+			$globRef->{descr} = "";
+		}
+	} ## End of looping flags
+
+	return;
+}
+
+
 # Once $_use_temp  is ready, this method builds
 # the final $use_flags hashref.
 # No parameters accepted
@@ -341,8 +388,11 @@ sub _gen_use_flags
 		for my $pkg (sort keys %{$flagRef->{"local"}}) {
 			$pRef  = $flagRef->{"local"}{$pkg};
 			$pdLen = length($pRef->{descr});
-			$pDesc = $pdLen ? "$pRef->{descr}" :
-					 $gdLen ? $gDesc : "(Unknown)";
+			
+			# only accept entries with a non-empty description:
+			$pdLen or next;
+
+			$pDesc = $pRef->{descr};
 			
 			# Now the Key can be assembled...
 			$pKey  = sprintf("[%s]%d:%d:%d:%d:%d:%d:%d", $pDesc, $pRef->{conf}, $pRef->{"default"},
@@ -350,11 +400,11 @@ sub _gen_use_flags
 							$pRef->{"package"}, $pRef->{pkguse});
 							
 			# ...and safed, if it has an own description or differs in its settings from global
-			if ($pdLen || (0 == $lCount) ## has own description or no global description available
-				|| $pRef->{"default"}    ## explicitly set default from IUSE
-				|| $pRef->{forced}       ## explicitly (un)forced from package.use.force
-				|| $pRef->{masked}       ## explicitly (un)masked from package.use.mask
-				|| $pRef->{pkguse}       ## explicitly (un)set from users package.use
+			if ( ($pdLen && ($gDesc ne $pDesc)) ## has an own description
+			  || $pRef->{"default"} ## explicitly set default from IUSE
+			  || $pRef->{forced}    ## explicitly (un)forced from package.use.force
+			  || $pRef->{masked}    ## explicitly (un)masked from package.use.mask
+			  || $pRef->{pkguse}    ## explicitly (un)set from users package.use
 			   ) {
 				$descCons{$pKey}{$pkg} = 1;
 				++$lCount;


^ permalink raw reply related	[flat|nested] 238+ messages in thread
* [gentoo-commits] proj/ufed:master commit in: /
@ 2013-02-14  8:35 Sven Eden
  0 siblings, 0 replies; 238+ messages in thread
From: Sven Eden @ 2013-02-14  8:35 UTC (permalink / raw
  To: gentoo-commits

commit:     c8378845701c32ec16b4695f62de9f07ecb06abc
Author:     Sven Eden <sven.eden <AT> gmx <DOT> de>
AuthorDate: Thu Feb 14 07:20:29 2013 +0000
Commit:     Sven Eden <sven.eden <AT> gmx <DOT> de>
CommitDate: Thu Feb 14 07:20:29 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/ufed.git;a=commit;h=c8378845

Fixed a bug that rendered upwards scrolling impossible if the list of descriptions of a flag is longer than the available number of displayable lines.

---
 ufed-curses.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/ufed-curses.c b/ufed-curses.c
index 78427ac..066a00f 100644
--- a/ufed-curses.c
+++ b/ufed-curses.c
@@ -182,7 +182,9 @@ void drawFlags() {
 	 * strong limiting filter (like "masked") has just been turned
 	 * off.
 	 */
-	int line = min(lHeight - getFlagHeight(flag), flag->listline - topline);
+	int line = flag->listline - topline;
+	if (line > lHeight)
+		line = lHeight - getFlagHeight(flag);
 
 	/* move to the top of the displayed list */
 	while ((flag != flags) && (line > 0)) {


^ permalink raw reply related	[flat|nested] 238+ messages in thread
* [gentoo-commits] proj/ufed:master commit in: /
@ 2013-02-13  9:23 Sven Eden
  0 siblings, 0 replies; 238+ messages in thread
From: Sven Eden @ 2013-02-13  9:23 UTC (permalink / raw
  To: gentoo-commits

commit:     5b1937661fc76d37ca90cea35901016c63c50f45
Author:     Sven Eden <sven.eden <AT> gmx <DOT> de>
AuthorDate: Tue Feb 12 18:43:12 2013 +0000
Commit:     Sven Eden <sven.eden <AT> gmx <DOT> de>
CommitDate: Tue Feb 12 18:43:12 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/ufed.git;a=commit;h=5b193766

Remove flags build from USE_EXPAND and USE_EXPAND_HIDDEN values. These can not be handled yet, although this is on the todo list. However, those flags must not be set in the general USE in make.conf.

---
 Portage.pm |   51 ++++++++++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 50 insertions(+), 1 deletions(-)

diff --git a/Portage.pm b/Portage.pm
index 06e711c..685d7f7 100644
--- a/Portage.pm
+++ b/Portage.pm
@@ -102,10 +102,11 @@ sub _read_packages;
 sub _read_sh;
 sub _read_use_force;
 sub _read_use_mask;
+sub _remove_expands;
 
 # --- Package initialization ---
 INIT {
-	$_environment{$_} = {} for qw{USE};
+	$_environment{$_} = {} for qw{USE USE_EXPAND USE_EXPAND_HIDDEN};
 	_determine_eprefix;
 	_determine_make_conf;
 	_determine_profiles;
@@ -132,6 +133,7 @@ INIT {
 	_read_use_mask;  ## unintentionally unmask explicitly masked flags.
 	_read_archs;
 	_read_descriptions;
+	_remove_expands;
 	_final_cleaning;
 	_gen_use_flags;
 }
@@ -840,4 +842,51 @@ sub _read_use_mask {
 	return;
 }
 
+
+# TODO : Remove this function once the usage of the USE_EXPAND
+#        values is implemented.
+# For now all use flags that are expanded are removed. They are not
+# set in USE="foo" but in their respective values like APACHE2_MODULES="foo"
+#
+# Note: the values from base/make.defaults are: (but there might be more)
+# USE_EXPAND="APACHE2_MODULES APACHE2_MPMS CALLIGRA_FEATURES ENLIGHTENMENT_MODULES 
+#  FOO2ZJS_DEVICES MISDN_CARDS FRITZCAPI_CARDS FCDSL_CARDS VIDEO_CARDS DVB_CARDS 
+#  LIRC_DEVICES INPUT_DEVICES LINGUAS USERLAND KERNEL ELIBC CROSSCOMPILE_OPTS 
+#  ALSA_CARDS ALSA_PCM_PLUGINS LCD_DEVICES CAMERAS NETBEANS_MODULES QEMU_SOFTMMU_TARGETS 
+#  QEMU_USER_TARGETS SANE_BACKENDS RUBY_TARGETS PHP_TARGETS NGINX_MODULES_HTTP 
+#  NGINX_MODULES_MAIL XFCE_PLUGINS XTABLES_ADDONS GPSD_PROTOCOLS COLLECTD_PLUGINS 
+#  DRACUT_MODULES OFED_DRIVERS GRUB_PLATFORMS FFTOOLS PYTHON_TARGETS CURL_SSL 
+#  OPENMPI_FABRICS OPENMPI_RM OPENMPI_OFED_FEATURES LIBREOFFICE_EXTENSIONS
+#  VOICEMAIL_STORAGE PYTHON_SINGLE_TARGET ABI_X86"
+#
+# And the USE_EXPAND variables whose contents are not shown in package manager output.
+# USE_EXPAND_HIDDEN="USERLAND KERNEL ELIBC CROSSCOMPILE_OPTS ABI_X86"
+#
+# Note2: It might be a good idea to leave this function and just reduce it to kill
+#        USE_EXPAND_HIDDEN flags, as they must not be seen anyway.
+sub _remove_expands {
+
+	if (defined($_environment{USE_EXPAND})) {
+		for my $key (map {my $x=lc($_)."_"; $x } keys $_environment{USE_EXPAND}) {
+			for my $flag (keys %$_use_temp) {
+				if ($flag =~ /^$key/ ) {
+					delete($_use_temp->{$flag});
+				} 
+			}
+		}
+	} ## Done looping USE_EXPAND
+
+	if (defined($_environment{USE_EXPAND_HIDDEN})) {
+		for my $key (map {my $x=lc($_)."_"; $x } keys $_environment{USE_EXPAND_HIDDEN}) {
+			for my $flag (keys %$_use_temp) {
+				if ($flag =~ /^$key/ ) {
+					delete($_use_temp->{$flag});
+				} 
+			}
+		}
+	} ## Done looping USE_EXPAND_HIDDEN
+
+	return;
+}
+
 1;


^ permalink raw reply related	[flat|nested] 238+ messages in thread
* [gentoo-commits] proj/ufed:master commit in: /
@ 2013-02-13  9:23 Sven Eden
  0 siblings, 0 replies; 238+ messages in thread
From: Sven Eden @ 2013-02-13  9:23 UTC (permalink / raw
  To: gentoo-commits

commit:     295afac22da2dc637b4adf56f6355b172df3cd34
Author:     Sven Eden <sven.eden <AT> gmx <DOT> de>
AuthorDate: Tue Feb 12 18:12:02 2013 +0000
Commit:     Sven Eden <sven.eden <AT> gmx <DOT> de>
CommitDate: Tue Feb 12 18:12:02 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/ufed.git;a=commit;h=295afac2

Scroll 2/3 of the description space when pressing KEY_LEFT or KEY_RIGHT. One character was really slow and cumbersome on long descriptions.

---
 ufed-curses-checklist.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/ufed-curses-checklist.c b/ufed-curses-checklist.c
index e871156..28a440c 100644
--- a/ufed-curses-checklist.c
+++ b/ufed-curses-checklist.c
@@ -448,14 +448,14 @@ static int callback(sFlag** curr, int key)
 				drawFlags();
 			break;
 		case KEY_LEFT:
-			if(descriptionleft>0)
-				descriptionleft--;
+			if(descriptionleft > 0)
+				descriptionleft -= min(descriptionleft, (wWidth(List) - minwidth) * 2 / 3);
 			drawflag(*curr, TRUE);
 			wmove(wLst, (*curr)->currline, 2);
 			wrefresh(wLst);
 			break;
 		case KEY_RIGHT:
-			descriptionleft++;
+			descriptionleft += (wWidth(List) - minwidth) * 2 / 3;
 			drawflag(*curr, TRUE);
 			wmove(wLst, (*curr)->currline, 2);
 			wrefresh(wLst);


^ permalink raw reply related	[flat|nested] 238+ messages in thread
* [gentoo-commits] proj/ufed:master commit in: /
@ 2013-02-13  9:23 Sven Eden
  0 siblings, 0 replies; 238+ messages in thread
From: Sven Eden @ 2013-02-13  9:23 UTC (permalink / raw
  To: gentoo-commits

commit:     9af992c041f7f05b6dc0e5d61804c6a2414b73b4
Author:     Sven Eden <sven.eden <AT> gmx <DOT> de>
AuthorDate: Wed Feb 13 08:44:53 2013 +0000
Commit:     Sven Eden <sven.eden <AT> gmx <DOT> de>
CommitDate: Wed Feb 13 08:44:53 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/ufed.git;a=commit;h=9af992c0

Changed the drawing of the key help to look more like buttons. Even if ncurses is installed without gpm support, this should make reading which key does what a lot easier.

---
 ufed-curses.c |   63 +++++++++++++++++++++++++++-----------------------------
 1 files changed, 30 insertions(+), 33 deletions(-)

diff --git a/ufed-curses.c b/ufed-curses.c
index f8680bb..78427ac 100644
--- a/ufed-curses.c
+++ b/ufed-curses.c
@@ -73,6 +73,7 @@ void initcurses() {
 	init_pair(3, COLOR_BLACK, COLOR_WHITE);
 	init_pair(4, COLOR_RED, COLOR_WHITE);
 	init_pair(5, COLOR_BLUE, COLOR_WHITE);
+	init_pair(6, COLOR_BLACK, COLOR_CYAN);
 #ifdef NCURSES_MOUSE_VERSION
 	mousemask(BUTTON1_CLICKED | BUTTON1_DOUBLE_CLICKED | BUTTON1_PRESSED | BUTTON1_RELEASED, NULL);
 #endif
@@ -111,54 +112,50 @@ static void checktermsize() {
  */
 void drawBottom(bool withSep)
 {
-	WINDOW* w = win(Bottom);
+	WINDOW* w      = win(Bottom);
+	int     bWidth = wWidth(Bottom);
 
 	wattrset(w, COLOR_PAIR(2) | A_BOLD);
 	mvwaddch(w, 0, 0, ACS_VLINE);
 	wattrset(w, COLOR_PAIR(3));
 	waddch(w, ' ');
 	waddch(w, ACS_LLCORNER);
-	whline(w, ACS_HLINE, wWidth(Bottom)-6);
+	whline(w, ACS_HLINE, bWidth - 6);
 	if (withSep) {
 		mvwaddch(w, 0, minwidth + 3, ACS_BTEE); // Before state
 		mvwaddch(w, 0, minwidth + 7, ACS_BTEE); // Between state and scope
 		mvwaddch(w, 0, minwidth + 10, ACS_BTEE); // After scope
 	}
-	mvwaddch(w, 0, wWidth(Bottom)-3, ACS_LRCORNER);
+	mvwaddch(w, 0, bWidth - 3, ACS_LRCORNER);
 	waddch(w, ' ');
 	wattrset(w, COLOR_PAIR(2) | A_BOLD);
-	waddch(w, ACS_VLINE);
+	waddch  (w, ACS_VLINE);                   // Right vline on line 0
+	waddch  (w, ACS_VLINE);                   // Left vline on line 1
+	whline  (w, ' ', bWidth - 2);             // Blank line (filled with keys later)
+	mvwaddch(w, 1, bWidth - 1, ACS_VLINE);    // Right vline on line 1
+	mvwaddch(w, 2, 0, ACS_LLCORNER);          // lower left corner on line 2
+	whline  (w, ACS_HLINE, bWidth - 2);       // bottom line
+	mvwaddch(w, 2, bWidth - 1, ACS_LRCORNER); // lower right corner on line 2
 
-	waddch(w, ACS_VLINE);
-	wattrset(w, COLOR_PAIR(3));
 	if (keys) {
-		char buf[COLS + 1];
-		char *p = buf;
-		const sKey* key;
-		const size_t maxAdr = (const size_t)(buf+wWidth(Bottom)-3);
-		*p++ = ' ';
-		for(key=keys; key->key!='\0'; key++) {
-			size_t n = maxAdr - (size_t)p;
-			if(n > key->length)
-				n = key->length;
-			memcpy(p, key->descr, n);
-			p += n;
-			if ((size_t)p == maxAdr)
-				break;
-			*p++ = ' ';
+		const sKey* key = keys;
+		int pos   = 2;
+		int len   = 0;
+
+		while ((pos < (bWidth - 2)) && (key->key != '\0')) {
+			len = strlen(key->descr);
+			if (len > (bWidth - 2 - pos))
+				len = bWidth - 2 - pos;
+			if (key->key > 0)
+				wattrset(w, COLOR_PAIR(6));
+			else
+				wattrset(w, COLOR_PAIR(3));
+			mvwaddnstr(w, 1, pos, key->descr, len);
+			pos += len + 1;
+			++key;
 		}
-		memset(p, ' ', maxAdr + 1 - (size_t)p);
-		buf[wWidth(Bottom)-2] = '\0';
-		waddstr(w, buf);
-	} else
-		whline(w, ' ', wWidth(Bottom) - 3);
-
-	wattrset(w, COLOR_PAIR(2) | A_BOLD);
-	waddch(w, ACS_VLINE);
+	}
 
-	waddch(w, ACS_LLCORNER);
-	whline(w, ACS_HLINE, wWidth(Bottom)-2);
-	mvwhline(w, 2, wWidth(Bottom)-1, ACS_LRCORNER, 1);
 
 	wnoutrefresh(w);
 }
@@ -626,12 +623,12 @@ int maineventloop(
 						for(key = keys; key->key!='\0'; key++) {
 							if( (key->key > 0) && ((size_t)x < key->length)) {
 								event.x -= x;
-								wattrset(win(Bottom), COLOR_PAIR(3) | A_BOLD | A_REVERSE);
+								wattrset(win(Bottom), COLOR_PAIR(6) | A_BOLD | A_REVERSE);
 								mvwaddstr(win(Bottom), event.y, event.x, key->descr);
 								wmove(win(Bottom), event.y, event.x);
 								wrefresh(win(Bottom));
 								usleep(100000);
-								wattrset(win(Bottom), COLOR_PAIR(3));
+								wattrset(win(Bottom), COLOR_PAIR(6));
 								waddstr(win(Bottom), key->descr);
 								wnoutrefresh(win(Bottom));
 								c = key->key;


^ permalink raw reply related	[flat|nested] 238+ messages in thread
* [gentoo-commits] proj/ufed:master commit in: /
@ 2013-02-13  9:23 Sven Eden
  0 siblings, 0 replies; 238+ messages in thread
From: Sven Eden @ 2013-02-13  9:23 UTC (permalink / raw
  To: gentoo-commits

commit:     5fd16c6089187b5241195b855b88cc7c6bad5191
Author:     Sven Eden <sven.eden <AT> gmx <DOT> de>
AuthorDate: Wed Feb 13 08:43:27 2013 +0000
Commit:     Sven Eden <sven.eden <AT> gmx <DOT> de>
CommitDate: Wed Feb 13 08:43:27 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/ufed.git;a=commit;h=5fd16c60

reordered key help and changed some of the texts. It should be much clearer now.

---
 ufed-curses-checklist.c |   36 +++++++++++++++++++-----------------
 1 files changed, 19 insertions(+), 17 deletions(-)

diff --git a/ufed-curses-checklist.c b/ufed-curses-checklist.c
index 28a440c..7e0f018 100644
--- a/ufed-curses-checklist.c
+++ b/ufed-curses-checklist.c
@@ -23,12 +23,11 @@ static const sKey keys[] = {
 	{ '?',      mkKey("Help (?)")             },
 	{ '\n',     mkKey("Save (Enter)")         },
 	{ '\033',   mkKey("Cancel (Esc)")         },
-	{ -1,       mkKey("Display (")            },
-	{ KEY_F(5), mkKey("Masked/Forced (F5),")  },
-	{ KEY_F(6), mkKey("Local/Global (F6),")   },
-	{ KEY_F(7), mkKey("Installed (F7),")      },
-	{ KEY_F(8), mkKey("Order (F8)")           },
-	{ -1,       mkKey(")")                    },
+	{ -1,       mkKey("Toggle :")             },
+	{ KEY_F(5), mkKey("Local/Global (F5)")    },
+	{ KEY_F(6), mkKey("Installed (F6)")       },
+	{ KEY_F(7), mkKey("Masked/Forced (F7)")   },
+	{ KEY_F(9), mkKey("Pkg/Desc Order (F9)")  },
 	{ '\0',     mkKey("")                     }
 };
 #undef mkKey
@@ -460,10 +459,11 @@ static int callback(sFlag** curr, int key)
 			wmove(wLst, (*curr)->currline, 2);
 			wrefresh(wLst);
 			break;
+
 		case KEY_F(5):
-			if      (eMask_masked   == e_mask) e_mask = eMask_unmasked;
-			else if (eMask_unmasked == e_mask) e_mask = eMask_both;
-			else                               e_mask = eMask_masked;
+			if      (eScope_local  == e_scope) e_scope = eScope_all;
+			else if (eScope_global == e_scope) e_scope = eScope_local;
+			else                               e_scope = eScope_global;
 
 			if ( !isFlagLegal(*curr)
 			  && !setNextItem(0, true)
@@ -471,13 +471,12 @@ static int callback(sFlag** curr, int key)
 				resetDisplay(true);
 			else
 				draw(true);
-
 			break;
 
 		case KEY_F(6):
-			if      (eScope_local  == e_scope) e_scope = eScope_all;
-			else if (eScope_global == e_scope) e_scope = eScope_local;
-			else                               e_scope = eScope_global;
+			if      (eState_installed    == e_state) e_state = eState_notinstalled;
+			else if (eState_notinstalled == e_state) e_state = eState_all;
+			else                                     e_state = eState_installed;
 
 			if ( !isFlagLegal(*curr)
 			  && !setNextItem(0, true)
@@ -488,9 +487,9 @@ static int callback(sFlag** curr, int key)
 			break;
 
 		case KEY_F(7):
-			if      (eState_installed    == e_state) e_state = eState_notinstalled;
-			else if (eState_notinstalled == e_state) e_state = eState_all;
-			else                                     e_state = eState_installed;
+			if      (eMask_masked   == e_mask) e_mask = eMask_unmasked;
+			else if (eMask_unmasked == e_mask) e_mask = eMask_both;
+			else                               e_mask = eMask_masked;
 
 			if ( !isFlagLegal(*curr)
 			  && !setNextItem(0, true)
@@ -498,14 +497,17 @@ static int callback(sFlag** curr, int key)
 				resetDisplay(true);
 			else
 				draw(true);
+
 			break;
 
-		case KEY_F(8):
+		case KEY_F(9):
 			if (eOrder_left == e_order) e_order = eOrder_right;
 			else                        e_order = eOrder_left;
+
 			drawFlags();
 			wmove(wInp, 0, strlen(fayt));
 			break;
+
 #ifdef NCURSES_MOUSE_VERSION
 		case KEY_MOUSE:
 			// Masked flags can be turned off, nothing else


^ permalink raw reply related	[flat|nested] 238+ messages in thread
* [gentoo-commits] proj/ufed:master commit in: /
@ 2013-02-13  9:23 Sven Eden
  0 siblings, 0 replies; 238+ messages in thread
From: Sven Eden @ 2013-02-13  9:23 UTC (permalink / raw
  To: gentoo-commits

commit:     bfc655b3c4d9772b2b148247ea71035f8c93f396
Author:     Sven Eden <sven.eden <AT> gmx <DOT> de>
AuthorDate: Wed Feb 13 08:42:46 2013 +0000
Commit:     Sven Eden <sven.eden <AT> gmx <DOT> de>
CommitDate: Wed Feb 13 08:42:46 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/ufed.git;a=commit;h=bfc655b3

Fixed building of the help text.

---
 ufed-curses-help.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/ufed-curses-help.c b/ufed-curses-help.c
index fb54bf5..5788e1c 100644
--- a/ufed-curses-help.c
+++ b/ufed-curses-help.c
@@ -155,9 +155,9 @@ static void init_lines(void)
 		if (n) {
 			memcpy(buf, word, n);
 			buf[n++] = '\0';
-			addFlagDesc(line, NULL, buf, "+    ");
+			addFlagDesc(line, NULL, buf, "+      ");
 		} else
-			addFlagDesc(line, NULL, " ", "+    ");
+			addFlagDesc(line, NULL, " ", "+      ");
 
 		// Advance behind current spaces
 		while (word[n] == ' ')


^ permalink raw reply related	[flat|nested] 238+ messages in thread
* [gentoo-commits] proj/ufed:master commit in: /
@ 2013-02-12 10:51 Sven Eden
  0 siblings, 0 replies; 238+ messages in thread
From: Sven Eden @ 2013-02-12 10:51 UTC (permalink / raw
  To: gentoo-commits

commit:     7c4b4e4397ecc9ddbf9c6cc9e2c1cbe0da9165e9
Author:     Sven Eden <sven.eden <AT> gmx <DOT> de>
AuthorDate: Tue Feb 12 10:52:02 2013 +0000
Commit:     Sven Eden <sven.eden <AT> gmx <DOT> de>
CommitDate: Tue Feb 12 10:52:02 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/ufed.git;a=commit;h=7c4b4e43

Fixed masked/forced display to be (flag) for forced and (-flag) for masked flags. This is the way they are displayed by portage. Further changed the default selection to no longer be A_BOLD, as this turned out to be gray, making the '-' almost invisible. Finally fixed a bug that allowed globally forced flags to be toggled.

---
 ufed-curses-checklist.c |   20 ++++++--------------
 1 files changed, 6 insertions(+), 14 deletions(-)

diff --git a/ufed-curses-checklist.c b/ufed-curses-checklist.c
index 9136256..e871156 100644
--- a/ufed-curses-checklist.c
+++ b/ufed-curses-checklist.c
@@ -258,12 +258,12 @@ static int drawflag(sFlag* flag, bool highlight)
 					' ', // Filled in later
 					flag->stateConf == ' ' ? ')' : ']',
 					/* name */
-					flag->globalForced ? "(+" : flag->globalMasked ? "(" : "",
+					flag->globalForced ? "(" : flag->globalMasked ? "(-" : "",
 					flag->name,
 					(flag->globalForced || flag->globalMasked) ? ")" : "",
 					/* distance */
 					(int)(minwidth
-						- (flag->globalForced ? 2 : flag->globalMasked ? 3 : 5)
+						- (flag->globalForced ? 3 : flag->globalMasked ? 2 : 5)
 						- strlen(flag->name)), " ");
 					// At this point buf is filled up to minwidth
 			} // End of generating left side mask display
@@ -328,13 +328,9 @@ static int drawflag(sFlag* flag, bool highlight)
 					else
 						wattrset(wLst, COLOR_PAIR(4) | A_BOLD);
 					mvwaddch(wLst, line, 2, '-');
-				} else if (' ' == flag->stateConf) {
-					if(highlight)
-						wattrset(wLst, COLOR_PAIR(3) | A_REVERSE);
-					else
-						wattrset(wLst, COLOR_PAIR(3) | A_BOLD);
+				} else if (' ' == flag->stateConf)
 					mvwaddch(wLst, line, 2, flag->stateDefault);
-				} else
+				else
 					mvwaddch(wLst, line, 2, flag->stateConf);
 			}
 
@@ -352,10 +348,6 @@ static int drawflag(sFlag* flag, bool highlight)
 					wattrset(wLst, COLOR_PAIR(4) | A_BOLD);
 				mvwaddch(wLst, line, minwidth + 1, special);
 			} else {
-				if(highlight)
-					wattrset(wLst, COLOR_PAIR(3) | A_BOLD | A_REVERSE);
-				else
-					wattrset(wLst, COLOR_PAIR(3));
 				if (' ' == flag->desc[idx].stateDefault)
 					mvwaddch(wLst, line, minwidth + 1, flag->stateDefault);
 				else
@@ -432,7 +424,7 @@ static int callback(sFlag** curr, int key)
 			break;
 		case ' ':
 			// Masked flags can be turned off, nothing else
-			if ( (*curr)->globalMasked ) {
+			if ( (*curr)->globalMasked || (*curr)->globalForced ) {
 				if (' ' != (*curr)->stateConf)
 					(*curr)->stateConf = ' ';
 			} else {
@@ -517,7 +509,7 @@ static int callback(sFlag** curr, int key)
 #ifdef NCURSES_MOUSE_VERSION
 		case KEY_MOUSE:
 			// Masked flags can be turned off, nothing else
-			if ( (*curr)->globalMasked ) {
+			if ( (*curr)->globalMasked || (*curr)->globalForced ) {
 				if (' ' != (*curr)->stateConf)
 					(*curr)->stateConf = ' ';
 			} else {


^ permalink raw reply related	[flat|nested] 238+ messages in thread
* [gentoo-commits] proj/ufed:master commit in: /
@ 2013-02-12 10:51 Sven Eden
  0 siblings, 0 replies; 238+ messages in thread
From: Sven Eden @ 2013-02-12 10:51 UTC (permalink / raw
  To: gentoo-commits

commit:     152ce93281e7bd7ce0cb08454f91f50ff6f1e847
Author:     Sven Eden <sven.eden <AT> gmx <DOT> de>
AuthorDate: Tue Feb 12 10:44:51 2013 +0000
Commit:     Sven Eden <sven.eden <AT> gmx <DOT> de>
CommitDate: Tue Feb 12 10:44:51 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/ufed.git;a=commit;h=152ce932

Beautified the help line a bit. However, it must be redesigned and the functionkeys reordered. The design is not clear enough and the ordering should be thought over.

---
 ufed-curses-checklist.c |   20 ++++++++++----------
 1 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/ufed-curses-checklist.c b/ufed-curses-checklist.c
index ebf25e7..9136256 100644
--- a/ufed-curses-checklist.c
+++ b/ufed-curses-checklist.c
@@ -20,16 +20,16 @@ static sFlag*  flags           = NULL;
 
 #define mkKey(x) x, sizeof(x)-1
 static const sKey keys[] = {
-	{ '?',      mkKey("Help (?)")            },
-	{ '\n',     mkKey("Save (Return/Enter)") },
-	{ '\033',   mkKey("Cancel (Esc)")        },
-	{ -1,       mkKey("Display (")           },
-	{ KEY_F(5), mkKey("Mask (F5)")           },
-	{ KEY_F(6), mkKey("Local/Global (F6)")   },
-	{ KEY_F(7), mkKey("Installed (F7)")      },
-	{ KEY_F(8), mkKey("Order (F8)")          },
-	{ -1,       mkKey(")")                   },
-	{ '\0',     mkKey("")                    }
+	{ '?',      mkKey("Help (?)")             },
+	{ '\n',     mkKey("Save (Enter)")         },
+	{ '\033',   mkKey("Cancel (Esc)")         },
+	{ -1,       mkKey("Display (")            },
+	{ KEY_F(5), mkKey("Masked/Forced (F5),")  },
+	{ KEY_F(6), mkKey("Local/Global (F6),")   },
+	{ KEY_F(7), mkKey("Installed (F7),")      },
+	{ KEY_F(8), mkKey("Order (F8)")           },
+	{ -1,       mkKey(")")                    },
+	{ '\0',     mkKey("")                     }
 };
 #undef mkKey
 


^ permalink raw reply related	[flat|nested] 238+ messages in thread
* [gentoo-commits] proj/ufed:master commit in: /
@ 2013-02-12  9:01 Sven Eden
  0 siblings, 0 replies; 238+ messages in thread
From: Sven Eden @ 2013-02-12  9:01 UTC (permalink / raw
  To: gentoo-commits

commit:     ccdb50aa4d5271ee5b9633be453fc497375ed313
Author:     Sven Eden <sven.eden <AT> gmx <DOT> de>
AuthorDate: Tue Feb 12 09:01:01 2013 +0000
Commit:     Sven Eden <sven.eden <AT> gmx <DOT> de>
CommitDate: Tue Feb 12 09:01:01 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/ufed.git;a=commit;h=ccdb50aa

Instead of trying to hide the cursor, it is now placed in the input line (where it belongs).

---
 ufed-curses-checklist.c |   50 ++++++++++++++++++++++++++++++++++------------
 ufed-curses.c           |   20 ++++++++++--------
 2 files changed, 48 insertions(+), 22 deletions(-)

diff --git a/ufed-curses-checklist.c b/ufed-curses-checklist.c
index b5e3ee3..ebf25e7 100644
--- a/ufed-curses-checklist.c
+++ b/ufed-curses-checklist.c
@@ -13,7 +13,6 @@
 
 /* internal members */
 static int     descriptionleft = 0;
-static char*   fayt            = NULL;
 static sFlag** faytsave        = NULL;
 static size_t  maxDescWidth    = 0;
 static char*   lineBuf         = NULL;
@@ -318,13 +317,22 @@ static int drawflag(sFlag* flag, bool highlight)
 			if (!hasHead) {
 				hasHead = true;
 				if (flag->globalForced) {
-					wattrset(wLst, COLOR_PAIR(5) | A_BOLD);
+					if(highlight)
+						wattrset(wLst, COLOR_PAIR(5) | A_REVERSE);
+					else
+						wattrset(wLst, COLOR_PAIR(5) | A_BOLD);
 					mvwaddch(wLst, line, 2, '+');
 				} else if (flag->globalMasked) {
-					wattrset(wLst, COLOR_PAIR(4) | A_BOLD);
+					if(highlight)
+						wattrset(wLst, COLOR_PAIR(4) | A_REVERSE);
+					else
+						wattrset(wLst, COLOR_PAIR(4) | A_BOLD);
 					mvwaddch(wLst, line, 2, '-');
 				} else if (' ' == flag->stateConf) {
-					wattrset(wLst, COLOR_PAIR(3) | A_BOLD);
+					if(highlight)
+						wattrset(wLst, COLOR_PAIR(3) | A_REVERSE);
+					else
+						wattrset(wLst, COLOR_PAIR(3) | A_BOLD);
 					mvwaddch(wLst, line, 2, flag->stateDefault);
 				} else
 					mvwaddch(wLst, line, 2, flag->stateConf);
@@ -332,13 +340,22 @@ static int drawflag(sFlag* flag, bool highlight)
 
 			// Add [D]efault column content
 			if ('f' == special) {
-				wattrset(wLst, COLOR_PAIR(5) | A_BOLD);
+				if(highlight)
+					wattrset(wLst, COLOR_PAIR(5) | A_REVERSE);
+				else
+					wattrset(wLst, COLOR_PAIR(5) | A_BOLD);
 				mvwaddch(wLst, line, minwidth + 1, special);
 			} else if ('m' == special) {
-				wattrset(wLst, COLOR_PAIR(4) | A_BOLD);
+				if(highlight)
+					wattrset(wLst, COLOR_PAIR(4) | A_REVERSE);
+				else
+					wattrset(wLst, COLOR_PAIR(4) | A_BOLD);
 				mvwaddch(wLst, line, minwidth + 1, special);
 			} else {
-				wattrset(wLst, COLOR_PAIR(3));
+				if(highlight)
+					wattrset(wLst, COLOR_PAIR(3) | A_BOLD | A_REVERSE);
+				else
+					wattrset(wLst, COLOR_PAIR(3));
 				if (' ' == flag->desc[idx].stateDefault)
 					mvwaddch(wLst, line, minwidth + 1, flag->stateDefault);
 				else
@@ -375,7 +392,8 @@ static int callback(sFlag** curr, int key)
 		fayt[0] = '\0';
 		drawStatus(true);
 		wrefresh(wInp);
-	}
+	} else
+		wmove(wInp, 0, strlen(fayt));
 
 	// Reset possible side scrolling of the current flags description first
 	if(descriptionleft && (key != KEY_LEFT) && (key != KEY_RIGHT) ) {
@@ -393,8 +411,8 @@ static int callback(sFlag** curr, int key)
 			fayt[--fLen] = '\0';
 			drawflag(*curr, FALSE);
 			*curr = faytsave[fLen];
-			scrollcurrent();
-			drawflag(*curr, TRUE);
+			if (!scrollcurrent())
+				drawflag(*curr, TRUE);
 			wattrset(wInp, COLOR_PAIR(5) | A_BOLD);
 			mvwaddstr(wInp, 0, 0, fayt);
 			whline(wInp, ' ', 2);
@@ -494,6 +512,7 @@ static int callback(sFlag** curr, int key)
 			if (eOrder_left == e_order) e_order = eOrder_right;
 			else                        e_order = eOrder_left;
 			drawFlags();
+			wmove(wInp, 0, strlen(fayt));
 			break;
 #ifdef NCURSES_MOUSE_VERSION
 		case KEY_MOUSE:
@@ -520,6 +539,7 @@ static int callback(sFlag** curr, int key)
 				wrefresh(wLst);
 			} else {
 				drawFlags();
+				wmove(wInp, 0, strlen(fayt));
 			}
 			break;
 #endif
@@ -536,6 +556,8 @@ static int callback(sFlag** curr, int key)
 				faytsave[fLen] = *curr;
 				fayt[++fLen]   = '\0';
 
+				wmove(wInp, 0, fLen);
+
 				/* if the current flag already matches the input string,
 				 * then update the input area only.
 				 */
@@ -560,18 +582,20 @@ static int callback(sFlag** curr, int key)
 						wmove(wInp, 0, fLen - 1);
 						wrefresh(wInp);
 					} else {
-						wattrset(wInp, COLOR_PAIR(5) | A_BOLD);
-						mvwaddstr(wInp, 0, 0, fayt);
-						wnoutrefresh(wInp);
 						drawflag(*curr, FALSE);
 						*curr = flag;
 						if (!scrollcurrent())
 							drawflag(*curr, TRUE);
+						wattrset(wInp, COLOR_PAIR(5) | A_BOLD);
+						mvwaddstr(wInp, 0, 0, fayt);
+						wmove(wInp, 0, fLen);
+						wrefresh(wInp);
 					}
 				}
 			}
 			break;
 	}
+
 	return -1;
 }
 

diff --git a/ufed-curses.c b/ufed-curses.c
index 6d80c8f..f8680bb 100644
--- a/ufed-curses.c
+++ b/ufed-curses.c
@@ -234,8 +234,8 @@ void drawFlags() {
 		} else
 			dispEnd = flag->listline + flag->ndesc;
 	}
-	wmove(wLst, lHeight - 1, lWidth - 1);
-	wnoutrefresh(win(List));
+	wmove(win(Input), 0, strlen(fayt));
+	wnoutrefresh(wLst);
 }
 
 static void drawScrollbar() {
@@ -268,6 +268,7 @@ static void drawScrollbar() {
 
 	mvwaddch(w, sHeight - 2, 0, ACS_DARROW);
 	mvwaddch(w, sHeight - 1, 0, ACS_VLINE);
+	wmove(win(Input), 0, strlen(fayt));
 	wnoutrefresh(w);
 }
 
@@ -309,9 +310,9 @@ void drawStatus(bool withSep)
 		waddstr(w, buf);
 	}
 
-	// Reset cursor to 0,0 and apply changes
-	wmove(w, 0, 0);
-	wnoutrefresh(w);
+	// Reset cursor and apply changes
+	wmove(w, 0, strlen(fayt));
+	wrefresh(w);
 }
 
 
@@ -388,14 +389,13 @@ void draw(bool withSep) {
 
 	drawTop(withSep);
 	drawBottom(withSep);
-	drawStatus(withSep);
 
 	if (flags) {
 		drawFlags();
 		drawScrollbar();
 	}
 
-	wrefresh(win(List));
+	drawStatus(withSep);
 }
 
 bool scrollcurrent() {
@@ -555,8 +555,10 @@ int maineventloop(
 							if(result>=0)
 								goto exit;
 						}
-						scrollcurrent();
-						drawflag(currentflag, TRUE);
+						if (scrollcurrent())
+							drawStatus(withSep);
+						else
+							drawflag(currentflag, TRUE);
 					}
 				} else if(wmouse_trafo(win(Scrollbar), &event.y, &event.x, FALSE)) {
 					// Only do mouse events if there actually is a scrollbar


^ permalink raw reply related	[flat|nested] 238+ messages in thread
* [gentoo-commits] proj/ufed:master commit in: /
@ 2013-02-12  9:01 Sven Eden
  0 siblings, 0 replies; 238+ messages in thread
From: Sven Eden @ 2013-02-12  9:01 UTC (permalink / raw
  To: gentoo-commits

commit:     c4daab69f30e5cbcf367c2ae5d096ffc3da27b48
Author:     Sven Eden <sven.eden <AT> gmx <DOT> de>
AuthorDate: Mon Feb 11 18:20:56 2013 +0000
Commit:     Sven Eden <sven.eden <AT> gmx <DOT> de>
CommitDate: Mon Feb 11 18:20:56 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/ufed.git;a=commit;h=c4daab69

Allow information on specific versioning of packages for masked/forced flags and flags that are explicitly enabled/disabled by package.use files.

---
 Portage.pm |   32 ++++++++++++++++++++++++++------
 1 files changed, 26 insertions(+), 6 deletions(-)

diff --git a/Portage.pm b/Portage.pm
index 93c991c..06e711c 100644
--- a/Portage.pm
+++ b/Portage.pm
@@ -267,6 +267,23 @@ sub _determine_profiles
 # No parameters accepted
 sub _final_cleaning
 {
+	# All flags that are specific to explicit versioning have no
+	# descriptions yet. This must be enriched from the versionless
+	# package setting, or deleted if none are found.
+	for my $flag (keys %{$_use_temp}) {
+		my $flagRef  = $_use_temp->{$flag}; ## Shortcut
+		for my $pkg (sort keys %{$flagRef->{"local"}}) {
+			next if (length($flagRef->{"local"}{$pkg}{descr}));
+			
+			if ($pkg =~ /^[<>=~]+([^<>=~].+)-\d+(?:\.\d+)*\w?(?:_(?:alpha|beta|pre|rc|p)\d*)*(?:-r\d+)?$/) {
+				defined($flagRef->{"local"}{$1})
+					and $flagRef->{"local"}{$pkg}{descr} = $flagRef->{"local"}{$1}{descr}
+					or  delete($flagRef->{"local"}{$pkg}{descr});
+			}
+			
+		} ## End of looping packages
+	} ## End of looping flags
+	
 	# The "disable all" flag is truncated to '*' by the parsing, but it
 	# has to read '-*'.
 	_add_temp("-*", "global");
@@ -302,17 +319,19 @@ sub _gen_use_flags
 		my $flagRef  = $_use_temp->{$flag}; ## Shortcut
 		my $hasGlobal= defined($flagRef->{global}) ? 1 : 0;
 		my $lCount   = ($hasGlobal && length($flagRef->{global}{descr})) ? 1 : 0;
-		my $gDesc    = "(Unknown)";
+		my $gDesc    = "";
 		my $gKey     = "";
 		my $gRef     = $flagRef->{global};
+		my $gdLen    = 0;
 		my $pDesc    = "";
 		my $pKey     = "";
 		my $pRef     = undef;
-		my $pdLen     = 0;
+		my $pdLen    = 0;
 		
 		# Build the description consolidation hash
-		if ($lCount) {
+		if ($hasGlobal) {
 			$gDesc = $gRef->{descr};
+			$gdLen = length($gDesc);
 			$gKey  = sprintf("[%s]%d:%d:%d:%d:%d:%d:%d", $gDesc, $gRef->{conf}, $gRef->{"default"},
 							$gRef->{forced}, $gRef->{installed}, $gRef->{masked},
 							$gRef->{"package"}, $gRef->{pkguse});
@@ -320,7 +339,8 @@ sub _gen_use_flags
 		for my $pkg (sort keys %{$flagRef->{"local"}}) {
 			$pRef  = $flagRef->{"local"}{$pkg};
 			$pdLen = length($pRef->{descr});
-			$pDesc = $pdLen ? "$pRef->{descr}" : $gDesc;
+			$pDesc = $pdLen ? "$pRef->{descr}" :
+					 $gdLen ? $gDesc : "(Unknown)";
 			
 			# Now the Key can be assembled...
 			$pKey  = sprintf("[%s]%d:%d:%d:%d:%d:%d:%d", $pDesc, $pRef->{conf}, $pRef->{"default"},
@@ -577,7 +597,7 @@ sub _read_make_defaults {
 			# acceptable way determine which versions are relevant,
 			# we have to *skip* all settings that have specific version
 			# and/or slot information limiting their scope.
-			$pkg =~ /^[<>=~]/ and next;
+# CHECK			$pkg =~ /^[<>=~]/ and next;
 			
 			for my $flag (@flags) {
 				my $state = $flag =~ s/^-// || 0;
@@ -640,7 +660,7 @@ sub _read_packages {
 			}
 
 			# could be shortened, but make sure not to strip off part of the name
-			$pkg =~ s/-\d+(?:\.\d+)*\w?(?:_(?:alpha|beta|pre|rc|p)\d*)?(?:-r\d+)?$//;
+			$pkg =~ s/-\d+(?:\.\d+)*\w?(?:_(?:alpha|beta|pre|rc|p)\d*)*(?:-r\d+)?$//;
 			$pkg = $cat . "/" . $pkg;
 
 			# Now save the knowledge gained (if any) in $_use_temp:


^ permalink raw reply related	[flat|nested] 238+ messages in thread
* [gentoo-commits] proj/ufed:master commit in: /
@ 2013-02-12  9:01 Sven Eden
  0 siblings, 0 replies; 238+ messages in thread
From: Sven Eden @ 2013-02-12  9:01 UTC (permalink / raw
  To: gentoo-commits

commit:     f1c6e5c6437c1b7d379dd2d524229391dd3acca4
Author:     Sven Eden <sven.eden <AT> gmx <DOT> de>
AuthorDate: Mon Feb 11 17:43:57 2013 +0000
Commit:     Sven Eden <sven.eden <AT> gmx <DOT> de>
CommitDate: Mon Feb 11 17:43:57 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/ufed.git;a=commit;h=f1c6e5c6

Added local "default" settings from IUSE to output string

---
 Portage.pm |    1 -
 ufed.pl.in |    6 ++++--
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/Portage.pm b/Portage.pm
index 1f3bb55..93c991c 100644
--- a/Portage.pm
+++ b/Portage.pm
@@ -334,7 +334,6 @@ sub _gen_use_flags
 				|| $pRef->{masked}       ## explicitly (un)masked from package.use.mask
 				|| $pRef->{pkguse}       ## explicitly (un)set from users package.use
 			   ) {
-printf STDERR "Added $flag / $pkg local \"%s\" (lCount %d, pdLen %d)\n", $pKey, $lCount, $pdLen;
 				$descCons{$pKey}{$pkg} = 1;
 				++$lCount;
 			}

diff --git a/ufed.pl.in b/ufed.pl.in
index 9613174..3bc048a 100644
--- a/ufed.pl.in
+++ b/ufed.pl.in
@@ -84,7 +84,7 @@ sub flags_dialog {
 
 		# Print global description first (if available)
 		if (defined($conf->{global}) && length($conf->{global}{descr})) {
-			$outTxt .= sprintf("\t%s\t ( ) [+%s%s%s  ]\n",
+			$outTxt .= sprintf("\t%s\t ( ) [+%s%s%s   ]\n",
 						$conf->{global}{descr},
 						$conf->{global}{installed} ? '+' : ' ',
 						$conf->{global}{forced} ? '+' : ' ',
@@ -93,7 +93,7 @@ sub flags_dialog {
 
 		# Finally print the local description lines
 		for my $pkg (sort keys %{$conf->{"local"}}) {
-			$outTxt .= sprintf("\t%s\t (%s) [ %s%s%s%s%s]\n",
+			$outTxt .= sprintf("\t%s\t (%s) [ %s%s%s%s%s%s]\n",
 						$conf->{"local"}{$pkg}{descr},
 						$pkg,
 						$conf->{"local"}{$pkg}{installed} > 0 ? '+' :
@@ -102,6 +102,8 @@ sub flags_dialog {
 						$conf->{"local"}{$pkg}{forced}    < 0 ? '-' : ' ',
 						$conf->{"local"}{$pkg}{masked}    > 0 ? '+' :
 						$conf->{"local"}{$pkg}{masked}    < 0 ? '-' : ' ',
+						$conf->{"local"}{$pkg}{"default"} > 0 ? '+' :
+						$conf->{"local"}{$pkg}{"default"} < 0 ? '-' : ' ',
 						$conf->{"local"}{$pkg}{"package"} > 0 ? '+' :
 						$conf->{"local"}{$pkg}{"package"} < 0 ? '-' : ' ',
 						$conf->{"local"}{$pkg}{pkguse}    > 0 ? '+' :


^ permalink raw reply related	[flat|nested] 238+ messages in thread
* [gentoo-commits] proj/ufed:master commit in: /
@ 2013-02-12  9:01 Sven Eden
  0 siblings, 0 replies; 238+ messages in thread
From: Sven Eden @ 2013-02-12  9:01 UTC (permalink / raw
  To: gentoo-commits

commit:     053dd554d7e46ae10b2d6e4dd1dac0058cc86b35
Author:     Sven Eden <sven.eden <AT> gmx <DOT> de>
AuthorDate: Mon Feb 11 17:45:05 2013 +0000
Commit:     Sven Eden <sven.eden <AT> gmx <DOT> de>
CommitDate: Mon Feb 11 17:45:05 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/ufed.git;a=commit;h=053dd554

Added reading of local "default" setting int read_flags() and changed display to show IUSE defaults if set instead of global defaults for local descriptions.

---
 ufed-curses-checklist.c |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/ufed-curses-checklist.c b/ufed-curses-checklist.c
index 934b92d..227dc20 100644
--- a/ufed-curses-checklist.c
+++ b/ufed-curses-checklist.c
@@ -141,7 +141,7 @@ static void read_flags(void)
 				ERROR_EXIT(-1, "Description read failed on line %d\n\"%s\"\n", lineNum + 1, line);
 
 			// Check stats
-			if ((state.end - state.start) != 6)
+			if ((state.end - state.start) != 7)
 				ERROR_EXIT(-1, "Illegal description stats on line %d:\n\"%s\"\n", lineNum + 1, line);
 
 			// Add description line to flag:
@@ -339,7 +339,10 @@ static int drawflag(sFlag* flag, bool highlight)
 				mvwaddch(wLst, line, minwidth + 1, special);
 			} else {
 				wattrset(wLst, COLOR_PAIR(3));
-				mvwaddch(wLst, line, minwidth + 1, flag->stateDefault);
+				if (' ' == flag->desc[idx].stateDefault)
+					mvwaddch(wLst, line, minwidth + 1, flag->stateDefault);
+				else
+					mvwaddch(wLst, line, minwidth + 1, flag->desc[idx].stateDefault);
 			}
 
 			++line;


^ permalink raw reply related	[flat|nested] 238+ messages in thread
* [gentoo-commits] proj/ufed:master commit in: /
@ 2013-02-12  9:01 Sven Eden
  0 siblings, 0 replies; 238+ messages in thread
From: Sven Eden @ 2013-02-12  9:01 UTC (permalink / raw
  To: gentoo-commits

commit:     bda105db8356b122435717099adccfe3e9b9e6b0
Author:     Sven Eden <sven.eden <AT> gmx <DOT> de>
AuthorDate: Tue Feb 12 08:59:44 2013 +0000
Commit:     Sven Eden <sven.eden <AT> gmx <DOT> de>
CommitDate: Tue Feb 12 08:59:44 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/ufed.git;a=commit;h=bda105db

Added "fayt" (Input search string) to the global area.

---
 ufed-curses-globals.c |    1 +
 ufed-curses-globals.h |    1 +
 2 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/ufed-curses-globals.c b/ufed-curses-globals.c
index d43c4f1..dc9a38a 100644
--- a/ufed-curses-globals.c
+++ b/ufed-curses-globals.c
@@ -14,6 +14,7 @@ eMask      e_mask         = eMask_unmasked;
 eOrder     e_order        = eOrder_left;
 eScope     e_scope        = eScope_all;
 eState     e_state        = eState_all;
+char*      fayt           = NULL;
 sListStats listStats      = { 0, 0, 0, 0, 0, 0 };
 sWindow    window[wCount] = {
 	{ NULL,  0,  0,  5,  0 }, /* Top       --- Top ---- */

diff --git a/ufed-curses-globals.h b/ufed-curses-globals.h
index 263590b..514563e 100644
--- a/ufed-curses-globals.h
+++ b/ufed-curses-globals.h
@@ -15,6 +15,7 @@ extern eMask      e_mask;
 extern eOrder     e_order;
 extern eScope     e_scope;
 extern eState     e_state;
+extern char*      fayt;
 extern sListStats listStats;
 extern int        minwidth;
 extern int        topline;


^ permalink raw reply related	[flat|nested] 238+ messages in thread
* [gentoo-commits] proj/ufed:master commit in: /
@ 2013-02-12  9:01 Sven Eden
  0 siblings, 0 replies; 238+ messages in thread
From: Sven Eden @ 2013-02-12  9:01 UTC (permalink / raw
  To: gentoo-commits

commit:     7cd5b2871ee53ac2c9d1470f95fba7b537ded7c1
Author:     Sven Eden <sven.eden <AT> gmx <DOT> de>
AuthorDate: Tue Feb 12 07:18:50 2013 +0000
Commit:     Sven Eden <sven.eden <AT> gmx <DOT> de>
CommitDate: Tue Feb 12 07:18:50 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/ufed.git;a=commit;h=7cd5b287

Removed the warping of the beginning and end of the list. Further added the missing column separators on blank lines and move the cursor to the display end after drawing the flags.

---
 ufed-curses.c |   25 ++++++++++++++-----------
 1 files changed, 14 insertions(+), 11 deletions(-)

diff --git a/ufed-curses.c b/ufed-curses.c
index cd94da9..6d80c8f 100644
--- a/ufed-curses.c
+++ b/ufed-curses.c
@@ -165,7 +165,9 @@ void drawBottom(bool withSep)
 
 
 void drawFlags() {
-	int lHeight = wHeight(List);
+	WINDOW* wLst    = win(List);
+	int     lHeight = wHeight(List);
+	int     lWidth  = wWidth(List);
 
 	/* this method must not be called if the current
 	 * item is not valid.
@@ -220,18 +222,19 @@ void drawFlags() {
 			 * flag list, but not the end of the display.
 			 */
 			if(flag == flags) {
-				int lWidth = wWidth(List);
-				char buf[lWidth];
-				memset(buf, ' ', lWidth);
-				buf[lWidth] = '\0';
-				wmove(win(List), line, 0);
-				wattrset(win(List), COLOR_PAIR(3));
-				while(line++ < lHeight)
-					waddstr(win(List), buf);
+				wattrset(wLst, COLOR_PAIR(3));
+				while(line < lHeight) {
+					mvwhline(wLst, line, 0, ' ', lWidth);
+					mvwaddch(wLst, line, minwidth,     ACS_VLINE); // Before state
+					mvwaddch(wLst, line, minwidth + 4, ACS_VLINE); // Between state and scope
+					mvwaddch(wLst, line, minwidth + 7, ACS_VLINE); // After scope
+					++line;
+				}
 			}
 		} else
 			dispEnd = flag->listline + flag->ndesc;
 	}
+	wmove(wLst, lHeight - 1, lWidth - 1);
 	wnoutrefresh(win(List));
 }
 
@@ -779,7 +782,7 @@ bool setNextItem(int count, bool strict)
 		return false;
 	}
 
-	while (result && (skipped < count)) {
+	while (result && (skipped < count) && (curr->next != flags)) {
 		lastFlag = curr;
 		lastTop  = topline;
 		fHeight  = getFlagHeight(curr);
@@ -849,7 +852,7 @@ bool setPrevItem(int count, bool strict)
 		return false;
 	}
 
-	while (result && (skipped < count)) {
+	while (result && (skipped < count) && (curr != flags)) {
 		lastFlag = curr;
 		lastTop  = topline;
 		curr     = curr->prev;


^ permalink raw reply related	[flat|nested] 238+ messages in thread
* [gentoo-commits] proj/ufed:master commit in: /
@ 2013-02-12  9:01 Sven Eden
  0 siblings, 0 replies; 238+ messages in thread
From: Sven Eden @ 2013-02-12  9:01 UTC (permalink / raw
  To: gentoo-commits

commit:     811741909642be4bf626caabc1823dbdd8c94d12
Author:     Sven Eden <sven.eden <AT> gmx <DOT> de>
AuthorDate: Tue Feb 12 07:20:11 2013 +0000
Commit:     Sven Eden <sven.eden <AT> gmx <DOT> de>
CommitDate: Tue Feb 12 07:20:11 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/ufed.git;a=commit;h=81174190

Change the move of the current flag to 0 flags to skip when a filter is toggled. This way the list will no longer skip the last/first flag if a filter is toggled that leaves the current item on the first/last displayable flag.

---
 ufed-curses-checklist.c |   12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/ufed-curses-checklist.c b/ufed-curses-checklist.c
index 227dc20..b5e3ee3 100644
--- a/ufed-curses-checklist.c
+++ b/ufed-curses-checklist.c
@@ -456,8 +456,8 @@ static int callback(sFlag** curr, int key)
 			else                               e_mask = eMask_masked;
 
 			if ( !isFlagLegal(*curr)
-			  && !setNextItem(1, true)
-			  && !setPrevItem(1, true) )
+			  && !setNextItem(0, true)
+			  && !setPrevItem(0, true) )
 				resetDisplay(true);
 			else
 				draw(true);
@@ -470,8 +470,8 @@ static int callback(sFlag** curr, int key)
 			else                               e_scope = eScope_global;
 
 			if ( !isFlagLegal(*curr)
-			  && !setNextItem(1, true)
-			  && !setPrevItem(1, true) )
+			  && !setNextItem(0, true)
+			  && !setPrevItem(0, true) )
 				resetDisplay(true);
 			else
 				draw(true);
@@ -483,8 +483,8 @@ static int callback(sFlag** curr, int key)
 			else                                     e_state = eState_installed;
 
 			if ( !isFlagLegal(*curr)
-			  && !setNextItem(1, true)
-			  && !setPrevItem(1, true) )
+			  && !setNextItem(0, true)
+			  && !setPrevItem(0, true) )
 				resetDisplay(true);
 			else
 				draw(true);


^ permalink raw reply related	[flat|nested] 238+ messages in thread
* [gentoo-commits] proj/ufed:master commit in: /
@ 2013-02-12  9:01 Sven Eden
  0 siblings, 0 replies; 238+ messages in thread
From: Sven Eden @ 2013-02-12  9:01 UTC (permalink / raw
  To: gentoo-commits

commit:     6f41b3dd0f6d64d5120b18c2a10dc2911a47682f
Author:     Sven Eden <sven.eden <AT> gmx <DOT> de>
AuthorDate: Mon Feb 11 17:42:24 2013 +0000
Commit:     Sven Eden <sven.eden <AT> gmx <DOT> de>
CommitDate: Mon Feb 11 17:42:24 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/ufed.git;a=commit;h=6f41b3dd

Added local "default" setting from IUSE to struct sDesc_

---
 ufed-curses-types.c |    9 +++++----
 ufed-curses-types.h |    1 +
 2 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/ufed-curses-types.c b/ufed-curses-types.c
index 3cdb04d..a3bc79e 100644
--- a/ufed-curses-types.c
+++ b/ufed-curses-types.c
@@ -102,7 +102,7 @@ sFlag* addFlag (sFlag** root, const char* name, int line, int ndesc, const char
  *  @param[in] state '+','-',' ' for global, installed, forced, masked, package - in that order.
  *  @return the full length of the description including package list and separators
 **/
-size_t addFlagDesc (sFlag* flag, const char* pkg, const char* desc, const char state[6])
+size_t addFlagDesc (sFlag* flag, const char* pkg, const char* desc, const char state[7])
 {
 	size_t result = 3; // space and brackets.
 	if (flag) {
@@ -111,7 +111,7 @@ size_t addFlagDesc (sFlag* flag, const char* pkg, const char* desc, const char s
 		if (idx < flag->ndesc) {
 
 			// state is a byte mask. Check it first:
-			for (int i = 0; i < 6; ++i) {
+			for (int i = 0; i < 7; ++i) {
 				if (('+' != state[i]) && ('-' != state[i]) && (' ' != state[i]))
 					ERROR_EXIT(-1, "Illegal character '%c' in state string at position %d\n",
 						state[i], i)
@@ -124,8 +124,9 @@ size_t addFlagDesc (sFlag* flag, const char* pkg, const char* desc, const char s
 			if ('+' == state[1]) flag->desc[idx].isInstalled = true;
 			flag->desc[idx].stateForced  = state[2];
 			flag->desc[idx].stateMasked  = state[3];
-			flag->desc[idx].statePackage = state[4];
-			flag->desc[idx].statePkgUse  = state[5];
+			flag->desc[idx].stateDefault = state[4];
+			flag->desc[idx].statePackage = state[5];
+			flag->desc[idx].statePkgUse  = state[6];
 
 			// Set flag mask and force status if this is a global and masked/forced description
 			if (flag->desc[idx].isGlobal && ('+' == flag->desc[idx].stateMasked))

diff --git a/ufed-curses-types.h b/ufed-curses-types.h
index db61c3c..7eb7991 100644
--- a/ufed-curses-types.h
+++ b/ufed-curses-types.h
@@ -102,6 +102,7 @@ typedef struct sDesc_ {
 	char* pkg;          //!< affected packages
 	char  stateForced;  //!< unforced '-', forced '+' or not set ' ' by *use.force
 	char  stateMasked;  //!< unmasked '-', masked '+' or not sed ' ' by *use.mask
+	char  stateDefault; //!< disabled '-', enabled '+' or not set ' ' ebuilds IUSE (installed packages only)
 	char  statePackage; //!< disabled '-', enabled '+' or not set ' ' by profiles package.use
 	char  statePkgUse;  //!< disabled '-', enabled '+' or not set ' ' by users package.use
 } sDesc;


^ permalink raw reply related	[flat|nested] 238+ messages in thread
* [gentoo-commits] proj/ufed:master commit in: /
@ 2013-02-12  9:01 Sven Eden
  0 siblings, 0 replies; 238+ messages in thread
From: Sven Eden @ 2013-02-12  9:01 UTC (permalink / raw
  To: gentoo-commits

commit:     d0eea64382e8f14897a1b30895eb0a2fa2255f56
Author:     Sven Eden <sven.eden <AT> gmx <DOT> de>
AuthorDate: Tue Feb 12 06:53:55 2013 +0000
Commit:     Sven Eden <sven.eden <AT> gmx <DOT> de>
CommitDate: Tue Feb 12 06:53:55 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/ufed.git;a=commit;h=d0eea643

Fixed a bug that could cause the list to look corrupted if a strong limiting filter (like "masked only") has just been turned off.

---
 ufed-curses.c |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/ufed-curses.c b/ufed-curses.c
index e0eadfd..cd94da9 100644
--- a/ufed-curses.c
+++ b/ufed-curses.c
@@ -178,7 +178,12 @@ void drawFlags() {
 	sFlag* flag = currentflag;
 	sFlag* last = currentflag;
 
-	int line = flag->listline - topline;
+	/* lHeight - flagHeight are compared against listline - topline,
+	 * because the latter can result in a too large value if a
+	 * strong limiting filter (like "masked") has just been turned
+	 * off.
+	 */
+	int line = min(lHeight - getFlagHeight(flag), flag->listline - topline);
 
 	/* move to the top of the displayed list */
 	while ((flag != flags) && (line > 0)) {


^ permalink raw reply related	[flat|nested] 238+ messages in thread
* [gentoo-commits] proj/ufed:master commit in: /
@ 2013-02-12  9:01 Sven Eden
  0 siblings, 0 replies; 238+ messages in thread
From: Sven Eden @ 2013-02-12  9:01 UTC (permalink / raw
  To: gentoo-commits

commit:     b23472af8e6dda4e7040e39916fa896619e417f0
Author:     Sven Eden <sven.eden <AT> gmx <DOT> de>
AuthorDate: Mon Feb 11 07:37:27 2013 +0000
Commit:     Sven Eden <sven.eden <AT> gmx <DOT> de>
CommitDate: Mon Feb 11 07:40:03 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/ufed.git;a=commit;h=b23472af

Added sixth flag character to addFlagDesc() and new statePkgUse to use it to struct sDesc_.

---
 ufed-curses-types.c |    5 +++--
 ufed-curses-types.h |   13 +++++++------
 2 files changed, 10 insertions(+), 8 deletions(-)

diff --git a/ufed-curses-types.c b/ufed-curses-types.c
index 0d31300..3cdb04d 100644
--- a/ufed-curses-types.c
+++ b/ufed-curses-types.c
@@ -102,7 +102,7 @@ sFlag* addFlag (sFlag** root, const char* name, int line, int ndesc, const char
  *  @param[in] state '+','-',' ' for global, installed, forced, masked, package - in that order.
  *  @return the full length of the description including package list and separators
 **/
-size_t addFlagDesc (sFlag* flag, const char* pkg, const char* desc, const char state[5])
+size_t addFlagDesc (sFlag* flag, const char* pkg, const char* desc, const char state[6])
 {
 	size_t result = 3; // space and brackets.
 	if (flag) {
@@ -111,7 +111,7 @@ size_t addFlagDesc (sFlag* flag, const char* pkg, const char* desc, const char s
 		if (idx < flag->ndesc) {
 
 			// state is a byte mask. Check it first:
-			for (int i = 0; i < 5; ++i) {
+			for (int i = 0; i < 6; ++i) {
 				if (('+' != state[i]) && ('-' != state[i]) && (' ' != state[i]))
 					ERROR_EXIT(-1, "Illegal character '%c' in state string at position %d\n",
 						state[i], i)
@@ -125,6 +125,7 @@ size_t addFlagDesc (sFlag* flag, const char* pkg, const char* desc, const char s
 			flag->desc[idx].stateForced  = state[2];
 			flag->desc[idx].stateMasked  = state[3];
 			flag->desc[idx].statePackage = state[4];
+			flag->desc[idx].statePkgUse  = state[5];
 
 			// Set flag mask and force status if this is a global and masked/forced description
 			if (flag->desc[idx].isGlobal && ('+' == flag->desc[idx].stateMasked))

diff --git a/ufed-curses-types.h b/ufed-curses-types.h
index 4c55532..db61c3c 100644
--- a/ufed-curses-types.h
+++ b/ufed-curses-types.h
@@ -96,13 +96,14 @@ typedef enum eWin_ {
  *  @brief Describe one description line
 **/
 typedef struct sDesc_ {
-	char* desc;        //!< The description line
-	bool  isGlobal;    //!< true if this is the global description and setting
-	bool  isInstalled; //!< global: at least one pkg is installed, local: all in *pkg are installed.
-	char* pkg;         //!< affected packages
+	char* desc;         //!< The description line
+	bool  isGlobal;     //!< true if this is the global description and setting
+	bool  isInstalled;  //!< global: at least one pkg is installed, local: all in *pkg are installed.
+	char* pkg;          //!< affected packages
 	char  stateForced;  //!< unforced '-', forced '+' or not set ' ' by *use.force
 	char  stateMasked;  //!< unmasked '-', masked '+' or not sed ' ' by *use.mask
-	char  statePackage; //!< disabled '-', enabled '+' or not set ' ' by package.use
+	char  statePackage; //!< disabled '-', enabled '+' or not set ' ' by profiles package.use
+	char  statePkgUse;  //!< disabled '-', enabled '+' or not set ' ' by users package.use
 } sDesc;
 
 
@@ -163,7 +164,7 @@ typedef struct sWindow_ {
  * =======================================
  */
 sFlag* addFlag      (sFlag** root, const char* name, int line, int ndesc, const char state[2]);
-size_t addFlagDesc  (sFlag* flag, const char* pkg, const char* desc, const char state[5]);
+size_t addFlagDesc  (sFlag* flag, const char* pkg, const char* desc, const char state[6]);
 void   addLineStats (const sFlag* flag, sListStats* stats);
 void   destroyFlag  (sFlag** root, sFlag** flag);
 void   genFlagStats (sFlag* flag);


^ permalink raw reply related	[flat|nested] 238+ messages in thread
* [gentoo-commits] proj/ufed:master commit in: /
@ 2013-02-12  9:01 Sven Eden
  0 siblings, 0 replies; 238+ messages in thread
From: Sven Eden @ 2013-02-12  9:01 UTC (permalink / raw
  To: gentoo-commits

commit:     9f5ebb316d6b464cdc71060adc1ab53e678cfe46
Author:     Sven Eden <sven.eden <AT> gmx <DOT> de>
AuthorDate: Mon Feb 11 17:40:42 2013 +0000
Commit:     Sven Eden <sven.eden <AT> gmx <DOT> de>
CommitDate: Mon Feb 11 17:40:42 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/ufed.git;a=commit;h=9f5ebb31

Added local flags "default" setting from IUSE to . Changed the detection of "affected" packages to be more specific.

---
 Portage.pm |   19 ++++++++++++-------
 1 files changed, 12 insertions(+), 7 deletions(-)

diff --git a/Portage.pm b/Portage.pm
index 5416beb..1f3bb55 100644
--- a/Portage.pm
+++ b/Portage.pm
@@ -160,9 +160,9 @@ sub _add_flag
 		$data{installed} = $installed;
 		$data{masked}    = $masked;
 		$data{"package"} = $package;
+		$data{"default"} = $default;
 		if ("global" eq "$pkg") {
 			$data{conf}      = $conf;
-			$data{"default"} = $default;
 			%{$use_flags->{$flag}{global}} = %data;
 		} else {
 			$data{pkguse}    = $pkguse;
@@ -308,6 +308,7 @@ sub _gen_use_flags
 		my $pDesc    = "";
 		my $pKey     = "";
 		my $pRef     = undef;
+		my $pdLen     = 0;
 		
 		# Build the description consolidation hash
 		if ($lCount) {
@@ -318,18 +319,22 @@ sub _gen_use_flags
 		}
 		for my $pkg (sort keys %{$flagRef->{"local"}}) {
 			$pRef  = $flagRef->{"local"}{$pkg};
-			$pDesc = "$pRef->{descr}";
+			$pdLen = length($pRef->{descr});
+			$pDesc = $pdLen ? "$pRef->{descr}" : $gDesc;
 			
-			# If the flag has no local description, it is "affected"
-			length($pDesc) or $pDesc = $gDesc;
-
 			# Now the Key can be assembled...
 			$pKey  = sprintf("[%s]%d:%d:%d:%d:%d:%d:%d", $pDesc, $pRef->{conf}, $pRef->{"default"},
 							$pRef->{forced}, $pRef->{installed}, $pRef->{masked},
 							$pRef->{"package"}, $pRef->{pkguse});
 							
-			# ...and safed, unless it equals the global key
-			if ($pKey ne $gKey) {
+			# ...and safed, if it has an own description or differs in its settings from global
+			if ($pdLen || (0 == $lCount) ## has own description or no global description available
+				|| $pRef->{"default"}    ## explicitly set default from IUSE
+				|| $pRef->{forced}       ## explicitly (un)forced from package.use.force
+				|| $pRef->{masked}       ## explicitly (un)masked from package.use.mask
+				|| $pRef->{pkguse}       ## explicitly (un)set from users package.use
+			   ) {
+printf STDERR "Added $flag / $pkg local \"%s\" (lCount %d, pdLen %d)\n", $pKey, $lCount, $pdLen;
 				$descCons{$pKey}{$pkg} = 1;
 				++$lCount;
 			}


^ permalink raw reply related	[flat|nested] 238+ messages in thread
* [gentoo-commits] proj/ufed:master commit in: /
@ 2013-02-12  9:01 Sven Eden
  0 siblings, 0 replies; 238+ messages in thread
From: Sven Eden @ 2013-02-12  9:01 UTC (permalink / raw
  To: gentoo-commits

commit:     3f67b03eacb5405229655d2ff46b05a832cdeff3
Author:     Sven Eden <sven.eden <AT> gmx <DOT> de>
AuthorDate: Mon Feb 11 07:23:54 2013 +0000
Commit:     Sven Eden <sven.eden <AT> gmx <DOT> de>
CommitDate: Mon Feb 11 07:23:54 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/ufed.git;a=commit;h=3f67b03e

Removed "affected" list, it is not used, the problem is solved in a different way.

---
 Portage.pm |    2 --
 ufed.pl.in |    7 -------
 2 files changed, 0 insertions(+), 9 deletions(-)

diff --git a/Portage.pm b/Portage.pm
index a1e0f78..7e2fa65 100644
--- a/Portage.pm
+++ b/Portage.pm
@@ -24,7 +24,6 @@ BEGIN {
 # {count}  = number of different description lines
 #  Note: +1 for the list of affected packages, and +1 for each descriptionless package with settings differing from global.
 # {global} = hashref for the global paramters if the flag has a description in use.desc, otherwise undefined
-#   ->{affected}  = List of packages that are affected but have no own description
 #   ->{conf}      = The flag is disabled (-1), enabled (1) or not set (0) in make.conf
 #   ->{default}   = The flag is disabled (-1), enabled (1) or not set (0) by default
 #   ->{descr}     = Global description
@@ -162,7 +161,6 @@ sub _add_flag
 		$data{masked}    = $masked;
 		$data{"package"} = $package;
 		if ("global" eq "$pkg") {
-			$data{affected}  = [];
 			$data{conf}      = $conf;
 			$data{"default"} = $default;
 			%{$use_flags->{$flag}{global}} = %data;

diff --git a/ufed.pl.in b/ufed.pl.in
index 2c5b380..3574598 100644
--- a/ufed.pl.in
+++ b/ufed.pl.in
@@ -89,13 +89,6 @@ sub flags_dialog {
 						$conf->{global}{installed} ? '+' : ' ',
 						$conf->{global}{forced} ? '+' : ' ',
 						$conf->{global}{masked} ? '+' : ' ');
-
-			for my $afLst (@{$conf->{global}{affected}}) {
-				(defined($afLst) && length($afLst))
-					and $outTxt .= sprintf("\t%s\t (%s) [+    ]\n",
-									"Affected by global flag setting",
-									$afLst);
-			}
 		}
 
 		# Finally print the local description lines


^ permalink raw reply related	[flat|nested] 238+ messages in thread
* [gentoo-commits] proj/ufed:master commit in: /
@ 2013-02-12  9:01 Sven Eden
  0 siblings, 0 replies; 238+ messages in thread
From: Sven Eden @ 2013-02-12  9:01 UTC (permalink / raw
  To: gentoo-commits

commit:     0742c180bd08d25b31ca6d75c6e64fd473f53321
Author:     Sven Eden <sven.eden <AT> gmx <DOT> de>
AuthorDate: Mon Feb 11 08:16:41 2013 +0000
Commit:     Sven Eden <sven.eden <AT> gmx <DOT> de>
CommitDate: Mon Feb 11 08:16:41 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/ufed.git;a=commit;h=0742c180

It is no longer needed to have an existing {global} part for temp use flags.

---
 Portage.pm |    5 ++---
 1 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/Portage.pm b/Portage.pm
index c60b05a..5416beb 100644
--- a/Portage.pm
+++ b/Portage.pm
@@ -76,7 +76,7 @@ my $_use_template = {
 	installed => 0,
 	masked    => 0,
 	"package" => 0,
-	pkguse    => 0,
+	pkguse    => 0
 };
 
 # --- public methods ---
@@ -194,7 +194,6 @@ sub _add_temp
 		defined ($_use_temp->{$flag}{global})
 			or %{$_use_temp->{$flag}{global}} = %$_use_template;
 	} else {
-		_add_temp($flag, "global"); ## This must exist!
 		defined ($_use_temp->{$flag}{"local"}{$pkg})
 			or %{$_use_temp->{$flag}{"local"}{$pkg}} = %$_use_template;
 	}
@@ -311,7 +310,7 @@ sub _gen_use_flags
 		my $pRef     = undef;
 		
 		# Build the description consolidation hash
-		if ($hasGlobal) {
+		if ($lCount) {
 			$gDesc = $gRef->{descr};
 			$gKey  = sprintf("[%s]%d:%d:%d:%d:%d:%d:%d", $gDesc, $gRef->{conf}, $gRef->{"default"},
 							$gRef->{forced}, $gRef->{installed}, $gRef->{masked},


^ permalink raw reply related	[flat|nested] 238+ messages in thread
* [gentoo-commits] proj/ufed:master commit in: /
@ 2013-02-12  9:01 Sven Eden
  0 siblings, 0 replies; 238+ messages in thread
From: Sven Eden @ 2013-02-12  9:01 UTC (permalink / raw
  To: gentoo-commits

commit:     e4c3b690bd7e9a4b28fb59da05e54c8c75961664
Author:     Sven Eden <sven.eden <AT> gmx <DOT> de>
AuthorDate: Mon Feb 11 09:17:08 2013 +0000
Commit:     Sven Eden <sven.eden <AT> gmx <DOT> de>
CommitDate: Mon Feb 11 09:17:13 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/ufed.git;a=commit;h=e4c3b690

Removed [M]asked column and updated display to the new column scheme.

---
 ufed-curses-checklist.c |   56 +++++++++++++++++++++++++++++++----------------
 ufed-curses.c           |   25 ++++++++++-----------
 2 files changed, 49 insertions(+), 32 deletions(-)

diff --git a/ufed-curses-checklist.c b/ufed-curses-checklist.c
index a5baf44..934b92d 100644
--- a/ufed-curses-checklist.c
+++ b/ufed-curses-checklist.c
@@ -230,7 +230,7 @@ static int drawflag(sFlag* flag, bool highlight)
 	if(idx < flag->ndesc) {
 		WINDOW* wLst = win(List);
 		int  lHeight = wHeight(List);
-		int  descLen = wWidth(List) - (minwidth + 9);
+		int  descLen = wWidth(List) - (minwidth + 8);
 		bool hasHead = false;
 		char *p, special;
 
@@ -241,9 +241,9 @@ static int drawflag(sFlag* flag, bool highlight)
 
 			// Set special character if needed:
 			if (isDescForced(flag, idx))
-				special = 'F';
+				special = 'f';
 			else if (isDescMasked(flag, idx))
-				special = 'M';
+				special = 'm';
 			else
 				special = ' ';
 
@@ -271,18 +271,17 @@ static int drawflag(sFlag* flag, bool highlight)
 
 			/* Display flag state
 			 * The order in which the states are to be displayed is:
-			 * 1. Masked/Forced special hint
-			 * 2. make.defaults
-			 * 3. package.use
-			 * 4. make.conf
-			 * 5. global/local
-			 * 6. installed/not installed
+			 * 1. [D]efaults (make.defaults, IUSE, package.mask, package.force)
+			 *    Note: Filled in later
+			 * 2. [P]rofile package.use files
+			 * 3. [C]onfiguration (make.conf, users package.use)
+			 * 4. global/local
+			 * 5. installed/not installed
 			 */
-			sprintf(buf + minwidth, "%c %c%c%c %c%c ",
-				special,
-				flag->stateDefault,
+			sprintf(buf + minwidth, "  %c%c %c%c ",
 				flag->desc[idx].statePackage,
-				flag->stateConf,
+				' ' == flag->desc[idx].statePkgUse ?
+					flag->stateConf : flag->desc[idx].statePkgUse,
 				flag->desc[idx].isGlobal ? ' ' : 'L',
 				flag->desc[idx].isInstalled ? 'i' : ' ');
 
@@ -298,7 +297,7 @@ static int drawflag(sFlag* flag, bool highlight)
 				sprintf(desc, "%s", flag->desc[idx].desc);
 
 			// Now display the description line according to its horizontal position
-			sprintf(buf + minwidth + 9, "%-*.*s", descLen, descLen,
+			sprintf(buf + minwidth + 8, "%-*.*s", descLen, descLen,
 				strlen(desc) > (size_t)descriptionleft
 					? &desc[descriptionleft]
 					: "");
@@ -309,21 +308,40 @@ static int drawflag(sFlag* flag, bool highlight)
 			else
 				wattrset(wLst, COLOR_PAIR(3));
 
-			// Finally put the line on the screen
+			// Put the line on the screen
 			mvwaddstr(wLst, line, 0, buf);
-			mvwaddch(wLst, line, minwidth + 1, ACS_VLINE); // Before state
-			mvwaddch(wLst, line, minwidth + 5, ACS_VLINE); // Between state and scope
-			mvwaddch(wLst, line, minwidth + 8, ACS_VLINE); // After scope
+			mvwaddch(wLst, line, minwidth,     ACS_VLINE); // Before state
+			mvwaddch(wLst, line, minwidth + 4, ACS_VLINE); // Between state and scope
+			mvwaddch(wLst, line, minwidth + 7, ACS_VLINE); // After scope
 
+			// Add (default) selection if this is the header line
 			if (!hasHead) {
 				hasHead = true;
-				if (' ' == flag->stateConf) {
+				if (flag->globalForced) {
+					wattrset(wLst, COLOR_PAIR(5) | A_BOLD);
+					mvwaddch(wLst, line, 2, '+');
+				} else if (flag->globalMasked) {
+					wattrset(wLst, COLOR_PAIR(4) | A_BOLD);
+					mvwaddch(wLst, line, 2, '-');
+				} else if (' ' == flag->stateConf) {
 					wattrset(wLst, COLOR_PAIR(3) | A_BOLD);
 					mvwaddch(wLst, line, 2, flag->stateDefault);
 				} else
 					mvwaddch(wLst, line, 2, flag->stateConf);
 			}
 
+			// Add [D]efault column content
+			if ('f' == special) {
+				wattrset(wLst, COLOR_PAIR(5) | A_BOLD);
+				mvwaddch(wLst, line, minwidth + 1, special);
+			} else if ('m' == special) {
+				wattrset(wLst, COLOR_PAIR(4) | A_BOLD);
+				mvwaddch(wLst, line, minwidth + 1, special);
+			} else {
+				wattrset(wLst, COLOR_PAIR(3));
+				mvwaddch(wLst, line, minwidth + 1, flag->stateDefault);
+			}
+
 			++line;
 			++usedY;
 		}

diff --git a/ufed-curses.c b/ufed-curses.c
index da47b66..e0eadfd 100644
--- a/ufed-curses.c
+++ b/ufed-curses.c
@@ -120,9 +120,9 @@ void drawBottom(bool withSep)
 	waddch(w, ACS_LLCORNER);
 	whline(w, ACS_HLINE, wWidth(Bottom)-6);
 	if (withSep) {
-		mvwaddch(w, 0, minwidth + 4, ACS_BTEE); // Before state
-		mvwaddch(w, 0, minwidth + 8, ACS_BTEE); // Between state and scope
-		mvwaddch(w, 0, minwidth + 11, ACS_BTEE); // After scope
+		mvwaddch(w, 0, minwidth + 3, ACS_BTEE); // Before state
+		mvwaddch(w, 0, minwidth + 7, ACS_BTEE); // Between state and scope
+		mvwaddch(w, 0, minwidth + 10, ACS_BTEE); // After scope
 	}
 	mvwaddch(w, 0, wWidth(Bottom)-3, ACS_LRCORNER);
 	waddch(w, ' ');
@@ -283,15 +283,14 @@ void drawStatus(bool withSep)
 		char buf[COLS+1];
 
 		// Add Status separators and explenation characters
-		mvwaddch (w, 0, minwidth,     'M');       // Masked / Forced
-		mvwaddch (w, 0, minwidth + 1, ACS_VLINE); // Before state
-		mvwaddstr(w, 0, minwidth + 2, "DPC");     // Default, Package, Config
-		mvwaddch (w, 0, minwidth + 5, ACS_VLINE); // Between state and scope
-		mvwaddstr(w, 0, minwidth + 6, "Si");      // Scope, installed
-		mvwaddch (w, 0, minwidth + 8, ACS_VLINE); // After scope
+		mvwaddch (w, 0, minwidth    , ACS_VLINE); // Before state
+		mvwaddstr(w, 0, minwidth + 1, "DPC");     // Default, Profile, Config
+		mvwaddch (w, 0, minwidth + 4, ACS_VLINE); // Between state and scope
+		mvwaddstr(w, 0, minwidth + 5, "Si");      // Scope, installed
+		mvwaddch (w, 0, minwidth + 7, ACS_VLINE); // After scope
 
 		// Use the unused right side to show the filter status
-		sprintf(buf, "%-*s%-6s / %-6s / %-12s] ",
+		sprintf(buf, "%*s%-6s / %-6s / %-13s] ",
 			max(2, iWidth - 40 - minwidth), " [",
 			eMask_masked        == e_mask ? "masked" :
 			eMask_unmasked      == e_mask ? "normal" : "all",
@@ -345,9 +344,9 @@ void drawTop(bool withSep)
 	waddch(w, ACS_ULCORNER);
 	whline(w, ACS_HLINE, wWidth(Top)-6);
 	if (withSep) {
-		mvwaddch(w, 4, minwidth + 4, ACS_TTEE); // Before state
-		mvwaddch(w, 4, minwidth + 8, ACS_TTEE); // Between state and scope
-		mvwaddch(w, 4, minwidth + 11, ACS_TTEE); // After scope
+		mvwaddch(w, 4, minwidth + 3, ACS_TTEE); // Before state
+		mvwaddch(w, 4, minwidth + 7, ACS_TTEE); // Between state and scope
+		mvwaddch(w, 4, minwidth + 10, ACS_TTEE); // After scope
 	}
 	mvwaddch(w, 4, wWidth(Top)-3, ACS_URCORNER);
 	waddch(w, ' ');


^ permalink raw reply related	[flat|nested] 238+ messages in thread
* [gentoo-commits] proj/ufed:master commit in: /
@ 2013-02-12  9:01 Sven Eden
  0 siblings, 0 replies; 238+ messages in thread
From: Sven Eden @ 2013-02-12  9:01 UTC (permalink / raw
  To: gentoo-commits

commit:     ac8391b39dc4e606821167086c2917a2a9d76742
Author:     Sven Eden <sven.eden <AT> gmx <DOT> de>
AuthorDate: Mon Feb 11 07:33:34 2013 +0000
Commit:     Sven Eden <sven.eden <AT> gmx <DOT> de>
CommitDate: Mon Feb 11 07:33:34 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/ufed.git;a=commit;h=ac8391b3

Added new pkguse field to  generation and removed obsolete and superfluous addition of the global key to the consolitation hash.

---
 Portage.pm |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/Portage.pm b/Portage.pm
index 7e2fa65..c60b05a 100644
--- a/Portage.pm
+++ b/Portage.pm
@@ -152,7 +152,7 @@ sub _add_flag
 	
 	if ($descKey =~ /^\[(.*)\](-?\d+):(-?\d+):(-?\d+):(-?\d+):(-?\d+):(-?\d+):(-?\d+)$/ ) {
 		my ($descr, $conf, $default, $forced, $installed, $masked, $package, $pkguse)
-			= ($1, $2, $3, $4, $5, $6, $7);
+			= ($1, $2, $3, $4, $5, $6, $7, $8);
 		my %data = ();
 
 		$data{descr}     = $descr;
@@ -316,7 +316,6 @@ sub _gen_use_flags
 			$gKey  = sprintf("[%s]%d:%d:%d:%d:%d:%d:%d", $gDesc, $gRef->{conf}, $gRef->{"default"},
 							$gRef->{forced}, $gRef->{installed}, $gRef->{masked},
 							$gRef->{"package"}, $gRef->{pkguse});
-			$descCons{$gKey}{global} = 1;
 		}
 		for my $pkg (sort keys %{$flagRef->{"local"}}) {
 			$pRef  = $flagRef->{"local"}{$pkg};


^ permalink raw reply related	[flat|nested] 238+ messages in thread
* [gentoo-commits] proj/ufed:master commit in: /
@ 2013-02-12  9:01 Sven Eden
  0 siblings, 0 replies; 238+ messages in thread
From: Sven Eden @ 2013-02-12  9:01 UTC (permalink / raw
  To: gentoo-commits

commit:     e74545958730cd682cc5623e8825407db2119a3b
Author:     Sven Eden <sven.eden <AT> gmx <DOT> de>
AuthorDate: Mon Feb 11 08:17:57 2013 +0000
Commit:     Sven Eden <sven.eden <AT> gmx <DOT> de>
CommitDate: Mon Feb 11 08:17:57 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/ufed.git;a=commit;h=e7454595

Updated state chars input to await six characters instead of five.

---
 ufed-curses-checklist.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/ufed-curses-checklist.c b/ufed-curses-checklist.c
index 0f60845..a5baf44 100644
--- a/ufed-curses-checklist.c
+++ b/ufed-curses-checklist.c
@@ -141,7 +141,7 @@ static void read_flags(void)
 				ERROR_EXIT(-1, "Description read failed on line %d\n\"%s\"\n", lineNum + 1, line);
 
 			// Check stats
-			if ((state.end - state.start) != 5)
+			if ((state.end - state.start) != 6)
 				ERROR_EXIT(-1, "Illegal description stats on line %d:\n\"%s\"\n", lineNum + 1, line);
 
 			// Add description line to flag:


^ permalink raw reply related	[flat|nested] 238+ messages in thread
* [gentoo-commits] proj/ufed:master commit in: /
@ 2013-02-12  9:01 Sven Eden
  0 siblings, 0 replies; 238+ messages in thread
From: Sven Eden @ 2013-02-12  9:01 UTC (permalink / raw
  To: gentoo-commits

commit:     dc5900d7244503fc66bf8049a0a92b284232fcdb
Author:     Sven Eden <sven.eden <AT> gmx <DOT> de>
AuthorDate: Mon Feb 11 08:17:17 2013 +0000
Commit:     Sven Eden <sven.eden <AT> gmx <DOT> de>
CommitDate: Mon Feb 11 08:17:17 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/ufed.git;a=commit;h=dc5900d7

Fixed output string for global descriptions, the sixth state char was missing.

---
 ufed.pl.in |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/ufed.pl.in b/ufed.pl.in
index 3574598..9613174 100644
--- a/ufed.pl.in
+++ b/ufed.pl.in
@@ -84,7 +84,7 @@ sub flags_dialog {
 
 		# Print global description first (if available)
 		if (defined($conf->{global}) && length($conf->{global}{descr})) {
-			$outTxt .= sprintf("\t%s\t ( ) [+%s%s%s ]\n",
+			$outTxt .= sprintf("\t%s\t ( ) [+%s%s%s  ]\n",
 						$conf->{global}{descr},
 						$conf->{global}{installed} ? '+' : ' ',
 						$conf->{global}{forced} ? '+' : ' ',


^ permalink raw reply related	[flat|nested] 238+ messages in thread
* [gentoo-commits] proj/ufed:master commit in: /
@ 2013-02-12  9:01 Sven Eden
  0 siblings, 0 replies; 238+ messages in thread
From: Sven Eden @ 2013-02-12  9:01 UTC (permalink / raw
  To: gentoo-commits

commit:     4feb4630700694d561b15a30f7baf16cb786898e
Author:     Sven Eden <sven.eden <AT> gmx <DOT> de>
AuthorDate: Sat Feb  9 20:57:35 2013 +0000
Commit:     Sven Eden <sven.eden <AT> gmx <DOT> de>
CommitDate: Sat Feb  9 20:57:35 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/ufed.git;a=commit;h=4feb4630

Add "affected" packages (local flags without own descriptions but different settings than the global flag) to central use flag hash.

---
 Portage.pm |   37 +++++++++++++++++--------------------
 1 files changed, 17 insertions(+), 20 deletions(-)

diff --git a/Portage.pm b/Portage.pm
index 7ebcbdb..a49a5f2 100644
--- a/Portage.pm
+++ b/Portage.pm
@@ -304,7 +304,7 @@ sub _gen_use_flags
 		my $flagRef  = $_use_temp->{$flag}; ## Shortcut
 		my $hasGlobal= defined($flagRef->{global}) ? 1 : 0;
 		my $lCount   = ($hasGlobal && length($flagRef->{global}{descr})) ? 1 : 0;
-		my $gDesc    = "";
+		my $gDesc    = "(Unknown)";
 		my $gKey     = "";
 		my $gRef     = $flagRef->{global};
 		my $pDesc    = "";
@@ -314,25 +314,28 @@ sub _gen_use_flags
 		# Build the description consolidation hash
 		if ($hasGlobal) {
 			$gDesc = $gRef->{descr};
-			$gKey  = sprintf("[%s]%d:%d:%d:%d:%d:%d", $gDesc, $gRef->{conf}, $gRef->{"default"},
-							$gRef->{forced}, $gRef->{installed}, $gRef->{masked}, $gRef->{"package"});
+			$gKey  = sprintf("[%s]%d:%d:%d:%d:%d:%d:%d", $gDesc, $gRef->{conf}, $gRef->{"default"},
+							$gRef->{forced}, $gRef->{installed}, $gRef->{masked},
+							$gRef->{"package"}, $gRef->{pkguse});
 			$descCons{$gKey}{global} = 1;
 		}
 		for my $pkg (sort keys %{$flagRef->{"local"}}) {
 			$pRef  = $flagRef->{"local"}{$pkg};
-
-			if (length($pRef->{descr})) {
-				## This package has an individual description:
-				$pDesc = "$pRef->{descr}";
-				$pKey  = sprintf("[%s]%d:%d:%d:%d:%d:%d", $pDesc, $pRef->{conf}, $pRef->{"default"},
-								$pRef->{forced}, $pRef->{installed}, $pRef->{masked}, $pRef->{"package"});
+			$pDesc = "$pRef->{descr}";
+			
+			# If the flag has no local description, it is "affected"
+			length($pDesc) or $pDesc = $gDesc;
+
+			# Now the Key can be assembled...
+			$pKey  = sprintf("[%s]%d:%d:%d:%d:%d:%d:%d", $pDesc, $pRef->{conf}, $pRef->{"default"},
+							$pRef->{forced}, $pRef->{installed}, $pRef->{masked},
+							$pRef->{"package"}, $pRef->{pkguse});
+							
+			# ...and safed, unless it equals the global key
+			if ($pKey ne $gKey) {
 				$descCons{$pKey}{$pkg} = 1;
 				++$lCount;
 			}
-
-			## TODO : Add affected packages that have no own description
-			# once the interface can handle them. These can be used for
-			# the package filtering per command line arguments later.
 		} ## End of walking through a flags package list
 		
 		# Skip if there was nothing consolidated
@@ -342,16 +345,10 @@ sub _gen_use_flags
 		$use_flags->{$flag}{count} = 0;
 		
 		# The global data has to be added first:
-		if (length($gKey)) {
-			_add_flag($flag, "global", $gKey);
-			
-			# TODO : Add affected packages once they can be hanlded. See above TODO.
-		}
+		length($gKey) and _add_flag($flag, "global", $gKey);
 		
 		# Then the "local" flag descriptions
-		# TODO : Add affected packages that have diffeent settings once they can be handled.
 		for my $key (sort keys %descCons) {
-			next if ($key eq $gKey);
 
 			# Generate the package list with same description and flags,
 			# but not for more than 5 packages


^ permalink raw reply related	[flat|nested] 238+ messages in thread
* [gentoo-commits] proj/ufed:master commit in: /
@ 2013-02-12  9:01 Sven Eden
  0 siblings, 0 replies; 238+ messages in thread
From: Sven Eden @ 2013-02-12  9:01 UTC (permalink / raw
  To: gentoo-commits

commit:     42d1d806290ca8e0adc6fd9f3111c0dd11c24b1c
Author:     Sven Eden <sven.eden <AT> gmx <DOT> de>
AuthorDate: Sat Feb  9 19:53:42 2013 +0000
Commit:     Sven Eden <sven.eden <AT> gmx <DOT> de>
CommitDate: Sat Feb  9 19:53:42 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/ufed.git;a=commit;h=42d1d806

Updated some information and changed IUSE usage to manipulate "default" values for packages instead of "package".

---
 Portage.pm |   35 ++++++++++-------------------------
 1 files changed, 10 insertions(+), 25 deletions(-)

diff --git a/Portage.pm b/Portage.pm
index b647e7a..35c3d2d 100644
--- a/Portage.pm
+++ b/Portage.pm
@@ -37,8 +37,9 @@ BEGIN {
 #     Note: Packages without description are only listed here if their settings differ from the global
 #   ->{forced}    = The flag is explicitly unforced (-1), default (0) or explicitly force enabled (1) for this package
 #   ->{installed} = This package is installed
-#   ->{masked}    = The flag is explicitly unmasked (-1), default (0) or explicitly masked (1) for this package
-#   ->{package}   = The flag is explicitly disabled (-1), default (0) or explicitly enabled (1) for this package.
+#   ->{masked}    = The flag is explicitly unmasked (-1), default (0) or masked (1) for this package
+#   ->{package}   = The flag is explicitly disabled (-1), default (0) or enabled (1) for this package by (profiles)/package.use
+#   ->{pkguse}    = The flag is explicitly disabled (-1), default (0) or enabled(1) for this package by /etc/portage/package.use
 #     Note: This is a combination of the ebuilds IUSE and the installation PKGUSE and only set for installed packages.
 our $use_flags;
 
@@ -57,14 +58,15 @@ my @_profiles     = ();
 # {"local"}-> {package} = conf hash for per package settings
 # global and per package settings:
 # ->{conf}      Is either disabled, left alone or enabled by make.conf (-1, 0, 1)
-# ->{default}   Is either disabled, left alone or enabled by make.defaults (-1, 0, 1)
+# ->{default}   Is either disabled, left alone or enabled by make.defaults (-1, 0, 1) (global) or installed packages IUSE (local)
 # ->{descr}     Description from use.desc ({global}) or use.local.desc {cat/pkg} (string)
 # ->{forced}    Is force enabled (implies {masked}=1) in any *use.force
 #               For packages this is only set to -1 (explicitly unforced) or +1 (explicitly forced). 0 means "left alone".
 # ->{installed} Has one installed package ({global}) or is installed {cat/pkg} (0,1)
 # ->{masked}    Is masked by any *use.mask (0,1)
 #               For packages this is only set to -1 (explicitly unmasked) or +1 (explicitly masked). 0 means "left alone".
-# ->{package}   Is either disabled, left alone or enabled by its ebuild (IUSE) or by user package.use (PKGUSE) (-1, 0, 1)
+# ->{package}   Is either disabled, left alone or enabled by the profiles package.use files
+# ->{pkguse}    Is either disabled, left alone or enabled by the users package.use file
 
 my $_use_temp = undef;
 my $_use_template = {
@@ -609,9 +611,9 @@ sub _read_make_globals {
 
 
 # Analyze EPREFIX/var/db/pkg and analyze all installed
-# packages. We need to know what they use (IUSE) and what
-# has been set when they where emerged (PKGUSE).
-# No parameters accepted.
+# packages. The contents of the file IUSE are used to
+# enrich the information of the {default} part and to
+# determine which packages are installed.
 sub _read_packages {
 	my $pkgdir = undef;
 	opendir($pkgdir, "${_EPREFIX}/var/db/pkg")
@@ -627,7 +629,6 @@ sub _read_packages {
 		# loop through all openable directories in cat
 		while(my $pkg = readdir $catdir) {
 			next if $pkg eq '.' or $pkg eq '..';
-#			my @puse = ();
 			my @iuse = ();
 			
 			# Load IUSE to learn which use flags the package in this version knows
@@ -638,14 +639,6 @@ sub _read_packages {
 				close $use;
 			}
 
-			# Load PKGUSE to learn which use flags have been set when this package was emerged
-#			my $fpuse = "${_EPREFIX}/var/db/pkg/$cat/$pkg/PKGUSE";
-#			if(open my $use, '<', $fpuse) {
-#				local $/;
-#				@puse = split ' ', <$use>;
-#				close $use;
-#			}
-
 			# could be shortened, but make sure not to strip off part of the name
 			$pkg =~ s/-\d+(?:\.\d+)*\w?(?:_(?:alpha|beta|pre|rc|p)\d*)?(?:-r\d+)?$//;
 			$pkg = $cat . "/" . $pkg;
@@ -658,18 +651,10 @@ sub _read_packages {
 				_add_temp($flag, "global");
 				_add_temp($flag, $pkg);
 
-				$_use_temp->{$flag}{"local"}{$pkg}{"package"}   = $eState ? 1 : $dState ? -1 : 0;
+				$_use_temp->{$flag}{"local"}{$pkg}{"default"}   = $eState ? 1 : $dState ? -1 : 0;
 				$_use_temp->{$flag}{"local"}{$pkg}{installed}   = 1;
 				$_use_temp->{$flag}{global}{installed} = 1;
 			} ## End of looping IUSE
-#			for my $flag (@puse) {
-#				my $state = $flag =~ s/^-// || 0; 
-#
-#				if ( defined($_use_temp->{$flag}{global})
-#				  && defined($_use_temp->{$flag}{"local"}{$pkg})) {
-#				  	$_use_temp->{$flag}{"local"}{$pkg}{"package"} = $state ? -1 : 0;
-#				}
-#			} ## End of looping PKGUSE
 			
 		}
 		closedir $catdir;


^ permalink raw reply related	[flat|nested] 238+ messages in thread
* [gentoo-commits] proj/ufed:master commit in: /
@ 2013-02-12  9:01 Sven Eden
  0 siblings, 0 replies; 238+ messages in thread
From: Sven Eden @ 2013-02-12  9:01 UTC (permalink / raw
  To: gentoo-commits

commit:     84b83ba17b227b6cba56d5c64ecf8252e0050b65
Author:     Sven Eden <sven.eden <AT> gmx <DOT> de>
AuthorDate: Mon Feb 11 07:22:55 2013 +0000
Commit:     Sven Eden <sven.eden <AT> gmx <DOT> de>
CommitDate: Mon Feb 11 07:22:55 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/ufed.git;a=commit;h=84b83ba1

Added new pkguse field to global  hash and to output string.

---
 Portage.pm |    5 +++--
 ufed.pl.in |    6 ++++--
 2 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/Portage.pm b/Portage.pm
index fed45d9..a1e0f78 100644
--- a/Portage.pm
+++ b/Portage.pm
@@ -151,8 +151,8 @@ sub _add_flag
 {
 	my ($flag, $pkg, $descKey) = @_;
 	
-	if ($descKey =~ /^\[(.*)\](-?\d+):(-?\d+):(-?\d+):(-?\d+):(-?\d+):(-?\d+)$/ ) {
-		my ($descr, $conf, $default, $forced, $installed, $masked, $package)
+	if ($descKey =~ /^\[(.*)\](-?\d+):(-?\d+):(-?\d+):(-?\d+):(-?\d+):(-?\d+):(-?\d+)$/ ) {
+		my ($descr, $conf, $default, $forced, $installed, $masked, $package, $pkguse)
 			= ($1, $2, $3, $4, $5, $6, $7);
 		my %data = ();
 
@@ -167,6 +167,7 @@ sub _add_flag
 			$data{"default"} = $default;
 			%{$use_flags->{$flag}{global}} = %data;
 		} else {
+			$data{pkguse}    = $pkguse;
 			%{$use_flags->{$flag}{"local"}{$pkg}} = %data;
 		}
 		++$use_flags->{$flag}{count} if (length($descr));

diff --git a/ufed.pl.in b/ufed.pl.in
index 76483e9..2c5b380 100644
--- a/ufed.pl.in
+++ b/ufed.pl.in
@@ -100,7 +100,7 @@ sub flags_dialog {
 
 		# Finally print the local description lines
 		for my $pkg (sort keys %{$conf->{"local"}}) {
-			$outTxt .= sprintf("\t%s\t (%s) [ %s%s%s%s]\n",
+			$outTxt .= sprintf("\t%s\t (%s) [ %s%s%s%s%s]\n",
 						$conf->{"local"}{$pkg}{descr},
 						$pkg,
 						$conf->{"local"}{$pkg}{installed} > 0 ? '+' :
@@ -110,7 +110,9 @@ sub flags_dialog {
 						$conf->{"local"}{$pkg}{masked}    > 0 ? '+' :
 						$conf->{"local"}{$pkg}{masked}    < 0 ? '-' : ' ',
 						$conf->{"local"}{$pkg}{"package"} > 0 ? '+' :
-						$conf->{"local"}{$pkg}{"package"} < 0 ? '-' : ' ');
+						$conf->{"local"}{$pkg}{"package"} < 0 ? '-' : ' ',
+						$conf->{"local"}{$pkg}{pkguse}    > 0 ? '+' :
+						$conf->{"local"}{$pkg}{pkguse}    < 0 ? '-' : ' ');
 		}
 	}
 


^ permalink raw reply related	[flat|nested] 238+ messages in thread
* [gentoo-commits] proj/ufed:master commit in: /
@ 2013-02-12  9:01 Sven Eden
  0 siblings, 0 replies; 238+ messages in thread
From: Sven Eden @ 2013-02-12  9:01 UTC (permalink / raw
  To: gentoo-commits

commit:     ea1fee406abce71515ebacfbeac8e16b417d89ce
Author:     Sven Eden <sven.eden <AT> gmx <DOT> de>
AuthorDate: Sat Feb  9 20:08:38 2013 +0000
Commit:     Sven Eden <sven.eden <AT> gmx <DOT> de>
CommitDate: Sat Feb  9 20:08:38 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/ufed.git;a=commit;h=ea1fee40

Save information of /etc/portage/package.use in a new hash area "pkguse". It will later complete the 'C' column instead of 'P', which is reserved for profile settings now.

---
 Portage.pm |   14 ++++++++------
 1 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/Portage.pm b/Portage.pm
index 35c3d2d..7ebcbdb 100644
--- a/Portage.pm
+++ b/Portage.pm
@@ -76,7 +76,8 @@ my $_use_template = {
 	forced    => 0,
 	installed => 0,
 	masked    => 0,
-	"package" => 0
+	"package" => 0,
+	pkguse    => 0,
 };
 
 # --- public methods ---
@@ -126,8 +127,8 @@ INIT {
 		or die("Sorry, USE_ORDER without make.conf overriding global"
 			. " USE flags are not currently supported by ufed.\n");
 
-	_read_packages;
 	_read_make_defaults;
+	_read_packages;
 	_read_use_force; ## Must be before _read_use_mask to not
 	_read_use_mask;  ## unintentionally unmask explicitly masked flags.
 	_read_archs;
@@ -568,6 +569,7 @@ sub _read_make_defaults {
 
 	# package.use files are parsed next, finished by /etc/portage/package.use
 	for my $dir(@_profiles, "${_EPREFIX}/etc/portage") {
+		my $tgt = $dir eq "${_EPREFIX}/etc/portage" ? "pkguse" : "package";
 		for(_noncomments("$dir/package.use") ) {
 			my($pkg, @flags) = split;
 			
@@ -586,9 +588,9 @@ sub _read_make_defaults {
 				_add_temp($flag, $pkg);
 
 				if ($state) {
-					$_use_temp->{$flag}{"local"}{$pkg}{"package"} = -1; ## explicitly disabled
+					$_use_temp->{$flag}{"local"}{$pkg}{$tgt} = -1; ## explicitly disabled
 				} else {
-					$_use_temp->{$flag}{"local"}{$pkg}{"package"} =  1; ## explicitly enabled
+					$_use_temp->{$flag}{"local"}{$pkg}{$tgt} =  1; ## explicitly enabled
 				}
 			}
 		}
@@ -651,8 +653,8 @@ sub _read_packages {
 				_add_temp($flag, "global");
 				_add_temp($flag, $pkg);
 
-				$_use_temp->{$flag}{"local"}{$pkg}{"default"}   = $eState ? 1 : $dState ? -1 : 0;
-				$_use_temp->{$flag}{"local"}{$pkg}{installed}   = 1;
+				$_use_temp->{$flag}{"local"}{$pkg}{"default"} = $eState ? 1 : $dState ? -1 : 0;
+				$_use_temp->{$flag}{"local"}{$pkg}{installed} = 1;
 				$_use_temp->{$flag}{global}{installed} = 1;
 			} ## End of looping IUSE
 			


^ permalink raw reply related	[flat|nested] 238+ messages in thread
* [gentoo-commits] proj/ufed:master commit in: /
@ 2013-02-12  9:01 Sven Eden
  0 siblings, 0 replies; 238+ messages in thread
From: Sven Eden @ 2013-02-12  9:01 UTC (permalink / raw
  To: gentoo-commits

commit:     c3d179de06dc705c19644b46bc7171d4cacf16bb
Author:     Sven Eden <sven.eden <AT> gmx <DOT> de>
AuthorDate: Mon Feb 11 07:15:34 2013 +0000
Commit:     Sven Eden <sven.eden <AT> gmx <DOT> de>
CommitDate: Mon Feb 11 07:15:34 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/ufed.git;a=commit;h=c3d179de

Added ~ to package.use filter.

---
 Portage.pm |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/Portage.pm b/Portage.pm
index a49a5f2..fed45d9 100644
--- a/Portage.pm
+++ b/Portage.pm
@@ -576,7 +576,7 @@ sub _read_make_defaults {
 			# acceptable way determine which versions are relevant,
 			# we have to *skip* all settings that have specific version
 			# and/or slot information limiting their scope.
-			$pkg =~ /^[<>=]/ and next;
+			$pkg =~ /^[<>=~]/ and next;
 			
 			for my $flag (@flags) {
 				my $state = $flag =~ s/^-// || 0;


^ permalink raw reply related	[flat|nested] 238+ messages in thread
* [gentoo-commits] proj/ufed:master commit in: /
@ 2013-02-06  9:09 Sven Eden
  0 siblings, 0 replies; 238+ messages in thread
From: Sven Eden @ 2013-02-06  9:09 UTC (permalink / raw
  To: gentoo-commits

commit:     21b5b97ff2605459439fe017641b7d7e9e622db1
Author:     Sven Eden <sven.eden <AT> gmx <DOT> de>
AuthorDate: Wed Feb  6 09:10:26 2013 +0000
Commit:     Sven Eden <sven.eden <AT> gmx <DOT> de>
CommitDate: Wed Feb  6 09:10:26 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/ufed.git;a=commit;h=21b5b97f

If a flag is not set in make.conf, its default settings are now displayed in the round selection settings.

---
 ufed-curses-checklist.c |   26 ++++++++++++++++++--------
 1 files changed, 18 insertions(+), 8 deletions(-)

diff --git a/ufed-curses-checklist.c b/ufed-curses-checklist.c
index a58d60c..0f60845 100644
--- a/ufed-curses-checklist.c
+++ b/ufed-curses-checklist.c
@@ -228,6 +228,7 @@ static int drawflag(sFlag* flag, bool highlight)
 
 	// print descriptions according to filters
 	if(idx < flag->ndesc) {
+		WINDOW* wLst = win(List);
 		int  lHeight = wHeight(List);
 		int  descLen = wWidth(List) - (minwidth + 9);
 		bool hasHead = false;
@@ -255,7 +256,7 @@ static int drawflag(sFlag* flag, bool highlight)
 				sprintf(buf, " %c%c%c %s%s%s%-*s ",
 					/* State of selection */
 					flag->stateConf == ' ' ? '(' : '[',
-					flag->stateConf,
+					' ', // Filled in later
 					flag->stateConf == ' ' ? ')' : ']',
 					/* name */
 					flag->globalForced ? "(+" : flag->globalMasked ? "(" : "",
@@ -266,7 +267,6 @@ static int drawflag(sFlag* flag, bool highlight)
 						- (flag->globalForced ? 2 : flag->globalMasked ? 3 : 5)
 						- strlen(flag->name)), " ");
 					// At this point buf is filled up to minwidth
-				hasHead = true;
 			} // End of generating left side mask display
 
 			/* Display flag state
@@ -305,15 +305,25 @@ static int drawflag(sFlag* flag, bool highlight)
 
 			/* Set correct color set according to highlighting and status*/
 			if(highlight)
-				wattrset(win(List), COLOR_PAIR(3) | A_BOLD | A_REVERSE);
+				wattrset(wLst, COLOR_PAIR(3) | A_BOLD | A_REVERSE);
 			else
-				wattrset(win(List), COLOR_PAIR(3));
+				wattrset(wLst, COLOR_PAIR(3));
 
 			// Finally put the line on the screen
-			mvwaddstr(win(List), line, 0, buf);
-			mvwaddch(win(List), line, minwidth + 1, ACS_VLINE); // Before state
-			mvwaddch(win(List), line, minwidth + 5, ACS_VLINE); // Between state and scope
-			mvwaddch(win(List), line, minwidth + 8, ACS_VLINE); // After scope
+			mvwaddstr(wLst, line, 0, buf);
+			mvwaddch(wLst, line, minwidth + 1, ACS_VLINE); // Before state
+			mvwaddch(wLst, line, minwidth + 5, ACS_VLINE); // Between state and scope
+			mvwaddch(wLst, line, minwidth + 8, ACS_VLINE); // After scope
+
+			if (!hasHead) {
+				hasHead = true;
+				if (' ' == flag->stateConf) {
+					wattrset(wLst, COLOR_PAIR(3) | A_BOLD);
+					mvwaddch(wLst, line, 2, flag->stateDefault);
+				} else
+					mvwaddch(wLst, line, 2, flag->stateConf);
+			}
+
 			++line;
 			++usedY;
 		}


^ permalink raw reply related	[flat|nested] 238+ messages in thread
* [gentoo-commits] proj/ufed:master commit in: /
@ 2013-02-06  9:09 Sven Eden
  0 siblings, 0 replies; 238+ messages in thread
From: Sven Eden @ 2013-02-06  9:09 UTC (permalink / raw
  To: gentoo-commits

commit:     3b4c2f5975f036977fe0e9388eee8769411e528b
Author:     Sven Eden <sven.eden <AT> gmx <DOT> de>
AuthorDate: Wed Feb  6 09:10:16 2013 +0000
Commit:     Sven Eden <sven.eden <AT> gmx <DOT> de>
CommitDate: Wed Feb  6 09:10:16 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/ufed.git;a=commit;h=3b4c2f59

Added missing information that the IUSE line from installed packages influence the 'P' column.

---
 ufed-curses-help.c |    2 +-
 ufed.8.in          |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/ufed-curses-help.c b/ufed-curses-help.c
index 87fbb74..fb54bf5 100644
--- a/ufed-curses-help.c
+++ b/ufed-curses-help.c
@@ -66,7 +66,7 @@ static void init_lines(void)
 "M    : Either 'M' for Masked (always disabled), 'F' for Forced (always "
 "enabled) or empty for regular flags.",
 "D    : Default settings from make.defaults.",
-"P    : Package settings from package.use.",
+"P    : Package settings from package.use and IUSE for installed packages.",
 "C    : Configration setting from make.conf.",
 "S    : Scope of the description, package specific descriptions have an 'L' "
 "for \"local\".",

diff --git a/ufed.8.in b/ufed.8.in
index 430e576..23886b7 100644
--- a/ufed.8.in
+++ b/ufed.8.in
@@ -47,7 +47,7 @@ enabled) or empty for regular flags.
 .br
 D    : Default settings from make.defaults.
 .br
-P    : Package settings from package.use.
+P    : Package settings from package.use and IUSE for installed packages.
 .br
 C    : Configration setting from make.conf.
 .br


^ permalink raw reply related	[flat|nested] 238+ messages in thread
* [gentoo-commits] proj/ufed:master commit in: /
@ 2013-02-05 18:06 Paul Varner
  0 siblings, 0 replies; 238+ messages in thread
From: Paul Varner @ 2013-02-05 18:06 UTC (permalink / raw
  To: gentoo-commits

commit:     12f07a72b89a1fd79c8dc9a5638fb9bc3754885e
Author:     Paul Varner <fuzzyray <AT> gentoo <DOT> org>
AuthorDate: Tue Feb  5 18:04:38 2013 +0000
Commit:     Paul Varner <fuzzyray <AT> gentoo <DOT> org>
CommitDate: Tue Feb  5 18:04:38 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/ufed.git;a=commit;h=12f07a72

Remove "CVS Header" section from man page.

The ufed repository now resides on git, so the CVS variable expansion is
useless.

---
 ufed.8.in |    2 --
 1 files changed, 0 insertions(+), 2 deletions(-)

diff --git a/ufed.8.in b/ufed.8.in
index 2db4214..430e576 100644
--- a/ufed.8.in
+++ b/ufed.8.in
@@ -146,5 +146,3 @@ ufed was previously maintained by
 ufed is currently maintained by
 .br
  Sven Eden <yamakuzure@gmx.net>.
-.SH "CVS HEADER"
-$Header: /var/cvsroot/gentoo-src/ufed/docs/ufed.8,v 1.4 2004/06/03 05:00:04 fava Exp $"


^ permalink raw reply related	[flat|nested] 238+ messages in thread
* [gentoo-commits] proj/ufed:master commit in: /
@ 2013-02-05 13:53 Sven Eden
  0 siblings, 0 replies; 238+ messages in thread
From: Sven Eden @ 2013-02-05 13:53 UTC (permalink / raw
  To: gentoo-commits

commit:     1dce300ac53801216aa28b6e5fc4a522e2a03c2c
Author:     Sven Eden <sven.eden <AT> gmx <DOT> de>
AuthorDate: Tue Feb  5 13:54:24 2013 +0000
Commit:     Sven Eden <sven.eden <AT> gmx <DOT> de>
CommitDate: Tue Feb  5 13:54:24 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/ufed.git;a=commit;h=1dce300a

Added setting of the local EPREFIX in ufed.8 man page.

---
 .gitignore  |    2 +-
 Makefile.am |   11 ++++++++++-
 2 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/.gitignore b/.gitignore
index 06a3828..8801d59 100644
--- a/.gitignore
+++ b/.gitignore
@@ -17,4 +17,4 @@ stamp*
 ufed
 ufed-curses
 testflags.txt
-
+ufed.8

diff --git a/Makefile.am b/Makefile.am
index 3bbcd4c..aaf93cd 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -2,6 +2,7 @@ PACKAGE_VERSION = @PACKAGE_VERSION@
 PERL = @PERL@
 libexecdir = @libdir@/@PACKAGE@
 perldir = @datadir@/@PACKAGE@
+E_PREFIX := $(shell portageq envvar EPREFIX 2>/dev/null)
 
 sbin_SCRIPTS = ufed
 libexec_PROGRAMS = ufed-curses
@@ -22,7 +23,7 @@ noinst_HEADERS = \
 	ufed-curses-types.h
 	
 dist_man_MANS = ufed.8
-EXTRA_DIST = ufed.pl.in
+EXTRA_DIST = ufed.pl.in ufed.8.in
 
 ufed: ufed.pl.in
 	rm -f $@.tmp
@@ -34,3 +35,11 @@ ufed: ufed.pl.in
 		$< >$@.tmp
 	chmod +x $@.tmp
 	mv $@.tmp $@
+
+ufed.8: ufed.8.in
+	rm -f $@.tmp
+	sed \
+		-e 's|@GENTOO_PORTAGE_EPREFIX@|$(E_PREFIX)|g' \
+		$< >$@.tmp
+	chmod +x $@.tmp
+	mv $@.tmp $@


^ permalink raw reply related	[flat|nested] 238+ messages in thread
* [gentoo-commits] proj/ufed:master commit in: /
@ 2013-02-05 11:24 Sven Eden
  0 siblings, 0 replies; 238+ messages in thread
From: Sven Eden @ 2013-02-05 11:24 UTC (permalink / raw
  To: gentoo-commits

commit:     5452656baf62f9bb53635ea1d10780136be4a93a
Author:     Sven Eden <sven.eden <AT> gmx <DOT> de>
AuthorDate: Tue Feb  5 11:25:14 2013 +0000
Commit:     Sven Eden <sven.eden <AT> gmx <DOT> de>
CommitDate: Tue Feb  5 11:25:14 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/ufed.git;a=commit;h=5452656b

Fixed a bug that made ufed forget about /etc/portage/package.use if a package was installed that has a different setting in IUSE.

---
 Portage.pm |   15 ++++++---------
 1 files changed, 6 insertions(+), 9 deletions(-)

diff --git a/Portage.pm b/Portage.pm
index 7ca9fc1..b647e7a 100644
--- a/Portage.pm
+++ b/Portage.pm
@@ -107,7 +107,8 @@ INIT {
 	_determine_eprefix;
 	_determine_make_conf;
 	_determine_profiles;
-	_read_make_globals;  
+	_read_make_globals;
+	_read_make_conf; ## Needed first to know about overlays
 
 	# Now with the defaults loaded, a check is in order
 	# whether the set USE_ORDER is supported:
@@ -116,20 +117,15 @@ INIT {
 	my $lastorder = "";
 	my @use_order = reverse split /:/, $_environment{USE_ORDER};
 	for my $order(@use_order) {
-		if($order eq 'defaults') {
-			_read_make_defaults
-		} elsif($order eq 'conf') {
-			_read_make_conf
-		} else {
-			next;
-		}
-		$lastorder = $order;
+		$lastorder = $order
+			if( ($order eq 'defaults') || ($order eq 'conf') );
 	}
 	$lastorder eq 'conf'
 		or die("Sorry, USE_ORDER without make.conf overriding global"
 			. " USE flags are not currently supported by ufed.\n");
 
 	_read_packages;
+	_read_make_defaults;
 	_read_use_force; ## Must be before _read_use_mask to not
 	_read_use_mask;  ## unintentionally unmask explicitly masked flags.
 	_read_archs;
@@ -330,6 +326,7 @@ sub _gen_use_flags
 				$descCons{$pKey}{$pkg} = 1;
 				++$lCount;
 			}
+
 			## TODO : Add affected packages that have no own description
 			# once the interface can handle them. These can be used for
 			# the package filtering per command line arguments later.


^ permalink raw reply related	[flat|nested] 238+ messages in thread
* [gentoo-commits] proj/ufed:master commit in: /
@ 2013-02-03 14:32 Sven Eden
  0 siblings, 0 replies; 238+ messages in thread
From: Sven Eden @ 2013-02-03 14:32 UTC (permalink / raw
  To: gentoo-commits

commit:     ada4931e59d9fac668a097b84696bf7f602a8144
Author:     Sven Eden <sven.eden <AT> gmx <DOT> de>
AuthorDate: Sun Feb  3 14:31:29 2013 +0000
Commit:     Sven Eden <sven.eden <AT> gmx <DOT> de>
CommitDate: Sun Feb  3 14:31:29 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/ufed.git;a=commit;h=ada4931e

Removed globals (now in ufed-curses-globals.h) and removed handling of the function keys from maineventloop().

---
 ufed-curses.c |  121 +++++++++++++++------------------------------------------
 1 files changed, 32 insertions(+), 89 deletions(-)

diff --git a/ufed-curses.c b/ufed-curses.c
index cb94363..da47b66 100644
--- a/ufed-curses.c
+++ b/ufed-curses.c
@@ -11,46 +11,25 @@ static const char* subtitle = NULL;
 static const sKey* keys     = NULL;
 static sFlag* currentflag   = NULL;
 static sFlag* flags         = NULL;
+static bool   withSep       = false;
 
 // Needed for the scrollbar and its mouse events
 static int listHeight, barStart, barEnd, dispStart, dispEnd;
 
 
-/* external members */
-sWindow window[wCount] = {
-	{ NULL,  0,  0,  5,  0 }, /* Top       --- Top ---- */
-	{ NULL,  5,  0, -8,  3 }, /* Left      L+------+S|R */
-	{ NULL,  5,  3, -9, -6 }, /* List      E|      |c|i */
-	{ NULL, -4,  3,  1, -6 }, /* Input     F| List |r|g */
-	{ NULL,  5, -3, -8,  1 }, /* Scrollbar T|______|B|h */
-	{ NULL,  5, -2, -8,  2 }, /* Right     |+Input-+r|t */
-	{ NULL, -3,  0,  3,  0 }, /* Bottom    ---Bottom--- */
-};
-int topline = 0, bottomline = 0, minwidth = 0;
-extern eMask e_mask;
-extern eOrder e_order;
-extern eScope e_scope;
-extern eState e_state;
-extern sListStats listStats;
-
-
 /* internal prototypes */
 static int (*callback)(sFlag**, int);
 static int (*drawflag)(sFlag*, bool);
-void checktermsize(void);
-void draw(bool withSep);
-void drawScrollbar(void);
-int  getListHeight(void);
-void resetDisplay(bool withSep);
-bool setNextItem(int count, bool strict);
-bool setPrevItem(int count, bool strict);
+static void checktermsize(void);
+static void drawScrollbar(void);
+static int  getListHeight(void);
 
 
 /* internal functions */
 
 /** @brief get the sum of lines the list holds respecting current filtering
 **/
-int getListHeight()
+static int getListHeight()
 {
 	int result = 0;
 
@@ -110,9 +89,9 @@ void cursesdone() {
 	endwin();
 }
 
-void checktermsize() {
+static void checktermsize() {
 	while(wHeight(List) < 1
-	   || wWidth(List)  < minwidth) {
+	   || wWidth(List)  < (minwidth + 10)) {
 #ifdef KEY_RESIZE
 		clear();
 		attrset(0);
@@ -251,7 +230,7 @@ void drawFlags() {
 	wnoutrefresh(win(List));
 }
 
-void drawScrollbar() {
+static void drawScrollbar() {
 	int sHeight = wHeight(Scrollbar);
 	int lHeight = wHeight(List);
 	WINDOW *w = win(Scrollbar);
@@ -485,17 +464,9 @@ int maineventloop(
 		int(*_drawflag)(sFlag*, bool),
 		sFlag* _flags,
 		const sKey *_keys,
-		bool withSep) {
+		bool _withSep) {
 	int result;
 
-	// Always reset the Filters on start and revert on exit
-	eMask  oldMask  = e_mask;
-	eScope oldScope = e_scope;
-	eState oldState = e_state;
-	e_mask  = eMask_unmasked;
-	e_scope = eScope_all;
-	e_state = eState_all;
-
 	{ const char *temp = subtitle;
 		subtitle  = _subtitle;
 		_subtitle = temp; }
@@ -512,9 +483,23 @@ int maineventloop(
 		keys  = _keys;
 		_keys = temp; }
 
-	currentflag = flags;
-	topline = 0;
+	// Save old display position
+	sFlag* oldCurr = currentflag;
+	bool   oldSep  = withSep;
+	int    oldTop  = topline;
+	currentflag    = flags;
+	topline        = 0;
+	withSep        = _withSep;
+
+	// Save filter settings and start with neutral ones
+	eMask  oldMask  = e_mask;
+	eScope oldScope = e_scope;
+	eState oldState = e_state;
+	e_mask  = eMask_unmasked;
+	e_scope = eScope_all;
+	e_state = eState_all;
 
+	// Draw initial display
 	draw(withSep);
 
 	for(;;) {
@@ -703,53 +688,6 @@ int maineventloop(
 					}
 					break;
 
-				case KEY_F(5):
-					if      (eMask_masked   == e_mask) e_mask = eMask_unmasked;
-					else if (eMask_unmasked == e_mask) e_mask = eMask_both;
-					else                               e_mask = eMask_masked;
-
-					if ( !isFlagLegal(currentflag)
-					  && !setNextItem(1, true)
-					  && !setPrevItem(1, true) )
-						resetDisplay(withSep);
-					else
-						draw(withSep);
-
-					break;
-
-				case KEY_F(6):
-					if      (eScope_local  == e_scope) e_scope = eScope_all;
-					else if (eScope_global == e_scope) e_scope = eScope_local;
-					else                               e_scope = eScope_global;
-
-					if ( !isFlagLegal(currentflag)
-					  && !setNextItem(1, true)
-					  && !setPrevItem(1, true) )
-						resetDisplay(withSep);
-					else
-						draw(withSep);
-					break;
-
-				case KEY_F(7):
-					if      (eState_installed    == e_state) e_state = eState_notinstalled;
-					else if (eState_notinstalled == e_state) e_state = eState_all;
-					else                                     e_state = eState_installed;
-
-					if ( !isFlagLegal(currentflag)
-					  && !setNextItem(1, true)
-					  && !setPrevItem(1, true) )
-						resetDisplay(withSep);
-					else
-						draw(withSep);
-					break;
-
-				case KEY_F(8):
-					if (eOrder_left == e_order) e_order = eOrder_right;
-					else                        e_order = eOrder_left;
-					drawFlags();
-					break;
-
-
 #ifdef KEY_RESIZE
 				case KEY_RESIZE:
 					resizeterm(LINES, COLS);
@@ -780,13 +718,18 @@ exit:
 	flags    = _flags;
 	keys     = _keys;
 
-	// revert filters
+	// Reset display:
+	currentflag = oldCurr;
+	topline     = oldTop;
+	withSep     = oldSep;
+
+	// Revert filters
 	e_mask  = oldMask;
 	e_scope = oldScope;
 	e_state = oldState;
 
 	if(flags != NULL)
-		resetDisplay(withSep);
+		draw(withSep);
 
 	return result;
 }


^ permalink raw reply related	[flat|nested] 238+ messages in thread
* [gentoo-commits] proj/ufed:master commit in: /
@ 2013-02-03 14:32 Sven Eden
  0 siblings, 0 replies; 238+ messages in thread
From: Sven Eden @ 2013-02-03 14:32 UTC (permalink / raw
  To: gentoo-commits

commit:     62111738bc22335ae72037c2eac5dc9c38e682d3
Author:     Sven Eden <sven.eden <AT> gmx <DOT> de>
AuthorDate: Sun Feb  3 14:30:38 2013 +0000
Commit:     Sven Eden <sven.eden <AT> gmx <DOT> de>
CommitDate: Sun Feb  3 14:30:38 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/ufed.git;a=commit;h=62111738

Added inclusion of globals, added missing and re-ordered existing prototypes for better readability.

---
 ufed-curses.h |   17 +++++++++--------
 1 files changed, 9 insertions(+), 8 deletions(-)

diff --git a/ufed-curses.h b/ufed-curses.h
index f996d7c..117500f 100644
--- a/ufed-curses.h
+++ b/ufed-curses.h
@@ -1,12 +1,14 @@
-#include "ufed-curses-types.h"
-
-/* global members */
-extern sWindow window[wCount];
+#include "ufed-curses-globals.h"
 
 /* global prototypes */
 void cursesdone(void);
 void initcurses(void);
 
+void draw(bool withSep);
+void drawBottom(bool withSep);
+void drawFlags(void);
+void drawStatus(bool withSep);
+void drawTop(bool withSep);
 int maineventloop(
 	const char *subtitle,
 	int (*callback)(sFlag** curr, int key),
@@ -14,11 +16,10 @@ int maineventloop(
 	sFlag* flags,
 	const sKey* keys,
 	bool withSep);
-void drawBottom(bool withSep);
-void drawFlags(void);
-void drawStatus(bool withSep);
-void drawTop(bool withSep);
+void resetDisplay(bool withSep);
 bool scrollcurrent(void);
+bool setNextItem(int count, bool strict);
+bool setPrevItem(int count, bool strict);
 bool yesno(const char *);
 
 


^ permalink raw reply related	[flat|nested] 238+ messages in thread
* [gentoo-commits] proj/ufed:master commit in: /
@ 2013-02-03 14:32 Sven Eden
  0 siblings, 0 replies; 238+ messages in thread
From: Sven Eden @ 2013-02-03 14:32 UTC (permalink / raw
  To: gentoo-commits

commit:     9c30fd54d7f7d47c85607a1955aa4ddb1a8b89c7
Author:     Sven Eden <sven.eden <AT> gmx <DOT> de>
AuthorDate: Sun Feb  3 14:29:35 2013 +0000
Commit:     Sven Eden <sven.eden <AT> gmx <DOT> de>
CommitDate: Sun Feb  3 14:29:35 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/ufed.git;a=commit;h=9c30fd54

Moved function key detection and handling to flags callback() function. It is no longer possible to toggle filters while reading the help screen now.

---
 ufed-curses-checklist.c |   53 +++++++++++++++++++++++++++++++++++++++-------
 1 files changed, 45 insertions(+), 8 deletions(-)

diff --git a/ufed-curses-checklist.c b/ufed-curses-checklist.c
index ac6c60f..a58d60c 100644
--- a/ufed-curses-checklist.c
+++ b/ufed-curses-checklist.c
@@ -39,14 +39,6 @@ static const sKey keys[] = {
 static void free_flags(void);
 
 
-/* external members */
-eMask      e_mask    = eMask_unmasked;
-eOrder     e_order   = eOrder_left;
-eScope     e_scope   = eScope_all;
-eState     e_state   = eState_all;
-sListStats listStats = { 0, 0, 0, 0, 0, 0 };
-extern int bottomline, minwidth;
-
 /* static functions */
 static char *getline(FILE *fp)
 {
@@ -427,6 +419,51 @@ static int callback(sFlag** curr, int key)
 			wmove(wLst, (*curr)->currline, 2);
 			wrefresh(wLst);
 			break;
+		case KEY_F(5):
+			if      (eMask_masked   == e_mask) e_mask = eMask_unmasked;
+			else if (eMask_unmasked == e_mask) e_mask = eMask_both;
+			else                               e_mask = eMask_masked;
+
+			if ( !isFlagLegal(*curr)
+			  && !setNextItem(1, true)
+			  && !setPrevItem(1, true) )
+				resetDisplay(true);
+			else
+				draw(true);
+
+			break;
+
+		case KEY_F(6):
+			if      (eScope_local  == e_scope) e_scope = eScope_all;
+			else if (eScope_global == e_scope) e_scope = eScope_local;
+			else                               e_scope = eScope_global;
+
+			if ( !isFlagLegal(*curr)
+			  && !setNextItem(1, true)
+			  && !setPrevItem(1, true) )
+				resetDisplay(true);
+			else
+				draw(true);
+			break;
+
+		case KEY_F(7):
+			if      (eState_installed    == e_state) e_state = eState_notinstalled;
+			else if (eState_notinstalled == e_state) e_state = eState_all;
+			else                                     e_state = eState_installed;
+
+			if ( !isFlagLegal(*curr)
+			  && !setNextItem(1, true)
+			  && !setPrevItem(1, true) )
+				resetDisplay(true);
+			else
+				draw(true);
+			break;
+
+		case KEY_F(8):
+			if (eOrder_left == e_order) e_order = eOrder_right;
+			else                        e_order = eOrder_left;
+			drawFlags();
+			break;
 #ifdef NCURSES_MOUSE_VERSION
 		case KEY_MOUSE:
 			// Masked flags can be turned off, nothing else


^ permalink raw reply related	[flat|nested] 238+ messages in thread
* [gentoo-commits] proj/ufed:master commit in: /
@ 2013-02-03 14:32 Sven Eden
  0 siblings, 0 replies; 238+ messages in thread
From: Sven Eden @ 2013-02-03 14:32 UTC (permalink / raw
  To: gentoo-commits

commit:     103ecb8a278b4dfc32af443f5004ee940a0bf762
Author:     Sven Eden <sven.eden <AT> gmx <DOT> de>
AuthorDate: Sun Feb  3 14:28:36 2013 +0000
Commit:     Sven Eden <sven.eden <AT> gmx <DOT> de>
CommitDate: Sun Feb  3 14:28:36 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/ufed.git;a=commit;h=103ecb8a

Moved global variables to the new files ufed-curses-globals.c and ufed-curses-globals.h to clean up both ufed-curses.c and ufed-curses-checklist.c. Further this move should reduce confusion about what is desclared and/or defined where.

---
 Makefile.am           |   16 ++++++++++++++--
 ufed-curses-globals.c |   26 ++++++++++++++++++++++++++
 ufed-curses-globals.h |   23 +++++++++++++++++++++++
 3 files changed, 63 insertions(+), 2 deletions(-)

diff --git a/Makefile.am b/Makefile.am
index 8cd390c..3bbcd4c 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -7,8 +7,20 @@ sbin_SCRIPTS = ufed
 libexec_PROGRAMS = ufed-curses
 dist_perl_DATA = Portage.pm
 
-ufed_curses_SOURCES = ufed-curses-types.c ufed-curses.c ufed-curses-checklist.c ufed-curses-help.c
-noinst_HEADERS = ufed-curses-types.h ufed-curses.h ufed-curses-help.h ufed-curses-debug.h
+ufed_curses_SOURCES = \
+	ufed-curses.c \
+	ufed-curses-checklist.c \
+	ufed-curses-help.c \
+	ufed-curses-globals.c \
+	ufed-curses-types.c
+
+noinst_HEADERS = \
+	ufed-curses.h \
+	ufed-curses-debug.h \
+	ufed-curses-globals.h \
+	ufed-curses-help.h \
+	ufed-curses-types.h
+	
 dist_man_MANS = ufed.8
 EXTRA_DIST = ufed.pl.in
 

diff --git a/ufed-curses-globals.c b/ufed-curses-globals.c
new file mode 100644
index 0000000..d43c4f1
--- /dev/null
+++ b/ufed-curses-globals.c
@@ -0,0 +1,26 @@
+/*
+ * ufed-curses-globals.c
+ *
+ *  Created on: 03.02.2013
+ *      Author: Sven Eden
+ */
+
+#include "ufed-curses-types.h"
+
+int        bottomline     = 0;
+int        minwidth       = 0;
+int        topline        = 0;
+eMask      e_mask         = eMask_unmasked;
+eOrder     e_order        = eOrder_left;
+eScope     e_scope        = eScope_all;
+eState     e_state        = eState_all;
+sListStats listStats      = { 0, 0, 0, 0, 0, 0 };
+sWindow    window[wCount] = {
+	{ NULL,  0,  0,  5,  0 }, /* Top       --- Top ---- */
+	{ NULL,  5,  0, -8,  3 }, /* Left      L+------+S|R */
+	{ NULL,  5,  3, -9, -6 }, /* List      E|      |c|i */
+	{ NULL, -4,  3,  1, -6 }, /* Input     F| List |r|g */
+	{ NULL,  5, -3, -8,  1 }, /* Scrollbar T|______|B|h */
+	{ NULL,  5, -2, -8,  2 }, /* Right     |+Input-+r|t */
+	{ NULL, -3,  0,  3,  0 }, /* Bottom    ---Bottom--- */
+};

diff --git a/ufed-curses-globals.h b/ufed-curses-globals.h
new file mode 100644
index 0000000..263590b
--- /dev/null
+++ b/ufed-curses-globals.h
@@ -0,0 +1,23 @@
+/*
+ * ufed-curses-globals.h
+ *
+ *  Created on: 03.02.2013
+ *      Author: Sven Eden
+ */
+#pragma once
+#ifndef UFED_CURSES_GLOBALS_H_
+#define UFED_CURSES_GLOBALS_H_
+
+#include "ufed-curses-types.h"
+
+extern int        bottomline;
+extern eMask      e_mask;
+extern eOrder     e_order;
+extern eScope     e_scope;
+extern eState     e_state;
+extern sListStats listStats;
+extern int        minwidth;
+extern int        topline;
+extern sWindow    window[wCount];
+
+#endif /* UFED_CURSES_GLOBALS_H_ */


^ permalink raw reply related	[flat|nested] 238+ messages in thread
* [gentoo-commits] proj/ufed:master commit in: /
@ 2013-02-03 14:32 Sven Eden
  0 siblings, 0 replies; 238+ messages in thread
From: Sven Eden @ 2013-02-03 14:32 UTC (permalink / raw
  To: gentoo-commits

commit:     94506cca8db61ab0692a22a7586c2df13e547658
Author:     Sven Eden <sven.eden <AT> gmx <DOT> de>
AuthorDate: Sun Feb  3 14:33:03 2013 +0000
Commit:     Sven Eden <sven.eden <AT> gmx <DOT> de>
CommitDate: Sun Feb  3 14:33:03 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/ufed.git;a=commit;h=94506cca

Updated the documentation, added usage of the new globals and changed the drawline() function for a nicer help screen display. It now distincts between header and normal lines.

---
 ufed-curses-help.c |  170 ++++++++++++++++++++++++++++++----------------------
 1 files changed, 98 insertions(+), 72 deletions(-)

diff --git a/ufed-curses-help.c b/ufed-curses-help.c
index 76825d2..02f852c 100644
--- a/ufed-curses-help.c
+++ b/ufed-curses-help.c
@@ -10,104 +10,122 @@
 #include <strings.h>
 #include <unistd.h>
 
-/* internal types */
-// Do not use an own struct, just use sFlag
-//static struct line {
-//	struct item item;
-//	char *text;
-//} *lines;
-static sFlag* lines = NULL;
 
 /* internal members */
+static sFlag* lines = NULL;
 static size_t helpheight, helpwidth;
 
-/* external members */
-
 /* internal prototypes */
+static int callback(sFlag** curr, int key);
+static int drawline(sFlag* line, bool highlight);
 static void free_lines(void);
+void help(void);
+static void init_lines(void);
 
 /* function implementations */
-static void init_lines(void) {
+static void init_lines(void)
+{
 	static const char * const help[] = {
+"--- What is ufed ? ---",
+"",
 "ufed is a simple program designed to help you configure the systems USE "
-"flags (see below) to your liking. Use the Up and Down arrow keys, the "
-"Page Up and Page Down keys, the Home and End keys, or start typing the "
-"name of a flag to select it. Then, use the space bar to toggle the "
-"setting. After changing flags, press the Return or Enter key to make "
-"this permanent, or press Escape to revert your changes.",
-"",
-"Note: Depending on your system, you may need to wait a second before "
-"ufed detects this key; in some cases, you can use the ncurses "
-"environment variable ESCDELAY to change this. See the ncurses(3x) "
+"flags (see below) to your liking.",
+"",
+"--- Navigation and control ---",
+"",
+"Use the Up and Down arrow keys, the Page Up and Page Down keys, the Home and "
+"End keys, or start typing the name of a flag to select it.",
+"Use the space bar to toggle the setting.",
+"",
+"If ncurses is installed with the \"gpm\" use flag enabled, you can use your "
+"mouse to navigate and to toggle the settings, too.",
+"",
+"After changing flags, press the Return or Enter key to make this permanent, "
+"or press Escape to revert your changes.",
+"",
+"Note: Depending on your system, you may need to wait a second before ufed "
+"detects the Escape key or mouse clicks; in some cases, you can use the "
+"ncurses environment variable ESCDELAY to change this. See the ncurses(3x) "
 "manpage for more info.",
 "",
-"ufed will present you with a list of descriptions for each USE flag. If "
-"a description is too long to fit on your screen, you can use the Left "
-"and Right arrow keys to scroll the descriptions.",
+"--- Display layout ---",
 "",
-"ufed attempts to show you where a particular use setting came from. "
-"Each USE flag has a 2 character descriptor that represents the two "
-"ways a use flag can be set.",
+"ufed will present you with a list of descriptions for each USE flag. If a "
+"description is too long to fit on your screen, you can use the Left and Right "
+"arrow keys to scroll the descriptions.",
 "",
-"The 1st char is the setting from the make.defaults file. These are "
-"the defaults for Gentoo as a whole. These should not be changed.",
+"ufed attempts to show you where a particular use setting came from, and what "
+"its scope and state is.",
 "",
-"The 2nd char is the settings from the make.conf file. these are "
-"the only ones that should be changed by the user and these are the ones "
-"that ufed changes.",
+"The display consists of the following information:",
+" (s) flag  M|DPC|Si| (packages) description",
 "",
-"If the character is a + then that USE flag was set in that file, if it "
-"is a space then the flag was not mentioned in that file and if it is a "
-"- then that flag was unset in that file.",
+"(s)  : Your selection, either '+' to enable, '-' to disable, or empty to keep "
+"the default value.",
+"flag : The name of the flag",
+"M    : Either 'M' for Masked (always disabled), 'F' for Forced (always "
+"enabled) or empty for regular flags.",
+"D    : Default settings from make.defaults.",
+"P    : Package settings from package.use.",
+"C    : Configration setting from make.conf.",
+"S    : Scope of the description, package specific descriptions have an 'L' "
+"for \"local\".",
+"i    : 'i' if any affected package is installed.",
+"(packages): List of affected packages",
+"description : The description of the flag from use.desc or use.local.desc.",
 "",
-"-- What Are USE Flags? --",
+"If the character in any of the D, P or C column is a + then that USE flag was "
+"set in that file, if it is a space then the flag was not mentioned in that "
+"file and if it is a - then that flag was unset in that file.",
+"",
+"--- What Are USE Flags? ---",
 "",
 "The USE settings system is a flexible way to enable or disable various "
-"features at package build-time on a global level and for individual "
-"packages. This allows an administrator control over how packages are "
-"built in regards to the optional features which can be compiled into "
-"those packages.",
+"features at package build-time on a global level and for individual packages. "
+"This allows an administrator control over how packages are built in regards "
+"to the optional features which can be compiled into those packages.",
 "",
-"For instance, packages with optional GNOME support can have this "
-"support disabled at compile time by disabling the \"gnome\" USE setting. "
-"Enabling the \"gnome\" USE setting would enable GNOME support in these "
-"same packages.",
+"For instance, packages with optional GNOME support can have this support "
+"disabled at compile time by disabling the \"gnome\" USE setting. Enabling the "
+"\"gnome\" USE setting would enable GNOME support in these packages.",
 "",
 "The effect of USE settings on packages is dependent on whether both the "
 "software itself and the package ebuild supports the USE setting as an "
 "optional feature. If the software does not have support for an optional "
-"feature then the corresponding USE setting will obviously have no "
-"effect.",
+"feature then the corresponding USE setting will obviously have no effect.",
 "",
-"Also many package dependencies are not considered optional by the "
-"software and thus USE settings will have no effect on those mandatory "
-"dependencies.",
+"Also many package dependencies are not considered optional by the software "
+"and thus USE settings will have no effect on those mandatory dependencies.",
 "",
-"A list of USE keywords used by a particular package can be found by "
-"checking the IUSE line in any ebuild file.",
+"A list of USE keywords used by a particular package can be found by checking "
+"the IUSE line in any ebuild file.",
 "",
 "See",
 " http://www.gentoo.org/doc/en/handbook/handbook-x86.xml?part=2&chap=1",
 "for more information on USE flags.",
 "",
-"Please also note that if ufed describes a flag as (Unknown) it "
-"generally means that it is either a spelling error in one of the two "
-"configuration files or it is not an offically sanctioned USE flag. "
+"Please also note that if ufed describes a flag as (Unknown) it generally "
+"means that it is either a spelling error in one of the three configuration "
+"files or it is not an officially sanctioned USE flag.",
 "Sanctioned USE flags can be found in",
 " /usr/portage/profiles/use.desc",
 "and in",
 " /usr/portage/profiles/use.local.desc",
 "",
-"***",
+"--- Credits ---",
 "",
 "ufed was originally written by Maik Schreiber <blizzy@blizzy.de>.",
-"ufed was previously maintained by Robin Johnson <robbat2@gentoo.org>, "
-"Fred Van Andel <fava@gentoo.org>, and Arun Bhanu <codebear@gentoo.org>.",
-"ufed is currently maintained by Harald van Dijk <truedfx@gentoo.org>.",
-"",
-"Copyright 1999-2005 Gentoo Foundation",
+"ufed was previously maintained by",
+" Robin Johnson <robbat2@gentoo.org>,",
+" Fred Van Andel <fava@gentoo.org>,",
+" Arun Bhanu <codebear@gentoo.org> and",
+" Harald van Dijk <truedfx@gentoo.org>.",
+"ufed is currently maintained by",
+" Sven Eden <yamakuzure@gmx.net>.",
+"",
+"Copyright 1999-2013 Gentoo Foundation",
 "Distributed under the terms of the GNU General Public License v2"
-	};
+};
 	sFlag* line = NULL;
 	size_t lineCount = sizeof(help) / sizeof(*help);
 	size_t currLine  = 0;
@@ -154,7 +172,8 @@ static void init_lines(void) {
 	}
 }
 
-static void free_lines(void) {
+static void free_lines(void)
+{
 	sFlag* line = lines->prev;
 
 	// Clear all lines
@@ -174,14 +193,24 @@ static const sKey keys[] = {
 #undef key
 };
 
-static int drawline(sFlag* line, bool highlight) {
+static int drawline(sFlag* line, bool highlight)
+{
 	char buf[wWidth(List)+1];
 
 	sprintf(buf, "%-*.*s", wWidth(List), wWidth(List), line->desc[0].desc);
-	if(!highlight)
-		wattrset(win(List), COLOR_PAIR(3));
-	else
-		wattrset(win(List), COLOR_PAIR(3) | A_BOLD | A_REVERSE);
+
+	if ('-' == buf[0]) {
+		if (highlight)
+			wattrset(win(List), COLOR_PAIR(5) | A_REVERSE);
+		else
+			wattrset(win(List), COLOR_PAIR(5) | A_BOLD);
+	} else {
+		if (highlight)
+			wattrset(win(List), COLOR_PAIR(2) | A_BOLD | A_REVERSE);
+		else
+			wattrset(win(List), COLOR_PAIR(3));
+	}
+
 	mvwaddstr(win(List), line->currline, 0, buf);
 	if(highlight)
 		wmove(win(List), line->currline, 0);
@@ -189,7 +218,8 @@ static int drawline(sFlag* line, bool highlight) {
 	return 1;
 }
 
-static int callback(sFlag** curr, int key) {
+static int callback(sFlag** curr, int key)
+{
 	switch(key) {
 		case 'Q': case 'q':
 		case '\033':
@@ -206,7 +236,8 @@ static int callback(sFlag** curr, int key) {
 	}
 }
 
-void help(void) {
+void help(void)
+{
 	if ( ((int)helpheight != wHeight(List))
 	  || ((int)helpwidth  != wWidth(List)) ) {
 		if(lines!=NULL)
@@ -215,9 +246,4 @@ void help(void) {
 	}
 
 	maineventloop("", &callback, &drawline, lines, keys, false);
-
-	// Re-draw separators:
-	drawTop(true);
-	drawBottom(true);
-	drawStatus(true);
 }


^ permalink raw reply related	[flat|nested] 238+ messages in thread
* [gentoo-commits] proj/ufed:master commit in: /
@ 2013-02-02 20:49 Sven Eden
  0 siblings, 0 replies; 238+ messages in thread
From: Sven Eden @ 2013-02-02 20:49 UTC (permalink / raw
  To: gentoo-commits

commit:     82e96916d6a3e684110963ca2ead9a96eef58cbf
Author:     Sven Eden <sven.eden <AT> gmx <DOT> de>
AuthorDate: Sat Feb  2 20:49:55 2013 +0000
Commit:     Sven Eden <sven.eden <AT> gmx <DOT> de>
CommitDate: Sat Feb  2 20:49:55 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/ufed.git;a=commit;h=82e96916

Fixed a bug that could cause a found flag to be below the display if a displayed flag above it has one or more filtered description lines.

---
 ufed-curses-checklist.c |   21 +++++++++++----------
 ufed-curses.c           |    2 ++
 2 files changed, 13 insertions(+), 10 deletions(-)

diff --git a/ufed-curses-checklist.c b/ufed-curses-checklist.c
index f8a5ec4..ac6c60f 100644
--- a/ufed-curses-checklist.c
+++ b/ufed-curses-checklist.c
@@ -221,9 +221,12 @@ static int drawflag(sFlag* flag, bool highlight)
 	 */
 	if (line < 0) {
 		if (-line < getFlagHeight(flag)) {
-			idx   = -line;
-			line  = 0;
-			usedY = idx;
+			while (line < 0) {
+				if (isDescLegal(flag, idx++)) {
+					++line;
+					++usedY;
+				}
+			}
 		} else
 			// Otherwise this item is out of the display area
 			return 0;
@@ -487,17 +490,15 @@ static int callback(sFlag** curr, int key)
 						wattrset(wInp, COLOR_PAIR(4) | A_BOLD | A_REVERSE);
 						mvwaddstr(wInp, 0, 0, fayt);
 						wmove(wInp, 0, fLen - 1);
-						wnoutrefresh(wLst);
 						wrefresh(wInp);
 					} else {
-						drawflag(*curr, FALSE);
-						*curr = flag;
-						scrollcurrent();
-						drawflag(*curr, TRUE);
 						wattrset(wInp, COLOR_PAIR(5) | A_BOLD);
 						mvwaddstr(wInp, 0, 0, fayt);
-						wnoutrefresh(wLst);
-						wrefresh(wInp);
+						wnoutrefresh(wInp);
+						drawflag(*curr, FALSE);
+						*curr = flag;
+						if (!scrollcurrent())
+							drawflag(*curr, TRUE);
 					}
 				}
 			}

diff --git a/ufed-curses.c b/ufed-curses.c
index 0c3fd56..cb94363 100644
--- a/ufed-curses.c
+++ b/ufed-curses.c
@@ -417,12 +417,14 @@ bool scrollcurrent() {
 	int flHeight = getFlagHeight(currentflag);
 	int btLine   = lsLine + flHeight;
 	int wdHeight = wHeight(List);
+
 	if(lsLine < topline)
 		topline = max(lsLine, btLine - wdHeight);
 	else if( btLine > (topline + wdHeight))
 		topline = min(btLine - wdHeight, lsLine);
 	else
 		return false;
+
 	drawFlags();
 	drawScrollbar();
 	return true;


^ permalink raw reply related	[flat|nested] 238+ messages in thread
* [gentoo-commits] proj/ufed:master commit in: /
@ 2013-02-02 10:11 Sven Eden
  0 siblings, 0 replies; 238+ messages in thread
From: Sven Eden @ 2013-02-02 10:11 UTC (permalink / raw
  To: gentoo-commits

commit:     bb65cf92173654d1725e94214fc59a5596faed57
Author:     Sven Eden <sven.eden <AT> gmx <DOT> de>
AuthorDate: Sat Feb  2 10:12:18 2013 +0000
Commit:     Sven Eden <sven.eden <AT> gmx <DOT> de>
CommitDate: Sat Feb  2 10:12:18 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/ufed.git;a=commit;h=bb65cf92

removed the parsing of PKGUSE, as it is irrelevant which use flags _were_ enabled, ufed must care about flags that _are_ enabled.

---
 Portage.pm |   30 +++++++++++++++---------------
 1 files changed, 15 insertions(+), 15 deletions(-)

diff --git a/Portage.pm b/Portage.pm
index f5d125d..7ca9fc1 100644
--- a/Portage.pm
+++ b/Portage.pm
@@ -630,7 +630,7 @@ sub _read_packages {
 		# loop through all openable directories in cat
 		while(my $pkg = readdir $catdir) {
 			next if $pkg eq '.' or $pkg eq '..';
-			my @puse = ();
+#			my @puse = ();
 			my @iuse = ();
 			
 			# Load IUSE to learn which use flags the package in this version knows
@@ -642,12 +642,12 @@ sub _read_packages {
 			}
 
 			# Load PKGUSE to learn which use flags have been set when this package was emerged
-			my $fpuse = "${_EPREFIX}/var/db/pkg/$cat/$pkg/PKGUSE";
-			if(open my $use, '<', $fpuse) {
-				local $/;
-				@puse = split ' ', <$use>;
-				close $use;
-			}
+#			my $fpuse = "${_EPREFIX}/var/db/pkg/$cat/$pkg/PKGUSE";
+#			if(open my $use, '<', $fpuse) {
+#				local $/;
+#				@puse = split ' ', <$use>;
+#				close $use;
+#			}
 
 			# could be shortened, but make sure not to strip off part of the name
 			$pkg =~ s/-\d+(?:\.\d+)*\w?(?:_(?:alpha|beta|pre|rc|p)\d*)?(?:-r\d+)?$//;
@@ -665,14 +665,14 @@ sub _read_packages {
 				$_use_temp->{$flag}{"local"}{$pkg}{installed}   = 1;
 				$_use_temp->{$flag}{global}{installed} = 1;
 			} ## End of looping IUSE
-			for my $flag (@puse) {
-				my $state = $flag =~ s/^-// || 0; 
-
-				if ( defined($_use_temp->{$flag}{global})
-				  && defined($_use_temp->{$flag}{"local"}{$pkg})) {
-				  	$_use_temp->{$flag}{"local"}{$pkg}{"package"} = $state ? -1 : 0;
-				}
-			} ## End of looping PKGUSE
+#			for my $flag (@puse) {
+#				my $state = $flag =~ s/^-// || 0; 
+#
+#				if ( defined($_use_temp->{$flag}{global})
+#				  && defined($_use_temp->{$flag}{"local"}{$pkg})) {
+#				  	$_use_temp->{$flag}{"local"}{$pkg}{"package"} = $state ? -1 : 0;
+#				}
+#			} ## End of looping PKGUSE
 			
 		}
 		closedir $catdir;


^ permalink raw reply related	[flat|nested] 238+ messages in thread
* [gentoo-commits] proj/ufed:master commit in: /
@ 2013-02-02  9:47 Sven Eden
  0 siblings, 0 replies; 238+ messages in thread
From: Sven Eden @ 2013-02-02  9:47 UTC (permalink / raw
  To: gentoo-commits

commit:     6741a9c044748a9f0c2bdd8c2462e615d50ba8c8
Author:     Sven Eden <sven.eden <AT> gmx <DOT> de>
AuthorDate: Sat Feb  2 09:48:30 2013 +0000
Commit:     Sven Eden <sven.eden <AT> gmx <DOT> de>
CommitDate: Sat Feb  2 09:48:30 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/ufed.git;a=commit;h=6741a9c0

Moved EPREFIX back to _EPRIX and eventually implemented the parsing of package.use files. make.defaults and package.use files are now parsed in the same order as portage does according to strace.

---
 Portage.pm |  108 +++++++++++++++++++++++++++++++-----------------------------
 1 files changed, 56 insertions(+), 52 deletions(-)

diff --git a/Portage.pm b/Portage.pm
index 1641a54..f5d125d 100644
--- a/Portage.pm
+++ b/Portage.pm
@@ -44,10 +44,10 @@ our $use_flags;
 
 # $used_make_conf - path of the used make.conf
 our $used_make_conf = "";
-our $EPREFIX        = "";
 
 # --- private members ---
 my %_environment  = ();
+my $_EPREFIX        = "";
 my @_profiles     = ();
 # $_use_temp - hashref that represents the current state of
 # all known flags. This is for data gathering, the public
@@ -206,13 +206,13 @@ sub _add_temp
 
 
 # Determine the value for EPREFIX and save it
-# in $EPREFIX. This is done using 'portageq'.
+# in $_EPREFIX. This is done using 'portageq'.
 # Other output from portageq is printed on
 # STDERR.
 # No parameters accepted.
 sub _determine_eprefix {
 	my $tmp = "/tmp/ufed_$$.tmp";
-	$EPREFIX = qx{portageq envvar EPREFIX 2>$tmp};
+	$_EPREFIX = qx{portageq envvar EPREFIX 2>$tmp};
 	die "Couldn't determine EPREFIX from Portage" if $? != 0;
 
 	if ( -s $tmp ) {
@@ -223,7 +223,7 @@ sub _determine_eprefix {
 	}
 	-e $tmp and unlink $tmp;
 
-	chomp($EPREFIX);
+	chomp($_EPREFIX);
 	return;
 }
 
@@ -232,9 +232,9 @@ sub _determine_eprefix {
 # and save the result in $used_make_conf
 sub _determine_make_conf
 {
-	$used_make_conf = "${EPREFIX}/etc/portage/make.conf";
+	$used_make_conf = "${_EPREFIX}/etc/portage/make.conf";
 	(! -r $used_make_conf)
-		and $used_make_conf = "${EPREFIX}/etc/make.conf";
+		and $used_make_conf = "${_EPREFIX}/etc/make.conf";
 	return; 
 }
 
@@ -245,13 +245,13 @@ sub _determine_make_conf
 # No parameters accepted.
 sub _determine_profiles
 {
-	my $mp = readlink "${EPREFIX}/etc/portage/make.profile";
+	my $mp = readlink "${_EPREFIX}/etc/portage/make.profile";
 	defined($mp)
-		or $mp = readlink "${EPREFIX}/etc/make.profile";
+		or $mp = readlink "${_EPREFIX}/etc/make.profile";
 
 	# make.profile is mandatory and must be a link
 	defined($mp)
-		or die "${EPREFIX}/etc\{,/portage\}/make.profile is not a symlink\n";
+		or die "${_EPREFIX}/etc\{,/portage\}/make.profile is not a symlink\n";
 
 	# Start with the linked path, it is the deepest profile child.
 	@_profiles = _norm_path('/etc', $mp);
@@ -516,8 +516,8 @@ sub _read_descriptions
 # overrides.
 # No parameters accepted.
 sub _read_make_conf {
-	my %oldEnv = _read_sh("${EPREFIX}/etc/make.conf");
-	my %newEnv = _read_sh("${EPREFIX}/etc/portage/make.conf");
+	my %oldEnv = _read_sh("${_EPREFIX}/etc/make.conf");
+	my %newEnv = _read_sh("${_EPREFIX}/etc/portage/make.conf");
 	_merge (\%oldEnv, \%newEnv);
 
 	# Note the conf state of the read flags:
@@ -537,19 +537,21 @@ sub _read_make_conf {
 		and push @_profiles,
 				map { my $x=$_; $x =~ s/^\s*(\S+)\s*$/$1\/profiles/mg ; $x }
 				split('\n', $_environment{PORTDIR_OVERLAY});
-	-e "${EPREFIX}/etc/portage/profile"
-		and push @_profiles, "${EPREFIX}/etc/portage/profile";
+	-e "${_EPREFIX}/etc/portage/profile"
+		and push @_profiles, "${_EPREFIX}/etc/portage/profile";
 	return;
 }
 
 
-# read all found make.defaults and non-user package.use files
-# and merge their values into env.
+# read all found make.defaults and package.use files and merge
+# their values into env, adding flag parameters to $_use_tmp.
 # TODO : use USE_EXPAND to add Expansion parsing. The most
 #        important of these are set with sane defaults here,
 #        too.
 # No parameters accepted.
 sub _read_make_defaults {
+
+	# make.defaults are parsed first by portage:
 	for my $dir(@_profiles) {
 		if (-r "$dir/make.defaults") {
 			my %env = _read_sh("$dir/make.defaults");
@@ -563,7 +565,36 @@ sub _read_make_defaults {
 					or  $_use_temp->{$flag}{global}{"default"} = -1;
 			}
 		}
-	} ## End of looping through the profiles
+	} ## End of reading make.defaults
+
+	# package.use files are parsed next, finished by /etc/portage/package.use
+	for my $dir(@_profiles, "${_EPREFIX}/etc/portage") {
+		for(_noncomments("$dir/package.use") ) {
+			my($pkg, @flags) = split;
+			
+			# There is an important detail: package.use files can limit
+			# their settings to specific package versions.
+			# As ufed is showing a generalized view and can in no
+			# acceptable way determine which versions are relevant,
+			# we have to *skip* all settings that have specific version
+			# and/or slot information limiting their scope.
+			$pkg =~ /^[<>=]/ and next;
+			
+			for my $flag (@flags) {
+				my $state = $flag =~ s/^-// || 0;
+
+				_add_temp($flag, "global");
+				_add_temp($flag, $pkg);
+
+				if ($state) {
+					$_use_temp->{$flag}{"local"}{$pkg}{"package"} = -1; ## explicitly disabled
+				} else {
+					$_use_temp->{$flag}{"local"}{$pkg}{"package"} =  1; ## explicitly enabled
+				}
+			}
+		}
+	} ## End of reading package.use
+
 	return
 }
 
@@ -573,7 +604,7 @@ sub _read_make_defaults {
 # get the final "PORTDIR" and "USE_ORDER"
 # No parameters accepted
 sub _read_make_globals {
-	for my $dir(@_profiles, "${EPREFIX}/usr/share/portage/config") {
+	for my $dir(@_profiles, "${_EPREFIX}/usr/share/portage/config") {
 		_read_sh("$dir/make.globals");
 	}
 	return;
@@ -586,14 +617,14 @@ sub _read_make_globals {
 # No parameters accepted.
 sub _read_packages {
 	my $pkgdir = undef;
-	opendir($pkgdir, "${EPREFIX}/var/db/pkg")
-		or die "Couldn't read ${EPREFIX}/var/db/pkg\n";
+	opendir($pkgdir, "${_EPREFIX}/var/db/pkg")
+		or die "Couldn't read ${_EPREFIX}/var/db/pkg\n";
 		
 	# loop through all categories in pkgdir
 	while(my $cat = readdir $pkgdir) {
 		next if $cat eq '.' or $cat eq '..';
 		my $catdir = undef;
-		opendir($catdir, "${EPREFIX}/var/db/pkg/$cat")
+		opendir($catdir, "${_EPREFIX}/var/db/pkg/$cat")
 			or next;
 
 		# loop through all openable directories in cat
@@ -602,24 +633,8 @@ sub _read_packages {
 			my @puse = ();
 			my @iuse = ();
 			
-			# Load PROVIDE
-			#Update: Deprecated, this file is gone
-			#if(open my $provide, '<', "$eprefix/var/db/pkg/$cat/$pkg/PROVIDE") {
-			#	local $/;
-			#	@provide = split ' ', <$provide>;
-			#	close $provide;
-			#}
-			
-			# Load USE
-			# Update: deprecated, this file is no longer useful. read IUSE and PKGUSE instead
-			#if(open my $use, '<', "$eprefix/var/db/pkg/$cat/$pkg/USE") {
-			#	local $/;
-			#	@use = split ' ', <$use>;
-			#	close $use;
-			#}
-			
 			# Load IUSE to learn which use flags the package in this version knows
-			my $fiuse = "${EPREFIX}/var/db/pkg/$cat/$pkg/IUSE";
+			my $fiuse = "${_EPREFIX}/var/db/pkg/$cat/$pkg/IUSE";
 			if(open my $use, '<', $fiuse) {
 				local $/;
 				@iuse = split ' ', <$use>;
@@ -627,7 +642,7 @@ sub _read_packages {
 			}
 
 			# Load PKGUSE to learn which use flags have been set when this package was emerged
-			my $fpuse = "${EPREFIX}/var/db/pkg/$cat/$pkg/PKGUSE";
+			my $fpuse = "${_EPREFIX}/var/db/pkg/$cat/$pkg/PKGUSE";
 			if(open my $use, '<', $fpuse) {
 				local $/;
 				@puse = split ' ', <$use>;
@@ -654,20 +669,9 @@ sub _read_packages {
 				my $state = $flag =~ s/^-// || 0; 
 
 				if ( defined($_use_temp->{$flag}{global})
-				  && defined($_use_temp->{$flag}{$pkg})) {
-				  	$state and $_use_temp->{$flag}{"local"}{$pkg}{"package"} = -1
-				  	        or $_use_temp->{$flag}{"local"}{$pkg}{"package"} =  0;
-
-				} # enable if output is wanted!
-				#else {
-				#	## This can happen if a package was installed with a flag
-				#	## that is gone. (Seen with sys-fs/ntfs3g-2012.1.15-r1 to
-				#	## sys-fs/ntfs3g-2012.1.15-r2 and use flag "extras". Gone,
-				#	## but still listed in PKGUSE)
-				#	printf STDERR "DEBUG: '%s' found in\n    '%s'\n  but not in\n    '%s'\n",
-				#		$flag, $fpuse, $fiuse;
-				#	## No need to break, though...
-				#}
+				  && defined($_use_temp->{$flag}{"local"}{$pkg})) {
+				  	$_use_temp->{$flag}{"local"}{$pkg}{"package"} = $state ? -1 : 0;
+				}
 			} ## End of looping PKGUSE
 			
 		}


^ permalink raw reply related	[flat|nested] 238+ messages in thread
* [gentoo-commits] proj/ufed:master commit in: /
@ 2013-02-02  9:47 Sven Eden
  0 siblings, 0 replies; 238+ messages in thread
From: Sven Eden @ 2013-02-02  9:47 UTC (permalink / raw
  To: gentoo-commits

commit:     061f84d71fe14fe5b90dc0be5aeaf1805952929d
Author:     Sven Eden <sven.eden <AT> gmx <DOT> de>
AuthorDate: Sat Feb  2 09:42:55 2013 +0000
Commit:     Sven Eden <sven.eden <AT> gmx <DOT> de>
CommitDate: Sat Feb  2 09:42:55 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/ufed.git;a=commit;h=061f84d7

Use the make.conf location determined by Portage.pm to write rather than searching again.

---
 ufed.pl.in |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/ufed.pl.in b/ufed.pl.in
index e9f4f27..76483e9 100644
--- a/ufed.pl.in
+++ b/ufed.pl.in
@@ -167,8 +167,7 @@ sub save_flags {
 
 	my $contents;
 
-	my $makeconf_name = "$Portage::EPREFIX/etc/portage/make.conf";
-	$makeconf_name = "$Portage::EPREFIX/etc/make.conf" unless(-r $makeconf_name);
+	my $makeconf_name = $Portage::used_make_conf;
 	{
 		open my $makeconf, '<', $makeconf_name or die "Couldn't open $makeconf_name\n";
 		open my $makeconfold, '>', $makeconf_name . '.old' or die "Couldn't open $makeconf_name.old\n";


^ permalink raw reply related	[flat|nested] 238+ messages in thread
* [gentoo-commits] proj/ufed:master commit in: /
@ 2013-02-02  9:47 Sven Eden
  0 siblings, 0 replies; 238+ messages in thread
From: Sven Eden @ 2013-02-02  9:47 UTC (permalink / raw
  To: gentoo-commits

commit:     709696e1725276cfeaa7edb71a5a998af9d4501c
Author:     Sven Eden <sven.eden <AT> gmx <DOT> de>
AuthorDate: Sat Feb  2 08:56:55 2013 +0000
Commit:     Sven Eden <sven.eden <AT> gmx <DOT> de>
CommitDate: Sat Feb  2 08:56:55 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/ufed.git;a=commit;h=709696e1

Removed the double reading of make.defaults and make.conf

---
 Portage.pm |    2 --
 1 files changed, 0 insertions(+), 2 deletions(-)

diff --git a/Portage.pm b/Portage.pm
index cd32f8b..1641a54 100644
--- a/Portage.pm
+++ b/Portage.pm
@@ -108,8 +108,6 @@ INIT {
 	_determine_make_conf;
 	_determine_profiles;
 	_read_make_globals;  
-	_read_make_defaults; 
-	_read_make_conf;
 
 	# Now with the defaults loaded, a check is in order
 	# whether the set USE_ORDER is supported:


^ permalink raw reply related	[flat|nested] 238+ messages in thread
* [gentoo-commits] proj/ufed:master commit in: /
@ 2013-02-01 21:12 Sven Eden
  0 siblings, 0 replies; 238+ messages in thread
From: Sven Eden @ 2013-02-01 21:12 UTC (permalink / raw
  To: gentoo-commits

commit:     fcb4e95407255f3191e2bafe8710ab0c1a6a69ea
Author:     Sven Eden <sven.eden <AT> gmx <DOT> de>
AuthorDate: Fri Feb  1 18:46:47 2013 +0000
Commit:     Sven Eden <sven.eden <AT> gmx <DOT> de>
CommitDate: Fri Feb  1 18:46:47 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/ufed.git;a=commit;h=fcb4e954

Added a new Char to show local Masked/Forced status.

---
 ufed-curses-checklist.c |   52 +++++++++++++++++++++++++++++-----------------
 ufed-curses.c           |   22 ++++++++++---------
 2 files changed, 45 insertions(+), 29 deletions(-)

diff --git a/ufed-curses-checklist.c b/ufed-curses-checklist.c
index c28a824..31a2294 100644
--- a/ufed-curses-checklist.c
+++ b/ufed-curses-checklist.c
@@ -233,13 +233,31 @@ static int drawflag(sFlag* flag, bool highlight)
 
 	// print descriptions according to filters
 	if(idx < flag->ndesc) {
-		int lHeight = wHeight(List);
+		int  lHeight = wHeight(List);
+		int  descLen = wWidth(List) - (minwidth + 9);
+		bool hasHead = false;
+		char special = ' ';
+		char *p;
 		for( ; (idx < flag->ndesc) && (line < lHeight); ++idx) {
 			// Continue if any of the filters apply:
 			if (!isDescLegal(flag, idx))
 				continue;
 
-			if (!buf[0]) {
+			// Set special character if needed:
+			if ( (flag->globalForced && ('-' != flag->desc[idx].stateForced))
+			  || isDescForced(flag, idx))
+				special = 'F';
+			else if ( (flag->globalMasked && ('-' != flag->desc[idx].stateMasked))
+				   || isDescMasked(flag, idx))
+				special = 'M';
+			else
+				special = ' ';
+
+			if (hasHead) {
+				// Add spaces under the flag display
+				for(p = buf; p != buf + minwidth; ++p)
+					*p = ' ';
+			} else {
 				/* print the selection, name and state of the flag */
 				char prefix[2]  = { 0, 0 };
 				char postfix[2] = { 0, 0 };
@@ -263,17 +281,20 @@ static int drawflag(sFlag* flag, bool highlight)
 					/* distance */
 					(int)(minwidth - postlen - strlen(flag->name)), " ");
 					// At this point buf is filled up to minwidth
+				hasHead = true;
 			} // End of generating left side mask display
 
 			/* Display flag state
 			 * The order in which the states are to be displayed is:
-			 * 1. make.defaults
-			 * 2. package.use
-			 * 3. make.conf
-			 * 4. global/local
-			 * 5. installed/not installed
+			 * 1. Masked/Forced special hint
+			 * 2. make.defaults
+			 * 3. package.use
+			 * 4. make.conf
+			 * 5. global/local
+			 * 6. installed/not installed
 			 */
-			sprintf(buf + minwidth, " %c%c%c %c%c ",
+			sprintf(buf + minwidth, "%c %c%c%c %c%c ",
+				special,
 				flag->stateDefault,
 				flag->desc[idx].statePackage,
 				flag->stateConf,
@@ -292,9 +313,7 @@ static int drawflag(sFlag* flag, bool highlight)
 				sprintf(desc, "%s", flag->desc[idx].desc);
 
 			// Now display the description line according to its horizontal position
-			sprintf(buf + minwidth + 8, "%-*.*s",
-				wWidth(List)-minwidth - 8,
-				wWidth(List)-minwidth - 8,
+			sprintf(buf + minwidth + 9, "%-*.*s", descLen, descLen,
 				strlen(desc) > (size_t)descriptionleft
 					? &desc[descriptionleft]
 					: "");
@@ -307,16 +326,11 @@ static int drawflag(sFlag* flag, bool highlight)
 
 			// Finally put the line on the screen
 			mvwaddstr(win(List), line, 0, buf);
-			mvwaddch(win(List), line, minwidth,     ACS_VLINE); // Before state
-			mvwaddch(win(List), line, minwidth + 4, ACS_VLINE); // Between state and scope
-			mvwaddch(win(List), line, minwidth + 7, ACS_VLINE); // After scope
+			mvwaddch(win(List), line, minwidth + 1, ACS_VLINE); // Before state
+			mvwaddch(win(List), line, minwidth + 5, ACS_VLINE); // Between state and scope
+			mvwaddch(win(List), line, minwidth + 8, ACS_VLINE); // After scope
 			++line;
 			++usedY;
-			if(((idx + 1) < flag->ndesc) && (line < lHeight) ) {
-				char *p;
-				for(p = buf; p != buf + minwidth; p++)
-					*p = ' ';
-			}
 		}
 	} else {
 		memset(buf+minwidth, ' ', wWidth(List)-minwidth);

diff --git a/ufed-curses.c b/ufed-curses.c
index d14cd38..0c3fd56 100644
--- a/ufed-curses.c
+++ b/ufed-curses.c
@@ -141,9 +141,9 @@ void drawBottom(bool withSep)
 	waddch(w, ACS_LLCORNER);
 	whline(w, ACS_HLINE, wWidth(Bottom)-6);
 	if (withSep) {
-		mvwaddch(w, 0, minwidth + 3, ACS_BTEE); // Before state
-		mvwaddch(w, 0, minwidth + 7, ACS_BTEE); // Between state and scope
-		mvwaddch(w, 0, minwidth + 10, ACS_BTEE); // After scope
+		mvwaddch(w, 0, minwidth + 4, ACS_BTEE); // Before state
+		mvwaddch(w, 0, minwidth + 8, ACS_BTEE); // Between state and scope
+		mvwaddch(w, 0, minwidth + 11, ACS_BTEE); // After scope
 	}
 	mvwaddch(w, 0, wWidth(Bottom)-3, ACS_LRCORNER);
 	waddch(w, ' ');
@@ -304,10 +304,12 @@ void drawStatus(bool withSep)
 		char buf[COLS+1];
 
 		// Add Status separators and explenation characters
-		mvwaddstr(w, 0, minwidth, " DPC Si");
-		mvwaddch(w, 0, minwidth,     ACS_VLINE); // Before state
-		mvwaddch(w, 0, minwidth + 4, ACS_VLINE); // Between state and scope
-		mvwaddch(w, 0, minwidth + 7, ACS_VLINE); // After scope
+		mvwaddch (w, 0, minwidth,     'M');       // Masked / Forced
+		mvwaddch (w, 0, minwidth + 1, ACS_VLINE); // Before state
+		mvwaddstr(w, 0, minwidth + 2, "DPC");     // Default, Package, Config
+		mvwaddch (w, 0, minwidth + 5, ACS_VLINE); // Between state and scope
+		mvwaddstr(w, 0, minwidth + 6, "Si");      // Scope, installed
+		mvwaddch (w, 0, minwidth + 8, ACS_VLINE); // After scope
 
 		// Use the unused right side to show the filter status
 		sprintf(buf, "%-*s%-6s / %-6s / %-12s] ",
@@ -364,9 +366,9 @@ void drawTop(bool withSep)
 	waddch(w, ACS_ULCORNER);
 	whline(w, ACS_HLINE, wWidth(Top)-6);
 	if (withSep) {
-		mvwaddch(w, 4, minwidth + 3, ACS_TTEE); // Before state
-		mvwaddch(w, 4, minwidth + 7, ACS_TTEE); // Between state and scope
-		mvwaddch(w, 4, minwidth + 10, ACS_TTEE); // After scope
+		mvwaddch(w, 4, minwidth + 4, ACS_TTEE); // Before state
+		mvwaddch(w, 4, minwidth + 8, ACS_TTEE); // Between state and scope
+		mvwaddch(w, 4, minwidth + 11, ACS_TTEE); // After scope
 	}
 	mvwaddch(w, 4, wWidth(Top)-3, ACS_URCORNER);
 	waddch(w, ' ');


^ permalink raw reply related	[flat|nested] 238+ messages in thread
* [gentoo-commits] proj/ufed:master commit in: /
@ 2013-02-01 21:12 Sven Eden
  0 siblings, 0 replies; 238+ messages in thread
From: Sven Eden @ 2013-02-01 21:12 UTC (permalink / raw
  To: gentoo-commits

commit:     8b70cd015e891fcca7c2478f45e730223a54f97b
Author:     Sven Eden <sven.eden <AT> gmx <DOT> de>
AuthorDate: Fri Feb  1 21:13:34 2013 +0000
Commit:     Sven Eden <sven.eden <AT> gmx <DOT> de>
CommitDate: Fri Feb  1 21:13:34 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/ufed.git;a=commit;h=8b70cd01

Unified display of masked and forced flags. Only flags that are fully forced or masked are bracketed now. This should clarify some confusion about what can be changed and what can't.

---
 ufed-curses-checklist.c |   30 ++++++++++--------------------
 1 files changed, 10 insertions(+), 20 deletions(-)

diff --git a/ufed-curses-checklist.c b/ufed-curses-checklist.c
index 31a2294..f8a5ec4 100644
--- a/ufed-curses-checklist.c
+++ b/ufed-curses-checklist.c
@@ -236,19 +236,17 @@ static int drawflag(sFlag* flag, bool highlight)
 		int  lHeight = wHeight(List);
 		int  descLen = wWidth(List) - (minwidth + 9);
 		bool hasHead = false;
-		char special = ' ';
-		char *p;
+		char *p, special;
+
 		for( ; (idx < flag->ndesc) && (line < lHeight); ++idx) {
 			// Continue if any of the filters apply:
 			if (!isDescLegal(flag, idx))
 				continue;
 
 			// Set special character if needed:
-			if ( (flag->globalForced && ('-' != flag->desc[idx].stateForced))
-			  || isDescForced(flag, idx))
+			if (isDescForced(flag, idx))
 				special = 'F';
-			else if ( (flag->globalMasked && ('-' != flag->desc[idx].stateMasked))
-				   || isDescMasked(flag, idx))
+			else if (isDescMasked(flag, idx))
 				special = 'M';
 			else
 				special = ' ';
@@ -259,27 +257,19 @@ static int drawflag(sFlag* flag, bool highlight)
 					*p = ' ';
 			} else {
 				/* print the selection, name and state of the flag */
-				char prefix[2]  = { 0, 0 };
-				char postfix[2] = { 0, 0 };
-				int  postlen    = 5;
-				if (isDescForced(flag, idx)) {
-					prefix[0]  = '+';
-					postfix[0] = '+';
-					postlen    = 3;
-				} else if (isDescMasked(flag, idx)) {
-					prefix[0]  = '(';
-					postfix[0] = ')';
-					postlen    = 3;
-				}
 				sprintf(buf, " %c%c%c %s%s%s%-*s ",
 					/* State of selection */
 					flag->stateConf == ' ' ? '(' : '[',
 					flag->stateConf,
 					flag->stateConf == ' ' ? ')' : ']',
 					/* name */
-					prefix, flag->name, postfix,
+					flag->globalForced ? "(+" : flag->globalMasked ? "(" : "",
+					flag->name,
+					(flag->globalForced || flag->globalMasked) ? ")" : "",
 					/* distance */
-					(int)(minwidth - postlen - strlen(flag->name)), " ");
+					(int)(minwidth
+						- (flag->globalForced ? 2 : flag->globalMasked ? 3 : 5)
+						- strlen(flag->name)), " ");
 					// At this point buf is filled up to minwidth
 				hasHead = true;
 			} // End of generating left side mask display


^ permalink raw reply related	[flat|nested] 238+ messages in thread
* [gentoo-commits] proj/ufed:master commit in: /
@ 2013-02-01 21:12 Sven Eden
  0 siblings, 0 replies; 238+ messages in thread
From: Sven Eden @ 2013-02-01 21:12 UTC (permalink / raw
  To: gentoo-commits

commit:     a28c1903b8bb0f87947fc3bc6f11531527cd1d0a
Author:     Sven Eden <sven.eden <AT> gmx <DOT> de>
AuthorDate: Fri Feb  1 18:46:12 2013 +0000
Commit:     Sven Eden <sven.eden <AT> gmx <DOT> de>
CommitDate: Fri Feb  1 18:46:12 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/ufed.git;a=commit;h=a28c1903

Added checks against forced status to isDescLegal(), because there are some flags that are forced but explicitly unmasked (like "multilib"). Those are still not changeable, because of the enforcement.

---
 ufed-curses-types.c |   22 +++++++++++++++-------
 1 files changed, 15 insertions(+), 7 deletions(-)

diff --git a/ufed-curses-types.c b/ufed-curses-types.c
index c80b9dd..0d31300 100644
--- a/ufed-curses-types.c
+++ b/ufed-curses-types.c
@@ -321,14 +321,22 @@ bool isDescLegal (const sFlag* flag, int idx)
 
 	if (flag && (idx < flag->ndesc)) {
 		if ( // 1.: Check isGlobal versus e_scope
-			 ( ( flag->desc[idx].isGlobal && e_scope != eScope_local)
-			|| (!flag->desc[idx].isGlobal && e_scope != eScope_global) )
+			 ( ( flag->desc[idx].isGlobal && (e_scope != eScope_local))
+			|| (!flag->desc[idx].isGlobal && (e_scope != eScope_global)) )
 			 // 2.: Check isInstalled versus e_state
-		  && ( ( flag->desc[idx].isInstalled && e_state != eState_notinstalled)
-			|| (!flag->desc[idx].isInstalled && e_state != eState_installed) )
-			 // 3.: Check stateMasked versus e_mask
-		  && ( (('+' == flag->desc[idx].stateMasked) && e_mask != eMask_unmasked)
-			|| (('+' != flag->desc[idx].stateMasked) && e_mask != eMask_masked) ) )
+		  && ( ( flag->desc[idx].isInstalled && (e_state != eState_notinstalled))
+			|| (!flag->desc[idx].isInstalled && (e_state != eState_installed)) )
+			 // 3.: Check stateForced/stateMasked versus e_mask
+		  && ( ( (e_mask != eMask_unmasked)
+			  && ( (flag->globalMasked && ('-' != flag->desc[idx].stateMasked))
+				|| ('+' == flag->desc[idx].stateMasked)
+			    || (flag->globalForced && ('-' != flag->desc[idx].stateForced))
+				|| ('+' == flag->desc[idx].stateForced) ) )
+		    || ( (e_mask != eMask_masked)
+			  && ( (!flag->globalMasked && ('+' != flag->desc[idx].stateMasked))
+				|| ('-' == flag->desc[idx].stateMasked) )
+			  && ( (!flag->globalForced && ('+' != flag->desc[idx].stateForced))
+				|| ('-' == flag->desc[idx].stateForced) ) ) ) )
 			result = true;
 	}
 


^ permalink raw reply related	[flat|nested] 238+ messages in thread
* [gentoo-commits] proj/ufed:master commit in: /
@ 2013-02-01 16:04 Sven Eden
  0 siblings, 0 replies; 238+ messages in thread
From: Sven Eden @ 2013-02-01 16:04 UTC (permalink / raw
  To: gentoo-commits

commit:     2f1a81c1873ba4b465fcacb9853368bca1e9f431
Author:     Sven Eden <sven.eden <AT> gmx <DOT> de>
AuthorDate: Fri Feb  1 16:05:14 2013 +0000
Commit:     Sven Eden <sven.eden <AT> gmx <DOT> de>
CommitDate: Fri Feb  1 16:05:14 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/ufed.git;a=commit;h=2f1a81c1

Fixed the (deprecated) usage of ::eprefix - it is now ::EPREFIX.

---
 Portage.pm |   40 ++++++++++++++++++++--------------------
 ufed.pl.in |    4 ++--
 2 files changed, 22 insertions(+), 22 deletions(-)

diff --git a/Portage.pm b/Portage.pm
index 1d7a800..cd32f8b 100644
--- a/Portage.pm
+++ b/Portage.pm
@@ -44,10 +44,10 @@ our $use_flags;
 
 # $used_make_conf - path of the used make.conf
 our $used_make_conf = "";
+our $EPREFIX        = "";
 
 # --- private members ---
 my %_environment  = ();
-my $_EPREFIX      = "";
 my @_profiles     = ();
 # $_use_temp - hashref that represents the current state of
 # all known flags. This is for data gathering, the public
@@ -208,13 +208,13 @@ sub _add_temp
 
 
 # Determine the value for EPREFIX and save it
-# in $_EPREFIX. This is done using 'portageq'.
+# in $EPREFIX. This is done using 'portageq'.
 # Other output from portageq is printed on
 # STDERR.
 # No parameters accepted.
 sub _determine_eprefix {
 	my $tmp = "/tmp/ufed_$$.tmp";
-	$_EPREFIX = qx{portageq envvar EPREFIX 2>$tmp};
+	$EPREFIX = qx{portageq envvar EPREFIX 2>$tmp};
 	die "Couldn't determine EPREFIX from Portage" if $? != 0;
 
 	if ( -s $tmp ) {
@@ -225,7 +225,7 @@ sub _determine_eprefix {
 	}
 	-e $tmp and unlink $tmp;
 
-	chomp($_EPREFIX);
+	chomp($EPREFIX);
 	return;
 }
 
@@ -234,9 +234,9 @@ sub _determine_eprefix {
 # and save the result in $used_make_conf
 sub _determine_make_conf
 {
-	$used_make_conf = "${_EPREFIX}/etc/portage/make.conf";
+	$used_make_conf = "${EPREFIX}/etc/portage/make.conf";
 	(! -r $used_make_conf)
-		and $used_make_conf = "${_EPREFIX}/etc/make.conf";
+		and $used_make_conf = "${EPREFIX}/etc/make.conf";
 	return; 
 }
 
@@ -247,13 +247,13 @@ sub _determine_make_conf
 # No parameters accepted.
 sub _determine_profiles
 {
-	my $mp = readlink "${_EPREFIX}/etc/portage/make.profile";
+	my $mp = readlink "${EPREFIX}/etc/portage/make.profile";
 	defined($mp)
-		or $mp = readlink "${_EPREFIX}/etc/make.profile";
+		or $mp = readlink "${EPREFIX}/etc/make.profile";
 
 	# make.profile is mandatory and must be a link
 	defined($mp)
-		or die "${_EPREFIX}/etc\{,/portage\}/make.profile is not a symlink\n";
+		or die "${EPREFIX}/etc\{,/portage\}/make.profile is not a symlink\n";
 
 	# Start with the linked path, it is the deepest profile child.
 	@_profiles = _norm_path('/etc', $mp);
@@ -306,7 +306,7 @@ sub _gen_use_flags
 		my %descCons = ();
 		my $flagRef  = $_use_temp->{$flag}; ## Shortcut
 		my $hasGlobal= defined($flagRef->{global}) ? 1 : 0;
-		my $lCount   = ($hasGlobal && length($flagRef->{global}{desc})) ? 1 : 0;
+		my $lCount   = ($hasGlobal && length($flagRef->{global}{descr})) ? 1 : 0;
 		my $gDesc    = "";
 		my $gKey     = "";
 		my $gRef     = $flagRef->{global};
@@ -518,8 +518,8 @@ sub _read_descriptions
 # overrides.
 # No parameters accepted.
 sub _read_make_conf {
-	my %oldEnv = _read_sh("${_EPREFIX}/etc/make.conf");
-	my %newEnv = _read_sh("${_EPREFIX}/etc/portage/make.conf");
+	my %oldEnv = _read_sh("${EPREFIX}/etc/make.conf");
+	my %newEnv = _read_sh("${EPREFIX}/etc/portage/make.conf");
 	_merge (\%oldEnv, \%newEnv);
 
 	# Note the conf state of the read flags:
@@ -539,8 +539,8 @@ sub _read_make_conf {
 		and push @_profiles,
 				map { my $x=$_; $x =~ s/^\s*(\S+)\s*$/$1\/profiles/mg ; $x }
 				split('\n', $_environment{PORTDIR_OVERLAY});
-	-e "${_EPREFIX}/etc/portage/profile"
-		and push @_profiles, "${_EPREFIX}/etc/portage/profile";
+	-e "${EPREFIX}/etc/portage/profile"
+		and push @_profiles, "${EPREFIX}/etc/portage/profile";
 	return;
 }
 
@@ -575,7 +575,7 @@ sub _read_make_defaults {
 # get the final "PORTDIR" and "USE_ORDER"
 # No parameters accepted
 sub _read_make_globals {
-	for my $dir(@_profiles, "${_EPREFIX}/usr/share/portage/config") {
+	for my $dir(@_profiles, "${EPREFIX}/usr/share/portage/config") {
 		_read_sh("$dir/make.globals");
 	}
 	return;
@@ -588,14 +588,14 @@ sub _read_make_globals {
 # No parameters accepted.
 sub _read_packages {
 	my $pkgdir = undef;
-	opendir($pkgdir, "${_EPREFIX}/var/db/pkg")
-		or die "Couldn't read ${_EPREFIX}/var/db/pkg\n";
+	opendir($pkgdir, "${EPREFIX}/var/db/pkg")
+		or die "Couldn't read ${EPREFIX}/var/db/pkg\n";
 		
 	# loop through all categories in pkgdir
 	while(my $cat = readdir $pkgdir) {
 		next if $cat eq '.' or $cat eq '..';
 		my $catdir = undef;
-		opendir($catdir, "${_EPREFIX}/var/db/pkg/$cat")
+		opendir($catdir, "${EPREFIX}/var/db/pkg/$cat")
 			or next;
 
 		# loop through all openable directories in cat
@@ -621,7 +621,7 @@ sub _read_packages {
 			#}
 			
 			# Load IUSE to learn which use flags the package in this version knows
-			my $fiuse = "${_EPREFIX}/var/db/pkg/$cat/$pkg/IUSE";
+			my $fiuse = "${EPREFIX}/var/db/pkg/$cat/$pkg/IUSE";
 			if(open my $use, '<', $fiuse) {
 				local $/;
 				@iuse = split ' ', <$use>;
@@ -629,7 +629,7 @@ sub _read_packages {
 			}
 
 			# Load PKGUSE to learn which use flags have been set when this package was emerged
-			my $fpuse = "${_EPREFIX}/var/db/pkg/$cat/$pkg/PKGUSE";
+			my $fpuse = "${EPREFIX}/var/db/pkg/$cat/$pkg/PKGUSE";
 			if(open my $use, '<', $fpuse) {
 				local $/;
 				@puse = split ' ', <$use>;

diff --git a/ufed.pl.in b/ufed.pl.in
index d31b1b1..e9f4f27 100644
--- a/ufed.pl.in
+++ b/ufed.pl.in
@@ -167,8 +167,8 @@ sub save_flags {
 
 	my $contents;
 
-	my $makeconf_name = "$Portage::eprefix/etc/portage/make.conf";
-	$makeconf_name = "$Portage::eprefix/etc/make.conf" unless(-r $makeconf_name);
+	my $makeconf_name = "$Portage::EPREFIX/etc/portage/make.conf";
+	$makeconf_name = "$Portage::EPREFIX/etc/make.conf" unless(-r $makeconf_name);
 	{
 		open my $makeconf, '<', $makeconf_name or die "Couldn't open $makeconf_name\n";
 		open my $makeconfold, '>', $makeconf_name . '.old' or die "Couldn't open $makeconf_name.old\n";


^ permalink raw reply related	[flat|nested] 238+ messages in thread
* [gentoo-commits] proj/ufed:master commit in: /
@ 2013-02-01 15:55 Sven Eden
  0 siblings, 0 replies; 238+ messages in thread
From: Sven Eden @ 2013-02-01 15:55 UTC (permalink / raw
  To: gentoo-commits

commit:     1918d93f84127f9ba2142e7d03ec0d38b2705d10
Author:     Sven Eden <sven.eden <AT> gmx <DOT> de>
AuthorDate: Fri Feb  1 15:55:58 2013 +0000
Commit:     Sven Eden <sven.eden <AT> gmx <DOT> de>
CommitDate: Fri Feb  1 15:55:58 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/ufed.git;a=commit;h=1918d93f

Fixed a bug that caused ufed to "forget" all enabled flags from make.conf if the flag had only local descriptions.

---
 Portage.pm |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/Portage.pm b/Portage.pm
index 933d4d1..1d7a800 100644
--- a/Portage.pm
+++ b/Portage.pm
@@ -172,7 +172,7 @@ sub _add_flag
 		} else {
 			%{$use_flags->{$flag}{"local"}{$pkg}} = %data;
 		}
-		++$use_flags->{$flag}{count};
+		++$use_flags->{$flag}{count} if (length($descr));
 
 
 	} else {
@@ -198,6 +198,7 @@ sub _add_temp
 		defined ($_use_temp->{$flag}{global})
 			or %{$_use_temp->{$flag}{global}} = %$_use_template;
 	} else {
+		_add_temp($flag, "global"); ## This must exist!
 		defined ($_use_temp->{$flag}{"local"}{$pkg})
 			or %{$_use_temp->{$flag}{"local"}{$pkg}} = %$_use_template;
 	}
@@ -304,8 +305,8 @@ sub _gen_use_flags
 	for my $flag (keys %$_use_temp) {
 		my %descCons = ();
 		my $flagRef  = $_use_temp->{$flag}; ## Shortcut
-		my $hasGlobal= (defined($flagRef->{global}) && length($flagRef->{global}{descr})) ? 1 : 0;
-		my $lCount   = $hasGlobal;
+		my $hasGlobal= defined($flagRef->{global}) ? 1 : 0;
+		my $lCount   = ($hasGlobal && length($flagRef->{global}{desc})) ? 1 : 0;
 		my $gDesc    = "";
 		my $gKey     = "";
 		my $gRef     = $flagRef->{global};
@@ -523,7 +524,6 @@ sub _read_make_conf {
 
 	# Note the conf state of the read flags:
 	for my $flag ( keys %{$oldEnv{USE}}) {
-
 		_add_temp($flag, "global");
 
 		$oldEnv{USE}{$flag}


^ permalink raw reply related	[flat|nested] 238+ messages in thread
* [gentoo-commits] proj/ufed:master commit in: /
@ 2013-02-01 15:26 Sven Eden
  0 siblings, 0 replies; 238+ messages in thread
From: Sven Eden @ 2013-02-01 15:26 UTC (permalink / raw
  To: gentoo-commits

commit:     9d9098764e8d6f52ed506d500c061bb9878a62c8
Author:     Sven Eden <sven.eden <AT> gmx <DOT> de>
AuthorDate: Fri Feb  1 15:27:43 2013 +0000
Commit:     Sven Eden <sven.eden <AT> gmx <DOT> de>
CommitDate: Fri Feb  1 15:27:43 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/ufed.git;a=commit;h=9d909876

Added a post-load analyzation to make use flags, that have only local descriptions which are all masked and/or forced unchangeable.

---
 ufed-curses-checklist.c |    3 ++-
 ufed-curses-types.c     |   44 ++++++++++++++++++++++++++++++++++++++++++++
 ufed-curses-types.h     |    1 +
 3 files changed, 47 insertions(+), 1 deletions(-)

diff --git a/ufed-curses-checklist.c b/ufed-curses-checklist.c
index c8ccd65..c28a824 100644
--- a/ufed-curses-checklist.c
+++ b/ufed-curses-checklist.c
@@ -169,7 +169,8 @@ static void read_flags(void)
 			++lineNum;
 		} // loop through description lines
 
-		// Add line data to the list stats
+		// Update flag states and add data to the list stats
+		genFlagStats(newFlag);
 		addLineStats(newFlag, &listStats);
 	} // loop while input given
 

diff --git a/ufed-curses-types.c b/ufed-curses-types.c
index 7b208fa..c80b9dd 100644
--- a/ufed-curses-types.c
+++ b/ufed-curses-types.c
@@ -224,6 +224,50 @@ void destroyFlag (sFlag** root, sFlag** flag)
 }
 
 
+/** @brief generate globalMasked and globalForced
+ * This function checks whether either the first global description,
+ * or all local descriptions with no available global description of
+ * a flag is/are masked and/or forced and sets the global states
+ * accordingly.
+ * @param[in,out] flag pointer to the flag to check
+ */
+void genFlagStats (sFlag* flag)
+{
+	if (flag) {
+		bool hasLocal       = false;
+		bool hasGlobal      = false;
+		bool allLocalMasked = true;
+		bool allLocalForced = true;
+		for (int i = 0;
+			(!hasGlobal || allLocalMasked || allLocalForced)
+				&& (i < flag->ndesc)
+			; ++i) {
+			if (flag->desc[i].isGlobal) {
+				hasGlobal = true;
+				if ('+' == flag->desc[i].stateForced)
+					flag->globalForced = true;
+				if ('+' == flag->desc[i].stateMasked)
+					flag->globalMasked = true;
+			} else {
+				hasLocal = true;
+				if ('+' != flag->desc[i].stateForced)
+					allLocalForced = false;
+				if ('+' != flag->desc[i].stateMasked)
+					allLocalMasked = false;
+			}
+		}
+
+		// Now if there is no global description,
+		// the "global" settings are taken from the
+		// local ones.
+		if (!hasGlobal && hasLocal) {
+			flag->globalForced = allLocalForced;
+			flag->globalMasked = allLocalMasked;
+		}
+	}
+}
+
+
 /** @brief determine the number of lines used by @a flag
  *  This method checks the flag and its description line(s)
  *  settings against the globally active filters.

diff --git a/ufed-curses-types.h b/ufed-curses-types.h
index cb02e85..4c55532 100644
--- a/ufed-curses-types.h
+++ b/ufed-curses-types.h
@@ -166,6 +166,7 @@ sFlag* addFlag      (sFlag** root, const char* name, int line, int ndesc, const
 size_t addFlagDesc  (sFlag* flag, const char* pkg, const char* desc, const char state[5]);
 void   addLineStats (const sFlag* flag, sListStats* stats);
 void   destroyFlag  (sFlag** root, sFlag** flag);
+void   genFlagStats (sFlag* flag);
 int    getFlagHeight(const sFlag* flag);
 bool   isDescForced (const sFlag* flag, int idx);
 bool   isDescLegal  (const sFlag* flag, int idx);


^ permalink raw reply related	[flat|nested] 238+ messages in thread
* [gentoo-commits] proj/ufed:master commit in: /
@ 2013-02-01 14:49 Sven Eden
  0 siblings, 0 replies; 238+ messages in thread
From: Sven Eden @ 2013-02-01 14:49 UTC (permalink / raw
  To: gentoo-commits

commit:     73e577ca86f95532333ce0a335fa96bed2cc5b7b
Author:     Sven Eden <sven.eden <AT> gmx <DOT> de>
AuthorDate: Fri Feb  1 14:50:27 2013 +0000
Commit:     Sven Eden <sven.eden <AT> gmx <DOT> de>
CommitDate: Fri Feb  1 14:50:27 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/ufed.git;a=commit;h=73e577ca

Fixed F-Key descriptions

---
 ufed-curses-checklist.c |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/ufed-curses-checklist.c b/ufed-curses-checklist.c
index d9f3067..c8ccd65 100644
--- a/ufed-curses-checklist.c
+++ b/ufed-curses-checklist.c
@@ -26,9 +26,9 @@ static const sKey keys[] = {
 	{ '\033',   mkKey("Cancel (Esc)")        },
 	{ -1,       mkKey("Display (")           },
 	{ KEY_F(5), mkKey("Mask (F5)")           },
-	{ KEY_F(6), mkKey("Local/Global (F7)")   },
-	{ KEY_F(7), mkKey("Installed (F8)")      },
-	{ KEY_F(8), mkKey("Order (F6)")          },
+	{ KEY_F(6), mkKey("Local/Global (F6)")   },
+	{ KEY_F(7), mkKey("Installed (F7)")      },
+	{ KEY_F(8), mkKey("Order (F8)")          },
 	{ -1,       mkKey(")")                   },
 	{ '\0',     mkKey("")                    }
 };
@@ -335,6 +335,7 @@ static int callback(sFlag** curr, int key)
 	WINDOW* wInp = win(Input);
 	WINDOW* wLst = win(List);
 	size_t  fLen = 0;
+
 	if ( fayt[0]
 	  && (key != KEY_BACKSPACE)
 	  && (key != KEY_DC)


^ permalink raw reply related	[flat|nested] 238+ messages in thread
* [gentoo-commits] proj/ufed:master commit in: /
@ 2013-02-01 10:49 Sven Eden
  0 siblings, 0 replies; 238+ messages in thread
From: Sven Eden @ 2013-02-01 10:49 UTC (permalink / raw
  To: gentoo-commits

commit:     da9fd3adf9e5aa3c3b8f99aa99535ab95efd9e2f
Author:     Sven Eden <sven.eden <AT> gmx <DOT> de>
AuthorDate: Thu Jan 31 18:24:58 2013 +0000
Commit:     Sven Eden <sven.eden <AT> gmx <DOT> de>
CommitDate: Thu Jan 31 18:24:58 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/ufed.git;a=commit;h=da9fd3ad

Changed ufed-curses.c to support the new data model and added the implementation of the new drawing functions.

---
 ufed-curses.c |  756 ++++++++++++++++++++++++++++++---------------------------
 1 files changed, 403 insertions(+), 353 deletions(-)

diff --git a/ufed-curses.c b/ufed-curses.c
index f45b8e3..bc55ca1 100644
--- a/ufed-curses.c
+++ b/ufed-curses.c
@@ -6,61 +6,47 @@
 #include <unistd.h>
 #include <locale.h>
 
-/* internal types */
-struct window window[wCount] = {
-	{ NULL,  0,  0,  5,  0 }, /* Top       */
-	{ NULL,  5,  0, -8,  3 }, /* Left      */
-	{ NULL,  5,  3, -9, -6 }, /* List      */
-	{ NULL, -4,  3,  1, -6 }, /* Input     */
-	{ NULL,  5, -3, -8,  1 }, /* Scrollbar */
-	{ NULL,  5, -2, -8,  2 }, /* Right     */
-	{ NULL, -3,  0,  3,  0 }, /* Bottom    */
-};
-
-
 /* internal members */
-static const char *subtitle;
-static const struct key *keys;
-static struct item *items, *currentitem;
+static const char* subtitle = NULL;
+static const sKey* keys     = NULL;
+static sFlag* currentflag   = NULL;
+static sFlag* flags         = NULL;
+
 // Needed for the scrollbar and its mouse events
 static int listHeight, barStart, barEnd, dispStart, dispEnd;
 
 
 /* external members */
-int topline, bottomline, minwidth;
-extern enum mask showMasked;
-extern enum order pkgOrder;
-extern enum scope showScope;
-extern int lineCountGlobal;
-extern int lineCountGlobalInstalled;
-extern int lineCountLocal;
-extern int lineCountLocalInstalled;
-extern int lineCountMasked;
-extern int lineCountMaskedInstalled;
-extern int lineCountMasked;
+sWindow window[wCount] = {
+	{ NULL,  0,  0,  5,  0 }, /* Top       --- Top ---- */
+	{ NULL,  5,  0, -8,  3 }, /* Left      L+------+S|R */
+	{ NULL,  5,  3, -9, -6 }, /* List      E|      |c|i */
+	{ NULL, -4,  3,  1, -6 }, /* Input     F| List |r|g */
+	{ NULL,  5, -3, -8,  1 }, /* Scrollbar T|______|B|h */
+	{ NULL,  5, -2, -8,  2 }, /* Right     |+Input-+r|t */
+	{ NULL, -3,  0,  3,  0 }, /* Bottom    ---Bottom--- */
+};
+int topline = 0, bottomline = 0, minwidth = 0;
+extern eMask e_mask;
+extern eOrder e_order;
+extern eScope e_scope;
+extern eState e_state;
+extern sListStats listStats;
 
 
 /* internal prototypes */
-int (*callback)(struct item **, int);
-int (*drawitem)(struct item *, bool);
+static int (*callback)(sFlag**, int);
+static int (*drawflag)(sFlag*, bool);
 void checktermsize(void);
-void draw(void);
-void drawscrollbar(void);
+void draw(bool withSep);
+void drawScrollbar(void);
 int  getListHeight(void);
-void resetDisplay(void);
+void resetDisplay(bool withSep);
 void setNextItem(int count, bool strict);
 void setPrevItem(int count, bool strict);
 
 
 /* internal functions */
-/** @brief return the number of lines the full item display needs
-**/
-int getItemHeight(struct item *item)
-{
-	// TODO : Add filtering and possible line break
-	return item->ndescr;
-}
-
 
 /** @brief get the sum of lines the list holds respecting current filtering
 **/
@@ -68,19 +54,28 @@ int getListHeight()
 {
 	int result = 0;
 
-	if (show_unmasked != showMasked) {
-		// TODO : add installed/not installed filter
-		result += lineCountMasked + lineCountMaskedInstalled;
+	// Add masked lines
+	if (eMask_masked != e_mask) {
+		if (eState_installed != e_state)
+			result += listStats.lineCountMasked;
+		if (eState_notinstalled != e_state)
+			result += listStats.lineCountMaskedInstalled;
 	}
-	if (show_masked != showMasked) {
-		if (show_global != showScope) {
-			// TODO : add installed/not installed filter
-			result += lineCountLocal + lineCountLocalInstalled;
-		}
-		if (show_local != showScope) {
-			// TODO : add installed/not installed filter
-			result += lineCountGlobal + lineCountGlobalInstalled;
-		}
+
+	// Add global lines
+	if (eScope_local != e_scope) {
+		if (eState_installed != e_state)
+			result += listStats.lineCountGlobal;
+		if (eState_notinstalled != e_state)
+			result += listStats.lineCountGlobalInstalled;
+	}
+
+	// Add local lines
+	if (eScope_global != e_scope) {
+		if (eState_installed != e_state)
+			result += listStats.lineCountLocal;
+		if (eState_notinstalled != e_state)
+			result += listStats.lineCountLocalInstalled;
 	}
 
 	return result;
@@ -103,14 +98,14 @@ void initcurses() {
 	mousemask(BUTTON1_CLICKED | BUTTON1_DOUBLE_CLICKED | BUTTON1_PRESSED | BUTTON1_RELEASED, NULL);
 #endif
 	checktermsize();
-	{ enum win w; for(w = (enum win) 0; w != wCount; w++) {
+	{ eWin w; for(w = (eWin) 0; w != wCount; w++) {
 		window[w].win = newwin(wHeight(w), wWidth(w), wTop(w), wLeft(w));
 	} }
 }
 
 void cursesdone() {
-	enum win w;
-	for(w = (enum win) 0; w != wCount; w++)
+	eWin w;
+	for(w = (eWin) 0; w != wCount; w++)
 		delwin(window[w].win);
 	endwin();
 }
@@ -124,77 +119,142 @@ void checktermsize() {
 		mvaddstr(0, 0, "Your screen is too small. Press Ctrl+C to exit.");
 		while(getch()!=KEY_RESIZE) {}
 #else
-		cursesdone();
-		fputs("Your screen is too small.\n", stderr);
-		exit(-1);
+		ERROR_EXIT(-1, "The following error occurred:\n\"%2\n\"",
+			"Your screen is too small.\n")
 #endif
 	}
 }
 
-void drawitems() {
+
+/** @brief redraw Bottom with or without status separators
+ *  The window is not fully refreshed!
+ *  @param withSep Draw status separators and filter status if true.
+ */
+void drawBottom(bool withSep)
+{
+	WINDOW* w = win(Bottom);
+
+	wattrset(w, COLOR_PAIR(2) | A_BOLD);
+	mvwaddch(w, 0, 0, ACS_VLINE);
+	wattrset(w, COLOR_PAIR(3));
+	waddch(w, ' ');
+	waddch(w, ACS_LLCORNER);
+	whline(w, ACS_HLINE, wWidth(Bottom)-6);
+	if (withSep) {
+		mvwaddch(w, 0, minwidth + 3, ACS_BTEE); // Before state
+		mvwaddch(w, 0, minwidth + 7, ACS_BTEE); // Between state and scope
+		mvwaddch(w, 0, minwidth + 10, ACS_BTEE); // After scope
+	}
+	mvwaddch(w, 0, wWidth(Bottom)-3, ACS_LRCORNER);
+	waddch(w, ' ');
+	wattrset(w, COLOR_PAIR(2) | A_BOLD);
+	waddch(w, ACS_VLINE);
+
+	waddch(w, ACS_VLINE);
+	wattrset(w, COLOR_PAIR(3));
+	if (keys) {
+		char buf[COLS + 1];
+		char *p = buf;
+		const sKey* key;
+		const size_t maxAdr = (const size_t)(buf+wWidth(Bottom)-3);
+		*p++ = ' ';
+		for(key=keys; key->key!='\0'; key++) {
+			size_t n = maxAdr - (size_t)p;
+			if(n > key->length)
+				n = key->length;
+			memcpy(p, key->descr, n);
+			p += n;
+			if ((size_t)p == maxAdr)
+				break;
+			*p++ = ' ';
+		}
+		memset(p, ' ', maxAdr + 1 - (size_t)p);
+		buf[wWidth(Bottom)-2] = '\0';
+		waddstr(w, buf);
+	} else
+		whline(w, ' ', wWidth(Bottom) - 3);
+
+	wattrset(w, COLOR_PAIR(2) | A_BOLD);
+	waddch(w, ACS_VLINE);
+
+	waddch(w, ACS_LLCORNER);
+	whline(w, ACS_HLINE, wWidth(Bottom)-2);
+	mvwhline(w, 2, wWidth(Bottom)-1, ACS_LRCORNER, 1);
+
+	wnoutrefresh(w);
+}
+
+
+void drawFlags() {
+	int lHeight = wHeight(List);
+
 	/* this method must not be called if the current
 	 * item is not valid.
 	 */
-	if (!isLegalItem(currentitem))
+	if (!isFlagLegal(currentflag))
 		ERROR_EXIT(-1,
-			"drawitems() must not be called with a filtered currentitem! (topline %d listline %d)\n",
-			topline, currentitem->listline)
+			"drawflags() must not be called with a filtered currentflag! (topline %d listline %d)\n",
+			topline, currentflag->listline)
 
-	struct item *item = currentitem;
-	int line = item->listline - topline;
+	sFlag* flag = currentflag;
+
+	int line = flag->listline - topline;
 
 	/* move to the top of the displayed list */
-	while ((item != items) && (line > 0)) {
-		item = item->prev;
-		if (isLegalItem(item))
-			line -= getItemHeight(item);
+	while ((flag != flags) && (line > 0)) {
+		flag = flag->prev;
+		if (isFlagLegal(flag))
+			line -= getFlagHeight(flag);
 	}
 
-	/* If the above move ended up with item == items
+	/* If the above move ended up with flag == flags
 	 * topline and line must be adapted to the current
-	 * item.
+	 * flag.
 	 * This can happen if the flag filter is toggled
-	 * and the current item is the first not filtered item.
+	 * and the current flag is the first not filtered.
 	 */
-	if ((item == items) && !isLegalItem(item)) {
-		item    = currentitem;
-		topline = currentitem->listline;
+	if ((flag == flags) && !isFlagLegal(flag)) {
+		flag    = currentflag;
+		topline = currentflag->listline;
 		line    = 0;
 	}
 
 	// The display start line might differ from topline:
-	dispStart = item->listline;
+	dispStart = flag->listline;
 
-	for( ; line < wHeight(List); ) {
-		item->currline = line; // drawitem() and maineventloop() need this
-		line += drawitem(item, item == currentitem ? TRUE : FALSE);
+	for( ; line < lHeight; ) {
+		flag->currline = line; // drawflag() and maineventloop() need this
+		line += drawflag(flag, flag == currentflag ? TRUE : FALSE);
 
-		if (line < wHeight(List)) {
-			item = item->next;
+		if (line < lHeight) {
+			flag = flag->next;
 
 			/* Add blank lines if we reached the end of the
 			 * flag list, but not the end of the display.
 			 */
-			if(item == items) {
-				char buf[wWidth(List)];
-				memset(buf, ' ', wWidth(List));
-				buf[wWidth(List)] = '\0';
+			if(flag == flags) {
+				int lWidth = wWidth(List);
+				char buf[lWidth];
+				memset(buf, ' ', lWidth);
+				buf[lWidth] = '\0';
 				wmove(win(List), line, 0);
 				wattrset(win(List), COLOR_PAIR(3));
-				while(line++ < wHeight(List))
+				while(line++ < lHeight)
 					waddstr(win(List), buf);
 			}
 		} else
-			dispEnd = item->listline + item->ndescr;
+			dispEnd = flag->listline + flag->ndesc;
 	}
 	wnoutrefresh(win(List));
 }
 
-void drawscrollbar() {
+void drawScrollbar() {
+	int sHeight = wHeight(Scrollbar);
+	int lHeight = wHeight(List);
 	WINDOW *w = win(Scrollbar);
 	wattrset(w, COLOR_PAIR(3) | A_BOLD);
 	mvwaddch(w, 0, 0, ACS_UARROW);
-	wvline(w, ACS_CKBOARD, wHeight(Scrollbar)-3);
+	wvline(w, ACS_CKBOARD, sHeight - 3);
 
 	/* The scrollbar location differs related to the
 	 * current filtering of masked flags.
@@ -202,10 +262,10 @@ void drawscrollbar() {
 	listHeight = getListHeight();
 
 	// Only show a scrollbar if the list is actually longer than can be displayed:
-	if (listHeight > wHeight(List)) {
-		int sbHeight = wHeight(Scrollbar) - 3;
+	if (listHeight > lHeight) {
+		int sbHeight = sHeight - 3;
 		barStart = 1 + (dispStart * sbHeight / bottomline);
-		barEnd   = barStart + ((dispEnd - dispStart) * wHeight(List) / bottomline);
+		barEnd   = barStart + ((dispEnd - dispStart) * lHeight / bottomline);
 
 		// Strongly filtered lists scatter much and must be corrected:
 		if (barEnd > sbHeight) {
@@ -216,19 +276,62 @@ void drawscrollbar() {
 			mvwaddch(w, barStart, 0, ACS_BLOCK);
 	}
 
-	mvwaddch(w, wHeight(Scrollbar)-2, 0, ACS_DARROW);
-	mvwaddch(w, wHeight(Scrollbar)-1, 0, ACS_VLINE);
+	mvwaddch(w, sHeight - 2, 0, ACS_DARROW);
+	mvwaddch(w, sHeight - 1, 0, ACS_VLINE);
 	wnoutrefresh(w);
 }
 
-void draw() {
-	size_t bufsize = COLS+1;
-	char buf[bufsize];
-	WINDOW *w;
 
-	wnoutrefresh(stdscr);
+/** @brief redraw Input with blank input and current status if @a withSep is true
+ *  This function resets the cursor to 0,0.
+ *  The window is not fully refreshed!
+ *  @param withSep Draw status separators and filter status if true.
+ */
+void drawStatus(bool withSep)
+{
+	WINDOW* w = win(Input);
+	int     iWidth = wWidth(Input);
+
+	wattrset(w, COLOR_PAIR(3));
+
+	// Blank the input area
+	mvwhline(w, 0, 0, ' ', withSep ? minwidth : iWidth);
+
+	if (withSep) {
+		char buf[COLS+1];
+
+		// Add Status separators and explenation characters
+		mvwaddstr(w, 0, minwidth, " DPC Si");
+		mvwaddch(w, 0, minwidth,     ACS_VLINE); // Before state
+		mvwaddch(w, 0, minwidth + 4, ACS_VLINE); // Between state and scope
+		mvwaddch(w, 0, minwidth + 7, ACS_VLINE); // After scope
+
+		// Use the unused right side to show the filter status
+		sprintf(buf, "%-*s%-6s / %-6s / %-12s] ",
+			max(2, iWidth - 40 - minwidth), " [",
+			eMask_masked        == e_mask ? "masked" :
+			eMask_unmasked      == e_mask ? "normal" : "all",
+			eScope_global       == e_scope ? "global" :
+			eScope_local        == e_scope ? "local" : "all",
+			eState_installed    == e_state ? "installed" :
+			eState_notinstalled == e_state ? "not installed" : "all");
+		waddstr(w, buf);
+	}
+
+	// Reset cursor to 0,0 and apply changes
+	wmove(w, 0, 0);
+	wnoutrefresh(w);
+}
+
 
-	w = win(Top);
+/** @brief redraw Top with or without status separators
+ *  The window is not fully refreshed!
+ *  @param withSep Draw status separators and filter status if true.
+ */
+void drawTop(bool withSep)
+{
+	WINDOW* w = win(Top);
+	char buf[COLS + 1];
 
 	wattrset(w, COLOR_PAIR(1) | A_BOLD);
 	sprintf(buf, "%-*.*s", wWidth(Top), wWidth(Top), "Gentoo USE flags editor " PACKAGE_VERSION);
@@ -248,23 +351,37 @@ void draw() {
 	wattrset(w, COLOR_PAIR(2) | A_BOLD);
 	waddch(w, ACS_VLINE);
 
-	/* maybe this should be based on List? */
+	/* maybe this should be based on List?
+	 * A: Absolutely not, or every line drawing algorithm
+	 *    had to be rewritten to cover the offsets. - Sven
+	 */
 	waddch(w, ACS_VLINE);
 	wattrset(w, COLOR_PAIR(3));
 	waddch(w, ' ');
 	waddch(w, ACS_ULCORNER);
 	whline(w, ACS_HLINE, wWidth(Top)-6);
-	mvwaddch(w, 4, minwidth + 3, ACS_TTEE); // Before state
-	mvwaddch(w, 4, minwidth + 6, ACS_TTEE); // Between state and scope
-	mvwaddch(w, 4, minwidth + 9, ACS_TTEE); // After scope
+	if (withSep) {
+		mvwaddch(w, 4, minwidth + 3, ACS_TTEE); // Before state
+		mvwaddch(w, 4, minwidth + 7, ACS_TTEE); // Between state and scope
+		mvwaddch(w, 4, minwidth + 10, ACS_TTEE); // After scope
+	}
 	mvwaddch(w, 4, wWidth(Top)-3, ACS_URCORNER);
 	waddch(w, ' ');
 	wattrset(w, COLOR_PAIR(2) | A_BOLD);
 	waddch(w, ACS_VLINE);
 
 	wnoutrefresh(w);
+}
+
+
+/** @brief redraw the whole screen
+ *  @param withSep draw status separators if set to true
+ */
+void draw(bool withSep) {
+	WINDOW *w = win(Left);
+
+	wnoutrefresh(stdscr);
 
-	w = win(Left);
 	wattrset(w, COLOR_PAIR(2) | A_BOLD);
 	mvwvline(w, 0, 0, ACS_VLINE, wHeight(Left));
 	wattrset(w, COLOR_PAIR(3));
@@ -278,176 +395,116 @@ void draw() {
 	mvwvline(w, 0, 1, ACS_VLINE, wHeight(Right));
 	wnoutrefresh(w);
 
-	w = win(Bottom);
-
-	wattrset(w, COLOR_PAIR(2) | A_BOLD);
-	mvwaddch(w, 0, 0, ACS_VLINE);
-	wattrset(w, COLOR_PAIR(3));
-	waddch(w, ' ');
-	waddch(w, ACS_LLCORNER);
-	whline(w, ACS_HLINE, wWidth(Bottom)-6);
-	mvwaddch(w, 0, minwidth + 3, ACS_BTEE); // Before state
-	mvwaddch(w, 0, minwidth + 6, ACS_BTEE); // Between state and scope
-	mvwaddch(w, 0, minwidth + 9, ACS_BTEE); // After scope
-	mvwaddch(w, 0, wWidth(Bottom)-3, ACS_LRCORNER);
-	waddch(w, ' ');
-	wattrset(w, COLOR_PAIR(2) | A_BOLD);
-	waddch(w, ACS_VLINE);
+	drawTop(withSep);
+	drawBottom(withSep);
+	drawStatus(withSep);
 
-	waddch(w, ACS_VLINE);
-	wattrset(w, COLOR_PAIR(3));
-	{
-		char *p = buf;
-		const struct key *key;
-		const size_t maxAdr = (const size_t)(buf+wWidth(Bottom)-3);
-		*p++ = ' ';
-		for(key=keys; key->key!='\0'; key++) {
-			size_t n = maxAdr - (size_t)p;
-			if(n > key->length)
-				n = key->length;
-			memcpy(p, key->descr, n);
-			p += n;
-			if ((size_t)p == maxAdr)
-				break;
-			*p++ = ' ';
-		}
-		/* If there is enough space, show which kind of flags
-		 * are displayed: normal, masked or all
-		 */
-		if ((size_t)p < (maxAdr - 9)) {
-			memset(p, ' ', maxAdr - 9 - (size_t)p);
-			p += maxAdr - 9 - (size_t)p;
-			if (show_unmasked == showMasked) strcpy(p, "[normal]");
-			if (show_masked   == showMasked) strcpy(p, "[masked]");
-			if (show_both     == showMasked) strcpy(p, "[ all  ]");
-			p += 8;
-		}
-		memset(p, ' ', maxAdr + 1 - (size_t)p);
-		buf[wWidth(Bottom)-2] = '\0';
+	if (flags) {
+		drawFlags();
+		drawScrollbar();
 	}
-	waddstr(w, buf);
-	wattrset(w, COLOR_PAIR(2) | A_BOLD);
-	waddch(w, ACS_VLINE);
-
-	waddch(w, ACS_LLCORNER);
-	whline(w, ACS_HLINE, wWidth(Bottom)-2);
-	mvwhline(w, 2, wWidth(Bottom)-1, ACS_LRCORNER, 1);
-
-	wnoutrefresh(w);
-
-	w = win(Input);
-	wattrset(w, COLOR_PAIR(3));
-	mvwhline(w, 0, 0, ' ', wWidth(Input));
-	mvwaddch(w, 0, minwidth,     ACS_VLINE); // Before state
-	mvwaddch(w, 0, minwidth + 3, ACS_VLINE); // Between state and scope
-	mvwaddch(w, 0, minwidth + 6, ACS_VLINE); // After scope
-	wmove(w, 0, 0);
-	wnoutrefresh(w);
-
-	drawitems();
-	drawscrollbar();
 
 	wrefresh(win(List));
 }
 
 bool scrollcurrent() {
-	if(currentitem->listline < topline)
-		topline = max(currentitem->listline, currentitem->listline + currentitem->ndescr - wHeight(List));
-	else if( (currentitem->listline + currentitem->ndescr) > (topline + wHeight(List)))
-		topline = min(currentitem->listline + currentitem->ndescr - wHeight(List), currentitem->listline);
+	if(currentflag->listline < topline)
+		topline = max(currentflag->listline, currentflag->listline + currentflag->ndesc - wHeight(List));
+	else if( (currentflag->listline + currentflag->ndesc) > (topline + wHeight(List)))
+		topline = min(currentflag->listline + currentflag->ndesc - wHeight(List), currentflag->listline);
 	else
 		return false;
-	drawitems();
-	drawscrollbar();
+	drawFlags();
+	drawScrollbar();
 	return true;
 }
 
 bool yesno(const char *prompt) {
-	wattrset(win(Input), COLOR_PAIR(4) | A_BOLD | A_REVERSE);
-	mvwhline(win(Input), 0, 0, ' ', wWidth(Input));
-	mvwaddch(win(Input), 0, minwidth,     ACS_VLINE); // Before state
-	mvwaddch(win(Input), 0, minwidth + 3, ACS_VLINE); // Between state and scope
-	mvwaddch(win(Input), 0, minwidth + 6, ACS_VLINE); // After scope
-	wmove(win(Input), 0, 0);
-	waddstr(win(Input), prompt);
-	whline(win(Input), 'Y', 1);
-	wrefresh(win(Input));
-	for(;;) switch(getch()) {
-		case '\n': case KEY_ENTER:
-		case 'Y': case 'y':
-			return TRUE;
-		case '\033':
-		case 'N': case 'n':
-			wattrset(win(Input), COLOR_PAIR(3));
-			mvwhline(win(Input), 0, 0, ' ', wWidth(Input));
-			mvwaddch(win(Input), 0, minwidth,     ACS_VLINE); // Before state
-			mvwaddch(win(Input), 0, minwidth + 3, ACS_VLINE); // Between state and scope
-			mvwaddch(win(Input), 0, minwidth + 6, ACS_VLINE); // After scope
-			wmove(win(Input), 0, 0);
-			wnoutrefresh(win(Input));
-			wrefresh(win(List));
-			return FALSE;
+	WINDOW* wInp   = win(Input);
+	bool    doWait = true;
+	bool    result = true;
+
+	drawStatus(true);
+	wattrset(wInp, COLOR_PAIR(4) | A_BOLD);
+	waddstr(wInp, prompt);
+	waddch(wInp, 'Y');
+	wrefresh(wInp);
+
+	while(doWait) {
+		switch(getch()) {
+			case '\n': case KEY_ENTER:
+			case 'Y': case 'y':
+				doWait = false;
+				break;
+			case '\033':
+			case 'N': case 'n':
+				drawStatus(true);
+				wrefresh(wInp);
+				result = false;
+				doWait = false;
+				break;
 #ifdef KEY_RESIZE
 		case KEY_RESIZE:
 				resizeterm(LINES, COLS);
 				checktermsize();
-				{ enum win w; for(w = (enum win) 0; w != wCount; w++) {
+				{ eWin w; for(w = (eWin) 0; w != wCount; w++) {
 					delwin(window[w].win);
 					window[w].win = newwin(wHeight(w), wWidth(w), wTop(w), wLeft(w));
 				} }
+
 				/* this won't work for the help viewer, but it doesn't use yesno() */
 				topline = 0;
 				scrollcurrent();
-				draw();
-				wattrset(win(Input), COLOR_PAIR(4) | A_BOLD | A_REVERSE);
-				mvwhline(win(Input), 0, 0, ' ', wWidth(Input));
-				mvwaddch(win(Input), 0, minwidth,     ACS_VLINE); // Before state
-				mvwaddch(win(Input), 0, minwidth + 3, ACS_VLINE); // Between state and scope
-				mvwaddch(win(Input), 0, minwidth + 6, ACS_VLINE); // After scope
-				wmove(win(Input), 0, 0);
-				waddstr(win(Input), prompt);
-				whline(win(Input), 'Y', 1);
-				wrefresh(win(Input));
+				draw(true); // Only used outside help view.
+				wattrset(wInp, COLOR_PAIR(4) | A_BOLD);
+				waddstr(wInp, prompt);
+				waddch (wInp, 'Y');
+				wrefresh(wInp);
 				break;
 #endif
+		}
 	}
-	return FALSE;
+
+	return result;
 }
 
 int maineventloop(
 		const char *_subtitle,
-		int(*_callback)(struct item **, int),
-		int(*_drawitem)(struct item *, bool),
-		struct item *_items,
-		const struct key *_keys) {
+		int(*_callback)(sFlag**, int),
+		int(*_drawflag)(sFlag*, bool),
+		sFlag* _flags,
+		const sKey *_keys,
+		bool withSep) {
 	int result;
 
 	// Always reset the Filters on start and revert on exit
-	enum mask oldMask = showMasked;
-	enum scope oldScope = showScope;
-	showMasked = show_unmasked;
-	showScope  = show_all;
+	eMask  oldMask  = e_mask;
+	eScope oldScope = e_scope;
+	eState oldState = e_state;
+	e_mask  = eMask_unmasked;
+	e_scope = eScope_all;
+	e_state = eState_all;
 
 	{ const char *temp = subtitle;
-		subtitle=_subtitle;
-		_subtitle=temp; }
-	{ int(*temp)(struct item **, int) = callback;
-		callback=_callback;
-		_callback=temp; }
-	{ int(*temp)(struct item *, bool) = drawitem;
-		drawitem=_drawitem;
-		_drawitem=temp; }
-	{ struct item *temp=items;
-		items=_items;
-		_items=temp; }
-	{ const struct key *temp=keys;
-		keys=_keys;
-		_keys=temp; }
-
-	currentitem = items;
+		subtitle  = _subtitle;
+		_subtitle = temp; }
+	{ int(*temp)(sFlag**, int) = callback;
+		callback  = _callback;
+		_callback = temp; }
+	{ int(*temp)(sFlag*, bool) = drawflag;
+		drawflag  = _drawflag;
+		_drawflag = temp; }
+	{ sFlag* temp = flags;
+		flags  = _flags;
+		_flags = temp; }
+	{ const sKey *temp = keys;
+		keys  = _keys;
+		_keys = temp; }
+
+	currentflag = flags;
 	topline = 0;
 
-	draw();
+	draw(withSep);
 
 	for(;;) {
 		int c = getch();
@@ -476,27 +533,27 @@ int maineventloop(
 				}
 				if(wmouse_trafo(win(List), &event.y, &event.x, FALSE)) {
 					if(event.bstate & (BUTTON1_CLICKED | BUTTON1_DOUBLE_CLICKED)) {
-						struct item *item = currentitem;
-						if(currentitem->currline > event.y) {
-							do item = item->prev;
-							while((item==items ? item=NULL, 0 : 1)
-							 && item->currline > event.y);
-						} else if(currentitem->currline + getItemHeight(currentitem) - 1 < event.y) {
-							do item = item->next;
-							while((item->next==items ? item=NULL, 0 : 1)
-							 && item->currline + getItemHeight(item) - 1 < event.y);
+						sFlag* flag = currentflag;
+						if(currentflag->currline > event.y) {
+							do flag = flag->prev;
+							while((flag == flags ? flag = NULL, 0 : 1)
+							 && flag->currline > event.y);
+						} else if(currentflag->currline + getFlagHeight(currentflag) - 1 < event.y) {
+							do flag = flag->next;
+							while((flag->next == flags ? flag = NULL, 0 : 1)
+							 && flag->currline + getFlagHeight(flag) - 1 < event.y);
 						}
-						if(item==NULL)
+						if(flag == NULL)
 							continue;
-						drawitem(currentitem, FALSE);
-						currentitem = item;
+						drawflag(currentflag, FALSE);
+						currentflag = flag;
 						if(event.bstate & BUTTON1_DOUBLE_CLICKED) {
-							result=callback(&currentitem, KEY_MOUSE);
+							result=callback(&currentflag, KEY_MOUSE);
 							if(result>=0)
 								goto exit;
 						}
 						scrollcurrent();
-						drawitem(currentitem, TRUE);
+						drawflag(currentflag, TRUE);
 					}
 				} else if(wmouse_trafo(win(Scrollbar), &event.y, &event.x, FALSE)) {
 					// Only do mouse events if there actually is a scrollbar
@@ -531,19 +588,17 @@ int maineventloop(
 										event.y -= wTop(Scrollbar) + 1;
 										int sbHeight = wHeight(Scrollbar) - 3;
 										if( (event.y >= 0) && (event.y < sbHeight) ) {
-											/// TODO : This needs to be fixed!
 											topline = (event.y * (listHeight - sbHeight + 2) + sbHeight - 1) / sbHeight;
-											// was: topy = (event.y*(items->prev->top+items->prev->height-(wHeight(List)-1))+(wHeight(Scrollbar)-4))/(wHeight(Scrollbar)-3);
-											while( (currentitem != items)
-												&& (currentitem->prev->listline >= topline) )
-												currentitem = currentitem->prev;
-											while( (currentitem->next != items)
-												&& (currentitem->listline < topline) )
-												currentitem = currentitem->next;
-											if( (currentitem->listline + currentitem->ndescr) > (topline + wHeight(List)) )
-												topline = currentitem->listline + currentitem->ndescr - wHeight(List);
-											drawitems();
-											drawscrollbar();
+											while( (currentflag != flags)
+												&& (currentflag->prev->listline >= topline) )
+												currentflag = currentflag->prev;
+											while( (currentflag->next != flags)
+												&& (currentflag->listline < topline) )
+												currentflag = currentflag->next;
+											if( (currentflag->listline + currentflag->ndesc) > (topline + wHeight(List)) )
+												topline = currentflag->listline + currentflag->ndesc - wHeight(List);
+											drawFlags();
+											drawScrollbar();
 											wrefresh(win(List));
 										}
 									}
@@ -558,7 +613,7 @@ int maineventloop(
 				} else if(wmouse_trafo(win(Bottom), &event.y, &event.x, FALSE)) {
 					if( (event.bstate & (BUTTON1_CLICKED | BUTTON1_DOUBLE_CLICKED))
 					 && (event.y == 1) ) {
-						const struct key *key;
+						const sKey* key;
 						int x = event.x;
 						if(x < 2)
 							continue;
@@ -588,72 +643,79 @@ int maineventloop(
 		} else
 #endif
 		{
-			result=callback(&currentitem, c);
-			if(result>=0)
+			result = callback(&currentflag, c);
+			if(result >= 0)
 				goto exit;
 
 			switch(c) {
 				case KEY_UP:
-					if(currentitem->currline < 0 ) {
+					if(currentflag->currline < 0 ) {
 						--topline;
-						drawitems();
-						drawscrollbar();
+						drawFlags();
+						drawScrollbar();
 					} else
 						setPrevItem(1, true);
 					break;
 	
 				case KEY_DOWN:
-					if( (currentitem->currline + getItemHeight(currentitem)) > wHeight(List) ) {
+					if( (currentflag->currline + getFlagHeight(currentflag)) > wHeight(List) ) {
 						++topline;
-						drawitems();
-						drawscrollbar();
+						drawFlags();
+						drawScrollbar();
 					} else
 						setNextItem(1, true);
 					break;
 	
 				case KEY_PPAGE:
-					if(currentitem!=items)
+					if(currentflag != flags)
 						setPrevItem(wHeight(List), false);
 					break;
 	
 				case KEY_NPAGE:
-					if(currentitem->next!=items)
+					if(currentflag->next != flags)
 						setNextItem(wHeight(List), false);
 					break;
 	
 				case KEY_HOME:
-					if(currentitem!=items)
-						resetDisplay();
+					if(currentflag != flags)
+						resetDisplay(withSep);
 					break;
 	
 				case KEY_END:
-					if(currentitem->next!=items) {
-						drawitem(currentitem, FALSE);
-						currentitem = items->prev;
-						while (!isLegalItem(currentitem))
-							currentitem = currentitem->prev;
+					if(currentflag->next != flags) {
+						drawflag(currentflag, FALSE);
+						currentflag = flags->prev;
+						while (!isFlagLegal(currentflag))
+							currentflag = currentflag->prev;
 						scrollcurrent();
-						drawitem(currentitem, TRUE);
+						drawflag(currentflag, TRUE);
 					}
 					break;
 
 				case KEY_F(5):
-					if      (show_masked   == showMasked) showMasked = show_unmasked;
-					else if (show_both     == showMasked) showMasked = show_masked;
-					else if (show_unmasked == showMasked) showMasked = show_both;
-					resetDisplay();
+					if      (eMask_masked   == e_mask) e_mask = eMask_unmasked;
+					else if (eMask_unmasked == e_mask) e_mask = eMask_both;
+					else                               e_mask = eMask_masked;
+					resetDisplay(withSep);
 					break;
 
 				case KEY_F(6):
-					if (pkgs_left == pkgOrder) pkgOrder = pkgs_right;
-					else                       pkgOrder = pkgs_left;
-					drawitems();
+					if (eOrder_left == e_order) e_order = eOrder_right;
+					else                        e_order = eOrder_left;
+					drawFlags();
 					break;
 
 //				case KEY_F(7):
-//					if      (show_local  == showScope) showScope = show_all;
-//					else if (show_global == showScope) showScope = show_local;
-//					else if (show_all    == showScope) showScope = show_global;
+//					if      (eScope_local  == e_scope) e_scope = eScope_all;
+//					else if (eScope_global == e_scope) e_scope = eScope_local;
+//					else if (eScope_all    == e_scope) e_scope = eScope_global;
+//					resetDisplay();
+//					break;
+//
+//				case KEY_F(8):
+//					if      (eState_installed    == e_state) e_state = eState_notinstalled;
+//					else if (eState_notinstalled == e_state) e_state = eState_all;
+//					else if (eState_all          == e_state) e_state = eState_installed;
 //					resetDisplay();
 //					break;
 
@@ -661,16 +723,19 @@ int maineventloop(
 				case KEY_RESIZE:
 					resizeterm(LINES, COLS);
 					checktermsize();
-					{ enum win w; for(w = (enum win) 0; w != wCount; w++) {
+					{ eWin w; for(w = (eWin) 0; w != wCount; w++) {
 						delwin(window[w].win);
 						window[w].win = newwin(wHeight(w), wWidth(w), wTop(w), wLeft(w));
 					} }
-					if(result==-1) {
+					if(result == -1) {
 						topline = 0;
 						scrollcurrent();
 					} else
-						items = currentitem;
-					draw();
+						// This is the result of a resize in
+						// the help screen, it will re-init
+						// the help text lines.
+						flags = currentflag;
+					draw(withSep);
 					break;
 #endif
 			}
@@ -680,124 +745,109 @@ int maineventloop(
 exit:
 	subtitle = _subtitle;
 	callback = _callback;
-	drawitem = _drawitem;
-	items    = _items;
+	drawflag = _drawflag;
+	flags    = _flags;
 	keys     = _keys;
 
 	// revert filters
-	showMasked = oldMask;
-	showScope  = oldScope;
+	e_mask  = oldMask;
+	e_scope = oldScope;
+	e_state = oldState;
 
-	if(items!=NULL)
-		resetDisplay();
+	if(flags != NULL)
+		resetDisplay(withSep);
 
 	return result;
 }
 
 
-/* @brief Set display to first legal item and redraw
+/** @brief Set display to first legal item and redraw
+ *  @param withSep draw status separators if set to true
  */
-void resetDisplay()
+void resetDisplay(bool withSep)
 {
-	currentitem = items;
-	while (!isLegalItem(currentitem))
-		currentitem = currentitem->next;
-	topline = currentitem->listline;
-	draw();
+	currentflag = flags;
+	while (!isFlagLegal(currentflag) && (currentflag->next != flags))
+		currentflag = currentflag->next;
+	topline = currentflag->listline;
+	draw(withSep);
 }
 
 
-/* @brief set currentitem to the next item @a count lines away
+/** @brief set currentflag to the next flag @a count lines away
  * @param count set how many lines should be skipped
  * @param strict if set to false, at least one item has to be skipped.
  */
 void setNextItem(int count, bool strict)
 {
-	bool         result  = true;
-	struct item *curr    = currentitem;
-	int          skipped = 0;
-	int          oldTop  = topline;
+	bool   result  = true;
+	sFlag* curr    = currentflag;
+	int    skipped = 0;
+	int    oldTop  = topline;
 
 	while (result && (skipped < count)) {
-		if (curr->next == items)
+		if (curr->next == flags)
 			result = false; // The list is finished, no next item to display
 		else
 			curr = curr->next;
 
 		// curr is only counted if it is not filtered out:
-		if (isLegalItem(curr))
-			skipped += getItemHeight(curr);
+		if (isFlagLegal(curr))
+			skipped += getFlagHeight(curr);
 		else
 			// Otherwise topline must be adapted or scrollcurrent() wreaks havoc!
-			topline += curr->ndescr;
+			topline += curr->ndesc;
 	} // End of trying to find a next item
 
 	if ( (result && strict) || (!strict && skipped) ) {
 		// Move back again if curr ended up being filtered
-		while (!isLegalItem(curr)) {
-			topline -= curr->ndescr;
+		while (!isFlagLegal(curr)) {
+			topline -= curr->ndesc;
 			curr = curr->prev;
 		}
-		drawitem(currentitem, FALSE);
-		currentitem = curr;
+		drawflag(currentflag, FALSE);
+		currentflag = curr;
 		if (!scrollcurrent())
-			drawitem(currentitem, TRUE);
+			drawflag(currentflag, TRUE);
 	} else
 		topline = oldTop;
 }
 
 
-/* @brief set currentitem to the previous item @a count lines away
+/* @brief set currentflag to the previous item @a count lines away
  * @param count set how many lines should be skipped
  * @param strict if set to false, at least one item has to be skipped.
  */
 void setPrevItem(int count, bool strict)
 {
-	bool         result  = true;
-	struct item *curr    = currentitem;
-	int          skipped = 0;
-	int          oldTop  = topline;
+	bool   result  = true;
+	sFlag* curr    = currentflag;
+	int    skipped = 0;
+	int    oldTop  = topline;
 
 	while (result && (skipped < count)) {
-		if (curr == items)
+		if (curr == flags)
 			result = false; // The list is finished, no previous item to display
 		else
 			curr = curr->prev;
 
 		// curr is only counted if it is not filtered out:
-		if (isLegalItem(curr))
-			skipped += getItemHeight(curr);
+		if (isFlagLegal(curr))
+			skipped += getFlagHeight(curr);
 		else
-			topline -= curr->ndescr;
+			topline -= curr->ndesc;
 	} // End of trying to find next item
 
 	if ( (result && strict) || (!strict && skipped) ) {
 		// Move forth again if curr ended up being filtered
-		while (!isLegalItem(curr)) {
-			topline += curr->ndescr;
+		while (!isFlagLegal(curr)) {
+			topline += curr->ndesc;
 			curr = curr->next;
 		}
-		drawitem(currentitem, FALSE);
-		currentitem = curr;
+		drawflag(currentflag, FALSE);
+		currentflag = curr;
 		if (!scrollcurrent())
-			drawitem(currentitem, TRUE);
+			drawflag(currentflag, TRUE);
 	} else
 		topline = oldTop;
 }
-
-
-/* @brief return true if the given @a item is not filtered out
- */
-bool isLegalItem(struct item *item)
-{
-	if ( // 1: Mask filter
-	     ( ( item->isMasked && (show_unmasked != showMasked))
-	    || (!item->isMasked && (show_masked   != showMasked)) )
-	     // 2: Global / Local filter
-	  && ( ( item->isGlobal && ( (show_local  != showScope) || (item->ndescr > 1) ) )
-	    || (!item->isGlobal && (  show_global != showScope)) ) )
-		return true;
-	return false;
-}
-
-


^ permalink raw reply related	[flat|nested] 238+ messages in thread
* [gentoo-commits] proj/ufed:master commit in: /
@ 2013-02-01 10:49 Sven Eden
  0 siblings, 0 replies; 238+ messages in thread
From: Sven Eden @ 2013-02-01 10:49 UTC (permalink / raw
  To: gentoo-commits

commit:     900c8baab6a5cdd2e9556baeaa166be920537268
Author:     Sven Eden <sven.eden <AT> gmx <DOT> de>
AuthorDate: Fri Feb  1 10:50:42 2013 +0000
Commit:     Sven Eden <sven.eden <AT> gmx <DOT> de>
CommitDate: Fri Feb  1 10:50:42 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/ufed.git;a=commit;h=900c8baa

Removed old parts that where commented out.

---
 ufed.pl.in |   47 +++--------------------------------------------
 1 files changed, 3 insertions(+), 44 deletions(-)

diff --git a/ufed.pl.in b/ufed.pl.in
index bf09de4..d31b1b1 100644
--- a/ufed.pl.in
+++ b/ufed.pl.in
@@ -13,7 +13,7 @@ my $version = 'XX_PACKAGE_VERSION@';
 
 my $interface = 'ufed-curses';
 #my $memcheck  = "/usr/bin/valgrind -v --trace-children=yes --tool=memcheck"
-#			  . " --track-origins=yes --leak-check=full --show-reachable=yes"
+#			  . " --track-origins=yes --leak-check=full --show-reachable=no"
 #			  . " --read-var-info=yes"
 #              . " XX_libexecdir@/ufed-curses 2>/tmp/ufed_memcheck.log";
 
@@ -72,20 +72,6 @@ sub flags_dialog {
 	# Write out flags 
 	for my $flag (sort { uc $a cmp uc $b } keys %$Portage::use_flags) {
 		my $conf = $Portage::use_flags->{$flag}; ## Shortcut
-# deprecated: The output is updated to match the new data structure.
-#		my $state = "g";
-#
-#		$outTxt .= sprintf ("%s %s (%s%s) %d\n", $flag,
-#					defined($conf->{global}{conf}) ?
-#						$conf->{global}{conf} > 0 ? 'on' :
-#						$conf->{global}{conf} < 0 ? 'off' : 'def' : 'def',
-#					defined($conf->{global}{"default"}) ?
-#						$conf->{global}{"default"} > 0 ? '+' :
-#						$conf->{global}{"default"} < 0 ? '-' : ' ' : ' ',
-#					defined($conf->{global}{conf}) ?
-#						$conf->{global}{conf} > 0 ? '+' :
-#						$conf->{global}{conf} < 0 ? '-' : ' ' : ' ',
-#					$conf->{count});
 
 		$outTxt .= sprintf ("%s [%s%s] %d\n", $flag,
 					defined($conf->{global}{conf}) ?
@@ -96,29 +82,14 @@ sub flags_dialog {
 						$conf->{global}{"default"} < 0 ? '-' : ' ' : ' ',
 					$conf->{count});
 
-#		# Print global description first (if available)
+		# Print global description first (if available)
 		if (defined($conf->{global}) && length($conf->{global}{descr})) {
-# deprecated: The output is updated to match the new data structure.
-#			if ($conf->{global}{installed}) {
-#				$conf->{global}{masked} and $state = "M";
-#				$conf->{global}{masked} or  $state = "G";
-#			} else {
-#				$conf->{global}{masked} and $state = "m";
-#			}
-#			$outTxt .= "[" . $conf->{global}{descr} . "] $state\n";
-# *  @param[in] state '+','-',' ' for global, installed, forced, masked, package - in that order.
 			$outTxt .= sprintf("\t%s\t ( ) [+%s%s%s ]\n",
 						$conf->{global}{descr},
 						$conf->{global}{installed} ? '+' : ' ',
 						$conf->{global}{forced} ? '+' : ' ',
 						$conf->{global}{masked} ? '+' : ' ');
-							
-# deprecated: The output is updated to match the new data structure.
-#			# Then print the list of affected packages that have no own entry
-#			for my $afLst (@{$conf->{global}{affected}}) {
-#				(defined($afLst) && length($afLst))
-#					and $outTxt .= "($afLst) [Affected by global flag setting] $state\n";
-#			}
+
 			for my $afLst (@{$conf->{global}{affected}}) {
 				(defined($afLst) && length($afLst))
 					and $outTxt .= sprintf("\t%s\t (%s) [+    ]\n",
@@ -129,18 +100,6 @@ sub flags_dialog {
 
 		# Finally print the local description lines
 		for my $pkg (sort keys %{$conf->{"local"}}) {
-# deprecated: The output is updated to match the new data structure.
-#			$state = "l";
-#			if ($conf->{"local"}{$pkg}{installed}) {
-#				$state = "L";
-#				if ($conf->{global}{masked}) {
-#					$conf->{"local"}{$pkg}{masked} > -1 and $state = "M";
-#					$conf->{"local"}{$pkg}{masked} <  0 and $state = "L";
-#				}
-#			} elsif ($conf->{global}{masked}) {
-#					$conf->{"local"}{$pkg}{masked} > -1 and $state = "m";
-#			}
-#			$outTxt .= sprintf("(%s) [%s] %s\n", $pkg, $conf->{"local"}{$pkg}{descr}, $state);
 			$outTxt .= sprintf("\t%s\t (%s) [ %s%s%s%s]\n",
 						$conf->{"local"}{$pkg}{descr},
 						$pkg,


^ permalink raw reply related	[flat|nested] 238+ messages in thread
* [gentoo-commits] proj/ufed:master commit in: /
@ 2013-02-01 10:49 Sven Eden
  0 siblings, 0 replies; 238+ messages in thread
From: Sven Eden @ 2013-02-01 10:49 UTC (permalink / raw
  To: gentoo-commits

commit:     f44fc180351f67a460acf1d46b03124660da1c9a
Author:     Sven Eden <sven.eden <AT> gmx <DOT> de>
AuthorDate: Fri Feb  1 10:15:05 2013 +0000
Commit:     Sven Eden <sven.eden <AT> gmx <DOT> de>
CommitDate: Fri Feb  1 10:15:05 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/ufed.git;a=commit;h=f44fc180

Fixed setPrevItem(), setNextItem() and drawFlags() to handle the skipping of individual filtered out description lines. Note: this surely can be optimized. Later.

---
 ufed-curses.c |  176 ++++++++++++++++++++++++++++++++++++++++-----------------
 1 files changed, 123 insertions(+), 53 deletions(-)

diff --git a/ufed-curses.c b/ufed-curses.c
index bc55ca1..2808055 100644
--- a/ufed-curses.c
+++ b/ufed-curses.c
@@ -42,8 +42,8 @@ void draw(bool withSep);
 void drawScrollbar(void);
 int  getListHeight(void);
 void resetDisplay(bool withSep);
-void setNextItem(int count, bool strict);
-void setPrevItem(int count, bool strict);
+bool setNextItem(int count, bool strict);
+bool setPrevItem(int count, bool strict);
 
 
 /* internal functions */
@@ -197,25 +197,28 @@ void drawFlags() {
 			topline, currentflag->listline)
 
 	sFlag* flag = currentflag;
+	sFlag* last = currentflag;
 
 	int line = flag->listline - topline;
 
 	/* move to the top of the displayed list */
 	while ((flag != flags) && (line > 0)) {
 		flag = flag->prev;
-		if (isFlagLegal(flag))
+		if (isFlagLegal(flag)) {
 			line -= getFlagHeight(flag);
+			last = flag;
+		}
 	}
 
 	/* If the above move ended up with flag == flags
-	 * topline and line must be adapted to the current
-	 * flag.
+	 * topline and line must be adapted to the last
+	 * found not filtered flag.
 	 * This can happen if the flag filter is toggled
 	 * and the current flag is the first not filtered.
 	 */
 	if ((flag == flags) && !isFlagLegal(flag)) {
-		flag    = currentflag;
-		topline = currentflag->listline;
+		flag    = last;
+		topline = last->listline;
 		line    = 0;
 	}
 
@@ -408,10 +411,14 @@ void draw(bool withSep) {
 }
 
 bool scrollcurrent() {
-	if(currentflag->listline < topline)
-		topline = max(currentflag->listline, currentflag->listline + currentflag->ndesc - wHeight(List));
-	else if( (currentflag->listline + currentflag->ndesc) > (topline + wHeight(List)))
-		topline = min(currentflag->listline + currentflag->ndesc - wHeight(List), currentflag->listline);
+	int lsLine = currentflag->listline;
+	int flHeight = getFlagHeight(currentflag);
+	int btLine   = lsLine + flHeight;
+	int wdHeight = wHeight(List);
+	if(lsLine < topline)
+		topline = max(lsLine, btLine - wdHeight);
+	else if( btLine > (topline + wdHeight))
+		topline = min(btLine - wdHeight, lsLine);
 	else
 		return false;
 	drawFlags();
@@ -777,77 +784,140 @@ void resetDisplay(bool withSep)
 /** @brief set currentflag to the next flag @a count lines away
  * @param count set how many lines should be skipped
  * @param strict if set to false, at least one item has to be skipped.
+ * @return true if currentflag was changed, flase otherwise
  */
-void setNextItem(int count, bool strict)
+bool setNextItem(int count, bool strict)
 {
-	bool   result  = true;
-	sFlag* curr    = currentflag;
-	int    skipped = 0;
-	int    oldTop  = topline;
+	bool   result   = true;
+	sFlag* curr     = currentflag;
+	sFlag* lastFlag = NULL;
+	int    lastTop  = 0;
+	int    skipped  = 0;
+	int    oldTop   = topline;
+	int    fHeight  = 0;
+
+	// It is crucial to start with a not filtered flag:
+	while (!isFlagLegal(curr) && (curr->next != flags)) {
+		topline += curr->ndesc;
+		curr     = curr->next;
+	}
+
+	// Break this if the current item is still filtered
+	if (!isFlagLegal(curr)) {
+		topline = oldTop;
+		return false;
+	}
 
 	while (result && (skipped < count)) {
-		if (curr->next == flags)
-			result = false; // The list is finished, no next item to display
-		else
-			curr = curr->next;
-
-		// curr is only counted if it is not filtered out:
-		if (isFlagLegal(curr))
-			skipped += getFlagHeight(curr);
-		else
-			// Otherwise topline must be adapted or scrollcurrent() wreaks havoc!
+		lastFlag = curr;
+		lastTop  = topline;
+		fHeight  = getFlagHeight(curr);
+		skipped += fHeight;
+		topline += curr->ndesc - fHeight;
+		curr     = curr->next;
+
+		// Ensure a not filtered flag to continue
+		while (!isFlagLegal(curr) && (curr->next != flags)) {
 			topline += curr->ndesc;
+			curr     = curr->next;
+		}
+
+		// It is possible to end up with the last flag
+		// which might be filtered:
+		if (curr->next == flags) {
+			if (!isFlagLegal(curr)) {
+				// Revert to last known legal state:
+				curr     = lastFlag;
+				topline  = lastTop;
+				skipped -= getFlagHeight(curr);
+			}
+			// Did we fail ?
+			if (skipped < count)
+				result = false;
+		}
 	} // End of trying to find a next item
 
 	if ( (result && strict) || (!strict && skipped) ) {
-		// Move back again if curr ended up being filtered
-		while (!isFlagLegal(curr)) {
-			topline -= curr->ndesc;
-			curr = curr->prev;
-		}
 		drawflag(currentflag, FALSE);
 		currentflag = curr;
 		if (!scrollcurrent())
 			drawflag(currentflag, TRUE);
-	} else
+		result = true;
+	} else {
 		topline = oldTop;
+		result  = false;
+	}
+
+	return result;
 }
 
 
 /* @brief set currentflag to the previous item @a count lines away
  * @param count set how many lines should be skipped
  * @param strict if set to false, at least one item has to be skipped.
+ * @return true if currentflag was changed, flase otherwise
  */
-void setPrevItem(int count, bool strict)
+bool setPrevItem(int count, bool strict)
 {
-	bool   result  = true;
-	sFlag* curr    = currentflag;
-	int    skipped = 0;
-	int    oldTop  = topline;
+	bool   result   = true;
+	sFlag* curr     = currentflag;
+	sFlag* lastFlag = NULL;
+	int    lastTop  = 0;
+	int    skipped  = 0;
+	int    oldTop   = topline;
+	int    fHeight  = 0;
+
+	// It is crucial to start with a not filtered flag:
+	while (!isFlagLegal(curr) && (curr != flags)) {
+		topline -= curr->ndesc;
+		curr     = curr->prev;
+	}
+	// Break this if the current item is still filtered
+	if (!isFlagLegal(curr)) {
+		topline = oldTop;
+		return false;
+	}
 
 	while (result && (skipped < count)) {
-		if (curr == flags)
-			result = false; // The list is finished, no previous item to display
-		else
-			curr = curr->prev;
-
-		// curr is only counted if it is not filtered out:
-		if (isFlagLegal(curr))
-			skipped += getFlagHeight(curr);
-		else
+		lastFlag = curr;
+		lastTop  = topline;
+		curr     = curr->prev;
+
+		// Ensure a not filtered flag to continue
+		while (!isFlagLegal(curr) && (curr != flags)) {
 			topline -= curr->ndesc;
-	} // End of trying to find next item
+			curr     = curr->prev;
+		}
 
-	if ( (result && strict) || (!strict && skipped) ) {
-		// Move forth again if curr ended up being filtered
-		while (!isFlagLegal(curr)) {
-			topline += curr->ndesc;
-			curr = curr->next;
+		fHeight  = getFlagHeight(curr);
+		skipped += fHeight;
+		topline -= curr->ndesc - fHeight;
+
+		// It is possible to end up with the first flag
+		// which might be filtered:
+		if (curr == flags) {
+			if (!isFlagLegal(curr)) {
+				// Revert to last known legal state:
+				skipped -= getFlagHeight(curr);
+				curr     = lastFlag;
+				topline  = lastTop;
+			}
+			// Did we fail ?
+			if (skipped < count)
+				result = false;
 		}
+	} // End of trying to find a next item
+
+	if ( (result && strict) || (!strict && skipped) ) {
 		drawflag(currentflag, FALSE);
 		currentflag = curr;
 		if (!scrollcurrent())
 			drawflag(currentflag, TRUE);
-	} else
+		result = true;
+	} else {
 		topline = oldTop;
+		result  = false;
+	}
+
+	return result;
 }


^ permalink raw reply related	[flat|nested] 238+ messages in thread
* [gentoo-commits] proj/ufed:master commit in: /
@ 2013-02-01 10:49 Sven Eden
  0 siblings, 0 replies; 238+ messages in thread
From: Sven Eden @ 2013-02-01 10:49 UTC (permalink / raw
  To: gentoo-commits

commit:     e4bd16c64a35ed62e23388201c9e03edbcd4e1df
Author:     Sven Eden <sven.eden <AT> gmx <DOT> de>
AuthorDate: Fri Feb  1 10:39:48 2013 +0000
Commit:     Sven Eden <sven.eden <AT> gmx <DOT> de>
CommitDate: Fri Feb  1 10:39:48 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/ufed.git;a=commit;h=e4bd16c6

Reorganized filter toggling finally enabling local/global and installed/not-installed filter. The toggle no longer leads to a list reset, the display stays where it is.

---
 ufed-curses-checklist.c |    6 ++--
 ufed-curses.c           |   48 +++++++++++++++++++++++++++++++++-------------
 2 files changed, 37 insertions(+), 17 deletions(-)

diff --git a/ufed-curses-checklist.c b/ufed-curses-checklist.c
index 5950796..d9f3067 100644
--- a/ufed-curses-checklist.c
+++ b/ufed-curses-checklist.c
@@ -26,9 +26,9 @@ static const sKey keys[] = {
 	{ '\033',   mkKey("Cancel (Esc)")        },
 	{ -1,       mkKey("Display (")           },
 	{ KEY_F(5), mkKey("Mask (F5)")           },
-	{ KEY_F(6), mkKey("Order (F6)")          },
-//	{ KEY_F(7), mkKey("Local/Global (F7)")   },
-//	{ KEY_F(8), mkKey("Installed (F8)")      },
+	{ KEY_F(6), mkKey("Local/Global (F7)")   },
+	{ KEY_F(7), mkKey("Installed (F8)")      },
+	{ KEY_F(8), mkKey("Order (F6)")          },
 	{ -1,       mkKey(")")                   },
 	{ '\0',     mkKey("")                    }
 };

diff --git a/ufed-curses.c b/ufed-curses.c
index 2808055..d14cd38 100644
--- a/ufed-curses.c
+++ b/ufed-curses.c
@@ -703,28 +703,48 @@ int maineventloop(
 					if      (eMask_masked   == e_mask) e_mask = eMask_unmasked;
 					else if (eMask_unmasked == e_mask) e_mask = eMask_both;
 					else                               e_mask = eMask_masked;
-					resetDisplay(withSep);
+
+					if ( !isFlagLegal(currentflag)
+					  && !setNextItem(1, true)
+					  && !setPrevItem(1, true) )
+						resetDisplay(withSep);
+					else
+						draw(withSep);
+
 					break;
 
 				case KEY_F(6):
+					if      (eScope_local  == e_scope) e_scope = eScope_all;
+					else if (eScope_global == e_scope) e_scope = eScope_local;
+					else                               e_scope = eScope_global;
+
+					if ( !isFlagLegal(currentflag)
+					  && !setNextItem(1, true)
+					  && !setPrevItem(1, true) )
+						resetDisplay(withSep);
+					else
+						draw(withSep);
+					break;
+
+				case KEY_F(7):
+					if      (eState_installed    == e_state) e_state = eState_notinstalled;
+					else if (eState_notinstalled == e_state) e_state = eState_all;
+					else                                     e_state = eState_installed;
+
+					if ( !isFlagLegal(currentflag)
+					  && !setNextItem(1, true)
+					  && !setPrevItem(1, true) )
+						resetDisplay(withSep);
+					else
+						draw(withSep);
+					break;
+
+				case KEY_F(8):
 					if (eOrder_left == e_order) e_order = eOrder_right;
 					else                        e_order = eOrder_left;
 					drawFlags();
 					break;
 
-//				case KEY_F(7):
-//					if      (eScope_local  == e_scope) e_scope = eScope_all;
-//					else if (eScope_global == e_scope) e_scope = eScope_local;
-//					else if (eScope_all    == e_scope) e_scope = eScope_global;
-//					resetDisplay();
-//					break;
-//
-//				case KEY_F(8):
-//					if      (eState_installed    == e_state) e_state = eState_notinstalled;
-//					else if (eState_notinstalled == e_state) e_state = eState_all;
-//					else if (eState_all          == e_state) e_state = eState_installed;
-//					resetDisplay();
-//					break;
 
 #ifdef KEY_RESIZE
 				case KEY_RESIZE:


^ permalink raw reply related	[flat|nested] 238+ messages in thread
* [gentoo-commits] proj/ufed:master commit in: /
@ 2013-02-01 10:49 Sven Eden
  0 siblings, 0 replies; 238+ messages in thread
From: Sven Eden @ 2013-02-01 10:49 UTC (permalink / raw
  To: gentoo-commits

commit:     9c37d4ce2cd33ec1937bfcdd557ecce5f582c975
Author:     Sven Eden <sven.eden <AT> gmx <DOT> de>
AuthorDate: Fri Feb  1 10:49:57 2013 +0000
Commit:     Sven Eden <sven.eden <AT> gmx <DOT> de>
CommitDate: Fri Feb  1 10:49:57 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/ufed.git;a=commit;h=9c37d4ce

Removed internal (and possibly dangerous) use flags from the list of flags that ufed can handle.

---
 Portage.pm |   12 +++++++-----
 1 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/Portage.pm b/Portage.pm
index 8b91e4b..933d4d1 100644
--- a/Portage.pm
+++ b/Portage.pm
@@ -284,11 +284,13 @@ sub _final_cleaning
 			and $_use_temp->{'-*'}{global}{conf} = 1;
 	}
 	
-	# The following use flags are dangerous and must no be
-	# available using ufed:
-	for my $flag ("*", "boostrap", "build") {
-		defined($_use_temp->{"$flag"}) and delete($_use_temp->{"$flag"});
-	}
+	# The following use flags are dangerous or internal only
+	# and must no be available using ufed:
+	defined($_use_temp->{"*"})         and delete($_use_temp->{"*"});
+	defined($_use_temp->{"bootstrap"}) and delete($_use_temp->{"bootstrap"});
+	defined($_use_temp->{"build"})     and delete($_use_temp->{"build"});
+	defined($_use_temp->{"livecd"})    and delete($_use_temp->{"livecd"});
+	defined($_use_temp->{"selinux"})   and delete($_use_temp->{"selinux"});
 
 	return;
 }


^ permalink raw reply related	[flat|nested] 238+ messages in thread
* [gentoo-commits] proj/ufed:master commit in: /
@ 2013-02-01 10:49 Sven Eden
  0 siblings, 0 replies; 238+ messages in thread
From: Sven Eden @ 2013-02-01 10:49 UTC (permalink / raw
  To: gentoo-commits

commit:     6deb584ee8b64b44b90d81bf58fb853cafebbf61
Author:     Sven Eden <sven.eden <AT> gmx <DOT> de>
AuthorDate: Thu Jan 31 18:26:24 2013 +0000
Commit:     Sven Eden <sven.eden <AT> gmx <DOT> de>
CommitDate: Thu Jan 31 18:26:24 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/ufed.git;a=commit;h=6deb584e

Added support for the new data model to ufed-curses-checklist.c, which made the reading of the input and the generation of the flag list a lot easier and more convenient.

---
 ufed-curses-checklist.c |  722 ++++++++++++++++++++---------------------------
 1 files changed, 305 insertions(+), 417 deletions(-)

diff --git a/ufed-curses-checklist.c b/ufed-curses-checklist.c
index 8c9b408..5950796 100644
--- a/ufed-curses-checklist.c
+++ b/ufed-curses-checklist.c
@@ -11,28 +11,16 @@
 
 #include "ufed-curses-help.h"
 
-/* internal types */
-struct flag {
-	struct item item;
-	char *name;
-	char on;
-	char state[5];
-	bool *isInstalled;
-	char **pkgs;
-	char **descr;
-};
-
-
 /* internal members */
-static struct flag *flags;
-static int descriptionleft;
-static char *fayt;
-static struct item **faytsave;
-static size_t maxDescWidth = 0;
-static char *lineBuf = NULL;
+static int     descriptionleft = 0;
+static char*   fayt            = NULL;
+static sFlag** faytsave        = NULL;
+static size_t  maxDescWidth    = 0;
+static char*   lineBuf         = NULL;
+static sFlag*  flags           = NULL;
 
 #define mkKey(x) x, sizeof(x)-1
-static const struct key keys[] = {
+static const sKey keys[] = {
 	{ '?',      mkKey("Help (?)")            },
 	{ '\n',     mkKey("Save (Return/Enter)") },
 	{ '\033',   mkKey("Cancel (Esc)")        },
@@ -52,20 +40,16 @@ static void free_flags(void);
 
 
 /* external members */
-enum mask  showMasked = show_unmasked; //!< Set whether to show masked, unmasked or both flags
-enum order pkgOrder   = pkgs_left;     //!< Set whether to display package lists left or right of the description
-enum scope showScope  = show_all;      //!< Set whether global, local or all flags are shown
-int lineCountGlobal;
-int lineCountGlobalInstalled;
-int lineCountLocal;
-int lineCountLocalInstalled;
-int lineCountMasked;
-int lineCountMaskedInstalled;
-int lineCountMasked;
+eMask      e_mask    = eMask_unmasked;
+eOrder     e_order   = eOrder_left;
+eScope     e_scope   = eScope_all;
+eState     e_state   = eState_all;
+sListStats listStats = { 0, 0, 0, 0, 0, 0 };
 extern int bottomline, minwidth;
 
 /* static functions */
-static char *getline(FILE *fp) {
+static char *getline(FILE *fp)
+{
 	static size_t size = LINE_MAX;
 
 	if (NULL == lineBuf) {
@@ -104,167 +88,80 @@ static char *getline(FILE *fp) {
 	return NULL; // never reached.
 }
 
-static void read_flags(void) {
-	FILE *input   = fdopen(3, "r");
-	int   lineNum = 0;
-	char *line    = NULL;
+static void read_flags(void)
+{
+	FILE*  input     = fdopen(3, "r");
+	int    lineNum   = 0;
+	char*  line      = NULL;
+	int    ndescr    = 0;
+	char   endChar   = 0;
+	size_t fullWidth = 0;
+	struct {
+		int start, end;
+	} name, desc, pkg, state;
 
 	if(input == NULL)
 		ERROR_EXIT(-1, "fdopen failed with error %d\n", errno);
 	atexit(&free_flags);
 
-	// Initialize line count per type:
-	lineCountGlobal          = 0;
-	lineCountGlobalInstalled = 0;
-	lineCountLocal           = 0;
-	lineCountLocalInstalled  = 0;
-	lineCountMasked          = 0;
-	lineCountMaskedInstalled = 0;
-	lineCountMasked          = 0;
+	for(line = getline(input); line ; line = getline(input)) {
+		name.start  = name.end  = -1;
+		state.start = state.end = -1;
 
-	for(;;) {
-		struct {
-			int start, end;
-		} name, on, state, pkgs, desc;
-		int ndescr = 0;
-		struct flag *flag = NULL;
-		char descState = 0;
-
-		line = getline(input);
-		if(NULL == line)
-			break;
-		if(sscanf(line, "%n%*s%n %n%*s%n (%n%*[ +-]%n) %d",
+		if (sscanf(line, "%n%*s%n [%n%*[ +-]%n] %d",
 				&name.start,  &name.end,
-				&on.start,    &on.end,
 				&state.start, &state.end,
 				&ndescr) != 1)
-			ERROR_EXIT(-1, "flag sscanf failed on line %d:\n\"%s\"\n", lineNum, line);
-
-		/* Allocate memory for the struct and the arrays */
-		// struct
-		if (NULL == (flag = (struct flag*)malloc(sizeof(struct flag))))
-			ERROR_EXIT(-1, "Can not allocate %lu bytes for flag\n", sizeof(struct flag));
-		// isInstalled
-		if (NULL == (flag->isInstalled = (bool*)calloc(ndescr, sizeof(bool))))
-			ERROR_EXIT(-1, "Can not allocate %lu bytes for isInstalled array\n", ndescr * sizeof(bool));
-		// name
-		if (NULL == (flag->name = (char*)calloc(name.end - name.start + 1, sizeof(char))))
-			ERROR_EXIT(-1, "Can not allocate %lu bytes for flag name\n",
-				(name.end - name.start + 1) * sizeof(char));
-		// pkgs
-		if (NULL == (flag->pkgs = (char**)calloc(ndescr, sizeof(char*))))
-			ERROR_EXIT(-1, "Can not allocate %lu bytes for pkg array\n", ndescr * sizeof(char*));
-		// descr
-		if (NULL == (flag->descr = (char**)calloc(ndescr, sizeof(char*))))
-			ERROR_EXIT(-1, "Can not allocate %lu bytes for descr array\n", ndescr * sizeof(char*));
-
-		/* note position and name of the flag */
-		flag->item.listline = lineNum;
-		flag->item.currline = 0;
+			ERROR_EXIT(-1, "Flag read failed on line %d:\n\"%s\"\n", lineNum + 1, line);
+
+		// Check stats
+		if ((state.end - state.start) != 2)
+			ERROR_EXIT(-1, "Illegal flag stats on line %d:\n\"%s\"\n", lineNum + 1, line);
+
+		// Create a new flag
+		line[name.end]  = '\0';
+		line[state.end] = '\0';
+		sFlag* newFlag = addFlag(&flags, &line[name.start], lineNum, ndescr, &line[state.start]);
 
 		/* The minimum width of the left side display is:
-		 * Space + Selection + Space + name + Space + Mask brackets.
+		 * Space + Selection + Space + name + Space + Mask brackets/Force plus.
 		 * = 1 + 3 + 1 + strlen(name) + 1 + 2
 		 * = strlen(name) + 8
 		 */
-		if(name.end - name.start + 8 > minwidth)
+		if( (name.end - name.start + 8) > minwidth)
 			minwidth = name.end - name.start + 8;
-		strncpy(flag->name, &line[name.start], name.end - name.start);
-
-		/* check and save current flag setting from configuration */
-		line[on.end] = '\0';
-		if(!strcmp(&line[on.start], "on"))
-			flag->on = '+';
-		else if(!strcmp(&line[on.start], "off"))
-			flag->on = '-';
-		else if(!strcmp(&line[on.start], "def"))
-			flag->on = ' ';
-		else
-			ERROR_EXIT(-1, "flag->on can not be determined with \"%s\"\n", &line[on.start]);
-
-		/* check and set flag state */
-		if(state.end - state.start != 2)
-			ERROR_EXIT(-1, "state length is %d (must be 2)\n", state.end - state.start);
-		strncpy(flag->state, &line[state.start], 2);
-
-		/* check and set flag item height */
-		flag->item.ndescr = ndescr;
 
 		/* read description(s) and determine flag status */
-		flag->item.isMasked    = false;
-		flag->item.isGlobal    = false;
 		for (int i = 0; i < ndescr; ++i) {
-			pkgs.start = pkgs.end = -1;
-			desc.start = desc.end = -1;
+			desc.start  = desc.end  = -1;
+			pkg.start   = pkg.end   = -1;
+			state.start = state.end = -1;
 
 			line = getline(input);
 			if (!line) break;
 
-			/* There are two possible layouts:
-			 * a: "g [description]" for global flag descriptions and
-			 * b: "x (pkg(s)) [description]" for local flag descriptions
-			 * We therefore need two sscanf attempts. Use b first, as
-			 * it is more common.
-			 */
-			if ((sscanf(line, "(%n%*[^)]%n) [%n%*[^]]%n] %c",
-					&pkgs.start,  &pkgs.end,
-					&desc.start,  &desc.end,
-					&descState) !=1 )
-			  &&(sscanf(line, "[%n%*[^]]%n] %c",
+			if ( (sscanf(line, "\t%n%*[^\t]%n\t (%n%*[^)]%n) [%n%*[ +-]%n%c",
 					&desc.start,  &desc.end,
-					&descState) !=1))
-				ERROR_EXIT(-1, "desc sscanf failed on line\n\"%s\"\n", line);
-
-			// Set general state of the flag
-			flag->isInstalled[i] = false;
-			if ('g' == descState) {
-				flag->item.isGlobal  = true;
-				++lineCountGlobal;
-			}
-			else if ('G' == descState) {
-				flag->item.isGlobal  = true;
-				flag->isInstalled[i] = true;
-				++lineCountGlobalInstalled;
-			}
-			else if ('l' == descState) {
-				++lineCountLocal;
-			}
-			else if ('L' == descState) {
-				flag->isInstalled[i] = true;
-				++lineCountLocalInstalled;
-			}
-			else if ('M' == descState) {
-				flag->item.isMasked  = true;
-				flag->isInstalled[i] = true;
-				++lineCountMaskedInstalled;
-			}
-			else if ('m' == descState) {
-				flag->item.isMasked = true;
-				++lineCountMasked;
-			}
-
-			// Save packages
-			if (pkgs.start > -1) {
-				int pkgLen = pkgs.end - pkgs.start;
-				if (NULL == (flag->pkgs[i] = (char*)calloc(pkgLen + 1, sizeof(char))) )
-					ERROR_EXIT(-1, "Unable to allocate %lu bytes for pkg list %d\n",
-						sizeof(char) * (pkgLen + 1), i);
-				strncpy(flag->pkgs[i], &line[pkgs.start], pkgLen);
-			} else
-				flag->pkgs[i] = NULL;
-
-			// Save description
-			if (desc.start > -1) {
-				int descLen = desc.end - desc.start;
-				if (NULL == (flag->descr[i] = (char*)calloc(descLen + 1, sizeof(char))) )
-					ERROR_EXIT(-1, "Unable to allocate %lu bytes for description %d\n",
-						sizeof(char) * (descLen + 1), i);
-				strncpy(flag->descr[i], &line[desc.start], descLen);
+					&pkg.start,   &pkg.end,
+					&state.start, &state.end,
+					&endChar) != 1)
+			  || (']' != endChar) )
+				ERROR_EXIT(-1, "Description read failed on line %d\n\"%s\"\n", lineNum + 1, line);
+
+			// Check stats
+			if ((state.end - state.start) != 5)
+				ERROR_EXIT(-1, "Illegal description stats on line %d:\n\"%s\"\n", lineNum + 1, line);
+
+			// Add description line to flag:
+			line[desc.end]  = '\0';
+			line[state.end] = '\0';
+			if ( (pkg.end - pkg.start) > 1) {
+				line[pkg.end]   = '\0';
+				fullWidth = addFlagDesc(newFlag, &line[pkg.start], &line[desc.start], &line[state.start]);
 			} else
-				ERROR_EXIT(-1, "Flag %s has no description at line %d\n", flag->name, i);
+				fullWidth = addFlagDesc(newFlag, NULL, &line[desc.start], &line[state.start]);
 
 			// Note new max length if this line is longest:
-			size_t fullWidth = 1 + strlen(flag->descr[i]) + (flag->pkgs[i] ? strlen(flag->pkgs[i]) + 3 : 0);
 			if (fullWidth > maxDescWidth)
 				maxDescWidth = fullWidth;
 
@@ -272,50 +169,30 @@ static void read_flags(void) {
 			++lineNum;
 		} // loop through description lines
 
-		/* Save flag in our linked list */
-		if(flags==NULL) {
-			flag->item.prev = (struct item *) flag;
-			flag->item.next = (struct item *) flag;
-			flags = flag;
-		} else {
-			flag->item.next = (struct item *) flags;
-			flag->item.prev = flags->item.prev;
-			flags->item.prev->next = (struct item *) flag;
-			flags->item.prev = (struct item *) flag;
-		}
+		// Add line data to the list stats
+		addLineStats(newFlag, &listStats);
 	} // loop while input given
 
 	fclose(input);
 
-	if(flags==NULL) {
-		fputs("No input!\n", stderr);
-		exit(-1);
-	}
+	if(flags == NULL)
+		ERROR_EXIT(-1, "Unable to start: %s\n", "No Input!");
 
 	// Save the last line, it is needed in several places
 	bottomline = lineNum;
 }
 
-static void free_flags(void) {
-	struct flag *flag = flags;
+static void free_flags(void)
+{
+	sFlag* flag = flags->prev;
 
 	// Clear all flags
-	if(flag != NULL) {
-		flag->item.prev->next = NULL;
-		do {
-			void *p = flag;
-			for (int i = 0; i < flag->item.ndescr; ++i) {
-				if (flag->pkgs[i])  free(flag->pkgs[i]);
-				if (flag->descr[i]) free(flag->descr[i]);
-			}
-			if (flag->name)        free(flag->name);
-			if (flag->isInstalled) free(flag->isInstalled);
-			if (flag->pkgs)        free(flag->pkgs);
-			if (flag->descr)       free(flag->descr);
-			flag = (struct flag *) flag->item.next;
-			free(p);
-		} while(flag != NULL);
-		flags = NULL;
+	while (flags) {
+		if (flag)
+			destroyFlag(&flags, &flag);
+		else
+			destroyFlag(&flags, &flags);
+		flag = flags ? flags->prev ? flags->prev : flags : NULL;
 	}
 
 	// Clear line buffer
@@ -324,16 +201,16 @@ static void free_flags(void) {
 }
 
 
-static int drawflag(struct item *item, bool highlight) {
-	struct flag *flag = (struct flag *) item;
+static int drawflag(sFlag* flag, bool highlight)
+{
 	char buf[wWidth(List)+1];
 	char desc[maxDescWidth];
 	int idx   = 0;
 	int usedY = 0;
-	int line  = flag->item.currline;
+	int line  = flag->currline;
 
 	// Return early if there is nothing to display:
-	if (!isLegalItem(&flag->item))
+	if (!isFlagLegal(flag))
 		return 0;
 
 	/* Determine with which description to start.
@@ -342,7 +219,7 @@ static int drawflag(struct item *item, bool highlight) {
 	 * themselves.
 	 */
 	if (line < 0) {
-		if (-line < getItemHeight(&flag->item)) {
+		if (-line < getFlagHeight(flag)) {
 			idx   = -line;
 			line  = 0;
 			usedY = idx;
@@ -353,53 +230,65 @@ static int drawflag(struct item *item, bool highlight) {
 
 	memset(buf, 0, sizeof(char) * (wWidth(List)+1));
 
-	/* print the selection, name and state of the flag */
-	sprintf(buf, " %c%c%c %s%s%s%-*s ",
-		/* State of selection */
-		flag->on == ' ' ? '(' : '[',
-		flag->on == ' '
-			? flag->on == ' '
-				? flag->state[0] : ' '
-			: flag->on,
-		flag->on == ' ' ? ')' : ']',
-		/* name */
-		flag->item.isMasked ? "(" : "", flag->name, flag->item.isMasked ? ")" : "",
-		/* distance */
-		(int)(minwidth - (flag->item.isMasked ? 4 : 6) - strlen(flag->name)), " ");
-		// At this point buf is filled up to minwidth
-
-	/* print descriptions according to filters
-	 * TODO: Implement installed/all filters
-	 */
-	if(idx < flag->item.ndescr) {
-		for(;;) {
-			// Filter global description if it is not wanted:
-			if (!idx && (show_local == showScope) && flag->item.isGlobal) {
-				++idx;
+	// print descriptions according to filters
+	if(idx < flag->ndesc) {
+		int lHeight = wHeight(List);
+		for( ; (idx < flag->ndesc) && (line < lHeight); ++idx) {
+			// Continue if any of the filters apply:
+			if (!isDescLegal(flag, idx))
 				continue;
-			}
 
-			// Break on local descriptions if they are not wanted:
-			if (idx && (show_global == showScope))
-				break;
-
-			// Display flag state
-			bool isGlobalDesc = flag->item.isGlobal && !flag->pkgs[idx] ? true : false;
-			sprintf(buf + minwidth, " %s %c%c  ",
-				flag->state,
-				isGlobalDesc ? ' ' : flag->item.isMasked ? 'M' : 'L',
-				flag->isInstalled[idx] ? '*' : ' ');
+			if (!buf[0]) {
+				/* print the selection, name and state of the flag */
+				char prefix[2]  = { 0, 0 };
+				char postfix[2] = { 0, 0 };
+				int  postlen    = 5;
+				if (isDescForced(flag, idx)) {
+					prefix[0]  = '+';
+					postfix[0] = '+';
+					postlen    = 3;
+				} else if (isDescMasked(flag, idx)) {
+					prefix[0]  = '(';
+					postfix[0] = ')';
+					postlen    = 3;
+				}
+				sprintf(buf, " %c%c%c %s%s%s%-*s ",
+					/* State of selection */
+					flag->stateConf == ' ' ? '(' : '[',
+					flag->stateConf,
+					flag->stateConf == ' ' ? ')' : ']',
+					/* name */
+					prefix, flag->name, postfix,
+					/* distance */
+					(int)(minwidth - postlen - strlen(flag->name)), " ");
+					// At this point buf is filled up to minwidth
+			} // End of generating left side mask display
+
+			/* Display flag state
+			 * The order in which the states are to be displayed is:
+			 * 1. make.defaults
+			 * 2. package.use
+			 * 3. make.conf
+			 * 4. global/local
+			 * 5. installed/not installed
+			 */
+			sprintf(buf + minwidth, " %c%c%c %c%c ",
+				flag->stateDefault,
+				flag->desc[idx].statePackage,
+				flag->stateConf,
+				flag->desc[idx].isGlobal ? ' ' : 'L',
+				flag->desc[idx].isInstalled ? 'i' : ' ');
 
 			// Assemble description line:
 			memset(desc, 0, maxDescWidth * sizeof(char));
-			if (flag->pkgs[idx]) {
-				if (pkgs_left == pkgOrder)
-					sprintf(desc, "(%s) %s", flag->pkgs[idx], flag->descr[idx]);
+			if (flag->desc[idx].pkg) {
+				if (e_order == eOrder_left)
+					sprintf(desc, "(%s) %s", flag->desc[idx].pkg, flag->desc[idx].desc);
 				else
-					sprintf(desc, "%s (%s)", flag->descr[idx], flag->pkgs[idx]);
+					sprintf(desc, "%s (%s)", flag->desc[idx].desc, flag->desc[idx].pkg);
 			}
 			else
-				sprintf(desc, "%s", flag->descr[idx]);
+				sprintf(desc, "%s", flag->desc[idx].desc);
 
 			// Now display the description line according to its horizontal position
 			sprintf(buf + minwidth + 8, "%-*.*s",
@@ -418,224 +307,223 @@ static int drawflag(struct item *item, bool highlight) {
 			// Finally put the line on the screen
 			mvwaddstr(win(List), line, 0, buf);
 			mvwaddch(win(List), line, minwidth,     ACS_VLINE); // Before state
-			mvwaddch(win(List), line, minwidth + 3, ACS_VLINE); // Between state and scope
-			mvwaddch(win(List), line, minwidth + 6, ACS_VLINE); // After scope
+			mvwaddch(win(List), line, minwidth + 4, ACS_VLINE); // Between state and scope
+			mvwaddch(win(List), line, minwidth + 7, ACS_VLINE); // After scope
 			++line;
-			++idx;
 			++usedY;
-			if((idx < flag->item.ndescr) && (line < wHeight(List)) ) {
+			if(((idx + 1) < flag->ndesc) && (line < lHeight) ) {
 				char *p;
 				for(p = buf; p != buf + minwidth; p++)
 					*p = ' ';
-				continue;
 			}
-			break;
 		}
 	} else {
 		memset(buf+minwidth, ' ', wWidth(List)-minwidth);
 		buf[wWidth(List)] = '\0';
 		waddstr(win(List), buf);
 	}
+
 	if(highlight)
-		wmove(win(List), max(flag->item.currline, 0), 2);
+		wmove(win(List), max(flag->currline, 0), 2);
 	wnoutrefresh(win(List));
+
 	return usedY;
 }
 
-static int callback(struct item **currentitem, int key) {
-	if(*fayt!='\0' && key!=KEY_BACKSPACE && (key==' ' || key!=(unsigned char) key || !isprint(key))) {
-		*fayt = '\0';
-		wattrset(win(Input), COLOR_PAIR(3));
-		mvwhline(win(Input), 0, 0, ' ', wWidth(Input));
-		mvwaddch(win(Input), 0, minwidth,     ACS_VLINE); // Before state
-		mvwaddch(win(Input), 0, minwidth + 3, ACS_VLINE); // Between state and scope
-		mvwaddch(win(Input), 0, minwidth + 6, ACS_VLINE); // After scope
-		wmove(win(Input), 0, 0);
-		wrefresh(win(Input));
+static int callback(sFlag** curr, int key)
+{
+	WINDOW* wInp = win(Input);
+	WINDOW* wLst = win(List);
+	size_t  fLen = 0;
+	if ( fayt[0]
+	  && (key != KEY_BACKSPACE)
+	  && (key != KEY_DC)
+	  && (key != 0177)
+	  && ( (key == ' ') || (key != (unsigned char)key) || !isprint(key)) ) {
+		fayt[0] = '\0';
+		drawStatus(true);
+		wrefresh(wInp);
 	}
-	if(descriptionleft!=0 && key!=KEY_LEFT && key!=KEY_RIGHT) {
+
+	// Reset possible side scrolling of the current flags description first
+	if(descriptionleft && (key != KEY_LEFT) && (key != KEY_RIGHT) ) {
 		descriptionleft = 0;
-		drawflag(*currentitem, TRUE);
+		drawflag(*curr, TRUE);
 	}
+
 	switch(key) {
-	default:
-		if(key==(unsigned char) key && isprint(key)) {
-			struct item *item = *currentitem;
-			int n = strlen(fayt);
-			if(strncasecmp(((struct flag *) item)->name, fayt, n)!=0)
-				n--;
-			fayt[n] = (char) key;
-			faytsave[n] = *currentitem;
-			n++;
-			fayt[n] = '\0';
-
-			/* if the current flag already matches the input string,
-			 * then update the input area only.
-			 */
-			if(strncasecmp(((struct flag *) item)->name, fayt, n)==0) {
-				wattrset(win(Input), COLOR_PAIR(3) | A_BOLD);
-				mvwaddstr(win(Input), 0, 0, fayt);
-				wrefresh(win(Input));
-			}
-			/* if the current flag does not match, search one that does. */
-			else {
-				do item = item->next;
-				while( (item != *currentitem)
-				    && ( ( strncasecmp(((struct flag *) item)->name, fayt, n)
-				    	|| !isLegalItem(item)) ) );
-
-				/* if there was no match (or the match is filtered),
-				 * update the input area to show that there is no match
-				 */
-				if (item == *currentitem) {
-					if (item != *currentitem)
-						item = *currentitem;
-					wattrset(win(Input), COLOR_PAIR(4) | A_BOLD | A_REVERSE);
-					mvwaddstr(win(Input), 0, 0, fayt);
-					wmove(win(Input), 0, n-1);
-					wnoutrefresh(win(List));
-					wrefresh(win(Input));
-				} else {
-					drawflag(*currentitem, FALSE);
-					*currentitem = item;
-					scrollcurrent();
-					drawflag(*currentitem, TRUE);
-					wattrset(win(Input), COLOR_PAIR(3) | A_BOLD);
-					mvwaddstr(win(Input), 0, 0, fayt);
-					wnoutrefresh(win(List));
-					wrefresh(win(Input));
-				}
-			}
-		}
-		break;
-	case KEY_BACKSPACE: {
-			int n = strlen(fayt);
-			if(n==0)
+		case KEY_DC:
+		case 0177:
+		case KEY_BACKSPACE:
+			fLen = strlen(fayt);
+			if(0 == fLen)
 				break;
-			n--;
-			fayt[n] = '\0';
-			drawflag(*currentitem, FALSE);
-			*currentitem = faytsave[n];
+			fayt[--fLen] = '\0';
+			drawflag(*curr, FALSE);
+			*curr = faytsave[fLen];
 			scrollcurrent();
-			drawflag(*currentitem, TRUE);
-			wattrset(win(Input), COLOR_PAIR(3) | A_BOLD);
-			mvwaddstr(win(Input), 0, 0, fayt);
-			whline(win(Input), ' ', 2);
-			if(n==0) {
-				wmove(win(List), (*currentitem)->currline, 2);
-				wnoutrefresh(win(Input));
-				wrefresh(win(List));
+			drawflag(*curr, TRUE);
+			wattrset(wInp, COLOR_PAIR(5) | A_BOLD);
+			mvwaddstr(wInp, 0, 0, fayt);
+			whline(wInp, ' ', 2);
+			if(fLen == 0)
+				wmove(wLst, (*curr)->currline, 2);
+			wnoutrefresh(wLst);
+			wrefresh(wInp);
+			break;
+		case '\n':
+		case KEY_ENTER:
+			if(yesno("Save and exit? (Y/N) "))
+				return 0;
+			break;
+		case '\033':
+			if(yesno("Cancel? (Y/N) "))
+				return 1;
+			break;
+		case ' ':
+			// Masked flags can be turned off, nothing else
+			if ( (*curr)->globalMasked ) {
+				if (' ' != (*curr)->stateConf)
+					(*curr)->stateConf = ' ';
 			} else {
-				wnoutrefresh(win(List));
-				wrefresh(win(Input));
+				switch ((*curr)->stateConf) {
+					case '+':
+						(*curr)->stateConf = '-';
+						break;
+					case '-':
+						(*curr)->stateConf = ' ';
+						break;
+					default:
+						(*curr)->stateConf = '+';
+						break;
+				}
 			}
+			if (*curr != flags) {
+				drawflag(*curr, TRUE);
+				wmove(wLst, (*curr)->currline, 2);
+				wrefresh(wLst);
+			} else
+				drawFlags();
+			break;
+		case KEY_LEFT:
+			if(descriptionleft>0)
+				descriptionleft--;
+			drawflag(*curr, TRUE);
+			wmove(wLst, (*curr)->currline, 2);
+			wrefresh(wLst);
+			break;
+		case KEY_RIGHT:
+			descriptionleft++;
+			drawflag(*curr, TRUE);
+			wmove(wLst, (*curr)->currline, 2);
+			wrefresh(wLst);
 			break;
-		}
-	case '\n':
-	case KEY_ENTER:
-		if(yesno("Save and exit? (Y/N) "))
-			return 0;
-		break;
-	case '\033':
-		if(yesno("Cancel? (Y/N) "))
-			return 1;
-		break;
-	case ' ': {
-		// Masked flags can be turned off, nothing else
-		if ( (*currentitem)->isMasked
-		  && (' ' != ((struct flag *) *currentitem)->on) )
-			((struct flag *) *currentitem)->on = ' ';
-		else {
-			switch (((struct flag *) *currentitem)->on) {
-				case '+':
-					((struct flag *) *currentitem)->on = '-';
-					break;
-				case '-':
-					((struct flag *) *currentitem)->on = ' ';
-					break;
-				default:
-					((struct flag *) *currentitem)->on = '+';
-					break;
-			}
-		}
-		if (*currentitem != &flags->item) {
-			drawflag(*currentitem, TRUE);
-			wmove(win(List), (*currentitem)->currline, 2);
-			wrefresh(win(List));
-		} else {
-			drawitems();
-		}
-		break;
-	}
-	case KEY_LEFT:
-		if(descriptionleft>0)
-			descriptionleft--;
-		drawflag(*currentitem, TRUE);
-		wmove(win(List), (*currentitem)->currline, 2);
-		wrefresh(win(List));
-		break;
-	case KEY_RIGHT:
-		descriptionleft++;
-		drawflag(*currentitem, TRUE);
-		wmove(win(List), (*currentitem)->currline, 2);
-		wrefresh(win(List));
-		break;
 #ifdef NCURSES_MOUSE_VERSION
-	case KEY_MOUSE:
-		// Masked flags can be turned off, nothing else
-		if ( (*currentitem)->isMasked
-		  && (' ' != ((struct flag *) *currentitem)->on) )
-			((struct flag *) *currentitem)->on = ' ';
-		else {
-			switch (((struct flag *) *currentitem)->on) {
-				case '+':
-					((struct flag *) *currentitem)->on = '-';
-					break;
-				case '-':
-					((struct flag *) *currentitem)->on = ' ';
-					break;
-				default:
-					((struct flag *) *currentitem)->on = '+';
-					break;
+		case KEY_MOUSE:
+			// Masked flags can be turned off, nothing else
+			if ( (*curr)->globalMasked ) {
+				if (' ' != (*curr)->stateConf)
+					(*curr)->stateConf = ' ';
+			} else {
+				switch ((*curr)->stateConf) {
+					case '+':
+						(*curr)->stateConf = '-';
+						break;
+					case '-':
+						(*curr)->stateConf = ' ';
+						break;
+					default:
+						(*curr)->stateConf = '+';
+						break;
+				}
 			}
-		}
-		if (*currentitem != &flags->item) {
-			drawflag(*currentitem, TRUE);
-			wmove(win(List), (*currentitem)->currline, 2);
-			wrefresh(win(List));
-		} else {
-			drawitems();
-		}
-		break;
+			if (*curr != flags) {
+				drawflag(*curr, TRUE);
+				wmove(wLst, (*curr)->currline, 2);
+				wrefresh(wLst);
+			} else {
+				drawFlags();
+			}
+			break;
 #endif
-	case '?':
-		help();
-		break;
+		case '?':
+			help();
+			break;
+		default:
+			if( (key == (unsigned char) key) && isprint(key)) {
+				sFlag* flag = *curr;
+				fLen = strlen(fayt);
+				if(fLen && strncasecmp(flag->name, fayt, fLen))
+					--fLen;
+				fayt[fLen]     = (char) key;
+				faytsave[fLen] = *curr;
+				fayt[++fLen]   = '\0';
+
+				/* if the current flag already matches the input string,
+				 * then update the input area only.
+				 */
+				if(!strncasecmp(flag->name, fayt, fLen)) {
+					wattrset(wInp, COLOR_PAIR(5) | A_BOLD);
+					mvwaddstr(wInp, 0, 0, fayt);
+					wrefresh(wInp);
+				}
+				/* if the current flag does not match, search one that does. */
+				else {
+					do flag = flag->next;
+					while( (flag != *curr)
+					    && ( ( strncasecmp(flag->name, fayt, fLen)
+					    	|| !isFlagLegal(flag)) ) );
+
+					/* if there was no match (or the match is filtered),
+					 * update the input area to show that there is no match
+					 */
+					if (flag == *curr) {
+						wattrset(wInp, COLOR_PAIR(4) | A_BOLD | A_REVERSE);
+						mvwaddstr(wInp, 0, 0, fayt);
+						wmove(wInp, 0, fLen - 1);
+						wnoutrefresh(wLst);
+						wrefresh(wInp);
+					} else {
+						drawflag(*curr, FALSE);
+						*curr = flag;
+						scrollcurrent();
+						drawflag(*curr, TRUE);
+						wattrset(wInp, COLOR_PAIR(5) | A_BOLD);
+						mvwaddstr(wInp, 0, 0, fayt);
+						wnoutrefresh(wLst);
+						wrefresh(wInp);
+					}
+				}
+			}
+			break;
 	}
 	return -1;
 }
 
-int main(void) {
+int main(void)
+{
 	int result;
 
 	read_flags();
-	fayt = malloc((minwidth-11+2) * sizeof *fayt);
-	faytsave = malloc((minwidth-11+2) * sizeof *faytsave);
+	fayt     = (char*)  calloc(minwidth, sizeof(*fayt));
+	faytsave = (sFlag**)calloc(minwidth, sizeof(*faytsave));
 	if(fayt==NULL || faytsave==NULL)
-		exit(-1);
+		ERROR_EXIT(-1, "Unable to allocate %lu bytes for search buffer.\n",
+			(minwidth * sizeof(*fayt)) + (minwidth * sizeof(*faytsave)));
 	fayt[0] = '\0';
 
 	initcurses();
 
-	result=maineventloop("Select desired USE flags from the list below:",
-			&callback, &drawflag, (struct item *) flags, keys);
+	result = maineventloop("Select desired USE flags from the list below:",
+				&callback, &drawflag, flags, keys, true);
+
 	cursesdone();
 
-	if(result==0) {
+	if(0 == result) {
 		FILE *output = fdopen(4, "w");
-		struct flag *flag = flags;
+		sFlag *flag = flags;
 		do {
-			switch(flag->on)
+			switch(flag->stateConf)
 			{
 			case '+':
 				fprintf(output, "%s\n", flag->name);
@@ -644,8 +532,8 @@ int main(void) {
 				fprintf(output, "-%s\n", flag->name);
 				break;
 			}
-			flag = (struct flag *) flag->item.next;
-		} while(flag!=flags);
+			flag = flag->next;
+		} while(flag != flags);
 		fclose(output);
 	}
 


^ permalink raw reply related	[flat|nested] 238+ messages in thread
* [gentoo-commits] proj/ufed:master commit in: /
@ 2013-02-01 10:49 Sven Eden
  0 siblings, 0 replies; 238+ messages in thread
From: Sven Eden @ 2013-02-01 10:49 UTC (permalink / raw
  To: gentoo-commits

commit:     37ed232d9b7090992608cedfb191003b4d9e0713
Author:     Sven Eden <sven.eden <AT> gmx <DOT> de>
AuthorDate: Wed Jan 30 14:02:21 2013 +0000
Commit:     Sven Eden <sven.eden <AT> gmx <DOT> de>
CommitDate: Wed Jan 30 14:02:21 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/ufed.git;a=commit;h=37ed232d

Corrected the explanation of the first 3 state characters and added explanations of the two new state characters.

---
 ufed.8 |   43 ++++++++++++++++++++++++++++---------------
 1 files changed, 28 insertions(+), 15 deletions(-)

diff --git a/ufed.8 b/ufed.8
index 8b8c5cb..ce0619e 100644
--- a/ufed.8
+++ b/ufed.8
@@ -4,26 +4,39 @@ ufed \- Gentoo Linux USE flags editor
 .SH "SYNOPSIS"
 .B ufed 
 .SH "DESCRIPTION"
-UFED is a simple program designed to help you configure the systems USE flags
-(see below) to your liking.  To select or unselect a flag highlight it and hit
-space.
+UFED is a simple program designed to help you configure the
+systems USE flags (see below) to your liking. To enable or
+disable a flag highlight it and hit space.
 
-UFED attempts to show you where a particular use setting came from. Each USE
-flag has a 3 character descriptor that represents the three ways a use flag can
-be set.
+UFED attempts to show you where a particular use setting
+came from. Each USE flag has a 3 character descriptor that
+represents the three ways a use flag can be set.
+Additionally two more characters show the status of the
+description found in that line.
 
-The 1st char is the setting from the make.defaults file(s). These are the defaults
-for Gentoo as a whole. These should not be changed.
+The 1st char is the setting from the make.defaults file(s).
+These are the defaults for Gentoo as a whole. These should
+not be changed.
 
-The 2nd char is the setting from the package.use file(s). These will change as
-packages are added or removed from the system.
+The 2nd char is the setting from the package.use file(s).
+These will change as packages are added or removed from the
+system.
 
-The 3rd char is the setting from the make.conf file. These are the only ones
-that should be changed by the user and these are the ones that UFED changes.
+The 3rd char is the setting from the make.conf file. These
+are the only ones that should be changed by the user and
+these are the ones that UFED changes.
 
-If the character is a + then that USE flag was set in that file, if it is a
-space then the flag was not mentioned in that file and if it is a - then that
-flag was unset in that file.
+If the character is a + then that USE flag was set in that
+file, if it is a space then the flag was not mentioned in
+that file and if it is a - then that flag was unset in that
+file.
+
+The 4th char is either empty for global flag descriptions
+or an L for local flag descriptions.
+
+The 5th char is either empty if none of the affected
+packages is installed, or an i if at least one affected
+package is installed.
 
 .B What are USE flags?
 


^ permalink raw reply related	[flat|nested] 238+ messages in thread
* [gentoo-commits] proj/ufed:master commit in: /
@ 2013-02-01 10:49 Sven Eden
  0 siblings, 0 replies; 238+ messages in thread
From: Sven Eden @ 2013-02-01 10:49 UTC (permalink / raw
  To: gentoo-commits

commit:     1bdb819de722aba94ecbde8c56d7f14a4b76104d
Author:     Sven Eden <sven.eden <AT> gmx <DOT> de>
AuthorDate: Thu Jan 31 18:22:08 2013 +0000
Commit:     Sven Eden <sven.eden <AT> gmx <DOT> de>
CommitDate: Thu Jan 31 18:22:08 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/ufed.git;a=commit;h=1bdb819d

Removed now obsolete type definitions as they are moved to ufed-curses-types.h. Further added some fucntion prototypes to draw various aspects of the display on demand.

---
 ufed-curses.h |   86 +++++++++++---------------------------------------------
 1 files changed, 17 insertions(+), 69 deletions(-)

diff --git a/ufed-curses.h b/ufed-curses.h
index 3ef4a24..f996d7c 100644
--- a/ufed-curses.h
+++ b/ufed-curses.h
@@ -1,84 +1,32 @@
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <curses.h>
-
-
-/* debugging macros */
-#define DEBUG_EXIT 1
-#undef DEBUG_TRACE
-
-#if defined(DEBUG_EXIT)
-#  define ERROR_EXIT(code, fmt, ...) { \
-	cursesdone(); \
-	fprintf(stderr, "\nERROR in %s:%d (%s): \n -> ", \
-		__FILE__, __LINE__, __FUNCTION__); \
-	fprintf(stderr, fmt, __VA_ARGS__); \
-	exit(code); \
-}
-#else
-#  define ERROR_EXIT(code, ...) { cursesdone(); exit(code); }
-#endif // DEBUG_EXIT
-#if defined(DEBUG_TRACE)
-# define TRACE { \
-	fprintf(stderr, "(TRACE) %s:%d - %s\n", __FILE__, __LINE__, __FUNCTION__); \
-}
-#else
-# define TRACE
-#endif // DEBUG_TRACE
-
-
-/* global types */
-enum win { Top, Left, List, Input, Scrollbar, Right, Bottom, wCount };
-enum mask { show_unmasked, show_both, show_masked };
-enum order { pkgs_left, pkgs_right };
-enum scope { show_all, show_global, show_local };
-
-struct window {
-	WINDOW *win;
-	const int top, left, height, width;
-};
-
-struct item {
-	struct item *prev, *next;
-	int currline; //!< the current line on the screen this item starts.
-	int listline; //!< the fixed line within the full list this item starts
-	int ndescr;   //!< number of description lines
-	bool isMasked;
-	bool isGlobal;
-};
-
-struct key {
-	int key;
-	const char *descr;
-	size_t length;
-};
+#include "ufed-curses-types.h"
 
+/* global members */
+extern sWindow window[wCount];
 
 /* global prototypes */
 void cursesdone(void);
-int  getItemHeight(struct item *item);
 void initcurses(void);
-bool isLegalItem(struct item *item);
 
 int maineventloop(
 	const char *subtitle,
-	int (*callback)(struct item **currentitem, int key),
-	int (*drawitem)(struct item *item, bool highlight),
-	struct item *items,
-	const struct key *keys);
-void drawitems(void);
+	int (*callback)(sFlag** curr, int key),
+	int (*drawflag)(sFlag*  flag, bool highlight),
+	sFlag* flags,
+	const sKey* keys,
+	bool withSep);
+void drawBottom(bool withSep);
+void drawFlags(void);
+void drawStatus(bool withSep);
+void drawTop(bool withSep);
 bool scrollcurrent(void);
 bool yesno(const char *);
 
 
 /* global inline functions */
-extern struct window window[wCount];
-static inline WINDOW *win(enum win w) { return window[w].win; }
-static inline int wTop   (enum win w) { return (window[w].top   >= 0 ? 0 : LINES) + window[w].top   ; }
-static inline int wLeft  (enum win w) { return (window[w].left  >= 0 ? 0 : COLS ) + window[w].left  ; }
-static inline int wHeight(enum win w) { return (window[w].height > 0 ? 0 : LINES) + window[w].height; }
-static inline int wWidth (enum win w) { return (window[w].width  > 0 ? 0 : COLS ) + window[w].width ; }
+static inline WINDOW *win(eWin w) { return window[w].win; }
+static inline int wTop   (eWin w) { return (window[w].top   >= 0 ? 0 : LINES) + window[w].top   ; }
+static inline int wLeft  (eWin w) { return (window[w].left  >= 0 ? 0 : COLS ) + window[w].left  ; }
+static inline int wHeight(eWin w) { return (window[w].height > 0 ? 0 : LINES) + window[w].height; }
+static inline int wWidth (eWin w) { return (window[w].width  > 0 ? 0 : COLS ) + window[w].width ; }
 static inline int min(int a, int b) { return a < b ? a : b; }
 static inline int max(int a, int b) { return a > b ? a : b; }


^ permalink raw reply related	[flat|nested] 238+ messages in thread
* [gentoo-commits] proj/ufed:master commit in: /
@ 2013-02-01 10:49 Sven Eden
  0 siblings, 0 replies; 238+ messages in thread
From: Sven Eden @ 2013-02-01 10:49 UTC (permalink / raw
  To: gentoo-commits

commit:     34e1d52dfebe0758f3433ee5c7c2c625ca9b5411
Author:     Sven Eden <sven.eden <AT> gmx <DOT> de>
AuthorDate: Thu Jan 31 18:17:18 2013 +0000
Commit:     Sven Eden <sven.eden <AT> gmx <DOT> de>
CommitDate: Thu Jan 31 18:17:18 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/ufed.git;a=commit;h=34e1d52d

Renamed ufed-curses-debug.h, ufed-types.c and ufed-types.h to ufed-curses-debug.h, ufed-curses-types.c and ufed-curses-types.h to match the naming of the other files

---
 ufed-debug.h => ufed-curses-debug.h |    0
 ufed-types.c => ufed-curses-types.c |   69 ++++++++++++++++++++++++++++-------
 ufed-types.h => ufed-curses-types.h |   28 ++++++++++++--
 3 files changed, 79 insertions(+), 18 deletions(-)

diff --git a/ufed-debug.h b/ufed-curses-debug.h
similarity index 100%
rename from ufed-debug.h
rename to ufed-curses-debug.h

diff --git a/ufed-types.c b/ufed-curses-types.c
similarity index 85%
rename from ufed-types.c
rename to ufed-curses-types.c
index 694ea29..7b208fa 100644
--- a/ufed-types.c
+++ b/ufed-curses-types.c
@@ -4,7 +4,7 @@
  *  Created on: 28.01.2013
  *      Author: Sven Eden
  */
-#include "ufed-types.h"
+#include "ufed-curses-types.h"
 #include "ufed-curses.h"
 #include <stdlib.h>
 #include <string.h>
@@ -61,9 +61,9 @@ sFlag* addFlag (sFlag** root, const char* name, int line, int ndesc, const char
 				ERROR_EXIT(-1, "Unable to allocate %lu bytes for %d sDesc_ structs\n",
 					sizeof(sDesc) * ndesc, ndesc)
 
-			newFlag->forced       = false;
+			newFlag->globalForced = false;
+			newFlag->globalMasked = false;
 			newFlag->listline     = line;
-			newFlag->masked       = false;
 			newFlag->name         = strdup(name);
 			newFlag->ndesc        = ndesc;
 			newFlag->next         = NULL;
@@ -128,9 +128,9 @@ size_t addFlagDesc (sFlag* flag, const char* pkg, const char* desc, const char s
 
 			// Set flag mask and force status if this is a global and masked/forced description
 			if (flag->desc[idx].isGlobal && ('+' == flag->desc[idx].stateMasked))
-				flag->masked = true;
+				flag->globalMasked = true;
 			if (flag->desc[idx].isGlobal && ('+' == flag->desc[idx].stateForced))
-				flag->forced = true;
+				flag->globalForced = true;
 
 			// Determine width:
 			result += (flag->desc[idx].pkg ? strlen(flag->desc[idx].pkg) : 0)
@@ -155,15 +155,7 @@ void addLineStats (const sFlag* flag, sListStats* stats)
 {
 	if (flag && stats) {
 		for (int i = 0; i < flag->ndesc; ++i) {
-			// Masked is true if the flag is globally masked/forced
-			// and the description is not explicitly unmasked/unforced,
-			// or if the description is explicitly masked/forced.
-			if ( ('+' == flag->desc[i].stateMasked)
-			  || ('+' == flag->desc[i].stateForced)
-			  || ( (' ' == flag->desc[i].stateMasked)
-				&& flag->masked )
-			  || ( (' ' == flag->desc[i].stateForced)
-				&& flag->forced ) ) {
+			if ( isDescMasked(flag, i) ) {
 				if (flag->desc[i].isInstalled)
 					++stats->lineCountMaskedInstalled;
 				else
@@ -252,6 +244,27 @@ int getFlagHeight (const sFlag* flag)
 }
 
 
+/** @brief return true if a specific description line is force enabled
+ *  If @a flag is NULL, the result will be false.
+ *  @param[in] flag pointer to the flag to check.
+ *  @param[in] idx index of the description line to check.
+ *  @return true if the specific flag (global or local) is forced
+ */
+bool isDescForced(const sFlag* flag, int idx)
+{
+	bool result = false;
+
+	if (flag && (idx < flag->ndesc)) {
+		if ( ('+' == flag->desc[idx].stateForced)
+		  || ( (' ' == flag->desc[idx].stateForced)
+			&& flag->globalForced ) )
+		result = true;
+	}
+
+	return result;
+}
+
+
 /** @brief return true if the flag description @a idx is ok to display.
  *  If @a flag is NULL, the result will be false.
  *  @param[in] flag pointer to the flag to check.
@@ -278,6 +291,34 @@ bool isDescLegal (const sFlag* flag, int idx)
 	return result;
 }
 
+
+/** @brief return true if a specific description line is masked
+ *  If @a flag is NULL, the result will be false.
+ *  @param[in] flag pointer to the flag to check.
+ *  @param[in] idx index of the description line to check.
+ *  @return true if the specific flag (global or local) is masked
+ */
+bool isDescMasked(const sFlag* flag, int idx)
+{
+	bool result = false;
+
+	// Note: Masked is true if the flag is globally masked/forced
+	// and the description is not explicitly unmasked/unforced,
+	// or if the description is explicitly masked/forced.
+	if (flag && (idx < flag->ndesc)) {
+		if ( ('+' == flag->desc[idx].stateMasked)
+		  || ('+' == flag->desc[idx].stateForced)
+		  || ( (' ' == flag->desc[idx].stateMasked)
+			&& flag->globalMasked )
+		  || ( (' ' == flag->desc[idx].stateForced)
+			&& flag->globalForced ) )
+		result = true;
+	}
+
+	return result;
+}
+
+
 /** @brief return true if this flag has at least one line to display.
  *  This method checks the flag and its description line(s)
  *  settings against the globally active filters.

diff --git a/ufed-types.h b/ufed-curses-types.h
similarity index 88%
rename from ufed-types.h
rename to ufed-curses-types.h
index 9953b6a..cb02e85 100644
--- a/ufed-types.h
+++ b/ufed-curses-types.h
@@ -9,11 +9,29 @@
 #define UFED_TYPES_H_INCLUDED 1
 
 #ifdef HAVE_CONFIG_H
-#include "config.h"
+# include "config.h"
 #endif
 
 #include <curses.h>
-#include "ufed-debug.h"
+#include "ufed-curses-debug.h"
+
+#ifdef HAVE_STDINT_H
+# include <stdint.h>
+// TODO : else branch
+#endif
+
+#ifdef HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#ifndef bool
+# ifdef HAVE__BOOL
+#  define bool _Bool
+# else
+#  define bool int
+# endif
+#endif
+
 
 /* =============
  * === enums ===
@@ -94,9 +112,9 @@ typedef struct sDesc_ {
 typedef struct sFlag_ {
 	int     currline;     //!< The current line on the screen this flag starts
 	sDesc*  desc;         //!< variable array of sDesc structs
-	bool    forced;       //!< true if the first global description is force enabled.
+	bool    globalForced; //!< true if the first global description is force enabled.
+	bool    globalMasked; //!< true if the first global description is mask enabled.
 	int     listline;     //!< The fixed line within the full list this flag starts
-	bool    masked;       //!< true if the first global description is mask enabled.
 	char*   name;         //!< Name of the flag or NULL for help lines
 	int     ndesc;        //!< number of description lines
 	struct
@@ -149,7 +167,9 @@ size_t addFlagDesc  (sFlag* flag, const char* pkg, const char* desc, const char
 void   addLineStats (const sFlag* flag, sListStats* stats);
 void   destroyFlag  (sFlag** root, sFlag** flag);
 int    getFlagHeight(const sFlag* flag);
+bool   isDescForced (const sFlag* flag, int idx);
 bool   isDescLegal  (const sFlag* flag, int idx);
+bool   isDescMasked (const sFlag* flag, int idx);
 bool   isFlagLegal  (const sFlag* flag);
 
 #endif /* UFED_TYPES_H_INCLUDED */


^ permalink raw reply related	[flat|nested] 238+ messages in thread
* [gentoo-commits] proj/ufed:master commit in: /
@ 2013-02-01 10:49 Sven Eden
  0 siblings, 0 replies; 238+ messages in thread
From: Sven Eden @ 2013-02-01 10:49 UTC (permalink / raw
  To: gentoo-commits

commit:     56bac0bae4c0496f4a2d2848272cf442784ccc6d
Author:     Sven Eden <sven.eden <AT> gmx <DOT> de>
AuthorDate: Thu Jan 31 18:18:37 2013 +0000
Commit:     Sven Eden <sven.eden <AT> gmx <DOT> de>
CommitDate: Thu Jan 31 18:18:37 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/ufed.git;a=commit;h=56bac0ba

Changed names for the renamed files in Makefile.am (ufed-curses-debug.h, ufed-curses-types.c, ufed-curses-types.h)

---
 Makefile.am |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/Makefile.am b/Makefile.am
index f9b47e3..8cd390c 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -7,8 +7,8 @@ sbin_SCRIPTS = ufed
 libexec_PROGRAMS = ufed-curses
 dist_perl_DATA = Portage.pm
 
-ufed_curses_SOURCES = ufed-types.c ufed-curses.c ufed-curses-checklist.c ufed-curses-help.c
-noinst_HEADERS = ufed-types.h ufed-curses.h ufed-curses-help.h ufed-debug.h
+ufed_curses_SOURCES = ufed-curses-types.c ufed-curses.c ufed-curses-checklist.c ufed-curses-help.c
+noinst_HEADERS = ufed-curses-types.h ufed-curses.h ufed-curses-help.h ufed-curses-debug.h
 dist_man_MANS = ufed.8
 EXTRA_DIST = ufed.pl.in
 


^ permalink raw reply related	[flat|nested] 238+ messages in thread
* [gentoo-commits] proj/ufed:master commit in: /
@ 2013-02-01 10:49 Sven Eden
  0 siblings, 0 replies; 238+ messages in thread
From: Sven Eden @ 2013-02-01 10:49 UTC (permalink / raw
  To: gentoo-commits

commit:     b07cb5ebe2e03e4be359e898ffcc2a2d0bd1d6dc
Author:     Sven Eden <sven.eden <AT> gmx <DOT> de>
AuthorDate: Thu Jan 31 18:19:42 2013 +0000
Commit:     Sven Eden <sven.eden <AT> gmx <DOT> de>
CommitDate: Thu Jan 31 18:19:42 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/ufed.git;a=commit;h=b07cb5eb

Changed the help display to use the new flag type. I have used
the oportunity to clean up the line initialization which was
unneccessarily complicated.
Further added a redraw to the borders to not show the new
status separators when the help text is to be displayed.

---
 ufed-curses-help.c |  154 ++++++++++++++++++++++++++--------------------------
 ufed-curses-help.h |    8 +++-
 2 files changed, 84 insertions(+), 78 deletions(-)

diff --git a/ufed-curses-help.c b/ufed-curses-help.c
index ba71d04..76825d2 100644
--- a/ufed-curses-help.c
+++ b/ufed-curses-help.c
@@ -1,5 +1,4 @@
 #include "ufed-curses-help.h"
-
 #include "ufed-curses.h"
 
 #include <ctype.h>
@@ -12,13 +11,15 @@
 #include <unistd.h>
 
 /* internal types */
-static struct line {
-	struct item item;
-	char *text;
-} *lines;
+// Do not use an own struct, just use sFlag
+//static struct line {
+//	struct item item;
+//	char *text;
+//} *lines;
+static sFlag* lines = NULL;
 
 /* internal members */
-static int helpheight, helpwidth;
+static size_t helpheight, helpwidth;
 
 /* external members */
 
@@ -107,117 +108,116 @@ static void init_lines(void) {
 "Copyright 1999-2005 Gentoo Foundation",
 "Distributed under the terms of the GNU General Public License v2"
 	};
-	struct line *line;
-	const char * const *paragraph = &help[0], *word = &help[0][0];
-	int n, y=0;
+	sFlag* line = NULL;
+	size_t lineCount = sizeof(help) / sizeof(*help);
+	size_t currLine  = 0;
+	size_t n = 0;
+	int    y = 0;
+	const char* word = help[currLine];
 
 	helpheight = wHeight(List);
-	helpwidth = wWidth(List);
+	helpwidth  = wWidth(List);
+	char buf[helpwidth + 1];
+	memset(buf, 0, (helpwidth + 1) * sizeof(char));
 
 	atexit(&free_lines);
-	for(;;) {
-		line = malloc(sizeof *line);
-		if(line==NULL)
-			ERROR_EXIT(-1, "Can not allocate %lu bytes for help line struct\n", sizeof(*line));
-		if(lines==NULL) {
-			line->item.prev = (struct item *) line;
-			line->item.next = (struct item *) line;
-			lines = line;
-		} else {
-			line->item.next = (struct item *) lines;
-			line->item.prev = lines->item.prev;
-			lines->item.prev->next = (struct item *) line;
-			lines->item.prev = (struct item *) line;
-		}
+	while( currLine < lineCount ) {
+		line = addFlag(&lines, "help", y++, 1, "  ");
 
-		line->item.currline = 0;
-		line->item.isMasked = false;
-		line->item.isGlobal = true;
-		line->item.listline = y++;
-		line->item.ndescr = 1;
+		// Find the last space character in the string
+		// if it is too long to display.
 		n = strlen(word);
-		if(n > helpwidth-1) {
-			for(n = helpwidth-1; word[n]!=' '; n--) {
-				if(n==0) {
-					n = helpwidth;
-					break;
-				}
-			}
+		if(n > helpwidth - 1) {
+			for(n = helpwidth-1; (n > 0) && (word[n] != ' '); --n) ;
+			if(n==0)
+				n = helpwidth;
 		}
-		line->text = calloc((n+1), sizeof(char));
-		if(line->text==NULL)
-			ERROR_EXIT(-1, "Can not allocate %lu bytes for help line\n", (n+1) * sizeof(char));
-		memcpy(line->text, word, n);
-		while(word[n]==' ')
+
+		// copy the text if there is any
+		if (n) {
+			memcpy(buf, word, n);
+			buf[n++] = '\0';
+			addFlagDesc(line, NULL, buf, "+    ");
+		} else
+			addFlagDesc(line, NULL, " ", "+    ");
+
+		// Advance behind current spaces
+		while (word[n] == ' ')
 			n++;
-		word += n;
-		if(word[0]=='\0') {
-			paragraph++;
-			if(paragraph == &help[sizeof help / sizeof *help])
-				break;
-			word = &(*paragraph)[0];
-		}
+
+		// See whether there is text left...
+		if (strlen(word) > n)
+			word += n;
+		else if (++currLine < lineCount)
+			// ...or advance one line
+			word = help[currLine];
 	}
 }
 
 static void free_lines(void) {
-	struct line *line = lines;
-	if(line!=NULL) {
-		line->item.prev->next = NULL;
-		do {
-			void *p = line;
-			free(line->text);
-			line = (struct line *) line->item.next;
-			free(p);
-		} while(line!=NULL);
-		lines = NULL;
+	sFlag* line = lines->prev;
+
+	// Clear all lines
+	while (lines) {
+		if (line)
+			destroyFlag(&lines, &line);
+		else
+			destroyFlag(&lines, &lines);
+		line = lines ? lines->prev ? lines->prev : lines : NULL;
 	}
 }
 
-static const struct key keys[] = {
+static const sKey keys[] = {
 #define key(x) x, sizeof(x)-1
 	{ '\033', key("Back (Esc)") },
 	{ '\0',   key("")         }
 #undef key
 };
 
-static int drawline(struct item *item, bool highlight) {
-	struct line *line = (struct line *) item;
+static int drawline(sFlag* line, bool highlight) {
 	char buf[wWidth(List)+1];
-	sprintf(buf, "%-*.*s", wWidth(List), wWidth(List), line->text);
+
+	sprintf(buf, "%-*.*s", wWidth(List), wWidth(List), line->desc[0].desc);
 	if(!highlight)
 		wattrset(win(List), COLOR_PAIR(3));
 	else
 		wattrset(win(List), COLOR_PAIR(3) | A_BOLD | A_REVERSE);
-	mvwaddstr(win(List), line->item.currline, 0, buf);
+	mvwaddstr(win(List), line->currline, 0, buf);
 	if(highlight)
-		wmove(win(List), line->item.currline, 0);
+		wmove(win(List), line->currline, 0);
 	wnoutrefresh(win(List));
 	return 1;
 }
 
-static int callback(struct item **currentitem, int key) {
+static int callback(sFlag** curr, int key) {
 	switch(key) {
-	case 'Q': case 'q':
-	case '\033':
-		return 0;
+		case 'Q': case 'q':
+		case '\033':
+			return 0;
 #ifdef KEY_RESIZE
-	case KEY_RESIZE:
-		free_lines();
-		init_lines();
-		*currentitem = (struct item *) lines;
-		return -2;
+		case KEY_RESIZE:
+			free_lines();
+			init_lines();
+			*curr = lines;
+			return -2;
 #endif
-	default:
-		return -1;
+		default:
+			return -1;
 	}
 }
 
 void help(void) {
-	if(helpheight!=wHeight(List) || helpwidth!=wWidth(List)) {
+	if ( ((int)helpheight != wHeight(List))
+	  || ((int)helpwidth  != wWidth(List)) ) {
 		if(lines!=NULL)
 			free_lines();
 		init_lines();
 	}
-	maineventloop("", &callback, &drawline, (struct item *) lines, keys);
+
+	maineventloop("", &callback, &drawline, lines, keys, false);
+
+	// Re-draw separators:
+	drawTop(true);
+	drawBottom(true);
+	drawStatus(true);
 }

diff --git a/ufed-curses-help.h b/ufed-curses-help.h
index 5c66482..4cc0df0 100644
--- a/ufed-curses-help.h
+++ b/ufed-curses-help.h
@@ -1 +1,7 @@
-extern void help(void);
+#pragma once
+#ifndef UFED_CURSES_HELP_H_INCLUDED
+#define UFED_CURSES_HELP_H_INCLUDED
+
+void help(void);
+
+#endif /* UFED_CURSES_HELP_H_INCLUDED */


^ permalink raw reply related	[flat|nested] 238+ messages in thread
* [gentoo-commits] proj/ufed:master commit in: /
@ 2013-02-01 10:49 Sven Eden
  0 siblings, 0 replies; 238+ messages in thread
From: Sven Eden @ 2013-02-01 10:49 UTC (permalink / raw
  To: gentoo-commits

commit:     ffc687420a76332329082abab9e787f441910091
Author:     Sven Eden <sven.eden <AT> gmx <DOT> de>
AuthorDate: Wed Jan 30 14:03:09 2013 +0000
Commit:     Sven Eden <sven.eden <AT> gmx <DOT> de>
CommitDate: Wed Jan 30 14:03:09 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/ufed.git;a=commit;h=ffc68742

Removed obsolete passages and changed the output to include the many more details.

---
 ufed.pl.in |  189 ++++++++++++++++++++++--------------------------------------
 1 files changed, 69 insertions(+), 120 deletions(-)

diff --git a/ufed.pl.in b/ufed.pl.in
index 299c79d..bf09de4 100644
--- a/ufed.pl.in
+++ b/ufed.pl.in
@@ -17,54 +17,14 @@ my $interface = 'ufed-curses';
 #			  . " --read-var-info=yes"
 #              . " XX_libexecdir@/ufed-curses 2>/tmp/ufed_memcheck.log";
 
-# no longer needed
-# my %use_descriptions;
-
 sub finalise;
 sub flags_dialog;
 sub save_flags;
 
-# deprecated, the functionality is merged into Portage.pm
-# delete $Portage::all_flags{'*'};
-# read_use_descs;
-# @use_descriptions{qw(bootstrap build)};
-#
-#$Portage::make_conf_flags{'-*'} = 1
-#	if defined $Portage::make_conf_flags{'*'}
-#		&& !$Portage::make_conf_flags{'*'};
-#
-#for(keys %Portage::all_flags) {
-#	@{$use_descriptions{$_}} = "[(Unknown)] g"
-#		if not exists $use_descriptions{$_};
-#}
-#@{$use_descriptions{'-*'}} = '[Never enable any flags other than those specified in make.conf] g';
-#
-#for(@Portage::archs) {
-#	delete $Portage::default_flags{$_};
-#	delete $Portage::all_flags{$_};
-#	delete $use_descriptions{$_};
-#}
-#for my $flag (keys %Portage::use_masked_flags) {
-#	my $masked = 1;
-#	for my $mask (values %{$Portage::use_masked_flags{$flag}}) {
-#		last if not($masked &&= $mask);
-#	}
-#	if($masked) {
-#		if (defined($use_descriptions{$flag})) {
-#			for (my $i = 0; $i < scalar @{$use_descriptions{$flag}}; ++$i) {
-#				$use_descriptions{$flag}->[$i] =~ s/ [lg]$/ m/ ;
-#				$use_descriptions{$flag}->[$i] =~ s/ L$/ M/ ;
-#			}
-#		} else {
-#			delete $use_descriptions{$flag};
-#			delete $Portage::default_flags{$flag};
-#			delete $Portage::all_flags{$flag};
-#		}
-#	}
-#}
 
 flags_dialog;
 
+
 # Take a list and return it ordered the following way:
 # Put "-*" first, followed by enabling flags and put
 # disabling flags to the end.
@@ -112,49 +72,86 @@ sub flags_dialog {
 	# Write out flags 
 	for my $flag (sort { uc $a cmp uc $b } keys %$Portage::use_flags) {
 		my $conf = $Portage::use_flags->{$flag}; ## Shortcut
-		my $state = "g";
-		$outTxt .= sprintf ("%s %s (%s%s) %d\n", $flag,
+# deprecated: The output is updated to match the new data structure.
+#		my $state = "g";
+#
+#		$outTxt .= sprintf ("%s %s (%s%s) %d\n", $flag,
+#					defined($conf->{global}{conf}) ?
+#						$conf->{global}{conf} > 0 ? 'on' :
+#						$conf->{global}{conf} < 0 ? 'off' : 'def' : 'def',
+#					defined($conf->{global}{"default"}) ?
+#						$conf->{global}{"default"} > 0 ? '+' :
+#						$conf->{global}{"default"} < 0 ? '-' : ' ' : ' ',
+#					defined($conf->{global}{conf}) ?
+#						$conf->{global}{conf} > 0 ? '+' :
+#						$conf->{global}{conf} < 0 ? '-' : ' ' : ' ',
+#					$conf->{count});
+
+		$outTxt .= sprintf ("%s [%s%s] %d\n", $flag,
 					defined($conf->{global}{conf}) ?
-						$conf->{global}{conf} > 0 ? 'on' :
-						$conf->{global}{conf} < 0 ? 'off' : 'def' : 'def',
+						$conf->{global}{conf} > 0 ? '+' :
+						$conf->{global}{conf} < 0 ? '-' : ' ' : ' ',
 					defined($conf->{global}{"default"}) ?
 						$conf->{global}{"default"} > 0 ? '+' :
 						$conf->{global}{"default"} < 0 ? '-' : ' ' : ' ',
-					defined($conf->{global}{conf}) ?
-						$conf->{global}{conf} > 0 ? '+' :
-						$conf->{global}{conf} < 0 ? '-' : ' ' : ' ',
 					$conf->{count});
 
-		# Print global description first (if available)
+#		# Print global description first (if available)
 		if (defined($conf->{global}) && length($conf->{global}{descr})) {
-			if ($conf->{global}{installed}) {
-				$conf->{global}{masked} and $state = "M";
-				$conf->{global}{masked} or  $state = "G";
-			} else {
-				$conf->{global}{masked} and $state = "m";
-			}
-			$outTxt .= "[" . $conf->{global}{descr} . "] $state\n";
-	
-			# Then print the list of affected packages that have no own entry
+# deprecated: The output is updated to match the new data structure.
+#			if ($conf->{global}{installed}) {
+#				$conf->{global}{masked} and $state = "M";
+#				$conf->{global}{masked} or  $state = "G";
+#			} else {
+#				$conf->{global}{masked} and $state = "m";
+#			}
+#			$outTxt .= "[" . $conf->{global}{descr} . "] $state\n";
+# *  @param[in] state '+','-',' ' for global, installed, forced, masked, package - in that order.
+			$outTxt .= sprintf("\t%s\t ( ) [+%s%s%s ]\n",
+						$conf->{global}{descr},
+						$conf->{global}{installed} ? '+' : ' ',
+						$conf->{global}{forced} ? '+' : ' ',
+						$conf->{global}{masked} ? '+' : ' ');
+							
+# deprecated: The output is updated to match the new data structure.
+#			# Then print the list of affected packages that have no own entry
+#			for my $afLst (@{$conf->{global}{affected}}) {
+#				(defined($afLst) && length($afLst))
+#					and $outTxt .= "($afLst) [Affected by global flag setting] $state\n";
+#			}
 			for my $afLst (@{$conf->{global}{affected}}) {
 				(defined($afLst) && length($afLst))
-					and $outTxt .= "($afLst) [Affected by global flag setting] $state\n";
+					and $outTxt .= sprintf("\t%s\t (%s) [+    ]\n",
+									"Affected by global flag setting",
+									$afLst);
 			}
 		}
-				
+
 		# Finally print the local description lines
 		for my $pkg (sort keys %{$conf->{"local"}}) {
-			$state = "l";
-			if ($conf->{"local"}{$pkg}{installed}) {
-				$state = "L";
-				if ($conf->{global}{masked}) {
-					$conf->{"local"}{$pkg}{masked} > -1 and $state = "M";
-					$conf->{"local"}{$pkg}{masked} <  0 and $state = "L";
-				}
-			} elsif ($conf->{global}{masked}) {
-					$conf->{"local"}{$pkg}{masked} > -1 and $state = "m";
-			}
-			$outTxt .= sprintf("(%s) [%s] %s\n", $pkg, $conf->{"local"}{$pkg}{descr}, $state);
+# deprecated: The output is updated to match the new data structure.
+#			$state = "l";
+#			if ($conf->{"local"}{$pkg}{installed}) {
+#				$state = "L";
+#				if ($conf->{global}{masked}) {
+#					$conf->{"local"}{$pkg}{masked} > -1 and $state = "M";
+#					$conf->{"local"}{$pkg}{masked} <  0 and $state = "L";
+#				}
+#			} elsif ($conf->{global}{masked}) {
+#					$conf->{"local"}{$pkg}{masked} > -1 and $state = "m";
+#			}
+#			$outTxt .= sprintf("(%s) [%s] %s\n", $pkg, $conf->{"local"}{$pkg}{descr}, $state);
+			$outTxt .= sprintf("\t%s\t (%s) [ %s%s%s%s]\n",
+						$conf->{"local"}{$pkg}{descr},
+						$pkg,
+						$conf->{"local"}{$pkg}{installed} > 0 ? '+' :
+						$conf->{"local"}{$pkg}{installed} < 0 ? '-' : ' ',
+						$conf->{"local"}{$pkg}{forced}    > 0 ? '+' :
+						$conf->{"local"}{$pkg}{forced}    < 0 ? '-' : ' ',
+						$conf->{"local"}{$pkg}{masked}    > 0 ? '+' :
+						$conf->{"local"}{$pkg}{masked}    < 0 ? '-' : ' ',
+						$conf->{"local"}{$pkg}{"package"} > 0 ? '+' :
+						$conf->{"local"}{$pkg}{"package"} < 0 ? '-' : ' ');
 		}
 	}
 
@@ -162,7 +159,7 @@ sub flags_dialog {
 	# use descriptions. They cause problems unless the whole
 	# interface is changed to use wchar. Substitute with ISO:
 	$outTxt =~ tr/\x{2014}\x{201c}\x{201d}/\x2d\x22\x22/ ;
-	
+
 	# Now let the interface know of the result
 	if (open my $fh, '>&=', $iwrite) {
 		binmode( $fh, ":encoding(ISO-8859-1)" );
@@ -190,54 +187,6 @@ sub flags_dialog {
 	return;
 }
 
-# Deprecated, the funcionality is merged into Portage.pm.
-#
-## Build the global %use_descriptions hash.
-## Parsed files are:
-## 1. PORTDIR/profiles/use.desc
-## 2. PORTDIR/profiles/use.local.desc
-## No parameters accepted.
-## @todo : The local descriptions must be written in a different
-##         way (how?) to allow the wanted filtering/distinction
-##         between global/local flags.
-#sub read_use_descs {
-#	my %_use_descriptions;
-#	for my $dir(@Portage::portagedirs) {
-#		for(Portage::noncomments "$dir/profiles/use.desc") {
-#			my ($flag, $desc) = /^(.*?)\s+-\s+(.*)$/ or next;
-#			$_use_descriptions{$flag}{$desc} = 1;
-#		}
-#	}
-#	my %_use_local_descriptions;
-#	for my $dir(@Portage::portagedirs) {
-#		for(Portage::noncomments "$dir/profiles/use.local.desc") {
-#			my ($pkg, $flag, $desc) = /^(.*?):(.*?)\s+-\s+(.*)$/ or next;
-#			$_use_local_descriptions{$flag}{$desc}{$pkg} = 1;
-#		}
-#	}
-#	# Record all global flags first, their description is printed first
-#	# in the ncurses interface as well.
-#	for my $key (sort keys %_use_descriptions) {
-#		for my $desc (sort keys %{$_use_descriptions{$key}}) {
-#			push @{$use_descriptions{$key}}, "[" . $desc . "] g";
-#		}
-#	}
-#
-#	# Add local flags
-#	for my $key (sort keys %_use_local_descriptions) {
-#		for my $desc (sort keys %{$_use_local_descriptions{$key}}) {
-#			my $flagPrefix = "l";
-#			my @pkgs = ();
-#			for my $pkg (sort keys %{$_use_local_descriptions{$key}{$desc}}) {
-#				$flagPrefix = "L" if (Portage::have_package($pkg));
-#				push @pkgs, $pkg;
-#			}
-#			local $"=", ";
-#			push @{$use_descriptions{$key}}, sprintf("(%s) [%s] %s", "@pkgs", $desc, $flagPrefix);
-#		}
-#	}
-#	return;
-#}
 
 # Write given list of flags back to make.conf if
 # the file has not been changed since reading it.


^ permalink raw reply related	[flat|nested] 238+ messages in thread
* [gentoo-commits] proj/ufed:master commit in: /
@ 2013-02-01 10:49 Sven Eden
  0 siblings, 0 replies; 238+ messages in thread
From: Sven Eden @ 2013-02-01 10:49 UTC (permalink / raw
  To: gentoo-commits

commit:     e4944be76a346f34b679d5008827864b7b04df2b
Author:     Sven Eden <sven.eden <AT> gmx <DOT> de>
AuthorDate: Thu Jan 31 18:18:56 2013 +0000
Commit:     Sven Eden <sven.eden <AT> gmx <DOT> de>
CommitDate: Thu Jan 31 18:18:56 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/ufed.git;a=commit;h=e4944be7

Added two missing checks

---
 config.h.in  |   36 ++++++++++++++++++++++++++++++++++++
 configure.ac |    3 +++
 2 files changed, 39 insertions(+), 0 deletions(-)

diff --git a/config.h.in b/config.h.in
index 98d0c13..0916a33 100644
--- a/config.h.in
+++ b/config.h.in
@@ -1,5 +1,35 @@
 /* config.h.in.  Generated from configure.ac by autoheader.  */
 
+/* Define to 1 if you have the <inttypes.h> header file. */
+#undef HAVE_INTTYPES_H
+
+/* Define to 1 if you have the <memory.h> header file. */
+#undef HAVE_MEMORY_H
+
+/* Define to 1 if you have the <stdint.h> header file. */
+#undef HAVE_STDINT_H
+
+/* Define to 1 if you have the <stdlib.h> header file. */
+#undef HAVE_STDLIB_H
+
+/* Define to 1 if you have the <strings.h> header file. */
+#undef HAVE_STRINGS_H
+
+/* Define to 1 if you have the <string.h> header file. */
+#undef HAVE_STRING_H
+
+/* Define to 1 if you have the <sys/stat.h> header file. */
+#undef HAVE_SYS_STAT_H
+
+/* Define to 1 if you have the <sys/types.h> header file. */
+#undef HAVE_SYS_TYPES_H
+
+/* Define to 1 if you have the <unistd.h> header file. */
+#undef HAVE_UNISTD_H
+
+/* Define to 1 if the system has the type `_Bool'. */
+#undef HAVE__BOOL
+
 /* Name of package */
 #undef PACKAGE
 
@@ -21,6 +51,9 @@
 /* Define to the version of this package. */
 #undef PACKAGE_VERSION
 
+/* Define to 1 if you have the ANSI C header files. */
+#undef STDC_HEADERS
+
 /* Version number of package */
 #undef VERSION
 
@@ -29,3 +62,6 @@
 #ifndef __cplusplus
 #undef inline
 #endif
+
+/* Define to `unsigned int' if <sys/types.h> does not define. */
+#undef size_t

diff --git a/configure.ac b/configure.ac
index 50c54ca..1f47b68 100644
--- a/configure.ac
+++ b/configure.ac
@@ -18,6 +18,9 @@ else
 fi
 CFLAGS="${CFLAGS} -Wmissing-prototypes -Wstrict-prototypes"
 
+AC_TYPE_SIZE_T
+AC_CHECK_HEADER_STDBOOL
+
 AC_ARG_WITH([curses],
 	[AS_HELP_STRING([--with-curses], [override default curses library (ncursesw ncurses curses)])],
 	[curses=$withval],


^ permalink raw reply related	[flat|nested] 238+ messages in thread
* [gentoo-commits] proj/ufed:master commit in: /
@ 2013-02-01 10:49 Sven Eden
  0 siblings, 0 replies; 238+ messages in thread
From: Sven Eden @ 2013-02-01 10:49 UTC (permalink / raw
  To: gentoo-commits

commit:     7db268543c3b6c56aec762b68ba0dd8ea762cc3e
Author:     Sven Eden <sven.eden <AT> gmx <DOT> de>
AuthorDate: Sun Jan 27 15:36:02 2013 +0000
Commit:     Sven Eden <sven.eden <AT> gmx <DOT> de>
CommitDate: Sun Jan 27 15:36:02 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/ufed.git;a=commit;h=7db26854

Added the information about global flags affecting at least one installed package.

---
 ufed-curses-checklist.c |    9 ++++++++-
 ufed-curses.c           |    4 +++-
 2 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/ufed-curses-checklist.c b/ufed-curses-checklist.c
index c483d32..00700bd 100644
--- a/ufed-curses-checklist.c
+++ b/ufed-curses-checklist.c
@@ -56,6 +56,7 @@ enum mask  showMasked = show_unmasked; //!< Set whether to show masked, unmasked
 enum order pkgOrder   = pkgs_left;     //!< Set whether to display package lists left or right of the description
 enum scope showScope  = show_all;      //!< Set whether global, local or all flags are shown
 int lineCountGlobal;
+int lineCountGlobalInstalled;
 int lineCountLocal;
 int lineCountLocalInstalled;
 int lineCountMasked;
@@ -114,6 +115,7 @@ static void read_flags(void) {
 
 	// Initialize line count per type:
 	lineCountGlobal          = 0;
+	lineCountGlobalInstalled = 0;
 	lineCountLocal           = 0;
 	lineCountLocalInstalled  = 0;
 	lineCountMasked          = 0;
@@ -136,7 +138,7 @@ static void read_flags(void) {
 				&on.start,    &on.end,
 				&state.start, &state.end,
 				&ndescr) != 1)
-			ERROR_EXIT(-1, "flag sscanf failed on line\n\"%s\"\n", line);
+			ERROR_EXIT(-1, "flag sscanf failed on line %d:\n\"%s\"\n", lineNum, line);
 
 		/* Allocate memory for the struct and the arrays */
 		// struct
@@ -219,6 +221,11 @@ static void read_flags(void) {
 				flag->item.isGlobal  = true;
 				++lineCountGlobal;
 			}
+			else if ('G' == descState) {
+				flag->item.isGlobal  = true;
+				flag->isInstalled[i] = true;
+				++lineCountGlobalInstalled;
+			}
 			else if ('l' == descState) {
 				++lineCountLocal;
 			}

diff --git a/ufed-curses.c b/ufed-curses.c
index 8b1b53a..997798b 100644
--- a/ufed-curses.c
+++ b/ufed-curses.c
@@ -32,6 +32,7 @@ extern enum mask showMasked;
 extern enum order pkgOrder;
 extern enum scope showScope;
 extern int lineCountGlobal;
+extern int lineCountGlobalInstalled;
 extern int lineCountLocal;
 extern int lineCountLocalInstalled;
 extern int lineCountMasked;
@@ -77,7 +78,8 @@ int getListHeight()
 			result += lineCountLocal + lineCountLocalInstalled;
 		}
 		if (show_local != showScope) {
-			result += lineCountGlobal;
+			// TODO : add installed/not installed filter
+			result += lineCountGlobal + lineCountGlobalInstalled;
 		}
 	}
 


^ permalink raw reply related	[flat|nested] 238+ messages in thread
* [gentoo-commits] proj/ufed:master commit in: /
@ 2013-02-01 10:49 Sven Eden
  0 siblings, 0 replies; 238+ messages in thread
From: Sven Eden @ 2013-02-01 10:49 UTC (permalink / raw
  To: gentoo-commits

commit:     5c5775520fdd312ceb6837640a1be559980f5477
Author:     Sven Eden <sven.eden <AT> gmx <DOT> de>
AuthorDate: Sun Jan 27 15:41:33 2013 +0000
Commit:     Sven Eden <sven.eden <AT> gmx <DOT> de>
CommitDate: Sun Jan 27 15:41:33 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/ufed.git;a=commit;h=5c577552

Moved prompt back to the left side.

---
 ufed-curses-checklist.c |    1 +
 ufed-curses.c           |    4 ++++
 2 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/ufed-curses-checklist.c b/ufed-curses-checklist.c
index 00700bd..8c9b408 100644
--- a/ufed-curses-checklist.c
+++ b/ufed-curses-checklist.c
@@ -450,6 +450,7 @@ static int callback(struct item **currentitem, int key) {
 		mvwaddch(win(Input), 0, minwidth,     ACS_VLINE); // Before state
 		mvwaddch(win(Input), 0, minwidth + 3, ACS_VLINE); // Between state and scope
 		mvwaddch(win(Input), 0, minwidth + 6, ACS_VLINE); // After scope
+		wmove(win(Input), 0, 0);
 		wrefresh(win(Input));
 	}
 	if(descriptionleft!=0 && key!=KEY_LEFT && key!=KEY_RIGHT) {

diff --git a/ufed-curses.c b/ufed-curses.c
index 997798b..f45b8e3 100644
--- a/ufed-curses.c
+++ b/ufed-curses.c
@@ -341,6 +341,7 @@ void draw() {
 	mvwaddch(w, 0, minwidth,     ACS_VLINE); // Before state
 	mvwaddch(w, 0, minwidth + 3, ACS_VLINE); // Between state and scope
 	mvwaddch(w, 0, minwidth + 6, ACS_VLINE); // After scope
+	wmove(w, 0, 0);
 	wnoutrefresh(w);
 
 	drawitems();
@@ -367,6 +368,7 @@ bool yesno(const char *prompt) {
 	mvwaddch(win(Input), 0, minwidth,     ACS_VLINE); // Before state
 	mvwaddch(win(Input), 0, minwidth + 3, ACS_VLINE); // Between state and scope
 	mvwaddch(win(Input), 0, minwidth + 6, ACS_VLINE); // After scope
+	wmove(win(Input), 0, 0);
 	waddstr(win(Input), prompt);
 	whline(win(Input), 'Y', 1);
 	wrefresh(win(Input));
@@ -381,6 +383,7 @@ bool yesno(const char *prompt) {
 			mvwaddch(win(Input), 0, minwidth,     ACS_VLINE); // Before state
 			mvwaddch(win(Input), 0, minwidth + 3, ACS_VLINE); // Between state and scope
 			mvwaddch(win(Input), 0, minwidth + 6, ACS_VLINE); // After scope
+			wmove(win(Input), 0, 0);
 			wnoutrefresh(win(Input));
 			wrefresh(win(List));
 			return FALSE;
@@ -401,6 +404,7 @@ bool yesno(const char *prompt) {
 				mvwaddch(win(Input), 0, minwidth,     ACS_VLINE); // Before state
 				mvwaddch(win(Input), 0, minwidth + 3, ACS_VLINE); // Between state and scope
 				mvwaddch(win(Input), 0, minwidth + 6, ACS_VLINE); // After scope
+				wmove(win(Input), 0, 0);
 				waddstr(win(Input), prompt);
 				whline(win(Input), 'Y', 1);
 				wrefresh(win(Input));


^ permalink raw reply related	[flat|nested] 238+ messages in thread
* [gentoo-commits] proj/ufed:master commit in: /
@ 2013-02-01 10:49 Sven Eden
  0 siblings, 0 replies; 238+ messages in thread
From: Sven Eden @ 2013-02-01 10:49 UTC (permalink / raw
  To: gentoo-commits

commit:     87db82c8424435b99effd98a4a12f39c8b6796d8
Author:     Sven Eden <sven.eden <AT> gmx <DOT> de>
AuthorDate: Sun Jan 27 15:31:11 2013 +0000
Commit:     Sven Eden <sven.eden <AT> gmx <DOT> de>
CommitDate: Sun Jan 27 15:31:11 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/ufed.git;a=commit;h=87db82c8

Merged the functionality to build the global use flag hash into
Portage.pm.
Portage.pm has been reorganized and is a "real" modules now as
described in perlmod and perlmodlib. The data gathering is now done
in INIT, thus ufed never executes unless the data gathering was
successful.
Further the data layout has been rewritten to allow to gather more
information about packages and use flag states. This data is not
fully processed, as the internal data handling of the ncurses
interface has to be rewritten to handle this data.
These changes were neccessary to allow the addition of more filters
and to allow the addition of a per-package view, triggered by
command line arguments.
As this is much like a rewrite, this commit will get me either a big
clap on the back or I'll be tarred and feathered soon...

---
 Portage.pm |  778 ++++++++++++++++++++++++++++++++++++++++++++++--------------
 ufed.pl.in |  229 +++++++++++--------
 2 files changed, 731 insertions(+), 276 deletions(-)

diff --git a/Portage.pm b/Portage.pm
index 92f5495..8b91e4b 100644
--- a/Portage.pm
+++ b/Portage.pm
@@ -7,69 +7,213 @@ package Portage;
 use strict;
 use warnings;
 
-my %environment;
-$environment{$_}={} for qw(USE); # INCREMENTALS, except we only need USE
-
-our @portagedirs;
-our %packages;
-our @profiles;
-our %use_masked_flags;
-our %make_defaults_flags;
-our %default_flags;
-our %make_conf_flags;
-our %archs;
-our %all_flags;
-our $eprefix;
-
-sub get_eprefix;
-sub have_package;
-sub merge;
-sub merge_env;
-sub noncomments;
-sub norm_path;
-sub read_archs;
-sub read_make_conf;
-sub read_make_defaults;
-sub read_make_globals;
-sub read_packages;
-sub read_profiles;
-sub read_sh;
-sub read_use_mask;
-
-get_eprefix;
-read_packages;
-read_profiles;
-read_use_mask;
-read_make_globals;
-read_make_defaults;
-read_make_conf;
-read_archs;
-
-my $lastorder;
-for(reverse split /:/, $environment{USE_ORDER} || "env:pkg:conf:defaults:pkginternal:env.d") {
-	if($_ eq 'defaults') {
-		merge(\%default_flags, \%make_defaults_flags);
-		merge(\%all_flags, \%make_defaults_flags);
-	} elsif($_ eq 'conf') {
-		merge(\%all_flags, \%make_conf_flags);
+BEGIN {
+    use Exporter ();
+    
+    our @ISA         = qw(Exporter);
+    our %EXPORT_TAGS = ();
+    our @EXPORT_OK   = ();
+}
+
+
+# --- public members ---
+
+# $use_flags - hashref that represents the combined and
+# consolidated data about all valid use flags
+# Layout of $use_flags->{flag_name}:
+# {count}  = number of different description lines
+#  Note: +1 for the list of affected packages, and +1 for each descriptionless package with settings differing from global.
+# {global} = hashref for the global paramters if the flag has a description in use.desc, otherwise undefined
+#   ->{affected}  = List of packages that are affected but have no own description
+#   ->{conf}      = The flag is disabled (-1), enabled (1) or not set (0) in make.conf
+#   ->{default}   = The flag is disabled (-1), enabled (1) or not set (0) by default
+#   ->{descr}     = Global description
+#   ->{forced}    = The flag is globally force enabled (and masked) (0,1)
+#   ->{installed} = At least one affected package is installed (0,1)
+#   ->{masked}    = The flag is globally masked (0,1)
+#     Note: When a flag is forced, {masked} is set to one, but can be reset to 0 by any later use.mask file.
+# {"local"}->{package} = hashref for per package settings
+#   ->{descr}     = Description from use.local.desc or empty if there is no individual description
+#     Note: Packages without description are only listed here if their settings differ from the global
+#   ->{forced}    = The flag is explicitly unforced (-1), default (0) or explicitly force enabled (1) for this package
+#   ->{installed} = This package is installed
+#   ->{masked}    = The flag is explicitly unmasked (-1), default (0) or explicitly masked (1) for this package
+#   ->{package}   = The flag is explicitly disabled (-1), default (0) or explicitly enabled (1) for this package.
+#     Note: This is a combination of the ebuilds IUSE and the installation PKGUSE and only set for installed packages.
+our $use_flags;
+
+# $used_make_conf - path of the used make.conf
+our $used_make_conf = "";
+
+# --- private members ---
+my %_environment  = ();
+my $_EPREFIX      = "";
+my @_profiles     = ();
+# $_use_temp - hashref that represents the current state of
+# all known flags. This is for data gathering, the public
+# $use_flags is generated out of this by _gen_use_flags()
+# Layout of $_use_temp->{flag_name}:
+# {global}  = conf hash for global settings
+# {"local"}-> {package} = conf hash for per package settings
+# global and per package settings:
+# ->{conf}      Is either disabled, left alone or enabled by make.conf (-1, 0, 1)
+# ->{default}   Is either disabled, left alone or enabled by make.defaults (-1, 0, 1)
+# ->{descr}     Description from use.desc ({global}) or use.local.desc {cat/pkg} (string)
+# ->{forced}    Is force enabled (implies {masked}=1) in any *use.force
+#               For packages this is only set to -1 (explicitly unforced) or +1 (explicitly forced). 0 means "left alone".
+# ->{installed} Has one installed package ({global}) or is installed {cat/pkg} (0,1)
+# ->{masked}    Is masked by any *use.mask (0,1)
+#               For packages this is only set to -1 (explicitly unmasked) or +1 (explicitly masked). 0 means "left alone".
+# ->{package}   Is either disabled, left alone or enabled by its ebuild (IUSE) or by user package.use (PKGUSE) (-1, 0, 1)
+
+my $_use_temp = undef;
+my $_use_template = {
+	conf      => 0,
+	"default" => 0,
+	descr     => "",
+	forced    => 0,
+	installed => 0,
+	masked    => 0,
+	"package" => 0
+};
+
+# --- public methods ---
+
+# --- private methods ---
+sub _add_flag;
+sub _add_temp;
+sub _determine_eprefix;
+sub _determine_make_conf;
+sub _determine_profiles;
+sub _final_cleaning;
+sub _gen_use_flags;
+sub _merge;
+sub _merge_env;
+sub _noncomments;
+sub _norm_path;
+sub _read_archs;
+sub _read_descriptions;
+sub _read_make_conf;
+sub _read_make_defaults;
+sub _read_make_globals;
+sub _read_packages;
+sub _read_sh;
+sub _read_use_force;
+sub _read_use_mask;
+
+# --- Package initialization ---
+INIT {
+	$_environment{$_} = {} for qw{USE};
+	_determine_eprefix;
+	_determine_make_conf;
+	_determine_profiles;
+	_read_make_globals;  
+	_read_make_defaults; 
+	_read_make_conf;
+
+	# Now with the defaults loaded, a check is in order
+	# whether the set USE_ORDER is supported:
+	defined($_environment{USE_ORDER})
+		or die("Unable to determine USE_ORDER!\nSomething is seriously broken!\n");
+	my $lastorder = "";
+	my @use_order = reverse split /:/, $_environment{USE_ORDER};
+	for my $order(@use_order) {
+		if($order eq 'defaults') {
+			_read_make_defaults
+		} elsif($order eq 'conf') {
+			_read_make_conf
+		} else {
+			next;
+		}
+		$lastorder = $order;
+	}
+	$lastorder eq 'conf'
+		or die("Sorry, USE_ORDER without make.conf overriding global"
+			. " USE flags are not currently supported by ufed.\n");
+
+	_read_packages;
+	_read_use_force; ## Must be before _read_use_mask to not
+	_read_use_mask;  ## unintentionally unmask explicitly masked flags.
+	_read_archs;
+	_read_descriptions;
+	_final_cleaning;
+	_gen_use_flags;
+}
+
+# --- public methods implementations ---
+
+
+# --- private methods implementations ---
+
+# Add a flag to $use_flags and intialize it with the given
+# description hash key.
+# Parameter 1: flag
+# Parameter 2: Keyword "global" or the package name
+# Parameter 3: description hash key
+sub _add_flag
+{
+	my ($flag, $pkg, $descKey) = @_;
+	
+	if ($descKey =~ /^\[(.*)\](-?\d+):(-?\d+):(-?\d+):(-?\d+):(-?\d+):(-?\d+)$/ ) {
+		my ($descr, $conf, $default, $forced, $installed, $masked, $package)
+			= ($1, $2, $3, $4, $5, $6, $7);
+		my %data = ();
+
+		$data{descr}     = $descr;
+		$data{forced}    = $forced;
+		$data{installed} = $installed;
+		$data{masked}    = $masked;
+		$data{"package"} = $package;
+		if ("global" eq "$pkg") {
+			$data{affected}  = [];
+			$data{conf}      = $conf;
+			$data{"default"} = $default;
+			%{$use_flags->{$flag}{global}} = %data;
+		} else {
+			%{$use_flags->{$flag}{"local"}{$pkg}} = %data;
+		}
+		++$use_flags->{$flag}{count};
+
+
 	} else {
-		next;
+		die ("\n\"$flag\" ($pkg) Description Hash Key\n  \"$descKey\"\nis illegal!\n");
 	}
-	$lastorder = $_;
+
+	return;	
 }
-if($lastorder ne 'conf') {
-	die "Sorry, USE_ORDER without make.conf overriding global USE flags are not currently supported by ufed.\n";
+
+
+# Add a flag to $_use_temp if it does not exist
+# Parameter 1: flag
+# Parameter 2: Keyword "global" or "category/package"
+sub _add_temp
+{
+	my ($flag, $pkg) = @_;
+	my $isAdded = 0;
+	
+	(defined($flag) && length($flag))
+		or return;
+
+	if ("global" eq $pkg) {
+		defined ($_use_temp->{$flag}{global})
+			or %{$_use_temp->{$flag}{global}} = %$_use_template;
+	} else {
+		defined ($_use_temp->{$flag}{"local"}{$pkg})
+			or %{$_use_temp->{$flag}{"local"}{$pkg}} = %$_use_template;
+	}
+
+	return;
 }
 
 
 # Determine the value for EPREFIX and save it
-# in $eprefix. This is done using 'portageq'.
+# in $_EPREFIX. This is done using 'portageq'.
 # Other output from portageq is printed on
 # STDERR.
 # No parameters accepted.
-sub get_eprefix {
+sub _determine_eprefix {
 	my $tmp = "/tmp/ufed_$$.tmp";
-	$eprefix = qx{portageq envvar EPREFIX 2>$tmp};
+	$_EPREFIX = qx{portageq envvar EPREFIX 2>$tmp};
 	die "Couldn't determine EPREFIX from Portage" if $? != 0;
 
 	if ( -s $tmp ) {
@@ -80,24 +224,163 @@ sub get_eprefix {
 	}
 	-e $tmp and unlink $tmp;
 
-	chomp($eprefix);
+	chomp($_EPREFIX);
+	return;
+}
+
+
+# determine which make.conf to use
+# and save the result in $used_make_conf
+sub _determine_make_conf
+{
+	$used_make_conf = "${_EPREFIX}/etc/portage/make.conf";
+	(! -r $used_make_conf)
+		and $used_make_conf = "${_EPREFIX}/etc/make.conf";
+	return; 
+}
+
+
+# read /etc/make.profile and /etc/portage/make.profile and
+# analyze the complete profile tree using the found parent
+# files. Add all found paths to @profiles.
+# No parameters accepted.
+sub _determine_profiles
+{
+	my $mp = readlink "${_EPREFIX}/etc/portage/make.profile";
+	defined($mp)
+		or $mp = readlink "${_EPREFIX}/etc/make.profile";
+
+	# make.profile is mandatory and must be a link
+	defined($mp)
+		or die "${_EPREFIX}/etc\{,/portage\}/make.profile is not a symlink\n";
+
+	# Start with the linked path, it is the deepest profile child.
+	@_profiles = _norm_path('/etc', $mp);
+	for (my $i = -1; $i >= -@_profiles; $i--) {
+		for(_noncomments("${_profiles[$i]}/parent")) {
+			splice(@_profiles, $i, 0, _norm_path(${_profiles[$i]}, $_));
+		}
+	}
+	return;
+}
+
+
+# This method does a final cleanup of $_use_temp
+# Everything that is to be done _after_ all
+# configs are parsed goes in here.
+# No parameters accepted
+sub _final_cleaning
+{
+	# The "disable all" flag is truncated to '*' by the parsing, but it
+	# has to read '-*'.
+	_add_temp("-*", "global");
+
+	$_use_temp->{'-*'}{global}{descr} = "{Never enable any flags other than those specified in make.conf}";
+	$_use_temp->{'-*'}{global}{conf} = 0; ## Can never be -1
+	
+	# Set it from the truncated config:
+	if (defined($_use_temp->{'*'}{global})) {
+		$_use_temp->{'*'}{global}{conf} > 0
+			and $_use_temp->{'-*'}{global}{conf} = 1;
+	}
+	
+	# The following use flags are dangerous and must no be
+	# available using ufed:
+	for my $flag ("*", "boostrap", "build") {
+		defined($_use_temp->{"$flag"}) and delete($_use_temp->{"$flag"});
+	}
+
 	return;
 }
 
 
-# returns the content of %packages for the given
-# scalar or undef.
-# Parameter 1: Package to test of the form <category>/<name>
-sub have_package {
-	my ($cp) = @_;
-	return $packages{$cp};
+# Once $_use_temp  is ready, this method builds
+# the final $use_flags hashref.
+# No parameters accepted
+sub _gen_use_flags
+{
+	for my $flag (keys %$_use_temp) {
+		my %descCons = ();
+		my $flagRef  = $_use_temp->{$flag}; ## Shortcut
+		my $hasGlobal= (defined($flagRef->{global}) && length($flagRef->{global}{descr})) ? 1 : 0;
+		my $lCount   = $hasGlobal;
+		my $gDesc    = "";
+		my $gKey     = "";
+		my $gRef     = $flagRef->{global};
+		my $pDesc    = "";
+		my $pKey     = "";
+		my $pRef     = undef;
+		
+		# Build the description consolidation hash
+		if ($hasGlobal) {
+			$gDesc = $gRef->{descr};
+			$gKey  = sprintf("[%s]%d:%d:%d:%d:%d:%d", $gDesc, $gRef->{conf}, $gRef->{"default"},
+							$gRef->{forced}, $gRef->{installed}, $gRef->{masked}, $gRef->{"package"});
+			$descCons{$gKey}{global} = 1;
+		}
+		for my $pkg (sort keys %{$flagRef->{"local"}}) {
+			$pRef  = $flagRef->{"local"}{$pkg};
+
+			if (length($pRef->{descr})) {
+				## This package has an individual description:
+				$pDesc = "$pRef->{descr}";
+				$pKey  = sprintf("[%s]%d:%d:%d:%d:%d:%d", $pDesc, $pRef->{conf}, $pRef->{"default"},
+								$pRef->{forced}, $pRef->{installed}, $pRef->{masked}, $pRef->{"package"});
+				$descCons{$pKey}{$pkg} = 1;
+				++$lCount;
+			}
+			## TODO : Add affected packages that have no own description
+			# once the interface can handle them. These can be used for
+			# the package filtering per command line arguments later.
+		} ## End of walking through a flags package list
+		
+		# Skip if there was nothing consolidated
+		next unless($lCount);
+		
+		# Add the content of $descCons to $use_flags:
+		$use_flags->{$flag}{count} = 0;
+		
+		# The global data has to be added first:
+		if (length($gKey)) {
+			_add_flag($flag, "global", $gKey);
+			
+			# TODO : Add affected packages once they can be hanlded. See above TODO.
+		}
+		
+		# Then the "local" flag descriptions
+		# TODO : Add affected packages that have diffeent settings once they can be handled.
+		for my $key (sort keys %descCons) {
+			next if ($key eq $gKey);
+
+			# Generate the package list with same description and flags,
+			# but not for more than 5 packages
+			my $packages = "";
+			my $pkgCount = 0;
+			for my $pkg (sort keys %{$descCons{$key}}) {
+				length($packages) and $packages .= ", ";
+				$packages .= $pkg;
+				if (++$pkgCount == 5) {
+					_add_flag($flag, $packages, $key);
+					$packages = "";
+					$pkgCount = 0;
+				}
+			}
+			
+			# Add the last result if there is something left
+			$pkgCount and _add_flag($flag, $packages, $key);
+		}
+
+		delete $_use_temp->{$flag};
+	} ## End of walking through $_use_temp flags
+
+	return;
 }
 
 
 # merges two hashes into the first.
 # Parameter 1: reference of the destination hash
 # Parameter 2: reference of the source hash
-sub merge {
+sub _merge {
 	my ($dst, $src) = @_;
 	%{$dst} = () if(exists $src->{'*'});
 	$dst->{$_} = $src->{$_} for(keys %$src);
@@ -106,12 +389,12 @@ sub merge {
 
 
 # Splits content of the source hash at spaces and
-# merges its contents into %environment.
+# merges its contents into %_environment.
 # Parameter 1: reference of the hash to merge
-sub merge_env {
+sub _merge_env {
 	my ($src) = @_;
-	for(keys %environment) {
-		if(ref $environment{$_} eq 'HASH') {
+	for(keys %_environment) {
+		if(ref $_environment{$_} eq 'HASH') {
 			if(exists $src->{$_}) {
 				my %split;
 				for(split ' ', $src->{$_}) {
@@ -120,13 +403,13 @@ sub merge_env {
 					$split{$_} = !$off;
 				}
 				$src->{$_} = { %split };
-				merge(\%{$environment{$_}}, \%{$src->{$_}});
+				_merge(\%{$_environment{$_}}, \%{$src->{$_}});
 			}
 		}
 	}
 	for(keys %$src) {
-		if(ref $environment{$_} ne 'HASH') {
-			$environment{$_} = $src->{$_};
+		if(ref $_environment{$_} ne 'HASH') {
+			$_environment{$_} = $src->{$_};
 		}
 	}
 	return;
@@ -136,7 +419,7 @@ sub merge_env {
 # returns a list of all lines of a given file
 # that are no pure comments
 # Parameter 1: filename
-sub noncomments {
+sub _noncomments {
 	my ($fname) = @_;
 	my @result;
 	local $/;
@@ -154,7 +437,7 @@ sub noncomments {
 # Parameter 1: base path 
 # Parameter 2: sub path
 # return: normalized base path / normalized sub path
-sub norm_path {
+sub _norm_path {
 	my ($base, $path) = @_;
 	my @pathcomp = ($path !~ m!^/! && split(m!/!, $base), split(m!/!, $path));
 	for(my $i=0;;$i++) {
@@ -176,118 +459,217 @@ sub norm_path {
 }
 
 
-# reads all arch.list in all profiles sub directories
-# of found @portagedirs and saves the found architectures
-# in %arch
+# reads all found arch.list and erase all found archs
+# from $_use_temp. Archs are not setable.
 # No parameters accepted
-sub read_archs {
-	for my $dir(@portagedirs) {
-		for(noncomments "$dir/profiles/arch.list") {
-			$archs{$_} = 1;
+sub _read_archs {
+	for my $dir(@_profiles) {
+		next unless (-r "$dir/arch.list");
+		for my $arch (_noncomments("$dir/arch.list")) {
+			defined($_use_temp->{$arch})
+				and delete($_use_temp->{$arch});
 		}
 	}
 	return;
 }
 
 
-# read /etc/make.conf and/or /etc/portage/make.conf and
-# merge set USE flags into %make_conf_flags. Additionally
-# all set portage directories (plus overlays) are recorded
-# in @portagedirs.
-# No parameters accepted.
-sub read_make_conf {
-	my %oldEnv = read_sh("$eprefix/etc/make.conf");
-	my %newEnv = read_sh("$eprefix/etc/portage/make.conf");
-	merge (\%oldEnv, \%newEnv);
-	merge (\%make_conf_flags,\ %{$oldEnv{USE}}) if exists $oldEnv{USE};
-	@portagedirs = $environment{PORTDIR};
-	push @portagedirs, split ' ', $environment{PORTDIR_OVERLAY} if defined $environment{PORTDIR_OVERLAY};
+# reads all use.desc and use.local.desc and updates
+# $_use_temp accordingly.
+# No parameters accepted
+sub _read_descriptions
+{
+	for my $dir(@_profiles) {
+		if (-r "$dir/use.desc") {
+			for(_noncomments("$dir/use.desc")) {
+				my ($flag, $desc) = /^(.*?)\s+-\s+(.*)$/ or next;
+				
+				_add_temp($flag, "global");
+
+				$_use_temp->{$flag}{global}{descr} = $desc;
+			}
+		} ## End of having a use.desc file
+
+		if (-r "$dir/use.local.desc") {
+			for(_noncomments("$dir/use.local.desc")) {
+				my ($pkg, $flag, $desc) = /^(.*?):(.*?)\s+-\s+(.*)$/ or next;
+
+				# Here we do not explicitly add a {global} part,
+				# some flags are local only.
+				_add_temp($flag, $pkg);
+				
+				$_use_temp->{$flag}{"local"}{$pkg}{descr} = $desc;
+			}
+		} ## End of having a use.local.desc file
+	} ## End of looping the profiles
 	return;
 }
 
 
-# read all found make.defaults files and merge their flags
-# into %make_default_flags.
+# read make.conf and record the state of all set use
+# flags.
+# Additionally add all set portage directories (plus
+# overlays) to @_profiles.
+# The last added profile directory, if it exists, is
+# /etc/portage/profile to allow recognition of user
+# overrides.
 # No parameters accepted.
-sub read_make_defaults {
-	for my $dir(@profiles) {
-		my %env = read_sh "$dir/make.defaults";
-		merge (\%make_defaults_flags, \%{$env{USE}}) if exists $env{USE};
+sub _read_make_conf {
+	my %oldEnv = _read_sh("${_EPREFIX}/etc/make.conf");
+	my %newEnv = _read_sh("${_EPREFIX}/etc/portage/make.conf");
+	_merge (\%oldEnv, \%newEnv);
+
+	# Note the conf state of the read flags:
+	for my $flag ( keys %{$oldEnv{USE}}) {
+
+		_add_temp($flag, "global");
+
+		$oldEnv{USE}{$flag}
+			and $_use_temp->{$flag}{global}{conf} = 1
+			or  $_use_temp->{$flag}{global}{conf} = -1;
 	}
+	
+	# Add PORTDIR and overlays to @_profiles
+	defined ($_environment{PORTDIR})
+		and push @_profiles, "$_environment{PORTDIR}/profiles"
+		or  die("Unable to determine PORTDIR!\nSomething is seriously broken here!\n");
+	defined ($_environment{PORTDIR_OVERLAY})
+		and push @_profiles,
+				map { my $x=$_; $x =~ s/^\s*(\S+)\s*$/$1\/profiles/mg ; $x }
+				split('\n', $_environment{PORTDIR_OVERLAY});
+	-e "${_EPREFIX}/etc/portage/profile"
+		and push @_profiles, "${_EPREFIX}/etc/portage/profile";
+	return;
+}
+
+
+# read all found make.defaults and non-user package.use files
+# and merge their values into env.
+# TODO : use USE_EXPAND to add Expansion parsing. The most
+#        important of these are set with sane defaults here,
+#        too.
+# No parameters accepted.
+sub _read_make_defaults {
+	for my $dir(@_profiles) {
+		if (-r "$dir/make.defaults") {
+			my %env = _read_sh("$dir/make.defaults");
+	
+			# Note the conf state of the read flags:
+			for my $flag ( keys %{$env{USE}}) {
+				_add_temp($flag, "global");
+
+				$env{USE}{$flag}
+					and $_use_temp->{$flag}{global}{"default"} = 1
+					or  $_use_temp->{$flag}{global}{"default"} = -1;
+			}
+		}
+	} ## End of looping through the profiles
 	return
 }
 
 
 # read all found make.globals and merge their
-# settings into %environment.
+# settings into %environment. This is done to
+# get the final "PORTDIR" and "USE_ORDER"
 # No parameters accepted
-sub read_make_globals {
-	for my $dir(@profiles, "$eprefix/usr/share/portage/config") {
-		read_sh "$dir/make.globals";
+sub _read_make_globals {
+	for my $dir(@_profiles, "${_EPREFIX}/usr/share/portage/config") {
+		_read_sh("$dir/make.globals");
 	}
 	return;
 }
 
 
-# Analyze EPREFIX/var/db/pkg and note all installed
-# packages in %packages.
+# Analyze EPREFIX/var/db/pkg and analyze all installed
+# packages. We need to know what they use (IUSE) and what
+# has been set when they where emerged (PKGUSE).
 # No parameters accepted.
-sub read_packages {
-	die "Couldn't read $eprefix/var/db/pkg\n" unless opendir my $pkgdir, "$eprefix/var/db/pkg";
+sub _read_packages {
+	my $pkgdir = undef;
+	opendir($pkgdir, "${_EPREFIX}/var/db/pkg")
+		or die "Couldn't read ${_EPREFIX}/var/db/pkg\n";
+		
+	# loop through all categories in pkgdir
 	while(my $cat = readdir $pkgdir) {
 		next if $cat eq '.' or $cat eq '..';
-		next unless opendir my $catdir, "$eprefix/var/db/pkg/$cat";
+		my $catdir = undef;
+		opendir($catdir, "${_EPREFIX}/var/db/pkg/$cat")
+			or next;
+
+		# loop through all openable directories in cat
 		while(my $pkg = readdir $catdir) {
 			next if $pkg eq '.' or $pkg eq '..';
-			my @provide = ();
-			my @use = ();
+			my @puse = ();
+			my @iuse = ();
 			
 			# Load PROVIDE
-			## FIXME: There is no file "PROVIDE" anywhere, at least on my system!
-			if(open my $provide, '<', "$eprefix/var/db/pkg/$cat/$pkg/PROVIDE") {
-				local $/;
-				@provide = split ' ', <$provide>;
-				close $provide;
-			}
+			#Update: Deprecated, this file is gone
+			#if(open my $provide, '<', "$eprefix/var/db/pkg/$cat/$pkg/PROVIDE") {
+			#	local $/;
+			#	@provide = split ' ', <$provide>;
+			#	close $provide;
+			#}
 			
 			# Load USE
-			if(open my $use, '<', "$eprefix/var/db/pkg/$cat/$pkg/USE") {
+			# Update: deprecated, this file is no longer useful. read IUSE and PKGUSE instead
+			#if(open my $use, '<', "$eprefix/var/db/pkg/$cat/$pkg/USE") {
+			#	local $/;
+			#	@use = split ' ', <$use>;
+			#	close $use;
+			#}
+			
+			# Load IUSE to learn which use flags the package in this version knows
+			my $fiuse = "${_EPREFIX}/var/db/pkg/$cat/$pkg/IUSE";
+			if(open my $use, '<', $fiuse) {
+				local $/;
+				@iuse = split ' ', <$use>;
+				close $use;
+			}
+
+			# Load PKGUSE to learn which use flags have been set when this package was emerged
+			my $fpuse = "${_EPREFIX}/var/db/pkg/$cat/$pkg/PKGUSE";
+			if(open my $use, '<', $fpuse) {
 				local $/;
-				@use = split ' ', <$use>;
+				@puse = split ' ', <$use>;
 				close $use;
 			}
 
 			# could be shortened, but make sure not to strip off part of the name
 			$pkg =~ s/-\d+(?:\.\d+)*\w?(?:_(?:alpha|beta|pre|rc|p)\d*)?(?:-r\d+)?$//;
-			$packages{"$cat/$pkg"} = 1;
+			$pkg = $cat . "/" . $pkg;
+
+			# Now save the knowledge gained (if any) in $_use_temp:
+			for my $flag (@iuse) {
+				my $eState = $flag =~ s/^\+// || 0; 
+				my $dState = $flag =~ s/^-// || 0; 
+
+				_add_temp($flag, "global");
+				_add_temp($flag, $pkg);
+
+				$_use_temp->{$flag}{"local"}{$pkg}{"package"}   = $eState ? 1 : $dState ? -1 : 0;
+				$_use_temp->{$flag}{"local"}{$pkg}{installed}   = 1;
+				$_use_temp->{$flag}{global}{installed} = 1;
+			} ## End of looping IUSE
+			for my $flag (@puse) {
+				my $state = $flag =~ s/^-// || 0; 
+
+				if ( defined($_use_temp->{$flag}{global})
+				  && defined($_use_temp->{$flag}{$pkg})) {
+				  	$state and $_use_temp->{$flag}{"local"}{$pkg}{"package"} = -1
+				  	        or $_use_temp->{$flag}{"local"}{$pkg}{"package"} =  0;
+
+				} # enable if output is wanted!
+				#else {
+				#	## This can happen if a package was installed with a flag
+				#	## that is gone. (Seen with sys-fs/ntfs3g-2012.1.15-r1 to
+				#	## sys-fs/ntfs3g-2012.1.15-r2 and use flag "extras". Gone,
+				#	## but still listed in PKGUSE)
+				#	printf STDERR "DEBUG: '%s' found in\n    '%s'\n  but not in\n    '%s'\n",
+				#		$flag, $fpuse, $fiuse;
+				#	## No need to break, though...
+				#}
+			} ## End of looping PKGUSE
 			
-			# FIXME: What is this supposed to achieve?
-			# Currently this does nothing as there is no PROVIDE anywhere,
-			# but even if it were, there is nothing really done at all with
-			# @use.
-			for(my $i=0; $i<@provide; $i++) {
-				my $pkg = $provide[$i];
-				next if $pkg eq '(' || $pkg eq ')';
-				if($pkg !~ s/\?$//) {
-					$pkg =~ s/-\d+(?:\.\d+)*\w?(?:_(?:alpha|beta|pre|rc|p)\d*)?(?:-r\d+)?$//;
-					$packages{$pkg} = 1;
-				} else {
-					my $musthave = $pkg !~ s/^!//;
-					my $have = 0;
-					for(@use) {
-						if($pkg eq $_)
-						{ $have = 1; last }
-					}
-					if($musthave != $have) {
-						my $level = 0;
-						for($i++;$i<@provide;$i++) {
-							$level++ if $provide[$i] eq '(';
-							$level-- if $provide[$i] eq ')';
-							last if $level==0;
-						}
-					}
-				}
-			}
 		}
 		closedir $catdir;
 	}
@@ -296,32 +678,13 @@ sub read_packages {
 }
 
 
-# read /etc/make.profile and /etc/portage/make.profile
-# and analyze the complete profile tree using the found
-# parent files. Add all found paths to @profiles.
-# No parameters accepted.
-sub read_profiles {
-	$_ = readlink "$eprefix/etc/make.profile";
-	$_ = readlink "$eprefix/etc/portage/make.profile" if not defined $_;
-	die "$eprefix/etc\{,/portage\}/make.profile is not a symlink\n" if not defined $_;
-	@profiles = norm_path '/etc', $_;
-	for (my $i = -1; $i >= -@profiles; $i--) {
-		for(noncomments "$profiles[$i]/parent") {
-			splice @profiles, $i, 0, norm_path $profiles[$i], $_;
-		}
-	}
-	push @profiles, "$eprefix/etc/portage/profile";
-	return;
-}
-
-
 # reads the given file and parses it for key=value pairs.
 # "source" entries are added to the file and parsed as
 # well. The results of the parsing are merged into
 # %environment.
 # Parameter 1: The path of the file to parse.
 # In a non-scalar context the function returns the found values.
-sub read_sh {
+sub _read_sh {
 	my ($fname) = @_;
 	my $BLANK = qr{(?:[ \n\t]+|#.*)+};         # whitespace and comments
 	my $IDENT = qr{([^ \\\n\t'"{}=#]+)};       # identifiers
@@ -337,7 +700,7 @@ sub read_sh {
 		eval {
 			for(;;) {
 				/\G$BLANK/gc;
-				last if pos == length;
+				last if ((pos || 0) == (length || 0));
 				/\G$IDENT/gc or die;
 				my $name = $1;
 				/\G$BLANK/gc;
@@ -386,33 +749,88 @@ sub read_sh {
 		};
 		die "Parse error in $fname\n" if $@;
 	}
-	merge_env(\%env);
+	_merge_env(\%env);
 	return %env if wantarray;
 	return;
 }
 
 
+# read all enforced flags from all found use.force
+# and package.use.force files. Save the found
+# masks in %use_flags.
+# No parameters accepted.
+sub _read_use_force {
+	for my $dir(@_profiles) {
+		if (-r "$dir/use.force") {
+			# use.force can enforce and mask specific flags
+			for my $flag (_noncomments("$dir/use.force") ) {
+				my $state = $flag =~ s/^-// || 0;
+				
+				_add_temp($flag, "global");
+	
+				$_use_temp->{$flag}{global}{masked} = !$state;
+				$_use_temp->{$flag}{global}{forced} = !$state;
+			}
+		} ## End of having a use.force file
+		
+		if (-r "$dir/package.use.force") {
+			# package.use.force can enforce or unforce flags per package
+			for(_noncomments("$dir/package.use.force") ) {
+				my($pkg, @flags) = split;
+				for my $flag (@flags) {
+					my $state = $flag =~ s/^-// || 0;
+	
+					_add_temp($flag, "global");
+					_add_temp($flag, $pkg);
+	
+					if ($state) {
+						$_use_temp->{$flag}{"local"}{$pkg}{masked} = -1; ## explicitly unmasked and
+						$_use_temp->{$flag}{"local"}{$pkg}{forced} = -1; ## explicitly unforced
+					} else {
+						$_use_temp->{$flag}{"local"}{$pkg}{masked} =  1; ## explicitly masked and
+						$_use_temp->{$flag}{"local"}{$pkg}{forced} =  1; ## explicitly enforced
+					}
+				}
+			}
+		} ## End of having a package.use.force file
+	} ## End of looping through the profiles
+	return;
+}
+
+
 # read all masked flags from all found use.mask
 # and package.use.mask files. Save the found
-# masks in %use_masked_flags.
+# masks in %use_flags.
 # No parameters accepted.
-sub read_use_mask {
-	for my $dir(@profiles) {
-		-r "$dir/use.mask" or next;
-		for(noncomments "$dir/use.mask") {
-			my $off = s/^-//;
-			$use_masked_flags{$_} = { '' => !$off };
-		}
-		for(noncomments "$dir/package.use.mask") {
-			my($pkg, @flags) = split;
-			for(@flags) {
-				my $off = s/^-//;
-
-				$use_masked_flags{$_}{''} ||= 0;
-				$use_masked_flags{$_}{$pkg} = !$off;
+sub _read_use_mask {
+	for my $dir(@_profiles) {
+		if (-r "$dir/use.mask") {
+			# use.mask can enable or disable masks
+			for my $flag (_noncomments("$dir/use.mask") ) {
+				my $state = $flag =~ s/^-// || 0;
+
+				_add_temp($flag, "global");
+	
+				$_use_temp->{$flag}{global}{masked} = !$state;
 			}
-		}
-	}
+		} ## End of having a use.mask file
+		
+		if (-r "$dir/package.use.mask") {
+		# package.use.mask can enable or disable masks per package
+			for(_noncomments("$dir/package.use.mask") ) {
+				my($pkg, @flags) = split;
+				for my $flag (@flags) {
+					my $state = $flag =~ s/^-// || 0;
+	
+					_add_temp($flag, "global");
+					_add_temp($flag, $pkg);
+	
+					$state and $_use_temp->{$flag}{"local"}{$pkg}{masked} = -1; ## explicitly unmasked
+					$state  or $_use_temp->{$flag}{"local"}{$pkg}{masked} =  1; ## explicitly masked
+				}
+			}
+		} ## End of having a package.use.mask file
+	} ## End of looping through the profiles
 	return;
 }
 

diff --git a/ufed.pl.in b/ufed.pl.in
index 9b072b7..299c79d 100644
--- a/ufed.pl.in
+++ b/ufed.pl.in
@@ -17,52 +17,51 @@ my $interface = 'ufed-curses';
 #			  . " --read-var-info=yes"
 #              . " XX_libexecdir@/ufed-curses 2>/tmp/ufed_memcheck.log";
 
-my %use_descriptions;
+# no longer needed
+# my %use_descriptions;
 
 sub finalise;
 sub flags_dialog;
-sub read_use_descs;
 sub save_flags;
 
-delete $Portage::all_flags{'*'};
-
-read_use_descs;
-
-delete @use_descriptions{qw(bootstrap build)};
-
-$Portage::make_conf_flags{'-*'} = 1
-	if defined $Portage::make_conf_flags{'*'}
-		&& !$Portage::make_conf_flags{'*'};
-
-for(keys %Portage::all_flags) {
-	@{$use_descriptions{$_}} = "[(Unknown)] g"
-		if not exists $use_descriptions{$_};
-}
-@{$use_descriptions{'-*'}} = '[Never enable any flags other than those specified in make.conf] g';
-
-for(@Portage::archs) {
-	delete $Portage::default_flags{$_};
-	delete $Portage::all_flags{$_};
-	delete $use_descriptions{$_};
-}
-for my $flag (keys %Portage::use_masked_flags) {
-	my $masked = 1;
-	for my $mask (values %{$Portage::use_masked_flags{$flag}}) {
-		last if not($masked &&= $mask);
-	}
-	if($masked) {
-		if (defined($use_descriptions{$flag})) {
-			for (my $i = 0; $i < scalar @{$use_descriptions{$flag}}; ++$i) {
-				$use_descriptions{$flag}->[$i] =~ s/ [lg]$/ m/ ;
-				$use_descriptions{$flag}->[$i] =~ s/ L$/ M/ ;
-			}
-		} else {
-			delete $use_descriptions{$flag};
-			delete $Portage::default_flags{$flag};
-			delete $Portage::all_flags{$flag};
-		}
-	}
-}
+# deprecated, the functionality is merged into Portage.pm
+# delete $Portage::all_flags{'*'};
+# read_use_descs;
+# @use_descriptions{qw(bootstrap build)};
+#
+#$Portage::make_conf_flags{'-*'} = 1
+#	if defined $Portage::make_conf_flags{'*'}
+#		&& !$Portage::make_conf_flags{'*'};
+#
+#for(keys %Portage::all_flags) {
+#	@{$use_descriptions{$_}} = "[(Unknown)] g"
+#		if not exists $use_descriptions{$_};
+#}
+#@{$use_descriptions{'-*'}} = '[Never enable any flags other than those specified in make.conf] g';
+#
+#for(@Portage::archs) {
+#	delete $Portage::default_flags{$_};
+#	delete $Portage::all_flags{$_};
+#	delete $use_descriptions{$_};
+#}
+#for my $flag (keys %Portage::use_masked_flags) {
+#	my $masked = 1;
+#	for my $mask (values %{$Portage::use_masked_flags{$flag}}) {
+#		last if not($masked &&= $mask);
+#	}
+#	if($masked) {
+#		if (defined($use_descriptions{$flag})) {
+#			for (my $i = 0; $i < scalar @{$use_descriptions{$flag}}; ++$i) {
+#				$use_descriptions{$flag}->[$i] =~ s/ [lg]$/ m/ ;
+#				$use_descriptions{$flag}->[$i] =~ s/ L$/ M/ ;
+#			}
+#		} else {
+#			delete $use_descriptions{$flag};
+#			delete $Portage::default_flags{$flag};
+#			delete $Portage::all_flags{$flag};
+#		}
+#	}
+#}
 
 flags_dialog;
 
@@ -111,16 +110,52 @@ sub flags_dialog {
 	my $outTxt = "";
 
 	# Write out flags 
-	for my $flag (sort { uc $a cmp uc $b } keys %use_descriptions) {
+	for my $flag (sort { uc $a cmp uc $b } keys %$Portage::use_flags) {
+		my $conf = $Portage::use_flags->{$flag}; ## Shortcut
+		my $state = "g";
 		$outTxt .= sprintf ("%s %s (%s%s) %d\n", $flag,
-					defined($Portage::make_conf_flags{$flag})
-						? $Portage::make_conf_flags{$flag} ? 'on' : 'off' : 'def',
-					exists($Portage::make_defaults_flags{$flag})
-						? $Portage::make_defaults_flags{$flag} ? '+' : '-' : ' ',
-					exists($Portage::make_conf_flags{$flag})
-						? $Portage::make_conf_flags{$flag}     ? '+' : '-' : ' ',
-					scalar @{$use_descriptions{$flag}}  );
-		$outTxt .= sprintf ("%s\n", $_) for(@{$use_descriptions{$flag}});
+					defined($conf->{global}{conf}) ?
+						$conf->{global}{conf} > 0 ? 'on' :
+						$conf->{global}{conf} < 0 ? 'off' : 'def' : 'def',
+					defined($conf->{global}{"default"}) ?
+						$conf->{global}{"default"} > 0 ? '+' :
+						$conf->{global}{"default"} < 0 ? '-' : ' ' : ' ',
+					defined($conf->{global}{conf}) ?
+						$conf->{global}{conf} > 0 ? '+' :
+						$conf->{global}{conf} < 0 ? '-' : ' ' : ' ',
+					$conf->{count});
+
+		# Print global description first (if available)
+		if (defined($conf->{global}) && length($conf->{global}{descr})) {
+			if ($conf->{global}{installed}) {
+				$conf->{global}{masked} and $state = "M";
+				$conf->{global}{masked} or  $state = "G";
+			} else {
+				$conf->{global}{masked} and $state = "m";
+			}
+			$outTxt .= "[" . $conf->{global}{descr} . "] $state\n";
+	
+			# Then print the list of affected packages that have no own entry
+			for my $afLst (@{$conf->{global}{affected}}) {
+				(defined($afLst) && length($afLst))
+					and $outTxt .= "($afLst) [Affected by global flag setting] $state\n";
+			}
+		}
+				
+		# Finally print the local description lines
+		for my $pkg (sort keys %{$conf->{"local"}}) {
+			$state = "l";
+			if ($conf->{"local"}{$pkg}{installed}) {
+				$state = "L";
+				if ($conf->{global}{masked}) {
+					$conf->{"local"}{$pkg}{masked} > -1 and $state = "M";
+					$conf->{"local"}{$pkg}{masked} <  0 and $state = "L";
+				}
+			} elsif ($conf->{global}{masked}) {
+					$conf->{"local"}{$pkg}{masked} > -1 and $state = "m";
+			}
+			$outTxt .= sprintf("(%s) [%s] %s\n", $pkg, $conf->{"local"}{$pkg}{descr}, $state);
+		}
 	}
 
 	# Some overlays (like sunrise) use UTF-8 characters in their
@@ -155,52 +190,54 @@ sub flags_dialog {
 	return;
 }
 
-# Build the global %use_descriptions hash.
-# Parsed files are:
-# 1. PORTDIR/profiles/use.desc
-# 2. PORTDIR/profiles/use.local.desc
-# No parameters accepted.
-# @todo : The local descriptions must be written in a different
-#         way (how?) to allow the wanted filtering/distinction
-#         between global/local flags.
-sub read_use_descs {
-	my %_use_descriptions;
-	for my $dir(@Portage::portagedirs) {
-		for(Portage::noncomments "$dir/profiles/use.desc") {
-			my ($flag, $desc) = /^(.*?)\s+-\s+(.*)$/ or next;
-			$_use_descriptions{$flag}{$desc} = 1;
-		}
-	}
-	my %_use_local_descriptions;
-	for my $dir(@Portage::portagedirs) {
-		for(Portage::noncomments "$dir/profiles/use.local.desc") {
-			my ($pkg, $flag, $desc) = /^(.*?):(.*?)\s+-\s+(.*)$/ or next;
-			$_use_local_descriptions{$flag}{$desc}{$pkg} = 1;
-		}
-	}
-	# Record all global flags first, their description is printed first
-	# in the ncurses interface as well.
-	for my $key (sort keys %_use_descriptions) {
-		for my $desc (sort keys %{$_use_descriptions{$key}}) {
-			push @{$use_descriptions{$key}}, "[" . $desc . "] g";
-		}
-	}
-
-	# Add local flags
-	for my $key (sort keys %_use_local_descriptions) {
-		for my $desc (sort keys %{$_use_local_descriptions{$key}}) {
-			my $flagPrefix = "l";
-			my @pkgs = ();
-			for my $pkg (sort keys %{$_use_local_descriptions{$key}{$desc}}) {
-				$flagPrefix = "L" if (Portage::have_package($pkg));
-				push @pkgs, $pkg;
-			}
-			local $"=", ";
-			push @{$use_descriptions{$key}}, sprintf("(%s) [%s] %s", "@pkgs", $desc, $flagPrefix);
-		}
-	}
-	return;
-}
+# Deprecated, the funcionality is merged into Portage.pm.
+#
+## Build the global %use_descriptions hash.
+## Parsed files are:
+## 1. PORTDIR/profiles/use.desc
+## 2. PORTDIR/profiles/use.local.desc
+## No parameters accepted.
+## @todo : The local descriptions must be written in a different
+##         way (how?) to allow the wanted filtering/distinction
+##         between global/local flags.
+#sub read_use_descs {
+#	my %_use_descriptions;
+#	for my $dir(@Portage::portagedirs) {
+#		for(Portage::noncomments "$dir/profiles/use.desc") {
+#			my ($flag, $desc) = /^(.*?)\s+-\s+(.*)$/ or next;
+#			$_use_descriptions{$flag}{$desc} = 1;
+#		}
+#	}
+#	my %_use_local_descriptions;
+#	for my $dir(@Portage::portagedirs) {
+#		for(Portage::noncomments "$dir/profiles/use.local.desc") {
+#			my ($pkg, $flag, $desc) = /^(.*?):(.*?)\s+-\s+(.*)$/ or next;
+#			$_use_local_descriptions{$flag}{$desc}{$pkg} = 1;
+#		}
+#	}
+#	# Record all global flags first, their description is printed first
+#	# in the ncurses interface as well.
+#	for my $key (sort keys %_use_descriptions) {
+#		for my $desc (sort keys %{$_use_descriptions{$key}}) {
+#			push @{$use_descriptions{$key}}, "[" . $desc . "] g";
+#		}
+#	}
+#
+#	# Add local flags
+#	for my $key (sort keys %_use_local_descriptions) {
+#		for my $desc (sort keys %{$_use_local_descriptions{$key}}) {
+#			my $flagPrefix = "l";
+#			my @pkgs = ();
+#			for my $pkg (sort keys %{$_use_local_descriptions{$key}{$desc}}) {
+#				$flagPrefix = "L" if (Portage::have_package($pkg));
+#				push @pkgs, $pkg;
+#			}
+#			local $"=", ";
+#			push @{$use_descriptions{$key}}, sprintf("(%s) [%s] %s", "@pkgs", $desc, $flagPrefix);
+#		}
+#	}
+#	return;
+#}
 
 # Write given list of flags back to make.conf if
 # the file has not been changed since reading it.


^ permalink raw reply related	[flat|nested] 238+ messages in thread
* [gentoo-commits] proj/ufed:master commit in: /
@ 2013-02-01 10:49 Sven Eden
  0 siblings, 0 replies; 238+ messages in thread
From: Sven Eden @ 2013-02-01 10:49 UTC (permalink / raw
  To: gentoo-commits

commit:     bc866fe4f70ab565709011cdef4d81941d6760b0
Author:     Sven Eden <sven.eden <AT> gmx <DOT> de>
AuthorDate: Wed Jan 30 14:01:37 2013 +0000
Commit:     Sven Eden <sven.eden <AT> gmx <DOT> de>
CommitDate: Wed Jan 30 14:01:37 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/ufed.git;a=commit;h=bc866fe4

Added testflags.txt to .gitignore, a text file used to call ufed-curses directly via gdb.

---
 .gitignore |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/.gitignore b/.gitignore
index bdb3c38..06a3828 100644
--- a/.gitignore
+++ b/.gitignore
@@ -16,3 +16,5 @@ config.*
 stamp*
 ufed
 ufed-curses
+testflags.txt
+


^ permalink raw reply related	[flat|nested] 238+ messages in thread
* [gentoo-commits] proj/ufed:master commit in: /
@ 2013-02-01 10:49 Sven Eden
  0 siblings, 0 replies; 238+ messages in thread
From: Sven Eden @ 2013-02-01 10:49 UTC (permalink / raw
  To: gentoo-commits

commit:     6cdaf71f9178c057d8403468b78072c0fc2c14bb
Author:     Sven Eden <sven.eden <AT> gmx <DOT> de>
AuthorDate: Wed Jan 30 13:58:29 2013 +0000
Commit:     Sven Eden <sven.eden <AT> gmx <DOT> de>
CommitDate: Wed Jan 30 13:58:29 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/ufed.git;a=commit;h=6cdaf71f

Moved debugging macros to the new header ufed-debug.h

---
 ufed-debug.h |   40 ++++++++++++++++++++++++++++++++++++++++
 1 files changed, 40 insertions(+), 0 deletions(-)

diff --git a/ufed-debug.h b/ufed-debug.h
new file mode 100644
index 0000000..67bbf2c
--- /dev/null
+++ b/ufed-debug.h
@@ -0,0 +1,40 @@
+/*
+ * ufed-debug.h
+ *
+ *  Created on: 28.01.2013
+ *      Author: Sven Eden
+ */
+#pragma once
+#ifndef UFED_DEBUG_H_INCLUDED
+#define UFED_DEBUG_H_INCLUDED 1
+
+/* These are debugging macros that can be turned on/off by
+ * defining/undefining their guards.
+ */
+#define DEBUG_EXIT 1 /* If defined ERROR_EXIT() prints an error message */
+#undef DEBUG_TRACE /* If defined TRACE() prints current file, line, function */
+
+// DEBUG_EXIT -> ERROR_EXIT() macro
+#if defined(DEBUG_EXIT)
+#  define ERROR_EXIT(code, fmt, ...) { \
+	cursesdone(); \
+	fprintf(stderr, "\nERROR in %s:%d (%s): \n -> ", \
+		__FILE__, __LINE__, __FUNCTION__); \
+	fprintf(stderr, fmt, __VA_ARGS__); \
+	exit(code); \
+}
+#else
+#  define ERROR_EXIT(code, ...) { cursesdone(); exit(code); }
+#endif // DEBUG_EXIT
+
+// DEBUG_TRACE -> TRACE macro
+#if defined(DEBUG_TRACE)
+# define TRACE { \
+	fprintf(stderr, "(TRACE) %s:%d - %s\n", __FILE__, __LINE__, __FUNCTION__); \
+}
+#else
+# define TRACE
+#endif // DEBUG_TRACE
+
+
+#endif /* UFED_DEBUG_H_INCLUDED */


^ permalink raw reply related	[flat|nested] 238+ messages in thread
* [gentoo-commits] proj/ufed:master commit in: /
@ 2013-02-01 10:49 Sven Eden
  0 siblings, 0 replies; 238+ messages in thread
From: Sven Eden @ 2013-02-01 10:49 UTC (permalink / raw
  To: gentoo-commits

commit:     44916f41c4e7b65f5e8829f00ec101c7f52e4d72
Author:     Sven Eden <sven.eden <AT> gmx <DOT> de>
AuthorDate: Wed Jan 30 14:00:26 2013 +0000
Commit:     Sven Eden <sven.eden <AT> gmx <DOT> de>
CommitDate: Wed Jan 30 14:00:26 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/ufed.git;a=commit;h=44916f41

Moved type declaration of enums and structs to a central ufed-types.h and specific functions to ufed-types.c. The new structs sFlag and sDesc are desinged to substitute struct item and struct flag. They can handle much more details. This move is necessary to not have the original data structure to grow into an unmaintainable mess, and is useful to remove all the cross-casting done throughout the code.

---
 ufed-types.c |  301 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 ufed-types.h |  155 ++++++++++++++++++++++++++++++
 2 files changed, 456 insertions(+), 0 deletions(-)

diff --git a/ufed-types.c b/ufed-types.c
new file mode 100644
index 0000000..694ea29
--- /dev/null
+++ b/ufed-types.c
@@ -0,0 +1,301 @@
+/*
+ * ufed-types.c
+ *
+ *  Created on: 28.01.2013
+ *      Author: Sven Eden
+ */
+#include "ufed-types.h"
+#include "ufed-curses.h"
+#include <stdlib.h>
+#include <string.h>
+
+/* external members */
+extern eMask  e_mask;
+extern eScope e_scope;
+extern eState e_state;
+
+/* function implementations */
+
+/** @brief create a new flag without description lines
+ *  As this is a crucial initialization task, the function will
+ *  terminate the program if an error occurs.
+ *  @param[in,out] root the new item will be *root if *root is null and its previous flag otherwise.
+ *  @param[in] name the name to set, must not be NULL.
+ *  @param[in] line the fixed line in the list this item starts.
+ *  @param[in] ndesc number of description lines to allocate and initialize.
+ *  @param[in] state '+','-',' ' for stateConf and stateDefault in that order.
+ */
+sFlag* addFlag (sFlag** root, const char* name, int line, int ndesc, const char state[2])
+{
+	sFlag* newFlag = NULL;
+
+	// Exit early if root is NULL:
+	if (!root)
+		ERROR_EXIT(-1, "root must not be %s\n", "NULL")
+
+	if (name) {
+
+		// state is a byte mask. Check it first:
+		for (int i = 0; i < 2; ++i) {
+			if (('+' != state[i]) && ('-' != state[i]) && (' ' != state[i]))
+				ERROR_EXIT(-1, "Illegal character '%c' in state string at position %d\n",
+					state[i], i)
+		}
+
+		newFlag = (sFlag*)malloc(sizeof(sFlag));
+		if (newFlag) {
+			newFlag->currline     = 0;
+			newFlag->desc         = (sDesc*)malloc(sizeof(sDesc) * ndesc);
+
+			if (newFlag->desc) {
+				for (int i = 0; i < ndesc; ++i) {
+					newFlag->desc[i].desc         = NULL;
+					newFlag->desc[i].isGlobal     = false;
+					newFlag->desc[i].isInstalled  = false;
+					newFlag->desc[i].pkg          = NULL;
+					newFlag->desc[i].stateForced  = ' ';
+					newFlag->desc[i].stateMasked  = ' ';
+					newFlag->desc[i].statePackage = ' ';
+				}
+			} else
+				ERROR_EXIT(-1, "Unable to allocate %lu bytes for %d sDesc_ structs\n",
+					sizeof(sDesc) * ndesc, ndesc)
+
+			newFlag->forced       = false;
+			newFlag->listline     = line;
+			newFlag->masked       = false;
+			newFlag->name         = strdup(name);
+			newFlag->ndesc        = ndesc;
+			newFlag->next         = NULL;
+			newFlag->prev         = NULL;
+			newFlag->stateConf    = state[0];
+			newFlag->stateDefault = state[1];
+
+			// Eventually put the new flag into the doubly linked ring:
+			if (*root) {
+				newFlag->next = *root;
+				newFlag->prev = (*root)->prev;
+				(*root)->prev = newFlag;
+				if (newFlag->prev)
+					newFlag->prev->next = newFlag;
+			} else {
+				newFlag->next = newFlag;
+				newFlag->prev = newFlag;
+				*root = newFlag;
+			}
+
+		} else
+			ERROR_EXIT(-1, "Unable to allocate %lu bytes for sFlag_ struct\n", sizeof(sFlag))
+	} else
+		ERROR_EXIT(-1, "The new flags must have a name, not %s\n", "NULL")
+
+	return newFlag;
+}
+
+
+/** @brief add a flag description line to an existing flag
+ *  As this is a crucial initialization task, the function will
+ *  terminate the program if an error occurs.
+ *  @param[in,out] flag pointer to the flag to manipulate. Must not be NULL
+ *  @param[in] pkg list of affected packages or NULL if no packages are affected
+ *  @param[in] desc description line
+ *  @param[in] state '+','-',' ' for global, installed, forced, masked, package - in that order.
+ *  @return the full length of the description including package list and separators
+**/
+size_t addFlagDesc (sFlag* flag, const char* pkg, const char* desc, const char state[5])
+{
+	size_t result = 3; // space and brackets.
+	if (flag) {
+		int idx = 0;
+		for ( ; (idx < flag->ndesc) && flag->desc[idx].desc ; ++idx) ;
+		if (idx < flag->ndesc) {
+
+			// state is a byte mask. Check it first:
+			for (int i = 0; i < 5; ++i) {
+				if (('+' != state[i]) && ('-' != state[i]) && (' ' != state[i]))
+					ERROR_EXIT(-1, "Illegal character '%c' in state string at position %d\n",
+						state[i], i)
+			}
+
+			// Now apply.
+			if (pkg)  flag->desc[idx].pkg  = strdup(pkg);
+			if (desc) flag->desc[idx].desc = strdup(desc);
+			if ('+' == state[0]) flag->desc[idx].isGlobal    = true;
+			if ('+' == state[1]) flag->desc[idx].isInstalled = true;
+			flag->desc[idx].stateForced  = state[2];
+			flag->desc[idx].stateMasked  = state[3];
+			flag->desc[idx].statePackage = state[4];
+
+			// Set flag mask and force status if this is a global and masked/forced description
+			if (flag->desc[idx].isGlobal && ('+' == flag->desc[idx].stateMasked))
+				flag->masked = true;
+			if (flag->desc[idx].isGlobal && ('+' == flag->desc[idx].stateForced))
+				flag->forced = true;
+
+			// Determine width:
+			result += (flag->desc[idx].pkg ? strlen(flag->desc[idx].pkg) : 0)
+					+ strlen(flag->desc[idx].desc);
+		} else
+			ERROR_EXIT(-1, "Too many lines for flag %s which is set to %d lines.\n  desc: \"%s\"\n",
+				flag->name, flag->ndesc, desc ? desc : "no description provided")
+
+	} else
+		ERROR_EXIT(-1, "flag is NULL for description\n \"%s\"\n", desc ? desc : "no description provided")
+
+	return result;
+}
+
+
+/** @brief add statistics to @a stats according to the given flag stats
+ *  This function simply counts how many lines are added in which filter case.
+ *  @param[in] flag pointer to the flag to analyze.
+ *  @param[out] stats pointer to the sListStats struct to update.
+ */
+void addLineStats (const sFlag* flag, sListStats* stats)
+{
+	if (flag && stats) {
+		for (int i = 0; i < flag->ndesc; ++i) {
+			// Masked is true if the flag is globally masked/forced
+			// and the description is not explicitly unmasked/unforced,
+			// or if the description is explicitly masked/forced.
+			if ( ('+' == flag->desc[i].stateMasked)
+			  || ('+' == flag->desc[i].stateForced)
+			  || ( (' ' == flag->desc[i].stateMasked)
+				&& flag->masked )
+			  || ( (' ' == flag->desc[i].stateForced)
+				&& flag->forced ) ) {
+				if (flag->desc[i].isInstalled)
+					++stats->lineCountMaskedInstalled;
+				else
+					++stats->lineCountMasked;
+			} else if (flag->desc[i].isGlobal) {
+				if (flag->desc[i].isInstalled)
+					++stats->lineCountGlobalInstalled;
+				else
+					++stats->lineCountGlobal;
+			} else {
+				if (flag->desc[i].isInstalled)
+					++stats->lineCountLocalInstalled;
+				else
+					++stats->lineCountLocal;
+			}
+		}
+	}
+}
+
+
+/** @brief destroy a given flag and set its pointer to the next flag or NULL
+ *  This function never fails. It is completely safe to call it with
+ *  a NULL pointer or a pointer to NULL.
+ *  If the given @a flag is the last in the ring, @a root and @a flag
+ *  are both set to NULL after the flags destruction.
+ *  If @a flag equals @a root and there are items left in the
+ *  ring, @a root is set to its successor.
+ *  @param[in,out] root pointer to the root flag.
+ *  @param[in,out] flag pointer to an sFlag pointer.
+**/
+void destroyFlag (sFlag** root, sFlag** flag)
+{
+	if (flag && *flag) {
+		sFlag* xFlag = *flag;
+		*flag = xFlag->next != xFlag ? xFlag->next : NULL;
+
+		// a) determine whether the ring is closed:
+		if (*root == xFlag)
+			*root = *flag;
+
+		// b) destroy description lines
+		for (int i = 0; i < xFlag->ndesc; ++i) {
+			if (xFlag->desc[i].pkg)
+				free (xFlag->desc[i].pkg);
+			if (xFlag->desc[i].desc)
+				free (xFlag->desc[i].desc);
+		}
+		if (xFlag->desc)
+			free (xFlag->desc);
+
+		// c) Destroy name and detach from the ring
+		if (xFlag->name)
+			free (xFlag->name);
+		if (xFlag->next && (xFlag->next != xFlag)) {
+			if (xFlag->prev && (xFlag->prev != xFlag))
+				xFlag->prev->next = xFlag->next;
+			xFlag->next->prev = xFlag->prev;
+		} else if (xFlag->prev && (xFlag->prev != xFlag))
+			xFlag->prev->next = NULL;
+		xFlag->next = NULL;
+		xFlag->prev = NULL;
+
+		// d) destroy remaining flag struct and set pointer to NULL
+		free (xFlag);
+	}
+}
+
+
+/** @brief determine the number of lines used by @a flag
+ *  This method checks the flag and its description line(s)
+ *  settings against the globally active filters.
+ *  If @a flag is NULL, the result will be 0.
+ *  @param[in] flag pointer to the flag to check.
+ *  @return number of lines needed to display the line *without* possible line wrapping.
+**/
+int getFlagHeight (const sFlag* flag)
+{
+	int result = 0;
+
+	if (flag) {
+		for (int i = 0; i < flag->ndesc; ++i)
+			result += isDescLegal(flag, i) ? 1 : 0;
+	}
+
+	return result;
+}
+
+
+/** @brief return true if the flag description @a idx is ok to display.
+ *  If @a flag is NULL, the result will be false.
+ *  @param[in] flag pointer to the flag to check.
+ *  @param[in] idx index of the description line to check.
+ *  @return true if at least one line has to be shown.
+ */
+bool isDescLegal (const sFlag* flag, int idx)
+{
+	bool result = false;
+
+	if (flag && (idx < flag->ndesc)) {
+		if ( // 1.: Check isGlobal versus e_scope
+			 ( ( flag->desc[idx].isGlobal && e_scope != eScope_local)
+			|| (!flag->desc[idx].isGlobal && e_scope != eScope_global) )
+			 // 2.: Check isInstalled versus e_state
+		  && ( ( flag->desc[idx].isInstalled && e_state != eState_notinstalled)
+			|| (!flag->desc[idx].isInstalled && e_state != eState_installed) )
+			 // 3.: Check stateMasked versus e_mask
+		  && ( (('+' == flag->desc[idx].stateMasked) && e_mask != eMask_unmasked)
+			|| (('+' != flag->desc[idx].stateMasked) && e_mask != eMask_masked) ) )
+			result = true;
+	}
+
+	return result;
+}
+
+/** @brief return true if this flag has at least one line to display.
+ *  This method checks the flag and its description line(s)
+ *  settings against the globally active filters.
+ *  The function returns as soon as the first displayable line is
+ *  found and can be therefore faster than getFlagHeight().
+ *  If @a flag is NULL, the result will be false.
+ *  @param[in] flag pointer to the flag to check.
+ *  @return true if at least one line has to be shown.
+ */
+bool isFlagLegal (const sFlag* flag)
+{
+	bool result = false;
+
+	if (flag) {
+		for (int i = 0; !result && (i < flag->ndesc); ++i) {
+			result = isDescLegal(flag, i);
+		}
+	}
+
+	return result;
+}

diff --git a/ufed-types.h b/ufed-types.h
new file mode 100644
index 0000000..9953b6a
--- /dev/null
+++ b/ufed-types.h
@@ -0,0 +1,155 @@
+/*
+ * ufed-types.h
+ *
+ *  Created on: 28.01.2013
+ *      Author: Sven Eden
+ */
+#pragma once
+#ifndef UFED_TYPES_H_INCLUDED
+#define UFED_TYPES_H_INCLUDED 1
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <curses.h>
+#include "ufed-debug.h"
+
+/* =============
+ * === enums ===
+ * =============
+ */
+
+/** @enum eMask_
+ *  @brief determine which flags are shown concerning masked status
+**/
+typedef enum eMask_ {
+	eMask_unmasked,
+	eMask_both,
+	eMask_masked
+} eMask;
+
+
+/** @enum eOrder_
+ *  @brief determine whether package lists are shown left or right of the description
+**/
+typedef enum eOrder_ {
+	eOrder_left,
+	eOrder_right
+} eOrder;
+
+
+/** @enum eScope_
+ *  @brief determine whether global, local or all flags are listed
+**/
+typedef enum eScope_ {
+	eScope_all,
+	eScope_global,
+	eScope_local
+} eScope;
+
+
+/** @enum eState_
+ *  @brief determine whether installed, not installed or all packages are listed
+**/
+typedef enum eState_ {
+	eState_all,
+	eState_installed,
+	eState_notinstalled
+} eState;
+
+
+/** @enum eWin_
+ *  @brief list of used curses windows
+**/
+typedef enum eWin_ {
+	Top = 0,
+	Left, List, Input, Scrollbar, Right, Bottom,
+	wCount // always last
+} eWin;
+
+
+/* ===============
+ * === structs ===
+ * ===============
+ */
+
+/** @struct sDesc_
+ *  @brief Describe one description line
+**/
+typedef struct sDesc_ {
+	char* desc;        //!< The description line
+	bool  isGlobal;    //!< true if this is the global description and setting
+	bool  isInstalled; //!< global: at least one pkg is installed, local: all in *pkg are installed.
+	char* pkg;         //!< affected packages
+	char  stateForced;  //!< unforced '-', forced '+' or not set ' ' by *use.force
+	char  stateMasked;  //!< unmasked '-', masked '+' or not sed ' ' by *use.mask
+	char  statePackage; //!< disabled '-', enabled '+' or not set ' ' by package.use
+} sDesc;
+
+
+/** @struct sFlag_
+ *  @brief Describe one flag and its make.conf setting in a doubly linked ring
+**/
+typedef struct sFlag_ {
+	int     currline;     //!< The current line on the screen this flag starts
+	sDesc*  desc;         //!< variable array of sDesc structs
+	bool    forced;       //!< true if the first global description is force enabled.
+	int     listline;     //!< The fixed line within the full list this flag starts
+	bool    masked;       //!< true if the first global description is mask enabled.
+	char*   name;         //!< Name of the flag or NULL for help lines
+	int     ndesc;        //!< number of description lines
+	struct
+	sFlag_* next;         //!< Next flag in the doubly linked ring
+	struct
+	sFlag_* prev;         //!< Previous flag in the doubly linked ring
+	char    stateConf;    //!< disabled '-', enabled '+' or not set ' ' by make.conf
+	char    stateDefault; //!< disabled '-', enabled '+' or not set ' ' by make.defaults
+} sFlag;
+
+
+/** @struct sListStats_
+ *  @brief hold stats of the flag list like line counts
+**/
+typedef struct sListStats_ {
+	int lineCountGlobal;
+	int lineCountGlobalInstalled;
+	int lineCountLocal;
+	int lineCountLocalInstalled;
+	int lineCountMasked;
+	int lineCountMaskedInstalled;
+} sListStats;
+
+
+/** @struct sKey_
+ *  @brief describe one main control key
+**/
+typedef struct sKey_ {
+	int key;           //!< curses key or -1 if no key shall be used
+	const char *descr; //!< Help text to display
+	size_t length;     //!< length of the description
+} sKey;
+
+
+/** @struct sWindow_
+ *  @brief describe one curses window dimensions
+**/
+typedef struct sWindow_ {
+	WINDOW *win;
+	const int top, left, height, width;
+} sWindow;
+
+
+/* =======================================
+ * === public functions handling types ===
+ * =======================================
+ */
+sFlag* addFlag      (sFlag** root, const char* name, int line, int ndesc, const char state[2]);
+size_t addFlagDesc  (sFlag* flag, const char* pkg, const char* desc, const char state[5]);
+void   addLineStats (const sFlag* flag, sListStats* stats);
+void   destroyFlag  (sFlag** root, sFlag** flag);
+int    getFlagHeight(const sFlag* flag);
+bool   isDescLegal  (const sFlag* flag, int idx);
+bool   isFlagLegal  (const sFlag* flag);
+
+#endif /* UFED_TYPES_H_INCLUDED */


^ permalink raw reply related	[flat|nested] 238+ messages in thread
* [gentoo-commits] proj/ufed:master commit in: /
@ 2013-02-01 10:49 Sven Eden
  0 siblings, 0 replies; 238+ messages in thread
From: Sven Eden @ 2013-02-01 10:49 UTC (permalink / raw
  To: gentoo-commits

commit:     15e2fbf03fa9b9edfdf9b51d7c309aca41cebd56
Author:     Sven Eden <sven.eden <AT> gmx <DOT> de>
AuthorDate: Wed Jan 30 14:00:46 2013 +0000
Commit:     Sven Eden <sven.eden <AT> gmx <DOT> de>
CommitDate: Wed Jan 30 14:00:46 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/ufed.git;a=commit;h=15e2fbf0

Added new files to Makefile.am

---
 Makefile.am |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/Makefile.am b/Makefile.am
index df14de5..f9b47e3 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -7,8 +7,8 @@ sbin_SCRIPTS = ufed
 libexec_PROGRAMS = ufed-curses
 dist_perl_DATA = Portage.pm
 
-ufed_curses_SOURCES = ufed-curses.c ufed-curses-checklist.c ufed-curses-help.c
-noinst_HEADERS = ufed-curses.h ufed-curses-help.h
+ufed_curses_SOURCES = ufed-types.c ufed-curses.c ufed-curses-checklist.c ufed-curses-help.c
+noinst_HEADERS = ufed-types.h ufed-curses.h ufed-curses-help.h ufed-debug.h
 dist_man_MANS = ufed.8
 EXTRA_DIST = ufed.pl.in
 


^ permalink raw reply related	[flat|nested] 238+ messages in thread
* [gentoo-commits] proj/ufed:master commit in: /
@ 2013-01-24 10:15 Sven Eden
  0 siblings, 0 replies; 238+ messages in thread
From: Sven Eden @ 2013-01-24 10:15 UTC (permalink / raw
  To: gentoo-commits

commit:     83f550d6b483d40845865d939352ad8292b6c9b9
Author:     Sven Eden <sven.eden <AT> gmx <DOT> de>
AuthorDate: Thu Jan 24 10:07:38 2013 +0000
Commit:     Sven Eden <sven.eden <AT> gmx <DOT> de>
CommitDate: Thu Jan 24 10:07:38 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/ufed.git;a=commit;h=83f550d6

Removed flexible array member configuration checks. It is no longer needed.

---
 config.h.in  |    9 ---------
 configure.ac |    5 ++---
 2 files changed, 2 insertions(+), 12 deletions(-)

diff --git a/config.h.in b/config.h.in
index fb98a70..98d0c13 100644
--- a/config.h.in
+++ b/config.h.in
@@ -1,14 +1,5 @@
 /* config.h.in.  Generated from configure.ac by autoheader.  */
 
-/* Define to nothing if C supports flexible array members, and to 1 if it does
-   not. That way, with a declaration like `struct s { int n; double
-   d[FLEXIBLE_ARRAY_MEMBER]; };', the struct hack can be used with pre-C99
-   compilers. When computing the size of such an object, don't use 'sizeof
-   (struct s)' as it overestimates the size. Use 'offsetof (struct s, d)'
-   instead. Don't use 'offsetof (struct s, d[0])', as this doesn't work with
-   MSVC and with C++ compilers. */
-#undef FLEXIBLE_ARRAY_MEMBER
-
 /* Name of package */
 #undef PACKAGE
 

diff --git a/configure.ac b/configure.ac
index bf34d16..50c54ca 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,6 +1,6 @@
 AC_PREREQ(2.68)
 AC_INIT([ufed],[git],[https://bugs.gentoo.org/])
-AM_INIT_AUTOMAKE([foreign -Wall -Werror])
+AM_INIT_AUTOMAKE([foreign])
 AC_CONFIG_SRCDIR([ufed-curses.c])
 AC_CONFIG_HEADERS([config.h])
 
@@ -10,14 +10,13 @@ if test "$ac_cv_prog_cc_c99" != no
 then
 	CFLAGS="$CFLAGS -Wall -Wextra -pedantic"
 	CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE=600"
-	AC_DEFINE([FLEXIBLE_ARRAY_MEMBER], [])
 else
 	AC_PROG_CC_C89
 	AC_C_INLINE
-	AC_C_FLEXIBLE_ARRAY_MEMBER
 	CFLAGS="$CFLAGS -Wall -W"
 	CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE=500"
 fi
+CFLAGS="${CFLAGS} -Wmissing-prototypes -Wstrict-prototypes"
 
 AC_ARG_WITH([curses],
 	[AS_HELP_STRING([--with-curses], [override default curses library (ncursesw ncurses curses)])],


^ permalink raw reply related	[flat|nested] 238+ messages in thread
* [gentoo-commits] proj/ufed:master commit in: /
@ 2013-01-24 10:15 Sven Eden
  0 siblings, 0 replies; 238+ messages in thread
From: Sven Eden @ 2013-01-24 10:15 UTC (permalink / raw
  To: gentoo-commits

commit:     b14f6eceb178d3a95eeba27fe7c26a0081e8b4d3
Author:     Sven Eden <sven.eden <AT> gmx <DOT> de>
AuthorDate: Thu Jan 24 10:08:23 2013 +0000
Commit:     Sven Eden <sven.eden <AT> gmx <DOT> de>
CommitDate: Thu Jan 24 10:08:23 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/ufed.git;a=commit;h=b14f6ece

Add missing comments and initializations to the help lines.

---
 ufed-curses-help.c |   21 +++++++++++++++++----
 1 files changed, 17 insertions(+), 4 deletions(-)

diff --git a/ufed-curses-help.c b/ufed-curses-help.c
index 3803144..62835f9 100644
--- a/ufed-curses-help.c
+++ b/ufed-curses-help.c
@@ -11,13 +11,23 @@
 #include <strings.h>
 #include <unistd.h>
 
+/* internal types */
 static struct line {
 	struct item item;
 	char *text;
 } *lines;
+
+/* internal members */
 static int helpheight, helpwidth;
 
+/* external members */
+extern enum mask showMasked;
+extern enum scope showScope;
+
+/* internal prototypes */
 static void free_lines(void);
+
+/* function implementations */
 static void init_lines(void) {
 	static const char * const help[] = {
 "ufed is a simple program designed to help you configure the systems USE "
@@ -110,7 +120,7 @@ static void init_lines(void) {
 	for(;;) {
 		line = malloc(sizeof *line);
 		if(line==NULL)
-			exit(-1);
+			ERROR_EXIT(-1, "Can not allocate %lu bytes for help line struct\n", sizeof(*line));
 		if(lines==NULL) {
 			line->item.prev = (struct item *) line;
 			line->item.next = (struct item *) line;
@@ -121,6 +131,10 @@ static void init_lines(void) {
 			lines->item.prev->next = (struct item *) line;
 			lines->item.prev = (struct item *) line;
 		}
+
+		line->item.currline = 0;
+		line->item.isMasked = false;
+		line->item.isGlobal = true;
 		line->item.listline = y++;
 		line->item.ndescr = 1;
 		n = strlen(word);
@@ -132,11 +146,10 @@ static void init_lines(void) {
 				}
 			}
 		}
-		line->text = malloc(n+1);
+		line->text = calloc((n+1), sizeof(char));
 		if(line->text==NULL)
-			exit(-1);
+			ERROR_EXIT(-1, "Can not allocate %lu bytes for help line\n", (n+1) * sizeof(char));
 		memcpy(line->text, word, n);
-		line->text[n] = '\0';
 		while(word[n]==' ')
 			n++;
 		word += n;


^ permalink raw reply related	[flat|nested] 238+ messages in thread
* [gentoo-commits] proj/ufed:master commit in: /
@ 2013-01-24 10:15 Sven Eden
  0 siblings, 0 replies; 238+ messages in thread
From: Sven Eden @ 2013-01-24 10:15 UTC (permalink / raw
  To: gentoo-commits

commit:     d1a02e6e159fedf7519b6b5a18c5d922aa6c9533
Author:     Sven Eden <sven.eden <AT> gmx <DOT> de>
AuthorDate: Thu Jan 24 10:16:06 2013 +0000
Commit:     Sven Eden <sven.eden <AT> gmx <DOT> de>
CommitDate: Thu Jan 24 10:16:06 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/ufed.git;a=commit;h=d1a02e6e

Set sane filters on every maineventloop start.

---
 ufed-curses.c |   28 +++++++++++++++++-----------
 1 files changed, 17 insertions(+), 11 deletions(-)

diff --git a/ufed-curses.c b/ufed-curses.c
index e4934ae..8b1b53a 100644
--- a/ufed-curses.c
+++ b/ufed-curses.c
@@ -42,11 +42,11 @@ extern int lineCountMasked;
 /* internal prototypes */
 int (*callback)(struct item **, int);
 int (*drawitem)(struct item *, bool);
-void checktermsize();
-void draw();
-void drawscrollbar();
-int  getListHeight();
-void resetDisplay();
+void checktermsize(void);
+void draw(void);
+void drawscrollbar(void);
+int  getListHeight(void);
+void resetDisplay(void);
 void setNextItem(int count, bool strict);
 void setPrevItem(int count, bool strict);
 
@@ -416,6 +416,12 @@ int maineventloop(
 		const struct key *_keys) {
 	int result;
 
+	// Always reset the Filters on start and revert on exit
+	enum mask oldMask = showMasked;
+	enum scope oldScope = showScope;
+	showMasked = show_unmasked;
+	showScope  = show_all;
+
 	{ const char *temp = subtitle;
 		subtitle=_subtitle;
 		_subtitle=temp; }
@@ -672,11 +678,12 @@ exit:
 	items    = _items;
 	keys     = _keys;
 
-	if(items!=NULL) {
-		currentitem = items;
-		topline = 0;
-		draw();
-	}
+	// revert filters
+	showMasked = oldMask;
+	showScope  = oldScope;
+
+	if(items!=NULL)
+		resetDisplay();
 
 	return result;
 }
@@ -686,7 +693,6 @@ exit:
  */
 void resetDisplay()
 {
-	drawitem(currentitem, FALSE);
 	currentitem = items;
 	while (!isLegalItem(currentitem))
 		currentitem = currentitem->next;


^ permalink raw reply related	[flat|nested] 238+ messages in thread
* [gentoo-commits] proj/ufed:master commit in: /
@ 2013-01-24 10:15 Sven Eden
  0 siblings, 0 replies; 238+ messages in thread
From: Sven Eden @ 2013-01-24 10:15 UTC (permalink / raw
  To: gentoo-commits

commit:     ffd649aa6a59a0c06a675f4884e40d0b5dc550e4
Author:     Sven Eden <sven.eden <AT> gmx <DOT> de>
AuthorDate: Thu Jan 24 10:15:16 2013 +0000
Commit:     Sven Eden <sven.eden <AT> gmx <DOT> de>
CommitDate: Thu Jan 24 10:15:16 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/ufed.git;a=commit;h=ffd649aa

Exit curses before erroring out with ERROR_EXIT() macro.

---
 ufed-curses.h |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/ufed-curses.h b/ufed-curses.h
index 6f46e28..3ef4a24 100644
--- a/ufed-curses.h
+++ b/ufed-curses.h
@@ -11,13 +11,14 @@
 
 #if defined(DEBUG_EXIT)
 #  define ERROR_EXIT(code, fmt, ...) { \
+	cursesdone(); \
 	fprintf(stderr, "\nERROR in %s:%d (%s): \n -> ", \
 		__FILE__, __LINE__, __FUNCTION__); \
 	fprintf(stderr, fmt, __VA_ARGS__); \
 	exit(code); \
 }
 #else
-#  define ERROR_EXIT(code, ...) { exit(code); }
+#  define ERROR_EXIT(code, ...) { cursesdone(); exit(code); }
 #endif // DEBUG_EXIT
 #if defined(DEBUG_TRACE)
 # define TRACE { \


^ permalink raw reply related	[flat|nested] 238+ messages in thread
* [gentoo-commits] proj/ufed:master commit in: /
@ 2013-01-24 10:15 Sven Eden
  0 siblings, 0 replies; 238+ messages in thread
From: Sven Eden @ 2013-01-24 10:15 UTC (permalink / raw
  To: gentoo-commits

commit:     a4b967e516f98de1c114c02ca33cde63090b78bc
Author:     Sven Eden <sven.eden <AT> gmx <DOT> de>
AuthorDate: Thu Jan 24 10:13:29 2013 +0000
Commit:     Sven Eden <sven.eden <AT> gmx <DOT> de>
CommitDate: Thu Jan 24 10:13:29 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/ufed.git;a=commit;h=a4b967e5

removed extern filter enums from ufed-curses-help.c, they are not used there

---
 ufed-curses-help.c |    2 --
 ufed-curses.h      |    2 +-
 2 files changed, 1 insertions(+), 3 deletions(-)

diff --git a/ufed-curses-help.c b/ufed-curses-help.c
index 62835f9..ba71d04 100644
--- a/ufed-curses-help.c
+++ b/ufed-curses-help.c
@@ -21,8 +21,6 @@ static struct line {
 static int helpheight, helpwidth;
 
 /* external members */
-extern enum mask showMasked;
-extern enum scope showScope;
 
 /* internal prototypes */
 static void free_lines(void);

diff --git a/ufed-curses.h b/ufed-curses.h
index a48dad1..6f46e28 100644
--- a/ufed-curses.h
+++ b/ufed-curses.h
@@ -11,7 +11,7 @@
 
 #if defined(DEBUG_EXIT)
 #  define ERROR_EXIT(code, fmt, ...) { \
-	fprintf(stderr, "ERROR in %s:%d (%s): \n -> ", \
+	fprintf(stderr, "\nERROR in %s:%d (%s): \n -> ", \
 		__FILE__, __LINE__, __FUNCTION__); \
 	fprintf(stderr, fmt, __VA_ARGS__); \
 	exit(code); \


^ permalink raw reply related	[flat|nested] 238+ messages in thread
* [gentoo-commits] proj/ufed:master commit in: /
@ 2013-01-23 14:44 Sven Eden
  0 siblings, 0 replies; 238+ messages in thread
From: Sven Eden @ 2013-01-23 14:44 UTC (permalink / raw
  To: gentoo-commits

commit:     7d480726bfedba69db50d761f669829414fba53c
Author:     Sven Eden <sven.eden <AT> gmx <DOT> de>
AuthorDate: Wed Jan 23 14:45:14 2013 +0000
Commit:     Sven Eden <sven.eden <AT> gmx <DOT> de>
CommitDate: Wed Jan 23 14:45:14 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/ufed.git;a=commit;h=7d480726

Change layout to have both the flag setting origin (make.defaults/make.conf) and the flag description scope (global, local, masked, installed) in separate columns.

---
 ufed-curses-checklist.c |  116 +++++++++++++++++++++++++----------------------
 ufed-curses.c           |   18 +++++++
 2 files changed, 80 insertions(+), 54 deletions(-)

diff --git a/ufed-curses-checklist.c b/ufed-curses-checklist.c
index f2cfcaf..c483d32 100644
--- a/ufed-curses-checklist.c
+++ b/ufed-curses-checklist.c
@@ -131,7 +131,7 @@ static void read_flags(void) {
 		line = getline(input);
 		if(NULL == line)
 			break;
-		if(sscanf(line, "%n%*s%n %n%*s%n %n(%*[ +-])%n %d",
+		if(sscanf(line, "%n%*s%n %n%*s%n (%n%*[ +-]%n) %d",
 				&name.start,  &name.end,
 				&on.start,    &on.end,
 				&state.start, &state.end,
@@ -160,8 +160,13 @@ static void read_flags(void) {
 		flag->item.listline = lineNum;
 		flag->item.currline = 0;
 
-		if(name.end - name.start + 11 > minwidth)
-			minwidth = name.end - name.start + 11;
+		/* The minimum width of the left side display is:
+		 * Space + Selection + Space + name + Space + Mask brackets.
+		 * = 1 + 3 + 1 + strlen(name) + 1 + 2
+		 * = strlen(name) + 8
+		 */
+		if(name.end - name.start + 8 > minwidth)
+			minwidth = name.end - name.start + 8;
 		strncpy(flag->name, &line[name.start], name.end - name.start);
 
 		/* check and save current flag setting from configuration */
@@ -176,9 +181,9 @@ static void read_flags(void) {
 			ERROR_EXIT(-1, "flag->on can not be determined with \"%s\"\n", &line[on.start]);
 
 		/* check and set flag state */
-		if(state.end - state.start != 4)
-			ERROR_EXIT(-1, "state length is %d (must be 4)\n", state.end - state.start);
-		strncpy(flag->state, &line[state.start], 4);
+		if(state.end - state.start != 2)
+			ERROR_EXIT(-1, "state length is %d (must be 2)\n", state.end - state.start);
+		strncpy(flag->state, &line[state.start], 2);
 
 		/* check and set flag item height */
 		flag->item.ndescr = ndescr;
@@ -252,7 +257,7 @@ static void read_flags(void) {
 				ERROR_EXIT(-1, "Flag %s has no description at line %d\n", flag->name, i);
 
 			// Note new max length if this line is longest:
-			size_t fullWidth = 1 + strlen(flag->descr[i]) + (flag->pkgs[i] ? strlen(flag->pkgs[i] + 3) : 0);
+			size_t fullWidth = 1 + strlen(flag->descr[i]) + (flag->pkgs[i] ? strlen(flag->pkgs[i]) + 3 : 0);
 			if (fullWidth > maxDescWidth)
 				maxDescWidth = fullWidth;
 
@@ -339,23 +344,22 @@ static int drawflag(struct item *item, bool highlight) {
 			return 0;
 	}
 
-	wmove(win(List), line, 0);
+	memset(buf, 0, sizeof(char) * (wWidth(List)+1));
 
 	/* print the selection, name and state of the flag */
-	sprintf(buf, " %c%c%c %s%s%s%-*s %-4.4s ",
+	sprintf(buf, " %c%c%c %s%s%s%-*s ",
 		/* State of selection */
 		flag->on == ' ' ? '(' : '[',
 		flag->on == ' '
-			? flags->on == ' '
-				? flag->state[1] : ' '
+			? flag->on == ' '
+				? flag->state[0] : ' '
 			: flag->on,
 		flag->on == ' ' ? ')' : ']',
 		/* name */
 		flag->item.isMasked ? "(" : "", flag->name, flag->item.isMasked ? ")" : "",
 		/* distance */
-		(int)(minwidth - (flag->item.isMasked ? 13 : 11) - strlen(flag->name)), "",
-		/* current selection state */
-		flag->state);
+		(int)(minwidth - (flag->item.isMasked ? 4 : 6) - strlen(flag->name)), " ");
+		// At this point buf is filled up to minwidth
 
 	/* print descriptions according to filters
 	 * TODO: Implement installed/all filters
@@ -373,12 +377,11 @@ static int drawflag(struct item *item, bool highlight) {
 				break;
 
 			// Display flag state
-			bool hasScope = flag->item.isGlobal && !flag->pkgs[idx] ? false : true;
-			if (hasScope) {
-				sprintf(buf + minwidth, " %c%c  ",
-					flag->item.isMasked ? 'M' : 'L',
-					flag->isInstalled[idx] ? '*' : ' ');
-			}
+			bool isGlobalDesc = flag->item.isGlobal && !flag->pkgs[idx] ? true : false;
+			sprintf(buf + minwidth, " %s %c%c  ",
+				flag->state,
+				isGlobalDesc ? ' ' : flag->item.isMasked ? 'M' : 'L',
+				flag->isInstalled[idx] ? '*' : ' ');
 
 			// Assemble description line:
 			memset(desc, 0, maxDescWidth * sizeof(char));
@@ -392,9 +395,9 @@ static int drawflag(struct item *item, bool highlight) {
 				sprintf(desc, "%s", flag->descr[idx]);
 
 			// Now display the description line according to its horizontal position
-			sprintf(buf + minwidth + (hasScope ? 5 : 0), "%-*.*s",
-				wWidth(List)-minwidth - (hasScope ? 5 : 0),
-				wWidth(List)-minwidth - (hasScope ? 5 : 0),
+			sprintf(buf + minwidth + 8, "%-*.*s",
+				wWidth(List)-minwidth - 8,
+				wWidth(List)-minwidth - 8,
 				strlen(desc) > (size_t)descriptionleft
 					? &desc[descriptionleft]
 					: "");
@@ -407,11 +410,9 @@ static int drawflag(struct item *item, bool highlight) {
 
 			// Finally put the line on the screen
 			mvwaddstr(win(List), line, 0, buf);
-			// waddstr(win(List), buf);
-			if (hasScope) {
-				mvwaddch(win(List), line, minwidth,     ACS_VLINE);
-				mvwaddch(win(List), line, minwidth + 3, ACS_VLINE);
-			}
+			mvwaddch(win(List), line, minwidth,     ACS_VLINE); // Before state
+			mvwaddch(win(List), line, minwidth + 3, ACS_VLINE); // Between state and scope
+			mvwaddch(win(List), line, minwidth + 6, ACS_VLINE); // After scope
 			++line;
 			++idx;
 			++usedY;
@@ -439,6 +440,9 @@ static int callback(struct item **currentitem, int key) {
 		*fayt = '\0';
 		wattrset(win(Input), COLOR_PAIR(3));
 		mvwhline(win(Input), 0, 0, ' ', wWidth(Input));
+		mvwaddch(win(Input), 0, minwidth,     ACS_VLINE); // Before state
+		mvwaddch(win(Input), 0, minwidth + 3, ACS_VLINE); // Between state and scope
+		mvwaddch(win(Input), 0, minwidth + 6, ACS_VLINE); // After scope
 		wrefresh(win(Input));
 	}
 	if(descriptionleft!=0 && key!=KEY_LEFT && key!=KEY_RIGHT) {
@@ -529,20 +533,22 @@ static int callback(struct item **currentitem, int key) {
 			return 1;
 		break;
 	case ' ': {
-		// do not toggle masked flags using the keyboard
-		if ((*currentitem)->isMasked)
-			break;
-		// Not masked? Then cycle through the states.
-		switch (((struct flag *) *currentitem)->on) {
-		case '+':
-			((struct flag *) *currentitem)->on = '-';
-			break;
-		case '-':
+		// Masked flags can be turned off, nothing else
+		if ( (*currentitem)->isMasked
+		  && (' ' != ((struct flag *) *currentitem)->on) )
 			((struct flag *) *currentitem)->on = ' ';
-			break;
-		default:
-			((struct flag *) *currentitem)->on = '+';
-			break;
+		else {
+			switch (((struct flag *) *currentitem)->on) {
+				case '+':
+					((struct flag *) *currentitem)->on = '-';
+					break;
+				case '-':
+					((struct flag *) *currentitem)->on = ' ';
+					break;
+				default:
+					((struct flag *) *currentitem)->on = '+';
+					break;
+			}
 		}
 		if (*currentitem != &flags->item) {
 			drawflag(*currentitem, TRUE);
@@ -568,20 +574,22 @@ static int callback(struct item **currentitem, int key) {
 		break;
 #ifdef NCURSES_MOUSE_VERSION
 	case KEY_MOUSE:
-		// do not toggle masked flags using the double click
-		if ((*currentitem)->isMasked)
-			break;
-		// Not masked? Then cycle through the states.
-		switch (((struct flag *) *currentitem)->on) {
-		case '+':
-			((struct flag *) *currentitem)->on = '-';
-			break;
-		case '-':
+		// Masked flags can be turned off, nothing else
+		if ( (*currentitem)->isMasked
+		  && (' ' != ((struct flag *) *currentitem)->on) )
 			((struct flag *) *currentitem)->on = ' ';
-			break;
-		default:
-			((struct flag *) *currentitem)->on = '+';
-			break;
+		else {
+			switch (((struct flag *) *currentitem)->on) {
+				case '+':
+					((struct flag *) *currentitem)->on = '-';
+					break;
+				case '-':
+					((struct flag *) *currentitem)->on = ' ';
+					break;
+				default:
+					((struct flag *) *currentitem)->on = '+';
+					break;
+			}
 		}
 		if (*currentitem != &flags->item) {
 			drawflag(*currentitem, TRUE);

diff --git a/ufed-curses.c b/ufed-curses.c
index 0f5e94e..e4934ae 100644
--- a/ufed-curses.c
+++ b/ufed-curses.c
@@ -252,6 +252,9 @@ void draw() {
 	waddch(w, ' ');
 	waddch(w, ACS_ULCORNER);
 	whline(w, ACS_HLINE, wWidth(Top)-6);
+	mvwaddch(w, 4, minwidth + 3, ACS_TTEE); // Before state
+	mvwaddch(w, 4, minwidth + 6, ACS_TTEE); // Between state and scope
+	mvwaddch(w, 4, minwidth + 9, ACS_TTEE); // After scope
 	mvwaddch(w, 4, wWidth(Top)-3, ACS_URCORNER);
 	waddch(w, ' ');
 	wattrset(w, COLOR_PAIR(2) | A_BOLD);
@@ -281,6 +284,9 @@ void draw() {
 	waddch(w, ' ');
 	waddch(w, ACS_LLCORNER);
 	whline(w, ACS_HLINE, wWidth(Bottom)-6);
+	mvwaddch(w, 0, minwidth + 3, ACS_BTEE); // Before state
+	mvwaddch(w, 0, minwidth + 6, ACS_BTEE); // Between state and scope
+	mvwaddch(w, 0, minwidth + 9, ACS_BTEE); // After scope
 	mvwaddch(w, 0, wWidth(Bottom)-3, ACS_LRCORNER);
 	waddch(w, ' ');
 	wattrset(w, COLOR_PAIR(2) | A_BOLD);
@@ -330,6 +336,9 @@ void draw() {
 	w = win(Input);
 	wattrset(w, COLOR_PAIR(3));
 	mvwhline(w, 0, 0, ' ', wWidth(Input));
+	mvwaddch(w, 0, minwidth,     ACS_VLINE); // Before state
+	mvwaddch(w, 0, minwidth + 3, ACS_VLINE); // Between state and scope
+	mvwaddch(w, 0, minwidth + 6, ACS_VLINE); // After scope
 	wnoutrefresh(w);
 
 	drawitems();
@@ -353,6 +362,9 @@ bool scrollcurrent() {
 bool yesno(const char *prompt) {
 	wattrset(win(Input), COLOR_PAIR(4) | A_BOLD | A_REVERSE);
 	mvwhline(win(Input), 0, 0, ' ', wWidth(Input));
+	mvwaddch(win(Input), 0, minwidth,     ACS_VLINE); // Before state
+	mvwaddch(win(Input), 0, minwidth + 3, ACS_VLINE); // Between state and scope
+	mvwaddch(win(Input), 0, minwidth + 6, ACS_VLINE); // After scope
 	waddstr(win(Input), prompt);
 	whline(win(Input), 'Y', 1);
 	wrefresh(win(Input));
@@ -364,6 +376,9 @@ bool yesno(const char *prompt) {
 		case 'N': case 'n':
 			wattrset(win(Input), COLOR_PAIR(3));
 			mvwhline(win(Input), 0, 0, ' ', wWidth(Input));
+			mvwaddch(win(Input), 0, minwidth,     ACS_VLINE); // Before state
+			mvwaddch(win(Input), 0, minwidth + 3, ACS_VLINE); // Between state and scope
+			mvwaddch(win(Input), 0, minwidth + 6, ACS_VLINE); // After scope
 			wnoutrefresh(win(Input));
 			wrefresh(win(List));
 			return FALSE;
@@ -381,6 +396,9 @@ bool yesno(const char *prompt) {
 				draw();
 				wattrset(win(Input), COLOR_PAIR(4) | A_BOLD | A_REVERSE);
 				mvwhline(win(Input), 0, 0, ' ', wWidth(Input));
+				mvwaddch(win(Input), 0, minwidth,     ACS_VLINE); // Before state
+				mvwaddch(win(Input), 0, minwidth + 3, ACS_VLINE); // Between state and scope
+				mvwaddch(win(Input), 0, minwidth + 6, ACS_VLINE); // After scope
 				waddstr(win(Input), prompt);
 				whline(win(Input), 'Y', 1);
 				wrefresh(win(Input));


^ permalink raw reply related	[flat|nested] 238+ messages in thread
* [gentoo-commits] proj/ufed:master commit in: /
@ 2013-01-23 12:05 Sven Eden
  0 siblings, 0 replies; 238+ messages in thread
From: Sven Eden @ 2013-01-23 12:05 UTC (permalink / raw
  To: gentoo-commits

commit:     bad3db1d1b1e55e8597ea6a0b48d2dbda7a8a41d
Author:     Sven Eden <sven.eden <AT> gmx <DOT> de>
AuthorDate: Wed Jan 23 11:46:12 2013 +0000
Commit:     Sven Eden <sven.eden <AT> gmx <DOT> de>
CommitDate: Wed Jan 23 11:46:12 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/ufed.git;a=commit;h=bad3db1d

Fixed scrollbar scaling and movement for filtered lists.

---
 ufed-curses.c |   52 ++++++++++++++++++++++++++++++++--------------------
 1 files changed, 32 insertions(+), 20 deletions(-)

diff --git a/ufed-curses.c b/ufed-curses.c
index b9e71b0..0f5e94e 100644
--- a/ufed-curses.c
+++ b/ufed-curses.c
@@ -22,6 +22,8 @@ struct window window[wCount] = {
 static const char *subtitle;
 static const struct key *keys;
 static struct item *items, *currentitem;
+// Needed for the scrollbar and its mouse events
+static int listHeight, barStart, barEnd, dispStart, dispEnd;
 
 
 /* external members */
@@ -158,23 +160,30 @@ void drawitems() {
 		line    = 0;
 	}
 
+	// The display start line might differ from topline:
+	dispStart = item->listline;
+
 	for( ; line < wHeight(List); ) {
 		item->currline = line; // drawitem() and maineventloop() need this
 		line += drawitem(item, item == currentitem ? TRUE : FALSE);
-		item = item->next;
 
-		/* Add blank lines if we reached the end of the
-		 * flag list, but not the end of the display.
-		 */
-		if((line < wHeight(List)) && (item == items)) {
-			char buf[wWidth(List)];
-			memset(buf, ' ', wWidth(List));
-			buf[wWidth(List)] = '\0';
-			wmove(win(List), line, 0);
-			wattrset(win(List), COLOR_PAIR(3));
-			while(line++ < wHeight(List))
-				waddstr(win(List), buf);
-		}
+		if (line < wHeight(List)) {
+			item = item->next;
+
+			/* Add blank lines if we reached the end of the
+			 * flag list, but not the end of the display.
+			 */
+			if(item == items) {
+				char buf[wWidth(List)];
+				memset(buf, ' ', wWidth(List));
+				buf[wWidth(List)] = '\0';
+				wmove(win(List), line, 0);
+				wattrset(win(List), COLOR_PAIR(3));
+				while(line++ < wHeight(List))
+					waddstr(win(List), buf);
+			}
+		} else
+			dispEnd = item->listline + item->ndescr;
 	}
 	wnoutrefresh(win(List));
 }
@@ -188,14 +197,19 @@ void drawscrollbar() {
 	/* The scrollbar location differs related to the
 	 * current filtering of masked flags.
 	 */
-	int listHeight = getListHeight();
+	listHeight = getListHeight();
 
 	// Only show a scrollbar if the list is actually longer than can be displayed:
 	if (listHeight > wHeight(List)) {
 		int sbHeight = wHeight(Scrollbar) - 3;
-		int barStart = 1 + (currentitem->listline * sbHeight / bottomline);
-		int barEnd   = barStart + (sbHeight * wHeight(List) / listHeight);
+		barStart = 1 + (dispStart * sbHeight / bottomline);
+		barEnd   = barStart + ((dispEnd - dispStart) * wHeight(List) / bottomline);
 
+		// Strongly filtered lists scatter much and must be corrected:
+		if (barEnd > sbHeight) {
+			barStart -= barEnd - sbHeight;
+			barEnd   -= barEnd - sbHeight;
+		}
 		for ( ; barStart <= barEnd; ++barStart)
 			mvwaddch(w, barStart, 0, ACS_BLOCK);
 	}
@@ -456,13 +470,9 @@ int maineventloop(
 					}
 				} else if(wmouse_trafo(win(Scrollbar), &event.y, &event.x, FALSE)) {
 					// Only do mouse events if there actually is a scrollbar
-					int listHeight = getListHeight();
 					if( (listHeight > wHeight(List))
 					 && (event.bstate & (BUTTON1_PRESSED | BUTTON1_CLICKED | BUTTON1_DOUBLE_CLICKED))
 					 && (event.y < wHeight(Scrollbar)-1) ) {
-						int sbHeight = wHeight(Scrollbar) - 3;
-						int barStart = 1 + (sbHeight / listHeight);
-						int barEnd   = barStart + (sbHeight * wHeight(List) / listHeight);
 						halfdelay(1);
 #define SIM(key) \
 	{ \
@@ -489,7 +499,9 @@ int maineventloop(
 								case KEY_MOUSE:
 									if(getmouse(&event)==OK) {
 										event.y -= wTop(Scrollbar) + 1;
+										int sbHeight = wHeight(Scrollbar) - 3;
 										if( (event.y >= 0) && (event.y < sbHeight) ) {
+											/// TODO : This needs to be fixed!
 											topline = (event.y * (listHeight - sbHeight + 2) + sbHeight - 1) / sbHeight;
 											// was: topy = (event.y*(items->prev->top+items->prev->height-(wHeight(List)-1))+(wHeight(Scrollbar)-4))/(wHeight(Scrollbar)-3);
 											while( (currentitem != items)


^ permalink raw reply related	[flat|nested] 238+ messages in thread
* [gentoo-commits] proj/ufed:master commit in: /
@ 2013-01-23 12:05 Sven Eden
  0 siblings, 0 replies; 238+ messages in thread
From: Sven Eden @ 2013-01-23 12:05 UTC (permalink / raw
  To: gentoo-commits

commit:     a688bacb6c21d00fd091e62cf9c07a789741f02a
Author:     Sven Eden <sven.eden <AT> gmx <DOT> de>
AuthorDate: Wed Jan 23 09:01:41 2013 +0000
Commit:     Sven Eden <sven.eden <AT> gmx <DOT> de>
CommitDate: Wed Jan 23 09:01:41 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/ufed.git;a=commit;h=a688bacb

Fixed wrong number of skipped lines using PgUp/PgDn

---
 ufed-curses.c |   57 ++++++++++++++++++++++++++++++---------------------------
 1 files changed, 30 insertions(+), 27 deletions(-)

diff --git a/ufed-curses.c b/ufed-curses.c
index 41b84ea..5bfaac4 100644
--- a/ufed-curses.c
+++ b/ufed-curses.c
@@ -128,21 +128,13 @@ void checktermsize() {
 }
 
 void drawitems() {
-	/* sanitize currentitem first.
-	 * This is needed, because the currently selected
-	 * item may become invalid when a filter is
-	 * toggled.
+	/* this method must not be called if the current
+	 * item is not valid.
 	 */
-	if (!isLegalItem(currentitem)) {
-		while ((currentitem != items) && !isLegalItem(currentitem)) {
-			currentitem = currentitem->prev;
-			topline -= currentitem->ndescr;
-		}
-		while ((currentitem->next != items) && !isLegalItem(currentitem)) {
-			topline += currentitem->ndescr;
-			currentitem = currentitem->next;
-		}
-	} // End of sanitizing currentitem
+	if (!isLegalItem(currentitem))
+		ERROR_EXIT(-1,
+			"drawitems() must not be called with a filtered currentitem! (topline %d listline %d)\n",
+			topline, currentitem->listline)
 
 	struct item *item = currentitem;
 	int line = item->listline - topline;
@@ -150,23 +142,20 @@ void drawitems() {
 	/* move to the top of the displayed list */
 	while ((item != items) && (line > 0)) {
 		item = item->prev;
-		line = item->listline - topline;
+		if (isLegalItem(item))
+			line -= getItemHeight(item);
 	}
 
 	/* If the above move ended up with item == items
-	 * it must be checked whether to move forwards again.
+	 * topline and line must be adapted to the current
+	 * item.
 	 * This can happen if the flag filter is toggled
 	 * and the current item is the first not filtered item.
 	 */
 	if ((item == items) && !isLegalItem(item)) {
-		item = currentitem;
-		while (!isLegalItem(item) && (item != items)) {
-			if (currentitem == item)
-				currentitem = item->next;
-			topline += item->ndescr;
-			item = item->next;
-			line = item->listline - topline;
-		}
+		item    = currentitem;
+		topline = currentitem->listline;
+		line    = 0;
 	}
 
 	for( ; line < wHeight(List); ) {
@@ -185,7 +174,6 @@ void drawitems() {
 			wattrset(win(List), COLOR_PAIR(3));
 			while(line++ < wHeight(List))
 				waddstr(win(List), buf);
-			break;
 		}
 	}
 	wnoutrefresh(win(List));
@@ -695,10 +683,18 @@ void setNextItem(int count, bool strict)
 
 		// curr is only counted if it is not filtered out:
 		if (isLegalItem(curr))
-			++skipped;
+			skipped += getItemHeight(curr);
+		else
+			// Otherwise topline must be adapted or scrollcurrent() wreaks havoc!
+			topline += curr->ndescr;
 	} // End of trying to find a next item
 
 	if ( (result && strict) || (!strict && skipped) ) {
+		// Move back again if curr ended up being filtered
+		while (!isLegalItem(curr)) {
+			topline -= curr->ndescr;
+			curr = curr->prev;
+		}
 		drawitem(currentitem, FALSE);
 		currentitem = curr;
 		if (!scrollcurrent())
@@ -725,10 +721,17 @@ void setPrevItem(int count, bool strict)
 
 		// curr is only counted if it is not filtered out:
 		if (isLegalItem(curr))
-			++skipped;
+			skipped += getItemHeight(curr);
+		else
+			topline -= curr->ndescr;
 	} // End of trying to find next item
 
 	if ( (result && strict) || (!strict && skipped) ) {
+		// Move forth again if curr ended up being filtered
+		while (!isLegalItem(curr)) {
+			curr = curr->prev;
+			topline += curr->ndescr;
+		}
 		drawitem(currentitem, FALSE);
 		currentitem = curr;
 		if (!scrollcurrent())


^ permalink raw reply related	[flat|nested] 238+ messages in thread
* [gentoo-commits] proj/ufed:master commit in: /
@ 2013-01-23 12:05 Sven Eden
  0 siblings, 0 replies; 238+ messages in thread
From: Sven Eden @ 2013-01-23 12:05 UTC (permalink / raw
  To: gentoo-commits

commit:     aad2bfc94bbcd62eaf2a6c8b49e3579a228cf900
Author:     Sven Eden <sven.eden <AT> gmx <DOT> de>
AuthorDate: Wed Jan 23 09:15:35 2013 +0000
Commit:     Sven Eden <sven.eden <AT> gmx <DOT> de>
CommitDate: Wed Jan 23 09:15:35 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/ufed.git;a=commit;h=aad2bfc9

Fixed Scrolling on limited filtered lists

---
 ufed-curses.c |   10 +++++++---
 1 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/ufed-curses.c b/ufed-curses.c
index 5bfaac4..b9e71b0 100644
--- a/ufed-curses.c
+++ b/ufed-curses.c
@@ -674,6 +674,7 @@ void setNextItem(int count, bool strict)
 	bool         result  = true;
 	struct item *curr    = currentitem;
 	int          skipped = 0;
+	int          oldTop  = topline;
 
 	while (result && (skipped < count)) {
 		if (curr->next == items)
@@ -699,7 +700,8 @@ void setNextItem(int count, bool strict)
 		currentitem = curr;
 		if (!scrollcurrent())
 			drawitem(currentitem, TRUE);
-	}
+	} else
+		topline = oldTop;
 }
 
 
@@ -712,6 +714,7 @@ void setPrevItem(int count, bool strict)
 	bool         result  = true;
 	struct item *curr    = currentitem;
 	int          skipped = 0;
+	int          oldTop  = topline;
 
 	while (result && (skipped < count)) {
 		if (curr == items)
@@ -729,14 +732,15 @@ void setPrevItem(int count, bool strict)
 	if ( (result && strict) || (!strict && skipped) ) {
 		// Move forth again if curr ended up being filtered
 		while (!isLegalItem(curr)) {
-			curr = curr->prev;
 			topline += curr->ndescr;
+			curr = curr->next;
 		}
 		drawitem(currentitem, FALSE);
 		currentitem = curr;
 		if (!scrollcurrent())
 			drawitem(currentitem, TRUE);
-	}
+	} else
+		topline = oldTop;
 }
 
 


^ permalink raw reply related	[flat|nested] 238+ messages in thread
* [gentoo-commits] proj/ufed:master commit in: /
@ 2013-01-23 12:05 Sven Eden
  0 siblings, 0 replies; 238+ messages in thread
From: Sven Eden @ 2013-01-23 12:05 UTC (permalink / raw
  To: gentoo-commits

commit:     56dd9c3f8f8e5f003ad1fa73f7015e03c628fd01
Author:     Sven Eden <sven.eden <AT> gmx <DOT> de>
AuthorDate: Wed Jan 23 12:04:42 2013 +0000
Commit:     Sven Eden <sven.eden <AT> gmx <DOT> de>
CommitDate: Wed Jan 23 12:04:42 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/ufed.git;a=commit;h=56dd9c3f

Changed layout: Global descriptions no longer have a prefix. Others have ACS_VLINE + L/M + ' '/'*' for Local/Masked and unisntalled/installed.

---
 ufed-curses-checklist.c |   24 +++++++++++++++---------
 1 files changed, 15 insertions(+), 9 deletions(-)

diff --git a/ufed-curses-checklist.c b/ufed-curses-checklist.c
index 4518375..f2cfcaf 100644
--- a/ufed-curses-checklist.c
+++ b/ufed-curses-checklist.c
@@ -373,10 +373,12 @@ static int drawflag(struct item *item, bool highlight) {
 				break;
 
 			// Display flag state
-			sprintf(buf + minwidth, "[%c] ",
-				flag->item.isMasked ? flag->isInstalled[idx] ? 'M' : 'm'
-					: flag->item.isGlobal && !flag->pkgs[idx] ? 'g'
-					: flag->isInstalled[idx] ? 'L' : 'l');
+			bool hasScope = flag->item.isGlobal && !flag->pkgs[idx] ? false : true;
+			if (hasScope) {
+				sprintf(buf + minwidth, " %c%c  ",
+					flag->item.isMasked ? 'M' : 'L',
+					flag->isInstalled[idx] ? '*' : ' ');
+			}
 
 			// Assemble description line:
 			memset(desc, 0, maxDescWidth * sizeof(char));
@@ -390,8 +392,9 @@ static int drawflag(struct item *item, bool highlight) {
 				sprintf(desc, "%s", flag->descr[idx]);
 
 			// Now display the description line according to its horizontal position
-			sprintf(buf + minwidth + 4, "%-*.*s",
-				wWidth(List)-minwidth - 4, wWidth(List)-minwidth - 4,
+			sprintf(buf + minwidth + (hasScope ? 5 : 0), "%-*.*s",
+				wWidth(List)-minwidth - (hasScope ? 5 : 0),
+				wWidth(List)-minwidth - (hasScope ? 5 : 0),
 				strlen(desc) > (size_t)descriptionleft
 					? &desc[descriptionleft]
 					: "");
@@ -399,13 +402,16 @@ static int drawflag(struct item *item, bool highlight) {
 			/* Set correct color set according to highlighting and status*/
 			if(highlight)
 				wattrset(win(List), COLOR_PAIR(3) | A_BOLD | A_REVERSE);
-			else if (flag->item.isGlobal && !flag->pkgs[idx])
-				wattrset(win(List), COLOR_PAIR(5));
 			else
 				wattrset(win(List), COLOR_PAIR(3));
 
 			// Finally put the line on the screen
-			waddstr(win(List), buf);
+			mvwaddstr(win(List), line, 0, buf);
+			// waddstr(win(List), buf);
+			if (hasScope) {
+				mvwaddch(win(List), line, minwidth,     ACS_VLINE);
+				mvwaddch(win(List), line, minwidth + 3, ACS_VLINE);
+			}
 			++line;
 			++idx;
 			++usedY;


^ permalink raw reply related	[flat|nested] 238+ messages in thread
* [gentoo-commits] proj/ufed:master commit in: /
@ 2013-01-23 12:05 Sven Eden
  0 siblings, 0 replies; 238+ messages in thread
From: Sven Eden @ 2013-01-23 12:05 UTC (permalink / raw
  To: gentoo-commits

commit:     f629c855270740437abaf11e046b59cfd1e1710e
Author:     Sven Eden <sven.eden <AT> gmx <DOT> de>
AuthorDate: Tue Jan 22 18:16:44 2013 +0000
Commit:     Sven Eden <sven.eden <AT> gmx <DOT> de>
CommitDate: Tue Jan 22 18:16:44 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/ufed.git;a=commit;h=f629c855

Eventually substituted the constant function pointer dereferences (*drawitem) and (*callback) with real function calls.

---
 ufed-curses.c |   37 +++++++++++++++++++++----------------
 1 files changed, 21 insertions(+), 16 deletions(-)

diff --git a/ufed-curses.c b/ufed-curses.c
index 0ce279d..41b84ea 100644
--- a/ufed-curses.c
+++ b/ufed-curses.c
@@ -38,6 +38,7 @@ extern int lineCountMasked;
 
 
 /* internal prototypes */
+int (*callback)(struct item **, int);
 int (*drawitem)(struct item *, bool);
 void checktermsize();
 void draw();
@@ -170,7 +171,7 @@ void drawitems() {
 
 	for( ; line < wHeight(List); ) {
 		item->currline = line; // drawitem() and maineventloop() need this
-		line += (*drawitem)(item, item == currentitem ? TRUE : FALSE);
+		line += drawitem(item, item == currentitem ? TRUE : FALSE);
 		item = item->next;
 
 		/* Add blank lines if we reached the end of the
@@ -398,6 +399,9 @@ int maineventloop(
 	{ const char *temp = subtitle;
 		subtitle=_subtitle;
 		_subtitle=temp; }
+	{ int(*temp)(struct item **, int) = callback;
+		callback=_callback;
+		_callback=temp; }
 	{ int(*temp)(struct item *, bool) = drawitem;
 		drawitem=_drawitem;
 		_drawitem=temp; }
@@ -452,15 +456,15 @@ int maineventloop(
 						}
 						if(item==NULL)
 							continue;
-						(*drawitem)(currentitem, FALSE);
+						drawitem(currentitem, FALSE);
 						currentitem = item;
 						if(event.bstate & BUTTON1_DOUBLE_CLICKED) {
-							result=(*_callback)(&currentitem, KEY_MOUSE);
+							result=callback(&currentitem, KEY_MOUSE);
 							if(result>=0)
 								goto exit;
 						}
 						scrollcurrent();
-						(*drawitem)(currentitem, TRUE);
+						drawitem(currentitem, TRUE);
 					}
 				} else if(wmouse_trafo(win(Scrollbar), &event.y, &event.x, FALSE)) {
 					// Only do mouse events if there actually is a scrollbar
@@ -554,7 +558,7 @@ int maineventloop(
 		} else
 #endif
 		{
-			result=(*_callback)(&currentitem, c);
+			result=callback(&currentitem, c);
 			if(result>=0)
 				goto exit;
 
@@ -594,12 +598,12 @@ int maineventloop(
 	
 				case KEY_END:
 					if(currentitem->next!=items) {
-						(*drawitem)(currentitem, FALSE);
+						drawitem(currentitem, FALSE);
 						currentitem = items->prev;
 						while (!isLegalItem(currentitem))
 							currentitem = currentitem->prev;
 						scrollcurrent();
-						(*drawitem)(currentitem, TRUE);
+						drawitem(currentitem, TRUE);
 					}
 					break;
 
@@ -644,10 +648,11 @@ int maineventloop(
 		doupdate();
 	}
 exit:
-	subtitle=_subtitle;
-	drawitem=_drawitem;
-	items=_items;
-	keys=_keys;
+	subtitle = _subtitle;
+	callback = _callback;
+	drawitem = _drawitem;
+	items    = _items;
+	keys     = _keys;
 
 	if(items!=NULL) {
 		currentitem = items;
@@ -663,7 +668,7 @@ exit:
  */
 void resetDisplay()
 {
-	(*drawitem)(currentitem, FALSE);
+	drawitem(currentitem, FALSE);
 	currentitem = items;
 	while (!isLegalItem(currentitem))
 		currentitem = currentitem->next;
@@ -694,10 +699,10 @@ void setNextItem(int count, bool strict)
 	} // End of trying to find a next item
 
 	if ( (result && strict) || (!strict && skipped) ) {
-		(*drawitem)(currentitem, FALSE);
+		drawitem(currentitem, FALSE);
 		currentitem = curr;
 		if (!scrollcurrent())
-			(*drawitem)(currentitem, TRUE);
+			drawitem(currentitem, TRUE);
 	}
 }
 
@@ -724,10 +729,10 @@ void setPrevItem(int count, bool strict)
 	} // End of trying to find next item
 
 	if ( (result && strict) || (!strict && skipped) ) {
-		(*drawitem)(currentitem, FALSE);
+		drawitem(currentitem, FALSE);
 		currentitem = curr;
 		if (!scrollcurrent())
-			(*drawitem)(currentitem, TRUE);
+			drawitem(currentitem, TRUE);
 	}
 }
 


^ permalink raw reply related	[flat|nested] 238+ messages in thread
* [gentoo-commits] proj/ufed:master commit in: /
@ 2013-01-23 12:05 Sven Eden
  0 siblings, 0 replies; 238+ messages in thread
From: Sven Eden @ 2013-01-23 12:05 UTC (permalink / raw
  To: gentoo-commits

commit:     673a531ca0855bfb855ca62e82f056b6f5ecd1d6
Author:     Sven Eden <sven.eden <AT> gmx <DOT> de>
AuthorDate: Tue Jan 22 16:23:52 2013 +0000
Commit:     Sven Eden <sven.eden <AT> gmx <DOT> de>
CommitDate: Tue Jan 22 16:23:52 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/ufed.git;a=commit;h=673a531c

topline must be handled as statically in regards of a fixed lines list like the former topy. Flexible line display is done beneath this.

---
 ufed-curses.c |   39 +++++++++++++++++++++------------------
 ufed-curses.h |    2 +-
 2 files changed, 22 insertions(+), 19 deletions(-)

diff --git a/ufed-curses.c b/ufed-curses.c
index 1bb26ca..01f5c7d 100644
--- a/ufed-curses.c
+++ b/ufed-curses.c
@@ -134,10 +134,10 @@ void drawitems(void) {
 	if (!isLegalItem(currentitem)) {
 		while ((currentitem != items) && !isLegalItem(currentitem)) {
 			currentitem = currentitem->prev;
-			topline -= getItemHeight(currentitem);
+			topline -= currentitem->ndescr;
 		}
 		while ((currentitem->next != items) && !isLegalItem(currentitem)) {
-			topline += getItemHeight(currentitem);
+			topline += currentitem->ndescr;
 			currentitem = currentitem->next;
 		}
 	} // End of sanitizing currentitem
@@ -146,8 +146,10 @@ void drawitems(void) {
 	int line = item->listline - topline;
 
 	/* move to the top of the displayed list */
-	for ( ; (item != items) && ((line > 0) || !isLegalItem(item)); line = item->listline - topline)
+	while ((item != items) && (line > 0)) {
 		item = item->prev;
+		line = item->listline - topline;
+	}
 
 	/* If the above move ended up with item == items
 	 * it must be checked whether to move forwards again.
@@ -159,8 +161,9 @@ void drawitems(void) {
 		while (!isLegalItem(item) && (item != items)) {
 			if (currentitem == item)
 				currentitem = item->next;
+			topline += item->ndescr;
 			item = item->next;
-			topline += getItemHeight(item);
+			line = item->listline - topline;
 		}
 	}
 
@@ -330,15 +333,16 @@ static void draw(void) {
 	wrefresh(win(List));
 }
 
-void scrollcurrent(void) {
+bool scrollcurrent(void) {
 	if(currentitem->listline < topline)
 		topline = max(currentitem->listline, currentitem->listline + currentitem->ndescr - wHeight(List));
 	else if( (currentitem->listline + currentitem->ndescr) > (topline + wHeight(List)))
 		topline = min(currentitem->listline + currentitem->ndescr - wHeight(List), currentitem->listline);
 	else
-		return;
+		return false;
 	drawitems();
 	drawscrollbar();
+	return true;
 }
 
 bool yesno(const char *prompt) {
@@ -554,20 +558,19 @@ int maineventloop(
 
 			switch(c) {
 				case KEY_UP:
-					if(currentitem->listline < topline ) {
-						(*drawitem)(currentitem, FALSE);
-						topline--;
-						(*drawitem)(currentitem, TRUE);
+					if(currentitem->currline < 0 ) {
+						--topline;
+						drawitems();
+						drawscrollbar();
 					} else
 						setPrevItem(1, true);
 					break;
 	
 				case KEY_DOWN:
-					if( (currentitem->listline + currentitem->ndescr) > (topline + wHeight(List)) ) {
-						// Scroll through descriptions if their list is longer than the window
-						(*drawitem)(currentitem, FALSE);
+					if( (currentitem->currline + getItemHeight(currentitem)) > wHeight(List) ) {
 						++topline;
-						(*drawitem)(currentitem, TRUE);
+						drawitems();
+						drawscrollbar();
 					} else
 						setNextItem(1, true);
 					break;
@@ -691,8 +694,8 @@ void setNextItem(int count, bool strict)
 	if ( (result && strict) || (!strict && skipped) ) {
 		(*drawitem)(currentitem, FALSE);
 		currentitem = curr;
-		scrollcurrent();
-		(*drawitem)(currentitem, TRUE);
+		if (!scrollcurrent())
+			(*drawitem)(currentitem, TRUE);
 	}
 }
 
@@ -721,8 +724,8 @@ void setPrevItem(int count, bool strict)
 	if ( (result && strict) || (!strict && skipped) ) {
 		(*drawitem)(currentitem, FALSE);
 		currentitem = curr;
-		scrollcurrent();
-		(*drawitem)(currentitem, TRUE);
+		if (!scrollcurrent())
+			(*drawitem)(currentitem, TRUE);
 	}
 }
 

diff --git a/ufed-curses.h b/ufed-curses.h
index 71a4b18..a48dad1 100644
--- a/ufed-curses.h
+++ b/ufed-curses.h
@@ -68,7 +68,7 @@ int maineventloop(
 	struct item *items,
 	const struct key *keys);
 void drawitems(void);
-void scrollcurrent(void);
+bool scrollcurrent(void);
 bool yesno(const char *);
 
 


^ permalink raw reply related	[flat|nested] 238+ messages in thread
* [gentoo-commits] proj/ufed:master commit in: /
@ 2013-01-23 12:05 Sven Eden
  0 siblings, 0 replies; 238+ messages in thread
From: Sven Eden @ 2013-01-23 12:05 UTC (permalink / raw
  To: gentoo-commits

commit:     d45d3cc0603ad17f576f6cb182b4a8d32c947a4a
Author:     Sven Eden <sven.eden <AT> gmx <DOT> de>
AuthorDate: Tue Jan 22 16:21:42 2013 +0000
Commit:     Sven Eden <sven.eden <AT> gmx <DOT> de>
CommitDate: Tue Jan 22 16:21:42 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/ufed.git;a=commit;h=d45d3cc0

Skipped description lines from flags reaching into the display must still be counted as used, or showitems() will restart the display with the next flag.

---
 ufed-curses-checklist.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/ufed-curses-checklist.c b/ufed-curses-checklist.c
index ae2a3e3..1df84b3 100644
--- a/ufed-curses-checklist.c
+++ b/ufed-curses-checklist.c
@@ -326,8 +326,9 @@ static int drawflag(struct item *item, bool highlight) {
 	 */
 	if (line < 0) {
 		if (-line < getItemHeight(&flag->item)) {
-			idx  = -line;
-			line = 0;
+			idx   = -line;
+			line  = 0;
+			usedY = idx;
 		} else
 			// Otherwise this item is out of the display area
 			return 0;


^ permalink raw reply related	[flat|nested] 238+ messages in thread
* [gentoo-commits] proj/ufed:master commit in: /
@ 2013-01-23 12:05 Sven Eden
  0 siblings, 0 replies; 238+ messages in thread
From: Sven Eden @ 2013-01-23 12:05 UTC (permalink / raw
  To: gentoo-commits

commit:     289cbff40db1e31920c3f06f518d416b8b13d223
Author:     Sven Eden <sven.eden <AT> gmx <DOT> de>
AuthorDate: Tue Jan 22 18:04:03 2013 +0000
Commit:     Sven Eden <sven.eden <AT> gmx <DOT> de>
CommitDate: Tue Jan 22 18:04:03 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/ufed.git;a=commit;h=289cbff4

Re-add masked flags to normal flag list, re-sorting them in alphabetically to fix certain searching issues.

---
 ufed.pl.in |   30 ++++++++----------------------
 1 files changed, 8 insertions(+), 22 deletions(-)

diff --git a/ufed.pl.in b/ufed.pl.in
index d1bd669..9b072b7 100644
--- a/ufed.pl.in
+++ b/ufed.pl.in
@@ -18,7 +18,6 @@ my $interface = 'ufed-curses';
 #              . " XX_libexecdir@/ufed-curses 2>/tmp/ufed_memcheck.log";
 
 my %use_descriptions;
-my %masked_descriptions;
 
 sub finalise;
 sub flags_dialog;
@@ -53,15 +52,15 @@ for my $flag (keys %Portage::use_masked_flags) {
 	}
 	if($masked) {
 		if (defined($use_descriptions{$flag})) {
-			@{$masked_descriptions{$flag}} = @{$use_descriptions{$flag}};
-			for (my $i = 0; $i < scalar @{$masked_descriptions{$flag}}; ++$i) {
-				$masked_descriptions{$flag}->[$i] =~ s/ [lg]$/ m/ ;
-				$masked_descriptions{$flag}->[$i] =~ s/ L$/ M/ ;
+			for (my $i = 0; $i < scalar @{$use_descriptions{$flag}}; ++$i) {
+				$use_descriptions{$flag}->[$i] =~ s/ [lg]$/ m/ ;
+				$use_descriptions{$flag}->[$i] =~ s/ L$/ M/ ;
 			}
+		} else {
+			delete $use_descriptions{$flag};
+			delete $Portage::default_flags{$flag};
+			delete $Portage::all_flags{$flag};
 		}
-		delete $use_descriptions{$flag};
-		delete $Portage::default_flags{$flag};
-		delete $Portage::all_flags{$flag};
 	}
 }
 
@@ -111,20 +110,7 @@ sub flags_dialog {
 	POSIX::close $owrite;
 	my $outTxt = "";
 
-	# Write masked flags first so they sort at the beginning of the list
-	for my $flag (sort { uc $a cmp uc $b } keys %masked_descriptions) {
-		$outTxt .= sprintf ("%s %s (%s%s) %d\n", $flag,
-					defined($Portage::make_conf_flags{$flag})
-						? $Portage::make_conf_flags{$flag} ? 'on' : 'off' : 'def',
-					exists($Portage::make_defaults_flags{$flag})
-						? $Portage::make_defaults_flags{$flag} ? '+' : '-' : ' ',
-					exists($Portage::make_conf_flags{$flag})
-						? $Portage::make_conf_flags{$flag}     ? '+' : '-' : ' ',
-					scalar @{$masked_descriptions{$flag}} );
-		$outTxt .= sprintf ("%s\n", $_) for(@{$masked_descriptions{$flag}});
-	}
-
-	# Then write regular flags
+	# Write out flags 
 	for my $flag (sort { uc $a cmp uc $b } keys %use_descriptions) {
 		$outTxt .= sprintf ("%s %s (%s%s) %d\n", $flag,
 					defined($Portage::make_conf_flags{$flag})


^ permalink raw reply related	[flat|nested] 238+ messages in thread
* [gentoo-commits] proj/ufed:master commit in: /
@ 2013-01-23 12:05 Sven Eden
  0 siblings, 0 replies; 238+ messages in thread
From: Sven Eden @ 2013-01-23 12:05 UTC (permalink / raw
  To: gentoo-commits

commit:     23f8640b5cb3f8b6058b7e7f49a74453adae2b86
Author:     Sven Eden <sven.eden <AT> gmx <DOT> de>
AuthorDate: Tue Jan 22 18:04:30 2013 +0000
Commit:     Sven Eden <sven.eden <AT> gmx <DOT> de>
CommitDate: Tue Jan 22 18:04:30 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/ufed.git;a=commit;h=23f8640b

Fix scrollbar

---
 ufed-curses-checklist.c |    7 ++++++-
 ufed-curses.c           |   26 ++++++++++++++------------
 2 files changed, 20 insertions(+), 13 deletions(-)

diff --git a/ufed-curses-checklist.c b/ufed-curses-checklist.c
index 1df84b3..4518375 100644
--- a/ufed-curses-checklist.c
+++ b/ufed-curses-checklist.c
@@ -61,7 +61,7 @@ int lineCountLocalInstalled;
 int lineCountMasked;
 int lineCountMaskedInstalled;
 int lineCountMasked;
-extern int minwidth;
+extern int bottomline, minwidth;
 
 /* static functions */
 static char *getline(FILE *fp) {
@@ -272,11 +272,16 @@ static void read_flags(void) {
 			flags->item.prev = (struct item *) flag;
 		}
 	} // loop while input given
+
 	fclose(input);
+
 	if(flags==NULL) {
 		fputs("No input!\n", stderr);
 		exit(-1);
 	}
+
+	// Save the last line, it is needed in several places
+	bottomline = lineNum;
 }
 
 static void free_flags(void) {

diff --git a/ufed-curses.c b/ufed-curses.c
index 01f5c7d..0ce279d 100644
--- a/ufed-curses.c
+++ b/ufed-curses.c
@@ -25,7 +25,7 @@ static struct item *items, *currentitem;
 
 
 /* external members */
-int topline, minwidth;
+int topline, bottomline, minwidth;
 extern enum mask showMasked;
 extern enum order pkgOrder;
 extern enum scope showScope;
@@ -38,7 +38,10 @@ extern int lineCountMasked;
 
 
 /* internal prototypes */
-static void checktermsize(void);
+int (*drawitem)(struct item *, bool);
+void checktermsize();
+void draw();
+void drawscrollbar();
 int  getListHeight();
 void resetDisplay();
 void setNextItem(int count, bool strict);
@@ -79,7 +82,7 @@ int getListHeight()
 }
 
 
-void initcurses(void) {
+void initcurses() {
 	setlocale(LC_CTYPE, "");
 	initscr();
 	start_color();
@@ -100,14 +103,14 @@ void initcurses(void) {
 	} }
 }
 
-void cursesdone(void) {
+void cursesdone() {
 	enum win w;
 	for(w = (enum win) 0; w != wCount; w++)
 		delwin(window[w].win);
 	endwin();
 }
 
-static void checktermsize(void) {
+void checktermsize() {
 	while(wHeight(List) < 1
 	   || wWidth(List)  < minwidth) {
 #ifdef KEY_RESIZE
@@ -123,9 +126,7 @@ static void checktermsize(void) {
 	}
 }
 
-static int (*drawitem)(struct item *, bool);
-
-void drawitems(void) {
+void drawitems() {
 	/* sanitize currentitem first.
 	 * This is needed, because the currently selected
 	 * item may become invalid when a filter is
@@ -189,7 +190,7 @@ void drawitems(void) {
 	wnoutrefresh(win(List));
 }
 
-static void drawscrollbar(void) {
+void drawscrollbar() {
 	WINDOW *w = win(Scrollbar);
 	wattrset(w, COLOR_PAIR(3) | A_BOLD);
 	mvwaddch(w, 0, 0, ACS_UARROW);
@@ -203,8 +204,9 @@ static void drawscrollbar(void) {
 	// Only show a scrollbar if the list is actually longer than can be displayed:
 	if (listHeight > wHeight(List)) {
 		int sbHeight = wHeight(Scrollbar) - 3;
-		int barStart = 1 + (sbHeight / listHeight);
+		int barStart = 1 + (currentitem->listline * sbHeight / bottomline);
 		int barEnd   = barStart + (sbHeight * wHeight(List) / listHeight);
+
 		for ( ; barStart <= barEnd; ++barStart)
 			mvwaddch(w, barStart, 0, ACS_BLOCK);
 	}
@@ -214,7 +216,7 @@ static void drawscrollbar(void) {
 	wnoutrefresh(w);
 }
 
-static void draw(void) {
+void draw() {
 	size_t bufsize = COLS+1;
 	char buf[bufsize];
 	WINDOW *w;
@@ -333,7 +335,7 @@ static void draw(void) {
 	wrefresh(win(List));
 }
 
-bool scrollcurrent(void) {
+bool scrollcurrent() {
 	if(currentitem->listline < topline)
 		topline = max(currentitem->listline, currentitem->listline + currentitem->ndescr - wHeight(List));
 	else if( (currentitem->listline + currentitem->ndescr) > (topline + wHeight(List)))


^ permalink raw reply related	[flat|nested] 238+ messages in thread
* [gentoo-commits] proj/ufed:master commit in: /
@ 2013-01-23 12:05 Sven Eden
  0 siblings, 0 replies; 238+ messages in thread
From: Sven Eden @ 2013-01-23 12:05 UTC (permalink / raw
  To: gentoo-commits

commit:     ffa22db238235c70dc4c7cd12434ec78d39ed01e
Author:     Sven Eden <sven.eden <AT> gmx <DOT> de>
AuthorDate: Mon Jan 21 21:23:25 2013 +0000
Commit:     Sven Eden <sven.eden <AT> gmx <DOT> de>
CommitDate: Mon Jan 21 21:23:25 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/ufed.git;a=commit;h=ffa22db2

Rewrote the core displaying routines to use the static list of lines
for the general organization, but determine the real display line
number of each displayed flag in a flexible way.
Variable line counts of flags with multiple descriptions are not
scrolling correctly, yet. This has to be fixed.
Once fully functional, the new drawing allows a much easier filtering
of the displayed flags. It will no longer be neccessary to have the
masked flags being at the front of the list.

---
 ufed-curses-checklist.c |   97 +++++++++++++-------
 ufed-curses-help.c      |   10 +-
 ufed-curses.c           |  229 ++++++++++++++++++++++++++++-------------------
 ufed-curses.h           |    5 +-
 4 files changed, 207 insertions(+), 134 deletions(-)

diff --git a/ufed-curses-checklist.c b/ufed-curses-checklist.c
index 11de724..ae2a3e3 100644
--- a/ufed-curses-checklist.c
+++ b/ufed-curses-checklist.c
@@ -55,8 +55,13 @@ static void free_flags(void);
 enum mask  showMasked = show_unmasked; //!< Set whether to show masked, unmasked or both flags
 enum order pkgOrder   = pkgs_left;     //!< Set whether to display package lists left or right of the description
 enum scope showScope  = show_all;      //!< Set whether global, local or all flags are shown
-int firstNormalY      = -1;            //!< y of first not masked flag
-extern int topy, minwidth;
+int lineCountGlobal;
+int lineCountLocal;
+int lineCountLocalInstalled;
+int lineCountMasked;
+int lineCountMaskedInstalled;
+int lineCountMasked;
+extern int minwidth;
 
 /* static functions */
 static char *getline(FILE *fp) {
@@ -99,14 +104,22 @@ static char *getline(FILE *fp) {
 }
 
 static void read_flags(void) {
-	FILE *input = fdopen(3, "r");
-	int   y     = 0;
-	char *line  = NULL;
+	FILE *input   = fdopen(3, "r");
+	int   lineNum = 0;
+	char *line    = NULL;
 
 	if(input == NULL)
 		ERROR_EXIT(-1, "fdopen failed with error %d\n", errno);
 	atexit(&free_flags);
 
+	// Initialize line count per type:
+	lineCountGlobal          = 0;
+	lineCountLocal           = 0;
+	lineCountLocalInstalled  = 0;
+	lineCountMasked          = 0;
+	lineCountMaskedInstalled = 0;
+	lineCountMasked          = 0;
+
 	for(;;) {
 		struct {
 			int start, end;
@@ -144,7 +157,8 @@ static void read_flags(void) {
 			ERROR_EXIT(-1, "Can not allocate %lu bytes for descr array\n", ndescr * sizeof(char*));
 
 		/* note position and name of the flag */
-		flag->item.top = y;
+		flag->item.listline = lineNum;
+		flag->item.currline = 0;
 
 		if(name.end - name.start + 11 > minwidth)
 			minwidth = name.end - name.start + 11;
@@ -167,7 +181,7 @@ static void read_flags(void) {
 		strncpy(flag->state, &line[state.start], 4);
 
 		/* check and set flag item height */
-		flag->item.height = ndescr;
+		flag->item.ndescr = ndescr;
 
 		/* read description(s) and determine flag status */
 		flag->item.isMasked    = false;
@@ -196,16 +210,26 @@ static void read_flags(void) {
 
 			// Set general state of the flag
 			flag->isInstalled[i] = false;
-			if ('g' == descState)
+			if ('g' == descState) {
 				flag->item.isGlobal  = true;
-			else if ('L' == descState)
+				++lineCountGlobal;
+			}
+			else if ('l' == descState) {
+				++lineCountLocal;
+			}
+			else if ('L' == descState) {
 				flag->isInstalled[i] = true;
+				++lineCountLocalInstalled;
+			}
 			else if ('M' == descState) {
 				flag->item.isMasked  = true;
 				flag->isInstalled[i] = true;
+				++lineCountMaskedInstalled;
 			}
-			else if ('m' == descState)
+			else if ('m' == descState) {
 				flag->item.isMasked = true;
+				++lineCountMasked;
+			}
 
 			// Save packages
 			if (pkgs.start > -1) {
@@ -231,13 +255,10 @@ static void read_flags(void) {
 			size_t fullWidth = 1 + strlen(flag->descr[i]) + (flag->pkgs[i] ? strlen(flag->pkgs[i] + 3) : 0);
 			if (fullWidth > maxDescWidth)
 				maxDescWidth = fullWidth;
-		} // loop through description lines
 
-		/* record first not masked y if not done, yet */
-		if (firstNormalY < 0 && !flag->item.isMasked)
-			firstNormalY = flag->item.top;
-
-		y += ndescr;
+			// Advance lineNum
+			++lineNum;
+		} // loop through description lines
 
 		/* Save flag in our linked list */
 		if(flags==NULL) {
@@ -266,7 +287,7 @@ static void free_flags(void) {
 		flag->item.prev->next = NULL;
 		do {
 			void *p = flag;
-			for (int i = 0; i < flag->item.height; ++i) {
+			for (int i = 0; i < flag->item.ndescr; ++i) {
 				if (flag->pkgs[i])  free(flag->pkgs[i]);
 				if (flag->descr[i]) free(flag->descr[i]);
 			}
@@ -290,12 +311,12 @@ static int drawflag(struct item *item, bool highlight) {
 	struct flag *flag = (struct flag *) item;
 	char buf[wWidth(List)+1];
 	char desc[maxDescWidth];
-	int y = flag->item.top - topy;
-	int idx = 0;
+	int idx   = 0;
 	int usedY = 0;
+	int line  = flag->item.currline;
 
 	// Return early if there is nothing to display:
-	if (!isLegalItem(item))
+	if (!isLegalItem(&flag->item))
 		return 0;
 
 	/* Determine with which description to start.
@@ -303,11 +324,16 @@ static int drawflag(struct item *item, bool highlight) {
 	 * and therefore must be scrolled instead of the flags
 	 * themselves.
 	 */
-	if(y < 0 && (-y < flag->item.height)) {
-		idx = -y;
-		y   = 0;
+	if (line < 0) {
+		if (-line < getItemHeight(&flag->item)) {
+			idx  = -line;
+			line = 0;
+		} else
+			// Otherwise this item is out of the display area
+			return 0;
 	}
-	wmove(win(List), y, 0);
+
+	wmove(win(List), line, 0);
 
 	/* print the selection, name and state of the flag */
 	sprintf(buf, " %c%c%c %s%s%s%-*s %-4.4s ",
@@ -328,7 +354,7 @@ static int drawflag(struct item *item, bool highlight) {
 	/* print descriptions according to filters
 	 * TODO: Implement installed/all filters
 	 */
-	if(idx < flag->item.height) {
+	if(idx < flag->item.ndescr) {
 		for(;;) {
 			// Filter global description if it is not wanted:
 			if (!idx && (show_local == showScope) && flag->item.isGlobal) {
@@ -374,10 +400,10 @@ static int drawflag(struct item *item, bool highlight) {
 
 			// Finally put the line on the screen
 			waddstr(win(List), buf);
-			y++;
-			idx++;
-			usedY++;
-			if((idx < flag->item.height) && (y < wHeight(List)) ) {
+			++line;
+			++idx;
+			++usedY;
+			if((idx < flag->item.ndescr) && (line < wHeight(List)) ) {
 				char *p;
 				for(p = buf; p != buf + minwidth; p++)
 					*p = ' ';
@@ -391,7 +417,7 @@ static int drawflag(struct item *item, bool highlight) {
 		waddstr(win(List), buf);
 	}
 	if(highlight)
-		wmove(win(List), max(flag->item.top - topy, 0), 2);
+		wmove(win(List), max(flag->item.currline, 0), 2);
 	wnoutrefresh(win(List));
 	return usedY;
 }
@@ -472,7 +498,7 @@ static int callback(struct item **currentitem, int key) {
 			mvwaddstr(win(Input), 0, 0, fayt);
 			whline(win(Input), ' ', 2);
 			if(n==0) {
-				wmove(win(List), (*currentitem)->top-topy, 2);
+				wmove(win(List), (*currentitem)->currline, 2);
 				wnoutrefresh(win(Input));
 				wrefresh(win(List));
 			} else {
@@ -508,7 +534,7 @@ static int callback(struct item **currentitem, int key) {
 		}
 		if (*currentitem != &flags->item) {
 			drawflag(*currentitem, TRUE);
-			wmove(win(List), (*currentitem)->top-topy, 2);
+			wmove(win(List), (*currentitem)->currline, 2);
 			wrefresh(win(List));
 		} else {
 			drawitems();
@@ -519,13 +545,13 @@ static int callback(struct item **currentitem, int key) {
 		if(descriptionleft>0)
 			descriptionleft--;
 		drawflag(*currentitem, TRUE);
-		wmove(win(List), (*currentitem)->top-topy, 2);
+		wmove(win(List), (*currentitem)->currline, 2);
 		wrefresh(win(List));
 		break;
 	case KEY_RIGHT:
 		descriptionleft++;
 		drawflag(*currentitem, TRUE);
-		wmove(win(List), (*currentitem)->top-topy, 2);
+		wmove(win(List), (*currentitem)->currline, 2);
 		wrefresh(win(List));
 		break;
 #ifdef NCURSES_MOUSE_VERSION
@@ -547,7 +573,7 @@ static int callback(struct item **currentitem, int key) {
 		}
 		if (*currentitem != &flags->item) {
 			drawflag(*currentitem, TRUE);
-			wmove(win(List), (*currentitem)->top-topy, 2);
+			wmove(win(List), (*currentitem)->currline, 2);
 			wrefresh(win(List));
 		} else {
 			drawitems();
@@ -600,3 +626,4 @@ int main(void) {
 
 	return result;
 }
+

diff --git a/ufed-curses-help.c b/ufed-curses-help.c
index fff79f5..5a12712 100644
--- a/ufed-curses-help.c
+++ b/ufed-curses-help.c
@@ -11,7 +11,7 @@
 #include <strings.h>
 #include <unistd.h>
 
-extern int topy;
+extern int topline;
 
 static struct line {
 	struct item item;
@@ -123,8 +123,8 @@ static void init_lines(void) {
 			lines->item.prev->next = (struct item *) line;
 			lines->item.prev = (struct item *) line;
 		}
-		line->item.top = y++;
-		line->item.height = 1;
+		line->item.listline = y++;
+		line->item.ndescr = 1;
 		n = strlen(word);
 		if(n > helpwidth-1) {
 			for(n = helpwidth-1; word[n]!=' '; n--) {
@@ -180,9 +180,9 @@ static int drawline(struct item *item, bool highlight) {
 		wattrset(win(List), COLOR_PAIR(3));
 	else
 		wattrset(win(List), COLOR_PAIR(3) | A_BOLD | A_REVERSE);
-	mvwaddstr(win(List), line->item.top-topy, 0, buf);
+	mvwaddstr(win(List), line->item.currline, 0, buf);
 	if(highlight)
-		wmove(win(List), line->item.top-topy, 0);
+		wmove(win(List), line->item.currline, 0);
 	wnoutrefresh(win(List));
 	return 1;
 }

diff --git a/ufed-curses.c b/ufed-curses.c
index 1e9b232..1bb26ca 100644
--- a/ufed-curses.c
+++ b/ufed-curses.c
@@ -25,21 +25,60 @@ static struct item *items, *currentitem;
 
 
 /* external members */
-int topy, minwidth;
+int topline, minwidth;
 extern enum mask showMasked;
 extern enum order pkgOrder;
 extern enum scope showScope;
-extern int firstNormalY;
+extern int lineCountGlobal;
+extern int lineCountLocal;
+extern int lineCountLocalInstalled;
+extern int lineCountMasked;
+extern int lineCountMaskedInstalled;
+extern int lineCountMasked;
 
 
 /* internal prototypes */
 static void checktermsize(void);
+int  getListHeight();
 void resetDisplay();
 void setNextItem(int count, bool strict);
 void setPrevItem(int count, bool strict);
 
 
 /* internal functions */
+/** @brief return the number of lines the full item display needs
+**/
+int getItemHeight(struct item *item)
+{
+	// TODO : Add filtering and possible line break
+	return item->ndescr;
+}
+
+
+/** @brief get the sum of lines the list holds respecting current filtering
+**/
+int getListHeight()
+{
+	int result = 0;
+
+	if (show_unmasked != showMasked) {
+		// TODO : add installed/not installed filter
+		result += lineCountMasked + lineCountMaskedInstalled;
+	}
+	if (show_masked != showMasked) {
+		if (show_global != showScope) {
+			// TODO : add installed/not installed filter
+			result += lineCountLocal + lineCountLocalInstalled;
+		}
+		if (show_local != showScope) {
+			result += lineCountGlobal;
+		}
+	}
+
+	return result;
+}
+
+
 void initcurses(void) {
 	setlocale(LC_CTYPE, "");
 	initscr();
@@ -87,49 +126,63 @@ static void checktermsize(void) {
 static int (*drawitem)(struct item *, bool);
 
 void drawitems(void) {
+	/* sanitize currentitem first.
+	 * This is needed, because the currently selected
+	 * item may become invalid when a filter is
+	 * toggled.
+	 */
+	if (!isLegalItem(currentitem)) {
+		while ((currentitem != items) && !isLegalItem(currentitem)) {
+			currentitem = currentitem->prev;
+			topline -= getItemHeight(currentitem);
+		}
+		while ((currentitem->next != items) && !isLegalItem(currentitem)) {
+			topline += getItemHeight(currentitem);
+			currentitem = currentitem->next;
+		}
+	} // End of sanitizing currentitem
+
 	struct item *item = currentitem;
-	int y = item->top - topy;
+	int line = item->listline - topline;
 
 	/* move to the top of the displayed list */
-	for ( ; (y > 0) && item; y = item->top - topy)
+	for ( ; (item != items) && ((line > 0) || !isLegalItem(item)); line = item->listline - topline)
 		item = item->prev;
 
-	/* advance in the list if the top item would be a masked
-	 * flag that is to be filtered out.
-	 * This is needed in two situations. First at the very start
-	 * of the program and second whenever the filtering is
-	 * toggled. The latter resets the list position to guarantee
-	 * a valid display.
+	/* If the above move ended up with item == items
+	 * it must be checked whether to move forwards again.
+	 * This can happen if the flag filter is toggled
+	 * and the current item is the first not filtered item.
 	 */
-	if ((show_unmasked == showMasked) && item->isMasked) {
-		while (item && item->isMasked) {
+	if ((item == items) && !isLegalItem(item)) {
+		item = currentitem;
+		while (!isLegalItem(item) && (item != items)) {
 			if (currentitem == item)
 				currentitem = item->next;
-			topy += item->height;
-			item  = item->next;
+			item = item->next;
+			topline += getItemHeight(item);
 		}
 	}
 
-	for(;;) {
-		if(item!=currentitem)
-			y += (*drawitem)(item, FALSE);
-		else
-			y += item->height;
+	for( ; line < wHeight(List); ) {
+		item->currline = line; // drawitem() and maineventloop() need this
+		line += (*drawitem)(item, item == currentitem ? TRUE : FALSE);
 		item = item->next;
-		if(y >= wHeight(List))
-			break;
-		if(item==items) {
+
+		/* Add blank lines if we reached the end of the
+		 * flag list, but not the end of the display.
+		 */
+		if((line < wHeight(List)) && (item == items)) {
 			char buf[wWidth(List)];
 			memset(buf, ' ', wWidth(List));
 			buf[wWidth(List)] = '\0';
-			wmove(win(List), y, 0);
+			wmove(win(List), line, 0);
 			wattrset(win(List), COLOR_PAIR(3));
-			while(y++ < wHeight(List))
+			while(line++ < wHeight(List))
 				waddstr(win(List), buf);
 			break;
 		}
 	}
-	(*drawitem)(currentitem, TRUE);
 	wnoutrefresh(win(List));
 }
 
@@ -142,25 +195,12 @@ static void drawscrollbar(void) {
 	/* The scrollbar location differs related to the
 	 * current filtering of masked flags.
 	 */
-	int bottomY    = items->prev->top + items->prev->height;
-	// Case 1: Masked flags are not displayed (the default)
-	int listHeight = bottomY - firstNormalY;
-	int listTopY   = topy    - firstNormalY;
-	if (show_masked == showMasked) {
-		// Case 2: Only masked flags are displayed
-		listHeight = firstNormalY;
-		listTopY   = topy;
-	}
-	else if (show_both == showMasked) {
-		// case 3: All flags are shown
-		listHeight = bottomY;
-		listTopY   = topy;
-	}
+	int listHeight = getListHeight();
 
 	// Only show a scrollbar if the list is actually longer than can be displayed:
 	if (listHeight > wHeight(List)) {
 		int sbHeight = wHeight(Scrollbar) - 3;
-		int barStart = 1 + (sbHeight * listTopY / listHeight);
+		int barStart = 1 + (sbHeight / listHeight);
 		int barEnd   = barStart + (sbHeight * wHeight(List) / listHeight);
 		for ( ; barStart <= barEnd; ++barStart)
 			mvwaddch(w, barStart, 0, ACS_BLOCK);
@@ -291,10 +331,10 @@ static void draw(void) {
 }
 
 void scrollcurrent(void) {
-	if(currentitem->top < topy)
-		topy = max(currentitem->top, currentitem->top + currentitem->height - wHeight(List));
-	else if( (currentitem->top + currentitem->height) > (topy + wHeight(List)))
-		topy = min(currentitem->top + currentitem->height - wHeight(List), currentitem->top);
+	if(currentitem->listline < topline)
+		topline = max(currentitem->listline, currentitem->listline + currentitem->ndescr - wHeight(List));
+	else if( (currentitem->listline + currentitem->ndescr) > (topline + wHeight(List)))
+		topline = min(currentitem->listline + currentitem->ndescr - wHeight(List), currentitem->listline);
 	else
 		return;
 	drawitems();
@@ -327,7 +367,7 @@ bool yesno(const char *prompt) {
 					window[w].win = newwin(wHeight(w), wWidth(w), wTop(w), wLeft(w));
 				} }
 				/* this won't work for the help viewer, but it doesn't use yesno() */
-				topy = 0;
+				topline = 0;
 				scrollcurrent();
 				draw();
 				wattrset(win(Input), COLOR_PAIR(4) | A_BOLD | A_REVERSE);
@@ -363,7 +403,7 @@ int maineventloop(
 		_keys=temp; }
 
 	currentitem = items;
-	topy = 0;
+	topline = 0;
 
 	draw();
 
@@ -395,14 +435,14 @@ int maineventloop(
 				if(wmouse_trafo(win(List), &event.y, &event.x, FALSE)) {
 					if(event.bstate & (BUTTON1_CLICKED | BUTTON1_DOUBLE_CLICKED)) {
 						struct item *item = currentitem;
-						if(currentitem->top-topy > event.y) {
+						if(currentitem->currline > event.y) {
 							do item = item->prev;
 							while((item==items ? item=NULL, 0 : 1)
-							 && item->top-topy > event.y);
-						} else if(currentitem->top-topy+currentitem->height-1 < event.y) {
+							 && item->currline > event.y);
+						} else if(currentitem->currline + getItemHeight(currentitem) - 1 < event.y) {
 							do item = item->next;
 							while((item->next==items ? item=NULL, 0 : 1)
-							 && item->top-topy+item->height-1 < event.y);
+							 && item->currline + getItemHeight(item) - 1 < event.y);
 						}
 						if(item==NULL)
 							continue;
@@ -417,10 +457,15 @@ int maineventloop(
 						(*drawitem)(currentitem, TRUE);
 					}
 				} else if(wmouse_trafo(win(Scrollbar), &event.y, &event.x, FALSE)) {
-					if( (event.bstate & (BUTTON1_PRESSED | BUTTON1_CLICKED | BUTTON1_DOUBLE_CLICKED))
+					// Only do mouse events if there actually is a scrollbar
+					int listHeight = getListHeight();
+					if( (listHeight > wHeight(List))
+					 && (event.bstate & (BUTTON1_PRESSED | BUTTON1_CLICKED | BUTTON1_DOUBLE_CLICKED))
 					 && (event.y < wHeight(Scrollbar)-1) ) {
+						int sbHeight = wHeight(Scrollbar) - 3;
+						int barStart = 1 + (sbHeight / listHeight);
+						int barEnd   = barStart + (sbHeight * wHeight(List) / listHeight);
 						halfdelay(1);
-
 #define SIM(key) \
 	{ \
 		c = KEY_ ## key; \
@@ -428,50 +473,48 @@ int maineventloop(
 			mousekey = c; \
 		goto check_key; \
 	}
-						if(items->prev->top+items->prev->height > wHeight(List))
-							{}
-						else if(event.y == 0)
+						if(event.y == 0)
 							SIM(UP)
 						else if(event.y == wHeight(Scrollbar)-2)
 							SIM(DOWN)
-						else if(event.y-1 < (wHeight(Scrollbar)-3)*topy/(items->prev->top+items->prev->height-(wHeight(List)-1)))
+						else if( (event.y - 1) < barStart)
 							SIM(PPAGE)
-						else if(event.y-1 > (wHeight(Scrollbar)-3)*topy/(items->prev->top+items->prev->height-(wHeight(List)-1)))
+						else if( (event.y - 1) > barEnd)
 							SIM(NPAGE)
 #undef SIM
-						else
-							if(event.bstate & BUTTON1_PRESSED) {
-								for(;;) {
-									c = getch();
-									switch(c) {
-									case ERR:
-										continue;
-									case KEY_MOUSE:
-										if(getmouse(&event)==OK) {
-											event.y -= wTop(Scrollbar)+1;
-											if(event.y>=0 && event.y<wHeight(Scrollbar)-3) {
-												topy = (event.y*(items->prev->top+items->prev->height-(wHeight(List)-1))+(wHeight(Scrollbar)-4))/(wHeight(Scrollbar)-3);
-												while(currentitem!=items
-												 && currentitem->prev->top >= topy)
-													currentitem = currentitem->prev;
-												while(currentitem->next!=items
-												 && currentitem->top < topy)
-													currentitem = currentitem->next;
-												if(currentitem->top+currentitem->height > topy+wHeight(List))
-													topy = currentitem->top+currentitem->height - wHeight(List);
-												drawitems();
-												drawscrollbar();
-												wrefresh(win(List));
-											}
+						else if(event.bstate & BUTTON1_PRESSED) {
+							for(;;) {
+								c = getch();
+								switch(c) {
+								case ERR:
+									continue;
+								case KEY_MOUSE:
+									if(getmouse(&event)==OK) {
+										event.y -= wTop(Scrollbar) + 1;
+										if( (event.y >= 0) && (event.y < sbHeight) ) {
+											topline = (event.y * (listHeight - sbHeight + 2) + sbHeight - 1) / sbHeight;
+											// was: topy = (event.y*(items->prev->top+items->prev->height-(wHeight(List)-1))+(wHeight(Scrollbar)-4))/(wHeight(Scrollbar)-3);
+											while( (currentitem != items)
+												&& (currentitem->prev->listline >= topline) )
+												currentitem = currentitem->prev;
+											while( (currentitem->next != items)
+												&& (currentitem->listline < topline) )
+												currentitem = currentitem->next;
+											if( (currentitem->listline + currentitem->ndescr) > (topline + wHeight(List)) )
+												topline = currentitem->listline + currentitem->ndescr - wHeight(List);
+											drawitems();
+											drawscrollbar();
+											wrefresh(win(List));
 										}
-										break;
-									default:
-										goto check_key;
 									}
 									break;
+								default:
+									goto check_key;
 								}
+								break;
 							}
-					}
+						} // End of alternate scrollbar event
+					} // End of having a scrollbar
 				} else if(wmouse_trafo(win(Bottom), &event.y, &event.x, FALSE)) {
 					if( (event.bstate & (BUTTON1_CLICKED | BUTTON1_DOUBLE_CLICKED))
 					 && (event.y == 1) ) {
@@ -511,19 +554,19 @@ int maineventloop(
 
 			switch(c) {
 				case KEY_UP:
-					if(currentitem->top < topy ) {
+					if(currentitem->listline < topline ) {
 						(*drawitem)(currentitem, FALSE);
-						topy--;
+						topline--;
 						(*drawitem)(currentitem, TRUE);
 					} else
 						setPrevItem(1, true);
 					break;
 	
 				case KEY_DOWN:
-					if( (currentitem->top + currentitem->height) > (topy + wHeight(List)) ) {
+					if( (currentitem->listline + currentitem->ndescr) > (topline + wHeight(List)) ) {
 						// Scroll through descriptions if their list is longer than the window
 						(*drawitem)(currentitem, FALSE);
-						topy++;
+						++topline;
 						(*drawitem)(currentitem, TRUE);
 					} else
 						setNextItem(1, true);
@@ -584,7 +627,7 @@ int maineventloop(
 						window[w].win = newwin(wHeight(w), wWidth(w), wTop(w), wLeft(w));
 					} }
 					if(result==-1) {
-						topy = 0;
+						topline = 0;
 						scrollcurrent();
 					} else
 						items = currentitem;
@@ -603,7 +646,7 @@ exit:
 
 	if(items!=NULL) {
 		currentitem = items;
-		topy = 0;
+		topline = 0;
 		draw();
 	}
 
@@ -619,7 +662,7 @@ void resetDisplay()
 	currentitem = items;
 	while (!isLegalItem(currentitem))
 		currentitem = currentitem->next;
-	topy = currentitem->top;
+	topline = currentitem->listline;
 	draw();
 }
 
@@ -692,7 +735,7 @@ bool isLegalItem(struct item *item)
 	     ( ( item->isMasked && (show_unmasked != showMasked))
 	    || (!item->isMasked && (show_masked   != showMasked)) )
 	     // 2: Global / Local filter
-	  && ( ( item->isGlobal && ( (show_local  != showScope) || (item->height > 1) ) )
+	  && ( ( item->isGlobal && ( (show_local  != showScope) || (item->ndescr > 1) ) )
 	    || (!item->isGlobal && (  show_global != showScope)) ) )
 		return true;
 	return false;

diff --git a/ufed-curses.h b/ufed-curses.h
index 9633692..71a4b18 100644
--- a/ufed-curses.h
+++ b/ufed-curses.h
@@ -41,7 +41,9 @@ struct window {
 
 struct item {
 	struct item *prev, *next;
-	int top, height;
+	int currline; //!< the current line on the screen this item starts.
+	int listline; //!< the fixed line within the full list this item starts
+	int ndescr;   //!< number of description lines
 	bool isMasked;
 	bool isGlobal;
 };
@@ -55,6 +57,7 @@ struct key {
 
 /* global prototypes */
 void cursesdone(void);
+int  getItemHeight(struct item *item);
 void initcurses(void);
 bool isLegalItem(struct item *item);
 


^ permalink raw reply related	[flat|nested] 238+ messages in thread
* [gentoo-commits] proj/ufed:master commit in: /
@ 2013-01-23 12:05 Sven Eden
  0 siblings, 0 replies; 238+ messages in thread
From: Sven Eden @ 2013-01-23 12:05 UTC (permalink / raw
  To: gentoo-commits

commit:     0ef8034aa3e04a03d2b9af59d423d6990b61f8ac
Author:     Sven Eden <sven.eden <AT> gmx <DOT> de>
AuthorDate: Mon Jan 21 08:52:57 2013 +0000
Commit:     Sven Eden <sven.eden <AT> gmx <DOT> de>
CommitDate: Mon Jan 21 08:52:57 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/ufed.git;a=commit;h=0ef8034a

Cleaned up some prototypes and external references. This is a preapration for later development.

---
 ufed-curses-checklist.c |    2 +-
 ufed-curses-help.c      |    2 ++
 ufed-curses.h           |   24 +++++++++++++-----------
 3 files changed, 16 insertions(+), 12 deletions(-)

diff --git a/ufed-curses-checklist.c b/ufed-curses-checklist.c
index a4f65b8..11de724 100644
--- a/ufed-curses-checklist.c
+++ b/ufed-curses-checklist.c
@@ -56,7 +56,7 @@ enum mask  showMasked = show_unmasked; //!< Set whether to show masked, unmasked
 enum order pkgOrder   = pkgs_left;     //!< Set whether to display package lists left or right of the description
 enum scope showScope  = show_all;      //!< Set whether global, local or all flags are shown
 int firstNormalY      = -1;            //!< y of first not masked flag
-
+extern int topy, minwidth;
 
 /* static functions */
 static char *getline(FILE *fp) {

diff --git a/ufed-curses-help.c b/ufed-curses-help.c
index c967ff6..fff79f5 100644
--- a/ufed-curses-help.c
+++ b/ufed-curses-help.c
@@ -11,6 +11,8 @@
 #include <strings.h>
 #include <unistd.h>
 
+extern int topy;
+
 static struct line {
 	struct item item;
 	char *text;

diff --git a/ufed-curses.h b/ufed-curses.h
index 7a1ca4d..9633692 100644
--- a/ufed-curses.h
+++ b/ufed-curses.h
@@ -5,6 +5,7 @@
 #include <curses.h>
 
 
+/* debugging macros */
 #define DEBUG_EXIT 1
 #undef DEBUG_TRACE
 
@@ -27,6 +28,7 @@
 #endif // DEBUG_TRACE
 
 
+/* global types */
 enum win { Top, Left, List, Input, Scrollbar, Right, Bottom, wCount };
 enum mask { show_unmasked, show_both, show_masked };
 enum order { pkgs_left, pkgs_right };
@@ -50,22 +52,25 @@ struct key {
 	size_t length;
 };
 
-extern struct window window[wCount];
 
-extern void initcurses(void);
-extern void cursesdone(void);
+/* global prototypes */
+void cursesdone(void);
+void initcurses(void);
+bool isLegalItem(struct item *item);
 
-extern int maineventloop(
+int maineventloop(
 	const char *subtitle,
 	int (*callback)(struct item **currentitem, int key),
 	int (*drawitem)(struct item *item, bool highlight),
 	struct item *items,
 	const struct key *keys);
-extern void drawitems(void);
-extern void scrollcurrent(void);
-extern bool yesno(const char *);
-bool isLegalItem(struct item *item);
+void drawitems(void);
+void scrollcurrent(void);
+bool yesno(const char *);
 
+
+/* global inline functions */
+extern struct window window[wCount];
 static inline WINDOW *win(enum win w) { return window[w].win; }
 static inline int wTop   (enum win w) { return (window[w].top   >= 0 ? 0 : LINES) + window[w].top   ; }
 static inline int wLeft  (enum win w) { return (window[w].left  >= 0 ? 0 : COLS ) + window[w].left  ; }
@@ -73,6 +78,3 @@ static inline int wHeight(enum win w) { return (window[w].height > 0 ? 0 : LINES
 static inline int wWidth (enum win w) { return (window[w].width  > 0 ? 0 : COLS ) + window[w].width ; }
 static inline int min(int a, int b) { return a < b ? a : b; }
 static inline int max(int a, int b) { return a > b ? a : b; }
-
-extern int minwidth;
-extern int topy;


^ permalink raw reply related	[flat|nested] 238+ messages in thread
* [gentoo-commits] proj/ufed:master commit in: /
@ 2013-01-23 12:05 Sven Eden
  0 siblings, 0 replies; 238+ messages in thread
From: Sven Eden @ 2013-01-23 12:05 UTC (permalink / raw
  To: gentoo-commits

commit:     4846cc315046a3c90261fd1d73f16f536a9e0120
Author:     Sven Eden <sven.eden <AT> gmx <DOT> de>
AuthorDate: Tue Jan 22 16:22:06 2013 +0000
Commit:     Sven Eden <sven.eden <AT> gmx <DOT> de>
CommitDate: Tue Jan 22 16:22:06 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/ufed.git;a=commit;h=4846cc31

Removed topline, it is not used by the help display.

---
 ufed-curses-help.c |    2 --
 1 files changed, 0 insertions(+), 2 deletions(-)

diff --git a/ufed-curses-help.c b/ufed-curses-help.c
index 5a12712..3803144 100644
--- a/ufed-curses-help.c
+++ b/ufed-curses-help.c
@@ -11,8 +11,6 @@
 #include <strings.h>
 #include <unistd.h>
 
-extern int topline;
-
 static struct line {
 	struct item item;
 	char *text;


^ permalink raw reply related	[flat|nested] 238+ messages in thread
* [gentoo-commits] proj/ufed:master commit in: /
@ 2013-01-23 12:05 Sven Eden
  0 siblings, 0 replies; 238+ messages in thread
From: Sven Eden @ 2013-01-23 12:05 UTC (permalink / raw
  To: gentoo-commits

commit:     876dd7edca1a28acceb95046ce466db0690f60e9
Author:     Sven Eden <sven.eden <AT> gmx <DOT> de>
AuthorDate: Mon Jan 21 08:03:23 2013 +0000
Commit:     Sven Eden <sven.eden <AT> gmx <DOT> de>
CommitDate: Mon Jan 21 08:03:23 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/ufed.git;a=commit;h=876dd7ed

Changed keys display to be more easier to handle. Added convenience methods to set prev/next items to display. Added a method to apply filters. Added a method to reset the display. Optimized filter handling. Prepared the upcoming rewrite of the core display design. (It is not fit to handle filters or wrapped lines.)

---
 ufed-curses-checklist.c |   40 +++++++---
 ufed-curses-help.c      |    3 +-
 ufed-curses.c           |  196 +++++++++++++++++++++++++++++-----------------
 ufed-curses.h           |    6 +-
 4 files changed, 159 insertions(+), 86 deletions(-)

diff --git a/ufed-curses-checklist.c b/ufed-curses-checklist.c
index b0b8ff1..a4f65b8 100644
--- a/ufed-curses-checklist.c
+++ b/ufed-curses-checklist.c
@@ -36,10 +36,12 @@ static const struct key keys[] = {
 	{ '?',      mkKey("Help (?)")            },
 	{ '\n',     mkKey("Save (Return/Enter)") },
 	{ '\033',   mkKey("Cancel (Esc)")        },
-	{ KEY_F(5), mkKey("Toggle (F5: Mask")    },
-	{ KEY_F(6), mkKey("F6: Pkg")             },
-//	{ KEY_F(7), mkKey("F7: Local")           },
-//	{ KEY_F(8), mkKey("F8: Installed)")      },
+	{ -1,       mkKey("Display (")           },
+	{ KEY_F(5), mkKey("Mask (F5)")           },
+	{ KEY_F(6), mkKey("Order (F6)")          },
+//	{ KEY_F(7), mkKey("Local/Global (F7)")   },
+//	{ KEY_F(8), mkKey("Installed (F8)")      },
+	{ -1,       mkKey(")")                   },
 	{ '\0',     mkKey("")                    }
 };
 #undef mkKey
@@ -52,6 +54,7 @@ static void free_flags(void);
 /* external members */
 enum mask  showMasked = show_unmasked; //!< Set whether to show masked, unmasked or both flags
 enum order pkgOrder   = pkgs_left;     //!< Set whether to display package lists left or right of the description
+enum scope showScope  = show_all;      //!< Set whether global, local or all flags are shown
 int firstNormalY      = -1;            //!< y of first not masked flag
 
 
@@ -283,12 +286,17 @@ static void free_flags(void) {
 }
 
 
-static void drawflag(struct item *item, bool highlight) {
+static int drawflag(struct item *item, bool highlight) {
 	struct flag *flag = (struct flag *) item;
 	char buf[wWidth(List)+1];
 	char desc[maxDescWidth];
 	int y = flag->item.top - topy;
 	int idx = 0;
+	int usedY = 0;
+
+	// Return early if there is nothing to display:
+	if (!isLegalItem(item))
+		return 0;
 
 	/* Determine with which description to start.
 	 * Overly long description lists might not fit on one screen,
@@ -318,10 +326,20 @@ static void drawflag(struct item *item, bool highlight) {
 		flag->state);
 
 	/* print descriptions according to filters
-	 * TODO: Implement local/global and installed/all filters
+	 * TODO: Implement installed/all filters
 	 */
 	if(idx < flag->item.height) {
 		for(;;) {
+			// Filter global description if it is not wanted:
+			if (!idx && (show_local == showScope) && flag->item.isGlobal) {
+				++idx;
+				continue;
+			}
+
+			// Break on local descriptions if they are not wanted:
+			if (idx && (show_global == showScope))
+				break;
+
 			// Display flag state
 			sprintf(buf + minwidth, "[%c] ",
 				flag->item.isMasked ? flag->isInstalled[idx] ? 'M' : 'm'
@@ -358,6 +376,7 @@ static void drawflag(struct item *item, bool highlight) {
 			waddstr(win(List), buf);
 			y++;
 			idx++;
+			usedY++;
 			if((idx < flag->item.height) && (y < wHeight(List)) ) {
 				char *p;
 				for(p = buf; p != buf + minwidth; p++)
@@ -374,6 +393,7 @@ static void drawflag(struct item *item, bool highlight) {
 	if(highlight)
 		wmove(win(List), max(flag->item.top - topy, 0), 2);
 	wnoutrefresh(win(List));
+	return usedY;
 }
 
 static int callback(struct item **currentitem, int key) {
@@ -410,14 +430,14 @@ static int callback(struct item **currentitem, int key) {
 			/* if the current flag does not match, search one that does. */
 			else {
 				do item = item->next;
-				while(item!=*currentitem && strncasecmp(((struct flag *) item)->name, fayt, n)!=0);
+				while( (item != *currentitem)
+				    && ( ( strncasecmp(((struct flag *) item)->name, fayt, n)
+				    	|| !isLegalItem(item)) ) );
 
 				/* if there was no match (or the match is filtered),
 				 * update the input area to show that there is no match
 				 */
-				if ( (item == *currentitem)
-					|| ( item->isMasked && (show_unmasked == showMasked))
-					|| (!item->isMasked && (show_masked   == showMasked)) ) {
+				if (item == *currentitem) {
 					if (item != *currentitem)
 						item = *currentitem;
 					wattrset(win(Input), COLOR_PAIR(4) | A_BOLD | A_REVERSE);

diff --git a/ufed-curses-help.c b/ufed-curses-help.c
index 79bd35e..c967ff6 100644
--- a/ufed-curses-help.c
+++ b/ufed-curses-help.c
@@ -170,7 +170,7 @@ static const struct key keys[] = {
 #undef key
 };
 
-static void drawline(struct item *item, bool highlight) {
+static int drawline(struct item *item, bool highlight) {
 	struct line *line = (struct line *) item;
 	char buf[wWidth(List)+1];
 	sprintf(buf, "%-*.*s", wWidth(List), wWidth(List), line->text);
@@ -182,6 +182,7 @@ static void drawline(struct item *item, bool highlight) {
 	if(highlight)
 		wmove(win(List), line->item.top-topy, 0);
 	wnoutrefresh(win(List));
+	return 1;
 }
 
 static int callback(struct item **currentitem, int key) {

diff --git a/ufed-curses.c b/ufed-curses.c
index 63797e9..1e9b232 100644
--- a/ufed-curses.c
+++ b/ufed-curses.c
@@ -28,10 +28,15 @@ static struct item *items, *currentitem;
 int topy, minwidth;
 extern enum mask showMasked;
 extern enum order pkgOrder;
+extern enum scope showScope;
 extern int firstNormalY;
 
+
 /* internal prototypes */
 static void checktermsize(void);
+void resetDisplay();
+void setNextItem(int count, bool strict);
+void setPrevItem(int count, bool strict);
 
 
 /* internal functions */
@@ -79,7 +84,7 @@ static void checktermsize(void) {
 	}
 }
 
-static void (*drawitem)(struct item *, bool);
+static int (*drawitem)(struct item *, bool);
 
 void drawitems(void) {
 	struct item *item = currentitem;
@@ -107,8 +112,9 @@ void drawitems(void) {
 
 	for(;;) {
 		if(item!=currentitem)
-			(*drawitem)(item, FALSE);
-		y += item->height;
+			y += (*drawitem)(item, FALSE);
+		else
+			y += item->height;
 		item = item->next;
 		if(y >= wHeight(List))
 			break;
@@ -338,7 +344,7 @@ bool yesno(const char *prompt) {
 int maineventloop(
 		const char *_subtitle,
 		int(*_callback)(struct item **, int),
-		void(*_drawitem)(struct item *, bool),
+		int(*_drawitem)(struct item *, bool),
 		struct item *_items,
 		const struct key *_keys) {
 	int result;
@@ -346,7 +352,7 @@ int maineventloop(
 	{ const char *temp = subtitle;
 		subtitle=_subtitle;
 		_subtitle=temp; }
-	{ void(*temp)(struct item *, bool) = drawitem;
+	{ int(*temp)(struct item *, bool) = drawitem;
 		drawitem=_drawitem;
 		_drawitem=temp; }
 	{ struct item *temp=items;
@@ -475,7 +481,7 @@ int maineventloop(
 							continue;
 						x -= 2;
 						for(key = keys; key->key!='\0'; key++) {
-							if((size_t)x < key->length) {
+							if( (key->key > 0) && ((size_t)x < key->length)) {
 								event.x -= x;
 								wattrset(win(Bottom), COLOR_PAIR(3) | A_BOLD | A_REVERSE);
 								mvwaddstr(win(Bottom), event.y, event.x, key->descr);
@@ -509,83 +515,41 @@ int maineventloop(
 						(*drawitem)(currentitem, FALSE);
 						topy--;
 						(*drawitem)(currentitem, TRUE);
-					} else if( (currentitem!=items || topy>currentitem->top)
-							&& (	!currentitem->prev->isMasked
-								||	(show_unmasked != showMasked)) ) {
-						(*drawitem)(currentitem, FALSE);
-						currentitem = currentitem->prev;
-						scrollcurrent();
-						(*drawitem)(currentitem, TRUE);
-					}
+					} else
+						setPrevItem(1, true);
 					break;
 	
 				case KEY_DOWN:
 					if( (currentitem->top + currentitem->height) > (topy + wHeight(List)) ) {
+						// Scroll through descriptions if their list is longer than the window
 						(*drawitem)(currentitem, FALSE);
 						topy++;
 						(*drawitem)(currentitem, TRUE);
-					} else if( (currentitem->next != items)
-							&& (	currentitem->next->isMasked
-								||	(show_masked != showMasked)) ){
-						(*drawitem)(currentitem, FALSE);
-						currentitem = currentitem->next;
-						scrollcurrent();
-						(*drawitem)(currentitem, TRUE);
-					}
+					} else
+						setNextItem(1, true);
 					break;
 	
 				case KEY_PPAGE:
-					if(currentitem!=items) {
-						struct item *olditem = currentitem;
-						(*drawitem)(currentitem, FALSE);
-						while( (currentitem != items)
-							&& ( (olditem->top - currentitem->prev->top) <= wHeight(List))
-							&& ( (	!currentitem->prev->isMasked
-								||	(show_unmasked != showMasked)) ) ) {
-							currentitem = currentitem->prev;
-						}
-						scrollcurrent();
-						(*drawitem)(currentitem, TRUE);
-					}
+					if(currentitem!=items)
+						setPrevItem(wHeight(List), false);
 					break;
 	
 				case KEY_NPAGE:
-					if(currentitem->next!=items) {
-						struct item *olditem = currentitem;
-						(*drawitem)(currentitem, FALSE);
-						while( (currentitem->next != items)
-							&& (((currentitem->next->top + currentitem->next->height)
-								-(olditem->top + olditem->height) ) <= wHeight(List))
-							&& ( (	currentitem->next->isMasked
-								||	(show_masked != showMasked)) ) ) {
-							currentitem = currentitem->next;
-						}
-						scrollcurrent();
-						(*drawitem)(currentitem, TRUE);
-					}
+					if(currentitem->next!=items)
+						setNextItem(wHeight(List), false);
 					break;
 	
 				case KEY_HOME:
-					if(currentitem!=items) {
-						(*drawitem)(currentitem, FALSE);
-						currentitem = items;
-						if (show_unmasked == showMasked) {
-							while (currentitem->isMasked)
-								currentitem = currentitem->next;
-						}
-						scrollcurrent();
-						(*drawitem)(currentitem, TRUE);
-					}
+					if(currentitem!=items)
+						resetDisplay();
 					break;
 	
 				case KEY_END:
 					if(currentitem->next!=items) {
 						(*drawitem)(currentitem, FALSE);
 						currentitem = items->prev;
-						if (show_masked == showMasked) {
-							while (!currentitem->isMasked)
-								currentitem = currentitem->prev;
-						}
+						while (!isLegalItem(currentitem))
+							currentitem = currentitem->prev;
 						scrollcurrent();
 						(*drawitem)(currentitem, TRUE);
 					}
@@ -595,25 +559,21 @@ int maineventloop(
 					if      (show_masked   == showMasked) showMasked = show_unmasked;
 					else if (show_both     == showMasked) showMasked = show_masked;
 					else if (show_unmasked == showMasked) showMasked = show_both;
-					currentitem = items;
-					topy = 0;
-					draw();
+					resetDisplay();
 					break;
 
 				case KEY_F(6):
 					if (pkgs_left == pkgOrder) pkgOrder = pkgs_right;
 					else                       pkgOrder = pkgs_left;
-					draw();
+					drawitems();
 					break;
 
-				case KEY_BTAB:
-					if      (show_masked   == showMasked) showMasked = show_both;
-					else if (show_both     == showMasked) showMasked = show_unmasked;
-					else if (show_unmasked == showMasked) showMasked = show_masked;
-					currentitem = items;
-					topy = 0;
-					draw();
-					break;
+//				case KEY_F(7):
+//					if      (show_local  == showScope) showScope = show_all;
+//					else if (show_global == showScope) showScope = show_local;
+//					else if (show_all    == showScope) showScope = show_global;
+//					resetDisplay();
+//					break;
 
 #ifdef KEY_RESIZE
 				case KEY_RESIZE:
@@ -649,3 +609,93 @@ exit:
 
 	return result;
 }
+
+
+/* @brief Set display to first legal item and redraw
+ */
+void resetDisplay()
+{
+	(*drawitem)(currentitem, FALSE);
+	currentitem = items;
+	while (!isLegalItem(currentitem))
+		currentitem = currentitem->next;
+	topy = currentitem->top;
+	draw();
+}
+
+
+/* @brief set currentitem to the next item @a count lines away
+ * @param count set how many lines should be skipped
+ * @param strict if set to false, at least one item has to be skipped.
+ */
+void setNextItem(int count, bool strict)
+{
+	bool         result  = true;
+	struct item *curr    = currentitem;
+	int          skipped = 0;
+
+	while (result && (skipped < count)) {
+		if (curr->next == items)
+			result = false; // The list is finished, no next item to display
+		else
+			curr = curr->next;
+
+		// curr is only counted if it is not filtered out:
+		if (isLegalItem(curr))
+			++skipped;
+	} // End of trying to find a next item
+
+	if ( (result && strict) || (!strict && skipped) ) {
+		(*drawitem)(currentitem, FALSE);
+		currentitem = curr;
+		scrollcurrent();
+		(*drawitem)(currentitem, TRUE);
+	}
+}
+
+
+/* @brief set currentitem to the previous item @a count lines away
+ * @param count set how many lines should be skipped
+ * @param strict if set to false, at least one item has to be skipped.
+ */
+void setPrevItem(int count, bool strict)
+{
+	bool         result  = true;
+	struct item *curr    = currentitem;
+	int          skipped = 0;
+
+	while (result && (skipped < count)) {
+		if (curr == items)
+			result = false; // The list is finished, no previous item to display
+		else
+			curr = curr->prev;
+
+		// curr is only counted if it is not filtered out:
+		if (isLegalItem(curr))
+			++skipped;
+	} // End of trying to find next item
+
+	if ( (result && strict) || (!strict && skipped) ) {
+		(*drawitem)(currentitem, FALSE);
+		currentitem = curr;
+		scrollcurrent();
+		(*drawitem)(currentitem, TRUE);
+	}
+}
+
+
+/* @brief return true if the given @a item is not filtered out
+ */
+bool isLegalItem(struct item *item)
+{
+	if ( // 1: Mask filter
+	     ( ( item->isMasked && (show_unmasked != showMasked))
+	    || (!item->isMasked && (show_masked   != showMasked)) )
+	     // 2: Global / Local filter
+	  && ( ( item->isGlobal && ( (show_local  != showScope) || (item->height > 1) ) )
+	    || (!item->isGlobal && (  show_global != showScope)) ) )
+		return true;
+	return false;
+}
+
+

diff --git a/ufed-curses.h b/ufed-curses.h
index a608f33..7a1ca4d 100644
--- a/ufed-curses.h
+++ b/ufed-curses.h
@@ -6,7 +6,7 @@
 
 
 #define DEBUG_EXIT 1
-#define DEBUG_TRACE 1
+#undef DEBUG_TRACE
 
 #if defined(DEBUG_EXIT)
 #  define ERROR_EXIT(code, fmt, ...) { \
@@ -30,6 +30,7 @@
 enum win { Top, Left, List, Input, Scrollbar, Right, Bottom, wCount };
 enum mask { show_unmasked, show_both, show_masked };
 enum order { pkgs_left, pkgs_right };
+enum scope { show_all, show_global, show_local };
 
 struct window {
 	WINDOW *win;
@@ -57,12 +58,13 @@ extern void cursesdone(void);
 extern int maineventloop(
 	const char *subtitle,
 	int (*callback)(struct item **currentitem, int key),
-	void(*drawitem)(struct item *item, bool highlight),
+	int (*drawitem)(struct item *item, bool highlight),
 	struct item *items,
 	const struct key *keys);
 extern void drawitems(void);
 extern void scrollcurrent(void);
 extern bool yesno(const char *);
+bool isLegalItem(struct item *item);
 
 static inline WINDOW *win(enum win w) { return window[w].win; }
 static inline int wTop   (enum win w) { return (window[w].top   >= 0 ? 0 : LINES) + window[w].top   ; }


^ permalink raw reply related	[flat|nested] 238+ messages in thread
* [gentoo-commits] proj/ufed:master commit in: /
@ 2013-01-23 12:05 Sven Eden
  0 siblings, 0 replies; 238+ messages in thread
From: Sven Eden @ 2013-01-23 12:05 UTC (permalink / raw
  To: gentoo-commits

commit:     f6dac0f1edf81203fa1e226fa7c4f5ca5e70f544
Author:     Sven Eden <sven.eden <AT> gmx <DOT> de>
AuthorDate: Sun Jan 20 11:12:18 2013 +0000
Commit:     Sven Eden <sven.eden <AT> gmx <DOT> de>
CommitDate: Sun Jan 20 11:12:18 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/ufed.git;a=commit;h=f6dac0f1

Changed mask toggle key from Tab to F5. Added F6 key to toggle packag list display order (left or right of the description)

---
 ufed-curses-checklist.c |   26 +++++++++++++++++---------
 ufed-curses.c           |    9 ++++++++-
 ufed-curses.h           |    3 ++-
 3 files changed, 27 insertions(+), 11 deletions(-)

diff --git a/ufed-curses-checklist.c b/ufed-curses-checklist.c
index 89d8a4a..b0b8ff1 100644
--- a/ufed-curses-checklist.c
+++ b/ufed-curses-checklist.c
@@ -33,11 +33,14 @@ static char *lineBuf = NULL;
 
 #define mkKey(x) x, sizeof(x)-1
 static const struct key keys[] = {
-	{ '?',    mkKey("Help (?)")            },
-	{ '\n',   mkKey("Save (Return/Enter)") },
-	{ '\033', mkKey("Cancel (Esc)")        },
-	{ '\t',   mkKey("Toggle Masked (Tab)") },
-	{ '\0',   mkKey("")                    }
+	{ '?',      mkKey("Help (?)")            },
+	{ '\n',     mkKey("Save (Return/Enter)") },
+	{ '\033',   mkKey("Cancel (Esc)")        },
+	{ KEY_F(5), mkKey("Toggle (F5: Mask")    },
+	{ KEY_F(6), mkKey("F6: Pkg")             },
+//	{ KEY_F(7), mkKey("F7: Local")           },
+//	{ KEY_F(8), mkKey("F8: Installed)")      },
+	{ '\0',     mkKey("")                    }
 };
 #undef mkKey
 
@@ -47,8 +50,9 @@ static void free_flags(void);
 
 
 /* external members */
-enum mask showMasked = show_unmasked; //!< Set whether to show masked, unmasked or both flags
-int firstNormalY = -1; //!< y of first not masked flag
+enum mask  showMasked = show_unmasked; //!< Set whether to show masked, unmasked or both flags
+enum order pkgOrder   = pkgs_left;     //!< Set whether to display package lists left or right of the description
+int firstNormalY      = -1;            //!< y of first not masked flag
 
 
 /* static functions */
@@ -326,8 +330,12 @@ static void drawflag(struct item *item, bool highlight) {
 
 			// Assemble description line:
 			memset(desc, 0, maxDescWidth * sizeof(char));
-			if (flag->pkgs[idx])
-				sprintf(desc, "(%s) %s", flag->pkgs[idx], flag->descr[idx]);
+			if (flag->pkgs[idx]) {
+				if (pkgs_left == pkgOrder)
+					sprintf(desc, "(%s) %s", flag->pkgs[idx], flag->descr[idx]);
+				else
+					sprintf(desc, "%s (%s)", flag->descr[idx], flag->pkgs[idx]);
+			}
 			else
 				sprintf(desc, "%s", flag->descr[idx]);
 

diff --git a/ufed-curses.c b/ufed-curses.c
index e885d75..63797e9 100644
--- a/ufed-curses.c
+++ b/ufed-curses.c
@@ -27,6 +27,7 @@ static struct item *items, *currentitem;
 /* external members */
 int topy, minwidth;
 extern enum mask showMasked;
+extern enum order pkgOrder;
 extern int firstNormalY;
 
 /* internal prototypes */
@@ -590,7 +591,7 @@ int maineventloop(
 					}
 					break;
 
-				case '\t':
+				case KEY_F(5):
 					if      (show_masked   == showMasked) showMasked = show_unmasked;
 					else if (show_both     == showMasked) showMasked = show_masked;
 					else if (show_unmasked == showMasked) showMasked = show_both;
@@ -599,6 +600,12 @@ int maineventloop(
 					draw();
 					break;
 
+				case KEY_F(6):
+					if (pkgs_left == pkgOrder) pkgOrder = pkgs_right;
+					else                       pkgOrder = pkgs_left;
+					draw();
+					break;
+
 				case KEY_BTAB:
 					if      (show_masked   == showMasked) showMasked = show_both;
 					else if (show_both     == showMasked) showMasked = show_unmasked;

diff --git a/ufed-curses.h b/ufed-curses.h
index bae8847..a608f33 100644
--- a/ufed-curses.h
+++ b/ufed-curses.h
@@ -29,6 +29,7 @@
 
 enum win { Top, Left, List, Input, Scrollbar, Right, Bottom, wCount };
 enum mask { show_unmasked, show_both, show_masked };
+enum order { pkgs_left, pkgs_right };
 
 struct window {
 	WINDOW *win;
@@ -43,7 +44,7 @@ struct item {
 };
 
 struct key {
-	char key;
+	int key;
 	const char *descr;
 	size_t length;
 };


^ permalink raw reply related	[flat|nested] 238+ messages in thread
* [gentoo-commits] proj/ufed:master commit in: /
@ 2013-01-19 21:43 Sven Eden
  0 siblings, 0 replies; 238+ messages in thread
From: Sven Eden @ 2013-01-19 21:43 UTC (permalink / raw
  To: gentoo-commits

commit:     4c71fca78a4ff4afc8d8380c6221acecf58f123a
Author:     Sven Eden <sven.eden <AT> gmx <DOT> de>
AuthorDate: Sat Jan 19 21:44:31 2013 +0000
Commit:     Sven Eden <sven.eden <AT> gmx <DOT> de>
CommitDate: Sat Jan 19 21:44:31 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/ufed.git;a=commit;h=4c71fca7

Fixed several memory leaks. According to valgrind, ufed is now leak free.

---
 ufed-curses-checklist.c |  107 +++++++++++++++++++++++++++--------------------
 1 files changed, 61 insertions(+), 46 deletions(-)

diff --git a/ufed-curses-checklist.c b/ufed-curses-checklist.c
index a2e3c88..89d8a4a 100644
--- a/ufed-curses-checklist.c
+++ b/ufed-curses-checklist.c
@@ -16,7 +16,7 @@ struct flag {
 	struct item item;
 	char *name;
 	char on;
-	char *state;
+	char state[5];
 	bool *isInstalled;
 	char **pkgs;
 	char **descr;
@@ -29,6 +29,7 @@ static int descriptionleft;
 static char *fayt;
 static struct item **faytsave;
 static size_t maxDescWidth = 0;
+static char *lineBuf = NULL;
 
 #define mkKey(x) x, sizeof(x)-1
 static const struct key keys[] = {
@@ -52,35 +53,37 @@ int firstNormalY = -1; //!< y of first not masked flag
 
 /* static functions */
 static char *getline(FILE *fp) {
-	size_t size;
-	char *result;
-
-	size = LINE_MAX;
-	result = malloc(size);
-	if(result == NULL)
-		ERROR_EXIT(-1, "Can not allocate %lu bytes\n", sizeof(char) * size);
-	if(fgets(result, size, fp) == NULL)
+	static size_t size = LINE_MAX;
+
+	if (NULL == lineBuf) {
+		lineBuf = malloc(size);
+		if (NULL == lineBuf)
+			ERROR_EXIT(-1, "Can not allocate %lu bytes for line buffer\n", sizeof(char) * size);
+	}
+
+	if(fgets(lineBuf, size, fp) == NULL)
 		return NULL;
-	{
-		char *p = strchr(result, '\n');
-		if(p!=NULL) {
-			*p++ = '\0';
-			p = realloc(result, p-result);
-			return p ? p : result;
+	else {
+		char *p = strchr(lineBuf, '\n');
+		if(p != NULL) {
+			*p = '\0';
+			return lineBuf;
 		}
 	}
 	for(;;) {
-		result = realloc(result, size+size/2);
-		if(result == NULL)
-			ERROR_EXIT(-1, "Can not reallocate %lu bytes\n", (size_t)(sizeof(char) * size * 1.5));
-		if(fgets(result+size, size/2, fp)==NULL)
+		char *newLine = realloc(lineBuf, size + size / 2);
+		if(newLine == NULL)
+			ERROR_EXIT(-1, "Can not reallocate %lu bytes for line buffer\n",
+				(size_t)(sizeof(char) * size * 1.5));
+		lineBuf = newLine;
+		newLine = NULL;
+		if(fgets(lineBuf + size, size / 2, fp) == NULL)
 			return NULL;
-		{
-			char *p = strchr(result+size, '\n');
-			if(p!=NULL) {
-				*p++ = '\0';
-				p = realloc(result, p-result);
-				return p ? p : result;
+		else {
+			char *p = strchr(lineBuf + size, '\n');
+			if(p != NULL) {
+				*p = '\0';
+				return lineBuf;
 			}
 		}
 		size += size/2;
@@ -90,37 +93,42 @@ static char *getline(FILE *fp) {
 
 static void read_flags(void) {
 	FILE *input = fdopen(3, "r");
-	char *line;
-	int y=0;
+	int   y     = 0;
+	char *line  = NULL;
 
-	if(input==NULL)
+	if(input == NULL)
 		ERROR_EXIT(-1, "fdopen failed with error %d\n", errno);
 	atexit(&free_flags);
+
 	for(;;) {
 		struct {
 			int start, end;
 		} name, on, state, pkgs, desc;
-		int ndescr;
-		struct flag *flag;
-		char descState;
+		int ndescr = 0;
+		struct flag *flag = NULL;
+		char descState = 0;
 
 		line = getline(input);
-		if(line==NULL)
+		if(NULL == line)
 			break;
 		if(sscanf(line, "%n%*s%n %n%*s%n %n(%*[ +-])%n %d",
 				&name.start,  &name.end,
 				&on.start,    &on.end,
 				&state.start, &state.end,
-				&ndescr)!=1)
+				&ndescr) != 1)
 			ERROR_EXIT(-1, "flag sscanf failed on line\n\"%s\"\n", line);
 
 		/* Allocate memory for the struct and the arrays */
 		// struct
-		if (NULL == (flag = (struct flag*)calloc(1, sizeof(struct flag))))
+		if (NULL == (flag = (struct flag*)malloc(sizeof(struct flag))))
 			ERROR_EXIT(-1, "Can not allocate %lu bytes for flag\n", sizeof(struct flag));
 		// isInstalled
 		if (NULL == (flag->isInstalled = (bool*)calloc(ndescr, sizeof(bool))))
 			ERROR_EXIT(-1, "Can not allocate %lu bytes for isInstalled array\n", ndescr * sizeof(bool));
+		// name
+		if (NULL == (flag->name = (char*)calloc(name.end - name.start + 1, sizeof(char))))
+			ERROR_EXIT(-1, "Can not allocate %lu bytes for flag name\n",
+				(name.end - name.start + 1) * sizeof(char));
 		// pkgs
 		if (NULL == (flag->pkgs = (char**)calloc(ndescr, sizeof(char*))))
 			ERROR_EXIT(-1, "Can not allocate %lu bytes for pkg array\n", ndescr * sizeof(char*));
@@ -131,10 +139,9 @@ static void read_flags(void) {
 		/* note position and name of the flag */
 		flag->item.top = y;
 
-		line[name.end] = '\0';
-		if(name.end-name.start+11 > minwidth)
-			minwidth = name.end-name.start+11;
-		flag->name = &line[name.start];
+		if(name.end - name.start + 11 > minwidth)
+			minwidth = name.end - name.start + 11;
+		strncpy(flag->name, &line[name.start], name.end - name.start);
 
 		/* check and save current flag setting from configuration */
 		line[on.end] = '\0';
@@ -148,10 +155,9 @@ static void read_flags(void) {
 			ERROR_EXIT(-1, "flag->on can not be determined with \"%s\"\n", &line[on.start]);
 
 		/* check and set flag state */
-		line[state.end] = '\0';
-		if(state.end-state.start != 4)
-			ERROR_EXIT(-1, "state.end - state.start is %d (must be 4)\n", state.end - state.start);
-		flag->state = &line[state.start];
+		if(state.end - state.start != 4)
+			ERROR_EXIT(-1, "state length is %d (must be 4)\n", state.end - state.start);
+		strncpy(flag->state, &line[state.start], 4);
 
 		/* check and set flag item height */
 		flag->item.height = ndescr;
@@ -162,9 +168,10 @@ static void read_flags(void) {
 		for (int i = 0; i < ndescr; ++i) {
 			pkgs.start = pkgs.end = -1;
 			desc.start = desc.end = -1;
+
 			line = getline(input);
-			if(line == NULL)
-				break;
+			if (!line) break;
+
 			/* There are two possible layouts:
 			 * a: "g [description]" for global flag descriptions and
 			 * b: "x (pkg(s)) [description]" for local flag descriptions
@@ -217,8 +224,6 @@ static void read_flags(void) {
 			size_t fullWidth = 1 + strlen(flag->descr[i]) + (flag->pkgs[i] ? strlen(flag->pkgs[i] + 3) : 0);
 			if (fullWidth > maxDescWidth)
 				maxDescWidth = fullWidth;
-
-			free(line);
 		} // loop through description lines
 
 		/* record first not masked y if not done, yet */
@@ -248,6 +253,8 @@ static void read_flags(void) {
 
 static void free_flags(void) {
 	struct flag *flag = flags;
+
+	// Clear all flags
 	if(flag != NULL) {
 		flag->item.prev->next = NULL;
 		do {
@@ -256,6 +263,7 @@ static void free_flags(void) {
 				if (flag->pkgs[i])  free(flag->pkgs[i]);
 				if (flag->descr[i]) free(flag->descr[i]);
 			}
+			if (flag->name)        free(flag->name);
 			if (flag->isInstalled) free(flag->isInstalled);
 			if (flag->pkgs)        free(flag->pkgs);
 			if (flag->descr)       free(flag->descr);
@@ -264,6 +272,10 @@ static void free_flags(void) {
 		} while(flag != NULL);
 		flags = NULL;
 	}
+
+	// Clear line buffer
+	if (lineBuf)
+		free(lineBuf);
 }
 
 
@@ -555,5 +567,8 @@ int main(void) {
 		fclose(output);
 	}
 
+	if (fayt)     free(fayt);
+	if (faytsave) free(faytsave);
+
 	return result;
 }


^ permalink raw reply related	[flat|nested] 238+ messages in thread
* [gentoo-commits] proj/ufed:master commit in: /
@ 2013-01-19 21:43 Sven Eden
  0 siblings, 0 replies; 238+ messages in thread
From: Sven Eden @ 2013-01-19 21:43 UTC (permalink / raw
  To: gentoo-commits

commit:     bfa25f47aceb07f59a982819841a781b86334df9
Author:     Sven Eden <sven.eden <AT> gmx <DOT> de>
AuthorDate: Sat Jan 19 11:56:03 2013 +0000
Commit:     Sven Eden <sven.eden <AT> gmx <DOT> de>
CommitDate: Sat Jan 19 11:56:03 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/ufed.git;a=commit;h=bfa25f47

Convert known UTF-8 characters to ASCII

---
 ufed.pl.in |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/ufed.pl.in b/ufed.pl.in
index b115629..d1bd669 100644
--- a/ufed.pl.in
+++ b/ufed.pl.in
@@ -137,8 +137,14 @@ sub flags_dialog {
 		$outTxt .= sprintf ("%s\n", $_) for(@{$use_descriptions{$flag}});
 	}
 
+	# Some overlays (like sunrise) use UTF-8 characters in their
+	# use descriptions. They cause problems unless the whole
+	# interface is changed to use wchar. Substitute with ISO:
+	$outTxt =~ tr/\x{2014}\x{201c}\x{201d}/\x2d\x22\x22/ ;
+	
 	# Now let the interface know of the result
 	if (open my $fh, '>&=', $iwrite) {
+		binmode( $fh, ":encoding(ISO-8859-1)" );
 		print $fh $outTxt;
 		close $fh;
 	} else {


^ permalink raw reply related	[flat|nested] 238+ messages in thread
* [gentoo-commits] proj/ufed:master commit in: /
@ 2013-01-19 21:43 Sven Eden
  0 siblings, 0 replies; 238+ messages in thread
From: Sven Eden @ 2013-01-19 21:43 UTC (permalink / raw
  To: gentoo-commits

commit:     530472b1c92a1170f37a1deb5370da9b3fc3309d
Author:     Sven Eden <sven.eden <AT> gmx <DOT> de>
AuthorDate: Sat Jan 19 11:43:31 2013 +0000
Commit:     Sven Eden <sven.eden <AT> gmx <DOT> de>
CommitDate: Sat Jan 19 11:43:31 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/ufed.git;a=commit;h=530472b1

Initialize description buffer before write.

---
 ufed-curses-checklist.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/ufed-curses-checklist.c b/ufed-curses-checklist.c
index 9f9fae9..a2e3c88 100644
--- a/ufed-curses-checklist.c
+++ b/ufed-curses-checklist.c
@@ -313,6 +313,7 @@ static void drawflag(struct item *item, bool highlight) {
 					: flag->isInstalled[idx] ? 'L' : 'l');
 
 			// Assemble description line:
+			memset(desc, 0, maxDescWidth * sizeof(char));
 			if (flag->pkgs[idx])
 				sprintf(desc, "(%s) %s", flag->pkgs[idx], flag->descr[idx]);
 			else


^ permalink raw reply related	[flat|nested] 238+ messages in thread
* [gentoo-commits] proj/ufed:master commit in: /
@ 2013-01-19 21:43 Sven Eden
  0 siblings, 0 replies; 238+ messages in thread
From: Sven Eden @ 2013-01-19 21:43 UTC (permalink / raw
  To: gentoo-commits

commit:     daeca639017e2f78ab7a8f3e7abca8cca4e5ce8d
Author:     Sven Eden <sven.eden <AT> gmx <DOT> de>
AuthorDate: Fri Jan 18 07:33:57 2013 +0000
Commit:     Sven Eden <sven.eden <AT> gmx <DOT> de>
CommitDate: Fri Jan 18 07:33:57 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/ufed.git;a=commit;h=daeca639

Eventually removed the two remaining prototypes. Their usage is, even
like this, is deprecated for ages now, and simply not reliable.

---
 Portage.pm |   51 ++++++++++++++++++++++++++-------------------------
 1 files changed, 26 insertions(+), 25 deletions(-)

diff --git a/Portage.pm b/Portage.pm
index 2caed7d..5b9b233 100644
--- a/Portage.pm
+++ b/Portage.pm
@@ -23,8 +23,8 @@ our $eprefix;
 
 sub get_eprefix;
 sub have_package;
-sub merge(\%%);
-sub merge_env(\%);
+sub merge;
+sub merge_env;
 sub noncomments;
 sub norm_path;
 sub read_archs;
@@ -48,10 +48,10 @@ read_archs;
 my $lastorder;
 for(reverse split /:/, $environment{USE_ORDER} || "env:pkg:conf:defaults:pkginternal:env.d") {
 	if($_ eq 'defaults') {
-		merge(%default_flags, %make_defaults_flags);
-		merge(%all_flags, %make_defaults_flags);
+		merge(\%default_flags, \%make_defaults_flags);
+		merge(\%all_flags, \%make_defaults_flags);
 	} elsif($_ eq 'conf') {
-		merge(%all_flags, %make_conf_flags);
+		merge(\%all_flags, \%make_conf_flags);
 	} else {
 		next;
 	}
@@ -95,38 +95,38 @@ sub have_package {
 
 
 # merges two hashes into the first.
-# Parameter 1: destination hash
-# Parameter 2: source hash
-sub merge(\%%) {
-	my ($env, %env) = @_;
-	%{$env} = () if(exists $env{'*'});
-	$env->{$_} = $env{$_} for(keys %env);
+# Parameter 1: reference of the destination hash
+# Parameter 2: reference of the source hash
+sub merge {
+	my ($dst, $src) = @_;
+	%{$dst} = () if(exists $src->{'*'});
+	$dst->{$_} = $src->{$_} for(keys %$src);
 	return;
 }
 
 
 # Splits content of the source hash at spaces and
 # merges its contents into %environment.
-# Parameter 1: hash to merge
-sub merge_env(\%) {
-	my ($env) = @_;
+# Parameter 1: reference of the hash to merge
+sub merge_env {
+	my ($src) = @_;
 	for(keys %environment) {
 		if(ref $environment{$_} eq 'HASH') {
-			if(exists $env->{$_}) {
+			if(exists $src->{$_}) {
 				my %split;
-				for(split ' ', $env->{$_}) {
+				for(split ' ', $src->{$_}) {
 					my $off = s/^-//;
 					%split = () if($_ eq '*');
 					$split{$_} = !$off;
 				}
-				$env->{$_} = { %split };
-				merge(%{$environment{$_}}, %{$env->{$_}});
+				$src->{$_} = { %split };
+				merge(\%{$environment{$_}}, \%{$src->{$_}});
 			}
 		}
 	}
-	for(keys %$env) {
+	for(keys %$src) {
 		if(ref $environment{$_} ne 'HASH') {
-			$environment{$_} = $env->{$_};
+			$environment{$_} = $src->{$_};
 		}
 	}
 	return;
@@ -195,9 +195,10 @@ sub read_archs {
 # in @portagedirs.
 # No parameters accepted.
 sub read_make_conf {
-	my %env = read_sh "$eprefix/etc/make.conf";
-	merge (%env, read_sh("$eprefix/etc/portage/make.conf"));
-	merge (%make_conf_flags, %{$env{USE}}) if exists $env{USE};
+	my %oldEnv = read_sh("$eprefix/etc/make.conf");
+	my %newEnv = read_sh("$eprefix/etc/portage/make.conf");
+	merge (\%oldEnv, \%newEnv);
+	merge (\%make_conf_flags,\ %{$oldEnv{USE}}) if exists $oldEnv{USE};
 	@portagedirs = $environment{PORTDIR};
 	push @portagedirs, split ' ', $environment{PORTDIR_OVERLAY} if defined $environment{PORTDIR_OVERLAY};
 	return;
@@ -210,7 +211,7 @@ sub read_make_conf {
 sub read_make_defaults {
 	for my $dir(@profiles) {
 		my %env = read_sh "$dir/make.defaults";
-		merge (%make_defaults_flags, %{$env{USE}}) if exists $env{USE};
+		merge (\%make_defaults_flags, \%{$env{USE}}) if exists $env{USE};
 	}
 	return
 }
@@ -384,7 +385,7 @@ sub read_sh {
 		};
 		die "Parse error in $fname\n" if $@;
 	}
-	merge_env(%env);
+	merge_env(\%env);
 	return %env if wantarray;
 	return;
 }


^ permalink raw reply related	[flat|nested] 238+ messages in thread
* [gentoo-commits] proj/ufed:master commit in: /
@ 2013-01-19 21:43 Sven Eden
  0 siblings, 0 replies; 238+ messages in thread
From: Sven Eden @ 2013-01-19 21:43 UTC (permalink / raw
  To: gentoo-commits

commit:     81cc5f4805643d9e56d973c1468a166513d5c01a
Author:     Sven Eden <sven.eden <AT> gmx <DOT> de>
AuthorDate: Fri Jan 18 21:08:23 2013 +0000
Commit:     Sven Eden <sven.eden <AT> gmx <DOT> de>
CommitDate: Fri Jan 18 21:08:23 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/ufed.git;a=commit;h=81cc5f48

Added knowledge about instaled packages. Further split the internal
representation fro all-in-one to separate description and package
lists for each flag and description.

Currently the packages are not displayed, this has to be added next.

---
 ufed-curses-checklist.c |  150 +++++++++++++++++++++++++++++++---------------
 ufed-curses.h           |   23 +++++++
 ufed.pl.in              |   23 +++++---
 3 files changed, 139 insertions(+), 57 deletions(-)

diff --git a/ufed-curses-checklist.c b/ufed-curses-checklist.c
index 1cea40b..1529e1f 100644
--- a/ufed-curses-checklist.c
+++ b/ufed-curses-checklist.c
@@ -11,26 +11,14 @@
 
 #include "ufed-curses-help.h"
 
-#define DEBUG_EXIT 1
-
-#if defined(DEBUG_EXIT)
-#  define ERROR_EXIT(code, fmt, ...) { \
-	fprintf(stderr, "ERROR in %s:%d (%s): \n -> ", \
-		__FILE__, __LINE__, __FUNCTION__); \
-	fprintf(stderr, fmt, __VA_ARGS__); \
-	exit(code); \
-}
-#else
-#  define ERROR_EXIT(code, ...) { exit(code); }
-#endif // DEBUG_EXIT
-
 /* internal types */
 struct flag {
 	struct item item;
 	char *name;
 	char on;
 	char *state;
-	char *descr[FLEXIBLE_ARRAY_MEMBER];
+	char **pkgs;
+	char **descr;
 };
 
 
@@ -109,9 +97,11 @@ static void read_flags(void) {
 	for(;;) {
 		struct {
 			int start, end;
-		} name, on, state;
+		} name, on, state, pkgs, desc;
 		int ndescr;
 		struct flag *flag;
+		char descState;
+
 		line = getline(input);
 		if(line==NULL)
 			break;
@@ -120,10 +110,17 @@ static void read_flags(void) {
 				&on.start,    &on.end,
 				&state.start, &state.end,
 				&ndescr)!=1)
-			ERROR_EXIT(-1, "sscanf failed on line\n\"%s\"\n", line);
-		flag = malloc(sizeof *flag + ndescr * sizeof *flag->descr);
-		if(flag==NULL)
-			ERROR_EXIT(-1, "Can not allocate %lu bytes\n", sizeof *flag + ndescr * sizeof *flag->descr);
+			ERROR_EXIT(-1, "flag sscanf failed on line\n\"%s\"\n", line);
+
+		/* Allocate memory for the struct and the arrays */
+		if (NULL == (flag = (struct flag*)calloc(1, sizeof(struct flag))))
+			ERROR_EXIT(-1, "Can not allocate %lu bytes for flag\n", sizeof(struct flag));
+		if (NULL == (flag->pkgs = (char**)calloc(ndescr, sizeof(char*))))
+			ERROR_EXIT(-1, "Can not allocate %lu bytes for pkg array\n", ndescr * sizeof(char*));
+		if (NULL == (flag->descr = (char**)calloc(ndescr, sizeof(char*))))
+			ERROR_EXIT(-1, "Can not allocate %lu bytes for descr array\n", ndescr * sizeof(char*));
+
+		/* note position and name of the flag */
 		flag->item.top = y;
 
 		line[name.end] = '\0';
@@ -156,18 +153,59 @@ static void read_flags(void) {
 		flag->item.isGlobal    = false;
 		flag->item.isInstalled = false;
 		for (int i = 0; i < ndescr; ++i) {
-			flag->descr[i] = getline(input);
-			if ('g' == flag->descr[i][1])
+			pkgs.start = pkgs.end = -1;
+			desc.start = desc.end = -1;
+			line = getline(input);
+			if(line == NULL)
+				break;
+			/* There are two possible layouts:
+			 * a: "g [description]" for global flag descriptions and
+			 * b: "x (pkg(s)) [description]" for local flag descriptions
+			 * We therefore need two sscanf attempts. Use b first, as
+			 * it is more common.
+			 */
+			if ((sscanf(line, "(%n%*[^)]%n) [%n%*[^]]%n] %c",
+					&pkgs.start,  &pkgs.end,
+					&desc.start,  &desc.end,
+					&descState) !=1 )
+			  &&(sscanf(line, "[%n%*[^]]%n] %c",
+					&desc.start,  &desc.end,
+					&descState) !=1))
+				ERROR_EXIT(-1, "desc sscanf failed on line\n\"%s\"\n", line);
+
+			// Set general state of the flag
+			if ('g' == descState)
 				flag->item.isGlobal = true;
-			else if ('L' == flag->descr[i][1])
+			else if ('L' == descState)
 				flag->item.isInstalled = true;
-			else if ('M' == flag->descr[i][1]) {
+			else if ('M' == descState) {
 				flag->item.isMasked = true;
 				flag->item.isInstalled = true;
 			}
-			else if ('m' == flag->descr[i][1])
+			else if ('m' == descState)
 				flag->item.isMasked = true;
-		}
+
+			// Save packages
+			if (pkgs.start > -1) {
+				int pkgLen = pkgs.end - pkgs.start;
+				if (NULL == (flag->pkgs[i] = (char*)calloc(pkgLen + 1, sizeof(char))) )
+					ERROR_EXIT(-1, "Unable to allocate %lu bytes for pkg list %d\n",
+						sizeof(char) * (pkgLen + 1), i);
+				strncpy(flag->pkgs[i], &line[pkgs.start], pkgLen);
+			}
+
+			// Save description
+			if (desc.start > -1) {
+				int descLen = desc.end - desc.start;
+				if (NULL == (flag->descr[i] = (char*)calloc(descLen + 1, sizeof(char))) )
+					ERROR_EXIT(-1, "Unable to allocate %lu bytes for description %d\n",
+						sizeof(char) * (descLen + 1), i);
+				strncpy(flag->descr[i], &line[desc.start], descLen);
+			} else
+				ERROR_EXIT(-1, "Flag %s has no description at line %d\n", flag->name, i);
+
+			free(line);
+		} // loop through description lines
 
 		/* record first not masked y if not done, yet */
 		if (firstNormalY < 0 && !flag->item.isMasked)
@@ -186,7 +224,7 @@ static void read_flags(void) {
 			flags->item.prev->next = (struct item *) flag;
 			flags->item.prev = (struct item *) flag;
 		}
-	}
+	} // loop while input given
 	fclose(input);
 	if(flags==NULL) {
 		fputs("No input!\n", stderr);
@@ -196,16 +234,17 @@ static void read_flags(void) {
 
 static void free_flags(void) {
 	struct flag *flag = flags;
-	if(flag!=NULL) {
+	if(flag != NULL) {
 		flag->item.prev->next = NULL;
 		do {
 			void *p = flag;
-			char **descr;
-			for(descr=&flag->descr[0]; descr!=&flag->descr[flag->item.height]; descr++)
-				free(*descr);
+			for (int i = 0; i < flag->item.height; ++i) {
+				if (flag->pkgs[i])  free(flag->pkgs[i]);
+				if (flag->descr[i]) free(flag->descr[i]);
+			}
 			flag = (struct flag *) flag->item.next;
 			free(p);
-		} while(flag!=NULL);
+		} while(flag != NULL);
 		flags = NULL;
 	}
 }
@@ -214,22 +253,28 @@ static void free_flags(void) {
 static void drawflag(struct item *item, bool highlight) {
 	struct flag *flag = (struct flag *) item;
 	char buf[wWidth(List)+1];
-	char **d;
-
 	int y = flag->item.top - topy;
+	int idx = 0;
+
+	/* Set correct color set according to highlighting */
 	if(!highlight)
 		wattrset(win(List), COLOR_PAIR(3));
 	else
 		wattrset(win(List), COLOR_PAIR(3) | A_BOLD | A_REVERSE);
-	if(y >= 0 || -y >= flag->item.height) {
-		d = &flag->descr[0];
-	} else {
-		wmove(win(List), 0, 0);
-		d = &flag->descr[-y];
-		y = 0;
+
+	/* Determine with which description to start.
+	 * Overly long description lists might not fit on one screen,
+	 * and therefore must be scrolled instead of the flags
+	 * themselves.
+	 */
+	if(y < 0 && (-y < flag->item.height)) {
+		idx = -y;
+		y   = 0;
 	}
 	wmove(win(List), y, 0);
-	sprintf(buf, " %c%c%c %-*s %-4.4s ",
+
+	/* print the selection, name and state of the flag */
+	sprintf(buf, " %c%c%c %s%s%s%-*s %-4.4s ",
 		/* State of selection */
 		flag->on == ' ' ? '(' : '[',
 		flag->on == ' '
@@ -237,23 +282,29 @@ static void drawflag(struct item *item, bool highlight) {
 				? flag->state[1] : ' '
 			: flag->on,
 		flag->on == ' ' ? ')' : ']',
-		/* distance and name */
-		minwidth-11, flag->name,
+		/* name */
+		flag->item.isMasked ? "(" : "", flag->name, flag->item.isMasked ? ")" : "",
+		/* distance */
+		(int)(minwidth - (flag->item.isMasked ? 13 : 11) - strlen(flag->name)), "",
 		/* current selection state */
 		flag->state);
-	if(d != &flag->descr[flag->item.height]) {
+
+	/* print descriptions according to filters
+	 * TODO: Implement local/global and installed/all filters
+	 */
+	if(idx < flag->item.height) {
 		for(;;) {
-			sprintf(buf+minwidth, "%-*.*s",
+			sprintf(buf + minwidth, "%-*.*s",
 				wWidth(List)-minwidth, wWidth(List)-minwidth,
-				strlen(*d) > (size_t)descriptionleft
-					? &(*d)[descriptionleft]
+				strlen(flag->descr[idx]) > (size_t)descriptionleft
+					? &flag->descr[idx][descriptionleft]
 					: "");
 			waddstr(win(List), buf);
-			d++;
 			y++;
-			if(d!=&flag->descr[flag->item.height] && y<wHeight(List)) {
+			idx++;
+			if((idx < flag->item.height) && (y < wHeight(List)) ) {
 				char *p;
-				for(p=buf; p!=buf+minwidth; p++)
+				for(p = buf; p != buf + minwidth; p++)
 					*p = ' ';
 				continue;
 			}
@@ -445,6 +496,7 @@ int main(void) {
 	fayt[0] = '\0';
 
 	initcurses();
+
 	result=maineventloop("Select desired USE flags from the list below:",
 			&callback, &drawflag, (struct item *) flags, keys);
 	cursesdone();

diff --git a/ufed-curses.h b/ufed-curses.h
index 81ee779..fee9e67 100644
--- a/ufed-curses.h
+++ b/ufed-curses.h
@@ -4,6 +4,29 @@
 
 #include <curses.h>
 
+
+#define DEBUG_EXIT 1
+#define DEBUG_TRACE 1
+
+#if defined(DEBUG_EXIT)
+#  define ERROR_EXIT(code, fmt, ...) { \
+	fprintf(stderr, "ERROR in %s:%d (%s): \n -> ", \
+		__FILE__, __LINE__, __FUNCTION__); \
+	fprintf(stderr, fmt, __VA_ARGS__); \
+	exit(code); \
+}
+#else
+#  define ERROR_EXIT(code, ...) { exit(code); }
+#endif // DEBUG_EXIT
+#if defined(DEBUG_TRACE)
+# define TRACE { \
+	fprintf(stderr, "(TRACE) %s:%d - %s\n", __FILE__, __LINE__, __FUNCTION__); \
+}
+#else
+# define TRACE
+#endif // DEBUG_TRACE
+
+
 enum win { Top, Left, List, Input, Scrollbar, Right, Bottom, wCount };
 enum mask { show_unmasked, show_both, show_masked };
 

diff --git a/ufed.pl.in b/ufed.pl.in
index 9b1263e..b115629 100644
--- a/ufed.pl.in
+++ b/ufed.pl.in
@@ -11,6 +11,12 @@ use Portage;
 
 my $version = 'XX_PACKAGE_VERSION@';
 
+my $interface = 'ufed-curses';
+#my $memcheck  = "/usr/bin/valgrind -v --trace-children=yes --tool=memcheck"
+#			  . " --track-origins=yes --leak-check=full --show-reachable=yes"
+#			  . " --read-var-info=yes"
+#              . " XX_libexecdir@/ufed-curses 2>/tmp/ufed_memcheck.log";
+
 my %use_descriptions;
 my %masked_descriptions;
 
@@ -30,10 +36,10 @@ $Portage::make_conf_flags{'-*'} = 1
 		&& !$Portage::make_conf_flags{'*'};
 
 for(keys %Portage::all_flags) {
-	@{$use_descriptions{$_}} = "(Unknown)"
+	@{$use_descriptions{$_}} = "[(Unknown)] g"
 		if not exists $use_descriptions{$_};
 }
-@{$use_descriptions{'-*'}} = 'Never enable any flags other than those specified in make.conf';
+@{$use_descriptions{'-*'}} = '[Never enable any flags other than those specified in make.conf] g';
 
 for(@Portage::archs) {
 	delete $Portage::default_flags{$_};
@@ -49,8 +55,8 @@ for my $flag (keys %Portage::use_masked_flags) {
 		if (defined($use_descriptions{$flag})) {
 			@{$masked_descriptions{$flag}} = @{$use_descriptions{$flag}};
 			for (my $i = 0; $i < scalar @{$masked_descriptions{$flag}}; ++$i) {
-				$masked_descriptions{$flag}->[$i] =~ s/^\[[lg]\]/[m]/ ;
-				$masked_descriptions{$flag}->[$i] =~ s/^\[L\]/[M]/ ;
+				$masked_descriptions{$flag}->[$i] =~ s/ [lg]$/ m/ ;
+				$masked_descriptions{$flag}->[$i] =~ s/ L$/ M/ ;
 			}
 		}
 		delete $use_descriptions{$flag};
@@ -96,9 +102,10 @@ sub flags_dialog {
 		POSIX::close $iread;
 		POSIX::dup2 $owrite, 4;
 		POSIX::close $owrite;
-		my $interface = 'ufed-curses';
 		exec { "XX_libexecdir@/$interface" } $interface or
 		do { print STDERR "Couldn't launch $interface\n"; exit 3 }
+#		exec $memcheck or
+#		do { print STDERR "Couldn't launch valgrind\n$!\n"; exit 3 }
 	}
 	POSIX::close $iread;
 	POSIX::close $owrite;
@@ -106,7 +113,7 @@ sub flags_dialog {
 
 	# Write masked flags first so they sort at the beginning of the list
 	for my $flag (sort { uc $a cmp uc $b } keys %masked_descriptions) {
-		$outTxt .= sprintf ("(%s) %s (%s%s) %d\n", $flag,
+		$outTxt .= sprintf ("%s %s (%s%s) %d\n", $flag,
 					defined($Portage::make_conf_flags{$flag})
 						? $Portage::make_conf_flags{$flag} ? 'on' : 'off' : 'def',
 					exists($Portage::make_defaults_flags{$flag})
@@ -183,7 +190,7 @@ sub read_use_descs {
 	# in the ncurses interface as well.
 	for my $key (sort keys %_use_descriptions) {
 		for my $desc (sort keys %{$_use_descriptions{$key}}) {
-			push @{$use_descriptions{$key}}, "[g] " . $desc;
+			push @{$use_descriptions{$key}}, "[" . $desc . "] g";
 		}
 	}
 
@@ -197,7 +204,7 @@ sub read_use_descs {
 				push @pkgs, $pkg;
 			}
 			local $"=", ";
-			push @{$use_descriptions{$key}}, sprintf("[%s] (%s) %s", $flagPrefix, "@pkgs", $desc);
+			push @{$use_descriptions{$key}}, sprintf("(%s) [%s] %s", "@pkgs", $desc, $flagPrefix);
 		}
 	}
 	return;


^ permalink raw reply related	[flat|nested] 238+ messages in thread
* [gentoo-commits] proj/ufed:master commit in: /
@ 2013-01-19 21:43 Sven Eden
  0 siblings, 0 replies; 238+ messages in thread
From: Sven Eden @ 2013-01-19 21:43 UTC (permalink / raw
  To: gentoo-commits

commit:     b2916dcad57a7a09069e2a76e14d3a347cef251f
Author:     Sven Eden <sven.eden <AT> gmx <DOT> de>
AuthorDate: Fri Jan 18 07:36:00 2013 +0000
Commit:     Sven Eden <sven.eden <AT> gmx <DOT> de>
CommitDate: Fri Jan 18 07:36:00 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/ufed.git;a=commit;h=b2916dca

Fixed Scrollbar, the determination where the first not masked flag
begins was left in the wrong place.

---
 ufed-curses-checklist.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/ufed-curses-checklist.c b/ufed-curses-checklist.c
index 176ceca..1cea40b 100644
--- a/ufed-curses-checklist.c
+++ b/ufed-curses-checklist.c
@@ -142,10 +142,6 @@ static void read_flags(void) {
 		else
 			ERROR_EXIT(-1, "flag->on can not be determined with \"%s\"\n", &line[on.start]);
 
-		/* record first not masked y if not done, yet */
-		if (firstNormalY < 0 && !flag->item.isMasked)
-			firstNormalY = flag->item.top;
-
 		/* check and set flag state */
 		line[state.end] = '\0';
 		if(state.end-state.start != 4)
@@ -173,6 +169,10 @@ static void read_flags(void) {
 				flag->item.isMasked = true;
 		}
 
+		/* record first not masked y if not done, yet */
+		if (firstNormalY < 0 && !flag->item.isMasked)
+			firstNormalY = flag->item.top;
+
 		y += ndescr;
 
 		/* Save flag in our linked list */


^ permalink raw reply related	[flat|nested] 238+ messages in thread
* [gentoo-commits] proj/ufed:master commit in: /
@ 2013-01-19 21:43 Sven Eden
  0 siblings, 0 replies; 238+ messages in thread
From: Sven Eden @ 2013-01-19 21:43 UTC (permalink / raw
  To: gentoo-commits

commit:     833fe5f13eb621dbc8cee1e0b1095547bb888d38
Author:     Sven Eden <sven.eden <AT> gmx <DOT> de>
AuthorDate: Sat Jan 19 11:44:13 2013 +0000
Commit:     Sven Eden <sven.eden <AT> gmx <DOT> de>
CommitDate: Sat Jan 19 11:44:13 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/ufed.git;a=commit;h=833fe5f1

Excplicitedly load as UTF-8. It fits on all ASCII/ISO and some overlay files actually are UTF-8.

---
 Portage.pm |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/Portage.pm b/Portage.pm
index 5b9b233..92f5495 100644
--- a/Portage.pm
+++ b/Portage.pm
@@ -141,6 +141,7 @@ sub noncomments {
 	my @result;
 	local $/;
 	if(open my $file, '<', $fname) {
+		binmode( $file, ":encoding(UTF-8)" );
 		@result = split /(?:[^\S\n]*(?:#.*)?\n)+/, <$file>."\n";
 		shift @result if @result>0 && $result[0] eq '';
 		close $file;


^ permalink raw reply related	[flat|nested] 238+ messages in thread
* [gentoo-commits] proj/ufed:master commit in: /
@ 2013-01-19 21:43 Sven Eden
  0 siblings, 0 replies; 238+ messages in thread
From: Sven Eden @ 2013-01-19 21:43 UTC (permalink / raw
  To: gentoo-commits

commit:     f6cc45aff1e8011bd496908ce3f2afc0c5ee2e46
Author:     Sven Eden <sven.eden <AT> gmx <DOT> de>
AuthorDate: Fri Jan 18 07:22:56 2013 +0000
Commit:     Sven Eden <sven.eden <AT> gmx <DOT> de>
CommitDate: Fri Jan 18 07:22:56 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/ufed.git;a=commit;h=f6cc45af

The following changes are made:

1. Removed the "Local Flag: " prefix for flag descriptions
2. Added [x] prefix for all descriptions with the following meanings:
  g = global flag
  l = local flag, package not installed
  L = local flag, package is installed
  m = masked flag (package not installed if local)
  M = masked flag package is installed
3. Moved affected packages list of local flags to the front.

This is a preparation to add local/global and installed/uninstalled
filters.

The display, as it now is, is not pretty. I am not happy with the
static description line.

It is important to add a destinction between a globally masked flag,
and a locally masked flag. Further the prefix [x] is a) ugly and
b) must not scroll. It should be moved to the static left side,
getting its own column.

---
 ufed-curses-checklist.c |   57 +++++++++++++++++++++++++++++++++--------------
 ufed-curses.h           |    2 +
 ufed.pl.in              |   53 ++++++++++++++++++++++++++++++-------------
 3 files changed, 79 insertions(+), 33 deletions(-)

diff --git a/ufed-curses-checklist.c b/ufed-curses-checklist.c
index 8461ffb..176ceca 100644
--- a/ufed-curses-checklist.c
+++ b/ufed-curses-checklist.c
@@ -11,6 +11,19 @@
 
 #include "ufed-curses-help.h"
 
+#define DEBUG_EXIT 1
+
+#if defined(DEBUG_EXIT)
+#  define ERROR_EXIT(code, fmt, ...) { \
+	fprintf(stderr, "ERROR in %s:%d (%s): \n -> ", \
+		__FILE__, __LINE__, __FUNCTION__); \
+	fprintf(stderr, fmt, __VA_ARGS__); \
+	exit(code); \
+}
+#else
+#  define ERROR_EXIT(code, ...) { exit(code); }
+#endif // DEBUG_EXIT
+
 /* internal types */
 struct flag {
 	struct item item;
@@ -54,9 +67,9 @@ static char *getline(FILE *fp) {
 
 	size = LINE_MAX;
 	result = malloc(size);
-	if(result==NULL)
-		exit(-1);
-	if(fgets(result, size, fp)==NULL)
+	if(result == NULL)
+		ERROR_EXIT(-1, "Can not allocate %lu bytes\n", sizeof(char) * size);
+	if(fgets(result, size, fp) == NULL)
 		return NULL;
 	{
 		char *p = strchr(result, '\n');
@@ -68,8 +81,8 @@ static char *getline(FILE *fp) {
 	}
 	for(;;) {
 		result = realloc(result, size+size/2);
-		if(result==NULL)
-			exit(-1);
+		if(result == NULL)
+			ERROR_EXIT(-1, "Can not reallocate %lu bytes\n", (size_t)(sizeof(char) * size * 1.5));
 		if(fgets(result+size, size/2, fp)==NULL)
 			return NULL;
 		{
@@ -91,7 +104,7 @@ static void read_flags(void) {
 	int y=0;
 
 	if(input==NULL)
-		exit(-1);
+		ERROR_EXIT(-1, "fdopen failed with error %d\n", errno);
 	atexit(&free_flags);
 	for(;;) {
 		struct {
@@ -107,10 +120,10 @@ static void read_flags(void) {
 				&on.start,    &on.end,
 				&state.start, &state.end,
 				&ndescr)!=1)
-			exit(-1);
+			ERROR_EXIT(-1, "sscanf failed on line\n\"%s\"\n", line);
 		flag = malloc(sizeof *flag + ndescr * sizeof *flag->descr);
 		if(flag==NULL)
-			exit(-1);
+			ERROR_EXIT(-1, "Can not allocate %lu bytes\n", sizeof *flag + ndescr * sizeof *flag->descr);
 		flag->item.top = y;
 
 		line[name.end] = '\0';
@@ -120,19 +133,14 @@ static void read_flags(void) {
 
 		/* check and save current flag setting from configuration */
 		line[on.end] = '\0';
-		flag->item.isMasked = false;
 		if(!strcmp(&line[on.start], "on"))
 			flag->on = '+';
 		else if(!strcmp(&line[on.start], "off"))
 			flag->on = '-';
 		else if(!strcmp(&line[on.start], "def"))
 			flag->on = ' ';
-		else if(!strcmp(&line[on.start], "msk")) {
-			flag->on = 'm';
-			flag->item.isMasked = true;
-		}
 		else
-			exit(-1);
+			ERROR_EXIT(-1, "flag->on can not be determined with \"%s\"\n", &line[on.start]);
 
 		/* record first not masked y if not done, yet */
 		if (firstNormalY < 0 && !flag->item.isMasked)
@@ -141,14 +149,29 @@ static void read_flags(void) {
 		/* check and set flag state */
 		line[state.end] = '\0';
 		if(state.end-state.start != 4)
-			exit(-1);
+			ERROR_EXIT(-1, "state.end - state.start is %d (must be 4)\n", state.end - state.start);
 		flag->state = &line[state.start];
 
 		/* check and set flag item height */
 		flag->item.height = ndescr;
-		{ int i; for(i=0; i<ndescr; i++) {
+
+		/* read description(s) and determine flag status */
+		flag->item.isMasked    = false;
+		flag->item.isGlobal    = false;
+		flag->item.isInstalled = false;
+		for (int i = 0; i < ndescr; ++i) {
 			flag->descr[i] = getline(input);
-		} }
+			if ('g' == flag->descr[i][1])
+				flag->item.isGlobal = true;
+			else if ('L' == flag->descr[i][1])
+				flag->item.isInstalled = true;
+			else if ('M' == flag->descr[i][1]) {
+				flag->item.isMasked = true;
+				flag->item.isInstalled = true;
+			}
+			else if ('m' == flag->descr[i][1])
+				flag->item.isMasked = true;
+		}
 
 		y += ndescr;
 

diff --git a/ufed-curses.h b/ufed-curses.h
index 03bb62a..81ee779 100644
--- a/ufed-curses.h
+++ b/ufed-curses.h
@@ -16,6 +16,8 @@ struct item {
 	struct item *prev, *next;
 	int top, height;
 	bool isMasked;
+	bool isGlobal;
+	bool isInstalled;
 };
 
 struct key {

diff --git a/ufed.pl.in b/ufed.pl.in
index bdcfb91..9b1263e 100644
--- a/ufed.pl.in
+++ b/ufed.pl.in
@@ -40,17 +40,22 @@ for(@Portage::archs) {
 	delete $Portage::all_flags{$_};
 	delete $use_descriptions{$_};
 }
-for(keys %Portage::use_masked_flags) {
+for my $flag (keys %Portage::use_masked_flags) {
 	my $masked = 1;
-	for(values %{$Portage::use_masked_flags{$_}}) {
-		last if not($masked &&= $_);
+	for my $mask (values %{$Portage::use_masked_flags{$flag}}) {
+		last if not($masked &&= $mask);
 	}
 	if($masked) {
-		@{$masked_descriptions{$_}} = @{$use_descriptions{$_}}
-			if (defined($use_descriptions{$_}));
-		delete $Portage::default_flags{$_};
-		delete $Portage::all_flags{$_};
-		delete $use_descriptions{$_};
+		if (defined($use_descriptions{$flag})) {
+			@{$masked_descriptions{$flag}} = @{$use_descriptions{$flag}};
+			for (my $i = 0; $i < scalar @{$masked_descriptions{$flag}}; ++$i) {
+				$masked_descriptions{$flag}->[$i] =~ s/^\[[lg]\]/[m]/ ;
+				$masked_descriptions{$flag}->[$i] =~ s/^\[L\]/[M]/ ;
+			}
+		}
+		delete $use_descriptions{$flag};
+		delete $Portage::default_flags{$flag};
+		delete $Portage::all_flags{$flag};
 	}
 }
 
@@ -101,7 +106,9 @@ sub flags_dialog {
 
 	# Write masked flags first so they sort at the beginning of the list
 	for my $flag (sort { uc $a cmp uc $b } keys %masked_descriptions) {
-		$outTxt .= sprintf ("(%s) msk (%s%s) %d\n", $flag,
+		$outTxt .= sprintf ("(%s) %s (%s%s) %d\n", $flag,
+					defined($Portage::make_conf_flags{$flag})
+						? $Portage::make_conf_flags{$flag} ? 'on' : 'off' : 'def',
 					exists($Portage::make_defaults_flags{$flag})
 						? $Portage::make_defaults_flags{$flag} ? '+' : '-' : ' ',
 					exists($Portage::make_conf_flags{$flag})
@@ -114,7 +121,7 @@ sub flags_dialog {
 	for my $flag (sort { uc $a cmp uc $b } keys %use_descriptions) {
 		$outTxt .= sprintf ("%s %s (%s%s) %d\n", $flag,
 					defined($Portage::make_conf_flags{$flag})
-						? $Portage::make_conf_flags{$flag} ? ' on ' : ' off ' : ' def ',
+						? $Portage::make_conf_flags{$flag} ? 'on' : 'off' : 'def',
 					exists($Portage::make_defaults_flags{$flag})
 						? $Portage::make_defaults_flags{$flag} ? '+' : '-' : ' ',
 					exists($Portage::make_conf_flags{$flag})
@@ -172,12 +179,26 @@ sub read_use_descs {
 			$_use_local_descriptions{$flag}{$desc}{$pkg} = 1;
 		}
 	}
-	local $"=", ";
-	for(sort keys %_use_descriptions)
-	{ @{$use_descriptions{$_}} = sort keys %{$_use_descriptions{$_}} }
-	for(sort keys %_use_local_descriptions) {
-		for my $desc(sort keys %{$_use_local_descriptions{$_}})
-		{ push @{$use_descriptions{$_}}, "Local flag: $desc (@{[sort keys %{$_use_local_descriptions{$_}{$desc}}]})" }
+	# Record all global flags first, their description is printed first
+	# in the ncurses interface as well.
+	for my $key (sort keys %_use_descriptions) {
+		for my $desc (sort keys %{$_use_descriptions{$key}}) {
+			push @{$use_descriptions{$key}}, "[g] " . $desc;
+		}
+	}
+
+	# Add local flags
+	for my $key (sort keys %_use_local_descriptions) {
+		for my $desc (sort keys %{$_use_local_descriptions{$key}}) {
+			my $flagPrefix = "l";
+			my @pkgs = ();
+			for my $pkg (sort keys %{$_use_local_descriptions{$key}{$desc}}) {
+				$flagPrefix = "L" if (Portage::have_package($pkg));
+				push @pkgs, $pkg;
+			}
+			local $"=", ";
+			push @{$use_descriptions{$key}}, sprintf("[%s] (%s) %s", $flagPrefix, "@pkgs", $desc);
+		}
 	}
 	return;
 }


^ permalink raw reply related	[flat|nested] 238+ messages in thread
* [gentoo-commits] proj/ufed:master commit in: /
@ 2013-01-19 21:43 Sven Eden
  0 siblings, 0 replies; 238+ messages in thread
From: Sven Eden @ 2013-01-19 21:43 UTC (permalink / raw
  To: gentoo-commits

commit:     e61e43452fe1e8db273fb5a31448ee153808f0a6
Author:     Sven Eden <sven.eden <AT> gmx <DOT> de>
AuthorDate: Fri Jan 18 22:07:57 2013 +0000
Commit:     Sven Eden <sven.eden <AT> gmx <DOT> de>
CommitDate: Fri Jan 18 22:07:57 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/ufed.git;a=commit;h=e61e4345

Readded the packages display. Further the state (global, local, masked, installed) is shown fixed in front of the description. Addition to test: Lines describing a global flag behavior are now shown in blue unless highlighted.

---
 ufed-curses-checklist.c |   67 +++++++++++++++++++++++++++++++++++-----------
 ufed-curses.c           |    1 +
 ufed-curses.h           |    1 -
 3 files changed, 52 insertions(+), 17 deletions(-)

diff --git a/ufed-curses-checklist.c b/ufed-curses-checklist.c
index 1529e1f..9f9fae9 100644
--- a/ufed-curses-checklist.c
+++ b/ufed-curses-checklist.c
@@ -17,6 +17,7 @@ struct flag {
 	char *name;
 	char on;
 	char *state;
+	bool *isInstalled;
 	char **pkgs;
 	char **descr;
 };
@@ -27,6 +28,7 @@ static struct flag *flags;
 static int descriptionleft;
 static char *fayt;
 static struct item **faytsave;
+static size_t maxDescWidth = 0;
 
 #define mkKey(x) x, sizeof(x)-1
 static const struct key keys[] = {
@@ -113,10 +115,16 @@ static void read_flags(void) {
 			ERROR_EXIT(-1, "flag sscanf failed on line\n\"%s\"\n", line);
 
 		/* Allocate memory for the struct and the arrays */
+		// struct
 		if (NULL == (flag = (struct flag*)calloc(1, sizeof(struct flag))))
 			ERROR_EXIT(-1, "Can not allocate %lu bytes for flag\n", sizeof(struct flag));
+		// isInstalled
+		if (NULL == (flag->isInstalled = (bool*)calloc(ndescr, sizeof(bool))))
+			ERROR_EXIT(-1, "Can not allocate %lu bytes for isInstalled array\n", ndescr * sizeof(bool));
+		// pkgs
 		if (NULL == (flag->pkgs = (char**)calloc(ndescr, sizeof(char*))))
 			ERROR_EXIT(-1, "Can not allocate %lu bytes for pkg array\n", ndescr * sizeof(char*));
+		// descr
 		if (NULL == (flag->descr = (char**)calloc(ndescr, sizeof(char*))))
 			ERROR_EXIT(-1, "Can not allocate %lu bytes for descr array\n", ndescr * sizeof(char*));
 
@@ -151,7 +159,6 @@ static void read_flags(void) {
 		/* read description(s) and determine flag status */
 		flag->item.isMasked    = false;
 		flag->item.isGlobal    = false;
-		flag->item.isInstalled = false;
 		for (int i = 0; i < ndescr; ++i) {
 			pkgs.start = pkgs.end = -1;
 			desc.start = desc.end = -1;
@@ -174,13 +181,14 @@ static void read_flags(void) {
 				ERROR_EXIT(-1, "desc sscanf failed on line\n\"%s\"\n", line);
 
 			// Set general state of the flag
+			flag->isInstalled[i] = false;
 			if ('g' == descState)
-				flag->item.isGlobal = true;
+				flag->item.isGlobal  = true;
 			else if ('L' == descState)
-				flag->item.isInstalled = true;
+				flag->isInstalled[i] = true;
 			else if ('M' == descState) {
-				flag->item.isMasked = true;
-				flag->item.isInstalled = true;
+				flag->item.isMasked  = true;
+				flag->isInstalled[i] = true;
 			}
 			else if ('m' == descState)
 				flag->item.isMasked = true;
@@ -192,7 +200,8 @@ static void read_flags(void) {
 					ERROR_EXIT(-1, "Unable to allocate %lu bytes for pkg list %d\n",
 						sizeof(char) * (pkgLen + 1), i);
 				strncpy(flag->pkgs[i], &line[pkgs.start], pkgLen);
-			}
+			} else
+				flag->pkgs[i] = NULL;
 
 			// Save description
 			if (desc.start > -1) {
@@ -204,6 +213,11 @@ static void read_flags(void) {
 			} else
 				ERROR_EXIT(-1, "Flag %s has no description at line %d\n", flag->name, i);
 
+			// Note new max length if this line is longest:
+			size_t fullWidth = 1 + strlen(flag->descr[i]) + (flag->pkgs[i] ? strlen(flag->pkgs[i] + 3) : 0);
+			if (fullWidth > maxDescWidth)
+				maxDescWidth = fullWidth;
+
 			free(line);
 		} // loop through description lines
 
@@ -242,6 +256,9 @@ static void free_flags(void) {
 				if (flag->pkgs[i])  free(flag->pkgs[i]);
 				if (flag->descr[i]) free(flag->descr[i]);
 			}
+			if (flag->isInstalled) free(flag->isInstalled);
+			if (flag->pkgs)        free(flag->pkgs);
+			if (flag->descr)       free(flag->descr);
 			flag = (struct flag *) flag->item.next;
 			free(p);
 		} while(flag != NULL);
@@ -253,15 +270,10 @@ static void free_flags(void) {
 static void drawflag(struct item *item, bool highlight) {
 	struct flag *flag = (struct flag *) item;
 	char buf[wWidth(List)+1];
+	char desc[maxDescWidth];
 	int y = flag->item.top - topy;
 	int idx = 0;
 
-	/* Set correct color set according to highlighting */
-	if(!highlight)
-		wattrset(win(List), COLOR_PAIR(3));
-	else
-		wattrset(win(List), COLOR_PAIR(3) | A_BOLD | A_REVERSE);
-
 	/* Determine with which description to start.
 	 * Overly long description lists might not fit on one screen,
 	 * and therefore must be scrolled instead of the flags
@@ -294,11 +306,34 @@ static void drawflag(struct item *item, bool highlight) {
 	 */
 	if(idx < flag->item.height) {
 		for(;;) {
-			sprintf(buf + minwidth, "%-*.*s",
-				wWidth(List)-minwidth, wWidth(List)-minwidth,
-				strlen(flag->descr[idx]) > (size_t)descriptionleft
-					? &flag->descr[idx][descriptionleft]
+			// Display flag state
+			sprintf(buf + minwidth, "[%c] ",
+				flag->item.isMasked ? flag->isInstalled[idx] ? 'M' : 'm'
+					: flag->item.isGlobal && !flag->pkgs[idx] ? 'g'
+					: flag->isInstalled[idx] ? 'L' : 'l');
+
+			// Assemble description line:
+			if (flag->pkgs[idx])
+				sprintf(desc, "(%s) %s", flag->pkgs[idx], flag->descr[idx]);
+			else
+				sprintf(desc, "%s", flag->descr[idx]);
+
+			// Now display the description line according to its horizontal position
+			sprintf(buf + minwidth + 4, "%-*.*s",
+				wWidth(List)-minwidth - 4, wWidth(List)-minwidth - 4,
+				strlen(desc) > (size_t)descriptionleft
+					? &desc[descriptionleft]
 					: "");
+
+			/* Set correct color set according to highlighting and status*/
+			if(highlight)
+				wattrset(win(List), COLOR_PAIR(3) | A_BOLD | A_REVERSE);
+			else if (flag->item.isGlobal && !flag->pkgs[idx])
+				wattrset(win(List), COLOR_PAIR(5));
+			else
+				wattrset(win(List), COLOR_PAIR(3));
+
+			// Finally put the line on the screen
 			waddstr(win(List), buf);
 			y++;
 			idx++;

diff --git a/ufed-curses.c b/ufed-curses.c
index 65ffe67..e885d75 100644
--- a/ufed-curses.c
+++ b/ufed-curses.c
@@ -45,6 +45,7 @@ void initcurses(void) {
 	init_pair(2, COLOR_WHITE, COLOR_WHITE);
 	init_pair(3, COLOR_BLACK, COLOR_WHITE);
 	init_pair(4, COLOR_RED, COLOR_WHITE);
+	init_pair(5, COLOR_BLUE, COLOR_WHITE);
 #ifdef NCURSES_MOUSE_VERSION
 	mousemask(BUTTON1_CLICKED | BUTTON1_DOUBLE_CLICKED | BUTTON1_PRESSED | BUTTON1_RELEASED, NULL);
 #endif

diff --git a/ufed-curses.h b/ufed-curses.h
index fee9e67..bae8847 100644
--- a/ufed-curses.h
+++ b/ufed-curses.h
@@ -40,7 +40,6 @@ struct item {
 	int top, height;
 	bool isMasked;
 	bool isGlobal;
-	bool isInstalled;
 };
 
 struct key {


^ permalink raw reply related	[flat|nested] 238+ messages in thread
* [gentoo-commits] proj/ufed:master commit in: /
@ 2013-01-19 21:43 Sven Eden
  0 siblings, 0 replies; 238+ messages in thread
From: Sven Eden @ 2013-01-19 21:43 UTC (permalink / raw
  To: gentoo-commits

commit:     b7470f766b642212fc25f4e78cc8facd2816c6f2
Author:     Sven Eden <sven.eden <AT> gmx <DOT> de>
AuthorDate: Thu Jan 17 17:44:58 2013 +0000
Commit:     Sven Eden <sven.eden <AT> gmx <DOT> de>
CommitDate: Thu Jan 17 17:44:58 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/ufed.git;a=commit;h=b7470f76

Added more commentary to the useless looking part of read_packages()
and fixed a copy&paste move error (although that was harmless).

---
 Portage.pm |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/Portage.pm b/Portage.pm
index a69795e..2caed7d 100644
--- a/Portage.pm
+++ b/Portage.pm
@@ -243,12 +243,14 @@ sub read_packages {
 			# Load PROVIDE
 			## FIXME: There is no file "PROVIDE" anywhere, at least on my system!
 			if(open my $provide, '<', "$eprefix/var/db/pkg/$cat/$pkg/PROVIDE") {
+				local $/;
 				@provide = split ' ', <$provide>;
 				close $provide;
 			}
 			
 			# Load USE
 			if(open my $use, '<', "$eprefix/var/db/pkg/$cat/$pkg/USE") {
+				local $/;
 				@use = split ' ', <$use>;
 				close $use;
 			}
@@ -256,9 +258,11 @@ sub read_packages {
 			# could be shortened, but make sure not to strip off part of the name
 			$pkg =~ s/-\d+(?:\.\d+)*\w?(?:_(?:alpha|beta|pre|rc|p)\d*)?(?:-r\d+)?$//;
 			$packages{"$cat/$pkg"} = 1;
-			local $/;
 			
 			# FIXME: What is this supposed to achieve?
+			# Currently this does nothing as there is no PROVIDE anywhere,
+			# but even if it were, there is nothing really done at all with
+			# @use.
 			for(my $i=0; $i<@provide; $i++) {
 				my $pkg = $provide[$i];
 				next if $pkg eq '(' || $pkg eq ')';


^ permalink raw reply related	[flat|nested] 238+ messages in thread
* [gentoo-commits] proj/ufed:master commit in: /
@ 2013-01-19 21:43 Sven Eden
  0 siblings, 0 replies; 238+ messages in thread
From: Sven Eden @ 2013-01-19 21:43 UTC (permalink / raw
  To: gentoo-commits

commit:     9372270835430b83878a3f8f318c058e53e1dda5
Author:     Sven Eden <sven.eden <AT> gmx <DOT> de>
AuthorDate: Thu Jan 17 07:16:28 2013 +0000
Commit:     Sven Eden <sven.eden <AT> gmx <DOT> de>
CommitDate: Thu Jan 17 07:16:28 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/ufed.git;a=commit;h=93722708

Added subroutine descriptions for future reference.

---
 ufed.pl.in |   17 +++++++++++++++++
 1 files changed, 17 insertions(+), 0 deletions(-)

diff --git a/ufed.pl.in b/ufed.pl.in
index 7bd37b2..cbf072c 100644
--- a/ufed.pl.in
+++ b/ufed.pl.in
@@ -56,6 +56,9 @@ for(keys %Portage::use_masked_flags) {
 
 flags_dialog;
 
+# Take a list and return it ordered the following way:
+# Put "-*" first, followed by enabling flags and put
+# disabling flags to the end.
 sub finalise {
 	my @arg = @_;
 	my @result = sort {
@@ -68,6 +71,10 @@ sub finalise {
 	return @result;
 }
 
+# Launch the curses inteface. Communication is done using
+# pipes. Waiting for pipe read/write to finish is done
+# automatically.
+# No arguments accepted.
 sub flags_dialog {
 	use POSIX ();
 	POSIX::dup2 1, 3;
@@ -141,6 +148,14 @@ sub flags_dialog {
 	return;
 }
 
+# Build the global %use_descriptions hash.
+# Parsed files are:
+# 1. PORTDIR/profiles/use.desc
+# 2. PORTDIR/profiles/use.local.desc
+# No arguments accepted.
+# @todo : The local descriptions must be written in a different
+#         way (how?) to allow the wanted filtering/distinction
+#         between global/local flags.
 sub read_use_descs {
 	my %_use_descriptions;
 	for my $dir(@Portage::portagedirs) {
@@ -166,6 +181,8 @@ sub read_use_descs {
 	return;
 }
 
+# Write given list of flags back to make.conf if
+# the file has not been changed since reading it.
 sub save_flags {
 	my (@flags) = @_;
 	my $BLANK = qr{(?:[ \n\t]+|#.*)+};              # whitespace and comments


^ permalink raw reply related	[flat|nested] 238+ messages in thread
* [gentoo-commits] proj/ufed:master commit in: /
@ 2013-01-19 21:43 Sven Eden
  0 siblings, 0 replies; 238+ messages in thread
From: Sven Eden @ 2013-01-19 21:43 UTC (permalink / raw
  To: gentoo-commits

commit:     0d72a4ce141c7213e4bbacb30f966c108dbcf7af
Author:     Sven Eden <sven.eden <AT> gmx <DOT> de>
AuthorDate: Wed Jan 16 19:07:06 2013 +0000
Commit:     Sven Eden <sven.eden <AT> gmx <DOT> de>
CommitDate: Wed Jan 16 19:07:06 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/ufed.git;a=commit;h=0d72a4ce

Fixed the scrollbar:

The height is now relative to the displayed list.
The position is fixed according of the state of the masked flags
filtering.

---
 ufed-curses-checklist.c |    5 +++++
 ufed-curses.c           |   31 +++++++++++++++++++++++++++++--
 2 files changed, 34 insertions(+), 2 deletions(-)

diff --git a/ufed-curses-checklist.c b/ufed-curses-checklist.c
index b78a773..8461ffb 100644
--- a/ufed-curses-checklist.c
+++ b/ufed-curses-checklist.c
@@ -44,6 +44,7 @@ static void free_flags(void);
 
 /* external members */
 enum mask showMasked = show_unmasked; //!< Set whether to show masked, unmasked or both flags
+int firstNormalY = -1; //!< y of first not masked flag
 
 
 /* static functions */
@@ -133,6 +134,10 @@ static void read_flags(void) {
 		else
 			exit(-1);
 
+		/* record first not masked y if not done, yet */
+		if (firstNormalY < 0 && !flag->item.isMasked)
+			firstNormalY = flag->item.top;
+
 		/* check and set flag state */
 		line[state.end] = '\0';
 		if(state.end-state.start != 4)

diff --git a/ufed-curses.c b/ufed-curses.c
index d7ff8da..65ffe67 100644
--- a/ufed-curses.c
+++ b/ufed-curses.c
@@ -27,6 +27,7 @@ static struct item *items, *currentitem;
 /* external members */
 int topy, minwidth;
 extern enum mask showMasked;
+extern int firstNormalY;
 
 /* internal prototypes */
 static void checktermsize(void);
@@ -129,8 +130,34 @@ static void drawscrollbar(void) {
 	wattrset(w, COLOR_PAIR(3) | A_BOLD);
 	mvwaddch(w, 0, 0, ACS_UARROW);
 	wvline(w, ACS_CKBOARD, wHeight(Scrollbar)-3);
-	if(items->prev->top+items->prev->height > wHeight(List))
-		mvwaddch(w, 1+(wHeight(Scrollbar)-3)*topy/(items->prev->top+items->prev->height-(wHeight(List)-1)), 0, ACS_BLOCK);
+
+	/* The scrollbar location differs related to the
+	 * current filtering of masked flags.
+	 */
+	int bottomY    = items->prev->top + items->prev->height;
+	// Case 1: Masked flags are not displayed (the default)
+	int listHeight = bottomY - firstNormalY;
+	int listTopY   = topy    - firstNormalY;
+	if (show_masked == showMasked) {
+		// Case 2: Only masked flags are displayed
+		listHeight = firstNormalY;
+		listTopY   = topy;
+	}
+	else if (show_both == showMasked) {
+		// case 3: All flags are shown
+		listHeight = bottomY;
+		listTopY   = topy;
+	}
+
+	// Only show a scrollbar if the list is actually longer than can be displayed:
+	if (listHeight > wHeight(List)) {
+		int sbHeight = wHeight(Scrollbar) - 3;
+		int barStart = 1 + (sbHeight * listTopY / listHeight);
+		int barEnd   = barStart + (sbHeight * wHeight(List) / listHeight);
+		for ( ; barStart <= barEnd; ++barStart)
+			mvwaddch(w, barStart, 0, ACS_BLOCK);
+	}
+
 	mvwaddch(w, wHeight(Scrollbar)-2, 0, ACS_DARROW);
 	mvwaddch(w, wHeight(Scrollbar)-1, 0, ACS_VLINE);
 	wnoutrefresh(w);


^ permalink raw reply related	[flat|nested] 238+ messages in thread
* [gentoo-commits] proj/ufed:master commit in: /
@ 2013-01-19 21:43 Sven Eden
  0 siblings, 0 replies; 238+ messages in thread
From: Sven Eden @ 2013-01-19 21:43 UTC (permalink / raw
  To: gentoo-commits

commit:     1280f8d91022b24410ee6321da08161771cc2352
Author:     Sven Eden <sven.eden <AT> gmx <DOT> de>
AuthorDate: Thu Jan 17 16:35:11 2013 +0000
Commit:     Sven Eden <sven.eden <AT> gmx <DOT> de>
CommitDate: Thu Jan 17 16:35:11 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/ufed.git;a=commit;h=1280f8d9

Added comments to all subroutines and fixed various Perl::Critic warnings as follows:

[Subroutines::RequireArgUnpacking]
  Always unpack @_ first (See page 178 of PBP)

[Subroutines::ProhibitSubroutinePrototypes]
  Subroutine prototypes used (See page 194 of PBP)

[Subroutines::RequireFinalReturn]
  Subroutine does not end with "return" (See page 197 of PBP)

[InputOutput::RequireBriefOpen]
  Close filehandles as soon as possible after opening them (See page 209 of PBP)

[TestingAndDebugging::RequireUseStrict]
  Code before strictures are enabled (See page 429 of PBP)

[TestingAndDebugging::RequireUseWarnings]
  Code before warnings are enabled (See page 431 of PBP)

One note to the subroutine prototypes:
As long as it is not tried to create a function that behaves like a builtin
operator, or unless it is important that a given parameter is taken as
a strict reference, prototypes are not only superfluous, but can be outright
dangerous.

---
 Portage.pm |  228 ++++++++++++++++++++++++++++++++++++++++++------------------
 1 files changed, 159 insertions(+), 69 deletions(-)

diff --git a/Portage.pm b/Portage.pm
index 4b34372..a69795e 100644
--- a/Portage.pm
+++ b/Portage.pm
@@ -4,9 +4,13 @@ package Portage;
 # Distributed under the terms of the GNU General Public License v2
 # $Header: /var/cvsroot/gentoo-src/ufed/Portage.pm,v 1.3 2005/11/13 00:28:17 truedfx Exp $
 
+use strict;
+use warnings;
+
 my %environment;
 $environment{$_}={} for qw(USE); # INCREMENTALS, except we only need USE
 
+our @portagedirs;
 our %packages;
 our @profiles;
 our %use_masked_flags;
@@ -17,20 +21,20 @@ our %archs;
 our %all_flags;
 our $eprefix;
 
-sub get_eprefix();
-sub have_package($);
+sub get_eprefix;
+sub have_package;
 sub merge(\%%);
 sub merge_env(\%);
-sub noncomments($);
-sub norm_path($$);
-sub read_archs();
-sub read_make_conf();
-sub read_make_defaults();
-sub read_make_globals();
-sub read_packages();
-sub read_profiles();
-sub read_sh($);
-sub read_use_mask();
+sub noncomments;
+sub norm_path;
+sub read_archs;
+sub read_make_conf;
+sub read_make_defaults;
+sub read_make_globals;
+sub read_packages;
+sub read_profiles;
+sub read_sh;
+sub read_use_mask;
 
 get_eprefix;
 read_packages;
@@ -44,10 +48,10 @@ read_archs;
 my $lastorder;
 for(reverse split /:/, $environment{USE_ORDER} || "env:pkg:conf:defaults:pkginternal:env.d") {
 	if($_ eq 'defaults') {
-		merge %default_flags, %make_defaults_flags;
-		merge %all_flags, %make_defaults_flags;
+		merge(%default_flags, %make_defaults_flags);
+		merge(%all_flags, %make_defaults_flags);
 	} elsif($_ eq 'conf') {
-		merge %all_flags, %make_conf_flags;
+		merge(%all_flags, %make_conf_flags);
 	} else {
 		next;
 	}
@@ -58,14 +62,18 @@ if($lastorder ne 'conf') {
 }
 
 
-sub get_eprefix() {
+# Determine the value for EPREFIX and save it
+# in $eprefix. This is done using 'portageq'.
+# Other output from portageq is printed on
+# STDERR.
+# No parameters accepted.
+sub get_eprefix {
 	my $tmp = "/tmp/ufed_$$.tmp";
 	$eprefix = qx{portageq envvar EPREFIX 2>$tmp};
 	die "Couldn't determine EPREFIX from Portage" if $? != 0;
 
 	if ( -s $tmp ) {
-		my $fTmp = undef;
-		if (open ($fTmp, "<", $tmp)) {
+		if (open (my $fTmp, "<", $tmp)) {
 			print STDERR "$_" while (<$fTmp>);
 			close $fTmp;
 		}
@@ -73,19 +81,33 @@ sub get_eprefix() {
 	-e $tmp and unlink $tmp;
 
 	chomp($eprefix);
+	return;
 }
 
-sub have_package($) {
+
+# returns the content of %packages for the given
+# scalar or undef.
+# Parameter 1: Package to test of the form <category>/<name>
+sub have_package {
 	my ($cp) = @_;
 	return $packages{$cp};
 }
 
+
+# merges two hashes into the first.
+# Parameter 1: destination hash
+# Parameter 2: source hash
 sub merge(\%%) {
 	my ($env, %env) = @_;
 	%{$env} = () if(exists $env{'*'});
 	$env->{$_} = $env{$_} for(keys %env);
+	return;
 }
 
+
+# Splits content of the source hash at spaces and
+# merges its contents into %environment.
+# Parameter 1: hash to merge
 sub merge_env(\%) {
 	my ($env) = @_;
 	for(keys %environment) {
@@ -98,18 +120,23 @@ sub merge_env(\%) {
 					$split{$_} = !$off;
 				}
 				$env->{$_} = { %split };
-				merge %{$environment{$_}}, %{$env->{$_}};
+				merge(%{$environment{$_}}, %{$env->{$_}});
 			}
 		}
 	}
-	for(keys %{$env}) {
+	for(keys %$env) {
 		if(ref $environment{$_} ne 'HASH') {
 			$environment{$_} = $env->{$_};
 		}
 	}
+	return;
 }
 
-sub noncomments($) {
+
+# returns a list of all lines of a given file
+# that are no pure comments
+# Parameter 1: filename
+sub noncomments {
 	my ($fname) = @_;
 	my @result;
 	local $/;
@@ -121,7 +148,12 @@ sub noncomments($) {
 	return @result;
 }
 
-sub norm_path($$) {
+
+# normalizes a given path behind a base
+# Parameter 1: base path 
+# Parameter 2: sub path
+# return: normalized base path / normalized sub path
+sub norm_path {
 	my ($base, $path) = @_;
 	my @pathcomp = ($path !~ m!^/! && split(m!/!, $base), split(m!/!, $path));
 	for(my $i=0;;$i++) {
@@ -142,84 +174,127 @@ sub norm_path($$) {
 	return '/'.join '/', @pathcomp;
 }
 
-sub read_archs() {
+
+# reads all arch.list in all profiles sub directories
+# of found @portagedirs and saves the found architectures
+# in %arch
+# No parameters accepted
+sub read_archs {
 	for my $dir(@portagedirs) {
 		for(noncomments "$dir/profiles/arch.list") {
 			$archs{$_} = 1;
 		}
 	}
+	return;
 }
 
-sub read_make_conf() {
+
+# read /etc/make.conf and/or /etc/portage/make.conf and
+# merge set USE flags into %make_conf_flags. Additionally
+# all set portage directories (plus overlays) are recorded
+# in @portagedirs.
+# No parameters accepted.
+sub read_make_conf {
 	my %env = read_sh "$eprefix/etc/make.conf";
 	merge (%env, read_sh("$eprefix/etc/portage/make.conf"));
-	merge %make_conf_flags, %{$env{USE}} if exists $env{USE};
+	merge (%make_conf_flags, %{$env{USE}}) if exists $env{USE};
 	@portagedirs = $environment{PORTDIR};
 	push @portagedirs, split ' ', $environment{PORTDIR_OVERLAY} if defined $environment{PORTDIR_OVERLAY};
+	return;
 }
 
-sub read_make_defaults() {
+
+# read all found make.defaults files and merge their flags
+# into %make_default_flags.
+# No parameters accepted.
+sub read_make_defaults {
 	for my $dir(@profiles) {
 		my %env = read_sh "$dir/make.defaults";
-		merge %make_defaults_flags, %{$env{USE}} if exists $env{USE};
+		merge (%make_defaults_flags, %{$env{USE}}) if exists $env{USE};
 	}
+	return
 }
 
-sub read_make_globals() {
+
+# read all found make.globals and merge their
+# settings into %environment.
+# No parameters accepted
+sub read_make_globals {
 	for my $dir(@profiles, "$eprefix/usr/share/portage/config") {
 		read_sh "$dir/make.globals";
 	}
+	return;
 }
 
-sub read_packages() {
+
+# Analyze EPREFIX/var/db/pkg and note all installed
+# packages in %packages.
+# No parameters accepted.
+sub read_packages {
 	die "Couldn't read $eprefix/var/db/pkg\n" unless opendir my $pkgdir, "$eprefix/var/db/pkg";
 	while(my $cat = readdir $pkgdir) {
 		next if $cat eq '.' or $cat eq '..';
-		next unless opendir my $catdir, "/var/db/pkg/$cat";
+		next unless opendir my $catdir, "$eprefix/var/db/pkg/$cat";
 		while(my $pkg = readdir $catdir) {
 			next if $pkg eq '.' or $pkg eq '..';
-			if(open my $provide, '<', "/var/db/pkg/$cat/$pkg/PROVIDE") {
-				if(open my $use, '<', "/var/db/pkg/$cat/$pkg/USE") {
-					# could be shortened, but make sure not to strip off part of the name
+			my @provide = ();
+			my @use = ();
+			
+			# Load PROVIDE
+			## FIXME: There is no file "PROVIDE" anywhere, at least on my system!
+			if(open my $provide, '<', "$eprefix/var/db/pkg/$cat/$pkg/PROVIDE") {
+				@provide = split ' ', <$provide>;
+				close $provide;
+			}
+			
+			# Load USE
+			if(open my $use, '<', "$eprefix/var/db/pkg/$cat/$pkg/USE") {
+				@use = split ' ', <$use>;
+				close $use;
+			}
+
+			# could be shortened, but make sure not to strip off part of the name
+			$pkg =~ s/-\d+(?:\.\d+)*\w?(?:_(?:alpha|beta|pre|rc|p)\d*)?(?:-r\d+)?$//;
+			$packages{"$cat/$pkg"} = 1;
+			local $/;
+			
+			# FIXME: What is this supposed to achieve?
+			for(my $i=0; $i<@provide; $i++) {
+				my $pkg = $provide[$i];
+				next if $pkg eq '(' || $pkg eq ')';
+				if($pkg !~ s/\?$//) {
 					$pkg =~ s/-\d+(?:\.\d+)*\w?(?:_(?:alpha|beta|pre|rc|p)\d*)?(?:-r\d+)?$//;
-					$packages{"$cat/$pkg"} = 1;
-					local $/;
-					my @provide = split ' ', <$provide>;
-					my @use = split ' ', <$use>;
-					for(my $i=0; $i<@provide; $i++) {
-						my $pkg = $provide[$i];
-						next if $pkg eq '(' || $pkg eq ')';
-						if($pkg !~ s/\?$//) {
-							$pkg =~ s/-\d+(?:\.\d+)*\w?(?:_(?:alpha|beta|pre|rc|p)\d*)?(?:-r\d+)?$//;
-							$packages{$pkg} = 1;
-						} else {
-							my $musthave = $pkg !~ s/^!//;
-							my $have = 0;
-							for(@use) {
-								if($pkg eq $_)
-								{ $have = 1; last }
-							}
-							if($musthave != $have) {
-								my $level = 0;
-								for($i++;$i<@provide;$i++) {
-									$level++ if $provide[$i] eq '(';
-									$level-- if $provide[$i] eq ')';
-									last if $level==0;
-								}
-							}
+					$packages{$pkg} = 1;
+				} else {
+					my $musthave = $pkg !~ s/^!//;
+					my $have = 0;
+					for(@use) {
+						if($pkg eq $_)
+						{ $have = 1; last }
+					}
+					if($musthave != $have) {
+						my $level = 0;
+						for($i++;$i<@provide;$i++) {
+							$level++ if $provide[$i] eq '(';
+							$level-- if $provide[$i] eq ')';
+							last if $level==0;
 						}
 					}
-					close $use;
 				}
-				close $provide;
 			}
 		}
 		closedir $catdir;
 	}
 	closedir $pkgdir;
+	return;
 }
 
-sub read_profiles() {
+
+# read /etc/make.profile and /etc/portage/make.profile
+# and analyze the complete profile tree using the found
+# parent files. Add all found paths to @profiles.
+# No parameters accepted.
+sub read_profiles {
 	$_ = readlink "$eprefix/etc/make.profile";
 	$_ = readlink "$eprefix/etc/portage/make.profile" if not defined $_;
 	die "$eprefix/etc\{,/portage\}/make.profile is not a symlink\n" if not defined $_;
@@ -230,9 +305,18 @@ sub read_profiles() {
 		}
 	}
 	push @profiles, "$eprefix/etc/portage/profile";
+	return;
 }
 
-sub read_sh($) {
+
+# reads the given file and parses it for key=value pairs.
+# "source" entries are added to the file and parsed as
+# well. The results of the parsing are merged into
+# %environment.
+# Parameter 1: The path of the file to parse.
+# In a non-scalar context the function returns the found values.
+sub read_sh {
+	my ($fname) = @_;
 	my $BLANK = qr{(?:[ \n\t]+|#.*)+};         # whitespace and comments
 	my $IDENT = qr{([^ \\\n\t'"{}=#]+)};       # identifiers
 	my $ASSIG = qr{=};                         # assignment operator
@@ -240,10 +324,10 @@ sub read_sh($) {
 	my $SQVAL = qr{'([^']*)'};                 # singlequoted value
 	my $DQVAL = qr{"((?:[^\\"]|\\.)*)"}s;      # doublequoted value
 
-	my ($fname) = @_;
 	my %env;
 	if(open my $file, '<', $fname) {
 		{ local $/; $_ = <$file> }
+		close $file;
 		eval {
 			for(;;) {
 				/\G$BLANK/gc;
@@ -279,7 +363,7 @@ sub read_sh($) {
 					}
 				}
 				if($name eq 'source') {
-					open my $f, '<', $value or die;
+					open my $f, '<', $value or die "Unable to open $value\n$!\n";
 					my $pos = pos;
 					substr($_, pos, 0) = do {
 						local $/;
@@ -288,20 +372,25 @@ sub read_sh($) {
 						$text;
 					};
 					pos = $pos;
-					close $f or die;
+					close $f or die "Unable to open $value\n$!\n";
 				} else {
 				$env{$name} = $value;
 				}
 			}
 		};
 		die "Parse error in $fname\n" if $@;
-		close $file;
 	}
-	merge_env %env;
+	merge_env(%env);
 	return %env if wantarray;
+	return;
 }
 
-sub read_use_mask() {
+
+# read all masked flags from all found use.mask
+# and package.use.mask files. Save the found
+# masks in %use_masked_flags.
+# No parameters accepted.
+sub read_use_mask {
 	for my $dir(@profiles) {
 		-r "$dir/use.mask" or next;
 		for(noncomments "$dir/use.mask") {
@@ -318,6 +407,7 @@ sub read_use_mask() {
 			}
 		}
 	}
+	return;
 }
 
 1;


^ permalink raw reply related	[flat|nested] 238+ messages in thread
* [gentoo-commits] proj/ufed:master commit in: /
@ 2013-01-19 21:43 Sven Eden
  0 siblings, 0 replies; 238+ messages in thread
From: Sven Eden @ 2013-01-19 21:43 UTC (permalink / raw
  To: gentoo-commits

commit:     0e7b283c98dc352bf6049f68652902b4c3fed029
Author:     Sven Eden <sven.eden <AT> gmx <DOT> de>
AuthorDate: Thu Jan 17 07:41:19 2013 +0000
Commit:     Sven Eden <sven.eden <AT> gmx <DOT> de>
CommitDate: Thu Jan 17 07:41:19 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/ufed.git;a=commit;h=0e7b283c

Fixed typos and added parameter descriptions to subroutines.

---
 ufed.pl.in |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/ufed.pl.in b/ufed.pl.in
index cbf072c..bdcfb91 100644
--- a/ufed.pl.in
+++ b/ufed.pl.in
@@ -59,6 +59,7 @@ flags_dialog;
 # Take a list and return it ordered the following way:
 # Put "-*" first, followed by enabling flags and put
 # disabling flags to the end.
+# Parameters: list of flags
 sub finalise {
 	my @arg = @_;
 	my @result = sort {
@@ -74,7 +75,7 @@ sub finalise {
 # Launch the curses inteface. Communication is done using
 # pipes. Waiting for pipe read/write to finish is done
 # automatically.
-# No arguments accepted.
+# No parameters accepted.
 sub flags_dialog {
 	use POSIX ();
 	POSIX::dup2 1, 3;
@@ -152,7 +153,7 @@ sub flags_dialog {
 # Parsed files are:
 # 1. PORTDIR/profiles/use.desc
 # 2. PORTDIR/profiles/use.local.desc
-# No arguments accepted.
+# No parameters accepted.
 # @todo : The local descriptions must be written in a different
 #         way (how?) to allow the wanted filtering/distinction
 #         between global/local flags.
@@ -183,6 +184,7 @@ sub read_use_descs {
 
 # Write given list of flags back to make.conf if
 # the file has not been changed since reading it.
+# Parameters: list of flags
 sub save_flags {
 	my (@flags) = @_;
 	my $BLANK = qr{(?:[ \n\t]+|#.*)+};              # whitespace and comments


^ permalink raw reply related	[flat|nested] 238+ messages in thread
* [gentoo-commits] proj/ufed:master commit in: /
@ 2013-01-19 21:43 Sven Eden
  0 siblings, 0 replies; 238+ messages in thread
From: Sven Eden @ 2013-01-19 21:43 UTC (permalink / raw
  To: gentoo-commits

commit:     e78d0f4211ad6e5963c359d566965990d72d537c
Author:     Sven Eden <sven.eden <AT> gmx <DOT> de>
AuthorDate: Thu Jan 17 06:59:09 2013 +0000
Commit:     Sven Eden <sven.eden <AT> gmx <DOT> de>
CommitDate: Thu Jan 17 06:59:09 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/ufed.git;a=commit;h=e78d0f42

Fixed several Perl::Critic warnings. This has been done as a
preparation for future changes implementing new features.

The following warnings have been fixed:

[Variables::RequireLexicalLoo pIterators]
  Loop iterator is not lexical (See page 108 of PBP)

[Subroutines::RequireArgUnpacking]
  Always unpack @_ first (See page 178 of PBP)

[Subroutines::ProhibitSubroutinePrototypes]
  Subroutine prototypes used (See page 194 of PBP)

[Subrotines::RequireFinalReturn]
  Subroutine did not end with "return" (See page 197 of PBP)

---
 ufed.pl.in |   90 ++++++++++++++++++++++++++++++++----------------------------
 1 files changed, 48 insertions(+), 42 deletions(-)

diff --git a/ufed.pl.in b/ufed.pl.in
index 341cb55..7bd37b2 100644
--- a/ufed.pl.in
+++ b/ufed.pl.in
@@ -14,10 +14,10 @@ my $version = 'XX_PACKAGE_VERSION@';
 my %use_descriptions;
 my %masked_descriptions;
 
-sub finalise(@);
-sub flags_dialog();
-sub read_use_descs();
-sub save_flags(@);
+sub finalise;
+sub flags_dialog;
+sub read_use_descs;
+sub save_flags;
 
 delete $Portage::all_flags{'*'};
 
@@ -56,17 +56,19 @@ for(keys %Portage::use_masked_flags) {
 
 flags_dialog;
 
-sub finalise(@) {
-	return sort {
+sub finalise {
+	my @arg = @_;
+	my @result = sort {
 		($a ne '-*') <=> ($b ne '-*')
 		||
 		($a =~ /^-/) <=> ($b =~ /^-/)
 		||
 		$a cmp $b
-	} @_;
+	} @arg;
+	return @result;
 }
 
-sub flags_dialog() {
+sub flags_dialog {
 	use POSIX ();
 	POSIX::dup2 1, 3;
 	POSIX::dup2 1, 4;
@@ -87,47 +89,47 @@ sub flags_dialog() {
 	}
 	POSIX::close $iread;
 	POSIX::close $owrite;
-	if(open my $fh, '>&=', $iwrite) {
-		
-		# Write masked flags first so they sort at the beginning of the list
-		for my $flag (sort { uc $a cmp uc $b } keys %masked_descriptions) {
-			print $fh "(" . $flag . ") msk "
-			. (exists($Portage::make_defaults_flags{$flag})
-				? $Portage::make_defaults_flags{$flag} ? '(+' :'(-'
-				: '( ')
-			. (exists($Portage::make_conf_flags{$flag})
-				? $Portage::make_conf_flags{$flag}     ? '+)': '-)'
-				: ' )')
-			. ' ' . scalar(@{$masked_descriptions{$flag}}) . "\n";
-			print $fh $_, "\n" for(@{$masked_descriptions{$flag}});
-		}
+	my $outTxt = "";
 
-		# Then write regular flags
-		for my $flag (sort { uc $a cmp uc $b } keys %use_descriptions) {
-			print $fh $flag
-			. (defined($Portage::make_conf_flags{$flag})
-				? $Portage::make_conf_flags{$flag} ? ' on ' : ' off '
-				: ' def ' )
-			. (exists($Portage::make_defaults_flags{$flag})
-				? $Portage::make_defaults_flags{$flag} ? '(+' :'(-'
-				: '( ')
-			. (exists($Portage::make_conf_flags{$flag})
-				? $Portage::make_conf_flags{$flag}     ? '+)': '-)'
-				: ' )')
-			. ' ' . scalar(@{$use_descriptions{$flag}}) . "\n";
-			print $fh $_, "\n" for(@{$use_descriptions{$flag}});
-		}
+	# Write masked flags first so they sort at the beginning of the list
+	for my $flag (sort { uc $a cmp uc $b } keys %masked_descriptions) {
+		$outTxt .= sprintf ("(%s) msk (%s%s) %d\n", $flag,
+					exists($Portage::make_defaults_flags{$flag})
+						? $Portage::make_defaults_flags{$flag} ? '+' : '-' : ' ',
+					exists($Portage::make_conf_flags{$flag})
+						? $Portage::make_conf_flags{$flag}     ? '+' : '-' : ' ',
+					scalar @{$masked_descriptions{$flag}} );
+		$outTxt .= sprintf ("%s\n", $_) for(@{$masked_descriptions{$flag}});
+	}
+
+	# Then write regular flags
+	for my $flag (sort { uc $a cmp uc $b } keys %use_descriptions) {
+		$outTxt .= sprintf ("%s %s (%s%s) %d\n", $flag,
+					defined($Portage::make_conf_flags{$flag})
+						? $Portage::make_conf_flags{$flag} ? ' on ' : ' off ' : ' def ',
+					exists($Portage::make_defaults_flags{$flag})
+						? $Portage::make_defaults_flags{$flag} ? '+' : '-' : ' ',
+					exists($Portage::make_conf_flags{$flag})
+						? $Portage::make_conf_flags{$flag}     ? '+' : '-' : ' ',
+					scalar @{$use_descriptions{$flag}}  );
+		$outTxt .= sprintf ("%s\n", $_) for(@{$use_descriptions{$flag}});
+	}
+
+	# Now let the interface know of the result
+	if (open my $fh, '>&=', $iwrite) {
+		print $fh $outTxt;
 		close $fh;
 	} else {
 		die "Couldn't let interface know of flags\n";
 	}
 	POSIX::close $iwrite;
 	wait;
-	open my $fh, '<&=', $oread or die "Couldn't read output.\n";
 	if(POSIX::WIFEXITED($?)) {
 		my $rc = POSIX::WEXITSTATUS($?);
 		if($rc==0) {
+			open my $fh, '<&=', $oread or die "Couldn't read output.\n";
 			my @flags = grep { $_ ne '--*' } do { local $/; split /\n/, <$fh> };
+			close $fh;
 			save_flags finalise @flags;
 		} elsif($rc==1)
 		{ print "Cancelled, not saving changes.\n" }
@@ -136,9 +138,10 @@ sub flags_dialog() {
 	{ kill POSIX::WTERMSIG($?), $$ }
 	else
 	{ exit 127 }
+	return;
 }
 
-sub read_use_descs() {
+sub read_use_descs {
 	my %_use_descriptions;
 	for my $dir(@Portage::portagedirs) {
 		for(Portage::noncomments "$dir/profiles/use.desc") {
@@ -160,9 +163,11 @@ sub read_use_descs() {
 		for my $desc(sort keys %{$_use_local_descriptions{$_}})
 		{ push @{$use_descriptions{$_}}, "Local flag: $desc (@{[sort keys %{$_use_local_descriptions{$_}{$desc}}]})" }
 	}
+	return;
 }
 
-sub save_flags(@) {
+sub save_flags {
+	my (@flags) = @_;
 	my $BLANK = qr{(?:[ \n\t]+|#.*)+};              # whitespace and comments
 	my $UBLNK = qr{(?:                              # as above, but scan for #USE=
 		[ \n\t]+ |
@@ -176,7 +181,6 @@ sub save_flags(@) {
 	my $BNUQV = qr{(?:[^ \\\n\t'"#]+|\\\n()|\\.)+}s;# unquoted value (scan for \\\n)
 	my $BNDQV = qr{"(?:[^\\"]|\\\n()|\\.)*"}s;      # doublequoted value (scan for \\\n)
 
-	my (@flags) = @_;
 	my $contents;
 
 	my $makeconf_name = "$Portage::eprefix/etc/portage/make.conf";
@@ -257,7 +261,7 @@ sub save_flags(@) {
 						$flags   = $nl.$flag;
 						$length  = length $flag;
 					}
-					for $flag(@flags[1..$#flags]) {
+					for my $flag (@flags[1..$#flags]) {
 						if($length + 1 + length $flag <= $linelength) {
 							$flags  .= " $flag";
 							$length += 1+length $flag;
@@ -326,4 +330,6 @@ EOF
 		print $makeconf $_;
 		close $makeconf;
 	}
+	
+	return;
 }


^ permalink raw reply related	[flat|nested] 238+ messages in thread
* [gentoo-commits] proj/ufed:master commit in: /
@ 2013-01-16 13:43 Sven Eden
  0 siblings, 0 replies; 238+ messages in thread
From: Sven Eden @ 2013-01-16 13:43 UTC (permalink / raw
  To: gentoo-commits

commit:     006dcae3e2abadc1773b2d762b0f661ad69da851
Author:     Sven Eden <sven.eden <AT> gmx <DOT> de>
AuthorDate: Wed Jan 16 13:42:30 2013 +0000
Commit:     Sven Eden <sven.eden <AT> gmx <DOT> de>
CommitDate: Wed Jan 16 13:42:30 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/ufed.git;a=commit;h=006dcae3

Portage.pm: get_eprefix() now filteres warnings from portageq and
writes them seperately out to stderr. Therefore warnings, like
invalid contents in FEATURES, no longer break determining EPREFIX.

---
 Portage.pm |   13 ++++++++++++-
 1 files changed, 12 insertions(+), 1 deletions(-)

diff --git a/Portage.pm b/Portage.pm
index 5443cf4..4b34372 100644
--- a/Portage.pm
+++ b/Portage.pm
@@ -59,8 +59,19 @@ if($lastorder ne 'conf') {
 
 
 sub get_eprefix() {
-	$eprefix = `portageq envvar EPREFIX 2>&1`;
+	my $tmp = "/tmp/ufed_$$.tmp";
+	$eprefix = qx{portageq envvar EPREFIX 2>$tmp};
 	die "Couldn't determine EPREFIX from Portage" if $? != 0;
+
+	if ( -s $tmp ) {
+		my $fTmp = undef;
+		if (open ($fTmp, "<", $tmp)) {
+			print STDERR "$_" while (<$fTmp>);
+			close $fTmp;
+		}
+	}
+	-e $tmp and unlink $tmp;
+
 	chomp($eprefix);
 }
 


^ permalink raw reply related	[flat|nested] 238+ messages in thread
* [gentoo-commits] proj/ufed:master commit in: /
@ 2013-01-16 12:56 Sven Eden
  0 siblings, 0 replies; 238+ messages in thread
From: Sven Eden @ 2013-01-16 12:56 UTC (permalink / raw
  To: gentoo-commits

commit:     8db257e9c8e2c8fa2bacdf826fc24e00467c7f03
Author:     Sven Eden <sven.eden <AT> gmx <DOT> de>
AuthorDate: Wed Jan 16 12:56:22 2013 +0000
Commit:     Sven Eden <sven.eden <AT> gmx <DOT> de>
CommitDate: Wed Jan 16 12:56:22 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/ufed.git;a=commit;h=8db257e9

Added the functonality to toggle masked flag display by pressing the
tab key.
Further added the key description to the bottom display and the
current filterstate (normal, masked, all) to the bottom right.

---
 ufed-curses-checklist.c |    1 +
 ufed-curses.c           |   42 ++++++++++++++++++++++++++++++++++++------
 ufed-curses.h           |    2 +-
 3 files changed, 38 insertions(+), 7 deletions(-)

diff --git a/ufed-curses-checklist.c b/ufed-curses-checklist.c
index 2f3432d..b78a773 100644
--- a/ufed-curses-checklist.c
+++ b/ufed-curses-checklist.c
@@ -32,6 +32,7 @@ static const struct key keys[] = {
 	{ '?',    mkKey("Help (?)")            },
 	{ '\n',   mkKey("Save (Return/Enter)") },
 	{ '\033', mkKey("Cancel (Esc)")        },
+	{ '\t',   mkKey("Toggle Masked (Tab)") },
 	{ '\0',   mkKey("")                    }
 };
 #undef mkKey

diff --git a/ufed-curses.c b/ufed-curses.c
index edaef38..d7ff8da 100644
--- a/ufed-curses.c
+++ b/ufed-curses.c
@@ -208,18 +208,30 @@ static void draw(void) {
 	{
 		char *p = buf;
 		const struct key *key;
+		const size_t maxAdr = (const size_t)(buf+wWidth(Bottom)-3);
 		*p++ = ' ';
 		for(key=keys; key->key!='\0'; key++) {
-			int n = (buf+wWidth(Bottom)-3) - p;
+			size_t n = maxAdr - (size_t)p;
 			if(n > key->length)
 				n = key->length;
 			memcpy(p, key->descr, n);
 			p += n;
-			*p++ = ' ';
-			if(p == buf+wWidth(Bottom)-3)
+			if ((size_t)p == maxAdr)
 				break;
+			*p++ = ' ';
+		}
+		/* If there is enough space, show which kind of flags
+		 * are displayed: normal, masked or all
+		 */
+		if ((size_t)p < (maxAdr - 9)) {
+			memset(p, ' ', maxAdr - 9 - (size_t)p);
+			p += maxAdr - 9 - (size_t)p;
+			if (show_unmasked == showMasked) strcpy(p, "[normal]");
+			if (show_masked   == showMasked) strcpy(p, "[masked]");
+			if (show_both     == showMasked) strcpy(p, "[ all  ]");
+			p += 8;
 		}
-		memset(p, ' ', buf+wWidth(Bottom)-2-p);
+		memset(p, ' ', maxAdr + 1 - (size_t)p);
 		buf[wWidth(Bottom)-2] = '\0';
 	}
 	waddstr(w, buf);
@@ -434,7 +446,7 @@ int maineventloop(
 							continue;
 						x -= 2;
 						for(key = keys; key->key!='\0'; key++) {
-							if(x < key->length) {
+							if((size_t)x < key->length) {
 								event.x -= x;
 								wattrset(win(Bottom), COLOR_PAIR(3) | A_BOLD | A_REVERSE);
 								mvwaddstr(win(Bottom), event.y, event.x, key->descr);
@@ -549,7 +561,25 @@ int maineventloop(
 						(*drawitem)(currentitem, TRUE);
 					}
 					break;
-	
+
+				case '\t':
+					if      (show_masked   == showMasked) showMasked = show_unmasked;
+					else if (show_both     == showMasked) showMasked = show_masked;
+					else if (show_unmasked == showMasked) showMasked = show_both;
+					currentitem = items;
+					topy = 0;
+					draw();
+					break;
+
+				case KEY_BTAB:
+					if      (show_masked   == showMasked) showMasked = show_both;
+					else if (show_both     == showMasked) showMasked = show_unmasked;
+					else if (show_unmasked == showMasked) showMasked = show_masked;
+					currentitem = items;
+					topy = 0;
+					draw();
+					break;
+
 #ifdef KEY_RESIZE
 				case KEY_RESIZE:
 					resizeterm(LINES, COLS);

diff --git a/ufed-curses.h b/ufed-curses.h
index 7a97c3e..03bb62a 100644
--- a/ufed-curses.h
+++ b/ufed-curses.h
@@ -21,7 +21,7 @@ struct item {
 struct key {
 	char key;
 	const char *descr;
-	int length;
+	size_t length;
 };
 
 extern struct window window[wCount];


^ permalink raw reply related	[flat|nested] 238+ messages in thread
* [gentoo-commits] proj/ufed:master commit in: /
@ 2013-01-16 12:56 Sven Eden
  0 siblings, 0 replies; 238+ messages in thread
From: Sven Eden @ 2013-01-16 12:56 UTC (permalink / raw
  To: gentoo-commits

commit:     f4e7703e71415a0b67b0558137e50b0ac9ece5e7
Author:     Sven Eden <sven.eden <AT> gmx <DOT> de>
AuthorDate: Mon Jan 14 06:36:20 2013 +0000
Commit:     Sven Eden <sven.eden <AT> gmx <DOT> de>
CommitDate: Mon Jan 14 06:36:20 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/ufed.git;a=commit;h=f4e7703e

Add variables to save masked flags before they get deleted. This is a preparation to add a "masked flags display on demand" to ufed.

---
 ufed.pl.in |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/ufed.pl.in b/ufed.pl.in
index a66ac52..e7f9673 100644
--- a/ufed.pl.in
+++ b/ufed.pl.in
@@ -12,6 +12,8 @@ use Portage;
 my $version = 'XX_PACKAGE_VERSION@';
 
 my %use_descriptions;
+my %masked_flags;
+my %masked_descriptions;
 
 sub finalise(@);
 sub flags_dialog();
@@ -45,6 +47,8 @@ for(keys %Portage::use_masked_flags) {
 		last if not($masked &&= $_);
 	}
 	if($masked) {
+		$masked_flags{$_}        = $Portage::all_flags{$_};
+		$masked_descriptions{$_} = $use_descriptions{$_};
 		delete $Portage::default_flags{$_};
 		delete $Portage::all_flags{$_};
 		delete $use_descriptions{$_};


^ permalink raw reply related	[flat|nested] 238+ messages in thread
* [gentoo-commits] proj/ufed:master commit in: /
@ 2013-01-16 12:56 Sven Eden
  0 siblings, 0 replies; 238+ messages in thread
From: Sven Eden @ 2013-01-16 12:56 UTC (permalink / raw
  To: gentoo-commits

commit:     d426c8cd669479200d89375ec21966142bcf3b65
Author:     Sven Eden <sven.eden <AT> gmx <DOT> de>
AuthorDate: Mon Jan 14 06:22:48 2013 +0000
Commit:     Sven Eden <sven.eden <AT> gmx <DOT> de>
CommitDate: Mon Jan 14 06:22:48 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/ufed.git;a=commit;h=d426c8cd

Changed old style placeholders for 'sed' in Makefile.am to prefix with 'XX_' instead of '@'. The latter is reserved in perl for lists and drives any IDE nuts.

---
 Makefile.am |    8 ++++----
 Portage.pm  |    2 ++
 ufed.pl.in  |   11 +++++++----
 3 files changed, 13 insertions(+), 8 deletions(-)

diff --git a/Makefile.am b/Makefile.am
index 630ad2e..df14de5 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -15,10 +15,10 @@ EXTRA_DIST = ufed.pl.in
 ufed: ufed.pl.in
 	rm -f $@.tmp
 	sed \
-		-e 's|@PACKAGE_VERSION[@]|$(PACKAGE_VERSION)|g' \
-		-e 's|@PERL[@]|$(PERL)|g' \
-		-e 's|@libexecdir[@]|$(libexecdir)|g' \
-		-e 's|@perldir[@]|$(perldir)|g' \
+		-e 's|XX_PACKAGE_VERSION[@]|$(PACKAGE_VERSION)|g' \
+		-e 's|XX_PERL[@]|$(PERL)|g' \
+		-e 's|XX_libexecdir[@]|$(libexecdir)|g' \
+		-e 's|XX_perldir[@]|$(perldir)|g' \
 		$< >$@.tmp
 	chmod +x $@.tmp
 	mv $@.tmp $@

diff --git a/Portage.pm b/Portage.pm
index c7e236d..5443cf4 100644
--- a/Portage.pm
+++ b/Portage.pm
@@ -292,6 +292,7 @@ sub read_sh($) {
 
 sub read_use_mask() {
 	for my $dir(@profiles) {
+		-r "$dir/use.mask" or next;
 		for(noncomments "$dir/use.mask") {
 			my $off = s/^-//;
 			$use_masked_flags{$_} = { '' => !$off };
@@ -300,6 +301,7 @@ sub read_use_mask() {
 			my($pkg, @flags) = split;
 			for(@flags) {
 				my $off = s/^-//;
+
 				$use_masked_flags{$_}{''} ||= 0;
 				$use_masked_flags{$_}{$pkg} = !$off;
 			}

diff --git a/ufed.pl.in b/ufed.pl.in
index 3435dae..a66ac52 100644
--- a/ufed.pl.in
+++ b/ufed.pl.in
@@ -1,4 +1,4 @@
-#!@PERL@ -I@perldir@
+#!XX_PERL@
 use strict;
 use warnings;
 
@@ -6,9 +6,10 @@ use warnings;
 # Distributed under the terms of the GNU General Public License v2
 # $Header: /var/cvsroot/gentoo-src/ufed/ufed.pl,v 1.45 2005/10/18 11:14:33 truedfx Exp $
 
+use lib qw{XX_perldir@};
 use Portage;
 
-my $version = '@PACKAGE_VERSION@';
+my $version = 'XX_PACKAGE_VERSION@';
 
 my %use_descriptions;
 
@@ -23,7 +24,9 @@ read_use_descs;
 
 delete @use_descriptions{qw(bootstrap build)};
 
-$Portage::make_conf_flags{'-*'} = 1 if defined $Portage::make_conf_flags{'*'} && !$Portage::make_conf_flags{'*'};
+$Portage::make_conf_flags{'-*'} = 1
+	if defined $Portage::make_conf_flags{'*'}
+		&& !$Portage::make_conf_flags{'*'};
 
 for(keys %Portage::all_flags) {
 	@{$use_descriptions{$_}} = "(Unknown)"
@@ -76,7 +79,7 @@ sub flags_dialog() {
 		POSIX::dup2 $owrite, 4;
 		POSIX::close $owrite;
 		my $interface = 'ufed-curses';
-		exec { "@libexecdir@/$interface" } $interface or
+		exec { "XX_libexecdir@/$interface" } $interface or
 		do { print STDERR "Couldn't launch $interface\n"; exit 3 }
 	}
 	POSIX::close $iread;


^ permalink raw reply related	[flat|nested] 238+ messages in thread
* [gentoo-commits] proj/ufed:master commit in: /
@ 2013-01-16 12:56 Sven Eden
  0 siblings, 0 replies; 238+ messages in thread
From: Sven Eden @ 2013-01-16 12:56 UTC (permalink / raw
  To: gentoo-commits

commit:     bba5611120141abef8896f3e1c123db5ab317477
Author:     Sven Eden <sven.eden <AT> gmx <DOT> de>
AuthorDate: Mon Jan 14 18:08:59 2013 +0000
Commit:     Sven Eden <sven.eden <AT> gmx <DOT> de>
CommitDate: Mon Jan 14 18:08:59 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/ufed.git;a=commit;h=bba56111

Send list of (known) masked use flags to the interface. But do not allow to toggle masked flags using mouse or keyboard.

---
 ufed-curses-checklist.c |   16 +++++++++++++++-
 ufed.pl.in              |   43 ++++++++++++++++++++++++++++++-------------
 2 files changed, 45 insertions(+), 14 deletions(-)

diff --git a/ufed-curses-checklist.c b/ufed-curses-checklist.c
index 9123388..50dc1b4 100644
--- a/ufed-curses-checklist.c
+++ b/ufed-curses-checklist.c
@@ -96,6 +96,8 @@ static void read_flags(void) {
 			flag->on = '-';
 		else if(!strcmp(&line[on.start], "def"))
 			flag->on = ' ';
+		else if(!strcmp(&line[on.start], "msk"))
+			flag->on = 'm';
 		else
 			exit(-1);
 
@@ -173,12 +175,16 @@ static void drawflag(struct item *item, bool highlight) {
 	}
 	wmove(win(List), y, 0);
 	sprintf(buf, " %c%c%c %-*s %-4.4s ",
+		/* State of selection */
 		flag->on == ' ' ? '(' : '[',
 		flag->on == ' '
-			? flags->on == ' ' ? flag->state[1] : ' '
+			? flags->on == ' '
+				? flag->state[1] : ' '
 			: flag->on,
 		flag->on == ' ' ? ')' : ']',
+		/* distance and name being masked or not */
 		minwidth-11, flag->name,
+		/* current selection state */
 		flag->state);
 	if(d != &flag->descr[flag->item.height]) {
 		for(;;) {
@@ -292,6 +298,10 @@ static int callback(struct item **currentitem, int key) {
 			return 1;
 		break;
 	case ' ': {
+		// do not toggle masked flags using the keyboard
+		if ('m' == ((struct flag *) *currentitem)->on)
+			break;
+		// Not masked? Then cycle through the states.
 		switch (((struct flag *) *currentitem)->on) {
 		case '+':
 			((struct flag *) *currentitem)->on = '-';
@@ -327,6 +337,10 @@ static int callback(struct item **currentitem, int key) {
 		break;
 #ifdef NCURSES_MOUSE_VERSION
 	case KEY_MOUSE:
+		// do not toggle masked flags using the double click
+		if ('m' == ((struct flag *) *currentitem)->on)
+			break;
+		// Not masked? Then cycle through the states.
 		switch (((struct flag *) *currentitem)->on) {
 		case '+':
 			((struct flag *) *currentitem)->on = '-';

diff --git a/ufed.pl.in b/ufed.pl.in
index e7f9673..341cb55 100644
--- a/ufed.pl.in
+++ b/ufed.pl.in
@@ -12,7 +12,6 @@ use Portage;
 my $version = 'XX_PACKAGE_VERSION@';
 
 my %use_descriptions;
-my %masked_flags;
 my %masked_descriptions;
 
 sub finalise(@);
@@ -32,7 +31,7 @@ $Portage::make_conf_flags{'-*'} = 1
 
 for(keys %Portage::all_flags) {
 	@{$use_descriptions{$_}} = "(Unknown)"
-	if not exists $use_descriptions{$_};
+		if not exists $use_descriptions{$_};
 }
 @{$use_descriptions{'-*'}} = 'Never enable any flags other than those specified in make.conf';
 
@@ -47,8 +46,8 @@ for(keys %Portage::use_masked_flags) {
 		last if not($masked &&= $_);
 	}
 	if($masked) {
-		$masked_flags{$_}        = $Portage::all_flags{$_};
-		$masked_descriptions{$_} = $use_descriptions{$_};
+		@{$masked_descriptions{$_}} = @{$use_descriptions{$_}}
+			if (defined($use_descriptions{$_}));
 		delete $Portage::default_flags{$_};
 		delete $Portage::all_flags{$_};
 		delete $use_descriptions{$_};
@@ -89,15 +88,33 @@ sub flags_dialog() {
 	POSIX::close $iread;
 	POSIX::close $owrite;
 	if(open my $fh, '>&=', $iwrite) {
-		my @flags = sort { uc $a cmp uc $b } keys %use_descriptions;
-		my %descriptions;
-		for(my $flag=0; $flag<@flags; $flag++) {
-			my $flag = $flags[$flag];
-			print $fh $flag;
-			print $fh defined $Portage::make_conf_flags{$flag} ? $Portage::make_conf_flags{$flag} ? ' on ' : ' off ' : ' def ';
-			print $fh exists $Portage::make_defaults_flags{$flag} ? $Portage::make_defaults_flags{$flag} ? '(+' :'(-' :'( ' ;
-			print $fh exists     $Portage::make_conf_flags{$flag} ?     $Portage::make_conf_flags{$flag} ?  '+)': '-)': ' )';
-			print $fh ' ', scalar(@{$use_descriptions{$flag}}), "\n";
+		
+		# Write masked flags first so they sort at the beginning of the list
+		for my $flag (sort { uc $a cmp uc $b } keys %masked_descriptions) {
+			print $fh "(" . $flag . ") msk "
+			. (exists($Portage::make_defaults_flags{$flag})
+				? $Portage::make_defaults_flags{$flag} ? '(+' :'(-'
+				: '( ')
+			. (exists($Portage::make_conf_flags{$flag})
+				? $Portage::make_conf_flags{$flag}     ? '+)': '-)'
+				: ' )')
+			. ' ' . scalar(@{$masked_descriptions{$flag}}) . "\n";
+			print $fh $_, "\n" for(@{$masked_descriptions{$flag}});
+		}
+
+		# Then write regular flags
+		for my $flag (sort { uc $a cmp uc $b } keys %use_descriptions) {
+			print $fh $flag
+			. (defined($Portage::make_conf_flags{$flag})
+				? $Portage::make_conf_flags{$flag} ? ' on ' : ' off '
+				: ' def ' )
+			. (exists($Portage::make_defaults_flags{$flag})
+				? $Portage::make_defaults_flags{$flag} ? '(+' :'(-'
+				: '( ')
+			. (exists($Portage::make_conf_flags{$flag})
+				? $Portage::make_conf_flags{$flag}     ? '+)': '-)'
+				: ' )')
+			. ' ' . scalar(@{$use_descriptions{$flag}}) . "\n";
 			print $fh $_, "\n" for(@{$use_descriptions{$flag}});
 		}
 		close $fh;


^ permalink raw reply related	[flat|nested] 238+ messages in thread
* [gentoo-commits] proj/ufed:master commit in: /
@ 2013-01-16 12:56 Sven Eden
  0 siblings, 0 replies; 238+ messages in thread
From: Sven Eden @ 2013-01-16 12:56 UTC (permalink / raw
  To: gentoo-commits

commit:     dc50feb37e84cf3dec29eac69143d7e625734cf3
Author:     Sven Eden <sven.eden <AT> gmx <DOT> de>
AuthorDate: Wed Jan 16 08:05:49 2013 +0000
Commit:     Sven Eden <sven.eden <AT> gmx <DOT> de>
CommitDate: Wed Jan 16 08:05:49 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/ufed.git;a=commit;h=dc50feb3

Added filtering of now transported masked flags. These are not shown, yet,
because of the filter being turned off by default. A key to toggle the
filtering of masked flags is not implemented, yet.

With this commit ufed should not do anything different than in the past.

---
 ufed-curses-checklist.c |   69 +++++++++++++++++++++++++++++---------------
 ufed-curses.c           |   73 +++++++++++++++++++++++++++++++++-------------
 ufed-curses.h           |    5 +++
 3 files changed, 103 insertions(+), 44 deletions(-)

diff --git a/ufed-curses-checklist.c b/ufed-curses-checklist.c
index 50dc1b4..b43ecac 100644
--- a/ufed-curses-checklist.c
+++ b/ufed-curses-checklist.c
@@ -11,6 +11,41 @@
 
 #include "ufed-curses-help.h"
 
+/* internal types */
+struct flag {
+	struct item item;
+	char *name;
+	char on;
+	char *state;
+	char *descr[FLEXIBLE_ARRAY_MEMBER];
+};
+
+
+/* internal members */
+static struct flag *flags;
+static int descriptionleft;
+static char *fayt;
+static struct item **faytsave;
+
+#define mkKey(x) x, sizeof(x)-1
+static const struct key keys[] = {
+	{ '?',    mkKey("Help (?)")            },
+	{ '\n',   mkKey("Save (Return/Enter)") },
+	{ '\033', mkKey("Cancel (Esc)")        },
+	{ '\0',   mkKey("")                    }
+};
+#undef mkKey
+
+
+/* internal prototypes */
+static void free_flags(void);
+
+
+/* external members */
+enum mask showMasked = show_unmasked; //!< Set whether to show masked, unmasked or both flags
+
+
+/* static functions */
 static char *getline(FILE *fp) {
 	size_t size;
 	char *result;
@@ -45,22 +80,14 @@ static char *getline(FILE *fp) {
 		}
 		size += size/2;
 	}
+	return NULL; // never reached.
 }
 
-static struct flag {
-	struct item item;
-	char *name;
-	char on;
-	char *state;
-	char *descr[FLEXIBLE_ARRAY_MEMBER];
-} *flags;
-static int descriptionleft;
-
-static void free_flags(void);
 static void read_flags(void) {
 	FILE *input = fdopen(3, "r");
 	char *line;
 	int y=0;
+
 	if(input==NULL)
 		exit(-1);
 	atexit(&free_flags);
@@ -89,23 +116,29 @@ static void read_flags(void) {
 			minwidth = name.end-name.start+11;
 		flag->name = &line[name.start];
 
+		/* check and save current flag setting from configuration */
 		line[on.end] = '\0';
+		flag->item.isMasked = false;
 		if(!strcmp(&line[on.start], "on"))
 			flag->on = '+';
 		else if(!strcmp(&line[on.start], "off"))
 			flag->on = '-';
 		else if(!strcmp(&line[on.start], "def"))
 			flag->on = ' ';
-		else if(!strcmp(&line[on.start], "msk"))
+		else if(!strcmp(&line[on.start], "msk")) {
 			flag->on = 'm';
+			flag->item.isMasked = true;
+		}
 		else
 			exit(-1);
 
+		/* check and set flag state */
 		line[state.end] = '\0';
 		if(state.end-state.start != 4)
 			exit(-1);
 		flag->state = &line[state.start];
 
+		/* check and set flag item height */
 		flag->item.height = ndescr;
 		{ int i; for(i=0; i<ndescr; i++) {
 			flag->descr[i] = getline(input);
@@ -113,6 +146,7 @@ static void read_flags(void) {
 
 		y += ndescr;
 
+		/* Save flag in our linked list */
 		if(flags==NULL) {
 			flag->item.prev = (struct item *) flag;
 			flag->item.next = (struct item *) flag;
@@ -147,14 +181,6 @@ static void free_flags(void) {
 	}
 }
 
-static const struct key keys[] = {
-#define key(x) x, sizeof(x)-1
-	{ '?',    key("Help (?)")            },
-	{ '\n',   key("Save (Return/Enter)") },
-	{ '\033', key("Cancel (Esc)")        },
-	{ '\0',   key("")                    }
-#undef key
-};
 
 static void drawflag(struct item *item, bool highlight) {
 	struct flag *flag = (struct flag *) item;
@@ -182,7 +208,7 @@ static void drawflag(struct item *item, bool highlight) {
 				? flag->state[1] : ' '
 			: flag->on,
 		flag->on == ' ' ? ')' : ']',
-		/* distance and name being masked or not */
+		/* distance and name */
 		minwidth-11, flag->name,
 		/* current selection state */
 		flag->state);
@@ -214,9 +240,6 @@ static void drawflag(struct item *item, bool highlight) {
 	wnoutrefresh(win(List));
 }
 
-static char *fayt;
-static struct item **faytsave;
-
 static int callback(struct item **currentitem, int key) {
 	if(*fayt!='\0' && key!=KEY_BACKSPACE && (key==' ' || key!=(unsigned char) key || !isprint(key))) {
 		*fayt = '\0';

diff --git a/ufed-curses.c b/ufed-curses.c
index 14b41e3..65c4ba8 100644
--- a/ufed-curses.c
+++ b/ufed-curses.c
@@ -6,6 +6,7 @@
 #include <unistd.h>
 #include <locale.h>
 
+/* internal types */
 struct window window[wCount] = {
 	{ NULL,  0,  0,  5,  0 }, /* Top       */
 	{ NULL,  5,  0, -8,  3 }, /* Left      */
@@ -16,15 +17,22 @@ struct window window[wCount] = {
 	{ NULL, -3,  0,  3,  0 }, /* Bottom    */
 };
 
-static const char *subtitle;
 
+/* internal members */
+static const char *subtitle;
 static const struct key *keys;
-
 static struct item *items, *currentitem;
+
+
+/* external members */
 int topy, minwidth;
+extern enum mask showMasked;
 
+/* internal prototypes */
 static void checktermsize(void);
 
+
+/* internal functions */
 void initcurses(void) {
 	setlocale(LC_CTYPE, "");
 	initscr();
@@ -71,19 +79,35 @@ static void checktermsize(void) {
 static void (*drawitem)(struct item *, bool);
 
 void drawitems(void) {
-	struct item *item;
-	int y;
+	struct item *item = currentitem;
+	int y = item->top - topy;
 
-	item = currentitem;
-	while((y=item->top-topy) > 0)
+	/* move to the top of the displayed list */
+	for ( ; (y > 0) && item; y = item->top - topy)
 		item = item->prev;
 
+	/* advance in the list if the top item would be a masked
+	 * flag that is to be filtered out.
+	 * This is needed in two situations. First at the very start
+	 * of the program and second whenever the filtering is
+	 * toggled. The latter resets the list position to guarantee
+	 * a valid display.
+	 */
+	if ((show_unmasked == showMasked) && item->isMasked) {
+		while (item && item->isMasked) {
+			if (currentitem == item)
+				currentitem = item->next;
+			topy += item->height;
+			item  = item->next;
+		}
+	}
+
 	for(;;) {
 		if(item!=currentitem)
 			(*drawitem)(item, FALSE);
 		y += item->height;
 		item = item->next;
-		if(y>=wHeight(List))
+		if(y >= wHeight(List))
 			break;
 		if(item==items) {
 			char buf[wWidth(List)];
@@ -221,9 +245,9 @@ static void draw(void) {
 
 void scrollcurrent(void) {
 	if(currentitem->top < topy)
-		topy = max(currentitem->top, currentitem->top+currentitem->height-wHeight(List));
-	else if(currentitem->top+currentitem->height > topy+wHeight(List))
-		topy = min(currentitem->top+currentitem->height-wHeight(List), currentitem->top);
+		topy = max(currentitem->top, currentitem->top + currentitem->height - wHeight(List));
+	else if( (currentitem->top + currentitem->height) > (topy + wHeight(List)))
+		topy = min(currentitem->top + currentitem->height - wHeight(List), currentitem->top);
 	else
 		return;
 	drawitems();
@@ -267,6 +291,7 @@ bool yesno(const char *prompt) {
 				break;
 #endif
 	}
+	return FALSE;
 }
 
 int maineventloop(
@@ -313,7 +338,8 @@ int maineventloop(
 		if(c==KEY_MOUSE) {
 			MEVENT event;
 			if(getmouse(&event)==OK) {
-				if(mousekey != ERR && event.bstate & (BUTTON1_CLICKED | BUTTON1_DOUBLE_CLICKED | BUTTON1_RELEASED)) {
+				if( (mousekey != ERR)
+					&& (event.bstate & (BUTTON1_CLICKED | BUTTON1_DOUBLE_CLICKED | BUTTON1_RELEASED)) ) {
 					cbreak();
 					mousekey = ERR;
 					if(!(event.bstate & (BUTTON1_CLICKED | BUTTON1_DOUBLE_CLICKED)))
@@ -344,8 +370,8 @@ int maineventloop(
 						(*drawitem)(currentitem, TRUE);
 					}
 				} else if(wmouse_trafo(win(Scrollbar), &event.y, &event.x, FALSE)) {
-					if(event.bstate & (BUTTON1_PRESSED | BUTTON1_CLICKED | BUTTON1_DOUBLE_CLICKED)
-					 && event.y < wHeight(Scrollbar)-1) {
+					if( (event.bstate & (BUTTON1_PRESSED | BUTTON1_CLICKED | BUTTON1_DOUBLE_CLICKED))
+					 && (event.y < wHeight(Scrollbar)-1) ) {
 						halfdelay(1);
 
 #define SIM(key) \
@@ -371,8 +397,6 @@ int maineventloop(
 								for(;;) {
 									c = getch();
 									switch(c) {
-									default:
-										goto check_key;
 									case ERR:
 										continue;
 									case KEY_MOUSE:
@@ -393,14 +417,17 @@ int maineventloop(
 												wrefresh(win(List));
 											}
 										}
+										break;
+									default:
+										goto check_key;
 									}
 									break;
 								}
 							}
 					}
 				} else if(wmouse_trafo(win(Bottom), &event.y, &event.x, FALSE)) {
-					if(event.bstate & (BUTTON1_CLICKED | BUTTON1_DOUBLE_CLICKED)
-					 && event.y == 1) {
+					if( (event.bstate & (BUTTON1_CLICKED | BUTTON1_DOUBLE_CLICKED))
+					 && (event.y == 1) ) {
 						const struct key *key;
 						int x = event.x;
 						if(x < 2)
@@ -437,11 +464,13 @@ int maineventloop(
 
 			switch(c) {
 				case KEY_UP:
-					if(currentitem->top<topy) {
+					if(currentitem->top < topy ) {
 						(*drawitem)(currentitem, FALSE);
 						topy--;
 						(*drawitem)(currentitem, TRUE);
-					} else if(currentitem!=items || topy>currentitem->top) {
+					} else if( (currentitem!=items || topy>currentitem->top)
+							&& (	!currentitem->prev->isMasked
+								||	(show_unmasked != showMasked)) ) {
 						(*drawitem)(currentitem, FALSE);
 						currentitem = currentitem->prev;
 						scrollcurrent();
@@ -450,11 +479,13 @@ int maineventloop(
 					break;
 	
 				case KEY_DOWN:
-					if(currentitem->top+currentitem->height>topy+wHeight(List)) {
+					if( (currentitem->top + currentitem->height) > (topy + wHeight(List)) ) {
 						(*drawitem)(currentitem, FALSE);
 						topy++;
 						(*drawitem)(currentitem, TRUE);
-					} else if(currentitem->next!=items) {
+					} else if( (currentitem->next != items)
+							&& (	currentitem->next->isMasked
+								||	(show_masked != showMasked)) ){
 						(*drawitem)(currentitem, FALSE);
 						currentitem = currentitem->next;
 						scrollcurrent();

diff --git a/ufed-curses.h b/ufed-curses.h
index 8730d36..7a97c3e 100644
--- a/ufed-curses.h
+++ b/ufed-curses.h
@@ -5,14 +5,19 @@
 #include <curses.h>
 
 enum win { Top, Left, List, Input, Scrollbar, Right, Bottom, wCount };
+enum mask { show_unmasked, show_both, show_masked };
+
 struct window {
 	WINDOW *win;
 	const int top, left, height, width;
 };
+
 struct item {
 	struct item *prev, *next;
 	int top, height;
+	bool isMasked;
 };
+
 struct key {
 	char key;
 	const char *descr;


^ permalink raw reply related	[flat|nested] 238+ messages in thread
* [gentoo-commits] proj/ufed:master commit in: /
@ 2013-01-16 12:56 Sven Eden
  0 siblings, 0 replies; 238+ messages in thread
From: Sven Eden @ 2013-01-16 12:56 UTC (permalink / raw
  To: gentoo-commits

commit:     10f0d42fa883ece4b2afc6be2eafb29f7cdf9a62
Author:     Sven Eden <sven.eden <AT> gmx <DOT> de>
AuthorDate: Wed Jan 16 08:57:31 2013 +0000
Commit:     Sven Eden <sven.eden <AT> gmx <DOT> de>
CommitDate: Wed Jan 16 08:57:31 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/ufed.git;a=commit;h=10f0d42f

Added checks to disallow breaking the masked/unmasked flag filtering
using PGUP, PGDN, HOME, END or the flag search by keywords.

This is a preparation to finally add a masked flag display toggle.

---
 ufed-curses-checklist.c |   22 ++++++++++++++++++----
 ufed-curses.c           |   28 +++++++++++++++++++++-------
 2 files changed, 39 insertions(+), 11 deletions(-)

diff --git a/ufed-curses-checklist.c b/ufed-curses-checklist.c
index b43ecac..2f3432d 100644
--- a/ufed-curses-checklist.c
+++ b/ufed-curses-checklist.c
@@ -262,14 +262,28 @@ static int callback(struct item **currentitem, int key) {
 			faytsave[n] = *currentitem;
 			n++;
 			fayt[n] = '\0';
+
+			/* if the current flag already matches the input string,
+			 * then update the input area only.
+			 */
 			if(strncasecmp(((struct flag *) item)->name, fayt, n)==0) {
 				wattrset(win(Input), COLOR_PAIR(3) | A_BOLD);
 				mvwaddstr(win(Input), 0, 0, fayt);
 				wrefresh(win(Input));
-			} else {
+			}
+			/* if the current flag does not match, search one that does. */
+			else {
 				do item = item->next;
 				while(item!=*currentitem && strncasecmp(((struct flag *) item)->name, fayt, n)!=0);
-				if(item==*currentitem) {
+
+				/* if there was no match (or the match is filtered),
+				 * update the input area to show that there is no match
+				 */
+				if ( (item == *currentitem)
+					|| ( item->isMasked && (show_unmasked == showMasked))
+					|| (!item->isMasked && (show_masked   == showMasked)) ) {
+					if (item != *currentitem)
+						item = *currentitem;
 					wattrset(win(Input), COLOR_PAIR(4) | A_BOLD | A_REVERSE);
 					mvwaddstr(win(Input), 0, 0, fayt);
 					wmove(win(Input), 0, n-1);
@@ -322,7 +336,7 @@ static int callback(struct item **currentitem, int key) {
 		break;
 	case ' ': {
 		// do not toggle masked flags using the keyboard
-		if ('m' == ((struct flag *) *currentitem)->on)
+		if ((*currentitem)->isMasked)
 			break;
 		// Not masked? Then cycle through the states.
 		switch (((struct flag *) *currentitem)->on) {
@@ -361,7 +375,7 @@ static int callback(struct item **currentitem, int key) {
 #ifdef NCURSES_MOUSE_VERSION
 	case KEY_MOUSE:
 		// do not toggle masked flags using the double click
-		if ('m' == ((struct flag *) *currentitem)->on)
+		if ((*currentitem)->isMasked)
 			break;
 		// Not masked? Then cycle through the states.
 		switch (((struct flag *) *currentitem)->on) {

diff --git a/ufed-curses.c b/ufed-curses.c
index 65c4ba8..edaef38 100644
--- a/ufed-curses.c
+++ b/ufed-curses.c
@@ -497,9 +497,12 @@ int maineventloop(
 					if(currentitem!=items) {
 						struct item *olditem = currentitem;
 						(*drawitem)(currentitem, FALSE);
-						do currentitem = currentitem->prev;
-						while(currentitem!=items
-						 && olditem->top - currentitem->prev->top <= wHeight(List));
+						while( (currentitem != items)
+							&& ( (olditem->top - currentitem->prev->top) <= wHeight(List))
+							&& ( (	!currentitem->prev->isMasked
+								||	(show_unmasked != showMasked)) ) ) {
+							currentitem = currentitem->prev;
+						}
 						scrollcurrent();
 						(*drawitem)(currentitem, TRUE);
 					}
@@ -509,10 +512,13 @@ int maineventloop(
 					if(currentitem->next!=items) {
 						struct item *olditem = currentitem;
 						(*drawitem)(currentitem, FALSE);
-						do currentitem = currentitem->next;
-						while(currentitem->next!=items
-						 && (currentitem->next->top + currentitem->next->height)
-						     - (olditem->top + olditem->height) <= wHeight(List));
+						while( (currentitem->next != items)
+							&& (((currentitem->next->top + currentitem->next->height)
+								-(olditem->top + olditem->height) ) <= wHeight(List))
+							&& ( (	currentitem->next->isMasked
+								||	(show_masked != showMasked)) ) ) {
+							currentitem = currentitem->next;
+						}
 						scrollcurrent();
 						(*drawitem)(currentitem, TRUE);
 					}
@@ -522,6 +528,10 @@ int maineventloop(
 					if(currentitem!=items) {
 						(*drawitem)(currentitem, FALSE);
 						currentitem = items;
+						if (show_unmasked == showMasked) {
+							while (currentitem->isMasked)
+								currentitem = currentitem->next;
+						}
 						scrollcurrent();
 						(*drawitem)(currentitem, TRUE);
 					}
@@ -531,6 +541,10 @@ int maineventloop(
 					if(currentitem->next!=items) {
 						(*drawitem)(currentitem, FALSE);
 						currentitem = items->prev;
+						if (show_masked == showMasked) {
+							while (!currentitem->isMasked)
+								currentitem = currentitem->prev;
+						}
 						scrollcurrent();
 						(*drawitem)(currentitem, TRUE);
 					}


^ permalink raw reply related	[flat|nested] 238+ messages in thread
* [gentoo-commits] proj/ufed:master commit in: /
@ 2013-01-08 11:02 Sven Eden
  0 siblings, 0 replies; 238+ messages in thread
From: Sven Eden @ 2013-01-08 11:02 UTC (permalink / raw
  To: gentoo-commits

commit:     37ac066c6d2ba2ed1c4a61ba892bb8b52f28dbf4
Author:     Sven Eden <sven.eden <AT> gmx <DOT> de>
AuthorDate: Tue Jan  8 11:03:51 2013 +0000
Commit:     Sven Eden <sven.eden <AT> gmx <DOT> de>
CommitDate: Tue Jan  8 11:03:51 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/ufed.git;a=commit;h=37ac066c

Replaced another mentioning of use.defaults in the man page that i missed (obviously) earlier.

---
 ufed.8 |   28 ++++++++++++++--------------
 1 files changed, 14 insertions(+), 14 deletions(-)

diff --git a/ufed.8 b/ufed.8
index 4bc2f9a..8b8c5cb 100644
--- a/ufed.8
+++ b/ufed.8
@@ -5,20 +5,20 @@ ufed \- Gentoo Linux USE flags editor
 .B ufed 
 .SH "DESCRIPTION"
 UFED is a simple program designed to help you configure the systems USE flags
-(see below) to your liking.  To select of unselect a flag highlight it and hit
+(see below) to your liking.  To select or unselect a flag highlight it and hit
 space.
 
-UFED attempts to show you where a  particular use setting came from.  Each USE
+UFED attempts to show you where a particular use setting came from. Each USE
 flag has a 3 character descriptor that represents the three ways a use flag can
 be set.
 
-The 1st char is the setting from the make.defaults file.  These are the defaults
+The 1st char is the setting from the make.defaults file(s). These are the defaults
 for Gentoo as a whole. These should not be changed.
 
-The 2nd char is the setting from the use.defaults file. These will change as
-packages are added and removes from the system.
+The 2nd char is the setting from the package.use file(s). These will change as
+packages are added or removed from the system.
 
-The 3rd char is the settings from the make.conf file. these are the only ones
+The 3rd char is the setting from the make.conf file. These are the only ones
 that should be changed by the user and these are the ones that UFED changes.
 
 If the character is a + then that USE flag was set in that file, if it is a
@@ -29,23 +29,23 @@ flag was unset in that file.
 
 The USE settings system is a flexible way to enable or disable various features
 at package build-time on a global level and for individual packages. This
-allows an administrator control over how packages are built in regards to the
+allows an administrator to control how packages are built in regards to the
 optional features which can be compiled into those packages.
 
 For instance, packages with optional GNOME support can have this support
-disabled at compile time by disabling the "gnome" USE setting. Enabling the
-"gnome" USE setting would enable GNOME support in these same packages.
+disabled at compile time by disabling the "gnome" USE flag. Enabling the
+"gnome" USE flag would enable GNOME support in these packages.
 
-The effect of USE settings on packages is dependent on whether both the
-software itself and the package ebuild supports the USE setting as an optional
+The effect of USE flags on packages is dependent on whether both the
+software itself and the package ebuild supports the USE flag as an optional
 feature. If the software does not have support for an optional feature then the
-corresponding USE setting will obviously have no effect.
+corresponding USE flag will obviously have no effect.
 
 Also many package dependencies are not considered optional by the software and
-thus USE settings will have no effect on those mandatory dependencies.
+thus USE flags will have no effect on those mandatory dependencies.
 
 A list of USE keywords used by a particular package can be found by checking
-the IUSE line in any ebuild file.
+the IUSE line in any ebuild file or by using "equery" from gentoolkit.
 
 See http://www.gentoo.org/doc/en/handbook/handbook-x86.xml?part=2&chap=2
 for more information on USE flags.


^ permalink raw reply related	[flat|nested] 238+ messages in thread
* [gentoo-commits] proj/ufed:master commit in: /
@ 2013-01-02  8:47 Sven Eden
  0 siblings, 0 replies; 238+ messages in thread
From: Sven Eden @ 2013-01-02  8:47 UTC (permalink / raw
  To: gentoo-commits

commit:     f3cf8171cccb65f4b33f7d8be12ae1605d4fc1a8
Author:     Sven Eden <sven.eden <AT> gmx <DOT> de>
AuthorDate: Wed Jan  2 08:47:54 2013 +0000
Commit:     Sven Eden <sven.eden <AT> gmx <DOT> de>
CommitDate: Wed Jan  2 08:47:54 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/ufed.git;a=commit;h=f3cf8171

Updated man page file. use.defaults no longer exist, per package default USE flags are defined in package.use.

---
 ufed.8 |   10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/ufed.8 b/ufed.8
index f42fdc1..4bc2f9a 100644
--- a/ufed.8
+++ b/ufed.8
@@ -65,17 +65,19 @@ Please report bugs via http://bugs.gentoo.org/
 .TP
 \fB@GENTOO_PORTAGE_EPREFIX@/etc/make.conf\fR 
 \fB@GENTOO_PORTAGE_EPREFIX@/etc/portage/make.conf\fR 
+.br
 Contains user specified USE flags
 .TP
-\fB@GENTOO_PORTAGE_EPREFIX@/etc/make.conf.old \fR
-\fB@GENTOO_PORTAGE_EPREFIX@/etc/portage/make.conf.old \fR
+\fB@GENTOO_PORTAGE_EPREFIX@/etc/make.conf.old\fR
+\fB@GENTOO_PORTAGE_EPREFIX@/etc/portage/make.conf.old\fR
+.br
 This is where ufed places a backup of your make.conf file.
 .TP
 \fB@GENTOO_PORTAGE_EPREFIX@/etc/make.profile/make.defaults\fR
 Contains system default USE flags
 .TP
-\fB@GENTOO_PORTAGE_EPREFIX@/etc/make.profile/use.defaults\fR
-Provides an automatic ebuild to USE flag mapping ('auto' flags)
+\fB@GENTOO_PORTAGE_EPREFIX@/etc/make.profile/package.use\fR
+Contains per package default USE flags
 .TP
 \fB@GENTOO_PORTAGE_EPREFIX@/etc/make.profile/use.mask\fR
 Restricted USE flags


^ permalink raw reply related	[flat|nested] 238+ messages in thread
* [gentoo-commits] proj/ufed:master commit in: /
@ 2013-01-02  8:01 Sven Eden
  0 siblings, 0 replies; 238+ messages in thread
From: Sven Eden @ 2013-01-02  8:01 UTC (permalink / raw
  To: gentoo-commits

commit:     2488bcf1d3c658cba60c8bf51f583d7fe461b318
Author:     Sven Eden <sven.eden <AT> gmx <DOT> de>
AuthorDate: Wed Jan  2 07:21:09 2013 +0000
Commit:     Sven Eden <sven.eden <AT> gmx <DOT> de>
CommitDate: Wed Jan  2 07:21:09 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/ufed.git;a=commit;h=2488bcf1

Added some automatically generated files to .gitignore

---
 .gitignore |   11 +++++++++++
 1 files changed, 11 insertions(+), 0 deletions(-)

diff --git a/.gitignore b/.gitignore
index 36aebc7..bdb3c38 100644
--- a/.gitignore
+++ b/.gitignore
@@ -5,3 +5,14 @@ configure
 Makefile
 Makefile.in
 run
+.??*
+TODO
+*~
+*.bak
+*.old
+*.o
+config.*
+!config.h.in
+stamp*
+ufed
+ufed-curses


^ permalink raw reply related	[flat|nested] 238+ messages in thread
* [gentoo-commits] proj/ufed:master commit in: /
@ 2013-01-02  8:01 Sven Eden
  0 siblings, 0 replies; 238+ messages in thread
From: Sven Eden @ 2013-01-02  8:01 UTC (permalink / raw
  To: gentoo-commits

commit:     6106f530caf229485db7d71a310450678ef5289f
Author:     Sven Eden <sven.eden <AT> gmx <DOT> de>
AuthorDate: Wed Jan  2 07:22:40 2013 +0000
Commit:     Sven Eden <sven.eden <AT> gmx <DOT> de>
CommitDate: Wed Jan  2 07:22:40 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/ufed.git;a=commit;h=6106f530

Updated AC_PREREQ to current version, added warning flags to CFLAGS (important for later development) and corrected AC_PATH_PROG() for perl, the current version of autoconf needs a mandatory third argument.

---
 configure.ac |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/configure.ac b/configure.ac
index fa17bd3..bf34d16 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,4 +1,4 @@
-AC_PREREQ(2.63)
+AC_PREREQ(2.68)
 AC_INIT([ufed],[git],[https://bugs.gentoo.org/])
 AM_INIT_AUTOMAKE([foreign -Wall -Werror])
 AC_CONFIG_SRCDIR([ufed-curses.c])
@@ -8,12 +8,14 @@ AC_PROG_CC
 AC_PROG_CC_C99
 if test "$ac_cv_prog_cc_c99" != no
 then
+	CFLAGS="$CFLAGS -Wall -Wextra -pedantic"
 	CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE=600"
 	AC_DEFINE([FLEXIBLE_ARRAY_MEMBER], [])
 else
 	AC_PROG_CC_C89
 	AC_C_INLINE
 	AC_C_FLEXIBLE_ARRAY_MEMBER
+	CFLAGS="$CFLAGS -Wall -W"
 	CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE=500"
 fi
 
@@ -23,7 +25,7 @@ AC_ARG_WITH([curses],
 	[curses="ncursesw ncurses curses"])
 AC_SEARCH_LIBS([initscr], [$curses], [], [AC_MSG_ERROR([curses library not found])])
 
-AC_PATH_PROG([PERL], [perl])
+AC_PATH_PROG([PERL], [perl], [])
 
 AC_CONFIG_FILES([Makefile])
 AC_OUTPUT


^ permalink raw reply related	[flat|nested] 238+ messages in thread
* [gentoo-commits] proj/ufed:master commit in: /
@ 2012-11-20 17:31 Paul Varner
  0 siblings, 0 replies; 238+ messages in thread
From: Paul Varner @ 2012-11-20 17:31 UTC (permalink / raw
  To: gentoo-commits

commit:     0f67e677776c6a5b6a095c3c2486a2184a5427a0
Author:     Paul Varner <fuzzyray <AT> gentoo <DOT> org>
AuthorDate: Tue Nov 20 17:28:57 2012 +0000
Commit:     Paul Varner <fuzzyray <AT> gentoo <DOT> org>
CommitDate: Tue Nov 20 17:28:57 2012 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/ufed.git;a=commit;h=0f67e677

Update handbook URL for more information on USE flags

---
 ufed.8 |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/ufed.8 b/ufed.8
index 4c55c29..f42fdc1 100644
--- a/ufed.8
+++ b/ufed.8
@@ -47,7 +47,7 @@ thus USE settings will have no effect on those mandatory dependencies.
 A list of USE keywords used by a particular package can be found by checking
 the IUSE line in any ebuild file.
 
-See http://www.gentoo.org/doc/en/handbook/handbook-x86.xml?part=2&chap=1
+See http://www.gentoo.org/doc/en/handbook/handbook-x86.xml?part=2&chap=2
 for more information on USE flags.
 
 Please also note that if UFED describes a flag (Unknown) it generally means


^ permalink raw reply related	[flat|nested] 238+ messages in thread
* [gentoo-commits] proj/ufed:master commit in: /
@ 2012-11-20 17:25 Paul Varner
  0 siblings, 0 replies; 238+ messages in thread
From: Paul Varner @ 2012-11-20 17:25 UTC (permalink / raw
  To: gentoo-commits

commit:     7d133e58b27253ebc1bcfc16fa45ef91125ccde9
Author:     Paul Varner <fuzzyray <AT> gentoo <DOT> org>
AuthorDate: Tue Nov 20 17:22:09 2012 +0000
Commit:     Paul Varner <fuzzyray <AT> gentoo <DOT> org>
CommitDate: Tue Nov 20 17:22:09 2012 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/ufed.git;a=commit;h=7d133e58

Change ufed to use EPREFIX for prefix installs.

---
 Portage.pm         |   26 ++++++++++++++++++--------
 ufed-curses-help.c |    7 +++----
 ufed.8             |   29 +++++++++++++++--------------
 ufed.pl.in         |    6 +++---
 4 files changed, 39 insertions(+), 29 deletions(-)

diff --git a/Portage.pm b/Portage.pm
index 0b02cab..c7e236d 100644
--- a/Portage.pm
+++ b/Portage.pm
@@ -15,7 +15,9 @@ our %default_flags;
 our %make_conf_flags;
 our %archs;
 our %all_flags;
+our $eprefix;
 
+sub get_eprefix();
 sub have_package($);
 sub merge(\%%);
 sub merge_env(\%);
@@ -30,6 +32,7 @@ sub read_profiles();
 sub read_sh($);
 sub read_use_mask();
 
+get_eprefix;
 read_packages;
 read_profiles;
 read_use_mask;
@@ -54,6 +57,13 @@ if($lastorder ne 'conf') {
 	die "Sorry, USE_ORDER without make.conf overriding global USE flags are not currently supported by ufed.\n";
 }
 
+
+sub get_eprefix() {
+	$eprefix = `portageq envvar EPREFIX 2>&1`;
+	die "Couldn't determine EPREFIX from Portage" if $? != 0;
+	chomp($eprefix);
+}
+
 sub have_package($) {
 	my ($cp) = @_;
 	return $packages{$cp};
@@ -130,8 +140,8 @@ sub read_archs() {
 }
 
 sub read_make_conf() {
-	my %env = read_sh "/etc/make.conf";
-	merge (%env, read_sh('/etc/portage/make.conf'));
+	my %env = read_sh "$eprefix/etc/make.conf";
+	merge (%env, read_sh("$eprefix/etc/portage/make.conf"));
 	merge %make_conf_flags, %{$env{USE}} if exists $env{USE};
 	@portagedirs = $environment{PORTDIR};
 	push @portagedirs, split ' ', $environment{PORTDIR_OVERLAY} if defined $environment{PORTDIR_OVERLAY};
@@ -145,13 +155,13 @@ sub read_make_defaults() {
 }
 
 sub read_make_globals() {
-	for my $dir(@profiles, '/usr/share/portage/config') {
+	for my $dir(@profiles, "$eprefix/usr/share/portage/config") {
 		read_sh "$dir/make.globals";
 	}
 }
 
 sub read_packages() {
-	die "Couldn't read /var/db/pkg\n" unless opendir my $pkgdir, '/var/db/pkg';
+	die "Couldn't read $eprefix/var/db/pkg\n" unless opendir my $pkgdir, "$eprefix/var/db/pkg";
 	while(my $cat = readdir $pkgdir) {
 		next if $cat eq '.' or $cat eq '..';
 		next unless opendir my $catdir, "/var/db/pkg/$cat";
@@ -199,16 +209,16 @@ sub read_packages() {
 }
 
 sub read_profiles() {
-	$_ = readlink '/etc/make.profile';
-	$_ = readlink '/etc/portage/make.profile' if not defined $_;
-	die "/etc\{,/portage\}/make.profile is not a symlink\n" if not defined $_;
+	$_ = readlink "$eprefix/etc/make.profile";
+	$_ = readlink "$eprefix/etc/portage/make.profile" if not defined $_;
+	die "$eprefix/etc\{,/portage\}/make.profile is not a symlink\n" if not defined $_;
 	@profiles = norm_path '/etc', $_;
 	for (my $i = -1; $i >= -@profiles; $i--) {
 		for(noncomments "$profiles[$i]/parent") {
 			splice @profiles, $i, 0, norm_path $profiles[$i], $_;
 		}
 	}
-	push @profiles, '/etc/portage/profile';
+	push @profiles, "$eprefix/etc/portage/profile";
 }
 
 sub read_sh($) {

diff --git a/ufed-curses-help.c b/ufed-curses-help.c
index 19679bb..79bd35e 100644
--- a/ufed-curses-help.c
+++ b/ufed-curses-help.c
@@ -40,11 +40,10 @@ static void init_lines(void) {
 "Each USE flag has a 2 character descriptor that represents the two "
 "ways a use flag can be set.",
 "",
-"The 1st char is the setting from the /etc/make.profile/make.defaults "
-"file. These are the defaults for Gentoo as a whole. These should not be "
-"changed.",
+"The 1st char is the setting from the make.defaults file. These are "
+"the defaults for Gentoo as a whole. These should not be changed.",
 "",
-"The 2nd char is the settings from the /etc/make.conf file. these are "
+"The 2nd char is the settings from the make.conf file. these are "
 "the only ones that should be changed by the user and these are the ones "
 "that ufed changes.",
 "",

diff --git a/ufed.8 b/ufed.8
index 7d7fe50..4c55c29 100644
--- a/ufed.8
+++ b/ufed.8
@@ -12,15 +12,14 @@ UFED attempts to show you where a  particular use setting came from.  Each USE
 flag has a 3 character descriptor that represents the three ways a use flag can
 be set.
 
-The 1st char is the setting from the /etc/make.profile/make.defaults file.
-These are the defaults for Gentoo as a whole. These should not be changed.
+The 1st char is the setting from the make.defaults file.  These are the defaults
+for Gentoo as a whole. These should not be changed.
 
-The 2nd char is the setting from the /etc/make.profile/use.defaults file. These
-will change as packages are added and removes from the system.
+The 2nd char is the setting from the use.defaults file. These will change as
+packages are added and removes from the system.
 
-The 3rd char is the settings from the /etc/make.conf file. these are the only
-ones that should be changed by the user and these are the ones that UFED
-changes.
+The 3rd char is the settings from the make.conf file. these are the only ones
+that should be changed by the user and these are the ones that UFED changes.
 
 If the character is a + then that USE flag was set in that file, if it is a
 space then the flag was not mentioned in that file and if it is a - then that
@@ -64,25 +63,27 @@ Please report bugs via http://bugs.gentoo.org/
 .BR make.conf (5)
 .SH "FILES"
 .TP
-\fB/etc/make.conf\fR 
+\fB@GENTOO_PORTAGE_EPREFIX@/etc/make.conf\fR 
+\fB@GENTOO_PORTAGE_EPREFIX@/etc/portage/make.conf\fR 
 Contains user specified USE flags
 .TP
-\fB/etc/make.conf.old \fR
+\fB@GENTOO_PORTAGE_EPREFIX@/etc/make.conf.old \fR
+\fB@GENTOO_PORTAGE_EPREFIX@/etc/portage/make.conf.old \fR
 This is where ufed places a backup of your make.conf file.
 .TP
-\fB/etc/make.profile/make.defaults\fR
+\fB@GENTOO_PORTAGE_EPREFIX@/etc/make.profile/make.defaults\fR
 Contains system default USE flags
 .TP
-\fB/etc/make.profile/use.defaults\fR
+\fB@GENTOO_PORTAGE_EPREFIX@/etc/make.profile/use.defaults\fR
 Provides an automatic ebuild to USE flag mapping ('auto' flags)
 .TP
-\fB/etc/make.profile/use.mask\fR
+\fB@GENTOO_PORTAGE_EPREFIX@/etc/make.profile/use.mask\fR
 Restricted USE flags
 .TP
-\fB/usr/portage/profiles/use.desc\fR
+\fB@GENTOO_PORTAGE_EPREFIX@/usr/portage/profiles/use.desc\fR
 Description strings for global USE flags
 .TP
-\fB/usr/portage/profiles/use.local.desc\fR
+\fB@GENTOO_PORTAGE_EPREFIX@/usr/portage/profiles/use.local.desc\fR
 Description strings for local USE flags
 .SH "AUTHORS"
 Robin Johnson <robbat2@gentoo.org>

diff --git a/ufed.pl.in b/ufed.pl.in
index 7493147..3435dae 100644
--- a/ufed.pl.in
+++ b/ufed.pl.in
@@ -29,7 +29,7 @@ for(keys %Portage::all_flags) {
 	@{$use_descriptions{$_}} = "(Unknown)"
 	if not exists $use_descriptions{$_};
 }
-@{$use_descriptions{'-*'}} = 'Never enable any flags other than those specified in /etc/make.conf';
+@{$use_descriptions{'-*'}} = 'Never enable any flags other than those specified in make.conf';
 
 for(@Portage::archs) {
 	delete $Portage::default_flags{$_};
@@ -155,8 +155,8 @@ sub save_flags(@) {
 	my (@flags) = @_;
 	my $contents;
 
-	my $makeconf_name = '/etc/portage/make.conf';
-	$makeconf_name = '/etc/make.conf' unless(-r $makeconf_name);
+	my $makeconf_name = "$Portage::eprefix/etc/portage/make.conf";
+	$makeconf_name = "$Portage::eprefix/etc/make.conf" unless(-r $makeconf_name);
 	{
 		open my $makeconf, '<', $makeconf_name or die "Couldn't open $makeconf_name\n";
 		open my $makeconfold, '>', $makeconf_name . '.old' or die "Couldn't open $makeconf_name.old\n";


^ permalink raw reply related	[flat|nested] 238+ messages in thread
* [gentoo-commits] proj/ufed:master commit in: /
@ 2012-10-23 16:13 Paul Varner
  0 siblings, 0 replies; 238+ messages in thread
From: Paul Varner @ 2012-10-23 16:13 UTC (permalink / raw
  To: gentoo-commits

commit:     a6fa7fa7cb9ba8427cf9f7929d8a1340e9d62257
Author:     Paul Varner <fuzzyray <AT> gentoo <DOT> org>
AuthorDate: Tue Oct 23 16:12:40 2012 +0000
Commit:     Paul Varner <fuzzyray <AT> gentoo <DOT> org>
CommitDate: Tue Oct 23 16:12:40 2012 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/ufed.git;a=commit;h=a6fa7fa7

Write into correct make.conf. (Bug 434672)

Patch supplied by Martin Väth

---
 ufed.pl.in |   10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/ufed.pl.in b/ufed.pl.in
index 06d5642..7493147 100644
--- a/ufed.pl.in
+++ b/ufed.pl.in
@@ -155,9 +155,11 @@ sub save_flags(@) {
 	my (@flags) = @_;
 	my $contents;
 
+	my $makeconf_name = '/etc/portage/make.conf';
+	$makeconf_name = '/etc/make.conf' unless(-r $makeconf_name);
 	{
-		open my $makeconf, '<', '/etc/make.conf' or die "Couldn't open /etc/make.conf\n";
-		open my $makeconfold, '>', '/etc/make.conf.old' or die "Couldn't open /etc/make.conf.old\n";
+		open my $makeconf, '<', $makeconf_name or die "Couldn't open $makeconf_name\n";
+		open my $makeconfold, '>', $makeconf_name . '.old' or die "Couldn't open $makeconf_name.old\n";
 		local $/;
 		$_ = <$makeconf>;
 		print $makeconfold $_;
@@ -292,11 +294,11 @@ sub save_flags(@) {
 	die "Parse error when writing make.conf - did you modify it while ufed was running?\n" if $@;
 
 	print STDERR <<EOF if $sourcing;
-Warning: source command found in /etc/make.conf. Flags may
+Warning: source command found in $makeconf_name. Flags may
 be saved incorrectly if the sourced file modifies them.
 EOF
 	{
-		open my $makeconf, '>', '/etc/make.conf' or die "Couldn't open /etc/make.conf\n";
+		open my $makeconf, '>', $makeconf_name or die "Couldn't open $makeconf_name\n";
 		print $makeconf $_;
 		close $makeconf;
 	}


^ permalink raw reply related	[flat|nested] 238+ messages in thread
* [gentoo-commits] proj/ufed:master commit in: /
@ 2012-10-23 16:13 Paul Varner
  0 siblings, 0 replies; 238+ messages in thread
From: Paul Varner @ 2012-10-23 16:13 UTC (permalink / raw
  To: gentoo-commits

commit:     e6107d26956a6a5cbe0adec88d58cd011e471559
Author:     Paul Varner <fuzzyray <AT> gentoo <DOT> org>
AuthorDate: Tue Oct 23 16:08:15 2012 +0000
Commit:     Paul Varner <fuzzyray <AT> gentoo <DOT> org>
CommitDate: Tue Oct 23 16:08:15 2012 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/ufed.git;a=commit;h=e6107d26

Patch for /etc/{,portage}/make.profile. (Bug 434672)

Patch supplied by Martin Väth

---
 Portage.pm |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/Portage.pm b/Portage.pm
index ff023b9..0b02cab 100644
--- a/Portage.pm
+++ b/Portage.pm
@@ -200,7 +200,8 @@ sub read_packages() {
 
 sub read_profiles() {
 	$_ = readlink '/etc/make.profile';
-	die "/etc/make.profile is not a symlink\n" if not defined $_;
+	$_ = readlink '/etc/portage/make.profile' if not defined $_;
+	die "/etc\{,/portage\}/make.profile is not a symlink\n" if not defined $_;
 	@profiles = norm_path '/etc', $_;
 	for (my $i = -1; $i >= -@profiles; $i--) {
 		for(noncomments "$profiles[$i]/parent") {


^ permalink raw reply related	[flat|nested] 238+ messages in thread
* [gentoo-commits] proj/ufed:master commit in: /
@ 2012-10-23 16:13 Paul Varner
  0 siblings, 0 replies; 238+ messages in thread
From: Paul Varner @ 2012-10-23 16:13 UTC (permalink / raw
  To: gentoo-commits

commit:     e08d2e99ae00bb1b39d680d3accc732417bdbaa1
Author:     Paul Varner <fuzzyray <AT> gentoo <DOT> org>
AuthorDate: Tue Oct 23 16:04:53 2012 +0000
Commit:     Paul Varner <fuzzyray <AT> gentoo <DOT> org>
CommitDate: Tue Oct 23 16:04:53 2012 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/ufed.git;a=commit;h=e08d2e99

Merge both make.conf's in a nonintrusive way. (Bug 434672)

Patch supplied by Martin Väth

---
 Portage.pm |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/Portage.pm b/Portage.pm
index 524b5de..ff023b9 100644
--- a/Portage.pm
+++ b/Portage.pm
@@ -131,6 +131,7 @@ sub read_archs() {
 
 sub read_make_conf() {
 	my %env = read_sh "/etc/make.conf";
+	merge (%env, read_sh('/etc/portage/make.conf'));
 	merge %make_conf_flags, %{$env{USE}} if exists $env{USE};
 	@portagedirs = $environment{PORTDIR};
 	push @portagedirs, split ' ', $environment{PORTDIR_OVERLAY} if defined $environment{PORTDIR_OVERLAY};


^ permalink raw reply related	[flat|nested] 238+ messages in thread
* [gentoo-commits] proj/ufed:master commit in: /
@ 2012-10-23 16:01 Paul Varner
  0 siblings, 0 replies; 238+ messages in thread
From: Paul Varner @ 2012-10-23 16:01 UTC (permalink / raw
  To: gentoo-commits

commit:     5c88306cacc153bf54822fcf3511fc430160976d
Author:     Paul Varner <fuzzyray <AT> gentoo <DOT> org>
AuthorDate: Tue Oct 23 16:01:17 2012 +0000
Commit:     Paul Varner <fuzzyray <AT> gentoo <DOT> org>
CommitDate: Tue Oct 23 16:01:17 2012 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/ufed.git;a=commit;h=5c88306c

Change version in configure.ac to "git".

---
 configure.ac |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/configure.ac b/configure.ac
index d472213..fa17bd3 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,5 +1,5 @@
 AC_PREREQ(2.63)
-AC_INIT([ufed],[0.40.1],[https://bugs.gentoo.org/])
+AC_INIT([ufed],[git],[https://bugs.gentoo.org/])
 AM_INIT_AUTOMAKE([foreign -Wall -Werror])
 AC_CONFIG_SRCDIR([ufed-curses.c])
 AC_CONFIG_HEADERS([config.h])


^ permalink raw reply related	[flat|nested] 238+ messages in thread
* [gentoo-commits] proj/ufed:master commit in: /
@ 2012-10-22 20:42 Paul Varner
  0 siblings, 0 replies; 238+ messages in thread
From: Paul Varner @ 2012-10-22 20:42 UTC (permalink / raw
  To: gentoo-commits

commit:     ceb0f2adccdce4b96e2e7281e1a199499cf436d4
Author:     Paul Varner <fuzzyray <AT> gentoo <DOT> org>
AuthorDate: Mon Oct 22 20:38:54 2012 +0000
Commit:     Paul Varner <fuzzyray <AT> gentoo <DOT> org>
CommitDate: Mon Oct 22 20:38:54 2012 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/ufed.git;a=commit;h=ceb0f2ad

Use make.globals from /usr/share/portage/config instead of /etc (Bug 431064)

Patch by Holger Hoffstätte

---
 Portage.pm |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/Portage.pm b/Portage.pm
index 3f3b9d6..524b5de 100644
--- a/Portage.pm
+++ b/Portage.pm
@@ -144,7 +144,7 @@ sub read_make_defaults() {
 }
 
 sub read_make_globals() {
-	for my $dir(@profiles, '/etc') {
+	for my $dir(@profiles, '/usr/share/portage/config') {
 		read_sh "$dir/make.globals";
 	}
 }


^ permalink raw reply related	[flat|nested] 238+ messages in thread

end of thread, other threads:[~2020-11-07 14:25 UTC | newest]

Thread overview: 238+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-02-05 13:53 [gentoo-commits] proj/ufed:master commit in: / Sven Eden
  -- strict thread matches above, loose matches on Subject: below --
2020-11-07 14:25 Sven Eden
2020-05-02  8:38 Ulrich Müller
2019-09-27  6:42 Sven Eden
2019-09-27  6:39 Sven Eden
2019-09-24 17:57 Sven Eden
2019-09-24 17:56 Sven Eden
2019-04-07 15:17 David Seifert
2019-04-07 13:56 David Seifert
2019-04-07 13:19 David Seifert
2019-04-07 13:19 David Seifert
2019-04-07 13:19 David Seifert
2019-04-07 13:19 David Seifert
2019-04-07 13:19 David Seifert
2015-02-12 15:47 Sven Eden
2015-02-11  9:03 Sven Eden
2014-11-10  9:59 Sven Eden
2014-10-28 11:43 Sven Eden
2014-02-26 10:26 Sven Eden
2014-02-26 10:26 Sven Eden
2014-02-26 10:26 Sven Eden
2014-02-26 10:26 Sven Eden
2014-02-26 10:26 Sven Eden
2014-02-26 10:26 Sven Eden
2014-02-25  8:18 Sven Eden
2014-02-25  8:18 Sven Eden
2014-02-25  8:18 Sven Eden
2014-02-25  8:18 Sven Eden
2013-11-25 21:43 Sven Eden
2013-11-25 21:43 Sven Eden
2013-11-25 21:43 Sven Eden
2013-11-25 21:43 Sven Eden
2013-11-25 21:43 Sven Eden
2013-09-20  8:30 Sven Eden
2013-09-20  8:30 Sven Eden
2013-09-20  8:30 Sven Eden
2013-09-20  8:30 Sven Eden
2013-09-20  8:30 Sven Eden
2013-09-20  8:30 Sven Eden
2013-09-20  8:30 Sven Eden
2013-09-20  8:30 Sven Eden
2013-09-20  8:30 Sven Eden
2013-09-20  8:30 Sven Eden
2013-09-20  8:30 Sven Eden
2013-09-20  8:30 Sven Eden
2013-09-20  8:30 Sven Eden
2013-09-20  8:30 Sven Eden
2013-09-20  8:30 Sven Eden
2013-09-20  8:30 Sven Eden
2013-09-20  8:30 Sven Eden
2013-09-20  8:30 Sven Eden
2013-09-20  8:30 Sven Eden
2013-09-20  8:30 Sven Eden
2013-09-20  8:30 Sven Eden
2013-09-20  8:30 Sven Eden
2013-09-20  8:30 Sven Eden
2013-09-20  8:30 Sven Eden
2013-09-20  8:30 Sven Eden
2013-09-11  7:09 Sven Eden
2013-09-11  6:31 Sven Eden
2013-09-11  6:04 Sven Eden
2013-09-11  6:04 Sven Eden
2013-09-11  6:04 Sven Eden
2013-09-11  6:04 Sven Eden
2013-09-11  6:04 Sven Eden
2013-09-11  6:04 Sven Eden
2013-09-11  6:04 Sven Eden
2013-09-11  6:04 Sven Eden
2013-09-11  6:04 Sven Eden
2013-09-11  6:04 Sven Eden
2013-09-11  6:04 Sven Eden
2013-09-11  6:04 Sven Eden
2013-09-11  6:04 Sven Eden
2013-09-11  6:04 Sven Eden
2013-09-11  6:04 Sven Eden
2013-09-11  6:04 Sven Eden
2013-09-11  6:04 Sven Eden
2013-09-11  6:04 Sven Eden
2013-09-11  6:04 Sven Eden
2013-09-11  6:04 Sven Eden
2013-09-11  6:04 Sven Eden
2013-09-11  6:04 Sven Eden
2013-09-10 12:37 Sven Eden
2013-09-10  6:36 Sven Eden
2013-09-10  6:36 Sven Eden
2013-09-10  6:36 Sven Eden
2013-09-10  6:36 Sven Eden
2013-09-10  6:36 Sven Eden
2013-09-10  6:36 Sven Eden
2013-09-10  6:36 Sven Eden
2013-07-22  9:34 Sven Eden
2013-07-22  6:09 Sven Eden
2013-07-22  6:09 Sven Eden
2013-04-09  7:22 Sven Eden
2013-04-09  7:22 Sven Eden
2013-04-09  7:22 Sven Eden
2013-04-08  7:18 Sven Eden
2013-04-03 13:39 Sven Eden
2013-03-05 16:53 Sven Eden
2013-03-05 16:49 Sven Eden
2013-03-05 16:49 Sven Eden
2013-03-05 16:49 Sven Eden
2013-03-05 16:49 Sven Eden
2013-03-05 16:49 Sven Eden
2013-02-21 10:02 Sven Eden
2013-02-19 15:16 Sven Eden
2013-02-19 13:34 Sven Eden
2013-02-18  7:22 Sven Eden
2013-02-15  8:36 Sven Eden
2013-02-15  8:36 Sven Eden
2013-02-15  8:36 Sven Eden
2013-02-14  8:35 Sven Eden
2013-02-14  8:35 Sven Eden
2013-02-14  8:35 Sven Eden
2013-02-13  9:23 Sven Eden
2013-02-13  9:23 Sven Eden
2013-02-13  9:23 Sven Eden
2013-02-13  9:23 Sven Eden
2013-02-13  9:23 Sven Eden
2013-02-12 10:51 Sven Eden
2013-02-12 10:51 Sven Eden
2013-02-12  9:01 Sven Eden
2013-02-12  9:01 Sven Eden
2013-02-12  9:01 Sven Eden
2013-02-12  9:01 Sven Eden
2013-02-12  9:01 Sven Eden
2013-02-12  9:01 Sven Eden
2013-02-12  9:01 Sven Eden
2013-02-12  9:01 Sven Eden
2013-02-12  9:01 Sven Eden
2013-02-12  9:01 Sven Eden
2013-02-12  9:01 Sven Eden
2013-02-12  9:01 Sven Eden
2013-02-12  9:01 Sven Eden
2013-02-12  9:01 Sven Eden
2013-02-12  9:01 Sven Eden
2013-02-12  9:01 Sven Eden
2013-02-12  9:01 Sven Eden
2013-02-12  9:01 Sven Eden
2013-02-12  9:01 Sven Eden
2013-02-12  9:01 Sven Eden
2013-02-12  9:01 Sven Eden
2013-02-12  9:01 Sven Eden
2013-02-06  9:09 Sven Eden
2013-02-06  9:09 Sven Eden
2013-02-05 18:06 Paul Varner
2013-02-05 13:53 Sven Eden
2013-02-05 11:24 Sven Eden
2013-02-03 14:32 Sven Eden
2013-02-03 14:32 Sven Eden
2013-02-03 14:32 Sven Eden
2013-02-03 14:32 Sven Eden
2013-02-03 14:32 Sven Eden
2013-02-02 20:49 Sven Eden
2013-02-02 10:11 Sven Eden
2013-02-02  9:47 Sven Eden
2013-02-02  9:47 Sven Eden
2013-02-02  9:47 Sven Eden
2013-02-01 21:12 Sven Eden
2013-02-01 21:12 Sven Eden
2013-02-01 21:12 Sven Eden
2013-02-01 16:04 Sven Eden
2013-02-01 15:55 Sven Eden
2013-02-01 15:26 Sven Eden
2013-02-01 14:49 Sven Eden
2013-02-01 10:49 Sven Eden
2013-02-01 10:49 Sven Eden
2013-02-01 10:49 Sven Eden
2013-02-01 10:49 Sven Eden
2013-02-01 10:49 Sven Eden
2013-02-01 10:49 Sven Eden
2013-02-01 10:49 Sven Eden
2013-02-01 10:49 Sven Eden
2013-02-01 10:49 Sven Eden
2013-02-01 10:49 Sven Eden
2013-02-01 10:49 Sven Eden
2013-02-01 10:49 Sven Eden
2013-02-01 10:49 Sven Eden
2013-02-01 10:49 Sven Eden
2013-02-01 10:49 Sven Eden
2013-02-01 10:49 Sven Eden
2013-02-01 10:49 Sven Eden
2013-02-01 10:49 Sven Eden
2013-02-01 10:49 Sven Eden
2013-02-01 10:49 Sven Eden
2013-01-24 10:15 Sven Eden
2013-01-24 10:15 Sven Eden
2013-01-24 10:15 Sven Eden
2013-01-24 10:15 Sven Eden
2013-01-24 10:15 Sven Eden
2013-01-23 14:44 Sven Eden
2013-01-23 12:05 Sven Eden
2013-01-23 12:05 Sven Eden
2013-01-23 12:05 Sven Eden
2013-01-23 12:05 Sven Eden
2013-01-23 12:05 Sven Eden
2013-01-23 12:05 Sven Eden
2013-01-23 12:05 Sven Eden
2013-01-23 12:05 Sven Eden
2013-01-23 12:05 Sven Eden
2013-01-23 12:05 Sven Eden
2013-01-23 12:05 Sven Eden
2013-01-23 12:05 Sven Eden
2013-01-23 12:05 Sven Eden
2013-01-23 12:05 Sven Eden
2013-01-19 21:43 Sven Eden
2013-01-19 21:43 Sven Eden
2013-01-19 21:43 Sven Eden
2013-01-19 21:43 Sven Eden
2013-01-19 21:43 Sven Eden
2013-01-19 21:43 Sven Eden
2013-01-19 21:43 Sven Eden
2013-01-19 21:43 Sven Eden
2013-01-19 21:43 Sven Eden
2013-01-19 21:43 Sven Eden
2013-01-19 21:43 Sven Eden
2013-01-19 21:43 Sven Eden
2013-01-19 21:43 Sven Eden
2013-01-19 21:43 Sven Eden
2013-01-19 21:43 Sven Eden
2013-01-16 13:43 Sven Eden
2013-01-16 12:56 Sven Eden
2013-01-16 12:56 Sven Eden
2013-01-16 12:56 Sven Eden
2013-01-16 12:56 Sven Eden
2013-01-16 12:56 Sven Eden
2013-01-16 12:56 Sven Eden
2013-01-08 11:02 Sven Eden
2013-01-02  8:47 Sven Eden
2013-01-02  8:01 Sven Eden
2013-01-02  8:01 Sven Eden
2012-11-20 17:31 Paul Varner
2012-11-20 17:25 Paul Varner
2012-10-23 16:13 Paul Varner
2012-10-23 16:13 Paul Varner
2012-10-23 16:13 Paul Varner
2012-10-23 16:01 Paul Varner
2012-10-22 20:42 Paul Varner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox