Compare commits
8 Commits
a12faeb9e3
...
3922669351
Author | SHA1 | Date | |
---|---|---|---|
3922669351 | |||
139f694f2d | |||
d3321b2a43 | |||
f570032908 | |||
431b6e9bca | |||
f7f59469c2 | |||
9efbc49985 | |||
8b6957da01 |
13
Makefile
13
Makefile
@@ -1,6 +1,17 @@
|
||||
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
|
||||
.PHONY: full
|
||||
.PHONY: full pdcurses
|
||||
full:
|
||||
./installfull.sh
|
||||
make
|
||||
pdcurses:
|
||||
make program3-4-pdcurses
|
||||
program3-4-pdcurses: program3-4.c texted.c fileman.c
|
||||
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)
|
||||
- Run the configure script (for ncurses) with the `--with-pthread --with-shared` options.
|
||||
- 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_
|
||||
#define FILEMAN_H_
|
||||
#include <curses.h>
|
||||
#include <ncurses.h>
|
||||
#include <sys/stat.h>
|
||||
#include <string.h>
|
||||
#include <dirent.h>
|
||||
|
@@ -1,19 +1,44 @@
|
||||
#!/bin/bash
|
||||
FILE=/lib/libncursest.so
|
||||
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..."
|
||||
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}..."
|
||||
cd ncurses/*/
|
||||
wget -q -O- "${curses_url}" | tar -xz -C ncurses
|
||||
echo "Fetched ncurses source code from ${curses_url}..."
|
||||
cd ncurses/*/ || exit
|
||||
echo "Runnning configure script..."
|
||||
./configure --with-pthread --with-shared > /dev/null
|
||||
echo "Running make..."
|
||||
make -j"${CORES}" > /dev/null
|
||||
fi
|
||||
make -j"${cores}" > /dev/null
|
||||
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..."
|
||||
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) {
|
||||
|
||||
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 fileCountNum; //Number of files in a given directory
|
||||
int highlighted=0; //Index of the highlighted file
|
||||
|
Reference in New Issue
Block a user