Metropoli BBS
VIEWER: alltop.pps MODE: TEXT (ASCII)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Yet Another AllTop v1.0
; Written by Drew [PWA]
; Last updated 06-21-95
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; function / procedure declaractions
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
declare procedure Initialize()
declare procedure ReadExclusionFiles()
declare procedure ReadUserFile()
declare procedure MakeBulletins()
declare procedure PrintInfo(byte which, int usernum, byte printed)
declare function  Excluded(byte which, int usernum) boolean
declare procedure PrintFooter(byte which)
declare procedure PrintHeader(byte which)
declare function  PrintMUL(byte which, int unum) string
declare function  PrintMDL(byte which, int unum) string
declare function  CreateNewBlt(byte which) byte

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; global variables
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
string   username(1)    ; redimensioned array to store all the user names
string   usercity(1)    ; redim'ed array to store all the user city/notes
dreal    ulbytes(1)     ; redim'ed array to store all the uploaded bytes
dreal    dlbytes(1)     ; stores all downloaded bytes
int      ulfiles(1)     ; stores all uploaded files
int      dlfiles(1)     ; stores all downloaded files
int      callers(1)     ; stores number of calls
int      posters(1)     ; stores number of posts

dreal    totbul         ; totals for bytes uploaded
dreal    totbdl         ; totals for bytes downloaded
unsigned totful         ; totals for files uploaded
unsigned totfdl         ; totals for files downloaded
unsigned totcall        ; total calls
unsigned totpost        ; total posts

string   bltpath        ; the path of where to create the bulletins
int      numuser        ; number of users in pcboard's user record
byte     maxprint       ; max number to keep track of (ie: Top 10, Top 5...)
boolean  quiet          ; quiet mode - don't print anything to the user
boolean  dobul          ; flag indicator - make bytes ul'ed bulletin or not
boolean  dobdl          ; make bytes dl'ed bulletin or not
boolean  doful          ; make files ul'ed bulletin or not
boolean  dofdl          ; make files dl'ed bulletin or not
boolean  docall         ; make top callers bulletin or not
boolean  dopost         ; make top posters bulletin or not

integer sort1(1)        ; used to sort bytes ul'ed info
integer sort2(1)        ; used to sort bytes dl'ed info
integer sort3(1)        ; used to sort files ul'ed info
integer sort4(1)        ; used to sort files dl'ed info
integer sort5(1)        ; used to sort top callers info
integer sort6(1)        ; used to sort top posters info
string  excnames(7,16)  ; names to exclude for each individual bulletin
string  pattern(7)      ; lines to print for each indiv. bltn (rplcmnt codes)
byte    excnum(7)       ; number of names to exclude for each bulletin



;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; main
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
begin
    Initialize()
    ReadExclusionFiles()
    ReadUserFile()
    MakeBulletins()
end


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; the general algorithm to generate the bulletins.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
procedure MakeBulletins()
    byte i, printed, channel
    int j

    for i = 1 to 6
        ; check if user has said *not* to make some of the bulletins.  skip
        ; if they have.
        ;
        select case (i)
            case 1
                if (!dobul) break;
            case 2
                if (!dobdl) break;
            case 3
                if (!doful) break;
            case 4
                if (!dofdl) break;
            case 5
                if (!docall) break;
            case 6
                if (!dopost) break;
        endselect

        ; if not in "quiet mode", then print the status of what's going on
        ;
        if (!quiet) then
            clreol
            select case (i)
                case 1
                    print "@X07writing top ul - bytes" + chr(13)
                case 2
                    print "@X07writing top dl - bytes" + chr(13)
                case 3
                    print "@X07writing top ul - files" + chr(13)
                case 4
                    print "@X07writing top dl - bytes" + chr(13)
                case 5
                    print "@X07writing top callers" + chr(13)
                case 6
                    print "@X07writing top msg posters" + chr(13)
            endselect
        endif

        ; reset the totals for each bulletin
        ;
        totbul  = 0
        totbdl  = 0
        totful  = 0
        totfdl  = 0
        totcall = 0
        totpost = 0

        ; create the actual bulletins here.  print the header, check for
        ; exclusions, print the top xxx lines, and print the footer
        ;
        channel = CreateNewBlt(i)
        fdefout channel
        PrintHeader(i)
        j = numuser
        printed = maxprint
        while (j > 0) do
            if (!Excluded(i, j)) then
                PrintInfo(i, j, printed)
                dec printed
            endif

            dec j

            if (!printed) break;
        endwhile
        PrintFooter(i)
        fclose channel
    next i

    ; heh. :)
    ;
    if (!quiet) then
        clreol
        print "@X0FDone!@X07" + chr(13)
        delay 3
        println "@X08Yet Another AllTop v1.0 by Drew [PWA]@X07"
    endif
