Commit a548a3c2 authored by Andreas Gustafsson's avatar Andreas Gustafsson

added unix implementation of isc_file_absolutepath()

parent dee69dd3
......@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: file.c,v 1.36 2001/07/10 04:23:01 bwelling Exp $ */
/* $Id: file.c,v 1.37 2001/07/16 17:26:44 gson Exp $ */
#include <config.h>
......@@ -28,6 +28,7 @@
#include <sys/stat.h>
#include <sys/time.h>
#include <isc/dir.h>
#include <isc/file.h>
#include <isc/string.h>
#include <isc/time.h>
......@@ -290,3 +291,15 @@ isc_file_progname(const char *filename, char *buf, size_t buflen) {
return (ISC_R_SUCCESS);
}
isc_result_t
isc_file_absolutepath(const char *filename, char *path, size_t pathlen) {
isc_result_t result;
result = isc_dir_current(path, pathlen, ISC_TRUE);
if (result != ISC_R_SUCCESS)
return (result);
if (strlen(path) + strlen(filename) + 1 > pathlen)
return (ISC_R_NOSPACE);
strcat(path, filename);
return (ISC_R_SUCCESS);
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment