Commit 8ded860d authored by Birte Kristina Friesel's avatar Birte Kristina Friesel
Browse files

Change source code indentation (indent -kr -i8 -hnl, mainly)

parent 2fb795cf
Loading
Loading
Loading
Loading
+180 −208
Original line number Diff line number Diff line
@@ -28,8 +28,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "filelist.h"
#include "options.h"

void
init_collage_mode(void)
void init_collage_mode(void)
{
	Imlib_Image im_main;
	Imlib_Image im_temp;
@@ -48,39 +47,34 @@ init_collage_mode(void)
	mode = "collage";

	/* Use bg image dimensions for default size */
   if (opt.bg && opt.bg_file)
   {
	if (opt.bg && opt.bg_file) {
		if (!strcmp(opt.bg_file, "trans"))
			trans_bg = 1;
      else
      {
		else {

			D(4, ("Time to apply a background to blend onto\n"));
         if (feh_load_image_char(&bg_im, opt.bg_file) != 0)
         {
			if (feh_load_image_char(&bg_im, opt.bg_file) != 0) {
				bg_w = gib_imlib_image_get_width(bg_im);
				bg_h = gib_imlib_image_get_height(bg_im);
			}
		}
	}

   if (!opt.limit_w || !opt.limit_h)
   {
      if (bg_im)
      {
	if (!opt.limit_w || !opt.limit_h) {
		if (bg_im) {
			if (opt.verbose)
				fprintf(stdout,
                    PACKAGE " - No size restriction specified for collage.\n"
					PACKAGE
					" - No size restriction specified for collage.\n"
					" You did specify a background however, so the\n"
					" collage size has defaulted to the size of the image\n");
			opt.limit_w = bg_w;
			opt.limit_h = bg_h;
      }
      else
      {
		} else {
			if (opt.verbose)
				fprintf(stdout,
                    PACKAGE " - No size restriction specified for collage.\n"
					PACKAGE
					" - No size restriction specified for collage.\n"
					" - For collage mode, you need to specify width and height.\n"
					" Using defaults (width 800, height 600)\n");
			opt.limit_w = 800;
@@ -101,13 +95,10 @@ init_collage_mode(void)
		gib_imlib_blend_image_onto_image(im_main, bg_im,
				gib_imlib_image_has_alpha(bg_im), 0, 0,
				bg_w, bg_h, 0, 0, w, h, 1, 0, 0);
   else if (trans_bg)
   {
	else if (trans_bg) {
		gib_imlib_image_fill_rectangle(im_main, 0, 0, w, h, 0, 0, 0, 0);
		gib_imlib_image_set_has_alpha(im_main, 1);
   }
   else
   {
	} else {
		/* Colour the background */
		gib_imlib_image_fill_rectangle(im_main, 0, 0, w, h, 0, 0, 0, 255);
	}
@@ -119,26 +110,20 @@ init_collage_mode(void)
	else
		s = estrdup(feh_printf(opt.title, NULL));

   if (opt.display)
   {
      winwid =
         winwidget_create_from_image(im_main, s, WIN_TYPE_SINGLE);
	if (opt.display) {
		winwid = winwidget_create_from_image(im_main, s, WIN_TYPE_SINGLE);
		winwidget_show(winwid);
	}


   for (l = filelist; l; l = l->next)
   {
	for (l = filelist; l; l = l->next) {
		file = FEH_FILE(l->data);
      if (last)
      {
		if (last) {
			filelist = feh_file_remove_from_list(filelist, last);
			filelist_len--;
			last = NULL;
		}
		D(3, ("About to load image %s\n", file->filename));
      if (feh_load_image(&im_temp, file) != 0)
      {
		if (feh_load_image(&im_temp, file) != 0) {
			D(3, ("Successfully loaded %s\n", file->filename));
			if (opt.verbose)
				feh_display_status('.');
@@ -147,8 +132,7 @@ init_collage_mode(void)
			ww = gib_imlib_image_get_width(im_temp);
			hh = gib_imlib_image_get_height(im_temp);

         if (opt.aspect)
         {
			if (opt.aspect) {
				double ratio = 0.0;

				/* Keep the aspect ratio for the thumbnail */
@@ -160,8 +144,7 @@ init_collage_mode(void)
					www = opt.thumb_w * ratio;
			}

         if ((!opt.stretch) && ((www > ww) || (hhh > hh)))
         {
			if ((!opt.stretch) && ((www > ww) || (hhh > hh))) {
				/* Don't make the image larger unless stretch is specified */
				www = ww;
				hhh = hh;
@@ -172,38 +155,29 @@ init_collage_mode(void)
			yyy = ((h - hhh) * ((double) rand() / RAND_MAX));
			D(5, ("image going on at x=%d, y=%d\n", xxx, yyy));

         im_thumb =
            gib_imlib_create_cropped_scaled_image(im_temp, 0, 0, ww, hh, www,
                                                  hhh, 1);
			im_thumb = gib_imlib_create_cropped_scaled_image(im_temp,
					0, 0, ww, hh, www, hhh, 1);
			gib_imlib_free_image_and_decache(im_temp);

         if (opt.alpha)
         {
			if (opt.alpha) {
				DATA8 atab[256];

				D(4, ("Applying alpha options\n"));
				gib_imlib_image_set_has_alpha(im_thumb, 1);
				memset(atab, opt.alpha_level, sizeof(atab));
            gib_imlib_apply_color_modifier_to_rectangle(im_thumb, 0, 0, www,
                                                        hhh, NULL, NULL, NULL,
                                                        atab);
				gib_imlib_apply_color_modifier_to_rectangle(im_thumb,
						0, 0, www, hhh, NULL, NULL, NULL, atab);
			}
			gib_imlib_blend_image_onto_image(im_main, im_thumb,
                                          gib_imlib_image_has_alpha(im_thumb),
                                          0, 0, www, hhh, xxx, yyy, www, hhh,
                                          1,
                                          gib_imlib_image_has_alpha(im_thumb),
                                          0);
					gib_imlib_image_has_alpha(im_thumb), 0, 0, www, hhh, xxx,
					yyy,www, hhh, 1, gib_imlib_image_has_alpha(im_thumb), 0);
			gib_imlib_free_image_and_decache(im_thumb);
      }
      else
      {
		} else {
			last = l;
			if (opt.verbose)
				feh_display_status('x');
		}
      if (opt.display)
      {
		if (opt.display) {
			winwidget_render_image(winwid, 0, 0);
			if (!feh_main_iteration(0))
				exit(0);
@@ -212,16 +186,14 @@ init_collage_mode(void)
	if (opt.verbose)
		fprintf(stdout, "\n");

   if (opt.output && opt.output_file)
   {
	if (opt.output && opt.output_file) {
		char output_buf[1024];
		if (opt.output_dir)
			snprintf(output_buf, 1024, "%s/%s", opt.output_dir, opt.output_file);
		else
			strncpy(output_buf, opt.output_file, 1024);
		gib_imlib_save_image(im_main, output_buf);
      if (opt.verbose)
      {
		if (opt.verbose) {
			int tw, th;

			tw = gib_imlib_image_get_width(im_main);
+510 −616

File changed.

Preview size limit exceeded, changes collapsed.

+15 −16
Original line number Diff line number Diff line
@@ -67,7 +67,6 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "utils.h"
#include "getopt.h"


#include "debug.h"

#define SLIDESHOW_RELOAD_MAX 4096
@@ -89,14 +88,15 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#define DEFAULT_FONT_BIG "yudit/12"
#define DEFAULT_FONT_TITLE "yudit/14"

enum mode_type
{ MODE_NORMAL = 0, MODE_PAN, MODE_ZOOM, MODE_ROTATE, MODE_BLUR, MODE_NEXT };
enum mode_type { MODE_NORMAL = 0, MODE_PAN, MODE_ZOOM, MODE_ROTATE, MODE_BLUR, MODE_NEXT
};

enum bgmode_type
{ BG_MODE_NONE = 0, BG_MODE_TILE, BG_MODE_CENTER, BG_MODE_SEAMLESS, BG_MODE_SCALE };
enum bgmode_type { BG_MODE_NONE = 0, BG_MODE_TILE, BG_MODE_CENTER, BG_MODE_SEAMLESS,
	BG_MODE_SCALE
};

enum slide_change
{ SLIDE_NEXT, SLIDE_PREV, SLIDE_FIRST, SLIDE_LAST, SLIDE_JUMP_FWD,
enum slide_change { SLIDE_NEXT, SLIDE_PREV, SLIDE_FIRST, SLIDE_LAST,
	SLIDE_JUMP_FWD,
	SLIDE_JUMP_BACK
};

@@ -150,7 +150,6 @@ gib_list * feh_wrap_string(char *text, int wrap_width, int max_height, Imlib_Fon
char *build_caption_filename(feh_file * file);
gib_list *feh_list_jump(gib_list * root, gib_list * l, int direction, int num);


/* Imlib stuff */
extern Display *disp;
extern Visual *vis;
+20 −31
Original line number Diff line number Diff line
@@ -33,8 +33,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#define FEH_PNG_COMPRESSION 3
#define FEH_PNG_NUM_COMMENTS 2	/* only Thumb::URI and Thumb::MTime for now */

gib_hash*
feh_png_read_comments(char *file)
gib_hash *feh_png_read_comments(char *file)
{
	gib_hash *hash = NULL;

@@ -55,8 +54,7 @@ feh_png_read_comments(char *file)

	/* initialize data structures */
	png_ptr = png_create_read_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);
	if (!png_ptr)
	{
	if (!png_ptr) {
		fclose(fp);
		return hash;
	}
@@ -68,8 +66,7 @@ feh_png_read_comments(char *file)
		return hash;
	}

	if (setjmp(png_ptr->jmpbuf))
	{
	if (setjmp(png_ptr->jmpbuf)) {
		png_destroy_read_struct(&png_ptr, &info_ptr, NULL);
		fclose(fp);
		return hash;
@@ -97,8 +94,7 @@ feh_png_read_comments(char *file)
}

/* grab image data from image and write info file with comments ... */
int
feh_png_write_png(Imlib_Image image, char *file, ...)
int feh_png_write_png(Imlib_Image image, char *file, ...)
{
	FILE *fp;
	int i, w, h;
@@ -123,14 +119,12 @@ feh_png_write_png(Imlib_Image image, char *file, ...)
		return 0;

	info_ptr = png_create_info_struct(png_ptr);
	if (!info_ptr)
	{
	if (!info_ptr) {
		png_destroy_write_struct(&png_ptr, (png_infopp) NULL);
		return 0;
	}

	if (setjmp(png_ptr->jmpbuf))
	{
	if (setjmp(png_ptr->jmpbuf)) {
		fclose(fp);
		png_destroy_write_struct(&png_ptr, &info_ptr);
		png_destroy_info_struct(png_ptr, &info_ptr);
@@ -143,8 +137,7 @@ feh_png_write_png(Imlib_Image image, char *file, ...)
	png_init_io(png_ptr, fp);

	png_set_IHDR(png_ptr, info_ptr, w, h, 8, PNG_COLOR_TYPE_RGB_ALPHA,
							 PNG_INTERLACE_NONE, PNG_COMPRESSION_TYPE_DEFAULT,
							 PNG_FILTER_TYPE_DEFAULT);
		     PNG_INTERLACE_NONE, PNG_COMPRESSION_TYPE_DEFAULT, PNG_FILTER_TYPE_DEFAULT);

#ifdef WORDS_BIGENDIAN
	png_set_swap_alpha(png_ptr);
@@ -160,17 +153,14 @@ feh_png_write_png(Imlib_Image image, char *file, ...)

#ifdef PNG_TEXT_SUPPORTED
	va_start(args, file);
	for (i = 0; i < FEH_PNG_NUM_COMMENTS; i++)
	{
		if ((pair_key = va_arg(args, char *)) &&
				(pair_text = va_arg(args, char *)))
		{
	for (i = 0; i < FEH_PNG_NUM_COMMENTS; i++) {
		if ((pair_key = va_arg(args, char *))
		    && (pair_text = va_arg(args, char *))) {
			/* got a complete pair, add to info structure */
			text[i].key = pair_key;
			text[i].text = pair_text;
			text[i].compression = PNG_TEXT_COMPRESSION_NONE;
		}
		else
		} else
			break;
	}
	va_end(args);
@@ -200,8 +190,7 @@ feh_png_write_png(Imlib_Image image, char *file, ...)
}

/* check PNG signature */
int
feh_png_file_is_png(FILE *fp)
int feh_png_file_is_png(FILE * fp)
{
	unsigned char buf[8];

+432 −491
Original line number Diff line number Diff line
@@ -34,8 +34,7 @@ extern int errno;

static gib_list *rm_filelist = NULL;

feh_file *
feh_file_new(char *filename)
feh_file *feh_file_new(char *filename)
{
	feh_file *newfile;
	char *s;
@@ -54,8 +53,7 @@ feh_file_new(char *filename)
	D_RETURN(4, newfile);
}

void
feh_file_free(feh_file * file)
void feh_file_free(feh_file * file)
{
	D_ENTER(4);
	if (!file)
@@ -72,8 +70,7 @@ feh_file_free(feh_file * file)
	D_RETURN_(4);
}

feh_file_info *
feh_file_info_new(void)
feh_file_info *feh_file_info_new(void)
{
	feh_file_info *info;

@@ -92,8 +89,7 @@ feh_file_info_new(void)
	D_RETURN(4, info);
}

void
feh_file_info_free(feh_file_info * info)
void feh_file_info_free(feh_file_info * info)
{
	D_ENTER(4);
	if (!info)
@@ -106,16 +102,14 @@ feh_file_info_free(feh_file_info * info)
	D_RETURN_(4);
}

gib_list *
feh_file_rm_and_free(gib_list * list, gib_list * l)
gib_list *feh_file_rm_and_free(gib_list * list, gib_list * l)
{
	D_ENTER(4);
	unlink(FEH_FILE(l->data)->filename);
	D_RETURN(4, feh_file_remove_from_list(list, l));
}

gib_list *
feh_file_remove_from_list(gib_list * list, gib_list * l)
gib_list *feh_file_remove_from_list(gib_list * list, gib_list * l)
{
	D_ENTER(4);
	feh_file_free(FEH_FILE(l->data));
@@ -123,8 +117,7 @@ feh_file_remove_from_list(gib_list * list, gib_list * l)
}

/* Recursive */
void
add_file_to_filelist_recursively(char *origpath, unsigned char level)
void add_file_to_filelist_recursively(char *origpath, unsigned char level)
{
	struct stat st;
	char *path;
@@ -136,8 +129,7 @@ add_file_to_filelist_recursively(char *origpath, unsigned char level)
	path = estrdup(origpath);
	D(4, ("file is %s\n", path));

   if (level == FILELIST_FIRST)
   {
	if (level == FILELIST_FIRST) {
		/* First time through, sort out pathname */
		int len = 0;

@@ -145,19 +137,16 @@ add_file_to_filelist_recursively(char *origpath, unsigned char level)
		if (path[len - 1] == '/')
			path[len - 1] = '\0';

      if ((!strncmp(path, "http://", 7)) || 
          (!strncmp(path, "https://", 8)) || 
          (!strncmp(path, "ftp://", 6)))
      {
		if ((!strncmp(path, "http://", 7))
				|| (!strncmp(path, "https://", 8))
				|| (!strncmp(path, "ftp://", 6))) {
			/* Its a url */
			D(3, ("Adding url %s to filelist\n", path));
			filelist = gib_list_add_front(filelist, feh_file_new(path));
			/* We'll download it later... */
			free(path);
			D_RETURN_(5);
      }
      else if (opt.filelistfile)
      {
		} else if (opt.filelistfile) {
			char *newpath = feh_absolute_path(path);

			free(path);
@@ -166,11 +155,9 @@ add_file_to_filelist_recursively(char *origpath, unsigned char level)
	}

	errno = 0;
   if (stat(path, &st))
   {
	if (stat(path, &st)) {
		/* Display useful error message */
      switch (errno)
      {
		switch (errno) {
		case ENOENT:
		case ENOTDIR:
			if (!opt.quiet)
@@ -178,13 +165,11 @@ add_file_to_filelist_recursively(char *origpath, unsigned char level)
			break;
		case ELOOP:
			if (!opt.quiet)
              weprintf("%s - too many levels of symbolic links - skipping",
                       path);
				weprintf("%s - too many levels of symbolic links - skipping", path);
			break;
		case EACCES:
			if (!opt.quiet)
              weprintf("you don't have permission to open %s - skipping",
                       path);
				weprintf("you don't have permission to open %s - skipping", path);
			break;
		default:
			if (!opt.quiet)
@@ -195,25 +180,22 @@ add_file_to_filelist_recursively(char *origpath, unsigned char level)
		D_RETURN_(5);
	}

   if ((S_ISDIR(st.st_mode)) && (level != FILELIST_LAST))
   {
	if ((S_ISDIR(st.st_mode)) && (level != FILELIST_LAST)) {
		struct dirent *de;
		DIR *dir;

		D(4, ("It is a directory\n"));

      if ((dir = opendir(path)) == NULL)
      {
		if ((dir = opendir(path)) == NULL) {
			if (!opt.quiet)
				weprintf("couldn't open directory %s:", path);
			free(path);
			D_RETURN_(5);
		}
		de = readdir(dir);
      while (de != NULL)
      {
         if (strcmp(de->d_name, ".") && strcmp(de->d_name, ".."))
         {
		while (de != NULL) {
			if (strcmp(de->d_name, ".")
					&& strcmp(de->d_name, "..")) {
				char *newfile;

				newfile = estrjoin("", path, "/", de->d_name, NULL);
@@ -230,9 +212,7 @@ add_file_to_filelist_recursively(char *origpath, unsigned char level)
			de = readdir(dir);
		}
		closedir(dir);
   }
   else if (S_ISREG(st.st_mode))
   {
	} else if (S_ISREG(st.st_mode)) {
		D(5, ("Adding regular file %s to filelist\n", path));
		filelist = gib_list_add_front(filelist, feh_file_new(path));
	}
@@ -240,16 +220,14 @@ add_file_to_filelist_recursively(char *origpath, unsigned char level)
	D_RETURN_(5);
}

void
add_file_to_rm_filelist(char *file)
void add_file_to_rm_filelist(char *file)
{
	D_ENTER(4);
	rm_filelist = gib_list_add_front(rm_filelist, feh_file_new(file));
	D_RETURN_(4);
}

void
delete_rm_files(void)
void delete_rm_files(void)
{
	gib_list *l;

@@ -259,8 +237,7 @@ delete_rm_files(void)
	D_RETURN_(4);
}

gib_list *
feh_file_info_preload(gib_list * list)
gib_list *feh_file_info_preload(gib_list * list)
{
	gib_list *l;
	feh_file *file = NULL;
@@ -270,26 +247,21 @@ feh_file_info_preload(gib_list * list)
	if (opt.verbose)
		fprintf(stdout, PACKAGE " - preloading...\n");

   for (l = list; l; l = l->next)
   {
	for (l = list; l; l = l->next) {
		file = FEH_FILE(l->data);
      D(5,
        ("file %p, file->next %p, file->name %s\n", l, l->next, file->name));
      if (feh_file_info_load(file, NULL))
      {
		D(5, ("file %p, file->next %p, file->name %s\n", l, l->next, file->name));
		if (feh_file_info_load(file, NULL)) {
			D(3, ("Failed to load file %p\n", file));
			remove_list = gib_list_add_front(remove_list, l);
			if (opt.verbose)
				feh_display_status('x');
      }
      else if (opt.verbose)
		} else if (opt.verbose)
			feh_display_status('.');
	}
	if (opt.verbose)
		fprintf(stdout, "\n");

   if (remove_list)
   {
	if (remove_list) {
		for (l = remove_list; l; l = l->next)
			filelist = list = gib_list_remove(list, (gib_list *) l->data);

@@ -299,8 +271,7 @@ feh_file_info_preload(gib_list * list)
	D_RETURN(4, list);
}

int
feh_file_info_load(feh_file * file, Imlib_Image im)
int feh_file_info_load(feh_file * file, Imlib_Image im)
{
	struct stat st;
	int need_free = 1;
@@ -314,11 +285,9 @@ feh_file_info_load(feh_file * file, Imlib_Image im)
		need_free = 0;

	errno = 0;
   if (stat(file->filename, &st))
   {
	if (stat(file->filename, &st)) {
		/* Display useful error message */
      switch (errno)
      {
		switch (errno) {
		case ENOENT:
		case ENOTDIR:
			if (!opt.quiet)
@@ -326,13 +295,11 @@ feh_file_info_load(feh_file * file, Imlib_Image im)
			break;
		case ELOOP:
			if (!opt.quiet)
              weprintf("%s - too many levels of symbolic links - skipping",
                       file->filename);
				weprintf("%s - too many levels of symbolic links - skipping", file->filename);
			break;
		case EACCES:
			if (!opt.quiet)
              weprintf("you don't have permission to open %s - skipping",
                       file->filename);
				weprintf("you don't have permission to open %s - skipping", file->filename);
			break;
		default:
			if (!opt.quiet)
@@ -368,66 +335,53 @@ feh_file_info_load(feh_file * file, Imlib_Image im)
	D_RETURN(4, 0);
}

int
feh_cmp_filename(void *file1, void *file2)
int feh_cmp_filename(void *file1, void *file2)
{
	D_ENTER(4);
	D_RETURN(4, strcmp(FEH_FILE(file1)->filename, FEH_FILE(file2)->filename));
}

int
feh_cmp_name(void *file1, void *file2)
int feh_cmp_name(void *file1, void *file2)
{
	D_ENTER(4);
	D_RETURN(4, strcmp(FEH_FILE(file1)->name, FEH_FILE(file2)->name));
}

int
feh_cmp_width(void *file1, void *file2)
int feh_cmp_width(void *file1, void *file2)
{
	D_ENTER(4);
	D_RETURN(4, (FEH_FILE(file1)->info->width - FEH_FILE(file2)->info->width));
}

int
feh_cmp_height(void *file1, void *file2)
int feh_cmp_height(void *file1, void *file2)
{
	D_ENTER(4);
   D_RETURN(4,
            (FEH_FILE(file1)->info->height - FEH_FILE(file2)->info->height));
	D_RETURN(4, (FEH_FILE(file1)->info->height - FEH_FILE(file2)->info->height));
}

int
feh_cmp_pixels(void *file1, void *file2)
int feh_cmp_pixels(void *file1, void *file2)
{
	D_ENTER(4);
   D_RETURN(4,
            (FEH_FILE(file1)->info->pixels - FEH_FILE(file2)->info->pixels));
	D_RETURN(4, (FEH_FILE(file1)->info->pixels - FEH_FILE(file2)->info->pixels));
}

int
feh_cmp_size(void *file1, void *file2)
int feh_cmp_size(void *file1, void *file2)
{
	D_ENTER(4);
	D_RETURN(4, (FEH_FILE(file1)->info->size - FEH_FILE(file2)->info->size));
}

int
feh_cmp_format(void *file1, void *file2)
int feh_cmp_format(void *file1, void *file2)
{
	D_ENTER(4);
   D_RETURN(4,
            strcmp(FEH_FILE(file1)->info->format,
                   FEH_FILE(file2)->info->format));
	D_RETURN(4, strcmp(FEH_FILE(file1)->info->format, FEH_FILE(file2)->info->format));
}

void
feh_prepare_filelist(void)
void feh_prepare_filelist(void)
{
	D_ENTER(4);
	if (opt.list || opt.customlist || (opt.sort > SORT_FILENAME)
       || opt.preload)
   {
			|| opt.preload) {
		/* For these sort options, we have to preload images */
		filelist = feh_file_info_preload(filelist);
		if (!gib_list_length(filelist))
@@ -435,16 +389,12 @@ feh_prepare_filelist(void)
	}

	D(3, ("sort mode requested is: %d\n", opt.sort));
   switch (opt.sort)
   {
	switch (opt.sort) {
	case SORT_NONE:
        if (opt.randomize)
        {
		if (opt.randomize) {
			/* Randomize the filename order */
			filelist = gib_list_randomize(filelist);
        }
        else if (!opt.reverse)
        {
		} else if (!opt.reverse) {
			/* Let's reverse the list. Its back-to-front right now ;) */
			filelist = gib_list_reverse(filelist);
		}
@@ -475,8 +425,7 @@ feh_prepare_filelist(void)
	}

	/* no point reversing a random list */
   if (opt.reverse && (opt.sort != SORT_NONE))
   {
	if (opt.reverse && (opt.sort != SORT_NONE)) {
		D(3, ("Reversing filelist as requested\n"));
		filelist = gib_list_reverse(filelist);
	}
@@ -484,8 +433,7 @@ feh_prepare_filelist(void)
	D_RETURN_(4);
}

int
feh_write_filelist(gib_list * list, char *filename)
int feh_write_filelist(gib_list * list, char *filename)
{
	FILE *fp;
	gib_list *l;
@@ -496,8 +444,7 @@ feh_write_filelist(gib_list * list, char *filename)
		D_RETURN(4, 0);

	errno = 0;
   if ((fp = fopen(filename, "w")) == NULL)
   {
	if ((fp = fopen(filename, "w")) == NULL) {
		weprintf("can't write filelist %s:", filename);
		D_RETURN(4, 0);
	}
@@ -510,8 +457,7 @@ feh_write_filelist(gib_list * list, char *filename)
	D_RETURN(4, 1);
}

gib_list *
feh_read_filelist(char *filename)
gib_list *feh_read_filelist(char *filename)
{
	FILE *fp;
	gib_list *list = NULL;
@@ -529,21 +475,21 @@ feh_read_filelist(char *filename)
	 * filelist).
	 */
	if (feh_load_image_char(&im1, filename)) {
      weprintf("The file you specified as a filelist to read - %s - appears to be an image. Ignoring it (this is a common mistake).\n", filename);
		weprintf(
				"The file you specified as a filelist to read - %s - appears to be an image. Ignoring it (this is a common mistake).\n",
				filename);
		opt.filelistfile = NULL;
		D_RETURN(4, NULL);
	}

	errno = 0;
   if ((fp = fopen(filename, "r")) == NULL)
   {
	if ((fp = fopen(filename, "r")) == NULL) {
		/* return quietly, as it's okay to specify a filelist file that doesn't
		   exist. In that case we create it on exit. */
		D_RETURN(4, NULL);
	}

   for (; fgets(s, sizeof(s), fp);)
   {
	for (; fgets(s, sizeof(s), fp);) {
		D(5, ("Got line '%s'\n", s));
		s1[0] = '\0';
		sscanf(s, "%[^\n]", (char *) &s1);
@@ -558,8 +504,7 @@ feh_read_filelist(char *filename)
	D_RETURN(4, list);
}

char *
feh_absolute_path(char *path)
char *feh_absolute_path(char *path)
{
	char cwd[PATH_MAX];
	char fullpath[PATH_MAX];
@@ -581,12 +526,9 @@ feh_absolute_path(char *path)
	   path you give it is relative. Linux and BSD get this right... */
	getcwd(cwd, sizeof(cwd));
	snprintf(temp, sizeof(temp), "%s/%s", cwd, path);
   if (realpath(temp, fullpath) != NULL)
   {
	if (realpath(temp, fullpath) != NULL) {
		ret = estrdup(fullpath);
   }
   else
   {
	} else {
		ret = estrdup(temp);
	}
	D(4, ("Converted path to %s\n", ret));
@@ -599,8 +541,7 @@ void feh_save_filelist()

	D_ENTER(4);

      tmpname =
         feh_unique_filename("", "filelist");
	tmpname = feh_unique_filename("", "filelist");

	if (!opt.quiet)
		printf("saving filelist to filename '%s'\n", tmpname);
Loading