chiark / gitweb /
alphanum tidyups
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Wed, 4 Sep 2013 23:39:04 +0000 (00:39 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Wed, 4 Sep 2013 23:39:04 +0000 (00:39 +0100)
service

diff --git a/service b/service
index d3e0499b96aa81ed4c855118fc3d068319bc8415..bbcc43be545476f9b9c1df406d163181382c7fe8 100755 (executable)
--- a/service
+++ b/service
@@ -2,12 +2,13 @@
 our $usage1 = <<'END';
 usage: ../fyvzl [<options>] <database-file> <action> <arg>...
 options
-  -l<minrandlength>   (for create/choose, minimum randlength)
   -m<maxperuser>
   -d<dom>
   -q<qualdom>
   -C     (show comments in output)
   -h     (display help)
+options for alphanum generation
+  -l<minrandlength>   (for create/choose alphanum, minimum randlength)
 END
 our $usage2 = <<'END';
 actions
@@ -29,7 +30,7 @@ default generation method is alphanum
 END
 our %usage_genopts = (
 'alphanum' => <<END,
-  -l<randlength>     (number of letters+digits)
+  -l<randlength>      (number of letters+digits)
 END
 );
 #/
@@ -39,8 +40,6 @@ use strict;
 use DBI;
 use POSIX;
 
-our $randlength;
-
 our $maxperuser = 10000;
 our $qualdom;
 our $dbh;
@@ -51,8 +50,11 @@ our $showcomment;
 our $genmethod = 'alphanum';
 
 # for alphanum
+#   options
 our $minrandlength = 6;
-our $maxrandlength = 50;
+our $maxrandlength = 100;
+#   genopts
+our $randlength;
 
 sub nextarg () {
     die "too few arguments\n" unless @ARGV;
@@ -206,7 +208,7 @@ sub prepare_create () {
 sub genopt_alphanum {
     local ($_) = @_;
     if (m/^-l(\d+)$/) {
-       $randlength = $1;
+       $randlength = 0+$1;
        die "length out of range $minrandlength..$maxrandlength\n"
            unless ($minrandlength<=$randlength &&
                    $randlength<=$maxrandlength);