home *** CD-ROM | disk | FTP | other *** search
- '+--------------------------[ User2Asc Ver 0.91ß]----------------------------+
- '| Written By Gary Meeker 06/13/93 Updated 07/02/93 |
- '| SYSOP: SHARP Technical Support Line BBS Lawrenceville, GA |
- '| (404) 962-1788 300-14400 Baud. 24 Hours |
- '+---------------------------------------------------------------------------+
- 'V0.90ß 06/13/93 - Initial Beta Release
- 'V0.91ß 07/02/93 - Rewrote for new PCBTYPES.INC File
- ' Added Command line parameter for Range of Users
-
- DEFINT A-Z
-
- ' QuickPack Declarations
- DECLARE FUNCTION QInstrB% (Start%, Source$, Srch$)
- DECLARE FUNCTION QPStrI$ (IntValue%)
-
- ' PDQ Declarations
- DECLARE FUNCTION ExeName$ ()
- DECLARE FUNCTION PDQParse$ (Work$)
- DECLARE FUNCTION PDQValI% (Number$)
- DECLARE FUNCTION PDQValL& (Number$)
- DECLARE FUNCTION WaitKey2%() 'MyOwn
- DECLARE SUB CritErrOff ()
- DECLARE SUB CritErrOn ()
- DECLARE SUB PDQRestore ()
- DECLARE SUB SetDelimitChar (Char)
-
- ' ProBas Declarations
-
- ' Myown Declarations
- DECLARE FUNCTION EndString(Temp$, EndCh$)
- DECLARE FUNCTION ExistFile% (FileName$)
- DECLARE FUNCTION FindLastCh(St$, BYVAL Ch)
- DECLARE FUNCTION MidStr(St$, BYVAL Pointer)
- DECLARE FUNCTION UnSignedL& (BYVAL X%)
- DECLARE FUNCTION UnSignedI% (BYVAL X&)
- DECLARE SUB DelChar (Target$, Position, Char$)
- DECLARE SUB INC ALIAS "_inc" (IntVar%)
- DECLARE SUB INC2 ALIAS "_incL" (LongVar&)
- DECLARE SUB InsChar (Target$, Position, Char$)
-
- ' Local Declarations
- DECLARE FUNCTION EndChar$(St$, EndCh$)
- DECLARE FUNCTION MakeExt$(St$, Ext$)
- DECLARE SUB Check4File(FileName$, Ercd, ErrMsg)
- DECLARE SUB GetParameter(Parameter$, Flag)
-
- ' $INCLUDE: 'PCBTYPES.INC'
-
- TYPE AppsRecord
- Offset AS LONG
- Typ AS INTEGER
- END TYPE
-
- DIM SHARED None, TRUE, FALSE
- DIM SHARED Users AS UsersRecord, UsersInf AS UsersInfRecord, _
- UsersInfHdr AS UsersInfHdrRecord, UsersApp AS UsersAppRecord
- DIM SHARED Alias2 AS STRING * 25, Address AS AddressRecord, _
- Verify AS STRING * 25, Password AS PasswordRecord
- DIM SHARED FirstName AS STRING * 25, LastName AS STRING * 25, _
- SubDate AS STRING * 8, ExpLev AS STRING * 3, SecLev AS STRING * 3,_
- BDPhone AS STRING * 13, HVPhone AS STRING * 13, _
- LastOnDate AS STRING * 8, LastOnTime AS STRING * 5, _
- TimesOn AS STRING * 6
-
- FALSE = 0 : TRUE = -1 : None = -1
-
- ' Set up shared variables for Check4File
- DIM SHARED ComDir$, ExeDir$, PCBDATDir$, PCBDir$
-
- PRINT "User2Asc Ver 0.91ß - Copyright 1993 Gary Meeker"
-
- Q$ = CHR$(34) : Q2$ = Q$ + "," + Q$
-
- UserLen = LEN(Users)
-
- CritErrOff ' Stop nasty DOS/SHARE Errors
-
- SetDelimitChar 32
-
- ' Get command line
- C$ = UCASE$(COMMAND$)
-
- ' Parse possible command line arguments
- GetParameter "/R:", Dummy : Range$ = Value$
- ComDir$ = EndChar$(PDQParse$(C$), "\")
-
- ' Get Environment variables for Check4File
- Program$ = ExeName$
- ExeDir$ = LEFT$(Program$, FindLastCh(Program$, 92))
- PCBDir$ = EndChar$(ENVIRON$("PCBDRIVE") + ENVIRON$("PCBDIR"), "\")
- PCBDATDir$ = ENVIRON$("PCBDAT")
- PCBDATDir$ = LEFT$(PCBDATDir$, FindLastCh(PCBDATDir$, 92))
- PCBDAT$ = "PCBOARD.DAT"
- Ercd = FALSE
-
- Check4File PCBDAT$, Ercd, TRUE
- IF Ercd GOTO ErrorEnd
-
- PRINT #255, "Reading "; PCBDAT$
- OPEN PCBDAT$ FOR INPUT ACCESS READ SHARED AS #1 ' Open it
- FOR X = 1 TO 27
- LINE INPUT #1, A$ ' scan past what we don't need
- NEXT X
- LINE INPUT #1, USERSIndexPath$ ' Location of USERS File Index Files 28
- LINE INPUT #1, UserFile$ ' Loc/Name of Users File 29
- FOR X = 1 TO 150
- LINE INPUT #1, A$ ' scan past some more lines
- NEXT X
- LINE INPUT #1, UsersInfFile$ ' Name and location of USERS.INF file 180
- CLOSE ' got all we need
-
- PRINT #255, "Reading "; UsersInfFile$
- OPEN UsersInfFile$ FOR BINARY ACCESS READ SHARED AS #1
- GET #1, 1, UsersInfhdr
- NumofApps& = UnSignedL&(UsersInfhdr.NumofApps)
- HeaderSize& = NumofApps& * LEN(UsersApp) + LEN(UsersInfhdr) + 1&
- DIM Apps(UsersInfhdr.NumofApps) AS AppsRecord
- FOR X = 1 TO UsersInfhdr.NumofApps
- GET #1, , UsersApp
- Apps(X).Offset& = UsersApp.Offset&
- SELECT CASE RTRIM$(UsersApp.AppName$)
- CASE "PCBALIAS"
- AliasPSA = TRUE
- Apps(X).Typ = 1
- PRINT "Alias Support Found"
- CASE "PCBADDRESS"
- AddressPSA = TRUE
- Apps(X).Typ = 2
- PRINT "Address Support Found"
- CASE "PCBVERIFY"
- VerifyPSA = TRUE
- Apps(X).Typ = 3
- PRINT "Verify Support Found"
- CASE "PCBPASSWORD"
- PasswordPSA = TRUE
- Apps(X).Typ = 4
- PRINT "Password Support Found"
- CASE "PCBNOTES"
- NotesPSA = TRUE
- Apps(X).Typ = 5
- PRINT "Notes Support Found"
- CASE "PCBSTATS"
- StatsPSA = TRUE
- Apps(X).Typ = 6
- PRINT "Statistics Support Found"
- ' CASE ELSE
- ' PRINT "Skipping "; UsersApp.AppName$
- END SELECT
- NEXT X
- CLOSE #1
-
-
- UserAscFile$ = MakeExt(UserFile$, "ASC")
- PRINT #255, "Creating "; UserASCFile$;
- OPEN UserFile$ FOR RANDOM ACCESS READ SHARED AS #1 LEN = UserLen
- OPEN UsersInfFile$ FOR BINARY ACCESS READ SHARED AS #2
- OPEN UserAscFile$ FOR OUTPUT ACCESS WRITE SHARED AS #3
- Recs& = LOF(1) \ UserLen
- Handle = FILEATTR(2,2)
- SetDelimitChar 44 ' Look for "," in Range
- PDQRestore
- Rec& = PDQValL&(PDQParse(Range$))
- IF Rec& < 1 THEN Rec& = 1
- EndRec& = PDQValL&(PDQParse(Range$))
- IF (EndRec& < 1) OR (EndRec& > Recs&) THEN EndRec& = Recs&
- PRINT #255, " (Records:"; Rec&; "to"; STR$(EndRec&); ")"
- DO While Rec& <= EndRec&
- GET #1, Rec&, Users
- Pointer& = HeaderSize& + (Users.UsersInfPointer& - 1) * UsersInfhdr.TotalRecSize&
- GET #2, Pointer&, UsersInf
- FOR X = 1 TO UsersInfhdr.NumofApps
- SELECT CASE Apps(X).Typ
- CASE 1 ' Alias
- GET #2, Pointer& + Apps(X).Offset&, Alias2
- CASE 2 ' Address
- GET #2, Pointer& + Apps(X).Offset&, Address
- CASE 3 ' Verify
- GET #2, Pointer& + Apps(X).Offset&, Verify
- CASE 4 ' Password
- GET #2, Pointer& + Apps(X).Offset&, Password
- CASE 5 ' Notes
- CASE 6 ' Stats
- END SELECT
- NEXT X
- X = QInstrB(-1, RTRIM$(Users.UserName$), " ")
- IF X THEN
- LSET FirstName$ = LEFT$(Users.UserName$, X - 1)
- LSET LastName$ = MID$(Users.UserName$, X + 1)
- ELSE
- LSET FirstName$ = ""
- LSET LastName$ = Users.UserName$
- END IF
- PRINT #3, Q$; LastName$; Q2$; FirstName$; Q2$; Alias2.UserName$; Q2$;
- PRINT #3, Address.Street1$; Q2$; Address.Street2$; Q2$; _
- Address.City$; Q2$; Address.State$; Q2$; Address.Zip$; Q2$;_
- Address.Country$; Q2$;
- RSET BDPhone$ = RTRIM$(Users.BusDataPhone$)
- RSET HVPhone$ = RTRIM$(Users.HomeVoicePhone$)
- LSET SubDate$ = Users.RegExpDate$
- InsChar SubDate$, 3, "-"
- InsChar SubDate$, 6, "-"
- RSET Seclev$ = QPStrI$(ASC(Users.SecLevel$))
- RSET Explev$ = QPStrI$(ASC(Users.ExpSecLevel$))
- LSET LastOnDate$ = Users.LastOnDate$
- InsChar LastOnDate$, 3, "-"
- InsChar LastOnDate$, 6, "-"
- RSET TimesOn$ = QPStrI$(Users.NumTimesOn)
- PRINT #3, BDPhone$; Q2$; HVPhone$; Q2$; Users.UserComment$; Q2$; _
- Users.SysopComment$; Q2$; SubDate$; Q2$; ExpLev$; Q2$; _
- SecLev$; Q2$; Users.Password$; Q2$;
- PRINT #3, Password.Previous1$; Q2$; Password.Previous2$; Q2$; _
- Password.Previous3$; Q2$; Verify.St$; Q2$;
- PRINT #3, TimesOn$; Q2$; LastOnDate$; Q2$; Users.LastOnTime$; Q$
- Inc2 Rec&
- LOOP
- CLOSE #2
- CLOSE #1
-
- Ercd = FALSE
-
- ErrorEnd:
- IF Ercd THEN
- PRINT #255, "Press any key to Terminate"
- Ke = WaitKey2
- END IF
-
- ExitProgram:
-
- CritErron
- END
-
- '-----------------------------------------------------------------------------
- ' FUNCTION / SUB Procedures
- '-----------------------------------------------------------------------------
-
- FUNCTION EndChar$(St$, EndCh$) STATIC
- Temp$ = RTRIM$(ST$)
- IF EndString(Temp$, EndCh$) THEN
- EndChar$ = Temp$
- ELSE
- EndChar$ = Temp$ + EndCh$
- END IF
- END FUNCTION
-
- FUNCTION MakeExt$(St$, Ext$) STATIC
- ExtPos = FindLastCh(St$, 46)
- IF ExtPos THEN
- MakeExt$ = LEFT$(St$, ExtPos) + Ext$
- ELSE
- MakeExt$ = RTRIM$(St$) + "." + Ext$
- END IF
- END FUNCTION
-
- SUB Check4File(FileName$, Ercd, ErrMsg) STATIC
- IF ExistFile(ComDir$ + FileName$) THEN
- FileName$ = ComDir$ + Filename$
- ELSEIF ExistFile(FileName$) THEN
- EXIT SUB
- ELSEIF ExistFile(PCBDATDir$ + FileName$) THEN
- FileName$ = PCBDATDir$ + FileName$
- ELSEIF ExistFile(PCBDir$ + FileName$) THEN
- FileName$ = PCBDir$ + Filename$
- ELSEIF ExistFile(ExeDir$ + FileName$) THEN
- FileName$ = ExeDir$ + Filename$
- ELSE
- IF ErrMsg THEN
- PRINT #255, CHR$(34); FileName$; CHR$(34); " not Found!"
- PRINT #255, ""
- END IF
- Ercd = TRUE
- END IF
- END SUB
-
- SUB GetParameter(Parameter$, Par) STATIC
- SHARED C$, Value$
- StrLen = LEN(Parameter$)
- Flag = INSTR(C$, Parameter$)
- IF Flag THEN ' Was Parameter present?
- IF MidStr(Parameter$, StrLen) = 58 THEN ' Yes, Is it an Optional? ':'
- EndName = INSTR(Flag, C$, " ") ' Yes, Find End
- IF EndName = 0 THEN '
- EndName = LEN(C$) + 1 ' Must be end of Line
- END IF '
- Temp = EndName - Flag - StrLen ' This is the length
- Value$ = MID$(C$, Flag + StrLen, Temp) ' So we can return this
- Par = PDQValI(Value$) '
- ELSE
- Temp = 0 ' No, so zero length
- Par = -1
- END IF
- DelChar C$, Flag, SPACE$(StrLen + Temp) ' delete it all
- END IF
- END SUB
-
- 'This file was last compiled with:
- 'BC SCANUSER.BAS /o /s /ah;
- 'LINK SCANUSER+
- ' C:\QB\LIB\_NOERROR C:\QB\LIB\_NOFIELD C:\QB\LIB\_NOREAD C:\QB\LIB\_NOVAL+
- ' /ex /nod /noe /packcode /far
- '
- ' nul
- ' C:\QB\LIB\SCREEN C:\QB\LIB\MYOWN C:\QB\LIB\QPPRO C:\QB\LIB\PDQFP
- '
-