Compare commits

...

16 Commits

Author SHA1 Message Date
39ac802b97 Updated gitattributes 2022-11-03 22:15:17 -05:00
2c51f089d8 Updated gitattributes 2022-11-03 20:04:06 -05:00
0415c06d9b Updated gitattributes 2022-11-03 20:03:18 -05:00
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
3922669351 Updated header files 2022-10-24 07:55:38 -05:00
139f694f2d Updated Install Script 2022-10-24 07:55:26 -05:00
d3321b2a43 Updated Makefile 2022-10-23 16:36:40 -05:00
f570032908 Updated README todo 2022-10-23 16:25:49 -05:00
431b6e9bca Updated install script 2022-10-23 16:24:47 -05:00
f7f59469c2 Set env. var. for PDcurses SDL 2022-10-23 16:24:11 -05:00
9efbc49985 Updated header files 2022-10-23 16:23:29 -05:00
8b6957da01 Add pdcurses support to Makefile 2022-10-23 16:22:51 -05:00
8 changed files with 113 additions and 21 deletions

2
.gitattributes vendored Normal file
View File

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

View File

@@ -1,6 +1,18 @@
program3-4: program3-4.c texted.c fileman.c program3-4: program3-4.c texted.c fileman.c
sed -i 's/"pdcurses\/curses.h"/<ncurses.h>/g' texted.h
sed -i 's/"pdcurses\/curses.h"/<ncurses.h>/g' fileman.h
sed -i 's/for (int i=0,a=0;i<numCharsToPrint-1;i++,a++)/for (int i=0,a=0;i<numCharsToPrint;i++,a++)/g' program3-4.c
gcc program3-4.c texted.c fileman.c -o program3-4 -lncursest gcc program3-4.c texted.c fileman.c -o program3-4 -lncursest
.PHONY: full .PHONY: full pdcurses
full: full:
./installfull.sh ./installfull.sh
make make
pdcurses:
make program3-4-pdcurses
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' 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
gcc -g program3-4.c texted.c fileman.c -o program3-4-pdcurses pdcurses/sdl2/pdcurses.a -L/usr/lib -lSDL2

View File

@@ -7,7 +7,7 @@ The following steps are used to compile the version of ncurses that this program
- Grab the ncurses source code from [here](https://invisible-mirror.net/archives/ncurses/ncurses-6.3.tar.gz) - Grab the ncurses source code from [here](https://invisible-mirror.net/archives/ncurses/ncurses-6.3.tar.gz)
- Run the configure script (for ncurses) with the `--with-pthread --with-shared` options. - Run the configure script (for ncurses) with the `--with-pthread --with-shared` options.
- Run `make` and `make install` to compile and install the library. - Run `make` and `make install` to compile and install the library.
-TODO - Update install script to fetch and compile pdcurses source code.

View File

@@ -1,6 +1,6 @@
#ifndef FILEMAN_H_ #ifndef FILEMAN_H_
#define FILEMAN_H_ #define FILEMAN_H_
#include <curses.h> #include <ncurses.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <string.h> #include <string.h>
#include <dirent.h> #include <dirent.h>

65
installfull.sh Executable file → Normal file
View File

@@ -1,19 +1,52 @@
#!/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}..."
cd ncurses/*/ fi
cd ncurses/*/ || exit
echo "Runnning configure script..." echo "Runnning configure script..."
./configure --with-pthread --with-shared > /dev/null if test -f "$FILE"; then
echo "Running make..." echo "You have already compiled ncurses. Skipping this step..."
make -j"${CORES}" > /dev/null echo "However, ensure that you ran the 'configure' script with the '--with-pthread' and '--with-shared' flags."
fi echo ""
else
./configure --with-pthread --with-shared > /dev/null
echo "Running make..."
make -j"${cores}" > /dev/null
fi
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..."
cd ../ || exit
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

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

@@ -32,6 +32,10 @@ This is an ncurses tool allows you to browse your files and view/edit them in th
int main(int argc,char** argv) { int main(int argc,char** argv) {
putenv("PDC_COLS=1000");
putenv("PDC_LINES=1000");
int xLen,yLen,mainX,mainY; //values for the x-length and y-length of stdscr (i.e. the terminal window), and the 'main window' inside it. int xLen,yLen,mainX,mainY; //values for the x-length and y-length of stdscr (i.e. the terminal window), and the 'main window' inside it.
int fileCountNum; //Number of files in a given directory int fileCountNum; //Number of files in a given directory
int highlighted=0; //Index of the highlighted file int highlighted=0; //Index of the highlighted file
@@ -644,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);
@@ -660,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,"/");

View File

@@ -1,6 +1,6 @@
#ifndef TEXTED_H_ #ifndef TEXTED_H_
#define TEXTED_H_ #define TEXTED_H_
#include <curses.h> #include <ncurses.h>
#include <string.h> #include <string.h>
#include <stdlib.h> #include <stdlib.h>