|
@@ -23,6 +23,7 @@ extern Error error;
|
|
|
extern pid_t last;
|
|
|
extern int status_cmd;
|
|
|
extern int result_cmd;
|
|
|
+extern char base_path[];
|
|
|
char* cmdlist[] = {
|
|
|
"cd",
|
|
|
"exit",
|
|
@@ -31,6 +32,8 @@ char* cmdlist[] = {
|
|
|
"unsetenv",
|
|
|
"set",
|
|
|
"unset",
|
|
|
+ "myls",
|
|
|
+ "myps",
|
|
|
NULL
|
|
|
};
|
|
|
boolean exitsh = false;
|
|
@@ -151,6 +154,16 @@ int launch_internal_command(Command* cmd) {
|
|
|
else if (strncmp(cmd->name, cmdlist[6], length) == 0) {
|
|
|
result = unset_local(cmd->argc, cmd->argv);
|
|
|
return result;
|
|
|
+ }
|
|
|
+ //myls
|
|
|
+ else if (strncmp(cmd->name, cmdlist[7], length) == 0) {
|
|
|
+ result = myls(cmd->argc, cmd->argv);
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+ //myps
|
|
|
+ else if (strncmp(cmd->name, cmdlist[8], length) == 0) {
|
|
|
+ result = myps(cmd->argc, cmd->argv);
|
|
|
+ return result;
|
|
|
}
|
|
|
//Aucune commande
|
|
|
else {
|
|
@@ -323,4 +336,36 @@ int unset_local(int argc, char** argv){
|
|
|
return EXIT_FAILURE;
|
|
|
}
|
|
|
return EXIT_SUCCESS;
|
|
|
+}
|
|
|
+
|
|
|
+int myls(int argc, char** argv){
|
|
|
+ //Preparation nom cmd
|
|
|
+ int length = strlen(base_path);
|
|
|
+ char* path = malloc(sizeof(char) * (length + 4 + 1));
|
|
|
+ memset(path, 0, length + 4 + 1);
|
|
|
+ strncpy(path, base_path, length);
|
|
|
+ path[length] = '/';
|
|
|
+ path[length + 1] = 'm';
|
|
|
+ path[length + 2] = 'y';
|
|
|
+ path[length + 3] = 'l';
|
|
|
+ path[length + 4] = 's';
|
|
|
+ //Execution
|
|
|
+ //return exec_file(path, argv);
|
|
|
+ return 0;
|
|
|
+}
|
|
|
+
|
|
|
+int myps(int argc, char** argv){
|
|
|
+ //Preparation nom cmd
|
|
|
+ int length = strlen(base_path);
|
|
|
+ char* path = malloc(sizeof(char) * (length + 4 + 1));
|
|
|
+ memset(path, 0, length + 4 + 1);
|
|
|
+ strncpy(path, base_path, length);
|
|
|
+ path[length] = '/';
|
|
|
+ path[length + 1] = 'm';
|
|
|
+ path[length + 2] = 'y';
|
|
|
+ path[length + 3] = 'p';
|
|
|
+ path[length + 4] = 's';
|
|
|
+ //Execution
|
|
|
+ //return exec_file(path, argv);
|
|
|
+ return 0;
|
|
|
}
|