X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?p=vrlugburz;a=blobdiff_plain;f=src%2Ffs.h;fp=src%2Ffs.h;h=752f7b12661fe53fa8b2c77e44989ef363eff3c8;hp=0000000000000000000000000000000000000000;hb=6066118fc6a58b379f52b9aaaf45200b136812b9;hpb=95e4bd8e387c3cb9fc325ae922052bf7bc7ae8ea diff --git a/src/fs.h b/src/fs.h new file mode 100644 index 0000000..752f7b1 --- /dev/null +++ b/src/fs.h @@ -0,0 +1,22 @@ +#ifndef FS_H_ +#define FS_H_ + +#include + +/* buf should be at least as large as strlen(path) + 1 + * if buf is null, or buf points to path, will do in-place replacement + * only UNIX-style path separators are supported + * returns buf + */ +char *path_dir(const char *path, char *buf); +char *path_file(const char *path, char *buf); + +/* buf should be at least strlen(dirname) + strlen(fname) + 2 + * returns buf + */ +char *combine_path(const char *dirname, const char *fname, char *buf); + +/* if dirname is null or empty, this is equivalent to fopen(fname, attr) */ +FILE *fopenat(const char *dirname, const char *fname, const char *attr); + +#endif /* FS_H_ */