From 8bd5838ffeba4a05137f2cb3b2fd55c6c3017766 Mon Sep 17 00:00:00 2001 From: Rockingcool Date: Thu, 3 Nov 2022 17:54:09 -0500 Subject: [PATCH] Routine changes --- installfull.sh | 34 +++++++++++++++++++++------------- program3-4.c | 4 +++- 2 files changed, 24 insertions(+), 14 deletions(-) mode change 100755 => 100644 installfull.sh diff --git a/installfull.sh b/installfull.sh old mode 100755 new mode 100644 index b7c655c..c561fba --- a/installfull.sh +++ b/installfull.sh @@ -1,24 +1,31 @@ #!/bin/bash -FILE=/lib/libncursest.so +FILE=Makefile work_dir="${PWD}" cores="$(nproc)" curses_url="https://invisible-mirror.net/archives/ncurses/current/ncurses.tar.gz" -#if test -f "$FILE"; then -# echo "$FILE exists; skipping ncurses compile." -#else -# echo "$FILE does not exist, fetching and compiling ncurses source code now..." - mkdir ncurses - wget -q -O- "${curses_url}" | tar -xz -C ncurses - echo "Fetched ncurses source code from ${curses_url}..." + if [ -d "ncurses" ] + then + echo "You have already fetched the ncurses source code. Skipping this step..." + else + mkdir ncurses + wget -q -O- "${curses_url}" | tar -xz -C ncurses + echo "Fetched ncurses source code from ${curses_url}..." + fi cd ncurses/*/ || exit echo "Runnning configure script..." - ./configure --with-pthread --with-shared > /dev/null - echo "Running make..." - make -j"${cores}" > /dev/null + if test -f "$FILE"; then + echo "You have already compiled ncurses. Skipping this step..." + echo "However, ensure that you ran the 'configure' script with the '--with-pthread' and '--with-shared' flags." + echo "" + else + ./configure --with-pthread --with-shared > /dev/null + echo "Running make..." + make -j"${cores}" > /dev/null + fi cd lib || exit FILE=libncursest.so.?.? -#fi + if ls /lib/${FILE} 1> /dev/null 2>&1 ; then echo "You have a version of ncurses that was identical to the one that was compiled." echo " Quitting..." @@ -28,9 +35,10 @@ curses_url="https://invisible-mirror.net/archives/ncurses/current/ncurses.tar.gz read -p "Would you like to install the new version? [y/N] " userchoice - if [ "$userchoice" = "Y" ]; then + if [ "$userchoice" = "y" ]; then echo "The program will now attempt to install the new version of ncurses (the one that was just compiled). In order to do this, the sudo password is required." echo "Installing the new version of ncurses..." + cd ../ || exit sudo make install echo "The new version has been installed. The program will now quit." echo "Quitting..." diff --git a/program3-4.c b/program3-4.c index e84effc..53c2f3d 100644 --- a/program3-4.c +++ b/program3-4.c @@ -648,7 +648,7 @@ int main(int argc,char** argv) { case ('n' & 0x1f): // WINDOW* newFileWin = newwin(6,50,mainY/2-3,mainX/2-25); -// mvwaddstr(newFileWin,1,1,"Enter the name of the file you wish to create"); + ; //Dummy statement - Apparently you can't declare a variable in the first line in a case statment in C without curly braces surrounding the case char* newFileLoc = getSaveLoc(mainX,mainY,"$$$"); char* newSaveLoc = malloc(sizeof(char) * (strlen(dir) + strlen(newFileLoc)) + 1); strcpy(newSaveLoc,dir); @@ -664,6 +664,8 @@ int main(int argc,char** argv) { break; case ('p' & 0x1f): + ; //Dummy statement - Apparently you can't declare a variable in the first line in a case statment in C without curly braces surrounding the case + char* tempFileDir = malloc(sizeof(char) * MAX_LINE_LENGTH); strcpy(tempFileDir,dir); // strcat(tempFileDir,"/");