From 5278e8b0b47117e51ea99ffcb382ec830b2ec9e8 Mon Sep 17 00:00:00 2001 From: "Ryan C. Gordon" Date: Fri, 2 Mar 2001 22:07:42 +0000 Subject: [PATCH] updated. --- CHANGELOG | 54 +++++++++++++++++++++++++++ Makefile | 17 +++++---- TODO | 13 ++++++- bb.pas | 20 ++++++++-- bbs.pas | 19 ++++++++++ cbbs.pas | 53 +++++++++++++++++++++++--- common.pas | 102 +++++++++++++++++++++++++++++++++++++++++++-------- common1.pas | 2 + conv17a.pas | 48 ++++++++++++++++++++++-- conv17a9.pas | 47 ++++++++++++++++++++++-- conv18a.pas | 48 ++++++++++++++++++++++-- cuser.pas | 16 +++++++- file9.pas | 5 +++ init.pas | 52 +++++++++++++++++++++----- logon2.pas | 15 ++++++-- mail0.pas | 17 +++++++-- myio.pas | 48 +++++++++++++++--------- rec25.pas | 28 ++++++++++---- sysop3.pas | 4 +- t2t.pas | 49 ++++++++++++++++++++++--- ta2z.pas | 36 ++++++++++++++++++ tmpcom.pas | 32 +++++++++++++--- wfcmenu.pas | 11 +++++- 23 files changed, 630 insertions(+), 106 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index e097acb..e7d8c8e 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,57 @@ +2000-12-17 Ryan C. Gordon + * More CPU burnage: put a delay() call in the loop that prompts for + local login (yes, no, fast). This is starting to annoy me. + * Implemented sysop1() in common.pas ... since we can't check the value + of scroll lock, it now checks the existance of a file (GFILES/sysop.in). + An external program/script can set this, since we aren't in a single + tasked DOS anymore, and it shouldn't be repeated disk accesses, since + Linux should just keep the directory entry cached. + * Put initial work in place for myio.pas's savescreen() and friends. This + is probably FreePascal (and Unix?) specific code, though. + * Started fucking with socket interface. Gave up. :) + +2000-12-13 Ryan C. Gordon + * Put delay(10) call in the wait for modem initialization response, to + reduce CPU burn. + * Put delay() call in getkey() (common.pas) to stop CPU chowing. + * Added check to verify that the terminal is exactly 80 chars wide and + at least 25 chars high. (mainline of bbs.pas) + +2000-11-30 Ryan C. Gordon + * Put delay() call in the telegard logo animation loop on the wfc menu. + Now the logo updates a little less than three times a second, and doesn't + starve the CPU. + * Changed Makefile temporarily to only build bbs and init. + +2000-11-27 Ryan C. Gordon + * More Y2K crud. This is a slow, slow process. + * mail0.pas's initbrd() was looking for capital filenames. Fixed. + +2000-11-26 Ryan C. Gordon + * Changed dosansi() in common.pas to just call write() instead of a + DOS int21h service. This allows the menus that are stored in .ANS + files to show up on the local side, albeit incorrectly at this point. + * Went on a Y2K rampage. Looked for places that used two-digit years, and + started making them use 4 digits. This allowed me to remove some prior + hacks, and make the system more robust in general. It will probably + introduce a few bugs where the system is less obviously expecting a two + digit year. We'll see. Some of the more obvious places where a two-digit + year might pass through now have checks that halt() if there's a problem. + * Changed all the INT21h-based versions of date() and time(). Have I + mentioned yet that I'm astounded by the amount of cut-and-pasting in + this codebase? I don't understand why they bothered to have a "common" + unit if so much common code was just duplicated all over the place. + * Added rcgpanic() to common.pas. Made some of the programs reference this + unit if they weren't already. The checks for two-digit year strings call + rcgpanic in case of trouble...this gives me a unified place to set a + break point and backtrace in gdb... + * init.pas filled in the init user record's birthday with a hardcoded + '00/00/00'. logon2.pas checks for this to see if it's a new record. + Fixed in both places. Changed cuser.pas's cstuff::doage() to accept and + understand 4-digit years. + * sysop3.pas showuserinfo::shi1() had an output that spilled past the 80 + char line limit once it was printing 4-digit years. Fixed. + 2000-11-24 Ryan C. Gordon * Aha! I think I stumbled upon the keypressed() problem. Looks like a piece of the overlay code was still in there and causing problems. diff --git a/Makefile b/Makefile index 5d6da05..8af1458 100644 --- a/Makefile +++ b/Makefile @@ -31,11 +31,11 @@ endif ifeq ($(strip $(debug)),true) BUILDDIR := $(cpu)/Debug PPC386FLAGS += -g # include debug symbols. - #PPC386FLAGS += -gc # generate checks for pointers. - #PPC386FLAGS += -Ct # generate stack-checking code. - #PPC386FLAGS += -Cr # generate range-checking code. - #PPC386FLAGS += -Co # generate overflow-checking code. - #PPC386FLAGS += -Ci # generate I/O-checking code. + PPC386FLAGS += -gc # generate checks for pointers. + PPC386FLAGS += -Ct # generate stack-checking code. + PPC386FLAGS += -Cr # generate range-checking code. + PPC386FLAGS += -Co # generate overflow-checking code. + PPC386FLAGS += -Ci # generate I/O-checking code. else BUILDDIR := $(cpu)/Release PPC386FLAGS += -Xs # strip the binary. @@ -70,10 +70,10 @@ PPC386FLAGS += -Sg #PPC386FLAGS += -Sm # Assembly statements are Intel-like (instead of AT&T-like). -#PPC386FLAGS += -Rintel +PPC386FLAGS += -Rintel # Output target Linux. !!! FIXME: Want win32 compiles? -#PPC386FLAGS += -TLINUX +PPC386FLAGS += -TLINUX # Pipe output to assembler, rather than to temp file. This is a little faster. #PPC386FLAGS += -P @@ -107,7 +107,8 @@ SPDATEEXE=$(BUILDDIR)/spdate $(BUILDDIR)/%.o : %.pas $(PPC386) $(PPC386FLAGS) $< -all: $(BUILDDIR) $(MAINEXE) $(MINITERMEXE) $(INITEXE) $(TPAGEEXE) $(IFLEXE) \ +all: $(BUILDDIR) $(MAINEXE) $(INITEXE) #\ + $(MINITERMEXE) $(TPAGEEXE) $(IFLEXE) \ $(FINDITEXE) $(OBLITEXE) $(MTESTEXE) $(BBEXE) $(CBBSEXE) \ $(MABSEXE) $(COCONFIGEXE) $(SPDATEEXE) $(T2TEXE) diff --git a/TODO b/TODO index e634fa8..33757f1 100644 --- a/TODO +++ b/TODO @@ -1,6 +1,15 @@ - grep -i "DOS" * -- rm sources ; cvs remove sources ; cvs commit -m "not needed" sources -- cvs add TODO ; cvs commit -m "initial add." TODO - Look for calls to bslash() and isul(). - Looks for DOSisms in ifl.pas. +- Look at rec25.pas, and check for filename storage of only 8 bytes in the + various records. Make it a full 255-character string at least. +- Looks like we've got some record clash. Hunt it out. +- Mail crashes. Record problems? +- ANSI code issues with write() +- Savescreen(), etc. +- wfc broken in xterm. +- More y2k shit +- modem/telnet support. + +// end of TODO ... diff --git a/bb.pas b/bb.pas index 2cac022..d81180e 100644 --- a/bb.pas +++ b/bb.pas @@ -5,7 +5,7 @@ program BatchBackup; uses crt,dos, - myio; + myio, common; {$I func.pas} @@ -52,6 +52,8 @@ begin end; function sdat(dt:datetime):string; +{rcg11272000 my add.} +var yearstr:string; function tch(i:integer):string; var s:string; @@ -63,15 +65,25 @@ function sdat(dt:datetime):string; end; begin - with dt do - sdat:=tch(month)+'/'+tch(day)+'/'+tch(year-1900)+' '+tch(hour)+':'+tch(min)+':'+tch(sec); + with dt do begin + {rcg11272000 y2k stuff.} + {sdat:=tch(month)+'/'+tch(day)+'/'+tch(year-1900)+' '+tch(hour)+':'+tch(min)+':'+tch(sec);} + str(year,yearstr); + sdat:=tch(month)+'/'+tch(day)+'/'+yearstr+' '+tch(hour)+':'+tch(min)+':'+tch(sec); + end; end; procedure unsdat(s:string; var dt:datetime); var x:integer; begin + + {rcg11272000 my add...} + if (length(s) < 10) then rcgpanic('WHOA! TWO DIGIT YEAR IN DATE!'); + with dt do begin - val(copy(s,7,2),year,x); inc(year,1900); + {rcg11272000 Y2K-proofing.} + {val(copy(s,7,2),year,x); inc(year,1900);} + val(copy(s,7,4),year,x); val(copy(s,1,2),month,x); val(copy(s,4,2),day,x); val(copy(s,10,2),hour,x); diff --git a/bbs.pas b/bbs.pas index 2c09191..79e9840 100644 --- a/bbs.pas +++ b/bbs.pas @@ -212,6 +212,25 @@ Begin close(systatf); end; + + {rcg12132000 added checks. Friggin' Xterms... :) } + if (ScreenWidth <> 80) then + begin + writeln; + writeln('Your terminal needs to be exactly 80 characters wide to run the BBS.'); + writeln(' If this is a window, please resize it.'); + halt(254); + end; + + if ((ScreenHeight < 25) or (ScreenHeight > 50)) then + begin + writeln; + writeln('Your terminal must be between 25 and 50 characters high to run the BBS.'); + writeln(' If this is a window, please resize it.'); + halt(254); + end; + + {rcg11172000 No overlay on Linux.} { ovrinit('bbs.OVR'); diff --git a/cbbs.pas b/cbbs.pas index 940f187..1936f35 100644 --- a/cbbs.pas +++ b/cbbs.pas @@ -1,4 +1,4 @@ -uses dos; +uses dos, common; var f:text; @@ -28,6 +28,9 @@ begin if s='' then value:=0; end; +{rcg11272000 dunno if this is even used, but it won't fly under Linux.} +{ below is a working implementation.} +{ function time:string; var r:registers; h,m,s:string[4]; @@ -36,7 +39,20 @@ begin str(r.cx shr 8,h); str(r.cx mod 256,m); str(r.dx shr 8,s); time:=tch(h)+':'+tch(m)+':'+tch(s); end; +} +function time:string; +var h,m,s:string[3]; + hh,mm,ss,ss100:word; +begin + gettime(hh,mm,ss,ss100); + str(hh,h); str(mm,m); str(ss,s); + time:=tch(h)+':'+tch(m)+':'+tch(s); +end; + +{rcg11272000 dunno if this is even used, but it won't fly under Linux.} +{ below is a working implementation, Y2K fixes included.} +{ function date:string; var r:registers; m,d,y:string[4]; @@ -45,6 +61,26 @@ begin str(r.dx shr 8,m); date:=tch(m)+'/'+tch(d)+'/'+tch(y); end; +} + +function date:string; +var + {rcg11272000 unused variable.} + {r:registers;} + + {rcg11272000 Y2K-proofing.} + {y,m,d:string[3];} + m,d:string[3]; + y:string[5]; + yy,mm,dd,dow:word; + +begin + getdate(yy,mm,dd,dow); + {rcg11272000 Y2K-proofing.} + {str(yy-1900,y); str(mm,m); str(dd,d);} + str(yy,y); str(mm,m); str(dd,d); + date:=tch(m)+'/'+tch(d)+'/'+y; +end; function leapyear(yr:integer):boolean; begin @@ -75,11 +111,14 @@ begin d:=value(copy(dt,4,2)); {rcg11182000 hahahaha...a Y2K bug. :) } - y:=value(copy(dt,7,2))+1900; + {rcg11272000 Let's make sure the values coming in here are four } + {digits in the first place, which should save us some hacks elsewhere...} + {y:=value(copy(dt,7,2))+1900;} - {rcg11182000 added this conditional. } - if (y < 1977) then { Ugh...this is so bad. } - y := y + 100; + {rcg11272000 my adds...} + if (length(dt) < 10) then rcgpanic('WHOA! TWO DIGIT YEAR IN DATE!'); + y:=value(copy(dt,7,4)); + {rcg11272000 end my adds...} for c:=1985 to y-1 do if leapyear(c) then t:=t+366 else t:=t+365; @@ -102,7 +141,9 @@ begin 2:x:='Thu'; end; y:=mon[value(copy(date,1,2))]; - x:=x+' '+y+' '+copy(date,4,2)+', '+cstr(1900+value(copy(date,7,2))); + {rcg11272000 Y2K-proofing.} + {x:=x+' '+y+' '+copy(date,4,2)+', '+cstr(1900+value(copy(date,7,2)));} + x:=x+' '+y+' '+copy(date,4,2)+', '+cstr(value(copy(date,7,4))); y:=time; i:=value(copy(y,1,2)); if i>11 then ap:='pm' else ap:='am'; if i>12 then i:=i-12; diff --git a/common.pas b/common.pas index 4bfc449..84a93ea 100644 --- a/common.pas +++ b/common.pas @@ -19,6 +19,13 @@ type f_initexecswap = function(p:pointer; s:string):boolean; f_execwithswap = function(p,c:string):word; p_shutdownexecswap = procedure; + +{rcg12012000 my adds.} +var ansibuf:string; +const ansiset:set of char=['0'..'9','A'..'D','[',';','?','H', 'J','K','m','h']; +{rcg12012000 my adds end.} + + var initexecswap2:f_initexecswap; execwithswap2:f_execwithswap; shutdownexecswap2:p_shutdownexecswap; @@ -253,6 +260,10 @@ var hiubatchv:integer; +{rcg11272000 added by me.} +procedure rcgpanic(s:string); + + function lenn(s:string):integer; function lennmci(s:string):integer; procedure loaduboard(i:integer); @@ -515,6 +526,18 @@ procedure com_set_speed(speed:word); begin tmpcom.com_set_speed(speed); end; var cfilter:cfilterrec; cfiltertype,cfilternum,cfiltercount:integer; + +{rcg11272000 added by me.} +procedure rcgpanic(s:string); +begin + NormVideo; + clrscr; + writeln('PANIC: ' + s + ' ...'); + writeln(' ... halting ...'); + halt(69); +end; + + procedure shelldos(bat:boolean; cl:string; var rcode:integer); var t:text; s:string; @@ -1053,8 +1076,7 @@ begin end; } begin - writeln('STUB: common.pas; sysop1()...'); - sysop1 := FALSE; + sysop1 := exist(systat.gfilepath+'sysop.in'); end; @@ -1130,13 +1152,22 @@ begin end; function date:string; -var r:registers; - y,m,d:string[3]; +var + {rcg11272000 unused variable.} + {r:registers;} + + {rcg11272000 Y2K-proofing.} + {y,m,d:string[3];} + m,d:string[3]; + y:string[5]; yy,mm,dd,dow:word; + begin getdate(yy,mm,dd,dow); - str(yy-1900,y); str(mm,m); str(dd,d); - date:=tch(m)+'/'+tch(d)+'/'+tch(y); + {rcg11272000 Y2K-proofing.} + {str(yy-1900,y); str(mm,m); str(dd,d);} + str(yy,y); str(mm,m); str(dd,d); + date:=tch(m)+'/'+tch(d)+'/'+y; end; function value(s:string):longint; @@ -1167,12 +1198,16 @@ end; function ageuser(bday:string):integer; var i:integer; begin - i:=value(copy(date,7,2))-value(copy(bday,7,2)); - {rcg11242000 Y2K hack.} - i := i + 100; + {rcg11272000 my add...} + if (length(bday) < 10) then rcgpanic('WHOA! TWO DIGIT YEAR IN BIRTHDAY DATE!'); - if (daynum(copy(bday,1,6)+copy(date,7,2))>daynum(date)) then dec(i); + {rcg11272000 y2k issues...} + {i:=value(copy(date,7,2))-value(copy(bday,7,2));} + {if (daynum(copy(bday,1,6)+copy(date,7,2))>daynum(date)) then dec(i);} + + i:=value(copy(date,7,4))-value(copy(bday,7,4)); + if (daynum(copy(bday,1,6)+copy(date,7,4))>daynum(date)) then dec(i); ageuser:=i; end; @@ -1222,13 +1257,15 @@ begin t:=0; m:=value(copy(dt,1,2)); d:=value(copy(dt,4,2)); - {rcg11182000 hahahaha...a Y2K bug. :) } - y:=value(copy(dt,7,2))+1900; + {rcg11272000 Let's make sure the values coming in here are four } + {digits in the first place, which should save us some hacks elsewhere...} + {y:=value(copy(dt,7,2))+1900;} - {rcg11182000 added this conditional. } - if (y < 1977) then { Ugh...this is so bad. } - y := y + 100; + {rcg11272000 my adds...} + if (length(dt) < 10) then rcgpanic('WHOA! TWO DIGIT YEAR IN DATE!'); + y:=value(copy(dt,7,4)); + {rcg11272000 end my adds...} for c:=1985 to y-1 do if (leapyear(c)) then inc(t,366) else inc(t,365); @@ -1483,6 +1520,8 @@ end; *) procedure dosansi(c:char); +{rcg11262000 DOSism.} +{ var r:registers; begin with r do begin @@ -1490,6 +1529,31 @@ begin msdos(r); end; end; +} + +{rcg12012000 must buffer ANSI sequences for bug in FreePascal.} + +begin + + { there's something in the buffer and it can be safely dumped? } + if ((ansibuf[0] <> #0) and (not (c in ansiset))) then + begin + write(ansibuf); { dump to crt driver. } + ansibuf[0] := #0; { reset buffer. } + end; + + if ((ansibuf[0] <> #0) or (c = #27)) then { add to or start the buffer? } + begin + inc(ansibuf[0]); + ansibuf[ord(ansibuf[0])] := c; + end + + else + begin + write(c); { no need to buffer at this time; just write to crt... } + end; +end; + procedure lpromptc(c:char); var ss:string; @@ -1944,6 +2008,9 @@ begin 5:begin sound(3400); delay(55); end; end; aphase:=aphase mod 5+1; + {rcg12132000 else added by me to stop CPU chowing.} + end else begin + delay(10); end; if (ch) then c:=chinkey else c:=inkey; @@ -2850,10 +2917,15 @@ function verline(i:integer):string; var s:string; begin case i of + {rcg11252000 changed.} + { 1:begin s:='Project Coyote 0.14 Alpha '; end; 2:s:='Complied By Robert Merritt on 11-19-92'; + } + 1:s:='Penguin Telegard 0.0.1'; + 2:s:='Send complaints to Ryan C. Gordon '; end; verline:=s; end; diff --git a/common1.pas b/common1.pas index 3c4b5ce..978a00d 100644 --- a/common1.pas +++ b/common1.pas @@ -292,7 +292,9 @@ end; procedure chatfile(b:boolean); var bf:file of byte; s:string[91]; + trimmedfile:string; cr:boolean; + i, j: integer; begin s:='chat'; if (thisuser.chatseperate) then s:=s+cstr(usernum); diff --git a/conv17a.pas b/conv17a.pas index bcac61a..7372e2e 100644 --- a/conv17a.pas +++ b/conv17a.pas @@ -147,6 +147,9 @@ begin tch:=i; end; +{rcg11272000 dunno if this is even used, but it won't fly under Linux.} +{ below is a working implementation.} +{ function time:astr; var reg:registers; h,m,s:string[4]; @@ -155,7 +158,20 @@ begin str(reg.cx shr 8,h); str(reg.cx mod 256,m); str(reg.dx shr 8,s); time:=tch(h)+':'+tch(m)+':'+tch(s); end; +} +function time:string; +var h,m,s:string[3]; + hh,mm,ss,ss100:word; +begin + gettime(hh,mm,ss,ss100); + str(hh,h); str(mm,m); str(ss,s); + time:=tch(h)+':'+tch(m)+':'+tch(s); +end; + +{rcg11272000 dunno if this is even used, but it won't fly under Linux.} +{ below is a working implementation, Y2K fixes included.} +{ function date:astr; var reg:registers; m,d,y:string[4]; @@ -164,6 +180,27 @@ begin str(reg.dx shr 8,m); date:=tch(m)+'/'+tch(d)+'/'+tch(y); end; +} + +function date:string; +var + {rcg11272000 unused variable.} + {r:registers;} + + {rcg11272000 Y2K-proofing.} + {y,m,d:string[3];} + m,d:string[3]; + y:string[5]; + yy,mm,dd,dow:word; + +begin + getdate(yy,mm,dd,dow); + {rcg11272000 Y2K-proofing.} + {str(yy-1900,y); str(mm,m); str(dd,d);} + str(yy,y); str(mm,m); str(dd,d); + date:=tch(m)+'/'+tch(d)+'/'+y; +end; + function leapyear(yr:integer):boolean; begin @@ -194,11 +231,14 @@ begin d:=value(copy(dt,4,2)); {rcg11182000 hahahaha...a Y2K bug. :) } - y:=value(copy(dt,7,2))+1900; + {rcg11272000 Let's make sure the values coming in here are four } + {digits in the first place, which should save us some hacks elsewhere...} + {y:=value(copy(dt,7,2))+1900;} - {rcg11182000 added this conditional. } - if (y < 1977) then { Ugh...this is so bad. } - y := y + 100; + {rcg11272000 my adds...} + if (length(dt) < 10) then rcgpanic('WHOA! TWO DIGIT YEAR IN DATE!'); + y:=value(copy(dt,7,4)); + {rcg11272000 end my adds...} for c:=1985 to y-1 do if leapyear(c) then t:=t+366 else t:=t+365; diff --git a/conv17a9.pas b/conv17a9.pas index 03ebf19..1b56dba 100644 --- a/conv17a9.pas +++ b/conv17a9.pas @@ -172,6 +172,9 @@ begin tch:=i; end; +{rcg11272000 dunno if this is even used, but it won't fly under Linux.} +{ below is a working implementation.} +{ function time:astr; var reg:registers; h,m,s:string[4]; @@ -180,7 +183,20 @@ begin str(reg.cx shr 8,h); str(reg.cx mod 256,m); str(reg.dx shr 8,s); time:=tch(h)+':'+tch(m)+':'+tch(s); end; +} +function time:string; +var h,m,s:string[3]; + hh,mm,ss,ss100:word; +begin + gettime(hh,mm,ss,ss100); + str(hh,h); str(mm,m); str(ss,s); + time:=tch(h)+':'+tch(m)+':'+tch(s); +end; + +{rcg11272000 dunno if this is even used, but it won't fly under Linux.} +{ below is a working implementation, Y2K fixes included.} +{ function date:astr; var reg:registers; m,d,y:string[4]; @@ -189,6 +205,26 @@ begin str(reg.dx shr 8,m); date:=tch(m)+'/'+tch(d)+'/'+tch(y); end; +} + +function date:string; +var + {rcg11272000 unused variable.} + {r:registers;} + + {rcg11272000 Y2K-proofing.} + {y,m,d:string[3];} + m,d:string[3]; + y:string[5]; + yy,mm,dd,dow:word; + +begin + getdate(yy,mm,dd,dow); + {rcg11272000 Y2K-proofing.} + {str(yy-1900,y); str(mm,m); str(dd,d);} + str(yy,y); str(mm,m); str(dd,d); + date:=tch(m)+'/'+tch(d)+'/'+y; +end; function leapyear(yr:integer):boolean; begin @@ -219,11 +255,14 @@ begin d:=value(copy(dt,4,2)); {rcg11182000 hahahaha...a Y2K bug. :) } - y:=value(copy(dt,7,2))+1900; + {rcg11272000 Let's make sure the values coming in here are four } + {digits in the first place, which should save us some hacks elsewhere...} + {y:=value(copy(dt,7,2))+1900;} - {rcg11182000 added this conditional. } - if (y < 1977) then { Ugh...this is so bad. } - y := y + 100; + {rcg11272000 my adds...} + if (length(dt) < 10) then rcgpanic('WHOA! TWO DIGIT YEAR IN DATE!'); + y:=value(copy(dt,7,4)); + {rcg11272000 end my adds...} for c:=1985 to y-1 do if leapyear(c) then t:=t+366 else t:=t+365; diff --git a/conv18a.pas b/conv18a.pas index 1881f2b..fd04236 100644 --- a/conv18a.pas +++ b/conv18a.pas @@ -157,6 +157,9 @@ begin tch:=i; end; +{rcg11272000 dunno if this is even used, but it won't fly under Linux.} +{ below is a working implementation.} +{ function time:astr; var reg:registers; h,m,s:string[4]; @@ -165,7 +168,20 @@ begin str(reg.cx shr 8,h); str(reg.cx mod 256,m); str(reg.dx shr 8,s); time:=tch(h)+':'+tch(m)+':'+tch(s); end; +} +function time:string; +var h,m,s:string[3]; + hh,mm,ss,ss100:word; +begin + gettime(hh,mm,ss,ss100); + str(hh,h); str(mm,m); str(ss,s); + time:=tch(h)+':'+tch(m)+':'+tch(s); +end; + +{rcg11272000 dunno if this is even used, but it won't fly under Linux.} +{ below is a working implementation, Y2K fixes included.} +{ function date:astr; var reg:registers; m,d,y:string[4]; @@ -174,6 +190,27 @@ begin str(reg.dx shr 8,m); date:=tch(m)+'/'+tch(d)+'/'+tch(y); end; +} + +function date:string; +var + {rcg11272000 unused variable.} + {r:registers;} + + {rcg11272000 Y2K-proofing.} + {y,m,d:string[3];} + m,d:string[3]; + y:string[5]; + yy,mm,dd,dow:word; + +begin + getdate(yy,mm,dd,dow); + {rcg11272000 Y2K-proofing.} + {str(yy-1900,y); str(mm,m); str(dd,d);} + str(yy,y); str(mm,m); str(dd,d); + date:=tch(m)+'/'+tch(d)+'/'+y; +end; + function leapyear(yr:integer):boolean; begin @@ -204,11 +241,14 @@ begin d:=value(copy(dt,4,2)); {rcg11182000 hahahaha...a Y2K bug. :) } - y:=value(copy(dt,7,2))+1900; + {rcg11272000 Let's make sure the values coming in here are four } + {digits in the first place, which should save us some hacks elsewhere...} + {y:=value(copy(dt,7,2))+1900;} - {rcg11182000 added this conditional. } - if (y < 1977) then { Ugh...this is so bad. } - y := y + 100; + {rcg11272000 my adds...} + if (length(dt) < 10) then rcgpanic('WHOA! TWO DIGIT YEAR IN DATE!'); + y:=value(copy(dt,7,4)); + {rcg11272000 end my adds...} for c:=1985 to y-1 do if leapyear(c) then t:=t+366 else t:=t+365; diff --git a/cuser.pas b/cuser.pas index 7303629..5b2bb07 100644 --- a/cuser.pas +++ b/cuser.pas @@ -84,16 +84,28 @@ var done,done1:boolean; end; begin - if (how=3) then prompt('Enter date of birth (mm/dd/yy) : ') + {rcg11272000 y2k stuff.} + {if (how=3) then prompt('Enter date of birth (mm/dd/yy) : ')} + + if (how=3) then prompt('Enter date of birth (mm/dd/yyyy) : ') else begin sprint('^301^5=January ^304^5=April ^307^5=July ^310^5=October'); sprint('^302^5=February ^305^5=May ^308^5=August ^311^5=November'); sprint('^303^5=March ^306^5=June ^309^5=September ^312^5=December'); nl; - prt('Enter your date of birth (mm/dd/yy) : '); + {rcg11272000 y2k stuff.} + {prt('Enter your date of birth (mm/dd/yy) : ');} + prt('Enter your date of birth (mm/dd/yyyy) : '); end; + + {rcg11272000 y2k stuff.} + { cl(3); input(s,8); if ((length(s)=8) and (s[3]='/') and (s[6]='/')) then + } + + cl(3); input(s,10); + if ((length(s)=10) and (s[3]='/') and (s[6]='/')) then if (numsok(s)) then if (ageuser(s)<3) then sprint(#3#7+'Isn''t '+cstr(ageuser(s))+' years old a little YOUNG???') diff --git a/file9.pas b/file9.pas index 6078744..a5fd7b7 100644 --- a/file9.pas +++ b/file9.pas @@ -51,8 +51,13 @@ begin unpacktime(dirinfo.time,dt); with dt do begin if hour<13 then pm:='a' else begin pm:='p'; hour:=hour-12; end; + {rcg11272000 Y2K-proofing.} + { s:=s+' '+mrn(cstr(month),2)+'-'+ti(day)+'-'+ti(year-1900)+ ' '+mrn(cstr(hour),2)+':'+ti(min)+pm; + } + s:=s+' '+mrn(cstr(month),2)+'-'+ti(day)+'-'+cstr(year)+ + ' '+mrn(cstr(hour),2)+':'+ti(min)+pm; end; info:=s; end; diff --git a/init.pas b/init.pas index 4a07bf5..3018f66 100644 --- a/init.pas +++ b/init.pas @@ -158,11 +158,13 @@ begin d:=value(copy(dt,4,2)); {rcg11182000 hahahaha...a Y2K bug. :) } - y:=value(copy(dt,7,2))+1900; + {rcg11272000 Let's make sure the values coming in here are four } + {digits in the first place, which should save us some hacks elsewhere...} + {y:=value(copy(dt,7,2))+1900;} - {rcg11182000 added this conditional. } - if (y < 1977) then { Ugh...this is so bad. } - y := y + 100; + {rcg11272000 my adds...} + y:=value(copy(dt,7,4)); + {rcg11272000 end my adds...} for c:=1985 to y-1 do if (leapyear(c)) then inc(t,366) else inc(t,365); @@ -187,14 +189,23 @@ begin time:=tch(h)+':'+tch(m)+':'+tch(s); end; -function date:astr; -var r:registers; - y,m,d:string[3]; +function date:string; +var + {rcg11272000 unused variable.} + {r:registers;} + + {rcg11272000 Y2K-proofing.} + {y,m,d:string[3];} + m,d:string[3]; + y:string[5]; yy,mm,dd,dow:word; + begin getdate(yy,mm,dd,dow); - str(yy-1900,y); str(mm,m); str(dd,d); - date:=tch(m)+'/'+tch(d)+'/'+tch(y); + {rcg11272000 Y2K-proofing.} + {str(yy-1900,y); str(mm,m); str(dd,d);} + str(yy,y); str(mm,m); str(dd,d); + date:=tch(m)+'/'+tch(d)+'/'+y; end; procedure ttl(s:string); @@ -717,7 +728,11 @@ begin realname:='System Operator'; pw:='SYSOP'; ph:='000-000-0000'; - bday:='00/00/00'; + + {rcg11272000 y2k stuff.} + {bday:='00/00/00';} + bday:='00/00/0000'; + firston:=date; laston:=date; street:=''; @@ -957,6 +972,9 @@ begin assign(brdf,'email.brd'); rewrite(brdf,1); + + {rcg12152000 changed for sanity...} + { lng:=$FC020010; blockwrite(brdf,lng,4); lng:=$DCBA0123; blockwrite(brdf,lng,4); blockwrite(brdf,lsize,4); @@ -967,6 +985,20 @@ begin blockwrite(brdf,s[0],1); blockwrite(brdf,s[1],ord(s[0])); end; + } + +{ + lng:=$FC020010; blockwrite(brdf,lng,sizeof (lng)); + lng:=$DCBA0123; blockwrite(brdf,lng,sizeof (lng)); + blockwrite(brdf,lsize,sizeof (lsize)); + + while (not eof(t)) do begin + readln(t,s); + bb:=$FF; blockwrite(brdf,bb,sizeof (bb)); + blockwrite(brdf,s[0],1); + blockwrite(brdf,s[1],ord(s[0])); + end; +} close(t); erase(t); diff --git a/logon2.pas b/logon2.pas index 43d4892..03a2ca7 100644 --- a/logon2.pas +++ b/logon2.pas @@ -77,15 +77,20 @@ var ul:text; function checkbday:boolean; var i,j:integer; begin - i:=85; + {rcg11282000 Y2K stuff.} + {i:=85;} + i := 1985; repeat - j:=daynum(copy(thisuser.bday,1,6)+tch(cstr(i))); + {rcg11282000 y2k stuff.} + {j:=daynum(copy(thisuser.bday,1,6)+tch(cstr(i)));} + j:=daynum(copy(thisuser.bday,1,6)+cstr(i)); if (daynum(date)>=j) and (daynum(thisuser.laston)value(copy(date,7,2))); + {until (i>value(copy(date,7,2)));} + until (i>value(copy(date,7,4))); checkbday:=FALSE; end; @@ -247,7 +252,9 @@ begin if (not wasguestuser) then begin if (thisuser.flistopt=0) then thisuser.flistopt:=1; - if (thisuser.bday='00/00/00') then begin + {rcg11272000 y2k stuff.} + {if (thisuser.bday='00/00/00') then begin} + if (thisuser.bday='00/00/0000') then begin print('Updating system records ...'); cstuff(2,1,thisuser); nl; diff --git a/mail0.pas b/mail0.pas index f0ea327..6740a17 100644 --- a/mail0.pas +++ b/mail0.pas @@ -219,13 +219,20 @@ begin closebrd; bread:=x; - if (x=-1) then fn:='EMAIL' else begin + {rcg11272000 filename case.} + {if (x=-1) then fn:='EMAIL' else begin} + if (x=-1) then fn:='email' else begin loadboard(x); fn:=memboard.filename; end; - fn:=allcaps(fn); + + {rcg11272000 filename case.} + {fn:=allcaps(fn);} brdfnopen:=fn; - assign(mixf,systat.msgpath+fn+'.MIX'); + + {rcg11272000 filename case.} + {assign(mixf,systat.msgpath+fn+'.MIX');} + assign(mixf,systat.msgpath+fn+'.mix'); {$I-} reset(mixf,sizeof(mixr)); {$I+} if (ioresult<>0) then begin rewrite(mixf,sizeof(mixr)); @@ -243,7 +250,9 @@ begin blockwrite(mixf,mintab[0],100); end; - assign(brdf,systat.msgpath+fn+'.BRD'); + {rcg11272000 filename case.} + {assign(brdf,systat.msgpath+fn+'.BRD');} + assign(brdf,systat.msgpath+fn+'.brd'); {$I-} reset(brdf,1); {$I+} if (ioresult<>0) then rewrite(brdf,1); diff --git a/myio.pas b/myio.pas index e6568e5..ad1e771 100644 --- a/myio.pas +++ b/myio.pas @@ -406,29 +406,35 @@ begin end; procedure savescreen(var wind:windowrec; TLX,TLY,BRX,BRY:integer); -{rcg11172000 this only flies under DOS.} -{ var x,y,i:integer; +{rcg12152000 my add.} +arraypos : integer; begin checkvidseg; + { !!! uhoh...problems in xterms? } + wind[4000]:=TLX; wind[4001]:=TLY; wind[4002]:=BRX; wind[4003]:=BRY; + i:=0; for y:=TLY to BRY do for x:=TLX to BRX do begin + {rcg11172000 this only flies under DOS.} + { inline($FA); wind[i]:=mem[vidseg:(160*(y-1)+2*(x-1))]; wind[i+1]:=mem[vidseg:(160*(y-1)+2*(x-1))+1]; inline($FB); + } + { !!! this might be FreePascal/Linux-specific...} + arraypos := ((y * ScreenWidth) + x); + wind[i] := byte(ConsoleBuf^[arraypos].ch); + wind[i+1] := ConsoleBuf^[arraypos].attr; inc(i,2); end; end; -} -begin - writeln('STUB: myio.pas; savescreen()...'); -end; procedure setwindow(var wind:windowrec; TLX,TLY,BRX,BRY,tcolr,bcolr,boxtype:integer); {rcg11172000 unused variable.} @@ -442,9 +448,9 @@ begin end; procedure removewindow(wind:windowrec); -{rcg11172000 this only flies under DOS.} -{ var TLX,TLY,BRX,BRY,x,y,i:integer; +{rcg12152000 my add.} +arraypos : integer; begin checkvidseg; @@ -457,17 +463,20 @@ begin i:=0; for y:=TLY to BRY do for x:=TLX to BRX do begin + {rcg11172000 this only flies under DOS.} + { inline($FA); mem[vidseg:(160*(y-1)+2*(x-1))]:=wind[i]; mem[vidseg:(160*(y-1)+2*(x-1))+1]:=wind[i+1]; inline($FB); + } + { !!! this might be FreePascal/Linux-specific...} + arraypos := ((y * ScreenWidth) + x); + ConsoleBuf^[arraypos].ch := char(wind[i]); + ConsoleBuf^[arraypos].attr := wind[i+1]; inc(i,2); end; end; -} -begin - writeln('STUB: myio.pas; removewindow()...'); -end; procedure removewindow1(wind:windowrec); var oldx1,oldy1,oldx2,oldy2,sx,sy,sz:byte; @@ -483,9 +492,9 @@ begin end; procedure movewindow(wind:windowrec; TLX,TLY:integer); -{rcg11172000 this only flies under DOS.} -{ var BRX,BRY,x,y,i:integer; +{rcg12152000 my add.} +arraypos : integer; begin checkvidseg; @@ -498,16 +507,19 @@ begin i:=0; for y:=TLY to BRY do for x:=TLX to BRX do begin + {rcg11172000 this only flies under DOS.} + { inline($FA); mem[vidseg:(160*(y-1)+2*(x-1))]:=wind[i]; mem[vidseg:(160*(y-1)+2*(x-1))+1]:=wind[i+1]; inline($FB); + } + { !!! this might be FreePascal/Linux-specific...} + arraypos := ((y * ScreenWidth) + x); + wind[i] := byte(ConsoleBuf^[arraypos].ch); + wind[i+1] := ConsoleBuf^[arraypos].attr; inc(i,2); end; end; -} -begin - writeln('STUB: myio.pas; movewindow()...'); -end; end. diff --git a/rec25.pas b/rec25.pas index 02a01b6..8b34154 100644 --- a/rec25.pas +++ b/rec25.pas @@ -83,10 +83,14 @@ TYPE realname:string[36]; { real name } pw:string[20]; { user password } ph:string[12]; { user phone # } - bday:string[8]; { user birthdate } - firston:string[8]; { firston date } + {rcg11272000 Y2K limitations.} + (*bday:string[8]; { user birthdate }*) + (*firston:string[8]; { firston date }*) + (*laston:string[8]; { laston date }*) + bday:string[10]; { user birthdate } + firston:string[10]; { firston date } x1xs :array[1..2] of byte; - laston:string[8]; { laston date } + laston:string[10]; { laston date } x2xs :array[1..2] of byte; street:string[30]; { mailing address } citystate:string[30]; { city, state } @@ -224,7 +228,9 @@ TYPE zlogrec= { ZLOG.DAT : System log } record - date:string[8]; + {rcg11272000 Y2K bullshite.} + {date:string[8];} + date:string[10]; userbaud:array[0..4] of integer; active,calls,newusers,pubpost,privpost,fback,criterr:integer; uploads,downloads:integer; @@ -341,7 +347,9 @@ TYPE closedsystem:boolean; { DON'T allow new users? } swapshell:boolean; { is swap shell function enabled? } eventwarningtime:integer; { time before event warning } - tfiledate:string[8]; { last date text-files were inserted } + {rcg11272000 y2k stuff.} + (*tfiledate:string[8]; { last date text-files were inserted }*) + tfiledate:string[10]; { last date text-files were inserted } lastmsgid:longint; { last-used message ID (sequential) } res1:array[1..20] of byte; { RESERVED SPACE #1 } @@ -452,7 +460,9 @@ TYPE dlkratio, { DLk/ULk ratios } postratio:secrange; { post/call ratios } - lastdate:string[8]; { last system date } + {rcg11272000 y2k stuff.} + (*lastdate:string[8]; { last system date }*) + lastdate:string[10]; { last system date } curwindow:byte; { type of SysOp window currently in use } istopwindow:boolean; { is SysOp window on top of screen? } callernum:longint; { total number of callers } @@ -479,7 +489,9 @@ TYPE record title:string[40]; { title } filen:string[12]; { filename } - gdate:string[8]; { date of Tfile / Tfile base } + {rcg11272000 Y2K shit.} + (*gdate:string[8]; { date of Tfile / Tfile base }*) + gdate:string[10]; { date of Tfile / Tfile base } gdaten:integer; { numeric date for fast calculation } acs, { access requirement } ulacs:acstring; { upload to base access requirement } @@ -590,6 +602,8 @@ TYPE blocks:integer; { # 128 byte blks } owner:integer; { ULer of file } stowner:string[36]; { ULer's name } + {rcg11272000 y2k stuff.} + (*date:string[8]; { Date ULed }*) date:string[8]; { Date ULed } daten:integer; { Numeric date ULed } vpointer:longint; { Pointer to verbose descr, -1 if none } diff --git a/sysop3.pas b/sysop3.pas index 5b3097a..d7af1a9 100644 --- a/sysop3.pas +++ b/sysop3.pas @@ -113,7 +113,9 @@ var ii:array[1..12] of astr; #3#3+sex+cstr(ageuser(bday))+' ('+bday+')'; 5:ii[5]:='City / State :'+#3#3+mln(citystate,30)+#3#1+' Zip-code:'+#3#3+zipcode; 6:ii[6]:='Computer type:'+#3#3+mln(computer,30)+#3#1+' Phone # :'+#3#3+ph; - 7:ii[7]:='SysOp note :'+#3#3+mln(note,35)+#3#1+'Last/1st:'+#3#3+laston+' ('+firston+')'; + {rcg11272000 didn't fit on an 8-char line once the years were 4-digit.} + {7:ii[7]:='SysOp note :'+#3#3+mln(note,35)+#3#1+'Last/1st:'+#3#3+laston+' ('+firston+')';} + 7:ii[7]:='SysOp note :'+#3#3+mln(note,35)+#3#1+'Last/1st:'+#3#3+laston+' '+firston; 8:begin ii[8]:='Occupation :'+#3#3+mln(occupation,35)+#3#1+'Lockfile:'; if lockedout then ii[8]:=ii[8]+#3#7+lockedfile+'.MSG' else diff --git a/t2t.pas b/t2t.pas index 20b5c00..3f47efe 100644 --- a/t2t.pas +++ b/t2t.pas @@ -3,7 +3,7 @@ uses crt,dos, - myio; + myio, common; {$I tagr24d.pas} {$I rec18a.pas} @@ -103,6 +103,9 @@ begin tch:=i; end; +{rcg11272000 dunno if this is even used, but it won't fly under Linux.} +{ below is a working implementation.} +{ function time:astr; var reg:registers; h,m,s:string[4]; @@ -111,7 +114,20 @@ begin str(reg.cx shr 8,h); str(reg.cx mod 256,m); str(reg.dx shr 8,s); time:=tch(h)+':'+tch(m)+':'+tch(s); end; +} +function time:string; +var h,m,s:string[3]; + hh,mm,ss,ss100:word; +begin + gettime(hh,mm,ss,ss100); + str(hh,h); str(mm,m); str(ss,s); + time:=tch(h)+':'+tch(m)+':'+tch(s); +end; + +{rcg11272000 dunno if this is even used, but it won't fly under Linux.} +{ below is a working implementation, Y2K fixes included.} +{ function date:astr; var reg:registers; m,d,y:string[4]; @@ -120,6 +136,26 @@ begin str(reg.dx shr 8,m); date:=tch(m)+'/'+tch(d)+'/'+tch(y); end; +} + +function date:string; +var + {rcg11272000 unused variable.} + {r:registers;} + + {rcg11272000 Y2K-proofing.} + {y,m,d:string[3];} + m,d:string[3]; + y:string[5]; + yy,mm,dd,dow:word; + +begin + getdate(yy,mm,dd,dow); + {rcg11272000 Y2K-proofing.} + {str(yy-1900,y); str(mm,m); str(dd,d);} + str(yy,y); str(mm,m); str(dd,d); + date:=tch(m)+'/'+tch(d)+'/'+y; +end; function leapyear(yr:integer):boolean; begin @@ -150,11 +186,14 @@ begin d:=value(copy(dt,4,2)); {rcg11182000 hahahaha...a Y2K bug. :) } - y:=value(copy(dt,7,2))+1900; + {rcg11272000 Let's make sure the values coming in here are four } + {digits in the first place, which should save us some hacks elsewhere...} + {y:=value(copy(dt,7,2))+1900;} - {rcg11182000 added this conditional. } - if (y < 1977) then { Ugh...this is so bad. } - y := y + 100; + {rcg11272000 my adds...} + if (length(dt) < 10) then rcgpanic('WHOA! TWO DIGIT YEAR IN DATE!'); + y:=value(copy(dt,7,4)); + {rcg11272000 end my adds...} for c:=1985 to y-1 do if leapyear(c) then t:=t+366 else t:=t+365; diff --git a/ta2z.pas b/ta2z.pas index ee79c0c..6d43004 100644 --- a/ta2z.pas +++ b/ta2z.pas @@ -52,6 +52,9 @@ begin tch:=i; end; +{rcg11272000 dunno if this is even used, but it won't fly under Linux.} +{ below is a working implementation, Y2K fixes included.} +{ function date:astr; var reg:registers; m,d,y:string[4]; @@ -60,7 +63,30 @@ begin str(reg.dx shr 8,m); date:=tch(m)+'/'+tch(d)+'/'+tch(y); end; +} +function date:string; +var + {rcg11272000 unused variable.} + {r:registers;} + + {rcg11272000 Y2K-proofing.} + {y,m,d:string[3];} + m,d:string[3]; + y:string[5]; + yy,mm,dd,dow:word; + +begin + getdate(yy,mm,dd,dow); + {rcg11272000 Y2K-proofing.} + {str(yy-1900,y); str(mm,m); str(dd,d);} + str(yy,y); str(mm,m); str(dd,d); + date:=tch(m)+'/'+tch(d)+'/'+y; +end; + +{rcg11272000 dunno if this is even used, but it won't fly under Linux.} +{ below is a working implementation.} +{ function time:astr; var reg:registers; h,m,s:string[4]; @@ -69,6 +95,16 @@ begin str(reg.cx shr 8,h); str(reg.cx mod 256,m); str(reg.dx shr 8,s); time:=tch(h)+':'+tch(m)+':'+tch(s); end; +} + +function time:string; +var h,m,s:string[3]; + hh,mm,ss,ss100:word; +begin + gettime(hh,mm,ss,ss100); + str(hh,h); str(mm,m); str(ss,s); + time:=tch(h)+':'+tch(m)+':'+tch(s); +end; function value(I:astr):integer; var n,n1:integer; diff --git a/tmpcom.pas b/tmpcom.pas index f365f15..89bfab5 100644 --- a/tmpcom.pas +++ b/tmpcom.pas @@ -741,6 +741,29 @@ begin end; end; *) + +{ + primary_sockh = Socket(AF_INET, SOCK_STREAM, PF_INET); + if (primary_sockh = -1) then + begin + writeln; + writeln('WHOA! Socket() returned -1!'); + writeln(' Aborting...'); + halt(2); + end; + + if (Bind(primary_sockh, + + if (Listen(primary_sockh, 0) = FALSE) then + begin + writeln; + writeln('WHOA! Socket() returned -1!'); + writeln(' Aborting...'); + halt(2); + end; +} + + end; @@ -781,25 +804,22 @@ begin setintvec(intnum,old_vector); end; *) + + {if (sockh <> -1) then Shutdown(sockh, 2);} + end; { This procedure is called when the program exits for any reason. It deinstalls the interrupt driver.} {$F+} procedure exit_procedure; {$F-} begin -{rcg11172000 not needed under Linux.} -{ com_deinstall; exitproc:=exit_save; -} end; { This installs the exit procedure. } begin -{rcg11172000 not needed under Linux.} -{ exit_save:=exitproc; exitproc:=@exit_procedure; -} end. diff --git a/wfcmenu.pas b/wfcmenu.pas index c3dcf6e..9bc17b4 100644 --- a/wfcmenu.pas +++ b/wfcmenu.pas @@ -417,6 +417,8 @@ var u:userrec; rl1:=timer; repeat + {rcg12012000 delay added to stop CPU chowing...} + delay(10); if (recom1(c)) then begin if (c in ['0',^M]) then done:=TRUE; if (c in [#32..#255]) then wr(2,c); @@ -427,7 +429,7 @@ var u:userrec; if (try>10) then done:=TRUE; until ((done) or (keypressed)); end; - while (keypressed) do begin isc:=readkey; writeln(ord(isc)); end; + while (keypressed) do begin isc:=readkey; {writeln(ord(isc));} end; delay(100); com_flush_rx; rl1:=timer; repeat c:=ccinkey1 until (abs(timer-rl1)>0.1); @@ -717,6 +719,11 @@ begin if ((systat.specialfx) and (not blankmenunow) and (sysopon) and (systat.usewfclogo)) then begin + + {rcg11302000 added delay() so the stupid Telegard animation} + {doesn't eat all the processor time...} + delay(10); + inc(duh); if (duh=30) then begin duh:=0; inc(txt); if (txt>5) then txt:=0; @@ -945,7 +952,7 @@ begin cwrite(#3#3+'Log on? ('+#3#11+'Y'+#3#3+'/'+#3#11+'N'+ #3#3+'-'+#3#11+'F'+#3#3+'ast) : '); rl2:=timer; - while (not keypressed) and (abs(timer-rl2)<30.0) do; + while (not keypressed) and (abs(timer-rl2)<30.0) do delay(10); if (keypressed) then c:=readkey else c:='N'; c:=upcase(c); writeln(c); case c of