@@ -26,6 +26,7 @@ int quickoverflow_search(char **args); //open search
2626int quickoverflow_help (char * * args ); //help command
2727int quickoverflow_quit (char * * args ); //exit command
2828int quickoverflow_about (char * * args ); //about command
29+ int quickoverflow_cd (char * * args );
2930
3031/*
3132 List of builtin commands, followed by their corresponding functions.
@@ -35,13 +36,15 @@ char *builtin_str[] = {
3536 "help" , //help command
3637 "quit" , //exit command
3738 "about" ,
39+ "cd" ,
3840};
3941
4042int (* builtin_func []) (char * * ) = {
4143 & quickoverflow_search , //search directory
4244 & quickoverflow_help , //help command
4345 & quickoverflow_quit , //exit command
44- & quickoverflow_about ,
46+ & quickoverflow_about , //about
47+ & quickoverflow_cd , //change dir
4548};
4649
4750int quickoverflow_num_builtins () {
@@ -52,6 +55,21 @@ int quickoverflow_num_builtins() {
5255***********************************Builtin function implementations*************************************
5356*/
5457
58+ //Update 2.0.0 - Added cd for directory traversal
59+
60+ //***************************************chdir*********************************************** */
61+ int quickoverflow_cd (char * * args )
62+ {
63+ if (args [1 ] == NULL ) {
64+ fprintf (stderr , "QuickOverflow : expected argument to \"cd\"\n" );
65+ } else {
66+ if (chdir (args [1 ]) != 0 ) {
67+ perror ("QuickOverflow" );
68+ }
69+ }
70+ return 1 ;
71+ }
72+
5573//***************************************sofsearch*********************************************** */
5674//function for calling the python files for searching
5775int quickoverflow_search (char * * args )
@@ -72,7 +90,7 @@ int quickoverflow_search(char **args)
7290 PyRun_SimpleFile (fp , "search.py" );
7391 fclose (fp );
7492
75- //Update 1.1 .0 removed Py_Finalise to avoid segmentation faults
93+ //Update 2.0 .0 removed Py_Finalise to avoid segmentation faults
7694
7795 return 1 ;
7896}
@@ -84,7 +102,7 @@ int quickoverflow_search(char **args)
84102int quickoverflow_help (char * * args ){
85103 int i ;
86104 printf ("--------------------------------QuickOverflow-----------------------------\n" );
87- printf ("---------------------------------Version 1 .0.1 ----------------------------\n" );
105+ printf ("---------------------------------Version 2 .0.0 ----------------------------\n" );
88106 printf ("Type program names and arguments, and hit enter.\n" );
89107 printf ("The following are built in:\n" );
90108
@@ -105,8 +123,8 @@ int quickoverflow_quit(char **args){
105123
106124int quickoverflow_about (char * * args ){
107125 printf ("-------------------------------QuickOverflow-----------------------------------\n" );
108- printf ("Version: 1 .0.1 \n" );
109- printf ("License: MIT License\n" );
126+ printf ("Version: 2 .0.0 \n" );
127+ printf ("License: GNU GPL-3 License\n" );
110128 printf ("Author: Aryan Karamtoth (SpaciousCoder78)\n" );
111129 printf (
"Author Email: [email protected] \n" );
112130 printf ("Supported Operating Systems: Linux\n" );
0 commit comments