#! /usr/bin/perl -w # generates the guests file use strict ; use Repocafe ; my $prog = substr($0,rindex($0,'/')+1) ; my $Usage = < ---------------------------------------- - $prog - create the login:password file for guests. - Program $prog is called by the php programs when a guest is added/deleted, or when a guest changes his/her password. - Specifically it creates: out.db : a DB_file with (user -> password) pairs, used by httpd ; out.txt : for your information, as text, the same pairs. - Normally, $prog is not used by repocafe admins. ---------------------------------------- USAGE sub Usage { die "$_[0]$Usage" ; } sub Error { die "$prog: $_[0]\n" ; } sub Warn { warn "$prog: $_[0]\n" ; } # usage: &GetOptions(ARG,ARG,..) defines $opt_ID as 1 or user spec'ed value # usage: &GetOptions(\%opt,ARG,ARG,..) defines $opt{ID} as 1 or user value # ARG = 'ID' | 'ID=SPC' | 'ID:SPC' for no-arg, required-arg or optional-arg # ID = perl identifier # SPC = i|f|s for integer, fixedpoint real or string argument use Getopt::Long ; Getopt::Long::config('no_ignore_case') ; my %opt = () ; Usage('') unless GetOptions ( \%opt, qw(v q d c=s help) ) ; if ( $opt{help} ) { print $Usage ; exit 0 ; } Usage("Arg count\n") unless @ARGV == 1 ; my $OUT = shift ; my $Cafe = make_cafe ( %opt ) ; $Cafe -> guests -> file_out ( $OUT ) ;