| | 291 | |
| | 292 | /* \fn proc_read_line(command, index) |
| | 293 | * \param[in] proc command to execute |
| | 294 | * \param[in] index return this line |
| | 295 | * \return string |
| | 296 | */ |
| | 297 | char *proc_read_line(char *command, int index) { |
| | 298 | int lines = proc_open(command); |
| | 299 | char *line = NULL; |
| | 300 | |
| | 301 | if (lines >= 0) { |
| | 302 | if (index <= lines) { |
| | 303 | line = (char*)malloc(strlen(file_line_get(index)) + 1); |
| | 304 | if (line) { |
| | 305 | strcpy(line, file_line_get(index)); |
| | 306 | } |
| | 307 | } |
| | 308 | file_free(); |
| | 309 | } |
| | 310 | |
| | 311 | return line; |
| | 312 | } |
| | 313 | |
| | 314 | /* \fn file_read_line(command, index) |
| | 315 | * \param[in] file to be read |
| | 316 | * \param[in] index return this line |
| | 317 | * \return string |
| | 318 | */ |
| | 319 | char *file_read_line(char *file, int index) { |
| | 320 | int lines = file_open(file); |
| | 321 | char *line = NULL; |
| | 322 | |
| | 323 | if (lines >= 0) { |
| | 324 | if (index <= lines) { |
| | 325 | line = (char*)malloc(strlen(file_line_get(index)) + 1); |
| | 326 | if (line) { |
| | 327 | strcpy(line, file_line_get(index)); |
| | 328 | } |
| | 329 | } |
| | 330 | file_free(); |
| | 331 | } |
| | 332 | |
| | 333 | return line; |
| | 334 | } |