	REM "ERRORMAINT.BAS" EDITED 8/25/78 FOR SDOS V1.0B
	!	EDITED 4/25/80; CONVERTED TO BASIC V1.4
	DIM MAKEFILEBIG$/"?"/,ERRORFILE$/"ERRORMSGS.SYS"/
	DIM IP$[1],FILESIZE$[4]/0,0,0,0/,ERRMSG$[80]
	DIM MESSAGE,FREEBYTE,ERNUM,I,FROM,LAST,X,NOPRINT
	DIM	GETFILESIZE$/:F,:E,1,3/

	PRINT "Errormsgs.sys maintainence program V1.0 4/25/80"
	ON ERROR GOTO 600
	OPEN #1,ERRORFILE$
	ON ERROR GOTO 0
10	INPUT ">" IP$
20	IF UPPERCASE$(IP$)="I" THEN 100
30	IF UPPERCASE$(IP$)="L" THEN 300
40	IF UPPERCASE$(IP$)="C" THEN CLOSE #1\GOTO 640
50	IF UPPERCASE$(IP$)="V" THEN 500
	IF UPPERCASE$(IP$)="D" THEN 700
	IF UPPERCASE$(IP$)="O" THEN 800
	IF UPPERCASE$(IP$)="S" THEN EXIT
60	PRINT "WHAT???"\GOTO 10
100	GOSUB 1000
170	INPUT "ERROR MESSAGE: " ERRMSG$
	SYSCALL (GETFILESIZE$,"",FILESIZE$)
160	WRITE #1,FILESIZE$[2,3]
180	RESTORE #1,(FILESIZE$[2]**8+FILESIZE$[3])*256+FILESIZE$[4]
190	PRINT #1,ERRMSG$
250	GOTO 10
300	INPUT "FROM: " FROM
310	INPUT "TO:   " LAST\NOPRINT=0
320	FOR ERNUM=FROM TO LAST
330	GOSUB 530
340	NEXT ERNUM
350	GOTO 10
500	INPUT "ERROR #" ERNUM\NOPRINT=0
510	GOSUB 530\GOTO 10
530	RESTORE #1,ERNUM*3\READ #1,FILESIZE$[2,3]
540	MESSAGE=(FILESIZE$[2]**8+FILESIZE$[3])*256+FILESIZE$[4]
550	IF MESSAGE=0 THEN LET ERRMSG$="(**NO MESSAGE**)"\GOTO 570
560	RESTORE #1,MESSAGE\INPUT #1,ERRMSG$
570	IF NOPRINT=0 THEN PRINT ERNUM;ERRMSG$
580	RETURN
600	ON ERROR GOTO 0
610	IF ERR<>1011 THEN ERROR
620	PRINT ERRORFILE$;" didn't exist...so I created it."
640	CREATE #1,ERRORFILE$
	RESTORE #1,65536*3
	WRITE #1,MAKEFILEBIG$
	GOTO 10
700	INPUT "ERROR # " ERNUM\RESTORE #1,3*ERNUM\WRITE #1,0,0,0\GOTO 10
800	INPUT "OUTPUT FILE: " ERRMSG$\CREATE #2,ERRMSG$
810	INPUT "FROM: " FROM\ INPUT "TO: " LAST\FOR ERNUM=FROM TO LAST
820	NOPRINT=1\GOSUB 530
830	IF ERRMSG$<>"(**NO MESSAGE**)" THEN PRINT #2,ERNUM;" - ";ERRMSG$
840	NEXT ERNUM
850	CLOSE #2\GOTO 10
1000	INPUT "ERROR NUMBER: " ERNUM
1010	IF ERNUM<0 OR ERNUM>65535 OR ERNUM<>INT(ERNUM)
	THEN PRINT "ILLEGAL ERROR NUMBER"\GOSUB POP 0\GOTO 10
	RESTORE #1,ERNUM*3
	RETURN

	END
