#!/usr/bin/perl # A wrapper around ispell that asks you to choose a # dictionary first # # Artistic copyright by Tomas Pospisek # V0.0 - 11.10.2001 $DIRECTORY = "/usr/lib/ispell"; $LIST_DICTIONARIES="/usr/sbin/update-alternatives --display ispell-dictionary.hash ". "| grep priority | sort -r -n -k 4 | sed 's+/usr/lib/ispell/++'". "| sed 's/\.hash.*//'|"; $file2spell = shift(); open(DICTS, $LIST_DICTIONARIES); $i=0; while() { chomp(); if( $i==0) { print "Which dictionary do you want to use?\n"; print "------------------------------------\n"; print "[$i] $_ - default\n"; } else { print "[$i] $_\n"; } $dicts[$i++] = $_; } unless($i) { print "You don't have any dictionary installedn"; print "Press return to continue\n"; $_ = <>; exit; } else { $choice = <>; if( $choice) { $dict = $dicts[$choice]; $opt = "-d $DIRECTORY/$dict.hash"; } } exec("ispell $opt $file2spell");