t* sacc + cursorline and uri preview
       
   URI git clone git://git.codevoid.de/sacc-sdk
   DIR Log
   DIR Files
   DIR Refs
   DIR LICENSE
       ---
   DIR commit 01e24f0999841a8cdfa99027e2be90963742cef0
   DIR parent 5f2e561edb8bf36c8a19ec32e0a83abde936be34
   URI Author: Quentin Rameau <quinq@fifth.space>
       Date:   Fri, 30 Jun 2017 17:15:27 +0200
       
       Add setup() and cleanup(), and ui-specific equivalent
       
       Diffstat:
         M common.h                            |       2 ++
         M sacc.c                              |      32 ++++++++++++++++++++++---------
         M ui_txt.c                            |       5 +++++
       
       3 files changed, 30 insertions(+), 9 deletions(-)
       ---
   DIR diff --git a/common.h b/common.h
       t@@ -22,3 +22,5 @@ void die(const char *fmt, ...);
        void display(Item *item);
        Item *selectitem(Item *entry);
        const char *typedisplay(char t);
       +void uicleanup(void);
       +void uisetup(void);
   DIR diff --git a/sacc.c b/sacc.c
       t@@ -12,6 +12,9 @@
        
        #include "common.h"
        
       +static char *mainurl;
       +static Item *mainentry;
       +
        void
        die(const char *fmt, ...)
        {
       t@@ -409,22 +412,33 @@ moldentry(char *url)
                return entry;
        }
        
       +static void
       +cleanup(void)
       +{
       +        free(mainentry); /* TODO free all tree recursively */
       +        free(mainurl);
       +        uicleanup();
       +}
       +
       +static void
       +setup(void)
       +{
       +        atexit(cleanup);
       +        uisetup();
       +}
       +
        int
        main(int argc, char *argv[])
        {
       -        Item *entry;
       -        char *url;
       -
                if (argc != 2)
                        usage();
        
       -        url = xstrdup(argv[1]);
       +        setup();
        
       -        entry = moldentry(url);
       -        delve(entry);
       +        mainurl = xstrdup(argv[1]);
        
       -        free(entry); /* TODO free all tree recursively */
       -        free(url);
       +        mainentry = moldentry(mainurl);
       +        delve(mainentry);
        
       -        return 0;
       +        exit(0);
        }
   DIR diff --git a/ui_txt.c b/ui_txt.c
       t@@ -8,6 +8,11 @@
        #include "common.h"
        
        void
       +uisetup(void) { return; }
       +void
       +uicleanup(void) { return; }
       +
       +void
        help(void)
        {
                puts("Commands:\n"