home *** CD-ROM | disk | FTP | other *** search
- /**************************************************************************\
- * *
- * MyShell *
- * *
- \**************************************************************************/
-
- #include <stdio.h>
- #include <stdlib.h>
- #include <string.h>
- #include <dos.h>
- #include <libraries/dos.h>
- #include <intuition/preferences.h>
- #include <intuition/intuitionbase.h>
- #include <exec/memory.h>
- #include <ctype.h>
- #include <proto/all.h>
-
- #define INTUITION_REV 34
- #define GRAPHICS_REV 34
-
- /**************************************************************************\
- * *
- * WriteOut - handles passing params to AmigaDos Write *
- * *
- \**************************************************************************/
-
- void WriteOut(char *s)
- {
- Write(Output(),s,strlen(s));
- }
-
- /**************************************************************************\
- * *
- * nullstub - This is used to remove routines that we won't need. *
- * *
- \**************************************************************************/
-
- int nullstub(void)
- {
- return(0);
- }
-
- /**************************************************************************\
- * *
- * Main - This is the big one... *
- * *
- \**************************************************************************/
-
- void main(int argc,char **argv)
- {
- UBYTE TOP,OUT,FULL;
- ULONG x,y,rx,ry;
- char str[200];
- char s1[30],s2[30],s3[80];
-
- struct IntuitionBase *IntuitionBase;
- struct Screen *WBS;
-
- OUT=TOP=0;
- FULL=1;
-
- if(argc>1&&argv[1][0]=='?')
- {
- sprintf(str,"_MyShell_ Version 1.0 (%s) %s\n",__DATE__,__TIME__);
- WriteOut(str);
- WriteOut("(C) Copyright 1990 by Synthetic Technologies\n");
- WriteOut("Written by Mike Thomas\n\n");
- WriteOut("Usage: MyShell [-S/K] [-C/K] [-T/K] [-O] [-U] [-F]\n");
- WriteOut(" -S/K shell program default: NewShell\n");
- WriteOut(" -C/K console device default: CON:\n");
- WriteOut(" -T/K title/options default: NewShell/CLOSE from s:shell-startup\n");
- WriteOut(" -U display in upper half of screen\n");
- WriteOut(" -H display in half width of screen\n");
- WriteOut(" -O display in outer half of screen\n");
- WriteOut(" -W pull workbench to front\n\n");
- }
- else
- {
- if(IntuitionBase = (struct IntuitionBase *)OpenLibrary("intuition.library",0L))
- {
- WBS=IntuitionBase->FirstScreen;
-
- strcpy(s1,"NewShell");
- strcpy(s2,"CON:");
- strcpy(s3,"NewShell/CLOSE from s:shell-startup");
-
- for(x=1; x<argc; x++)
- {
- if(argv[x][0]=='-')
- {
- switch(toupper(argv[x][1]))
- {
- case 'H':
- FULL=0;
- break;
- case 'U':
- TOP=1;
- break;
- case 'O':
- OUT=1;
- break;
- case 'S':
- strcpy(s1,argv[x]+2);
- break;
- case 'C':
- strcpy(s2,argv[x]+2);
- break;
- case 'T':
- strcpy(s3,argv[x]+2);
- break;
- case 'W':
- WBenchToFront();
- break;
- }
- }
- }
-
- x=WBS->Width;
- y=WBS->Height;
- ry=(y%2);
- rx=(x%2);
-
- sprintf(str,"%s %s%ld/%ld/%ld/%ld/%s\n",s1,s2,(FULL?0:(OUT?x/2:0)),(TOP?0:y/2),(FULL?x:(x/2)+rx),(y/2)+ry,s3);
- Execute(str,NULL,NULL);
- CloseLibrary((struct Library *)IntuitionBase);
- }
- }
- }
-