everything in its own place

This commit is contained in:
2020-02-14 23:12:10 -08:00
parent 769de599fc
commit 81f4a77333
20 changed files with 0 additions and 192 deletions

42
libdirutils/kst/dirlist.h Normal file
View File

@@ -0,0 +1,42 @@
/*
* Copyright (c) 2012 Kyle Isom <kyle@tyrfingr.is>
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
* WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
* AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA
* OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
* ---------------------------------------------------------------------
*/
#ifndef __DIRUTILS_DIRLIST_H
#define __DIRUTILS_DIRLIST_H
#include <sys/queue.h>
#include <stdio.h>
#include <dirent.h>
struct dirlst {
char path[FILENAME_MAX + 1];
TAILQ_ENTRY(dirlst) dirs;
};
TAILQ_HEAD(tq_dirlst, dirlst);
struct tq_dirlst *dirlst_create(const char *, size_t);
int dirlst_push(struct tq_dirlst *, const char *, size_t);
struct dirlst *dirlst_pop(struct tq_dirlst *);
int dirlst_destroy(struct tq_dirlst **);
#endif

View File

@@ -0,0 +1,53 @@
/*
* Copyright (c) 2012 Kyle Isom <kyle@tyrfingr.is>
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
* WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
* AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA
* OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
* ---------------------------------------------------------------------
*/
#ifndef __DIRUTILS_DIRUTILS_H
#define __DIRUTILS_DIRUTILS_H
#include <sys/queue.h>
#include <dirent.h>
#include <stdio.h>
enum E_EXISTS_STATUS {
EXISTS_ERROR,
EXISTS_NOENT,
EXISTS_NOPERM,
EXISTS_DIR,
EXISTS_FILE,
EXISTS_OTHER
};
typedef enum E_EXISTS_STATUS EXISTS_STATUS;
typedef int (*dirwalk_action)(const char *);
extern const unsigned char FT_ANY;
extern const unsigned char FT_STD;
extern const unsigned char FT_NODESCEND;
int makedirs(const char *);
int rmdirs(const char *);
EXISTS_STATUS path_exists(const char *);
int walkdir(const char *, dirwalk_action, unsigned char);
#endif