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: dk4stat.ctr 12 */ 13 14 #ifndef DK4STAT_H_INCLUDED 15 /** Avoid multiple inclusions. */ 16 #define DK4STAT_H_INCLUDED 1 17 18 19 /** @file 20 File statistics (retrieve information from 21 stat() and lstat() results). 22 23 Note: The stat() and lstat() functions are sufficient for 24 non-Windows systems. 25 On Windows systems the st_dev and st_ino components may contain 26 dummy contents, the stat structure does not contain information 27 about symbolic links. 28 29 For a portable (both Windows and non-Windows) check whether a file 30 is a symbolic link, reparse point... use the dk4_file_info_t 31 data type from dk4fileit.h and the functions from dk4filei.h. 32 33 CRT on Windows: Required. 34 */ 35 36 #ifndef DK4CONF_H_INCLUDED 37 #if DK4_BUILDING_DKTOOLS4 38 #include "dk4conf.h" 39 #else 40 #include <dktools-4/dk4conf.h> 41 #endif 42 #endif 43 44 #ifndef DK4STATT_H_INCLUDED 45 #if DK4_BUILDING_DKTOOLS4 46 #include <libdk4c/dk4statt.h> 47 #else 48 #include <dktools-4/dk4statt.h> 49 #endif 50 #endif 51 52 #ifndef DK4ERROR_H_INCLUDED 53 #if DK4_BUILDING_DKTOOLS4 54 #include <libdk4base/dk4error.h> 55 #else 56 #include <dktools-4/dk4error.h> 57 #endif 58 #endif 59 60 #ifdef __cplusplus 61 extern "C" { 62 #endif 63 64 /** Check whether the file information is about a regular file. 65 @param stb Stat buffer filled previously. 66 @param erp Error report, may be NULL. 67 @return 1 for regular file, 0 otherwise. 68 69 */ 70 int 71 dk4stat_is_regular(const dk4_stat_t *stb, dk4_er_t *erp); 72 73 /** Check whether the file information is about a directory. 74 @param stb Stat buffer filled previously. 75 @param erp Error report, may be NULL. 76 @return 1 for regular file, 0 otherwise. 77 78 */ 79 int 80 dk4stat_is_directory(const dk4_stat_t *stb, dk4_er_t *erp); 81 82 /** Check whether the file information is about a symbolic link. 83 @param stb Stat buffer filled previously. 84 @param erp Error report, may be NULL. 85 @return 1 for regular file, 0 otherwise. 86 87 */ 88 int 89 dk4stat_is_symlink(const dk4_stat_t *stb, dk4_er_t *erp); 90 91 /** Check whether the file information is about UNIX domain socket. 92 @param stb Stat buffer filled previously. 93 @param erp Error report, may be NULL. 94 @return 1 for regular file, 0 otherwise. 95 96 */ 97 int 98 dk4stat_is_unix_domain_socket(const dk4_stat_t *stb, dk4_er_t *erp); 99 100 #ifdef __cplusplus 101 } 102 #endif 103 104 105 106 #endif 107