endproc

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; we have this really stupid looking select-case statement because the "sort"
; ppl statement only takes one dimensional arrays as arguments.  hence, i can
; not declare something like "sort(6,10)" and making things look clean.
;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
procedure PrintInfo(byte which, int unum, byte printed)
    string newpat

    newpat = pattern(which)
    newpat = replacestr(newpat, "%N", string(maxprint - printed + 1))
    select case (which)
        case 1
            newpat = replacestr(newpat, "%USERNAME",  username(sort1(unum)))
            newpat = replacestr(newpat, "%USERCITY",  usercity(sort1(unum)))
            newpat = replacestr(newpat, "%BUL", string(ulbytes(sort1(unum))))
            newpat = replacestr(newpat, "%BDL", string(dlbytes(sort1(unum))))
            newpat = replacestr(newpat, "%FUL", string(ulfiles(sort1(unum))))
            newpat = replacestr(newpat, "%FDL", string(dlfiles(sort1(unum))))
            newpat = replacestr(newpat, "%C",   string(callers(sort1(unum))))
            newpat = replacestr(newpat, "%P",   string(posters(sort1(unum))))
            newpat = replacestr(newpat, "%MUL", PrintMUL(which, unum))
            newpat = replacestr(newpat, "%MDL", PrintMDL(which, unum))
            totbul = totbul  + ulbytes(sort1(unum))
            totbdl = totbdl  + dlbytes(sort1(unum))
            totful = totful  + ulfiles(sort1(unum))
            totfdl = totfdl  + dlfiles(sort1(unum))
            totcall= totcall + callers(sort1(unum))
            totpost= totpost + posters(sort1(unum))
        case 2
            newpat= replacestr(newpat, "%USERNAME",  username(sort2(unum)))
            newpat= replacestr(newpat, "%USERCITY",  usercity(sort2(unum)))
            newpat= replacestr(newpat, "%BUL", string(ulbytes(sort2(unum))))
            newpat= replacestr(newpat, "%BDL", string(dlbytes(sort2(unum))))
            newpat= replacestr(newpat, "%FUL", string(ulfiles(sort2(unum))))
            newpat= replacestr(newpat, "%FDL", string(dlfiles(sort2(unum))))
            newpat= replacestr(newpat, "%C",   string(callers(sort2(unum))))
            newpat= replacestr(newpat, "%P",   string(posters(sort2(unum))))
            newpat= replacestr(newpat, "%MUL", PrintMUL(which, unum))
            newpat= replacestr(newpat, "%MDL", PrintMDL(which, unum))
            totbul = totbul  + ulbytes(sort2(unum))
            totbdl = totbdl  + dlbytes(sort2(unum))
            totful = totful  + ulfiles(sort2(unum))
            totfdl = totfdl  + dlfiles(sort2(unum))
            totcall= totcall + callers(sort2(unum))
            totpost= totpost + posters(sort2(unum))
        case 3
            newpat= replacestr(newpat, "%USERNAME",  username(sort3(unum)))
            newpat= replacestr(newpat, "%USERCITY",  usercity(sort3(unum)))
            newpat= replacestr(newpat, "%BUL", string(ulbytes(sort3(unum))))
            newpat= replacestr(newpat, "%BDL", string(dlbytes(sort3(unum))))
            newpat= replacestr(newpat, "%FUL", string(ulfiles(sort3(unum))))
            newpat= replacestr(newpat, "%FDL", string(dlfiles(sort3(unum))))
            newpat= replacestr(newpat, "%C",   string(callers(sort3(unum))))
            newpat= replacestr(newpat, "%P",   string(posters(sort3(unum))))
            newpat= replacestr(newpat, "%MUL", PrintMUL(which, unum))
            newpat= replacestr(newpat, "%MDL", PrintMDL(which, unum))
            totbul = totbul  + ulbytes(sort3(unum))
            totbdl = totbdl  + dlbytes(sort3(unum))
            totful = totful  + ulfiles(sort3(unum))
            totfdl = totfdl  + dlfiles(sort3(unum))
            totcall= totcall + callers(sort3(unum))
            totpost= totpost + posters(sort3(unum))
        case 4
            newpat= replacestr(newpat, "%USERNAME",  username(sort4(unum)))
            newpat= replacestr(newpat, "%USERCITY",  usercity(sort4(unum)))
            newpat= replacestr(newpat, "%BUL", string(ulbytes(sort4(unum))))
            newpat= replacestr(newpat, "%BDL", string(dlbytes(sort4(unum))))
            newpat= replacestr(newpat, "%FUL", string(ulfiles(sort4(unum))))
            newpat= replacestr(newpat, "%FDL", string(dlfiles(sort4(unum))))
            newpat= replacestr(newpat, "%C",   string(callers(sort4(unum))))
            newpat= replacestr(newpat, "%P",   string(posters(sort4(unum))))
            newpat= replacestr(newpat, "%MUL", PrintMUL(which, unum))
            newpat= replacestr(newpat, "%MDL", PrintMDL(which, unum))
            totbul = totbul  + ulbytes(sort4(unum))
            totbdl = totbdl  + dlbytes(sort4(unum))
            totful = totful  + ulfiles(sort4(unum))
            totfdl = totfdl  + dlfiles(sort4(unum))
            totcall= totcall + callers(sort4(unum))
            totpost= totpost + posters(sort4(unum))
        case 5
            newpat= replacestr(newpat, "%USERNAME",  username(sort5(unum)))
            newpat= replacestr(newpat, "%USERCITY",  usercity(sort5(unum)))
            newpat= replacestr(newpat, "%BUL", string(ulbytes(sort5(unum))))
            newpat= replacestr(newpat, "%BDL", string(dlbytes(sort5(unum))))
            newpat= replacestr(newpat, "%FUL", string(ulfiles(sort5(unum))))
            newpat= replacestr(newpat, "%FDL", string(dlfiles(sort5(unum))))
            newpat= replacestr(newpat, "%C",   string(callers(sort5(unum))))
            newpat= replacestr(newpat, "%P",   string(posters(sort5(unum))))
            newpat= replacestr(newpat, "%MUL", PrintMUL(which, unum))
            newpat= replacestr(newpat, "%MDL", PrintMDL(which, unum))
            totbul = totbul  + ulbytes(sort5(unum))
            totbdl = totbdl  + dlbytes(sort5(unum))
            totful = totful  + ulfiles(sort5(unum))
            totfdl = totfdl  + dlfiles(sort5(unum))
            totcall= totcall + callers(sort5(unum))
            totpost= totpost + posters(sort5(unum))
        case 6
            newpat= replacestr(newpat, "%USERNAME",  username(sort6(unum)))
            newpat= replacestr(newpat, "%USERCITY",  usercity(sort6(unum)))
            newpat= replacestr(newpat, "%BUL", string(ulbytes(sort6(unum))))
            newpat= replacestr(newpat, "%BDL", string(dlbytes(sort6(unum))))
            newpat= replacestr(newpat, "%FUL", string(ulfiles(sort6(unum))))
            newpat= replacestr(newpat, "%FDL", string(dlfiles(sort6(unum))))
            newpat= replacestr(newpat, "%C",   string(callers(sort6(unum))))
            newpat= replacestr(newpat, "%P",   string(posters(sort6(unum))))
            newpat= replacestr(newpat, "%MUL", PrintMUL(which, unum))
            newpat= replacestr(newpat, "%MDL", PrintMDL(which, unum))
            totbul = totbul  + ulbytes(sort6(unum))
            totbdl = totbdl  + dlbytes(sort6(unum))
            totful = totful  + ulfiles(sort6(unum))
            totfdl = totfdl  + dlfiles(sort6(unum))
            totcall= totcall + callers(sort6(unum))
            totpost= totpost + posters(sort6(unum))
    endselect

    fdputln newpat
