Compare commits
16 Commits
a12faeb9e3
...
master
Author | SHA1 | Date | |
---|---|---|---|
39ac802b97 | |||
2c51f089d8 | |||
0415c06d9b | |||
7fcc540ecb | |||
a12b25fb7d | |||
8bd5838ffe | |||
58be3215f9 | |||
3c5d9176b0 | |||
3922669351 | |||
139f694f2d | |||
d3321b2a43 | |||
f570032908 | |||
431b6e9bca | |||
f7f59469c2 | |||
9efbc49985 | |||
8b6957da01 |
2
.gitattributes
vendored
Normal file
2
.gitattributes
vendored
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
*.h linguist-detectable=true
|
||||||
|
*.h linguist-language=Header
|
14
Makefile
14
Makefile
@@ -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
|
||||||
|
|
||||||
|
@@ -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.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@@ -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>
|
||||||
|
59
installfull.sh
Executable file → Normal file
59
installfull.sh
Executable file → Normal 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..."
|
||||||
|
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
|
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
39
installpdcurses.sh
Executable 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
|
@@ -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,"/");
|
||||||
|
Reference in New Issue
Block a user