From c778d72b7439b4bcb19dc71bacbcda4a947bd0a0 Mon Sep 17 00:00:00 2001 From: Nathan Fisher Date: Wed, 19 Jul 2023 22:38:59 -0400 Subject: [PATCH] Initial commit --- .clang-format | 225 +++++++++++++++++++++++++++++++++++++++++++++++ Makefile | 47 ++++++++++ include/haggis.h | 0 src/haggis | Bin 0 -> 14824 bytes src/haggis.c | 39 ++++++++ src/haggis.h | 98 +++++++++++++++++++++ 6 files changed, 409 insertions(+) create mode 100644 .clang-format create mode 100644 Makefile create mode 100644 include/haggis.h create mode 100755 src/haggis create mode 100644 src/haggis.c create mode 100644 src/haggis.h diff --git a/.clang-format b/.clang-format new file mode 100644 index 0000000..17ad277 --- /dev/null +++ b/.clang-format @@ -0,0 +1,225 @@ +--- +Language: Cpp +# BasedOnStyle: LLVM +AccessModifierOffset: -2 +AlignAfterOpenBracket: Align +AlignArrayOfStructures: None +AlignConsecutiveAssignments: + Enabled: false + AcrossEmptyLines: false + AcrossComments: false + AlignCompound: false + PadOperators: true +AlignConsecutiveBitFields: + Enabled: false + AcrossEmptyLines: false + AcrossComments: false + AlignCompound: false + PadOperators: false +AlignConsecutiveDeclarations: + Enabled: false + AcrossEmptyLines: false + AcrossComments: false + AlignCompound: false + PadOperators: false +AlignConsecutiveMacros: + Enabled: false + AcrossEmptyLines: false + AcrossComments: false + AlignCompound: false + PadOperators: false +AlignEscapedNewlines: Right +AlignOperands: Align +AlignTrailingComments: + Kind: Always + OverEmptyLines: 0 +AllowAllArgumentsOnNextLine: true +AllowAllParametersOfDeclarationOnNextLine: true +AllowShortBlocksOnASingleLine: Never +AllowShortCaseLabelsOnASingleLine: false +AllowShortEnumsOnASingleLine: true +AllowShortFunctionsOnASingleLine: All +AllowShortIfStatementsOnASingleLine: Never +AllowShortLambdasOnASingleLine: All +AllowShortLoopsOnASingleLine: false +AlwaysBreakAfterDefinitionReturnType: None +AlwaysBreakAfterReturnType: None +AlwaysBreakBeforeMultilineStrings: false +AlwaysBreakTemplateDeclarations: MultiLine +AttributeMacros: + - __capability +BinPackArguments: true +BinPackParameters: true +BitFieldColonSpacing: Both +BraceWrapping: + AfterCaseLabel: false + AfterClass: false + AfterControlStatement: Never + AfterEnum: false + AfterExternBlock: false + AfterFunction: false + AfterNamespace: false + AfterObjCDeclaration: false + AfterStruct: false + AfterUnion: false + BeforeCatch: false + BeforeElse: false + BeforeLambdaBody: false + BeforeWhile: false + IndentBraces: false + SplitEmptyFunction: true + SplitEmptyRecord: true + SplitEmptyNamespace: true +BreakAfterAttributes: Never +BreakAfterJavaFieldAnnotations: false +BreakArrays: true +BreakBeforeBinaryOperators: None +BreakBeforeConceptDeclarations: Always +BreakBeforeBraces: Attach +BreakBeforeInlineASMColon: OnlyMultiline +BreakBeforeTernaryOperators: true +BreakConstructorInitializers: BeforeColon +BreakInheritanceList: BeforeColon +BreakStringLiterals: true +ColumnLimit: 80 +CommentPragmas: '^ IWYU pragma:' +CompactNamespaces: false +ConstructorInitializerIndentWidth: 4 +ContinuationIndentWidth: 4 +Cpp11BracedListStyle: true +DerivePointerAlignment: false +DisableFormat: false +EmptyLineAfterAccessModifier: Never +EmptyLineBeforeAccessModifier: LogicalBlock +ExperimentalAutoDetectBinPacking: false +FixNamespaceComments: true +ForEachMacros: + - foreach + - Q_FOREACH + - BOOST_FOREACH +IfMacros: + - KJ_IF_MAYBE +IncludeBlocks: Preserve +IncludeCategories: + - Regex: '^"(llvm|llvm-c|clang|clang-c)/' + Priority: 2 + SortPriority: 0 + CaseSensitive: false + - Regex: '^(<|"(gtest|gmock|isl|json)/)' + Priority: 3 + SortPriority: 0 + CaseSensitive: false + - Regex: '.*' + Priority: 1 + SortPriority: 0 + CaseSensitive: false +IncludeIsMainRegex: '(Test)?$' +IncludeIsMainSourceRegex: '' +IndentAccessModifiers: false +IndentCaseBlocks: false +IndentCaseLabels: false +IndentExternBlock: AfterExternBlock +IndentGotoLabels: true +IndentPPDirectives: None +IndentRequiresClause: true +IndentWidth: 4 +IndentWrappedFunctionNames: false +InsertBraces: false +InsertNewlineAtEOF: false +InsertTrailingCommas: None +IntegerLiteralSeparator: + Binary: 0 + BinaryMinDigits: 0 + Decimal: 0 + DecimalMinDigits: 0 + Hex: 0 + HexMinDigits: 0 +JavaScriptQuotes: Leave +JavaScriptWrapImports: true +KeepEmptyLinesAtTheStartOfBlocks: true +LambdaBodyIndentation: Signature +LineEnding: DeriveLF +MacroBlockBegin: '' +MacroBlockEnd: '' +MaxEmptyLinesToKeep: 1 +NamespaceIndentation: None +ObjCBinPackProtocolList: Auto +ObjCBlockIndentWidth: 2 +ObjCBreakBeforeNestedBlockParam: true +ObjCSpaceAfterProperty: false +ObjCSpaceBeforeProtocolList: true +PackConstructorInitializers: BinPack +PenaltyBreakAssignment: 2 +PenaltyBreakBeforeFirstCallParameter: 19 +PenaltyBreakComment: 300 +PenaltyBreakFirstLessLess: 120 +PenaltyBreakOpenParenthesis: 0 +PenaltyBreakString: 1000 +PenaltyBreakTemplateDeclaration: 10 +PenaltyExcessCharacter: 1000000 +PenaltyIndentedWhitespace: 0 +PenaltyReturnTypeOnItsOwnLine: 60 +PointerAlignment: Right +PPIndentWidth: -1 +QualifierAlignment: Leave +ReferenceAlignment: Pointer +ReflowComments: true +RemoveBracesLLVM: false +RemoveSemicolon: false +RequiresClausePosition: OwnLine +RequiresExpressionIndentation: OuterScope +SeparateDefinitionBlocks: Leave +ShortNamespaceLines: 1 +SortIncludes: CaseSensitive +SortJavaStaticImport: Before +SortUsingDeclarations: LexicographicNumeric +SpaceAfterCStyleCast: false +SpaceAfterLogicalNot: false +SpaceAfterTemplateKeyword: true +SpaceAroundPointerQualifiers: Default +SpaceBeforeAssignmentOperators: true +SpaceBeforeCaseColon: false +SpaceBeforeCpp11BracedList: false +SpaceBeforeCtorInitializerColon: true +SpaceBeforeInheritanceColon: true +SpaceBeforeParens: ControlStatements +SpaceBeforeParensOptions: + AfterControlStatements: true + AfterForeachMacros: true + AfterFunctionDefinitionName: false + AfterFunctionDeclarationName: false + AfterIfMacros: true + AfterOverloadedOperator: false + AfterRequiresInClause: false + AfterRequiresInExpression: false + BeforeNonEmptyParentheses: false +SpaceBeforeRangeBasedForLoopColon: true +SpaceBeforeSquareBrackets: false +SpaceInEmptyBlock: false +SpaceInEmptyParentheses: false +SpacesBeforeTrailingComments: 1 +SpacesInAngles: Never +SpacesInConditionalStatement: false +SpacesInContainerLiterals: true +SpacesInCStyleCastParentheses: false +SpacesInLineCommentPrefix: + Minimum: 1 + Maximum: -1 +SpacesInParentheses: false +SpacesInSquareBrackets: false +Standard: Latest +StatementAttributeLikeMacros: + - Q_EMIT +StatementMacros: + - Q_UNUSED + - QT_REQUIRE_VERSION +TabWidth: 4 +UseTab: Never +WhitespaceSensitiveMacros: + - BOOST_PP_STRINGIZE + - CF_SWIFT_NAME + - NS_SWIFT_NAME + - PP_STRINGIZE + - STRINGIZE +... + diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..9fbb8f6 --- /dev/null +++ b/Makefile @@ -0,0 +1,47 @@ +# _,.---._ .-._ .--.-. ,--.--------. +# _,..---._ ,-.' , - `. /==/ \ .-._/==/ //==/, - , -\ +# /==/, - \ /==/_, , - \|==|, \/ /, |==\ -\\==\.-. - ,-./ +# |==| _ _\==| .=. |==|- \| | \==\- \`--`\==\- \ +# |==| .=. |==|_ : ;=: - |==| , | -| `--`-' \==\_ \ +# |==|,| | -|==| , '=' |==| - _ | |==|- | +# |==| '=' /\==\ - ,_ /|==| /\ , | |==|, | +# |==|-, _`/ '.='. - .' /==/, | |- | /==/ -/ +# `-.`.____.' `--`--'' `--`./ `--` `--`--` +# _ __ ,---. .-._ .=-.-. _,.----. +# .-`.' ,`..--.' \ /==/ \ .-._ /==/_ /.' .' - \ +# /==/, - \==\-/\ \ |==|, \/ /, /==|, |/==/ , ,-' +# |==| _ .=. /==/-|_\ | |==|- \| ||==| ||==|- | . +# |==| , '=',\==\, - \ |==| , | -||==|- ||==|_ `-' \ +# |==|- '..'/==/ - ,| |==| - _ ||==| ,||==| _ , | +# |==|, | /==/- /\ - \|==| /\ , ||==|- |\==\. / +# /==/ - | \==\ _.\=\.-'/==/, | |- |/==/. / `-.`.___.-' +# `--`---' `--` `--`./ `--``--`-` +# +# @(#)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. +# + +progname = haggis; +srcs += src/haggis.c +hdrs += include/haggis.h + +cflags += -Iinclude + +all: haggis + +haggis: $(srcs) $(hdrs) + $(CC) $(cflags) -o $@ $< + +clean: + rm -rf $(progname) + +.PHONY: all clean diff --git a/include/haggis.h b/include/haggis.h new file mode 100644 index 0000000..e69de29 diff --git a/src/haggis b/src/haggis new file mode 100755 index 0000000000000000000000000000000000000000..2162f3ba71f700c20b8c0a136653259f609ecf2c GIT binary patch literal 14824 zcmd5@3wTu3oj-T(+&hz*ydXdl9x@21v@jtENCAOBuoH|m=7Ff-Wipv0qhThUnLuz? zK_gwW$QDai-G_p@-_~{6t@~(;b=6Q>pY4`!`>k55+kX2kU!mA-Yga|>Hv9XZd;WKB zZYGG|KE6Hq=A8fg|38m=&*Pr#+1PxQPt!_-NDQjY!HmnG5mwVg;aBCsv3s z^7&$}FoF9e&E~HY5eabF>$B-x25nU6C`s>e#eduvksL0kN=yhYDJDu(l3pQ26lj-! zYS<{3qSD4mk61?(pXy$q(xjkD?<-4d|J}%B9WE@GE5iLruS+z^E5s`c@r$|f) zF1hWmgPt;_BrdEVefo{4ejic&&Ly`Cm+Y^uFV&eGOeX63x)vq-x}&*Fw4OXt{Yi%E zb5%B(T;J9xe)U$BLnj{70XlSY@1_&4SfYAQF2a~G0e$`i^iP2v!Oxr4fKbdn)n}5Z z5jCqKQic1OhQ%Z?%^6Qj7s4n1G~}B4+Xz`T{Kb=(-4-C3Yo#^2y{P}l&vc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G*Uj^DWbVv=-ZH8(rj<<71c)1edJI$$#6|c?j2-dtE#qUYEM0Gi)$ZHDDK!zVz0ap zilroc@K(L}9#w8F?aiP2z+=p=(6cXfU7xiYZ}?opHBB1|dqNrjRth6PDOpy5LK{iB zke4@Y<<{B0Zj1Z4$wDtXnq#SswmcrdbzQY{mV0J8F>pvy(xO4-k#Uivj2w4Xk;}g5 zkHX$o-TW=`RDE(19z#Jt>{Ddo|1;qKKbWfMT#&3g(Z>_IL&y3fzKCRxC_+qPh0Hr` z)8{JsY{U9||1PN8IwN)=Cv)=6^8h}4%QOQyw#|H#L-75$7nQ!fTgBHECC`4iybN@@ zOUF3hr+Zx~M3f%+CI8;|uK?{mm;O0D0t(#&l!e^q62$&Few&N^DgauFuz$WUI8!-_ zDM8j}|6G0+eB!Y_-%phP^Z@!6rO$=8|E>jtY^_%UBmRhlMwEj=MJFHC_;LK){x^U| zHfh~LiEpT`Q0ptY)#^^{pUXIy1atiS{}s(jpZ5Rm#Pw!c27p_CyAhGB?Mk1PgYLxf zGi^5j(&zi1Jf9w6eQtQAz~hPa_jvSqx%#GZMBg3V$s7MZFx~!ndHePS>eD*RtuJaL zwmW(-k+#dcka^=j2o~vcHF;gg|1aZ}_qN{y9(`V)_ACD%r~j}=pVzB=; z)W#e?-><#r0`=VlI^&FTo;FUc!fxf05{A*P|D)n)`el>x93vIlRPTGZ&d;QZ!j%bS=2^)x9WS2)K zh@b6*02I?7nPcl8_1I-SF6C!_j|`#x7u&=wEU09>{T~6}BO)bVoNFum&ByfL!U^?@2 Ni`x3HdK5gU_%CJ>nZW=6 literal 0 HcmV?d00001 diff --git a/src/haggis.c b/src/haggis.c new file mode 100644 index 0000000..a142dad --- /dev/null +++ b/src/haggis.c @@ -0,0 +1,39 @@ +/* _,.---._ .-._ .--.-. ,--.--------. + * _,..---._ ,-.' , - `. /==/ \ .-._/==/ //==/, - , -\ + * /==/, - \ /==/_, , - \|==|, \/ /, |==\ -\\==\.-. - ,-./ + * |==| _ _\==| .=. |==|- \| | \==\- \`--`\==\- \ + * |==| .=. |==|_ : ;=: - |==| , | -| `--`-' \==\_ \ + * |==|,| | -|==| , '=' |==| - _ | |==|- | + * |==| '=' /\==\ - ,_ /|==| /\ , | |==|, | + * |==|-, _`/ '.='. - .' /==/, | |- | /==/ -/ + * `-.`.____.' `--`--'' `--`./ `--` `--`--` + * _ __ ,---. .-._ .=-.-. _,.----. + * .-`.' ,`..--.' \ /==/ \ .-._ /==/_ /.' .' - \ + * /==/, - \==\-/\ \ |==|, \/ /, /==|, |/==/ , ,-' + * |==| _ .=. /==/-|_\ | |==|- \| ||==| ||==|- | . + * |==| , '=',\==\, - \ |==| , | -||==|- ||==|_ `-' \ + * |==|- '..'/==/ - ,| |==| - _ ||==| ,||==| _ , | + * |==|, | /==/- /\ - \|==| /\ , ||==|- |\==\. / + * /==/ - | \==\ _.\=\.-'/==/, | |- |/==/. / `-.`.___.-' + * `--`---' `--` `--`./ `--``--`-` + * + * @(#)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. + */ + +#include + +#include "haggis.h" + +int main() { + printf("Hello, Haggis!\n"); +} diff --git a/src/haggis.h b/src/haggis.h new file mode 100644 index 0000000..3a26776 --- /dev/null +++ b/src/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