endproc


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; prints the megabytes downloaded
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
function PrintMDL(byte which, int unum) string
    select case (which)
        case 1
            PrintMDL= string(toint(dlbytes(sort1(unum)) / 1048576))
        case 2
            PrintMDL= string(toint(dlbytes(sort2(unum)) / 1048576))
        case 3
            PrintMDL= string(toint(dlbytes(sort3(unum)) / 1048576))
        case 4
            PrintMDL= string(toint(dlbytes(sort4(unum)) / 1048576))
        case 5
            PrintMDL= string(toint(dlbytes(sort5(unum)) / 1048576))
        case 6
            PrintMDL= string(toint(dlbytes(sort6(unum)) / 1048576))
    endselect
endfunc


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; prints the megabytes uploaded
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
function PrintMUL(byte which, int unum) string
    select case (which)
        case 1
            PrintMUL= string(toint(ulbytes(sort1(unum)) / 1048576))
        case 2
            PrintMUL= string(toint(ulbytes(sort2(unum)) / 1048576))
        case 3
            PrintMUL= string(toint(ulbytes(sort3(unum)) / 1048576))
        case 4
            PrintMUL= string(toint(ulbytes(sort4(unum)) / 1048576))
        case 5
            PrintMUL= string(toint(ulbytes(sort5(unum)) / 1048576))
        case 6
            PrintMUL= string(toint(ulbytes(sort6(unum)) / 1048576))
    endselect
