#/usr/local/bin/perl #---------------------------------------------------------------------- # variables you should change: $areacode_prog = "/home/ashpool/go4gw/areacode"; #---------------------------------------------------------------------- sub areacode_main { local($_) = @_; if (/^$/) { &Greply("0List of all Area Codes\t$Ggw &.\t$Ghost\t$Gport"); &Greply("7Find a specific Area Code\t$Ggw\t$Ghost\t$Gport"); &Greply("."); exit(0); } $Afile = 1 if (/^&/); s/^&//; #filter out everything but letters and numbers s/[^A-Za-z0-9 ]//g; $searchstr = $_; open(Areaprog, "$areacode_prog $_|"); while() { s/\n//; s/\r//; push(@lines,$_); } # # Always return the output of the search first # if ($Afile) { # reply with a file... foreach (@lines) { &Greply($_); } } else { &Greply("0Search Results in a file\t$Ggw & $searchstr\t$Ghost\t$Gport"); foreach (@lines) { m/(\d+)/; &Greply("0$_\t$Ggw & $1\t$Ghost\t$Gport"); } } &Greply("."); exit(0); } 1; # for require