Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/kisom/libdirutils
Some useful directory-oriented functions in C.
https://github.com/kisom/libdirutils
Last synced: 18 days ago
JSON representation
Some useful directory-oriented functions in C.
- Host: GitHub
- URL: https://github.com/kisom/libdirutils
- Owner: kisom
- License: isc
- Created: 2012-11-21T04:44:22.000Z (almost 12 years ago)
- Default Branch: master
- Last Pushed: 2015-09-09T08:46:01.000Z (about 9 years ago)
- Last Synced: 2024-10-11T02:46:51.886Z (about 1 month ago)
- Language: C
- Homepage: https://docs.kyleisom.net/p/libdirutils/
- Size: 233 KB
- Stars: 1
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG
- License: LICENSE
Awesome Lists containing this project
README
Introduction
============`libdirutils` is a utility library inspired by similar functionality in
the Go and Python programming languages; it provides functions similar
to `rm -r` and `mkdir -p`, as well as a convenience function to combine
the functionality of `access(2)` and `stat(2)`.Functions Provided
==================makedirs
--------int
makedirs(const char *path);`makedirs` creates a path and all required parent directories. The mode
created is the process’s `umask(2)` value applied to `0777`. It returns
`EXIT_SUCCESS` on success and `EXIT_FAILURE` on failure.rmdirs
------int
rmdirs(const char *path);`rmdirs` removes a path and all subdirectories and files. It returns
`EXIT_SUCCESS` on success and `EXIT_FAILURE` on failure.path\_exists
------------EXISTS_STATUS
path_exists(const char *path);`path_exists` combines the functionality of `access(2)` and `stat(2)`.
It checks whether the process has access to the file and indicates
whether it is a regular file, a directory, or if an error occurs. The
return type is of the enumeration `EXISTS_STATUS`, which is one of* `EXISTS_ERROR`: there was an error looking up the file;
* `EXISTS_NOENT`: the file does not exist;
* `EXISTS_NOPERM`: the process does not have the appropriate
permissions to access the file.* `EXISTS_DIR`: the file is a direcotry;
* `EXISTS_FILE`: the file is a regular file; and
* `EXISTS_OTHER`: the file could be read and is not a directory or
regular file.Getting the Source
==================Dependencies
------------If you will be running the unit tests, `CUnit`[^1] is required. If you
will be rebuilding the autotools build infrastructure, you will need
automake 1.11 and autoconf >= 2.59.Development Repository
----------------------The source code repository is available on Github[^2]. The code there is
in the original autotools source; the `autobuild.sh` script is provided
to run through a complete build, including running through the provided
unit tests:$ git clone https://github.com/kisom/libdirutils.git dirutils
$ cd dirutils
$ ./autobuild.shSeveral utility scripts are provided in the `scripts` subdirectory; the
`autobuild.sh` script calls these. Of note, the `prebuild.sh` script,
which will set the necessary autotools environment variables and call
`autoreconf`.Release Tarballs
----------------Release tarballs will be made available via the Github repository’s
downloads[^3] section.Once unpacked, these can be built with the normal
./configure && make && make install
method. See
./configure --help
for additional configuration options.
License
=======Copyright (c) 2012 Kyle Isom
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.[^1]: http://cunit.sourceforge.net/
[^2]: https://github.com/kisom/libdirutils
[^3]: https://github.com/kisom/libdirutils/downloads