endfunc


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; check for exclusions.  excnum(0) indicates the number of global exclusions
; as defined in "ALLTOP.EXC" and stored in excnames(0, x).
;
; input:        which bulletin we are generating (1-6)
;               the user/record number of the current user
; output:       boolean value to indicate if the user is exluded or not
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
function Excluded(byte which, int usernum) boolean
    int i
    boolean found
    string usrname

    select case (which)
        case 1
            usrname = username(sort1(usernum))
        case 2
            usrname = username(sort2(usernum))
        case 3
            usrname = username(sort3(usernum))
        case 4
            usrname = username(sort4(usernum))
        case 5
            usrname = username(sort5(usernum))
        case 6
            usrname = username(sort6(usernum))
    endselect

    found = FALSE

    ; check if the user is globablly excluded
    ;
    if (excnum(0)) then
        for i = 1 to excnum(0)
            if (upper(excnames(0, i)) == usrname) then
                found = TRUE
                break
            endif
        next i
    endif

    ; if not globally excluded, check if excluded specifically for the
    ; current bulletin
    ;
    if ((!found) && (excnum(which))) then
        for i = 1 to excnum(which)
            if (upper(excnames(which, i)) == usrname) then
                found = TRUE
                break
            endif
        next i
    endif

    Excluded = found
