home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Black Box 4
/
BlackBox.cdr
/
hamradio
/
nosvw137.arj
/
NOSFILES.ZIP
/
DOM2HOST.BAS
< prev
next >
Wrap
BASIC Source File
|
1991-09-18
|
3KB
|
100 lines
10 REM "DOM2HOST.BAS" [137]
20 REM
30 REM Translates NOS hosts files in DOMAIN.TXT format to
40 REM HOSTS.NET format (for NET) or
50 REM MSYSHOST.NET format (for MSYS)
60 REM
70 REM Release 129 (i.e. 199'1', week '29')
80 REM 19 July 1991
90 REM
100 REM Written by Ian Wade, G3NRW @ GB7BIL
110 REM
120 REM This program is Public Domain and may be freely distributed.
130 REM
140 REM **************************************************************
150 REM
160 REM IMPORTANT: BEFORE RUNNING THIS PROGRAM FOR THE FIRST TIME, SET
170 REM THE VARIABLE T$ IN THE PROGRAM STATEMENT IMMEDIATELY
180 REM BELOW TO:
190 REM "H" IF CONVERTING TO HOSTS.NET FORMAT, OR
200 REM "M" IF CONVERTING TO MSYSHOST.NET FORMAT.
210 REM
220 REM THEN SAVE THE PROGRAM.
230 REM **************************************************************
240 REM
250 T$="H"
260 REM
270 REM
280 REM FILE FORMATS:
290 REM ============
300 REM
310 REM Input File: DOMAIN.TXT format:
320 REM callsign.ampr.org. IN A 44.131.rr.xxx #comment
330 REM
340 REM Output File: HOSTS.NET format:
350 REM 44.131.rr.xxx callsign.ampr.org callsign #comment
360 REM
370 REM Output File: MSYSHOST.NET format:
380 REM 44.131.rr.xxx [callsign] callsign #comment
390 REM
400 ON ERROR GOTO 890
410 D$ = ""
420 INPUT "Input file name (e.g. DOMAIN.TXT), or RETURN to quit: ",D$
430 IF D$ = "" THEN 980
440 OPEN "I", #1, D$
450 ON ERROR GOTO 0
460 H$ = ""
470 INPUT "Output filename (e.g. HOSTS.NET), or RETURN to quit: ",H$
480 IF H$ = "" THEN 980
490 ON ERROR GOTO 930
500 OPEN "I", #2, H$
510 CLOSE #2
520 PRINT
530 PRINT CHR$(7) + "****************** WARNING: file " + H$ + " already exists."
540 PRINT
550 Y$=""
560 INPUT " Do you wish to overwrite it (y/n)? ", Y$
570 PRINT
580 IF Y$ = "y" OR Y$ = "Y" THEN 600
590 GOTO 460
600 ON ERROR GOTO 0
610 ON ERROR GOTO 940
620 OPEN "O", #2, H$
630 ON ERROR GOTO 0
640 PRINT #2, "# Converted from " + D$
650 PRINT #2, "# on " + DATE$ + " at " + TIME$
660 PRINT #2, "#"
670 PRINT "Converting ";
680 IF EOF(1) THEN 840
690 PRINT ".";
700 LINE INPUT #1, L$
710 X$=MID$(L$,1,1)
720 IF X$ = "#" OR X$ = " " OR X$ = " " THEN 820
730 N=INSTR(L$,".ampr.org.")
740 C$=MID$(L$,1,N-1)
750 N=INSTR(L$,"44.131")
760 M=INSTR(N+1,L$,"#")
770 I$=MID$(L$,N,M-1-N)
780 IF T$ = "H" THEN Z$=I$+" " + C$+".ampr.org "+C$ + " " + MID$(L$,M)
790 IF T$ = "M" THEN Z$=I$+" [" + C$ + "] " + C$ + " " + MID$(L$,M)
800 PRINT #2, Z$
810 GOTO 680
820 PRINT #2, L$
830 GOTO 680
840 PRINT
850 PRINT "Done"
860 PRINT
870 CLOSE
880 GOTO 400
890 PRINT
900 PRINT CHR$(7) + "****************** File " D$ " does not exist. Try again"
910 PRINT
920 RESUME 410
930 RESUME 600
940 PRINT
950 PRINT CHR$(7) + "****************** Output filename error. Try again."
960 PRINT
970 RESUME 460
980 CLOSE
990 STOP