Use a lua for loop in preference to a while and increment in the lua

example code - suggested by Marc Balmer.

	% make USETOOLS=no t
	cp Makefile a
	./netpgp.lua --sign --detached a
	netpgp: default key set to "C0596823"
	pub 2048/RSA (Encrypt or Sign) 1b68dcfcc0596823 2004-01-12
	Key fingerprint: d415 9deb 336d e4cc cdfa 00cd 1b68 dcfc c059 6823
	uid              Alistair Crooks <agc@netbsd.org>
	uid              Alistair Crooks <agc@pkgsrc.org>
	uid              Alistair Crooks <agc@alistaircrooks.com>
	uid              Alistair Crooks <alistair@hockley-crooks.com>
	netpgp passphrase:
	-rw-r--r--  1 agc  agc  287 Oct 17 15:58 a.sig
	./netpgp.lua --verify a.sig
	netpgp: default key set to "C0596823"
	netpgp: assuming signed data in "a"
	Good signature for a.sig made Sat Oct 17 15:58:09 2009
	using RSA (Encrypt or Sign) key 1b68dcfcc0596823
	pub 2048/RSA (Encrypt or Sign) 1b68dcfcc0596823 2004-01-12
	Key fingerprint: d415 9deb 336d e4cc cdfa 00cd 1b68 dcfc c059 6823
	uid              Alistair Crooks <alistair@hockley-crooks.com>
	uid              Alistair Crooks <agc@pkgsrc.org>
	uid              Alistair Crooks <agc@netbsd.org>
	uid              Alistair Crooks <agc@alistaircrooks.com>
	%
This commit is contained in:
agc 2009-10-18 07:23:37 +00:00
parent 1f8267516a
commit 9470081fd3
1 changed files with 2 additions and 3 deletions

View File

@ -77,8 +77,8 @@ end
-- initialise everything
netpgp.init(pgp)
local i = 1
while i <= #args do
local i
for i = 1, #args do
if options.encrypt then
-- encrypt a file
netpgp.encrypt_file(pgp, args[1], output, armour)
@ -97,5 +97,4 @@ while i <= #args do
-- verification of detached signature
netpgp.verify_file(pgp, args[1], armour)
end
i = i + 1
end