dircomp/dircomp.h

58 lines
1.4 KiB
C
Raw Normal View History

2023-04-17 15:51:04 +02:00
/*
2023-04-21 20:50:39 +02:00
dircomp - A directory comparison tool
2023-04-17 15:51:04 +02:00
2023-04-21 20:50:39 +02:00
THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
2023-04-17 15:51:04 +02:00
*/
# ifndef DIRCOMP_GUARD
# define DIRCOMP_GUARD
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <stdbool.h>
#include <dirent.h>
#include <string.h>
#include <limits.h>
#include <sys/types.h>
#include <openssl/sha.h>
2023-04-27 17:24:57 +02:00
#include <openssl/evp.h>
2023-04-17 15:51:04 +02:00
#include <sys/stat.h>
2023-04-28 15:21:37 +02:00
#define BYTES_TO_READ_AT_ONCE 512000 // 500KiB
#if BYTES_TO_READ_AT_ONCE > SIZE_MAX
#error Compile-time error: The specified value of BYTES_TO_READ_AT_ONCE is too large for this system.
#endif
2023-04-17 15:51:04 +02:00
struct arguments{
char* directory1;
char* directory2;
bool r; // recursive
bool v; // verbose
bool h; // help
bool f; // fast
2023-04-28 22:10:25 +02:00
bool d; // comparison by digest
2023-04-17 15:51:04 +02:00
};
struct arguments get_arguments(int, char**);
// Reference: https://www.gnu.org/software/libc/manual/html_node/Directory-Entries.html
bool analyze_directories(char*, char*, struct arguments*);
int byte_by_byte_file_comparison(char*, char*);
int hash_by_hash_file_comparison(char*, char*);
2023-04-27 17:33:26 +02:00
unsigned char* sha1(char*);
unsigned char* sha1_legacy(char*);
2023-04-17 15:51:04 +02:00
2023-04-21 12:33:34 +02:00
char* combine_path(char*, char*);
2023-04-17 15:51:04 +02:00
void print_help(void);
#endif