cfengine  3.15.4
About: CFEngine is a configuration management system for configuring and maintaining Unix-like computers (using an own high level policy language). Community version.
  Fossies Dox: cfengine-3.15.4.tar.gz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

files_names.h
Go to the documentation of this file.
1 /*
2  Copyright 2019 Northern.tech AS
3 
4  This file is part of CFEngine 3 - written and maintained by Northern.tech AS.
5 
6  This program is free software; you can redistribute it and/or modify it
7  under the terms of the GNU General Public License as published by the
8  Free Software Foundation; version 3.
9 
10  This program is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  GNU General Public License for more details.
14 
15  You should have received a copy of the GNU General Public License
16  along with this program; if not, write to the Free Software
17  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
18 
19  To the extent this program is licensed as part of the Enterprise
20  versions of CFEngine, the applicable Commercial Open Source License
21  (COSL) may apply to this file if you as a licensee so wish it. See
22  included file COSL.txt.
23 */
24 
25 #ifndef CFENGINE_FILES_NAMES_H
26 #define CFENGINE_FILES_NAMES_H
27 
28 #include <cf3.defs.h>
29 
30 typedef enum
31 {
33  FILE_PATH_TYPE_RELATIVE, // ./../foo.cf
35 } FilePathType;
36 
37 FilePathType FilePathGetType(const char *file_path);
38 
39 bool IsNewerFileTree(const char *dir, time_t reftime);
40 int CompareCSVName(const char *s1, const char *s2);
41 bool IsDir(const char *path);
42 char *JoinSuffix(char *path, size_t path_size, const char *leaf);
43 char *JoinPaths(char *path, size_t path_size, const char *leaf_path);
44 bool IsAbsPath(const char *path);
45 void AddSlash(char *str);
46 char *GetParentDirectoryCopy(const char *path);
47 void DeleteSlash(char *str);
48 void DeleteRedundantSlashes(char *str);
49 const char *FirstFileSeparator(const char *str);
50 const char *LastFileSeparator(const char *str);
51 bool ChopLastNode(char *str);
52 char *CanonifyName(const char *str);
53 void TransformNameInPlace(char *s, char from, char to);
54 char *CanonifyChar(const char *str, char ch);
55 const char *ReadLastNode(const char *str);
56 bool CompressPath(char *dest, size_t dest_size, const char *src);
57 char *GetAbsolutePath(const char *path);
58 char *GetRealPath(const char *path);
59 bool IsFileOutsideDefaultRepository(const char *f);
60 int RootDirLength(const char *f);
61 const char *GetSoftwareCacheFilename(char *buffer);
62 const char *GetSoftwarePatchesFilename(char *buffer);
63 
64 /**
65  * Detect whether package manager starts with an env command instead of package manager,
66  * and if so, return the real package manager.
67  */
68 const char *RealPackageManager(const char *manager);
69 
70 #endif
char * CanonifyChar(const char *str, char ch)
Definition: files_names.c:494
int CompareCSVName(const char *s1, const char *s2)
Definition: files_names.c:514
bool IsAbsPath(const char *path)
Definition: files_names.c:214
const char * GetSoftwarePatchesFilename(char *buffer)
Definition: files_names.c:806
bool CompressPath(char *dest, size_t dest_size, const char *src)
Definition: files_names.c:556
bool ChopLastNode(char *str)
Definition: files_names.c:422
char * CanonifyName(const char *str)
Definition: files_names.c:483
const char * FirstFileSeparator(const char *str)
Definition: files_names.c:375
FilePathType
Definition: files_names.h:31
@ FILE_PATH_TYPE_RELATIVE
Definition: files_names.h:33
@ FILE_PATH_TYPE_NON_ANCHORED
Definition: files_names.h:34
@ FILE_PATH_TYPE_ABSOLUTE
Definition: files_names.h:32
bool IsFileOutsideDefaultRepository(const char *f)
Definition: files_names.c:722
char * JoinSuffix(char *path, size_t path_size, const char *leaf)
Definition: files_names.c:152
void AddSlash(char *str)
Definition: files_names.c:230
FilePathType FilePathGetType(const char *file_path)
Definition: files_names.c:706
char * GetAbsolutePath(const char *path)
Definition: files_names.c:642
const char * ReadLastNode(const char *str)
Definition: files_names.c:539
void DeleteSlash(char *str)
Definition: files_names.c:320
int RootDirLength(const char *f)
Definition: files_names.c:787
bool IsNewerFileTree(const char *dir, time_t reftime)
Definition: files_names.c:41
bool IsDir(const char *path)
Definition: files_names.c:127
char * GetParentDirectoryCopy(const char *path)
Definition: files_names.c:281
const char * RealPackageManager(const char *manager)
Definition: files_names.c:813
void DeleteRedundantSlashes(char *str)
Definition: files_names.c:338
const char * GetSoftwareCacheFilename(char *buffer)
Definition: files_names.c:798
char * JoinPaths(char *path, size_t path_size, const char *leaf_path)
Definition: files_names.c:183
void TransformNameInPlace(char *s, char from, char to)
Definition: files_names.c:469
char * GetRealPath(const char *path)
Definition: files_names.c:670
const char * LastFileSeparator(const char *str)
Definition: files_names.c:398