diff options
author | Russ Allbery <rra@stanford.edu> | 2010-02-20 20:30:37 -0800 |
---|---|---|
committer | Russ Allbery <rra@stanford.edu> | 2010-02-20 20:30:37 -0800 |
commit | 4f863ccc9531130be3f4aecea341a0e8a66c6f8c (patch) | |
tree | 392e4953a3c2c6b77e2aeb8473c2ee17aa35b3a5 /server | |
parent | a3ee976840e97d37022ec117bae09fef25ac4385 (diff) |
wallet-backend gets the third store argument from stdin if missing
If there is no third argument to store, read it from standard input
instead. This is the preferred way of running wallet-backend, using
stdin=last support from remctl 2.14 and later. Receiving the third
argument as a regular argument continues to be supported for backward
compatibility.
Diffstat (limited to 'server')
-rwxr-xr-x | server/wallet-backend | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/server/wallet-backend b/server/wallet-backend index 7780758..453aa79 100755 --- a/server/wallet-backend +++ b/server/wallet-backend @@ -284,7 +284,11 @@ sub command { failure ($server->error, @_); } } elsif ($command eq 'store') { - check_args (3, 3, [3], @args); + check_args (2, 3, [3], @args); + if (@args == 2) { + local $/; + $args[2] = <STDIN>; + } splice (@_, 3); $server->store (@args) or failure ($server->error, @_); } else { @@ -536,10 +540,11 @@ name, the owner, any specific ACLs set on the object, the expiration if any, and the user, remote host, and time when the object was created, last stored, and last downloaded. -=item store <type> <name> <data> +=item store <type> <name> [<data>] Stores <data> for the object identified by <type> and <name> for later -retrieval with C<get>. Not all object types support this. +retrieval with C<get>. Not all object types support this. If <data> is +not given as an argument, it will be read from standard input. Currently, <data> is limited to not containing nul characters and may therefore not be binary data, and is limited by the maximum command line |