1 /* 2 Copyright (C) 2015-2021, Dirk Krause 3 SPDX-License-Identifier: BSD-3-Clause 4 */ 5 6 /* 7 WARNING: This file was generated by the dkct program (see 8 http://dktools.sourceforge.net/ for details). 9 Changes you make here will be lost if dkct is run again! 10 You should modify the original source and run dkct on it. 11 Original source: dk4getcwdd.ctr 12 */ 13 14 #ifndef DK4GETCWDD_H_INCLUDED 15 /** Avoid multiple inclusions. */ 16 #define DK4GETCWDD_H_INCLUDED 1 17 18 19 /** @file dk4getcwdd.h Get current working directoy in dkChar. 20 */ 21 22 #ifndef DK4CONF_H_INCLUDED 23 #if DK4_BUILDING_DKTOOLS4 24 #include "dk4conf.h" 25 #else 26 #include <dktools-4/dk4conf.h> 27 #endif 28 #endif 29 30 #ifndef DK4ERROR_H_INCLUDED 31 #if DK4_BUILDING_DKTOOLS4 32 #include <libdk4base/dk4error.h> 33 #else 34 #include <dktools-4/dk4error.h> 35 #endif 36 #endif 37 38 #ifdef __cplusplus 39 extern "C" { 40 #endif 41 42 /** Find current working directory. 43 @param dptr Destination buffer pointer. 44 @param sz Buffer size. 45 @param erp Error report, may be NULL. 46 @return 1 on success, 0 on error. 47 */ 48 int 49 dk4getcwd(dkChar *dptr, size_t sz, dk4_er_t *erp); 50 51 /** Find current working directory, return string in newly 52 allocated memory. 53 @param erp Error report, may be NULL. 54 @return Valid pointer to newly allocated memory containing 55 the directory name on success, NULL on error. 56 On success, use dk4mem_free() to release the memory when done 57 with it. 58 59 Error codes: 60 - DK4_E_SYSTEM<br> 61 with errno in iDetails if getcwd() or _getcwd() failed 62 or GetLastError() result in iDetails if GetCurrentDirectoryA() 63 failed. 64 - DK4_E_INVALID_ARGUMENTS<br> 65 if src is a NULL pointer, 66 - DK4_E_MATH_OVERFLOW<br> 67 on mathematical overflow in size calculation, 68 - DK4_E_MEMORY<br> 69 if no memory is available. 70 */ 71 dkChar * 72 dk4getcwd_dup(dk4_er_t *erp); 73 74 #ifdef __cplusplus 75 } 76 #endif 77 78 79 80 #endif 81