Compare commits

...

5 Commits

Author SHA1 Message Date
7fcc540ecb Updated .gitattributes 2022-11-03 19:52:42 -05:00
a12b25fb7d Added gitattributes - Testing 2022-11-03 19:50:23 -05:00
8bd5838ffe Routine changes 2022-11-03 17:54:09 -05:00
58be3215f9 Updated Makefile to use PDCurses install script 2022-10-25 08:08:08 -05:00
3c5d9176b0 Added install script for PDCurses 2022-10-25 08:07:48 -05:00
5 changed files with 65 additions and 14 deletions

1
.gitattributes vendored Normal file
View File

@@ -0,0 +1 @@
*.h linguist-language=Header

View File

@@ -10,6 +10,7 @@ full:
pdcurses: pdcurses:
make program3-4-pdcurses make program3-4-pdcurses
program3-4-pdcurses: program3-4.c texted.c fileman.c program3-4-pdcurses: program3-4.c texted.c fileman.c
./installpdcurses.sh
sed -i 's/<ncurses.h>/"pdcurses\/curses.h"/g' texted.h sed -i 's/<ncurses.h>/"pdcurses\/curses.h"/g' texted.h
sed -i 's/<ncurses.h>/"pdcurses\/curses.h"/g' fileman.h sed -i 's/<ncurses.h>/"pdcurses\/curses.h"/g' fileman.h
sed -i 's/for (int i=0,a=0;i<numCharsToPrint;i++,a++)/for (int i=0,a=0;i<numCharsToPrint-1;i++,a++)/g' program3-4.c sed -i 's/for (int i=0,a=0;i<numCharsToPrint;i++,a++)/for (int i=0,a=0;i<numCharsToPrint-1;i++,a++)/g' program3-4.c

22
installfull.sh Executable file → Normal file
View File

@@ -1,24 +1,31 @@
#!/bin/bash #!/bin/bash
FILE=/lib/libncursest.so FILE=Makefile
work_dir="${PWD}" work_dir="${PWD}"
cores="$(nproc)" cores="$(nproc)"
curses_url="https://invisible-mirror.net/archives/ncurses/current/ncurses.tar.gz" curses_url="https://invisible-mirror.net/archives/ncurses/current/ncurses.tar.gz"
#if test -f "$FILE"; then if [ -d "ncurses" ]
# echo "$FILE exists; skipping ncurses compile." then
#else echo "You have already fetched the ncurses source code. Skipping this step..."
# echo "$FILE does not exist, fetching and compiling ncurses source code now..." else
mkdir ncurses mkdir ncurses
wget -q -O- "${curses_url}" | tar -xz -C ncurses wget -q -O- "${curses_url}" | tar -xz -C ncurses
echo "Fetched ncurses source code from ${curses_url}..." echo "Fetched ncurses source code from ${curses_url}..."
fi
cd ncurses/*/ || exit cd ncurses/*/ || exit
echo "Runnning configure script..." echo "Runnning configure script..."
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 ./configure --with-pthread --with-shared > /dev/null
echo "Running make..." echo "Running make..."
make -j"${cores}" > /dev/null make -j"${cores}" > /dev/null
fi
cd lib || exit cd lib || exit
FILE=libncursest.so.?.? FILE=libncursest.so.?.?
#fi
if ls /lib/${FILE} 1> /dev/null 2>&1 ; then 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 "You have a version of ncurses that was identical to the one that was compiled."
echo " Quitting..." 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 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 "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..." echo "Installing the new version of ncurses..."
cd ../ || exit
sudo make install sudo make install
echo "The new version has been installed. The program will now quit." echo "The new version has been installed. The program will now quit."
echo "Quitting..." echo "Quitting..."

39
installpdcurses.sh Executable file
View File

@@ -0,0 +1,39 @@
#!/bin/bash
FILE=/lib/libncursest.so
work_dir="${PWD}"
cores="$(nproc)"
curses_url="https://github.com/wmcbrine/PDCurses.git"
mkdir pdcurses
git clone "${curses_url}" pdcurses
echo "Fetched pdcurses source code from ${curses_url}..."
cd pdcurses/sdl2 || exit
echo "Running make..."
make -j"${cores}" > /dev/null
echo "PDCurses has been compiled, and will be linked statically."
# cd lib || exit
# FILE=libncursest.so.?.?
# 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..."
# exit
# else
# echo "You have a different version of ncurses than the one that was just compiled."
# read -p "Would you like to install the new version? [y/N] " userchoice
#
#
# 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..."
# sudo make install
# echo "The new version has been installed. The program will now quit."
# echo "Quitting..."
# exit
#
# else
# echo "You chose to not install the new ncurses version. This program will now quit."
# echo "Quitting..."
# exit
# fi
# fi

View File

@@ -648,7 +648,7 @@ int main(int argc,char** argv) {
case ('n' & 0x1f): case ('n' & 0x1f):
// WINDOW* newFileWin = newwin(6,50,mainY/2-3,mainX/2-25); // 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* newFileLoc = getSaveLoc(mainX,mainY,"$$$");
char* newSaveLoc = malloc(sizeof(char) * (strlen(dir) + strlen(newFileLoc)) + 1); char* newSaveLoc = malloc(sizeof(char) * (strlen(dir) + strlen(newFileLoc)) + 1);
strcpy(newSaveLoc,dir); strcpy(newSaveLoc,dir);
@@ -664,6 +664,8 @@ int main(int argc,char** argv) {
break; break;
case ('p' & 0x1f): 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); char* tempFileDir = malloc(sizeof(char) * MAX_LINE_LENGTH);
strcpy(tempFileDir,dir); strcpy(tempFileDir,dir);
// strcat(tempFileDir,"/"); // strcat(tempFileDir,"/");