Update of /cvs/scoop/scoop/scripts
In directory lithium.sabren.com:/tmp/cvs-serv1516/scripts
Modified Files:
boxtool
Log Message:
Hulver's fixes for bugs 24, 77, 86, 160, 176, and 185
-janra
Index: boxtool
===================================================================
RCS file: /cvs/scoop/scoop/scripts/boxtool,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** boxtool 23 Nov 2003 21:59:05 -0000 1.9
--- boxtool 28 May 2005 01:56:29 -0000 1.10
***************
*** 13,17 ****
my $db_host = $1 || 'localhost';
my $db_port = $2 || 3306;
! my $editor = $ENV{EDITOR} || '/bin/vi';
if (($command eq "help") || ($command =~ /^--?h/) || !$command) {
--- 13,17 ----
my $db_host = $1 || 'localhost';
my $db_port = $2 || 3306;
! my $editor = $ENV{EDITOR} || (-x '/bin/vi') ? '/bin/vi' : '/usr/bin/vi';
if (($command eq "help") || ($command =~ /^--?h/) || !$command) {
***************
*** 35,52 ****
&print_help("Must specify a box to work with") unless $which->[0];
&make_connection();
!
my $resource = '';
if ($args->{f} eq "-") {
if ($args->{b}) {
! $args->{f} = "./$which->[0].block.html";
$resource = 'blocks';
} elsif ($args->{p}) {
! $args->{f} = "./$which->[0].page.html";
$resource = 'pages';
} elsif ($args->{v}) {
! $args->{f} = "./$which->[0].var.txt";
$resource = 'vars';
} else {
! $args->{f} = "./$which->[0].box.pl";
$resource = 'boxes';
}
--- 35,63 ----
&print_help("Must specify a box to work with") unless $which->[0];
&make_connection();
! # Specify a saner working directory
! my $basedir;
! if(-d '/tmp') {
! $basedir = '/tmp';
! }
! elsif(-d $ENV{HOME}){
! $basedir = $ENV{HOME};
! }
! else { # if all else fails... of course, this will also be likely
! # to fail, but what do you do?
! $basedir = '.';
! }
my $resource = '';
if ($args->{f} eq "-") {
if ($args->{b}) {
! $args->{f} = "${basedir}/$which->[0].block.html";
$resource = 'blocks';
} elsif ($args->{p}) {
! $args->{f} = "${basedir}/$which->[0].page.html";
$resource = 'pages';
} elsif ($args->{v}) {
! $args->{f} = "${basedir}/$which->[0].var.txt";
$resource = 'vars';
} else {
! $args->{f} = "${basedir}/$which->[0].box.pl";
$resource = 'boxes';
}