Skip to content

Commit

Permalink
spell: variable name alias (#838)
Browse files Browse the repository at this point in the history
* spell: variable name alias

* Avoid having two variables called $dict_file, one global and one in a loop
* The default path for dictionary becomes DICT_FILE
* Argument "+dict2" scans an extra dictionary as well as DICT_FILE
* Option "-d dict2" scans dict2 instead of DICT_FILE

* fix repeated +extrafile option
  • Loading branch information
mknos authored Nov 25, 2024
1 parent 5b73b94 commit ba57adb
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions bin/spell
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ use Getopt::Std qw(getopts);
use constant EX_SUCCESS => 0;
use constant EX_FAILURE => 1;

my $Program = basename($0);
use constant DICT_FILE => '/usr/dict/words';

my $dict_file = "/usr/dict/words"; # Filename (path) for standard dict
my $Program = basename($0);

my (
%words, # words from dictionary
Expand All @@ -47,9 +47,9 @@ getopts('cd:ixv', \%opt) or usage();
$check = 1 if $opt{'c'} || $opt{'x'};
$suff = 1 if $opt{'v'};
$inter = 1 if $opt{'i'};
$dict_file = $opt{'d'} if defined $opt{'d'};
@supp = ($dict_file);
for (0 .. $#ARGV) {
@supp = ( DICT_FILE );
@supp = ( $opt{'d'} ) if defined $opt{'d'};
for (reverse (0 .. $#ARGV)) {
if ($ARGV[$_] =~ m/\A\+./) {
push @supp, substr($ARGV[$_], 1);
splice @ARGV, $_, 1;
Expand Down

0 comments on commit ba57adb

Please sign in to comment.