--- ufed.orig 2003-08-03 17:04:40.000000000 -0400 +++ ufed 2003-08-03 17:13:48.000000000 -0400 @@ -13,7 +13,7 @@ # version number format is x.yy # if y<10, you NEED the trailing zero! -my $version = '0.33'; +my $version = '0.34'; my @make_defaults_flags; my @use_defaults_flags; @@ -29,6 +29,20 @@ my $PortageBase = '/usr/portage'; +my $DIALOG = 'dialog'; + +if (($ENV{'DISPLAY'} ne "") && ($ARGV[0] ne "--no-x")) { + if (-x '/usr/bin/Xdialog') { + print "Detected Xdialog binary and DISPLAY environment variable. Switching to X-based dialog.\n"; + print "To prevent this action, unset DISPLAY or pass --no-x to this program.\n"; + $DIALOG = '/usr/bin/Xdialog'; + } else { + print "Detected DISPLAY environment variable but Xdialog does not appear to be installed.\n"; + print "If you would like X support you can emerge x11-misc/xdialog. using default dialog now.\n"; + sleep 2; + } +} + sub get_flag_from_file { @@ -284,7 +298,7 @@ $items .= '"' . %use_desc_flags->{$flag} . '" '; } - $rc = system('DIALOG_ESC="" dialog 2>' + $rc = system('DIALOG_ESC="" '.$DIALOG.' 2>' . $tempfile . ' --separate-output ' . '--no-shadow --backtitle "Gentoo Linux USE flags editor ' @@ -449,7 +463,7 @@ ); close(FILE); - system('dialog --exit-label Back --no-shadow --title "What are USE flags?" ' + system($DIALOG .' --exit-label Back --no-shadow --title "What are USE flags?" ' . '--backtitle "Gentoo Linux USE flags editor ' . $version . ' - Help" '