mirror of
https://github.com/fscotto/fsnap.git
synced 2026-11-26 03:09:51 +00:00
Add fsnap diff <old> <new> that compares two snapshots and reports added (A), deleted (D), metadata changed (M), permissions changed (P), and symlink target changed (L) records. Both snapshots are loaded into memory, sorted by path using qsort, and merged with a two-pointer algorithm. Residual records after the merge are emitted as A or D. Escape sequences in paths are decoded on output. Also add GetTime accessor, set errno on load_in_memory failures for meaningful error messages, and fix unused-variable warnings.
41 lines
906 B
C
41 lines
906 B
C
#ifndef TYPE_H
|
|
#define TYPE_H
|
|
|
|
#include <inttypes.h>
|
|
|
|
enum Fields {
|
|
FILE_TYPE,
|
|
PERMISSIONS,
|
|
UID,
|
|
GID,
|
|
SIZE,
|
|
TIME,
|
|
TARGET,
|
|
FINGERPRINT,
|
|
PATH,
|
|
NONE,
|
|
};
|
|
|
|
extern enum Fields field;
|
|
|
|
const char *FieldName(enum Fields f);
|
|
|
|
struct RecordObject;
|
|
|
|
// Methods
|
|
struct RecordObject *NewRecordObject();
|
|
int Unpack(struct RecordObject *, char *);
|
|
int Compare(struct RecordObject *, struct RecordObject *);
|
|
char GetFileType(const struct RecordObject *);
|
|
unsigned int GetPermissions(const struct RecordObject *);
|
|
uintmax_t GetUid(const struct RecordObject *);
|
|
uintmax_t GetGid(const struct RecordObject *);
|
|
intmax_t GetSize(const struct RecordObject *);
|
|
intmax_t GetTime(const struct RecordObject *);
|
|
const char *GetPath(const struct RecordObject *);
|
|
const char *GetTarget(const struct RecordObject *);
|
|
uintmax_t GetFingerPrint(const struct RecordObject *);
|
|
int Release(struct RecordObject *);
|
|
|
|
#endif
|