3 #include "../include/routix.h"
10 char str
[]="Shell v 0.0.0.1";
25 // printf("*%s*\n", msg);
27 if ( ! strcmp(msg
, "clear") ) {
30 else if ( ! strcmp(msg
, "exec") ) {
31 printf("Ingrese nombre de tarea:");
34 perror("No pudo ejecutarse");
36 else if ( ! strcmp(msg
, "echo") ) {
37 printf("Ingrese texto:");
41 else if ( ! strcmp(msg
, "\n") ) {
43 else if ( ! strcmp(msg
, "ps") ) { proc_dump(); }
45 else if ( ! strcmp(msg
, "ps count") ) { proc_dump(); }
47 else if ( ! strcmp(msg
, "timers") ) { timer_dump(); }
49 else if ( ! strcmp(msg
, "kill") ) {
56 kill(atoi(msg1
), atoi(msg2
));
60 else if ( ! strcmp(msg
, "info") ) {
61 printf("Ingrese el PID: ");
63 if (proc_dump_v(atoi(msg2
))==-1)
64 perror("proc dump verbose");
67 else if ( ! strcmp(msg
, "renice") ) {
68 printf("Ingrese el PID: ");
70 printf("Ingrese la nueva prioridad: ");
72 if (renice( atoi(msg1
), atoi(msg2
)) == -1)
78 else if ( ! strcmp(msg
, "free mem") ) { printf("Paginas disponibles: %d\n",free_mem() ) ; }
80 else if (! strcmp(msg
, "show morecores")) {
84 else if (! strcmp(msg
, "show cache")) {
88 else if (! strcmp(msg
, "show 3")) {
92 else if (! strcmp(msg
, "setvar")) {
93 printf("Ingrese el nombre: ");
95 printf("Ingrese el valor: ");
97 if (setvar(msg1
, atoi(msg2
))==-1)
98 printf("No pueden definirse más variables\n");
101 else if (! strcmp(msg
, "getvar")) {
102 printf("Ingrese el nombre: ");
106 printf("%s no definida\n", msg1
);
107 else printf ("Valor de %s: %d\n", msg1
, j
);
110 else printf("comando o nombre de archivo erroneo\n");