	/*  WIDTH.C  for OSBORNE 1       */

	/*  changes screen width setting */
	/*  without rebooting disks      */

        /*  written in BDS-C             */
        /*  for the PUBLIC DOMAIN        */
        /*  c. 1983 by Dave Cairns       */

        /*  not tested on double density */
  
#define LWIDTH 0xEF6C	/* SD address of line width */
#define CLSCR 0x1A	/* clear screen char */

unsigned nwidth;

main(argc,argv)
char  *argv[];
{
	if(argc != 2)
	{	puts("\nusage is:\nA> WIDTH newline-length <cr>\n");
		exit();
	}
	if((nwidth= atoi(argv[1])) < 1 || nwidth > 128)
	{	puts("\n newline-length must be between 1 and 128 inclusive.\n");
		exit();
	}

	/* to clear screen if going to smaller size */

	if(nwidth < peek(LWIDTH))
	putchar(CLSCR);	/* clear screen */

        /* FINALLY WE DO IT */

	poke(LWIDTH,nwidth);	/* change width */

}
