From add9cfa1ae859e5f728a2ec3fd1d02586008dfe0 Mon Sep 17 00:00:00 2001
From: Daniel Friesel <derf@derf.homelinux.org>
Date: Sat, 19 Jun 2010 19:52:47 +0200
Subject: [PATCH] Move fehrc / help from options.c into separate files

---
 .gitignore    |   1 +
 src/Makefile  |  22 ++-
 src/deps.mk   |   2 +-
 src/fehrc.raw |  66 ++++++++
 src/help.raw  | 331 ++++++++++++++++++++++++++++++++++++++++
 src/options.c | 414 +-------------------------------------------------
 6 files changed, 422 insertions(+), 414 deletions(-)
 create mode 100644 src/fehrc.raw
 create mode 100644 src/help.raw

diff --git a/.gitignore b/.gitignore
index eb1565f..654402f 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,2 +1,3 @@
 /src/*.o
+/src/*.inc
 /src/feh
diff --git a/src/Makefile b/src/Makefile
index ed1ecc8..84ee7ab 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -3,15 +3,27 @@ include ../config.mk
 TARGETS = ${shell echo *.c}
 OBJECTS = ${TARGETS:.c=.o}
 
-feh: deps.mk ${OBJECTS}
-	${CC} ${LDFLAGS} ${CFLAGS} -o $@ ${OBJECTS} ${LDLIBS}
+I_SRCS = ${shell echo *.raw}
+I_DSTS = ${I_SRCS:.raw=.inc}
 
-deps.mk: ${TARGETS}
-	${CC} -MM ${TARGETS} > $@
+feh: deps.mk ${OBJECTS} ${I_DSTS}
+	${CC} ${LDFLAGS} ${CFLAGS} -o $@ ${OBJECTS} ${LDLIBS}
 
 include deps.mk
 
+.raw.inc:
+	sed 's/^\(.*\)$$/"\1\\n"/' < ${@:.inc=.raw} > $@
+
+fehrc.inc: fehrc.raw
+help.inc: help.raw
+
+
+deps.mk: ${TARGETS} ${I_DSTS}
+	${CC} -MM ${TARGETS} > $@
+
 clean:
-	rm -f feh *.o
+	rm -f feh *.o *.inc
 
 .PHONY: clean
+
+.SUFFIXES: .inc .raw
diff --git a/src/deps.mk b/src/deps.mk
index 9777c8e..36b264f 100644
--- a/src/deps.mk
+++ b/src/deps.mk
@@ -24,7 +24,7 @@ menu.o: menu.c feh.h structs.h menu.h utils.h getopt.h debug.h support.h \
 multiwindow.o: multiwindow.c feh.h structs.h menu.h utils.h getopt.h \
   debug.h winwidget.h timers.h filelist.h options.h
 options.o: options.c feh.h structs.h menu.h utils.h getopt.h debug.h \
-  filelist.h options.h
+  filelist.h options.h help.inc fehrc.inc
 signals.o: signals.c feh.h structs.h menu.h utils.h getopt.h debug.h \
   winwidget.h
 slideshow.o: slideshow.c feh.h structs.h menu.h utils.h getopt.h debug.h \
diff --git a/src/fehrc.raw b/src/fehrc.raw
new file mode 100644
index 0000000..d26f7a7
--- /dev/null
+++ b/src/fehrc.raw
@@ -0,0 +1,66 @@
+# Feh configuration file.
+# Lines starting with # are comments. Don't use comments mid-line.
+
+# Feh expects to find this as ~/.fehrc or /etc/fehrc
+# If both are available, ~/.fehrc will be used
+
+# Options are defined in theme_name/options pairs.
+# Separate themename and options by whitespace.
+
+# There are two ways of specifying the theme. Either use feh -Tthemename,
+# or use a symbolic link to feh with the name of the theme. eg
+# ln -s `which feh` ~/bin/mkindex
+# Now when you run 'mkindex', feh will load the config specified for the
+# mkindex theme.
+
+# ======================
+# Some examples of usage
+# ======================
+
+# Set the default feh options to be recursive and verbose
+# feh -rV
+
+# Multiple options can of course be used. If they are not in one line,
+# the lines after the theme name must start with a tab character. Like:
+# imagemap -rV --quiet -W 400 -H 300 \\
+#          --thumb-width 40 --thumb-height 30
+
+# ====================
+# A few default themes
+# ====================
+
+# Webcam mode, simply specify the url(s).
+# e.g. feh -Twebcam http://cam1 http://cam2
+webcam --multiwindow --reload 20
+
+# Create an index of the current directory. This version uses . as the
+# current dir, so you don't even need any commandline arguments.
+mkindex -iVO index.jpg .
+
+# More ambitious version...
+imgidx -iVO .fehindex.jpg --limit-width 1200 --thumb-width 90 --thumb-height 90 .
+
+# Show a presentation
+present --full-screen --sort name
+
+# Booth mode ;-)
+booth --full-screen --hide-pointer --slideshow-delay 20
+
+# Screw xscreensaver, use feh =)
+screensave --full-screen --randomize --slideshow-delay 5
+
+# Add <img> tags to your html with ease :-)
+newimg -q -L \"<img src=\\\"%f\\\" alt=\\\"%n\\\" border=\\\"0\\\" width=\\\"%w\\\" height=\\\"%h\\\">\"
+
+# Different menus
+chrome --menu-bg " PREFIX "/share/feh/images/menubg_chrome.png
+brushed --menu-bg " PREFIX "/share/feh/images/menubg_brushed.png
+pastel --menu-bg " PREFIX "/share/feh/images/menubg_pastel.png
+aluminium --menu-bg " PREFIX "/share/feh/images/menubg_aluminium.png
+wood --menu-bg " PREFIX "/share/feh/images/menubg_wood.png
+aqua --menu-bg " PREFIX "/share/feh/images/menubg_aqua.png
+sky --menu-bg " PREFIX "/share/feh/images/menubg_sky.png
+orange --menu-bg " PREFIX "/share/feh/images/menubg_orange.png
+light --menu-bg " PREFIX "/share/feh/images/menubg_light.png
+black --menu-bg " PREFIX "/share/feh/images/menubg_black.png \\
+      --menu-style " PREFIX "/share/feh/fonts/black.style
diff --git a/src/help.raw b/src/help.raw
new file mode 100644
index 0000000..0598e37
--- /dev/null
+++ b/src/help.raw
@@ -0,0 +1,331 @@
+Usage : " PACKAGE " [OPTIONS]... FILES...
+ Where a FILE is an image file or a directory.
+ Multiple files are supported.
+ Urls are supported. They must begin with http:// or ftp:// and you must
+ have wget installed to download the files for viewing.
+ Options can also be specified in the in the feh configuration file. See
+ man feh for more details
+ -h, --help                display this help and exit
+ -v, --version             output version information and exit
+ -V, --verbose             output useful information, progress bars, etc
+ -q, --quiet               Don't report non-fatal errors for failed loads
+                           Verbose and quiet modes are not mutually exclusive,
+                           the first controls informational messages, the
+                           second only errors.
+ -T, --theme THEME         Load options from config file with name THEME
+                           see man feh for more info.
+ -_, --rcfile FILE         Use FILE to parse themes and options from,
+                           instead of the default ~/.fehrc, /etc/fehrc files.
+ -r, --recursive           Recursively expand any directories in FILE to
+                           the content of those directories. (Take it easy)
+ -z, --randomize           When viewing multiple files in a slideshow,
+                           randomise the file list before displaying
+ --no-jump-on-resort       Don't jump to the first image when the filelist
+                           is resorted.
+ -g, --geometry STRING     Limit (and don't change) the window size. Takes
+                           an X-style geometry string like 640x480.
+                           Note that larger images will be zoomed out to fit
+                           but you can see them at 1:1 by clicking the zoom
+                           button.
+ -f, --filelist FILE       This option is similar to the playlists used by
+                           music software. If FILE exists, it will be read
+                           for a list of files to load, in the order they
+                           appear. The format is a list of image filenames,
+                           absolute or relative to the current directory,
+                           one filename per line.
+                           If FILE doesn't exist, it will be created from the
+                           internal filelist at the end of a viewing session.
+                           This is best used to store the results of complex
+                           sorts (-Spixels for example) for later viewing.
+                           Any changes to the internal filelist (such as
+                           deleting a file or it being pruned for being
+                           unloadable) will be saved to FILE when feh exits.
+                           You can add files to filelists by specifying them
+                           on the commandline when also specifying the list.
+ -|, --start-at POSITION   Start at POSITION in the filelist
+ -p, --preload             Preload images. This doesn't mean hold them in
+                           RAM, it means run through and eliminate unloadable
+                           images first. Otherwise they will be removed as you
+                           flick through.
+ -., --scale-down          Automatically scale down images too big for the
+                           screen. Currently only works with -P
+ -F, --full-screen         Make the window fullscreen
+ -Z, --auto-zoom           Zoom picture to screen size in fullscreen mode,
+                           is affected by the option --stretch
+     --zoom PERCENT        Zooms images by a PERCENT, when in full screen
+                           mode or when window geometry is fixed. If combined
+                           with --auto-zoom, zooming will be limited to the
+                           the size.
+ -w, --multiwindow         Disable slideshow mode. With this setting,
+                           instead of opening multiple files in slideshow
+                           mode, multiple windows will be opened.
+ -x, --borderless          Create borderless windows
+ -d, --draw-filename       Draw the filename at the top-left of the image.
+ -^, --title TITLE         Use TITLE as the window title in slideshow mode.
+ -D, --slideshow-delay NUM For slideshow mode, specifies time delay (seconds,
+                           can be a decimal) between automatically changing
+                           slides.
+     --cycle-once          exit feh after one loop through a slideshow
+ -R, --reload NUM          Use this option to tell feh to reload an image
+                           after NUM seconds. Useful for viewing webcams
+                           via http, or even on your local machine.
+ -Q, --builtin             Use builtin http grabber to grab remote files
+                           instead of wget.
+                           mechanism, useful if don't have wget.
+ -k, --keep-http           When viewing files using http, feh normally
+                           deletes the local copies after viewing, or,
+                           if caching, on exit. This option prevents this
+                           so that you get to keep the local copies.
+                           They will be in the current working directory
+                           with \"feh\" in the name.
+     --caption-path PATH   Path to directory containing image captions.
+                           This turns on caption viewing, and if captions
+                           are found in PATH, which is relative to the
+                           directory of each image, they are overlayed
+                           on the displayed image.
+                           e.g with caption path \"captions\", and viewing
+                           image images/foo.jpg, caption will be looked for
+                           as \"images/captions/foo.jpg.txt\"
+ -j, --output-dir          Output directory for saved files.  Really only
+                           useful with the -k flag.
+ -G, --wget-timestamp      When viewing http images with reload set (eg
+                           webcams), try to only reload the image if the
+                           remote file has changed.
+ -l, --list                Don't display images. Analyse them and display an
+                           'ls' style listing. Useful in scripts hunt out
+                           images of a certain size/resolution/type etc.
+ -L, --customlist FORMAT   Use FORMAT as the format specifier for list
+                           output. FORMAT is a printf-like string containing
+                           image info specifiers. See FORMAT SPECIFIERS.
+ -U, --loadable            Don't display images. Just print out their name
+                           if imlib2 can successfully load them.
+ -u, --unloadable          Don't display images. Just print out their name
+                           if imlib2 can NOT successfully load them.
+ -S, --sort SORT_TYPE      The file list may be sorted according to image
+                           parameters. Allowed sort types are: name,
+                           filename, width, height, pixels, size, format.
+                           For sort modes other than name or filename, a
+                           preload run will be necessary, causing a delay
+                           proportional to the number of images in the list
+ -n, --reverse             Reverse the sort order. Use this to invert the order
+                           of the filelist. Eg to sort in reverse width order,
+                           use -nSwidth
+ -A, --action ACTION       Specify a string as an action to perform on the
+                           image. In slideshow or multiwindow modes, the action
+                           in list mode, or loadable|unloadable modes, the
+                           action will be run for each file.
+                           The action will be executed by /bin/sh. Use
+                           format specifiers to refer to image info. See
+                           FORMAT SPECIFIERS for examples
+                           Eg. -A \"mv %f ~/images/%%n\"
+                           In slideshow mode, the next image will be shown
+                           after running the command, in multiwindow mode,
+                           the window will be closed.
+     --action1 ACTION      These extra action options allow you to specify
+     --action2 ACTION      multiple additional actions which can be invoked
+     ...                   using the appropriate number key 1-9
+     --action9 ACTION
+     --draw-actions        Show the defined actions and what they do
+ -m, --montage             Enable montage mode. Montage mode creates a new
+                           image consisting of a grid of thumbnails of the
+                           images specified using FILE... When montage mode
+                           is selected, certain other options become
+                           available. See MONTAGE MODE OPTIONS
+ -c, --collage             Same as montage mode, but the thumbnails are
+                           distributed randomly. You must specify width and
+                           height or supply a background image or both
+ -i, --index               Enable Index mode. Index mode is similar to
+                           montage mode, and accepts the same options. It
+                           creates an index print of thumbails, printing the
+                           images name beneath each thumbnail. Index mode
+                           enables certain other options, see INDEX MODE
+                           OPTIONS
+ -t, --thumbnails          As --index, but clicking an image will open it in
+                           a new viewing window
+     --cache-thumbnails    Enable thumbnail caching for thumbnail mode.
+                           Only works with thumbnails <= 256x256 pixels
+     --thumb-redraw N      Redraw thumbnail window every N images
+ -~, --thumb-title STRING  Set window title for images opened from thumbnail mode.
+                           Supports format specifiers, see there.
+ -I, --fullindex           Same as index mode, but below each thumbnail you
+                           get image name, size and dimensions
+     --index-name BOOL     Show/Don't show filename in index/thumbnail mode
+     --index-size BOOL     Show/Don't show filesize in index/thumbnail mode
+     --index-dim BOOL      Show/Don't show dimensions in index/thumbnail mode
+     --bg-tile FILE        Set FILE as tiled desktop background. Feh can
+                           use enlightenment IPC if you are running it,
+                           or will fall back to X methods.
+                           Feh stores the commandline necessary to restore
+                           the background you chose in ~/.fehbg. So to have
+                           feh-set backgrounds restored when you restart X,
+                           add the line \"eval `cat $HOME/.fehbg`\" to your
+                           X startup script (e.g. ~/.xsession). Note that
+                           you only need to do this for non E window
+                           managers
+     --bg-center FILE      Set FILE as centered desktop background
+     --bg-scale FILE       Set FILE as scaled desktop background. This will
+                           fill the whole background, but the images' aspect
+                           ratio may not be preserved
+     --bg-fill FILE        Like --bg-scale, but preserves aspect ratio by
+                           zooming the image until it fits
+     --bg-seamless FILE    Like --bg-tile, but with blurry corners
+ -C, --fontpath PATH       Specify an extra directory to look in for fonts,
+                           can be used multiple times to add multiple paths.
+ -M, --menu-font FONT      Use FONT for the font in menus.
+     --menu-style FILE     Use FILE as the style descriptor for menu text.
+ -), --menu-bg BG          Use BG for the background image in menus.
+     --menu-border INT     Specify number of pixels that define the menu
+                           background's border. Borders are not stretched
+                           when images are scaled.
+ -B, --image-bg STYLE      Set background for transparent images and the like.
+                           Accepted values: white, black, default
+ -N, --no-menus            Don't load or show any menus.
+ -0, --reload-button B     Use button B to reload the image (defaults to 0)
+ -1, --pan-button B        Use button B pan the image (hold button down, move
+                           the mouse to move the image around. Advancesto the
+                           next image when the mouse is not moved (defaults to
+                           1, usually the left button).
+ -2, --zoom-button B       Use button B to zoom the current image in any
+                           mode (defaults to 2, usually the middle button).
+ -3, --menu-button B       Use CTRL+Button B to activate the menu in any
+                           mode.  Set to 0 for any button.  This option
+                           is disabled if the -N or --no-menus option is set
+                           (defaults to 3, usually the right button).
+     --menu-ctrl-mask      Require CTRL+Button for menu activation in
+                           any mode (default=off).
+ -4, --prev-button B       Use button B to switch to the previous image
+                           (defaults to 4, which usually is <mousewheel up>).
+ -5, --next-button B       Use button B to switch to the next image
+                           (defaults to 5, which usually is <mousewheel down>).
+ -8, --rotate-button B     Use CTRL+Button B to rotate the current image in
+                           any mode (default=2).
+     --no-rotate-ctrl-mask Don't require CTRL+Button for rotation in
+                           any mode -- just use the button (default=off).
+ -9, --blur-button B       Use CTRL+Button B to blur the current image in
+                           any mode (default=1).
+     --no-blur-ctrl-mask   Don't require CTRL+Button for blurring in
+                           any mode -- just use the button (default=off).
+     --no-xinerama         Disable Xinerama support.  Only useful if
+                           you have Xinerama compiled in.
+     --no-screen-clip      Disable window clipping based on screen
+                           size.  WARNING: with this option disabled,
+                           image windows could become very large, making
+                           them unmanageable in certain window managers.
+     --hide-pointer        In full screen mode, hide the X mouse pointer.
+ FORMAT SPECIFIERS
+                           %f image path/filename
+                           %n image name
+                           %s image size (bytes)
+                           %p image pixel size
+                           %w image width
+                           %h image height
+                           %t image format
+                           %P prints feh
+                           %v prints the version
+                           %m prints the mode (slideshow, multiwindow...)
+                           %l prints the total number of files in the filelist
+                           %u prints the current file number
+                           %% prints a %
+                           \\n prints a newline
+                           Eg. feh -A \"mv %f ~/images/%n\" *
+ MONTAGE MODE OPTIONS
+ -X, --ignore-aspect       By default, the montage thumbnails will retain
+                           their aspect ratios, while fitting in --thumb-width
+                           and --thumb-height. This option will force them to
+                           be the size set by --thumb-width and --thumb-height
+                           This will prevent any whitespace in the final
+                           montage
+ -s, --stretch             Normally, if an image is smaller than the specified
+                           thumbnail size, it will not be enlarged. If this
+                           option is set, the image will be scaled up to fit
+                           the thumbnail size. (Aspect ratio will be maintained
+                           unless --ignore-aspect is specified)
+ -y, --thumb-width NUM     Set thumbnail width in pixels
+ -E, --thumb-height NUM    Set thumbnail height in pixels
+                           Thumbnails default to 20x20 pixels
+ -W, --limit-width NUM     Limit the width of the montage in pixels
+ -H, --limit-height NUM    Limit the height of the montage in pixels
+                           These options can be used together (to define the
+                           image size exactly), or separately. If only one is
+                           specified, theother is calculated from the number
+                           of files specified and the size of the thumbnails.
+                           The default is to limit width to 800 pixels and
+                           calculate the height
+ -b, --bg FILE|trans       Use FILE as a background for your montage. With
+                           this option specified, the size of the montage will
+                           default to the size of FILE if no size restrictions
+                           are specified. Alternatively, if FILE is \"trans\",
+                           make the background transparent.
+ -a, --alpha NUM           When drawing thumbnails onto the background, apply
+                           them with a transparency level of NUM (0-255).
+ -o, --output FILE         Save the created montage to FILE
+ -O, --output-only  FILE   Just save the created montage to FILE
+                           WITHOUT displaying it (use in scripts)
+ -e, --font FONT           Use FONT to print the information under each
+                           thumbnail. FONT should be defined in the form
+                           fontname/size(points). eg -e myfont/12
+ INDEX MODE OPTIONS
+ -@, --title-font FONT     Use FONT to print a title on the index, if no
+                           font is specified, a title will not be printed
+ SLIDESHOW KEYS
+ The default mode for viewing mulitple images is Slideshow mode
+ When viewing a slideshow, the following keys may be used:
+ p, P, <BACKSPACE>, <LEFT>  Goto previous slide
+ n, N, <SPACE>, <RIGHT>     Goto next slide
+ r, R                       Reload image (good for webcams)
+ v, V                       Toggle fullscreen
+ m, M                       Show popup menu
+ c, C                       Caption entry mode. If --caption-path has been
+                            specified, then this enables caption editing.
+                            The caption will turn yellow and be editable,
+                            hit enter to confirm and save the caption, or
+                            hit escape to cancel and revert the caption.
+ w, W                       Size window to current image dimensions
+ h, H                       Pause the slideshow (only useful when using
+                            timed reloading or image changes)
+ z, Z                       Jump to a random position in the current filelist
+ a, A                       Toggle action display (--draw-actions)
+ d, D                       Toggle filename display (--draw-filename)
+ s, S                       Save current image to unique filename
+ f, F                       Save current filelist to unique filename
+ <, >                       In place editing, rotate 90 degrees right/left
+ <HOME>                     Goto first slide
+ <END>                      Goto last slide
+ <ESCAPE>                   Quit the slideshow
+ +, =                       Increase reload delay
+ -, _                       Decrease reload delay
+ <DELETE>                   Remove the currently viewed file from the filelist
+ <CTRL+DELETE>              Delete the currently viewed file and remove it
+                            from the filelist
+ x, X                       Close current window
+ q, Q                       Quit the slideshow
+ <KEYPAD LEFT>              Move the image to the left
+ <KEYPAD RIGHT>             Move the image to the right
+ <KEYPAD UP>                Move the image up
+ <KEYPAD DOWN>              Move the image down
+ <KEYPAD BEGIN>             Antialias the image
+ <KEYPAD +>                 Zoom in
+ <KEYPAD ->                 Zoom out
+ <KEYPAD *>                 Zoom to 100%
+ <KEYPAD />                 Zoom to fit the window
+ <ENTER>,0                  Run action specified by --action option
+ 1-9                        Run action 1-9 specified by --action[1-9] options
+
+ MOUSE ACTIONS
+ When viewing an image, a click of mouse button 1 moves to the next image
+ (slideshow mode only), a drag of mouse button 1 pans the image, if the
+ viewable window is smaller than the image, button 2 zooms (click and drag
+ left->right to zoom in, right->left to zoom out, click once to restore
+ 1x zoom), and mouse button 3 pans.
+ Ctrl+button 1 blurs or sharpens the image (drag left to blur and right to
+ sharpen).  Ctrl+button 2 rotates the image around the center point.
+ Button 3 activates the context-sensitive menu.  Buttons can be redefined
+ with the -1 through -9 (or --*-button) cmdline flags.  All you people
+ with million button mice can remove the ctrl mask with the --no-*-ctrl-mask
+ options.
+
+See 'man feh' for more detailed information
+
+This program is free software see the file COPYING for licensing info.
+Copyright Tom Gilbert (and various contributors) 1999-2003
+Email bugs to <derf@chaosdorf.de>
diff --git a/src/options.c b/src/options.c
index 392fa26..e8c1baf 100644
--- a/src/options.c
+++ b/src/options.c
@@ -846,335 +846,9 @@ void show_mini_usage(void)
 
 static void show_usage(void)
 {
-	fprintf(stdout,
-"Usage : " PACKAGE " [OPTIONS]... FILES...\n"
-" Where a FILE is an image file or a directory.\n"
-" Multiple files are supported.\n"
-" Urls are supported. They must begin with http:// or ftp:// and you must\n"
-" have wget installed to download the files for viewing.\n"
-" Options can also be specified in the in the feh configuration file. See\n"
-" man feh for more details\n"
-" -h, --help                display this help and exit\n"
-" -v, --version             output version information and exit\n"
-" -V, --verbose             output useful information, progress bars, etc\n"
-" -q, --quiet               Don't report non-fatal errors for failed loads\n"
-"                           Verbose and quiet modes are not mutually exclusive,\n"
-"                           the first controls informational messages, the\n"
-"                           second only errors.\n"
-" -T, --theme THEME         Load options from config file with name THEME\n"
-"                           see man feh for more info.\n"
-" -_, --rcfile FILE         Use FILE to parse themes and options from,\n"
-"                           instead of the default ~/.fehrc, /etc/fehrc files.\n"
-" -r, --recursive           Recursively expand any directories in FILE to\n"
-"                           the content of those directories. (Take it easy)\n"
-" -z, --randomize           When viewing multiple files in a slideshow,\n"
-"                           randomise the file list before displaying\n"
-" --no-jump-on-resort       Don't jump to the first image when the filelist\n"
-"                           is resorted.\n"
-" -g, --geometry STRING     Limit (and don't change) the window size. Takes\n"
-"                           an X-style geometry string like 640x480.\n"
-"                           Note that larger images will be zoomed out to fit\n"
-"                           but you can see them at 1:1 by clicking the zoom\n"
-"                           button.\n"
-" -f, --filelist FILE       This option is similar to the playlists used by\n"
-"                           music software. If FILE exists, it will be read\n"
-"                           for a list of files to load, in the order they\n"
-"                           appear. The format is a list of image filenames,\n"
-"                           absolute or relative to the current directory,\n"
-"                           one filename per line.\n"
-"                           If FILE doesn't exist, it will be created from the\n"
-"                           internal filelist at the end of a viewing session.\n"
-"                           This is best used to store the results of complex\n"
-"                           sorts (-Spixels for example) for later viewing.\n"
-"                           Any changes to the internal filelist (such as\n"
-"                           deleting a file or it being pruned for being\n"
-"                           unloadable) will be saved to FILE when feh exits.\n"
-"                           You can add files to filelists by specifying them\n"
-"                           on the commandline when also specifying the list.\n"
-" -|, --start-at POSITION   Start at POSITION in the filelist\n"
-" -p, --preload             Preload images. This doesn't mean hold them in\n"
-"                           RAM, it means run through and eliminate unloadable\n"
-"                           images first. Otherwise they will be removed as you\n"
-"                           flick through.\n"
-" -., --scale-down          Automatically scale down images too big for the\n"
-"                           screen. Currently only works with -P\n"
-" -F, --full-screen         Make the window fullscreen\n"
-" -Z, --auto-zoom           Zoom picture to screen size in fullscreen mode,\n"
-"                           is affected by the option --stretch\n"
-"     --zoom PERCENT        Zooms images by a PERCENT, when in full screen\n"
-"                           mode or when window geometry is fixed. If combined\n"
-"                           with --auto-zoom, zooming will be limited to the\n"
-"                           the size.\n"
-" -w, --multiwindow         Disable slideshow mode. With this setting,\n"
-"                           instead of opening multiple files in slideshow\n"
-"                           mode, multiple windows will be opened.\n"
-" -x, --borderless          Create borderless windows\n"
-" -d, --draw-filename       Draw the filename at the top-left of the image.\n"
-" -^, --title TITLE         Use TITLE as the window title in slideshow mode.\n"
-" -D, --slideshow-delay NUM For slideshow mode, specifies time delay (seconds,\n"
-"                           can be a decimal) between automatically changing\n"
-"                           slides.\n"
-"     --cycle-once          exit feh after one loop through a slideshow\n"
-" -R, --reload NUM          Use this option to tell feh to reload an image\n"
-"                           after NUM seconds. Useful for viewing webcams\n"
-"                           via http, or even on your local machine.\n"
-" -Q, --builtin             Use builtin http grabber to grab remote files\n"
-"                           instead of wget.\n"
-"                           mechanism, useful if don't have wget.\n"
-" -k, --keep-http           When viewing files using http, feh normally\n"
-"                           deletes the local copies after viewing, or,\n"
-"                           if caching, on exit. This option prevents this\n"
-"                           so that you get to keep the local copies.\n"
-"                           They will be in the current working directory\n"
-"                           with \"feh\" in the name.\n"
-"     --caption-path PATH   Path to directory containing image captions.\n"
-"                           This turns on caption viewing, and if captions\n"
-"                           are found in PATH, which is relative to the\n"
-"                           directory of each image, they are overlayed\n"
-"                           on the displayed image.\n"
-"                           e.g with caption path \"captions\", and viewing\n"
-"                           image images/foo.jpg, caption will be looked for\n"
-"                           as \"images/captions/foo.jpg.txt\"\n"
-" -j, --output-dir          Output directory for saved files.  Really only\n"
-"                           useful with the -k flag.\n"
-" -G, --wget-timestamp      When viewing http images with reload set (eg\n"
-"                           webcams), try to only reload the image if the\n"
-"                           remote file has changed.\n"
-" -l, --list                Don't display images. Analyse them and display an\n"
-"                           'ls' style listing. Useful in scripts hunt out\n"
-"                           images of a certain size/resolution/type etc.\n"
-" -L, --customlist FORMAT   Use FORMAT as the format specifier for list\n"
-"                           output. FORMAT is a printf-like string containing\n"
-"                           image info specifiers. See FORMAT SPECIFIERS.\n"
-" -U, --loadable            Don't display images. Just print out their name\n"
-"                           if imlib2 can successfully load them.\n"
-" -u, --unloadable          Don't display images. Just print out their name\n"
-"                           if imlib2 can NOT successfully load them.\n"
-" -S, --sort SORT_TYPE      The file list may be sorted according to image\n"
-"                           parameters. Allowed sort types are: name,\n"
-"                           filename, width, height, pixels, size, format.\n"
-"                           For sort modes other than name or filename, a\n"
-"                           preload run will be necessary, causing a delay\n"
-"                           proportional to the number of images in the list\n"
-" -n, --reverse             Reverse the sort order. Use this to invert the order\n"
-"                           of the filelist. Eg to sort in reverse width order,\n"
-"                           use -nSwidth\n"
-" -A, --action ACTION       Specify a string as an action to perform on the\n"
-"                           image. In slideshow or multiwindow modes, the action\n"
-"                           in list mode, or loadable|unloadable modes, the\n"
-"                           action will be run for each file.\n"
-"                           The action will be executed by /bin/sh. Use\n"
-"                           format specifiers to refer to image info. See\n"
-"                           FORMAT SPECIFIERS for examples\n"
-"                           Eg. -A \"mv %%f ~/images/%%n\"\n"
-"                           In slideshow mode, the next image will be shown\n"
-"                           after running the command, in multiwindow mode,\n"
-"                           the window will be closed.\n"
-"     --action1 ACTION      These extra action options allow you to specify\n"
-"     --action2 ACTION      multiple additional actions which can be invoked\n"
-"     ...                   using the appropriate number key 1-9\n"
-"     --action9 ACTION\n"
-"     --draw-actions        Show the defined actions and what they do\n"
-" -m, --montage             Enable montage mode. Montage mode creates a new\n"
-"                           image consisting of a grid of thumbnails of the\n"
-"                           images specified using FILE... When montage mode\n"
-"                           is selected, certain other options become\n"
-"                           available. See MONTAGE MODE OPTIONS\n"
-" -c, --collage             Same as montage mode, but the thumbnails are\n"
-"                           distributed randomly. You must specify width and\n"
-"                           height or supply a background image or both\n"
-" -i, --index               Enable Index mode. Index mode is similar to\n"
-"                           montage mode, and accepts the same options. It\n"
-"                           creates an index print of thumbails, printing the\n"
-"                           images name beneath each thumbnail. Index mode\n"
-"                           enables certain other options, see INDEX MODE\n"
-"                           OPTIONS\n"
-" -t, --thumbnails          As --index, but clicking an image will open it in\n"
-"                           a new viewing window\n"
-"     --cache-thumbnails    Enable thumbnail caching for thumbnail mode.\n"
-"                           Only works with thumbnails <= 256x256 pixels\n"
-"     --thumb-redraw N      Redraw thumbnail window every N images\n"
-" -~, --thumb-title STRING  Set window title for images opened from thumbnail mode.\n"
-"                           Supports format specifiers, see there.\n"
-" -I, --fullindex           Same as index mode, but below each thumbnail you\n"
-"                           get image name, size and dimensions\n"
-"     --index-name BOOL     Show/Don't show filename in index/thumbnail mode\n"
-"     --index-size BOOL     Show/Don't show filesize in index/thumbnail mode\n"
-"     --index-dim BOOL      Show/Don't show dimensions in index/thumbnail mode\n"
-"     --bg-tile FILE        Set FILE as tiled desktop background. Feh can\n"
-"                           use enlightenment IPC if you are running it,\n"
-"                           or will fall back to X methods.\n"
-"                           Feh stores the commandline necessary to restore\n"
-"                           the background you chose in ~/.fehbg. So to have\n"
-"                           feh-set backgrounds restored when you restart X,\n"
-"                           add the line \"eval `cat $HOME/.fehbg`\" to your\n"
-"                           X startup script (e.g. ~/.xsession). Note that\n"
-"                           you only need to do this for non E window\n"
-"                           managers\n"
-"     --bg-center FILE      Set FILE as centered desktop background\n"
-"     --bg-scale FILE       Set FILE as scaled desktop background. This will\n"
-"                           fill the whole background, but the images' aspect\n"
-"                           ratio may not be preserved\n"
-"     --bg-fill FILE        Like --bg-scale, but preserves aspect ratio by\n"
-"                           zooming the image until it fits\n"
-"     --bg-seamless FILE    Like --bg-tile, but with blurry corners\n"
-" -C, --fontpath PATH       Specify an extra directory to look in for fonts,\n"
-"                           can be used multiple times to add multiple paths.\n"
-" -M, --menu-font FONT      Use FONT for the font in menus.\n"
-"     --menu-style FILE     Use FILE as the style descriptor for menu text.\n"
-" -), --menu-bg BG          Use BG for the background image in menus.\n"
-"     --menu-border INT     Specify number of pixels that define the menu\n"
-"                           background's border. Borders are not stretched\n"
-"                           when images are scaled.\n"
-" -B, --image-bg STYLE      Set background for transparent images and the like.\n"
-"                           Accepted values: white, black, default\n"
-" -N, --no-menus            Don't load or show any menus.\n"
-" -0, --reload-button B     Use button B to reload the image (defaults to 0)\n"
-" -1, --pan-button B        Use button B pan the image (hold button down, move\n"
-"                           the mouse to move the image around. Advancesto the\n"
-"                           next image when the mouse is not moved (defaults to\n"
-"                           1, usually the left button).\n"
-" -2, --zoom-button B       Use button B to zoom the current image in any\n"
-"                           mode (defaults to 2, usually the middle button).\n"
-" -3, --menu-button B       Use CTRL+Button B to activate the menu in any\n"
-"                           mode.  Set to 0 for any button.  This option\n"
-"                           is disabled if the -N or --no-menus option is set\n"
-"                           (defaults to 3, usually the right button).\n"
-"     --menu-ctrl-mask      Require CTRL+Button for menu activation in\n"
-"                           any mode (default=off).\n"
-" -4, --prev-button B       Use button B to switch to the previous image\n"
-"                           (defaults to 4, which usually is <mousewheel up>).\n"
-" -5, --next-button B       Use button B to switch to the next image\n"
-"                           (defaults to 5, which usually is <mousewheel down>).\n"
-" -8, --rotate-button B     Use CTRL+Button B to rotate the current image in\n"
-"                           any mode (default=2).\n"
-"     --no-rotate-ctrl-mask Don't require CTRL+Button for rotation in\n"
-"                           any mode -- just use the button (default=off).\n"
-" -9, --blur-button B       Use CTRL+Button B to blur the current image in\n"
-"                           any mode (default=1).\n"
-"     --no-blur-ctrl-mask   Don't require CTRL+Button for blurring in\n"
-"                           any mode -- just use the button (default=off).\n"
-"     --no-xinerama         Disable Xinerama support.  Only useful if\n"
-"                           you have Xinerama compiled in.\n"
-"     --no-screen-clip      Disable window clipping based on screen\n"
-"                           size.  WARNING: with this option disabled,\n"
-"                           image windows could become very large, making\n"
-"                           them unmanageable in certain window managers.\n"
-"     --hide-pointer        In full screen mode, hide the X mouse pointer.\n"
-" FORMAT SPECIFIERS\n"
-"                           %%f image path/filename\n"
-"                           %%n image name\n"
-"                           %%s image size (bytes)\n"
-"                           %%p image pixel size\n"
-"                           %%w image width\n"
-"                           %%h image height\n"
-"                           %%t image format\n"
-"                           %%P prints feh\n"
-"                           %%v prints the version\n"
-"                           %%m prints the mode (slideshow, multiwindow...)\n"
-"                           %%l prints the total number of files in the filelist\n"
-"                           %%u prints the current file number\n"
-"                           \\n prints a newline\n"
-"                           Eg. feh -A \"mv %%f ~/images/%%n\" *\n"
-" MONTAGE MODE OPTIONS\n"
-" -X, --ignore-aspect       By default, the montage thumbnails will retain\n"
-"                           their aspect ratios, while fitting in --thumb-width\n"
-"                           and --thumb-height. This option will force them to\n"
-"                           be the size set by --thumb-width and --thumb-height\n"
-"                           This will prevent any whitespace in the final\n"
-"                           montage\n"
-" -s, --stretch             Normally, if an image is smaller than the specified\n"
-"                           thumbnail size, it will not be enlarged. If this\n"
-"                           option is set, the image will be scaled up to fit\n"
-"                           the thumbnail size. (Aspect ratio will be maintained\n"
-"                           unless --ignore-aspect is specified)\n"
-" -y, --thumb-width NUM     Set thumbnail width in pixels\n"
-" -E, --thumb-height NUM    Set thumbnail height in pixels\n"
-"                           Thumbnails default to 20x20 pixels\n"
-" -W, --limit-width NUM     Limit the width of the montage in pixels\n"
-" -H, --limit-height NUM    Limit the height of the montage in pixels\n"
-"                           These options can be used together (to define the\n"
-"                           image size exactly), or separately. If only one is\n"
-"                           specified, theother is calculated from the number\n"
-"                           of files specified and the size of the thumbnails.\n"
-"                           The default is to limit width to 800 pixels and\n"
-"                           calculate the height\n"
-" -b, --bg FILE|trans       Use FILE as a background for your montage. With\n"
-"                           this option specified, the size of the montage will\n"
-"                           default to the size of FILE if no size restrictions\n"
-"                           are specified. Alternatively, if FILE is \"trans\",\n"
-"                           make the background transparent.\n"
-" -a, --alpha NUM           When drawing thumbnails onto the background, apply\n"
-"                           them with a transparency level of NUM (0-255).\n"
-" -o, --output FILE         Save the created montage to FILE\n"
-" -O, --output-only  FILE   Just save the created montage to FILE\n"
-"                           WITHOUT displaying it (use in scripts)\n"
-" -e, --font FONT           Use FONT to print the information under each\n"
-"                           thumbnail. FONT should be defined in the form\n"
-"                           fontname/size(points). eg -e myfont/12\n"
-" INDEX MODE OPTIONS\n"
-" -@, --title-font FONT     Use FONT to print a title on the index, if no\n"
-"                           font is specified, a title will not be printed\n"
-" SLIDESHOW KEYS\n"
-" The default mode for viewing mulitple images is Slideshow mode\n"
-" When viewing a slideshow, the following keys may be used:\n"
-" p, P, <BACKSPACE>, <LEFT>  Goto previous slide\n"
-" n, N, <SPACE>, <RIGHT>     Goto next slide\n"
-" r, R                       Reload image (good for webcams)\n"
-" v, V                       Toggle fullscreen\n"
-" m, M                       Show popup menu\n"
-" c, C                       Caption entry mode. If --caption-path has been\n"
-"                            specified, then this enables caption editing.\n"
-"                            The caption will turn yellow and be editable,\n"
-"                            hit enter to confirm and save the caption, or\n"
-"                            hit escape to cancel and revert the caption.\n"
-" w, W                       Size window to current image dimensions\n"
-" h, H                       Pause the slideshow (only useful when using\n"
-"                            timed reloading or image changes)\n"
-" z, Z                       Jump to a random position in the current filelist\n"
-" a, A                       Toggle action display (--draw-actions)\n"
-" d, D                       Toggle filename display (--draw-filename)\n"
-" s, S                       Save current image to unique filename\n"
-" f, F                       Save current filelist to unique filename\n"
-" <, >                       In place editing, rotate 90 degrees right/left\n"
-" <HOME>                     Goto first slide\n"
-" <END>                      Goto last slide\n"
-" <ESCAPE>                   Quit the slideshow\n"
-" +, =                       Increase reload delay\n"
-" -, _                       Decrease reload delay\n"
-" <DELETE>                   Remove the currently viewed file from the filelist\n"
-" <CTRL+DELETE>              Delete the currently viewed file and remove it\n"
-"                            from the filelist\n"
-" x, X                       Close current window\n"
-" q, Q                       Quit the slideshow\n"
-" <KEYPAD LEFT>              Move the image to the left\n"
-" <KEYPAD RIGHT>             Move the image to the right\n"
-" <KEYPAD UP>                Move the image up\n"
-" <KEYPAD DOWN>              Move the image down\n"
-" <KEYPAD BEGIN>             Antialias the image\n"
-" <KEYPAD +>                 Zoom in\n"
-" <KEYPAD ->                 Zoom out\n"
-" <KEYPAD *>                 Zoom to 100%%\n"
-" <KEYPAD />                 Zoom to fit the window\n"
-" <ENTER>,0                  Run action specified by --action option\n"
-" 1-9                        Run action 1-9 specified by --action[1-9] options\n"
-"\n"
-" MOUSE ACTIONS\n"
-" When viewing an image, a click of mouse button 1 moves to the next image\n"
-" (slideshow mode only), a drag of mouse button 1 pans the image, if the\n"
-" viewable window is smaller than the image, button 2 zooms (click and drag\n"
-" left->right to zoom in, right->left to zoom out, click once to restore\n"
-" 1x zoom), and mouse button 3 pans.\n"
-" Ctrl+button 1 blurs or sharpens the image (drag left to blur and right to\n"
-" sharpen).  Ctrl+button 2 rotates the image around the center point.\n"
-" Button 3 activates the context-sensitive menu.  Buttons can be redefined\n"
-" with the -1 through -9 (or --*-button) cmdline flags.  All you people\n"
-" with million button mice can remove the ctrl mask with the --no-*-ctrl-mask\n"
-" options.\n" "\n"
-"See 'man feh' for more detailed information\n" "\n"
-"This program is free software see the file COPYING for licensing info.\n"
-"Copyright Tom Gilbert (and various contributors) 1999-2003\n"
-"Email bugs to <derf@chaosdorf.de>\n");
+	fputs(
+#include "help.inc"
+	, stdout);
 	exit(0);
 }
 
@@ -1187,85 +861,9 @@ static void feh_create_default_config(char *rcfile)
 		return;
 	}
 
-	fprintf(fp,
-"# Feh configuration file.\n"
-"# Lines starting with # are comments. Don't use comments mid-line.\n"
-"\n"
-"# Feh expects to find this as ~/.fehrc or /etc/fehrc\n"
-"# If both are available, ~/.fehrc will be used\n"
-"\n"
-"# Options are defined in theme_name/options pairs.\n"
-"# Separate themename and options by whitespace.\n"
-"\n"
-"# There are two ways of specifying the theme. Either use feh -Tthemename,\n"
-"# or use a symbolic link to feh with the name of the theme. eg\n"
-"# ln -s `which feh` ~/bin/mkindex\n"
-"# Now when you run 'mkindex', feh will load the config specified for the\n"
-"# mkindex theme.\n"
-"\n"
-"# ======================\n"
-"# Some examples of usage\n"
-"# ======================\n"
-"\n"
-"# Set the default feh options to be recursive and verbose\n"
-"# feh -rV\n"
-"\n"
-"# Multiple options can of course be used. If they are not in one line,\n"
-"# the lines after the theme name must start with a tab character. Like:\n"
-"# imagemap -rV --quiet -W 400 -H 300 \\\n"
-"#          --thumb-width 40 --thumb-height 30\n"
-"\n"
-"# ====================\n"
-"# A few default themes\n"
-"# ====================\n"
-"\n"
-"# Webcam mode, simply specify the url(s).\n"
-"# e.g. feh -Twebcam http://cam1 http://cam2\n"
-"webcam --multiwindow --reload 20\n"
-"\n"
-"# Create an index of the current directory. This version uses . as the\n"
-"# current dir, so you don't even need any commandline arguments.\n"
-"mkindex -iVO index.jpg .\n"
-"\n"
-"# More ambitious version...\n"
-"imgidx -iVO .fehindex.jpg --limit-width 1200 --thumb-width 90 --thumb-height 90 .\n"
-"\n"
-"# Show a presentation\n"
-"present --full-screen --sort name\n"
-"\n"
-"# Booth mode ;-)\n"
-"booth --full-screen --hide-pointer --slideshow-delay 20\n"
-"\n"
-"# Screw xscreensaver, use feh =)\n"
-"screensave --full-screen --randomize --slideshow-delay 5\n"
-"\n"
-"# Add <img> tags to your html with ease :-)\n"
-"newimg -q -L \"<img src=\\\"%%f\\\" alt=\\\"%%n\\\" border=\\\"0\\\" "
-"width=\\\"%%w\\\" height=\\\"%%h\\\">\"\n"
-"\n"
-"# Different menus\n"
-"chrome --menu-bg "
-PREFIX "/share/feh/images/menubg_chrome.png\n"
-"brushed --menu-bg "
-PREFIX "/share/feh/images/menubg_brushed.png\n"
-"pastel --menu-bg "
-PREFIX "/share/feh/images/menubg_pastel.png\n"
-"aluminium --menu-bg "
-PREFIX "/share/feh/images/menubg_aluminium.png\n"
-"wood --menu-bg "
-PREFIX "/share/feh/images/menubg_wood.png\n"
-"aqua --menu-bg "
-PREFIX "/share/feh/images/menubg_aqua.png\n"
-"sky --menu-bg "
-PREFIX "/share/feh/images/menubg_sky.png\n"
-"orange --menu-bg "
-PREFIX "/share/feh/images/menubg_orange.png\n"
-"light --menu-bg "
-PREFIX "/share/feh/images/menubg_light.png\n"
-"black --menu-bg "
-PREFIX "/share/feh/images/menubg_black.png"
-" --menu-style "
-PREFIX "/share/feh/fonts/black.style\n");
+	fputs(
+#include "fehrc.inc"
+	, fp);
 	fclose(fp);
 
 	return;
-- 
GitLab