@@ -148,3 +148,148 @@ snapshots:
148
148
style : secondary
149
149
start : 123
150
150
end : 147
151
+ ? |
152
+ if (stat(file.c_str(), &buf) == 0)
153
+ {
154
+
155
+ // Open the file for reading
156
+ // ruleid : file-stat-before-action
157
+ fp = fopen(file.c_str(), "r");
158
+ if (fp == NULL)
159
+ {
160
+ char message[2560];
161
+ sprintf(message, "File '%s' Cound Not be Opened", file.c_str());
162
+ // DISPLAY_MSG_ERROR( this, message, "GetFileContents", "System" );
163
+ throw message;
164
+ }
165
+
166
+ MvString s, ss;
167
+ while (fgets(data, sizeof(data), fp) != (char *)0)
168
+ {
169
+ s = data;
170
+ s.trimBoth();
171
+ if (s.compare(0, 5, "GROUP") == 0)
172
+ {
173
+ // size_t t = s.find_last_of( ":" );
174
+ size_t t = s.find(":");
175
+ if (t != string::npos)
176
+ {
177
+ ss = s.substr(t + 1).c_str();
178
+ ss.trimBoth();
179
+ ss = ss.substr(1, ss.length() - 3).c_str();
180
+ group_list.push_back(ss);
181
+ }
182
+ }
183
+ }
184
+
185
+ // Close the file
186
+ fclose(fp);
187
+ }
188
+ : labels :
189
+ - source : fopen
190
+ style : primary
191
+ start : 123
192
+ end : 128
193
+ - source : stat
194
+ style : secondary
195
+ start : 4
196
+ end : 8
197
+ - source : file.c_str()
198
+ style : secondary
199
+ start : 9
200
+ end : 21
201
+ - source : (file.c_str(), &buf)
202
+ style : secondary
203
+ start : 8
204
+ end : 28
205
+ - source : stat(file.c_str(), &buf)
206
+ style : secondary
207
+ start : 4
208
+ end : 28
209
+ - source : |-
210
+ if (stat(file.c_str(), &buf) == 0)
211
+ {
212
+
213
+ // Open the file for reading
214
+ // ruleid: file-stat-before-action
215
+ fp = fopen(file.c_str(), "r");
216
+ if (fp == NULL)
217
+ {
218
+ char message[2560];
219
+ sprintf(message, "File '%s' Cound Not be Opened", file.c_str());
220
+ // DISPLAY_MSG_ERROR( this, message, "GetFileContents", "System" );
221
+ throw message;
222
+ }
223
+
224
+ MvString s, ss;
225
+ while (fgets(data, sizeof(data), fp) != (char *)0)
226
+ {
227
+ s = data;
228
+ s.trimBoth();
229
+ if (s.compare(0, 5, "GROUP") == 0)
230
+ {
231
+ // size_t t = s.find_last_of( ":" );
232
+ size_t t = s.find(":");
233
+ if (t != string::npos)
234
+ {
235
+ ss = s.substr(t + 1).c_str();
236
+ ss.trimBoth();
237
+ ss = ss.substr(1, ss.length() - 3).c_str();
238
+ group_list.push_back(ss);
239
+ }
240
+ }
241
+ }
242
+
243
+ // Close the file
244
+ fclose(fp);
245
+ }
246
+ style: secondary
247
+ start: 0
248
+ end: 967
249
+ - source : |-
250
+ {
251
+
252
+ // Open the file for reading
253
+ // ruleid: file-stat-before-action
254
+ fp = fopen(file.c_str(), "r");
255
+ if (fp == NULL)
256
+ {
257
+ char message[2560];
258
+ sprintf(message, "File '%s' Cound Not be Opened", file.c_str());
259
+ // DISPLAY_MSG_ERROR( this, message, "GetFileContents", "System" );
260
+ throw message;
261
+ }
262
+
263
+ MvString s, ss;
264
+ while (fgets(data, sizeof(data), fp) != (char *)0)
265
+ {
266
+ s = data;
267
+ s.trimBoth();
268
+ if (s.compare(0, 5, "GROUP") == 0)
269
+ {
270
+ // size_t t = s.find_last_of( ":" );
271
+ size_t t = s.find(":");
272
+ if (t != string::npos)
273
+ {
274
+ ss = s.substr(t + 1).c_str();
275
+ ss.trimBoth();
276
+ ss = ss.substr(1, ss.length() - 3).c_str();
277
+ group_list.push_back(ss);
278
+ }
279
+ }
280
+ }
281
+
282
+ // Close the file
283
+ fclose(fp);
284
+ }
285
+ style: secondary
286
+ start: 36
287
+ end: 967
288
+ - source : fp = fopen(file.c_str(), "r");
289
+ style : secondary
290
+ start : 118
291
+ end : 148
292
+ - source : fopen(file.c_str(), "r")
293
+ style : secondary
294
+ start : 123
295
+ end : 147
0 commit comments