Frees allocated memory and sets pointers to NULL before calling readline * and then parses the input into space separated tokens. */
| 339 | * and then parses the input into space separated tokens. |
| 340 | */ |
| 341 | static void rp_getline(const char *s) |
| 342 | { |
| 343 | int i; |
| 344 | |
| 345 | /* free allocated memory and set pointers to NULL */ |
| 346 | if (input_line) |
| 347 | { |
| 348 | free(input_line); |
| 349 | input_line = (char *)NULL; |
| 350 | } |
| 351 | |
| 352 | if (result) |
| 353 | { |
| 354 | result = (char *)NULL; |
| 355 | } |
| 356 | |
| 357 | /* cmd, arg1, arg2, arg3, arg4, arg5, arg6 |
| 358 | * arg5 and arg 6 are currently unused. |
| 359 | */ |
| 360 | for (i = 0; i < 7; i++) |
| 361 | { |
| 362 | parsed_input[i] = NULL; |
| 363 | } |
| 364 | |
| 365 | /* Action! Returns typed line with newline stripped. */ |
| 366 | input_line = readline(s); |
| 367 | } |
| 368 | #endif |
| 369 | |
| 370 |