endfunc


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; prints the footer for each corresponding bulletin.  footers have replacement
; codes.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
procedure PrintFooter(byte which)
    string filename, line
    byte tmpchn

    select case (which)
        case 1
            filename = ppepath() + "SHOW\ULB_BOT" + langext()
        case 2
            filename = ppepath() + "SHOW\DLB_BOT" + langext()
        case 3
            filename = ppepath() + "SHOW\ULF_BOT" + langext()
        case 4
            filename = ppepath() + "SHOW\DLF_BOT" + langext()
        case 5
            filename = ppepath() + "SHOW\CALL_BOT" + langext()
        case 6
            filename = ppepath() + "SHOW\POST_BOT" + langext()
    endselect

    tmpchn = fnext()
    fopen tmpchn, filename, O_RD, S_DW
    fdefin tmpchn
    fdget line
    while (!ferr(tmpchn)) do
        line = replacestr(line, "%BUL", string(totbul))
        line = replacestr(line, "%BDL", string(totbdl))
        line = replacestr(line, "%FUL", string(totful))
        line = replacestr(line, "%FDL", string(totfdl))
        line = replacestr(line, "%MUL", string(toint(totbul / 1048576)))
        line = replacestr(line, "%MDL", string(toint(totbdl / 1048576)))
        line = replacestr(line, "%C", string(totcall))
        line = replacestr(line, "%P", string(totpost))
        fdputln line
        fdget line
    endwhile
    fclose tmpchn
endproc


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; prints the header for each bulletin.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
procedure PrintHeader(byte which)
    string filename, line
    byte tmpchn

    select case (which)
        case 1
            filename = ppepath() + "SHOW\ULB_TOP" + langext()
        case 2
            filename = ppepath() + "SHOW\DLB_TOP" + langext()
        case 3
            filename = ppepath() + "SHOW\ULF_TOP" + langext()
        case 4
            filename = ppepath() + "SHOW\DLF_TOP" + langext()
        case 5
            filename = ppepath() + "SHOW\CALL_TOP" + langext()
        case 6
            filename = ppepath() + "SHOW\POST_TOP" + langext()
    endselect

    tmpchn = fnext()
    fopen tmpchn, filename, O_RD, S_DW
    fdefin tmpchn
    fdget line
    while (!ferr(tmpchn)) do
        fdputln line
        fdget line
    endwhile
    fclose tmpchn
endproc



;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; finds the next available channel for writing the new bulletin and opens the
; file for writing.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
function CreateNewBlt(byte which) byte
    byte chan
    string foo

    chan = fnext()
    select case (which)
        case 1
            foo = ppepath() + bltpath + "\BULBLT" + langext()
        case 2
            foo = ppepath() + bltpath + "\BDLBLT" + langext()
        case 3
            foo = ppepath() + bltpath + "\FULBLT" + langext()
        case 4
            foo = ppepath() + bltpath + "\FDLBLT" + langext()
        case 5
            foo = ppepath() + bltpath + "\CALLBLT" + langext()
        case 6
            foo = ppepath() + bltpath + "\POSTBLT" + langext()
    endselect

    if (exist(foo)) delete foo
    fopen chan, foo, O_WR, S_DW

    CreateNewBlt = chan
endproc


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; scan through all the user records, collect the data, and sort them using
; the ppl statement "sort".  this is somewhat wasteful as we are going through
; all of the user records and storing all of them.  only at the end do we use
; just the best 10 (or 5 or however many was defined).
;
; a better method would have been to use insertion sort, but ppl is much too
; slow to have this sorting algorithm be effective and it's internal "sort"
; statement isn't too bad.  so the tradeoff is speed for memory, which isn't
; too uncommon nowadays.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
procedure ReadUserFile()
    int i

    if (!quiet) then
        clreol
        print "reading user file #"
    endif

    for i = 1 to numuser
        getaltuser i
        if (!quiet) then
            print string(i)
            backup len(string(i))
        endif
        username(i) = u_name()
        usercity(i) = u_city
        ulbytes(i)  = u_bul()
        dlbytes(i)  = u_bdl()
        ulfiles(i)  = u_ful()
        dlfiles(i)  = u_fdl()
        callers(i)  = u_logons()
        posters(i)  = u_msgwr()
    next i

    print chr(13)

    sort ulbytes, sort1
    sort dlbytes, sort2
    sort ulfiles, sort3
    sort dlfiles, sort4
    sort callers, sort5
    sort posters, sort6
