18
doc/inc/docs.h
Normal file
18
doc/inc/docs.h
Normal file
@ -0,0 +1,18 @@
|
||||
#pragma once
|
||||
#include <linux/limits.h>
|
||||
#include <stdbool.h>
|
||||
#include <dirent.h>
|
||||
|
||||
#include "util.h"
|
||||
|
||||
typedef struct {
|
||||
DIR *dir;
|
||||
util_file_t *file;
|
||||
char name[NAME_MAX + 1];
|
||||
char *lang;
|
||||
} docs_t;
|
||||
|
||||
bool docs_init(docs_t *docs, char *dir);
|
||||
char *docs_next(docs_t *docs, char *name, bool content);
|
||||
void docs_reset(docs_t *docs);
|
||||
void docs_free(docs_t *docs);
|
@ -9,15 +9,11 @@ typedef struct {
|
||||
uint64_t size;
|
||||
} util_file_t;
|
||||
|
||||
#define util_compare_name(n1, n2) (strncmp(n1, n2, NAME_MAX) == 0)
|
||||
#define util_toupper(str) \
|
||||
for (char *c = str; *c != 0; c++) \
|
||||
*c = toupper(*c)
|
||||
#define util_tolower(str) \
|
||||
for (char *c = str; *c != 0; c++) \
|
||||
*c = tolower(*c)
|
||||
uint64_t util_endswith(char *str, char *suf);
|
||||
void util_send(ctorm_res_t *res, uint16_t code, cJSON *json);
|
||||
bool util_dir_contains(char *dir, const char *file);
|
||||
util_file_t *util_file_load(char *path);
|
||||
util_file_t *util_file_load(int dirfd, char *path);
|
||||
void util_file_free(util_file_t *file);
|
||||
bool util_parse_doc_name(char *name, char **lang, const char *ext);
|
||||
|
Reference in New Issue
Block a user