@@ -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,8 +90,7 @@ int quickoverflow_search(char **args)
7290 PyRun_SimpleFile (fp , "search.py" );
7391 fclose (fp );
7492
75- // Finalize the Python interpreter.
76- Py_Finalize ();
93+ //Update 2.0.0 removed Py_Finalise to avoid segmentation faults
7794
7895 return 1 ;
7996}
@@ -84,8 +101,15 @@ int quickoverflow_search(char **args)
84101//*****************************************sos*********************************************** */
85102int quickoverflow_help (char * * args ){
86103 int i ;
87- printf ("--------------------------------QuickOverflow-----------------------------\n" );
88- printf ("---------------------------------Version 1.0.1----------------------------\n" );
104+ printf (" \n"
105+ " _____ _ _ _____ __ _ \n"
106+ "| _ | (_) | | | _ | / _| | \n"
107+ "| | | |_ _ _ ___| | _| | | |_ _____ _ __| |_/| | _____ __\n"
108+ "| | | | | | | |/ __| |/ / | | \\ \\ / / _ \\ '__| _| |/ _ \\ \\ /\\ / /\n"
109+ "\\ \\/' / |_| | | (__| <\\ \\_/ /\\ V / __/ | | | | | (_) \\ V V / \n"
110+ " \\_/\\_\\\\__,_|_|\\___|_|\\_\\\\___/ \\_/ \\___|_| |_| |_|\\___/ \\_/\\_ \n"
111+ " \n" );
112+ printf ("---------------------------------Version 2.0.0----------------------------\n" );
89113 printf ("Type program names and arguments, and hit enter.\n" );
90114 printf ("The following are built in:\n" );
91115
@@ -105,9 +129,16 @@ int quickoverflow_quit(char **args){
105129//**************************************about (ofc credits)************************************* */
106130
107131int quickoverflow_about (char * * args ){
108- printf ("-------------------------------QuickOverflow-----------------------------------\n" );
109- printf ("Version: 1.0.1\n" );
110- printf ("License: MIT License\n" );
132+ printf (" \n"
133+ " _____ _ _ _____ __ _ \n"
134+ "| _ | (_) | | | _ | / _| | \n"
135+ "| | | |_ _ _ ___| | _| | | |_ _____ _ __| |_/| | _____ __\n"
136+ "| | | | | | | |/ __| |/ / | | \\ \\ / / _ \\ '__| _| |/ _ \\ \\ /\\ / /\n"
137+ "\\ \\/' / |_| | | (__| <\\ \\_/ /\\ V / __/ | | | | | (_) \\ V V / \n"
138+ " \\_/\\_\\\\__,_|_|\\___|_|\\_\\\\___/ \\_/ \\___|_| |_| |_|\\___/ \\_/\\_ \n"
139+ " \n" );
140+ printf ("Version: 2.0.0\n" );
141+ printf ("License: GNU GPL-3 License\n" );
111142 printf ("Author: Aryan Karamtoth (SpaciousCoder78)\n" );
112143 printf (
"Author Email: [email protected] \n" );
113144 printf ("Supported Operating Systems: Linux\n" );
0 commit comments