Move header into include directory

This commit is contained in:
Nathan Fisher 2023-07-19 23:42:04 -04:00
parent c778d72b74
commit 1df8da23e5
4 changed files with 102 additions and 98 deletions

2
.gitignore vendored Normal file
View file

@ -0,0 +1,2 @@
haggis
config.mk

View file

@ -30,6 +30,8 @@
# other than his own.
#
-include config.mk
progname = haggis;
srcs += src/haggis.c
hdrs += include/haggis.h

View file

@ -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 <stdint.h>
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

View file

@ -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 <stdint.h>
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