From 1df8da23e538e61ad7882310450f7ea9a2f47f35 Mon Sep 17 00:00:00 2001 From: Nathan Fisher Date: Wed, 19 Jul 2023 23:42:04 -0400 Subject: [PATCH] Move header into `include` directory --- .gitignore | 2 + Makefile | 2 + include/haggis.h | 98 ++++++++++++++++++++++++++++++++++++++++++++++++ src/haggis.h | 98 ------------------------------------------------ 4 files changed, 102 insertions(+), 98 deletions(-) create mode 100644 .gitignore delete mode 100644 src/haggis.h diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..fe83777 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +haggis +config.mk diff --git a/Makefile b/Makefile index 9fbb8f6..e2a5e9f 100644 --- a/Makefile +++ b/Makefile @@ -30,6 +30,8 @@ # other than his own. # +-include config.mk + progname = haggis; srcs += src/haggis.c hdrs += include/haggis.h diff --git a/include/haggis.h b/include/haggis.h index e69de29..3a26776 100644 --- a/include/haggis.h +++ b/include/haggis.h @@ -0,0 +1,98 @@ +/* _,.---._ .-._ .--.-. ,--.--------. + * _,..---._ ,-.' , - `. /==/ \ .-._/==/ //==/, - , -\ + * /==/, - \ /==/_, , - \|==|, \/ /, |==\ -\\==\.-. - ,-./ + * |==| _ _\==| .=. |==|- \| | \==\- \`--`\==\- \ + * |==| .=. |==|_ : ;=: - |==| , | -| `--`-' \==\_ \ + * |==|,| | -|==| , '=' |==| - _ | |==|- | + * |==| '=' /\==\ - ,_ /|==| /\ , | |==|, | + * |==|-, _`/ '.='. - .' /==/, | |- | /==/ -/ + * `-.`.____.' `--`--'' `--`./ `--` `--`--` + * _ __ ,---. .-._ .=-.-. _,.----. + * .-`.' ,`..--.' \ /==/ \ .-._ /==/_ /.' .' - \ + * /==/, - \==\-/\ \ |==|, \/ /, /==|, |/==/ , ,-' + * |==| _ .=. /==/-|_\ | |==|- \| ||==| ||==|- | . + * |==| , '=',\==\, - \ |==| , | -||==|- ||==|_ `-' \ + * |==|- '..'/==/ - ,| |==| - _ ||==| ,||==| _ , | + * |==|, | /==/- /\ - \|==| /\ , ||==|- |\==\. / + * /==/ - | \==\ _.\=\.-'/==/, | |- |/==/. / `-.`.___.-' + * `--`---' `--` `--`./ `--``--`-` + * + * @(#)Copyright (c) 2023, Nathan D. Fisher. + * + * This is free software. It comes with NO WARRANTY. + * Permission to use, modify and distribute this source code + * is granted subject to the following conditions. + * 1/ that the above copyright notice and this notice + * are preserved in all copies and that due credit be given + * to the author. + * 2/ that any changes to this code are clearly commented + * as such so that the author does not get blamed for bugs + * other than his own. +*/ + +#ifndef HAGGIS_H +#define HAGGIS_H + +#include + +struct haggis_device { + uint32_t major; + uint32_t minor; +}; + +enum haggis_algorithm { + md5, + sha1, + sha256, + skip, +}; + +union haggis_sum { + char md5[16]; + char sha1[20]; + char sha256[32]; +}; + +struct haggis_checksum { + enum haggis_algorithm tag; + union haggis_sum *sum; +}; + +struct haggis_normal { + uint64_t len; + struct haggis_checksum *cksum; + unsigned char *data[]; +}; + +enum haggis_typeflag { + normal, + hardlink, + softlink, + directory, + character, + block, + fifo, + eof, +}; + +union haggis_ft { + struct haggis_normal *file; + char target[4096]; + struct haggis_device *dev; +}; + +struct haggis_filetype { + enum haggis_typeflag tag; + union haggis_ft *f_type; +}; + +struct haggis_node { + uint32_t uid; + uint32_t gid; + uint64_t mtime; + uint16_t mode; + struct haggis_filetype *filetype; + char *name[]; +}; + +#endif // !HAGGIS_H diff --git a/src/haggis.h b/src/haggis.h deleted file mode 100644 index 3a26776..0000000 --- a/src/haggis.h +++ /dev/null @@ -1,98 +0,0 @@ -/* _,.---._ .-._ .--.-. ,--.--------. - * _,..---._ ,-.' , - `. /==/ \ .-._/==/ //==/, - , -\ - * /==/, - \ /==/_, , - \|==|, \/ /, |==\ -\\==\.-. - ,-./ - * |==| _ _\==| .=. |==|- \| | \==\- \`--`\==\- \ - * |==| .=. |==|_ : ;=: - |==| , | -| `--`-' \==\_ \ - * |==|,| | -|==| , '=' |==| - _ | |==|- | - * |==| '=' /\==\ - ,_ /|==| /\ , | |==|, | - * |==|-, _`/ '.='. - .' /==/, | |- | /==/ -/ - * `-.`.____.' `--`--'' `--`./ `--` `--`--` - * _ __ ,---. .-._ .=-.-. _,.----. - * .-`.' ,`..--.' \ /==/ \ .-._ /==/_ /.' .' - \ - * /==/, - \==\-/\ \ |==|, \/ /, /==|, |/==/ , ,-' - * |==| _ .=. /==/-|_\ | |==|- \| ||==| ||==|- | . - * |==| , '=',\==\, - \ |==| , | -||==|- ||==|_ `-' \ - * |==|- '..'/==/ - ,| |==| - _ ||==| ,||==| _ , | - * |==|, | /==/- /\ - \|==| /\ , ||==|- |\==\. / - * /==/ - | \==\ _.\=\.-'/==/, | |- |/==/. / `-.`.___.-' - * `--`---' `--` `--`./ `--``--`-` - * - * @(#)Copyright (c) 2023, Nathan D. Fisher. - * - * This is free software. It comes with NO WARRANTY. - * Permission to use, modify and distribute this source code - * is granted subject to the following conditions. - * 1/ that the above copyright notice and this notice - * are preserved in all copies and that due credit be given - * to the author. - * 2/ that any changes to this code are clearly commented - * as such so that the author does not get blamed for bugs - * other than his own. -*/ - -#ifndef HAGGIS_H -#define HAGGIS_H - -#include - -struct haggis_device { - uint32_t major; - uint32_t minor; -}; - -enum haggis_algorithm { - md5, - sha1, - sha256, - skip, -}; - -union haggis_sum { - char md5[16]; - char sha1[20]; - char sha256[32]; -}; - -struct haggis_checksum { - enum haggis_algorithm tag; - union haggis_sum *sum; -}; - -struct haggis_normal { - uint64_t len; - struct haggis_checksum *cksum; - unsigned char *data[]; -}; - -enum haggis_typeflag { - normal, - hardlink, - softlink, - directory, - character, - block, - fifo, - eof, -}; - -union haggis_ft { - struct haggis_normal *file; - char target[4096]; - struct haggis_device *dev; -}; - -struct haggis_filetype { - enum haggis_typeflag tag; - union haggis_ft *f_type; -}; - -struct haggis_node { - uint32_t uid; - uint32_t gid; - uint64_t mtime; - uint16_t mode; - struct haggis_filetype *filetype; - char *name[]; -}; - -#endif // !HAGGIS_H