Added the programs ls and help.
This commit is contained in:
parent
34e9ca277d
commit
2c18d43359
2
Makefile
2
Makefile
|
@ -103,7 +103,7 @@ iso: all debsource
|
||||||
mkdir -p $(INITRDDIR)
|
mkdir -p $(INITRDDIR)
|
||||||
cp hello/hello $(INITRDDIR)
|
cp hello/hello $(INITRDDIR)
|
||||||
cp pong/pong $(INITRDDIR)
|
cp pong/pong $(INITRDDIR)
|
||||||
for F in init cat sh mxsh clear; do cp utils/$$F $(INITRDDIR); done
|
for F in init cat sh mxsh clear ls help uname; do cp utils/$$F $(INITRDDIR); done
|
||||||
(cd $(INITRDDIR) && ../mkinitrd/mkinitrd * -o ../$(ISODIR)/boot/sortix.initrd)
|
(cd $(INITRDDIR) && ../mkinitrd/mkinitrd * -o ../$(ISODIR)/boot/sortix.initrd)
|
||||||
rm -rf $(INITRDDIR)
|
rm -rf $(INITRDDIR)
|
||||||
cp builds/$(DEBSRCNAME)-src.tar.gz $(ISODIR)
|
cp builds/$(DEBSRCNAME)-src.tar.gz $(ISODIR)
|
||||||
|
|
|
@ -30,6 +30,7 @@ namespace Maxsi
|
||||||
namespace Process
|
namespace Process
|
||||||
{
|
{
|
||||||
int Execute(const char* filepath, int argc, const char** argv);
|
int Execute(const char* filepath, int argc, const char** argv);
|
||||||
|
void PrintPathFiles();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -31,11 +31,17 @@ namespace Maxsi
|
||||||
namespace Process
|
namespace Process
|
||||||
{
|
{
|
||||||
DEFN_SYSCALL3(int, SysExecute, 10, const char*, int, const char**);
|
DEFN_SYSCALL3(int, SysExecute, 10, const char*, int, const char**);
|
||||||
|
DEFN_SYSCALL0_VOID(SysPrintPathFiles, 11);
|
||||||
|
|
||||||
int Execute(const char* filepath, int argc, const char** argv)
|
int Execute(const char* filepath, int argc, const char** argv)
|
||||||
{
|
{
|
||||||
return SysExecute(filepath, argc, argv);
|
return SysExecute(filepath, argc, argv);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void PrintPathFiles()
|
||||||
|
{
|
||||||
|
SysPrintPathFiles();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -65,5 +65,16 @@ namespace Sortix
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SysPrintPathFiles(CPU::InterruptRegisters* /*R*/)
|
||||||
|
{
|
||||||
|
Header* header = (Header*) initrd;
|
||||||
|
FileHeader* fhtbl = (FileHeader*) (initrd + sizeof(Header));
|
||||||
|
for ( uint32_t i = 0; i < header->numfiles; i++ )
|
||||||
|
{
|
||||||
|
FileHeader* fileheader = &(fhtbl[i]);
|
||||||
|
Log::PrintF("%s\n", fileheader->name);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -50,6 +50,7 @@ namespace Sortix
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifdef SORTIX_KERNEL
|
#ifdef SORTIX_KERNEL
|
||||||
|
void SysPrintPathFiles(CPU::InterruptRegisters* R);
|
||||||
void Init(byte* initrd, size_t size);
|
void Init(byte* initrd, size_t size);
|
||||||
byte* Open(const char* filepath, size_t* size);
|
byte* Open(const char* filepath, size_t* size);
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -35,6 +35,7 @@
|
||||||
#include "keyboard.h"
|
#include "keyboard.h"
|
||||||
#include "sound.h"
|
#include "sound.h"
|
||||||
#include "process.h"
|
#include "process.h"
|
||||||
|
#include "initrd.h"
|
||||||
|
|
||||||
namespace Sortix
|
namespace Sortix
|
||||||
{
|
{
|
||||||
|
@ -51,7 +52,7 @@ namespace Sortix
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
const size_t NumSyscalls = 11;
|
const size_t NumSyscalls = 12;
|
||||||
const Syscall Syscalls[NumSyscalls] =
|
const Syscall Syscalls[NumSyscalls] =
|
||||||
{
|
{
|
||||||
&Scheduler::SysCreateThread,
|
&Scheduler::SysCreateThread,
|
||||||
|
@ -65,6 +66,7 @@ namespace Sortix
|
||||||
&Keyboard::SysReceieveKeystroke,
|
&Keyboard::SysReceieveKeystroke,
|
||||||
&Sound::SysSetFrequency,
|
&Sound::SysSetFrequency,
|
||||||
&SysExecute,
|
&SysExecute,
|
||||||
|
&InitRD::SysPrintPathFiles,
|
||||||
};
|
};
|
||||||
|
|
||||||
void Init()
|
void Init()
|
||||||
|
|
|
@ -8,6 +8,9 @@ cat \
|
||||||
sh \
|
sh \
|
||||||
mxsh \
|
mxsh \
|
||||||
clear \
|
clear \
|
||||||
|
ls \
|
||||||
|
help \
|
||||||
|
uname \
|
||||||
|
|
||||||
all: $(BINARIES)
|
all: $(BINARIES)
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,15 @@
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <libmaxsi/process.h>
|
||||||
|
|
||||||
|
int main(int argc, char* argv[])
|
||||||
|
{
|
||||||
|
// Reset the terminal's color and the rest of it.
|
||||||
|
printf("Please enter the name of one of the following programs:\n");
|
||||||
|
|
||||||
|
const char* programname = "ls";
|
||||||
|
const char* newargv[] = { programname };
|
||||||
|
|
||||||
|
Maxsi::Process::Execute(programname, 1, newargv);
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
|
@ -0,0 +1,9 @@
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <libmaxsi/process.h>
|
||||||
|
|
||||||
|
int main(int argc, char* argv[])
|
||||||
|
{
|
||||||
|
Maxsi::Process::PrintPathFiles();
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
Loading…
Reference in New Issue