Manual Reference Pages  - DISPENSE (1)

NAME

dispense - Coke machine interface

CONTENTS

Synopsis
Diagnostics
Author
Copyright
Files
Bugs
Notes

SYNOPSIS

dispense [[-c count] [ -u user] [drink|slot|drinks-only]]

dispense [-h] | [-R] | [-r slot] | [-s slot price [name]]

dispense door

dispense acct [user [[+|-|=] amount]] "reason"

dispense give "user amount"

dispense finger (coke|door [number])

dispense cfinger [coke|door [number]]

dispense standalone [coke|telnet|both]

dispense [server|telnet]

dispense passwd [user]

http://.../cgi-bin/dispense/html.(menu|auth.n|disp.n)

DESCRIPTION - FORM 1

dispense is the UCC’s interface to the coke machine and the door. This allows you to drop a coke (or another drink) can from the machine. You can also use credit from dispense to pay for other items such as phone calls.

If you do not specify a command line parameter the dispense program will bring up a menu based selection screen (the drinks-only option will omit "other" items from this menu). From this screen you can select the item to drop by pressing a number or moving up and down with the ’k’ (or ^P) and ’j’ (or ^N) keys, as well as VT100 (or similar) arrow keys, and then pressing one of enter, space or ’d’ to dispense the item. By pressing ’q’ or the escape key you can quit from this section without dropping a can. If you are in the coke.controllers file in the coke server’s /var/coke there is also the function ’n’ which allows you to change the name of the current slot, the function ’p’ to change the price of the drinks in the current slot and the ’r’ (or ’f’) function to reset accounting data for a slot.

On the command line you can specify a number or a name of the can to drop. If you specify a number it is taken as the slot number (this assumes you already know which slot it is in). If you specify a name it trys to find the can of the appropriate type and drop that. If it fails it will print appropriate error messages.

Using the -u option it is possible for coke controllers to run dispense for someone else. By using the -c option a given number of an item can be dispensed, or the menu can be automatically recalled a given number of times.

EXAMPLES - FORM 1

dispense
  Will run the dispense program in interactive mode.
dispense 2
  Will drop a can from slot 2.
dispense drinks-only
  Will bring up a menu with only drinks on it.
dispense club lemon
  Will drop a club lemon can out of the machine. So will ’dispense cl’ (usually) but ’dispense c’ will do interesting things (dispense the first drink beginning with c, unless there are no drinks in any slots beginning with c, in which case it will complain there is none of the last drink beginning with c).

DESCRIPTION - FORM 2

dispense can also be used by "coke controllers" to configure the menus from the command line. The options in the second form of dispense (from above) are listed below.
"-h" show help
"-R" reset all slots
"-r "slot reset slot number slot
"-s ""slot price "[name]
  set slot number slot to price price and optionally change the name to name

EXAMPLES - FORM 2

dispense -r 3
  reset slot 3
dispense -s 3 78
  set slot 3 to a cost of 78 units
dispense -s 2 73 coke
  set slot 2 to a cost of 73 units and a name of coke

DESCRIPTION - OTHER FORMS

dispense door will open the door for users listed in the door.controllers file in the door server’s /var/coke directory.

"dispense acct" [user [+|-|=] amount] "reason" will modify the account of user to add or subtract amount or set the balance to amount, respectively and log the reason as reason.

"dispense give ""user amount" will give amount cents from your coke account to user.

"dispense finger "(coke|door [number]) will give information about the status of the coke machine or the doors around the guild building. If you specify a number the program will display only that door and exit with an appropriate status. If the number is negative, then all doors except the specified one are queried.

"dispense cfinger "[coke|door [number]] will give similar information in a GNU-cfinger format. This is run from inetd if wanted. If no parameter is specified information about both the coke machine and the doors will be given.

dispense passwd [user] will change your UCC password, or the password of user if you give the old password.

dispense server will start a server process if called from the inetd. This is typically done by:

"ucc stream tcp nowait coke /usr/local/etc/dispense ucc server"

in /etc/inetd.conf, but this may be different if you use TCP wrappers. The syntax for this server is given in the NOTES below.

