[Inaview-develop] new shell fucked up...
Brought to you by:
lhag
|
From: Kim L. <kd...@lh...> - 2011-10-08 15:02:40
|
Hello all,
I tried to compile a new shell file called testshell.c with some more
abstract code on it.
It just takes the same way as the normal shell is doing. So, I have to
hack another solution...
Kim
/*
DOS In a View 3.6.0
Copyright (C) 2010, 2011 Kim Leyendecker (kd...@lh...)
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include <stdio.h>
/*
* I maybe will clean up the header files
* for the next release and put them
* into a special dlib or something like that
* be surprised!
*/
#include "/home/kdl/diav-3x/trunk/src/api/intro.h"
#include "/home/kdl/diav-3x/trunk/src/api/sysinfo.h"
#include "/home/kdl/diav-3x/trunk/src/api/border.h"
void dax (void)
{
puts("DaX - DIAV Advanced (X) Configuration");
puts("===========================================================");
puts("DaX is a programm for you, to configurate and change DIAV3.");
switch (getchar() )
{
case 's':
puts("for source code hacking read this");
puts("==================================");
puts("DOS In a View is really easy to read and understand");
puts("If you want to change something, you just need to");
puts("understand some really basic C-commands");
puts("License information"); /* You can also see the license in the
diav-files */
puts("===================");
puts("DIAV and all other DIAV related software is developed under the
GPL-license in version 2");
puts("contribution");
puts("==============");
puts("If you want to contribute in DIAV, just write a pach and send it
as a tarball (tar.bz2 is the format of choice) to kd...@lh...");
puts("Coding guidelines");
puts("=================");
puts("first of all, *please* read this, patches which do not fit these
guidelines, will be rejected");
puts("If you start writing a new module for DOS In a View, start with
a short introduction.");
puts("into these introduction, you have to write the name, the
function, the current version number");
puts("and a short text about the program. Please divide this
introduction into two parts.");
puts("the first part is for the name and the version number, whereas
the second part is for the");
puts("short information. Please subdivide this with a =-line, like
this:");
puts("================================");
puts("as the programming language, please use C or Python.");
puts("Questions? a mail to kd...@lh... should help.");
break;
case 'p':
puts("QuickDaX");
puts("=======");
puts("QuickDaX is the little brother of DaX and part of the API. It
should become a library with 3.5.0");
puts("WORD");
puts("=====");
puts("DIAV Word 5.5b is the emulated text processor of DIAV. You can´t
use it");
puts("DOSphin");
puts("========");
puts("DOSphin is the filemanager of DIAV. You can use it just to watch
the files, DIAV contents");
puts("scandisk");
puts("=========");
puts("scandisk will scan your harddisk. It will detect broken files");
break;
default:
puts("Have fun with DIAV3 and DaX!");
}
getchar();
getchar();
getchar();
}
void dosphin (void)
{
puts("DOSphin - The DIAV filemanager");
puts("======================================================");
switch (getchar())
{
case 'l':
puts("Directory of C:");
puts("COMMAND COM 20 01-10-2010 12:34");
puts("AUTOEXEC BAT 32 04-11-2009 15:21");
puts("KEYB COM 20 01-02-2011 04:04");
puts("IMGMOUNT COM 20 11-08-2004 09:33");
puts("BOOT COM 20 01-10-2002 12:34");
puts("INTRO COM 20 01-10-2002 12:34");
puts("RESCAN COM 20 01-10-2002 12:34");
puts("LOADFIX COM 20 01-10-2002 12:34");
puts("MEM COM 20 01-10-2002 12:34");
puts("MOUNT COM 20 01-10-2002 12:34");
puts("MIXER COM 20 01-10-2002 12:34");
puts("CONFIG COM 20 01-10-2002 12:34");
puts(" 12 File(s) 252 Bytes.");
puts(" 0 Dir(s) 0 Bytes free.");
puts("=======================================================");
puts("C:>");
break;
case 'h':
puts("DOSphin help file");
puts("==================");
puts("put -l- to get a comprehensive list of the files on harddisk.");
puts("put -d- for a directory overview");
puts("put -h- for help");
puts("");
break;
case 'd':
puts(" C:\"");
puts(" D:\"");
puts(" A: \""); /* the floppy mount point... Oh, I´m glad to use Linux! */
default:
puts("Have fun!");
}
/* I never ever understood
* these idiot triple getchar
* but my book told be so
*/
getchar();
getchar();
getchar();
}
int main (void)
{
puts("Welcome to DIAV");
puts("this is the shell");
puts("shell version: 0.1.3");
puts("choose a or b");
/* Now the menu will come. for this, we have to code
* some functions after it, that will opened with
* the switch function.
*/
switch ( getchar() )
{
case 'a':
dax();
break;
case 'b':
dosphin();
break;
default:
puts("thanks for using");
getchar();
getchar();
getchar();
}
}
and here the testshell comes. It´s kinda the same, just a bit more
abstract for better understanding.
#include <stdio.h>
void test1 (void)
{
puts("testfunction1");
switch (getchar() )
{
case 'a':
puts("a");
break;
case 'b':
puts("b");
break;
default:
puts("a nor b");
getchar();
getchar();
getchar();
}
}
void test2 (void)
{
puts("test 2");
switch (getchar() )
{
case 'a': puts("c");
break;
case 'b': puts("d");
break;
default:
puts("c nor d");
getchar();
getchar();
getchar();
}
}
void main (void)
{
puts("choose one of them");
switch (getchar() )
{
case 'a': (test1);
break;
case 'b': (test2);
break;
default:
puts("what do you want then?");
}
}
--
Kim Leyendecker, openSUSE News and DEWIKI Team
I work for openSUSE, I don´t speak on their behalf
|