39 lines
940 B
C
39 lines
940 B
C
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
#include <string.h>
|
|
|
|
void showlogo() {
|
|
printf("\n\n");
|
|
printf("================================================================================\n");
|
|
printf(" m(etalsvm)shell\n\n");
|
|
printf(" Copyright 2010 Stefan Lankes, Chair for Operating Systems,\n");
|
|
printf(" RWTH Aachen University\n\n");
|
|
printf("================================================================================\n");
|
|
}
|
|
|
|
void help() {
|
|
printf("possible commands: \n");
|
|
printf("exit > exit shell \n");
|
|
}
|
|
|
|
int main(int argc, char** argv)
|
|
{
|
|
char* command = malloc(1024*sizeof(char));
|
|
int size;
|
|
system("clear");
|
|
showlogo();
|
|
while(1) {
|
|
size = scanf("%s", command);
|
|
if(!strcmp(command, "exit")) {
|
|
return 0;
|
|
}
|
|
if(!strcmp(command, "help")) {
|
|
help();
|
|
}
|
|
else {
|
|
char* argv[] = {command, NULL};
|
|
execve(command, argv, NULL);
|
|
}
|
|
}
|
|
}
|
|
|