Okay here is my useless, but still (I guess) basic
program. It was done for a class assignment, it's very
lame. Probably is fairly portable, as it doesn't do
anything fancy -- just stdio stuff. Grr.. Of course, I screwed the line length up on this, so Advogato doesn't do it right. Oh, well.
All Hail Friday!
Yes, I dug up (and added) a few new stuff to iMacLinux.
This weekend, I'll be busy working on Family Life MB.
' quik.conf generation program
' (c)2000, Andrew B. Arthur (aarthur@imaclinux.net)
' BSD Licensed
'
' This program is portable, AFAIK, it should compile
' cleanly in qbasic, MacBasic, ChipMunkBasic, any
' probably others. <grin>
' Declare Hard Coded Variables Here:
aliasarg$ = "bye" 'This is the bye command. You
don't
really need it
'unless you are using a boot menu. Most
people will
'just want bye, so we hard code it.
' In case we need to change the syntax.
append$ = "append="
boot$ = "boot="
root$ = "root="
alias$ = "alias="
ramdisk$ = "ramdisk="
' Internationalization Stuff
samplei8n$ = "People translating this program needs to
change these"
thisprogrami8n$ = "This program generates a sample
quik.conf"
returni8n$ = "Hit Return To Continue or Wait 5 Seconds"
kernelandparti8n$ = "Kernel and Partition Configuration"
addkernelargsi8n$ = "Additional Kernel Arguments "
year$ = DATE$
detailsonthislicense$ = "Details on licensing can be found
at"
' Introduce the user to the program.
'COLOR 0, 7 ' purty colors. No, I can't spell. Don't make
fun of me.
COLOR 0, 7
CLS
PRINT " ", thisprogrami8n$
PRINT
PRINT
PRINT
PRINT
PRINT
PRINT
PRINT
PRINT
PRINT
PRINT
PRINT
PRINT
PRINT
PRINT
PRINT
PRINT
PRINT
PRINT
PRINT
PRINT "Copyright (c)"; year$; ", Andrew B. Arthur
(aarthur@imaclinux.net)"
PRINT "BSD Licensed. ";
detailsonthislicense$; "http://bsdl.org/"
' Delay So People Can Read The Screen
SLEEP 5
thisisnothing$ = INKEY$
'Ask required questions.
CLS
PRINT " ", kernelandparti8n$
PRINT ""
' RAMDISK or DISK
PRINT "You can either set it to boot from a"
PRINT "ramdisk (for installing or floppy booting)"
PRINT "or from a a regular Hard Drive."
PRINT ""
PRINT "NOTE: You must use standard UNIX conventions."
PRINT ""
INPUT "Boot from a [r]amdisk or [h]ard Drive?
[h/r]";
ramordiskque$
IF ramordiskque$ = "h" THEN GOTO 80
IF ramordiskque$ = "r" THEN GOTO 70
'ramdisk size
70 INPUT "Ramdisk Size (In MB):"; ramdiskmb
ramdiskkb = ramdiskmb * 1024
rootpart$ = "/dev/ram"
GOTO 90
'root partition
80 INPUT "What is your root partition [from pdisk, in
standard /dev/blah fromat]"; rootpart$
IF rootpart$ = "0" THEN GOTO 90
PRINT ""
'Kernel Location
90 INPUT "Where is the kernel located [/boot/vmlinux]";
kernelpath$
IF kernelpath$ = "0" THEN
PRINT " ... no path specfied, defaulting
to /boot/vmlinux"
kernelpath$ = "/boot/vmlinux"
GOTO 100
END IF
100 CLS
PRINT " Video Card "
PRINT ""
PRINT "This screen chooses what video card you have."
PRINT
PRINT "You will be prompted if you have a certain card."
PRINT "If you do, say [y]. If not, say [n]."
PRINT
PRINT "If you don't see your driver, at the end of the list"
PRINT "you will be prompted to restart the list, or
manually"
PRINT "enter in the name of your Frame Buffer driver."
' ATI Mach64 CX or GX
110 INPUT "Do You Have a ATI Mach64 CX or GX [n/y]?"; atyfb$
IF atyfb$ = "y" THEN
video$ = "video=atyfb"
GOTO 200
END IF
IF atyfb$ = "n" THEN GOTO 120
' ATI Mach64 VT
120 INPUT "Do You Have a ATI Mach64 VT [n/y]?"; atyfb24$
IF atyfb24$ = "y" THEN
video$ = "video=atyfb"
COLOR 4, 7
PRINT "Warning: Requires Linux 2.4 to Get Good
Video"
COLOR 0, 7
GOTO 200
END IF
IF atyfb$ = "n" THEN GOTO 130
' ATI Rage 128
130 INPUT "Do You Have a ATI Rage 128 (Any Version)
[n/y]?"; aty128fb$
IF aty128fb$ = "y" THEN
video$ = "video=aty128fb"
GOTO 200
END IF
IF aty128fb$ = "n" THEN GOTO 140
' Twin Turbo II (for PCC Machines)
140 INPUT "Do You Have a Twin Turbo II (on PowerComputing
Machines) [n/y]?"; twintrbfb$
IF twintrbfb$ = "y" THEN
video$ = "video=txyfb"
GOTO 200
END IF
IF twintrbfb$ = "n" THEN GOTO 190
' Exausted Choices
190 PRINT ""
PRINT "Sorry, No More Choices Left."
PRINT ""
PRINT "Do You Want to [re]start the List or [man]ually
Enter"
INPUT "the FB Driver Name [re/man]?"; exhaustrestartfb$
IF exhaustrestartfb$ = "re" THEN GOTO 100
IF exhaustrestartfb$ = "man" THEN
PRINT
INPUT "Enter Your Frame Buffer Driver's Name [such
as atyfb]:"; manfb$
video$ = "video=" + manfb$
END IF
' Video Resolution
200 CLS
COLOR 2, 7
PRINT " Video Resolution "
COLOR 0, 7
PRINT ""
PRINT "Your Resolution, is the number of pixels"
PRINT "that will appear on your screen. A larger"
PRINT "value will make text smaller, but let you"
PRINT "put more on it, a smaller one will do the"
PRINT "opposite. "; ""
PRINT ""
PRINT "You may choose between 640x480, 800x600 and"
PRINT "1024x768. All values give you a 75 Hz Refresh."
PRINT
INPUT "Horizonal Resolution:", hzres$
' Table of Resolution
IF hzres$ = "1024x768" THEN hzres$ = "18"
IF hzres$ = "800x600" THEN hzres$ = "13"
IF hzres$ = "640x480" THEN hzres$ = "12"
' Video Colors
CLS
COLOR 2, 7
PRINT " Video Colors "
COLOR 0, 7
PRINT " "
PRINT "The number of colors you want to display"
PRINT "on your screen can be set below."
PRINT ""
PRINT "Most likely you will want to use the"
PRINT "highest number your screen supports."
PRINT ""
PRINT "Using too high of a value, will cause"
PRINT "you to get a blank screen upon boot."
PRINT ""
PRINT "For most people, they will want a value"
PRINT "of 32 (32 BPP = Millions of Colors)."
PRINT "If you have only a few MB of VRAM then"
PRINT "you should probably use 16"
PRINT "(16 BBP = Thousands of Colors)."
PRINT ""
PRINT ""
150 INPUT "Colors [16]:", hzcol$
IF hzcol$ = "0" THEN GOTO 150
CLS
PRINT TAB(35); addkernelargsi8n$
PRINT ""
LINE INPUT "Any other kernel arguments? "; kernelarg$
'Let's do some more cating, so to get this together.
kernelargsfull$ = append$ + "'" + video$ + ":" +
hzres$
+ ":" + hzcol$ + " " + kernelarg$
'Config Screen
CLS
PRINT TAB(40); "Generating Configuration..."
'Let's milk the sleep command again
'FOR t = 1 TO 500000 'Delay Loop
' NEXT t
SLEEP 5
anotherstupidcasttonowhere$ = INKEY$
'Introduce the user
COLOR 0, 7
CLS
PRINT "Below is a sample configuration file, you can cut
and"
PRINT "paste into another program."
PRINT ""
PRINT ""
PRINT "Your quik.conf:"
PRINT ""
PRINT ""
'Give them the data
COLOR 4, 7
PRINT "#Sample quik.conf"
PRINT "#Created by Yalamequik"; " on "; DATE$
PRINT boot$; kernelpath$; ""
PRINT root$; rootpart$
' Replace this with the cating one:
'PRINT append$; video$; " "; kernelarg$; ramdiskarg$;
ramdiskkb; "'"
'
'When you got nothing, you got nothing to lose.
'
PRINT kernelargsfull$; " "; ramdisk$; ramdiskkb; "'"
PRINT alias$; aliasarg$
' A generation lost in space
' Speaking of that, would the line "KILL c:" be funny ? :P
' Yes, I know I am mean. Commenting is fun.
PRINT
PRINT
PRINT
PRINT
PRINT
COLOR 0, 7
' Do you want to murder a tree?
INPUT "Do you want to dump it to the printer [y/n]?";
dumptoprinter$
IF dumptoprinter$ = "y" THEN
' Change to LPRINT in the future:
PRINT TAB(40); "** Below is a your sample
configuration file **"
PRINT
PRINT "To use this type in your favorite text
editior, and"
PRINT "save as /etc/quik.conf"
PRINT boot$; kernelpath$; ""
PRINT root$; rootpart$
PRINT append$; video$; " "; kernelarg$
PRINT alias$; aliasarg$
' Say Bye.
PRINT ""
PRINT ""
PRINT "PRINT Status: Now Printing..."
END IF
IF dumptoprinter$ = "n" THEN GOTO 2000
2000 END