Move filetype struct array declaration to separate filetypes.h. - geomyidae - A small C-based gopherd.
 (HTM) git clone git://bitreich.org/geomyidae/ git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws65d7roiv6bfj7d652fid.onion/geomyidae/
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) Tags
 (DIR) README
 (DIR) LICENSE
       ---
 (DIR) commit dc4e34b09a5e881e4e889c5e1b71b6c2d029968d
 (DIR) parent b8e888a23c8a70957942fb52d0afb95b102ef72a
 (HTM) Author: Christoph Lohmann <20h@r-36.net>
       Date:   Sat, 23 Oct 2021 16:52:30 +0200
       
       Move filetype struct array declaration to separate filetypes.h.
       
       This makes it more obvious where to add new filetype handling behaviour.
       
       Diffstat:
         A filetypes.h                         |      42 +++++++++++++++++++++++++++++++
         M ind.c                               |      26 +-------------------------
       
       2 files changed, 43 insertions(+), 25 deletions(-)
       ---
 (DIR) diff --git a/filetypes.h b/filetypes.h
       @@ -0,0 +1,42 @@
       +/*
       + * Copy me if you can.
       + * by 20h
       + */
       +
       +#ifndef FILETYPES_H
       +#define FILETYPES_H
       +
       +#include "ind.h"
       +
       +/*
       + * Before adding any filetype, see the comment in ind.c.
       + */
       +
       +filetype type[] = {
       +        {"default", "9", handlebin},
       +        {"gph", "1", handlegph},
       +        {"cgi", "0", handlecgi},
       +        {"dcgi", "1", handledcgi},
       +        {"bin", "9", handlebin},
       +        {"tgz", "9", handlebin},
       +        {"gz", "9", handlebin},
       +        {"jpg", "I", handlebin},
       +        {"gif", "g", handlebin},
       +        {"png", "I", handlebin},
       +        {"bmp", "I", handlebin},
       +        {"txt", "0", handlebin},
       +        {"vtt", "0", handlebin},
       +        {"html", "0", handlebin},
       +        {"htm", "0", handlebin},
       +        {"xhtml", "0", handlebin},
       +        {"css", "0", handlebin},
       +        {"md", "0", handlebin},
       +        {"c", "0", handlebin},
       +        {"sh", "0", handlebin},
       +        {"patch", "0", handlebin},
       +        {"meme", "0", handlebin},
       +        {NULL, NULL, NULL},
       +};
       +
       +#endif
       +
 (DIR) diff --git a/ind.c b/ind.c
       @@ -39,31 +39,7 @@
         * to be handled, if really used.
         */
        
       -filetype type[] = {
       -        {"default", "9", handlebin},
       -        {"gph", "1", handlegph},
       -        {"cgi", "0", handlecgi},
       -        {"dcgi", "1", handledcgi},
       -        {"bin", "9", handlebin},
       -        {"tgz", "9", handlebin},
       -        {"gz", "9", handlebin},
       -        {"jpg", "I", handlebin},
       -        {"gif", "g", handlebin},
       -        {"png", "I", handlebin},
       -        {"bmp", "I", handlebin},
       -        {"txt", "0", handlebin},
       -        {"vtt", "0", handlebin},
       -        {"html", "0", handlebin},
       -        {"htm", "0", handlebin},
       -        {"xhtml", "0", handlebin},
       -        {"css", "0", handlebin},
       -        {"md", "0", handlebin},
       -        {"c", "0", handlebin},
       -        {"sh", "0", handlebin},
       -        {"patch", "0", handlebin},
       -        {"meme", "0", handlebin},
       -        {NULL, NULL, NULL},
       -};
       +#include "filetypes.h"
        
        int
        pendingbytes(int sock)