Added checks for qsort, fixed some typos in README, cleaned up config file

pull/19/head
mananapr 5 years ago
parent dc7a7501c4
commit a3bc4b299c

@ -68,7 +68,7 @@ or press `m` in `cfiles` to add new bookmarks.
If `$XDG_CACHE_HOME` is not set, then `$HOME/.cache` is used.
## Image Previews
`cfiles` uses `w3mimgdisplay` to generate imagepreviews. To setup imagepreviews, move the `displayimg` and `clearimg` scripts to wherever you like and the set the appropriate path in `config,h`.
`cfiles` uses `w3mimgdisplay` to generate image previews. To setup image previews, move the `displayimg` and `clearimg` scripts to wherever you like and the set the appropriate path in `config.h`.
You may have to modify the scripts a little, about which you can read [here](https://wiki.vifm.info/index.php/How_to_preview_images).
## Why C?

@ -19,6 +19,7 @@
#include <string.h>
#include <strings.h>
#include <limits.h>
#include <signal.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <pwd.h>
@ -602,6 +603,10 @@ void getImgPreview(char *filepath, int maxy, int maxx)
execl(DISPLAYIMG,DISPLAYIMG,arg1,arg2,arg3,arg4,filepath,(char *)NULL);
exit(1);
}
else
{
signal(SIGCHLD, SIG_IGN);
}
}
@ -1160,7 +1165,9 @@ int main(int argc, char* argv[])
allocSize = snprintf(NULL,0,"%s",dir);
sort_dir = malloc(allocSize+1);
strncpy(sort_dir,dir,allocSize+1);
qsort(directories, len, sizeof (char*), compare);
if( len > 0 )
qsort(directories, len, sizeof (char*), compare);
// In case the last file is selected and it get's removed or moved
if(selection > len-1)

@ -1,6 +1,7 @@
#ifndef CONFIG
#define CONFIG
/*
cfiles settings
*/
@ -11,22 +12,26 @@
// Set to 0 if you want to disable borders
#define SHOW_BORDERS 1
// Program usd to open non-text file (Eg: `xdg-open` or `thunar`)
// Program used to open non-text file (Eg: `xdg-open` or `thunar`)
#define FILE_OPENER "/usr/bin/xdg-open"
// Display Image Script
#define DISPLAYIMG "/home/manan/Scripts/displayimg"
// Clear Image Preview Script
#define CLEARIMG "/home/manan/Scripts/clearimg"
/*
Color Settings
*/
// Shell Color Number to use for directories
#define DIR_COLOR 2
// Shell Color Number to use for file count which is displayed in the statusbar
#define STATUS_FILECOUNT_COLOR 1
// Shell Color Number to use for selected file which is displayed in the statusbar
#define STATUS_SELECTED_COLOR 6

Loading…
Cancel
Save