dispense telnet will start a telnet process to the coke machine, and should also be called from inetd. This is typically done by

"telnet stream tcp nowait root /usr/local/etc/dispense ucc telnet"

in /etc/inetd.conf (or similar for TCP wrappers).

"dispense standalone "[coke|telnet|both] is an alternative way of running the servers, which will attempt to bind to the specified ports (ucc ["coke"], telnet ["telnet"] or both ["both"]) and run the UCC Coke/Auth service and/or UCC Incoming Telnet service on these ports.

http://.../cgi-bin/dispense/html.(menu|auth.n|disp.n) is the syntax for the web interface to dispense. This is mostly used by accessing http://.../dispense/html.menu.

EXAMPLES - OTHER FORMS

dispense acct luyer +20 "20c deposit receipt 12345"
  will add 20 cents to luyer’s coke account with the reason "20c deposit receipt 12345".
"dispense finger door"
  will give status information about all the doors.
"dispense cfinger"
  will give cfinger-format information about the coke machine and door.
"lynx http://ucc.gu.uwa.edu.au/cgi-bin/dispense/html.menu"
  will bring up a menu of the coke machine contents at ucc.gu.uwa.edu.au.

DIAGNOSTICS

Exit codes
"-4" is returned if an attempt is made to start the coke server from the command line (except via rsh or as a standalone daemon).
"-3" is returned if an illegal function call was made in the coke library.
"-2" is returned if the remote username or password was invalid.
"-1" is returned if there was a problem connecting to the remote coke server.
"0" is returned if the operation was successful.
"1" is returned if the command line arguments (or html form contents) were invalid, or if the user attempted to do something they are not permitted, for example if they are not a coke controller and attempted to do a coke control command.
"2" is returned if there was a miscellaneous error, such as permissions problems, problems identifying the user, errors interacting with the coke machine, or an unexpected signal was recieved.
"3" is returned if the slot specified is empty.
"4" is returned if the credit was insufficient.
"5" is returned if no match for the name given was found.
"6" is returned if the operation was aborted by the user.
"dispense finger door "number
  returns 0 if the door is open, 1 if the door is closed or 2 if the door is malfunctioning.

AUTHOR

David Luyer <luyer@ucc.gu.uwa.edu.au>

COPYRIGHT

The ’dispense’ program is property of the UCC and the author. The author (David Luyer) maintains copyright over all source code. Permission is given to copy all binaries of the code to anywhere you may wish to run them at no cost.

FILES

