File: anonymous.proc

package info (click to toggle)
wims 2%3A4.29a%2Bdfsg1-3
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 185,704 kB
  • sloc: xml: 366,687; javascript: 120,570; ansic: 62,341; java: 62,170; sh: 7,744; perl: 3,937; yacc: 3,217; cpp: 1,915; lex: 1,805; makefile: 1,084; lisp: 914; pascal: 601; python: 520; php: 318; asm: 7
file content (72 lines) | stat: -rw-r--r-- 2,685 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
!! ---------- process manage of anonymous connexion to example class
!! each connexion use a different login
!! login is generated if necessary
!! anonymous connexion is limited to 50% of class capacity
!! other is reserved to registered login
!! wims_read_parm input parameters are
!!  first item : login of user (exit if not anonymous)
!!  second item : class number (exit if not <=9999 )
!! process exit if no place left
!! output=$output_user
!! login anonymous is never used in fact, it is a "model".
!distribute item $wims_read_parm into c_,u_
t_=!char 1 to 9 of $u_
t_=!lower $t_
n_=!char 10 to -1 of $u_
!default n_=0
!if NaN notin $[1*$n_] and $t_=anonymous
  dispo=!record 2 of wimshome/log/classes/$c_/freelogin
  dispo=!nospace $dispo
  time=!record 1 of wimshome/log/classes/$c_/freelogin
  !if $dispo=$empty and ($time=$empty or $wims_nowseconds>$time+600)
    ltuser=!sh cd $wims_home/sessions;\
               s=`grep wims_class=$c_ ./*/var.stat | cut -d: -f1`;\
               grep "wims_user=" $$s | cut -d= -f2;
    !if $ltuser!=$empty
      ltuser=!words2items $ltuser
      ltuser=!replace anonymous by $empty in $ltuser
    !endif
    cllimit=!defof class_limit in wimshome/log/classes/$c_/.def
    !if $cllimit=$empty
      cllimit=!defof class_user_limit in wimshome/log/wims.conf
      !if $cllimit=$empty
        cllimit=!defof DF_class_limit in wimshome/public_html/bases/sys/defaults.conf
      !endif
    !endif
    dispo=$[rint($cllimit/2)]
    dispo=!values v for v=1 to $dispo
    dispo=,$dispo
    dispo=!listcomplement $ltuser in $dispo
    dispo=!nospace $dispo
  !endif
  !if $dispo=$empty
    !restart module=adm/class/classes/&+job=example&+fullcls=1
  !else
    num=!item 1 of $dispo
    test=!fileexists wimshome/log/classes/$c_/.users/anonymous$num
    !if $test!=yes
      nbuser=!recordcnt wimshome/log/classes/$c_/.userlist
      !if $cllimit=$empty
        cllimit=!defof class_limit in wimshome/log/classes/$c_/.def
        !if $cllimit=$empty
          cllimit=!defof class_user_limit in wimshome/log/wims.conf
          !if $cllimit=$empty
            cllimit=!defof DF_class_limit in wimshome/public_html/bases/sys/defaults.conf
          !endif
        !endif
      !endif
      !if $nbuser<=$cllimit
        !sh cp $wims_home/log/classes/$c_/.users/anonymous $wims_home/log/classes/$c_/.users/anonymous$num
        !readproc adm/class/mkuserlist $c_
      !else
        !restart module=adm/class/classes/&+job=example&+fullcls=1
      !endif
    !endif
    output_user=anonymous$num
    dispo=!item 2 to -1 of $dispo
    !writefile wimshome/log/classes/$c_/freelogin :$wims_nowseconds\
:$dispo
  !endif
!else
  output_user=$u_
!endif