brianm@sco.COM (Brian Moffet) (11/03/88)
I thought that I would see how small I could make a clear screen
program from lattice C 4.01 (or so.) I actually got it down to
280 bytes or so. The program is listed below. For those of you
who do not have Lattice C, the <proto/..> include files include
information which is the offset from the lib base for the appropriate
function call (ExecBase + ### is a ptr to OpenLibrary etc...)
I'm curious. I seem to recall the REZ command (or similar) provided
by Workbench 1.3 requires the program to be pure. What exactly
does this mean. Does the clear program below qualify?
-=-=-=-=-=-=- 8< ( (<-scissors) snip here ) -=-=-=-=-=-=-=-
/*
* Brian Moffet
* 11-01-88
*
* test to see how small I could make a clear screen.
*
* compile with:
* lc -v -adbc cls.c
* link with:
* blink from cls.o to cls
*
* size is about 280 bytes.
*/
#include <exec/types.h>
#include <libraries/dos.h>
#include <proto/dos.h>
#include <proto/exec.h>
struct DosLibrary *DOSBase;
void
_main()
{
register long F;
DOSBase = OpenLibrary( "dos.library", 0 );
if( DOSBase != NULL )
{
F = Open( "*", MODE_OLDFILE );
if( F != -1 )
{
Write( F, "\f", 1 );
Close( F );
}
CloseLibrary( DOSBase );
}
}
--
Brian Moffet {uunet,decvax!microsoft,ucscc}!sco!brianm
-or- ...sco!alar!brian
"Evil Geniuses for a better tomoorow!" My fish and company have policies.
I have opinions.jesup@cbmvax.UUCP (Randell Jesup) (11/04/88)
In article <1623@scolex> brianm@sco.COM (Brian Moffet) writes: > * Brian Moffet > * 11-01-88 > * > * test to see how small I could make a clear screen. ... >void >_main() >{ > register long F; Please, evil as it is, that should be a BPTR. > DOSBase = OpenLibrary( "dos.library", 0 ); > if( DOSBase != NULL ) > { > F = Open( "*", MODE_OLDFILE ); > if( F != -1 ) URK! Ok, First, you'd do better to do F = Output(). Second, the error return from Open is 0, not -1!!!! > { > Write( F, "\f", 1 ); > Close( F ); If you use F=Output(), DO NOT Close() it! > } > CloseLibrary( DOSBase ); > } >} -- You've heard of CATS? Well, I'm a member of DOGS: Developers Of Great Software. Randell Jesup, Commodore Engineering {uunet|rutgers|allegra}!cbmvax!jesup
morgan@brambo.UUCP (Morgan W. Jones) (11/06/88)
Presumably you are writing a clear program just for the sake of doing it. Under 1.3 you can do "alias clear echo ^l" where you actually type the ^l as 1 character. -- Morgan Jones morgan@hcr.UUCP Human Computing Resources, Toronto, Canada "BMATH - 6 months and counting ..."