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: dk4getcwdw.ctr
12 */
13 
14 #ifndef DK4GETCWDW_H_INCLUDED
15 /** Avoid multiple inclusions. */
16 #define DK4GETCWDW_H_INCLUDED 1
17 
18 
19 /**	@file	dk4getcwdw.h	Get working directroy in wchar_t.
20 */
21 
22 
23 #ifndef	DK4CONF_H_INCLUDED
24 #if DK4_BUILDING_DKTOOLS4
25 #include "dk4conf.h"
26 #else
27 #include <dktools-4/dk4conf.h>
28 #endif
29 #endif
30 
31 #ifndef DK4ERROR_H_INCLUDED
32 #if DK4_BUILDING_DKTOOLS4
33 #include <libdk4base/dk4error.h>
34 #else
35 #include <dktools-4/dk4error.h>
36 #endif
37 #endif
38 
39 #ifdef __cplusplus
40 extern "C" {
41 #endif
42 
43 
44 /**	Find current working directory.
45 	@param	dptr	Destination buffer pointer.
46 	@param	sz	Buffer size (Number of wchar_t).
47 	@param	erp	Error report, may be NULL.
48 	@return	1 on success, 0 on error.
49 
50 	Error codes:
51 	- DK4_E_INVALID_ARGUMENTS<br>
52 	  if dptr is NULL or sz is 0,
53 	- DK4_E_BUFFER_TOO_SMALL<br>
54 	  if dptr is too small,
55 	- DK4_E_NOT_SUPPORTED<br>
56 	  if the operation is not supported,
57 	- DK4_E_SYSTEM<br>
58 	  with errno in iDetails if getcwd() or _getcwd() failed
59 	  or GetLastError() result in iDetails if GetCurrentDirectoryW()
60 	  failed.
61 */
62 int
63 dk4getcwd_wc(wchar_t *dptr, size_t sz, dk4_er_t *erp);
64 
65 /**	Find current working directory, return string in newly
66 	allocated memory.
67 	@param	erp	Error report, may be NULL.
68 	@return	Valid pointer to newly allocated memory containing
69 	the directory name on success, NULL on error.
70 	On success, use dk4mem_free() to release the memory when done
71 	with it.
72 
73 	Error codes:
74 	- DK4_E_SYSTEM<br>
75 	  with errno in iDetails if getcwd() or _getcwd() failed
76 	  or GetLastError() result in iDetails if GetCurrentDirectoryA()
77 	  failed.
78 	- DK4_E_INVALID_ARGUMENTS<br>
79 	  if src is a NULL pointer,
80 	- DK4_E_MATH_OVERFLOW<br>
81 	  on mathematical overflow in size calculation,
82 	- DK4_E_MEMORY<br>
83 	  if no memory is available.
84 */
85 wchar_t *
86 dk4getcwd_wc_dup(dk4_er_t *erp);
87 
88 #ifdef __cplusplus
89 }
90 #endif
91 
92 
93 
94 
95 #endif
96