diff --git a/doc/Informe.tex b/doc/Informe.tex index 883df2d..84b42a0 100644 --- a/doc/Informe.tex +++ b/doc/Informe.tex @@ -9,7 +9,7 @@ \usepackage{array} \usepackage{adjustbox} \usepackage{titling} -\usepackage[left=2cm,right=2cm,top=2cm,bottom=2cm,a4paper]{geometry} +\usepackage[left=2cm,right=2cm,top=2cm,bottom=2cm,letterpaper]{geometry} \usepackage{amsmath} \usepackage{listings} \usepackage{xcolor} diff --git a/doc/code/builtins.txt b/doc/code/builtins.txt new file mode 100644 index 0000000..3c382cf --- /dev/null +++ b/doc/code/builtins.txt @@ -0,0 +1,9 @@ +void run_builtin(StringArray *args) { + if (strcmp(args->array[0], "exit") == 0) { + exit_shell(args); + } +} + +void exit_shell(StringArray *args) { + exit(EXIT_SUCCESS); +} diff --git a/doc/code/loop.txt b/doc/code/loop.txt index 0d606ff..c480d5b 100644 --- a/doc/code/loop.txt +++ b/doc/code/loop.txt @@ -13,10 +13,6 @@ void loop() { insert_string_array(&args, token); token = strtok_r(NULL, " ", &saveptr); } - if (line != NULL) { - free(line); - line = NULL; - } if (args.size == 0) { continue; @@ -25,7 +21,5 @@ void loop() { if (is_builtin(args.array[0])) { run_builtin(&args); } - - free_string_array(&args); } } diff --git a/doc/sections/codigo.tex b/doc/sections/codigo.tex index b42ba62..1b2b97c 100644 --- a/doc/sections/codigo.tex +++ b/doc/sections/codigo.tex @@ -1,2 +1,3 @@ \section{Código} -\input{sections/codigo/ciclo} \ No newline at end of file +\input{sections/codigo/ciclo} +\input{sections/codigo/builtins} \ No newline at end of file diff --git a/doc/sections/codigo/builtins.tex b/doc/sections/codigo/builtins.tex new file mode 100644 index 0000000..d8c4115 --- /dev/null +++ b/doc/sections/codigo/builtins.tex @@ -0,0 +1,5 @@ +\subsection{Builtins} +Los builtins son comandos que son parte del shell, por lo tanto el sistema operativo no los proporciona. Un ejemplo es el comando\ +''exit''. Este comando no existe en el sistema operativo, por lo tanto el shell debe actuar cuando el usuario lo escribe en vez\ +de lanzar un proceso nuevo. +\lstinputlisting{code/builtins.txt} \ No newline at end of file diff --git a/doc/sections/conclusiones.tex b/doc/sections/conclusiones.tex index ab71532..0ee2ed5 100644 --- a/doc/sections/conclusiones.tex +++ b/doc/sections/conclusiones.tex @@ -1 +1,5 @@ -\section{Conclusiones} \ No newline at end of file +\section{Conclusiones} +Lo cosa mas importante que se puede aprender del proyecto es que el shell es un puente entre el usuario y el sistema operativo.\ +El shell es responsable para lanzar programas, interpretar comandos y un shells mas avanzados interpretar un lenguaje de\ +scripting para poder facilitar tareas o automatizarlas. Por lo tanto el shell es una parte integral para el sistema operativo\ +especialmente en sistemas como GNU/Linux o BSD. \ No newline at end of file