1 /********************************************************************/
2 /*                                                                  */
3 /*  cmd_rtl.h     Directory, file and other system functions.       */
4 /*  Copyright (C) 1989 - 2009  Thomas Mertes                        */
5 /*                                                                  */
6 /*  This file is part of the Seed7 Runtime Library.                 */
7 /*                                                                  */
8 /*  The Seed7 Runtime Library is free software; you can             */
9 /*  redistribute it and/or modify it under the terms of the GNU     */
10 /*  Lesser General Public License as published by the Free Software */
11 /*  Foundation; either version 2.1 of the License, or (at your      */
12 /*  option) any later version.                                      */
13 /*                                                                  */
14 /*  The Seed7 Runtime Library is distributed in the hope that it    */
15 /*  will be useful, but WITHOUT ANY WARRANTY; without even the      */
16 /*  implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR */
17 /*  PURPOSE.  See the GNU Lesser General Public License for more    */
18 /*  details.                                                        */
19 /*                                                                  */
20 /*  You should have received a copy of the GNU Lesser General       */
21 /*  Public License along with this program; if not, write to the    */
22 /*  Free Software Foundation, Inc., 51 Franklin Street,             */
23 /*  Fifth Floor, Boston, MA  02110-1301, USA.                       */
24 /*                                                                  */
25 /*  Module: Seed7 Runtime Library                                   */
26 /*  File: seed7/src/cmd_rtl.h                                       */
27 /*  Changes: 1994, 2006, 2009  Thomas Mertes                        */
28 /*  Content: Directory, file and other system functions.            */
29 /*                                                                  */
30 /********************************************************************/
31 
32 #ifdef FILE_UNKNOWN
33 #undef FILE_UNKNOWN
34 #endif
35 
36 #define FILE_ABSENT   0 /* A component of path does not exist */
37 #define FILE_UNKNOWN  1 /* File exists but has an unknown type */
38 #define FILE_REGULAR  2
39 #define FILE_DIR      3
40 #define FILE_CHAR     4
41 #define FILE_BLOCK    5
42 #define FILE_FIFO     6
43 #define FILE_SYMLINK  7
44 #define FILE_SOCKET   8
45 
46 #if HAS_READLINK
47 striType doReadLink (const const_striType filePath, errInfoType *err_info);
48 #endif
49 #if HAS_SYMBOLIC_LINKS
50 striType followLink (striType path, errInfoType *err_info);
51 #endif
52 #if defined USE_EXTENDED_LENGTH_PATH && USE_EXTENDED_LENGTH_PATH
53 void adjustCwdForShell (errInfoType *err_info);
54 #endif
55 #if EMULATE_ROOT_CWD
56 void initEmulatedCwd (errInfoType *err_info);
57 #endif
58 striType doGetCwd (errInfoType *err_info);
59 striType getAbsolutePath (const const_striType aPath);
60 bigIntType cmdBigFileSize (const const_striType file_name);
61 void cmdChdir (const const_striType dir_name);
62 void cmdCloneFile (const const_striType source_name, const const_striType dest_name);
63 striType cmdConfigValue (const const_striType name);
64 void cmdCopyFile (const const_striType source_name, const const_striType dest_name);
65 rtlArrayType cmdEnvironment (void);
66 setType cmdFileMode (const const_striType file_name);
67 intType cmdFileSize (const const_striType file_name);
68 intType cmdFileType (const const_striType file_name);
69 intType cmdFileTypeSL (const const_striType file_name);
70 striType cmdGetcwd (void);
71 striType cmdGetenv (const const_striType stri);
72 void cmdGetATime (const const_striType file_name,
73     intType *year, intType *month, intType *day, intType *hour,
74     intType *min, intType *sec, intType *micro_sec, intType *time_zone,
75     boolType *is_dst);
76 void cmdGetCTime (const const_striType file_name,
77     intType *year, intType *month, intType *day, intType *hour,
78     intType *min, intType *sec, intType *micro_sec, intType *time_zone,
79     boolType *is_dst);
80 void cmdGetMTime (const const_striType file_name,
81     intType *year, intType *month, intType *day, intType *hour,
82     intType *min, intType *sec, intType *micro_sec, intType *time_zone,
83     boolType *is_dst);
84 rtlArrayType cmdGetSearchPath (void);
85 striType cmdHomeDir (void);
86 rtlArrayType cmdLs (const const_striType dirPath);
87 void cmdMkdir (const const_striType dir_name);
88 void cmdMove (const const_striType source_name, const const_striType dest_name);
89 striType cmdReadLink (const const_striType link_name);
90 void cmdRemoveFile (const const_striType file_name);
91 void cmdRemoveTree (const const_striType file_name);
92 void cmdSetenv (const const_striType name, const const_striType value);
93 void cmdSetATime (const const_striType file_name,
94     intType year, intType month, intType day, intType hour,
95     intType min, intType sec, intType micro_sec, intType time_zone);
96 void cmdSetFileMode (const const_striType file_name, const const_setType mode);
97 void cmdSetMTime (const const_striType file_name,
98     intType year, intType month, intType day, intType hour,
99     intType min, intType sec, intType micro_sec, intType time_zone);
100 void cmdSetSearchPath (rtlArrayType searchPath);
101 intType cmdShell (const const_striType command, const const_striType parameters);
102 striType cmdShellEscape (const const_striType stri);
103 void cmdSymlink (const const_striType source_name, const const_striType dest_name);
104 striType cmdToOsPath (const const_striType standardPath);
105 void cmdUnsetenv (const const_striType name);
106