tSimplify DOWNLOAD macro - surf - customized build of surf, the suckless webkit browser
 (HTM) git clone git://src.adamsgaard.dk/surf
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) README
 (DIR) LICENSE
       ---
 (DIR) commit dca42648635b70f7d01adb8d9a53720a0c7909c1
 (DIR) parent 654d527f87e59c6c9f507402878bed62398c4e61
 (HTM) Author: Quentin Rameau <quinq@fifth.space>
       Date:   Thu,  4 May 2017 18:24:33 +0200
       
       Simplify DOWNLOAD macro
       
       No need to spawn an extra sh.
       Use short flags for curl and quote operands.
       Replace sleep with read, let the user close the download window instead
       of waiting for an arbitrary time.
       Rename d to reflect what it's used for.
       Reorder sh positional arguments.
       Set $0 to a command name and shift other positional parameters to
       clarify the "sh -c" command.
       
       Diffstat:
         M config.def.h                        |      11 +++++------
       
       1 file changed, 5 insertions(+), 6 deletions(-)
       ---
 (DIR) diff --git a/config.def.h b/config.def.h
       t@@ -61,12 +61,11 @@ static WebKitFindOptions findopts = WEBKIT_FIND_OPTIONS_CASE_INSENSITIVE |
        }
        
        /* DOWNLOAD(URI, referer) */
       -#define DOWNLOAD(d, r) { \
       -        .v = (const char *[]){ "/bin/sh", "-c", \
       -             "st -e /bin/sh -c \"curl -g -L -J -O --user-agent '$1'" \
       -             " --referer '$2' -b $3 -c $3 '$0';" \
       -             " sleep 5;\"", \
       -             d, useragent, r, cookiefile, NULL \
       +#define DOWNLOAD(u, r) { \
       +        .v = (const char *[]){ "st", "-e", "/bin/sh", "-c",\
       +             "curl -g -L -J -O -A \"$1\" -b \"$2\" -c \"$2\"" \
       +             " -e \"$3\" \"$4\"; read", \
       +             "surf-download", useragent, cookiefile, r, u, NULL \
                } \
        }