endproc


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; read all the exclusions files and store in excnames(x,y)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
procedure ReadExclusionFiles()
    byte i, channel
    string excfiles(7)

    if (!quiet) then
        clreol
        print "reading exclusion files" + chr(13)
    endif

    excfiles(0) = ppepath() + "ALLTOP.EXC"
    excfiles(1) = ppepath() + "ULBYTES.EXC"
    excfiles(2) = ppepath() + "DLBYTES.EXC"
    excfiles(3) = ppepath() + "ULFILES.EXC"
    excfiles(4) = ppepath() + "DLFILES.EXC"
    excfiles(5) = ppepath() + "CALLERS.EXC"
    excfiles(6) = ppepath() + "POSTERS.EXC"

    for i = 0 to 6
        excnum(i) = 0
        if (exist(excfiles(i))) then
            channel = fnext()
            if (channel == -1) then
                clreol
                println "@X0CAll channels exhausted for writing.  Try later."
                end
            endif

            fopen channel, excfiles(i), O_RD, S_DW
            fdefin channel
            fdget excnames(i, excnum(i))
            while (!ferr(channel)) do
                if (excnames(i, excnum(i)) != "") then
                    inc excnum(i)
                endif

                if (excnum(i) == 16) then
                    break
                endif

                fdget excnames(i, excnum(i))
            endwhile
            fclose channel
        endif
    next i
endproc


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; initialize a gazillion things
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
procedure Initialize()
    string foo

    quiet = FALSE
    dobul = TRUE
    dobdl = TRUE
    doful = TRUE
    dofdl = TRUE
    docall = TRUE
    dopost = TRUE

    while (tokcount()) do
    if (tokcount()) then
        foo = gettoken()
        select case (foo)
            case "QUIET", "-QUIET"
                quiet = TRUE
            case "-BUL"
                dobul = FALSE
            case "-BDL"
                dobdl = FALSE
            case "-FUL"
                doful = FALSE
            case "-FDL"
                dofdl = FALSE
            case "-C"
                docall = FALSE
            case "-P"
                dopost = FALSE
        endselect
    endif
    endwhile

    if (!quiet) print "@X07Updating all time bulletins" + chr(13)

    numuser = fileinf(readline(pcbdat(), 29) ,4) / 400
    fclose -1
    redim username, numuser
    redim usercity, numuser
    redim ulbytes,  numuser
    redim dlbytes,  numuser
    redim ulfiles,  numuser
    redim dlfiles,  numuser
    redim callers,  numuser
    redim posters,  numuser

    redim sort1, numuser
    redim sort2, numuser
    redim sort3, numuser
    redim sort4, numuser
    redim sort5, numuser
    redim sort6, numuser

    if (exist(ppepath() + "ALLTOP.CFG")) then
        bltpath = readline(ppepath() + "ALLTOP.CFG", 1)
        maxprint = s2i(readline(ppepath() + "ALLTOP.CFG", 2), 10)
        pattern(1) = readline(ppepath() + "ALLTOP.CFG", 3)
        pattern(2) = readline(ppepath() + "ALLTOP.CFG", 4)
        pattern(3) = readline(ppepath() + "ALLTOP.CFG", 5)
        pattern(4) = readline(ppepath() + "ALLTOP.CFG", 6)
        pattern(5) = readline(ppepath() + "ALLTOP.CFG", 7)
        pattern(6) = readline(ppepath() + "ALLTOP.CFG", 8)
        fclose -1
    else
        println "@X0CError!  " + ppepath() + "ALLTOP.CFG" + " does not exist!@X07"
        end
    endif

endproc
[ RETURN TO DIRECTORY ]