diff -r 414797051084 -r 98bc7c6e581a pwgen.pl --- a/pwgen.pl Wed Dec 09 15:46:30 2020 +0100 +++ b/pwgen.pl Wed Dec 09 15:57:34 2020 +0100 @@ -1,12 +1,8 @@ #!/usr/bin/perl -# $Id: pwgen.pl,v 72a196c63f31 2020/12/09 14:24:36 grin $ -# -# (c)Peter Gervai, 2002-2020; Released under GPLv3+ + CC_BY-SA-4.0 +# $Id: pwgen.pl,v 1ad4c2066b77 2020/12/09 14:56:54 grin $ +# (c)Peter Gervai, 2002; Released under GPLv2 + CC_BY-SA-2.0 # -# Password generator, 2002/04/08; 2016/11/09; 2020/12/09 -# -# This code generates easy (easier) to spell and remember passwords. -# The length, in-dashes and plenty of stuff are configurable. +# jelszogenerator, 2002/04/08; 2016/11/09; 2020/12/09 # use Getopt::Long; @@ -18,6 +14,7 @@ my $dashlen=2; my $dashchr='-'; my $longsyl=20; +my $nolf=0; GetOptions( "help" => \&help, @@ -27,6 +24,7 @@ "dashlen=i" => \$dashlen, "longsyl=i" => \$longsyl, "dashchr=s" => \$dashchr, + "nolf" => \$nolf, ) or &help; @@ -48,10 +46,10 @@ print substr($cons,rand($clen),1) if $longsyl > rand(100); print $dashchr unless !$dash or ++$dash_count % $dashlen or $i>$sylnum-$dashlen; } - print " "; + print " " unless $words == 1; } -print "\n"; +print "\n" unless $nolf; sub help { @@ -63,5 +61,6 @@ print " dashlen: use dash between every N syllable\n"; print " longsyl: long syllable probability (percent)\n"; print " dashchr: character to use instead of '-'\n"; + print " nolf: don't print a linefeed after the last word\n"; exit; }