** Retrieve a single line of input text. ** ** If in==0 then read from standard input and prompt before each line. ** If isContinuation is true, then a continuation prompt is appropriate. ** If isContinuation is zero, then the main prompt should be used. ** ** If zPrior is not NULL then it is a buffer from a prior call to this ** routine that can be reused. ** ** The result is stored in space obta
| 723 | ** zPrior argument for reuse. |
| 724 | */ |
| 725 | static char *one_input_line(FILE *in, char *zPrior, int isContinuation){ |
| 726 | char *zPrompt; |
| 727 | char *zResult; |
| 728 | if( in!=0 ){ |
| 729 | zResult = local_getline(zPrior, in); |
| 730 | }else{ |
| 731 | zPrompt = isContinuation ? continuePrompt : mainPrompt; |
| 732 | #if SHELL_USE_LOCAL_GETLINE |
| 733 | printf("%s", zPrompt); |
| 734 | fflush(stdout); |
| 735 | zResult = local_getline(zPrior, stdin); |
| 736 | #else |
| 737 | free(zPrior); |
| 738 | zResult = shell_readline(zPrompt); |
| 739 | if( zResult && *zResult ) shell_add_history(zResult); |
| 740 | #endif |
| 741 | } |
| 742 | return zResult; |
| 743 | } |
| 744 | |
| 745 | |
| 746 | /* |
no test coverage detected