groff-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[groff] 21/21: src/roff/grog/grog.pl: Continue refactoring.


From: G. Branden Robinson
Subject: [groff] 21/21: src/roff/grog/grog.pl: Continue refactoring.
Date: Sun, 6 Jun 2021 13:04:23 -0400 (EDT)

gbranden pushed a commit to branch master
in repository groff.

commit 6e93851ce0d38f153689f769533d56db471bd5f8
Author: G. Branden Robinson <g.branden.robinson@gmail.com>
AuthorDate: Mon Jun 7 02:01:02 2021 +1000

    src/roff/grog/grog.pl: Continue refactoring.
    
    ...begun in 3b8ca15c, 5 June.
    
    * Move bail-out logic later, after we've failed to locate grog's
      subroutines file in the 3 places we check.
    * Add information about _why_ we're aborting to the fatal diagnostic.
    * Now that we're importing catfile(), use it for own file spec
      construction and not just the one we originally replaced.  D'oh!
---
 src/roff/grog/grog.pl | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/src/roff/grog/grog.pl b/src/roff/grog/grog.pl
index 9050735..ee9ef03 100644
--- a/src/roff/grog/grog.pl
+++ b/src/roff/grog/grog.pl
@@ -53,11 +53,11 @@ if ($before_make) {
 
 # Locate our subroutines file.  We might be installed, in a source tree,
 # or in a separate build tree.
-my $grog_dir = $FindBin::Bin;
-die 'grog: "' . $grog_dir . '" does not exist or is not a directory'
-  unless -d $grog_dir;
+my $grog_dir;
 
-foreach my $dir ( $grog_dir, './src/roff/grog', '../src/roff/grog' ) {
+foreach my $dir ( $FindBin::Bin,
+                  catfile('.', 'src', 'roff', 'grog'),
+                  catfile('..', 'src', 'roff', 'grog')) {
   my $subs = catfile("$dir", "subs.pl");
   if ( -f $subs ) {
     $grog_dir = $dir;
@@ -65,6 +65,10 @@ foreach my $dir ( $grog_dir, './src/roff/grog', 
'../src/roff/grog' ) {
   }
 }
 
+die 'grog: cannot load subroutines; "' . $grog_dir . '" does not'
+    . ' exist or is not a directory'
+  unless -d $grog_dir;
+
 #############
 # import subs
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]