more helper functions added to nxinstall
[public/netxms.git] / doc / internal / nxinstall.txt
1 ************
2 * Tracing
3
4 "trace" function can be used in nxinstall scripts, output will be sent to stdout.
5 Trace level can be set by -t command line option. Default is 0.
6
7
8 *****************************
9 * Additional NXSL functions
10
11 1. access(file, mode)
12
13 Returns 1 (true) if file is accessible
14
15
16 2. chdir(path)
17
18 Change current directory.
19
20
21 3. CopyFile(src,dst)
22
23 Copy file. Currently available only on Windows.
24
25
26 4. DeleteFile(name)
27
28 Delete file (calls remove(name))
29
30
31 5. fclose(handle)
32
33 Close file.
34
35
36 6. feof(handle)
37
38 Returns 1 (true) if eof reached.
39
40
41 7. fgets(handle)
42
43 Read next line from file. String returned with new line character removed.
44 Returns null if EOF reached and no characters was read.
45
46
47 8. fopen(name, mode)
48
49 Open file. Returns file handle (object of class FILE). Handle has one attribute
50 "eof", which can be used for end of file checking. Mode is the same as for
51 libc call.
52
53
54 9. fputs(handle, string)
55
56 Writes line to file. New line character appended automatically.
57
58
59 10. mkdir(name)
60
61 Create directory (calls libc mkdir).
62
63
64 11. RenameFile(oldName, newName)
65
66 Rename file or directory (calls libc rename).
67
68
69 12. rmdir(name)
70
71 Remove directory (calls libc rmdir).
72
73
74 13. system(command)
75
76 Executes external command by calling libc system.
77
78
79
80 ******************
81 * Script example
82
83 mkdir("inst");
84 chdir("inst");
85
86 f = fopen("test","w");
87 fputs(f, "line 1");
88 fputs(f, "line 2");
89 fclose(f);
90
91 f = fopen("test");
92 while(!f->eof)
93 {
94 s = fgets(f);
95 if (s != null)
96 trace(0, ">>> " . s);
97 }
98 fclose(f);
99
100 chdir("..");
101
102 system("pwd");