/var/coke/* on the coke and door server(s)

BUGS

Attempting to load the menu selection screen from a Linux machine being accessed from MacTelnet can, under certian shells, cause a segmentation fault in the program.

The remote version of ’dispense acct’ displays zero balances for users without valid accounts, but still adds their current balance into the ’Total credits’.

NOTES

As mentioned above, the distributed coke software uses a server (dispense server) running on port 375. This can also be used to interact with the UCC coke/door system. The syntax for this server is documented below:

CommandArgsBeforeAfterReplies
------INIT200-ucc server ready
    200 services available: coke door
  --INIT_P200-ucc server ready (preauth)
    200 services avaliable: coke door
  ----574 network error
  ----575 can’t getpwnam coke
  ----576 getpeername: %s
user%sINIT*USER300 send pass for %s
  INIT*INIT500 invalid user %s
preauth%sINIT_PUSER203 preauth ok
  INIT_PINIT501 invalid or wrong user %s
xuser--USERINIT310 send real user
pass%sUSERPASS201 login ok
  USERINIT502 login incorrect
  !USERstatic520 pass not expected
salt%sINIT*USER_C301 send crypt for %s, salt %s
  INIT*INIT500 invalid user %s
opass%sUSERPASS_O302 send new crypt for %s
  USERINIT502 login incorrect
  USERINIT504 opass rejected for root
  !USERstatic521 opass not expected
crypt%sUSER_CPASS280 login ok, authority ok
  USER_CINIT590 login ok, authority bad
  USER_CINIT502 login incorrect
  PASS_OPASS281 password changed ok
  PASS_OINIT503 error changing password
nopass--USER*PASS202 nopass ok
  USER*static510 unable to confirm access for nopass
  USER*static511 unauthorised network for nopass
  USER*static512 unauthorised host for nopass
  USER*static513 unauthorised port for nopass
balance[%s]PASSPASS210 balance [for %s] %ld
  PASSPASS500 invalid user %s
  PASSPASS520 cokebank open error
first--PASSPASS216 balance including %s %ld
  PASSPASS520 cokebank open error
  PASSPASS523 end of cokebank
next--PASSPASS216 balance to %s %ld
  PASSPASS522 cokebank not open error
  PASSPASS523 end of cokebank
close--PASSPASS290 cokebank closed
bytebal[%s]PASSPASS210 balance [for %s] %ld bytes
  PASSPASS500 invalid user %s
  PASSPASS520 cokebank open error
control--PASSPASS260 control true
  PASSPASS551 control false
dctl--PASSPASS261 door control true
  PASSPASS552 door control false
dopen--PASSPASS270 door opened
  PASSPASS422 door open failed
  PASSPASS550 permission denied
become--PASSPASS204 user changed ok
  PASSPASS500 invalid user %s
  PASSPASS550 permission denied
status--PASSPASS220-status begin
    [...]
    220 status end
  PASSPASS400 error getting status
resetallPASSPASS212 slots reset ok
  PASSPASS401 error resetting slots
  PASSPASS550 permission denied
reset%dPASSPASS213 slot reset ok
  PASSPASS402 error resetting slot
  PASSPASS550 permission denied
acct*PASSPASS211 new balance for %s %ld
  PASSPASS500 invalid user %s
  PASSPASS520 cokebank open error
  PASSPASS540 parse error
  PASSPASS550 permission denied
bytes*PASSPASS211 new balance for %s %ld bytes
  PASSPASS500 invalid user %s
  PASSPASS520 cokebank open error
  PASSPASS540 parse error
  PASSPASS550 permission denied
set*PASSPASS214 name set ok
  PASSPASS215 price set ok
  PASSPASS400 error getting status
  PASSPASS403 error setting name
  PASSPASS404 error setting price
  PASSPASS530 invalid price
  PASSPASS540 parse error
  PASSPASS550 permission denied
dial%sPASSPASS100 warning: credit negative
  PASSPASS232-dialed ok
    232 credit left: %ld
  PASSPASS233 freecall dialed ok
  PASSPASS430-error dialing
    430 credit unchanged
  PASSPASS431 freecall failed
  PASSPASS520 cokebank open error
  PASSPASS561 not enough credit
  PASSPASS531 invalid phone number
disp%dPASSPASS100 warning: credit negative
  PASSPASS230-dispense ok
    230 credit left: %ld
  PASSPASS231 dispense attempt done
  PASSPASS400 error getting status
  PASSPASS410 dispense attempt failed
  PASSPASS411-dispense failed
    411 credit unchanged
  PASSPASS520 cokebank open error
  PASSPASS560 slot empty
  PASSPASS561 not enough credit
give%d %sPASSPASS100 warning: credit negative
  PASSPASS211-new balance for %s %ld
    211 new balance for %s %ld
  PASSPASS500 invalid user %s
  PASSPASS520 cokebank open error
  PASSPASS561 not enough credit
  PASSPASS562 cannot give negative credit
door %d--*static222 door %d status %d
  *static420 door not specified
  *static421 illegal door
finger--*static221-finger begin
    [...]
    221 finger end
  *static400 error getting status
slots--*static223 have %d slots %d pseudoslots
help--*static580 not implemented
noop--*static250 nothing done
quit--*--240 session completed
bad command   570 error: %s
null command   571 no input
serious error   572 fatal internal error
timeout   573 read error or timeout

Syntax for "*" commands above: 
 (acct|bytes) (add|sub|set) %d %s %[^\r0
 set (name %d %s)|(price %d %d)
Go to Top of page.


DISPENSE (1) "5 March 1996"
Generated by manServer 1.07 from /usr/share/man/man1/dispense.1 using man macros with tbl support.