mirror of
https://gitlab.com/sortix/sortix.git
synced 2023-02-13 20:55:38 -05:00
Added the programs ls and help.
This commit is contained in:
parent
34e9ca277d
commit
2c18d43359
9 changed files with 50 additions and 2 deletions
2
Makefile
2
Makefile
|
@ -103,7 +103,7 @@ iso: all debsource
|
|||
mkdir -p $(INITRDDIR)
|
||||
cp hello/hello $(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)
|
||||
rm -rf $(INITRDDIR)
|
||||
cp builds/$(DEBSRCNAME)-src.tar.gz $(ISODIR)
|
||||
|
|
|
@ -30,6 +30,7 @@ namespace Maxsi
|
|||
namespace Process
|
||||
{
|
||||
int Execute(const char* filepath, int argc, const char** argv);
|
||||
void PrintPathFiles();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -31,11 +31,17 @@ namespace Maxsi
|
|||
namespace Process
|
||||
{
|
||||
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)
|
||||
{
|
||||
return SysExecute(filepath, argc, argv);
|
||||
}
|
||||
|
||||
void PrintPathFiles()
|
||||
{
|
||||
SysPrintPathFiles();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -65,5 +65,16 @@ namespace Sortix
|
|||
|
||||
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
|
||||
void SysPrintPathFiles(CPU::InterruptRegisters* R);
|
||||
void Init(byte* initrd, size_t size);
|
||||
byte* Open(const char* filepath, size_t* size);
|
||||
#endif
|
||||
|
|
|
@ -35,6 +35,7 @@
|
|||
#include "keyboard.h"
|
||||
#include "sound.h"
|
||||
#include "process.h"
|
||||
#include "initrd.h"
|
||||
|
||||
namespace Sortix
|
||||
{
|
||||
|
@ -51,7 +52,7 @@ namespace Sortix
|
|||
#endif
|
||||
}
|
||||
|
||||
const size_t NumSyscalls = 11;
|
||||
const size_t NumSyscalls = 12;
|
||||
const Syscall Syscalls[NumSyscalls] =
|
||||
{
|
||||
&Scheduler::SysCreateThread,
|
||||
|
@ -65,6 +66,7 @@ namespace Sortix
|
|||
&Keyboard::SysReceieveKeystroke,
|
||||
&Sound::SysSetFrequency,
|
||||
&SysExecute,
|
||||
&InitRD::SysPrintPathFiles,
|
||||
};
|
||||
|
||||
void Init()
|
||||
|
|
|
@ -8,6 +8,9 @@ cat \
|
|||
sh \
|
||||
mxsh \
|
||||
clear \
|
||||
ls \
|
||||
help \
|
||||
uname \
|
||||
|
||||
all: $(BINARIES)
|
||||
|
||||
|
|
15
utils/help.cpp
Normal file
15
utils/help.cpp
Normal file
|
@ -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;
|
||||
}
|
9
utils/ls.cpp
Normal file
9
utils/ls.cpp
Normal file
|
@ -0,0 +1,9 @@
|
|||
#include <stdio.h>
|
||||
#include <libmaxsi/process.h>
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
Maxsi::Process::PrintPathFiles();
|
||||
|
||||
return 0;
|
||||
}
|
Loading…
Add table
Reference in a new issue