Hmm =0 for in list choices, hmm=1 for end of list choices. */ Return equals 0 to continue, -1 to stop, otherwise a number. */
| 121 | /* Hmm =0 for in list choices, hmm=1 for end of list choices. */ |
| 122 | /* Return equals 0 to continue, -1 to stop, otherwise a number. */ |
| 123 | int ListChoice(int hmm) |
| 124 | { |
| 125 | char buf[32]; |
| 126 | |
| 127 | if(!hmm) |
| 128 | { |
| 129 | int num=0; |
| 130 | |
| 131 | tryagain: |
| 132 | printf(" <'Enter' to continue, (S)top, or enter a number.> "); |
| 133 | if ( fgets(buf,ARRAY_SIZE(buf),stdin) == nullptr ) |
| 134 | { |
| 135 | return -1; |
| 136 | } |
| 137 | if(buf[0]=='s' || buf[0]=='S') return(-1); |
| 138 | if(buf[0]=='\n') return(0); |
| 139 | if(!sscanf(buf,"%d",&num)) |
| 140 | return(0); |
| 141 | if(num<1) goto tryagain; |
| 142 | return(num); |
| 143 | } |
| 144 | else |
| 145 | { |
| 146 | int num=0; |
| 147 | |
| 148 | tryagain2: |
| 149 | printf(" <'Enter' to make no selection or enter a number.> "); |
| 150 | if ( fgets(buf,ARRAY_SIZE(buf),stdin) == nullptr ) |
| 151 | { |
| 152 | return -1; |
| 153 | } |
| 154 | if(buf[0]=='\n') return(0); |
| 155 | if(!sscanf(buf,"%d",&num)) |
| 156 | return(0); |
| 157 | if(num<1) goto tryagain2; |
| 158 | return(num); |
| 159 | } |
| 160 | } |
| 161 | |
| 162 | int EndListShow(void) |
| 163 | { |
no outgoing calls
no test coverage detected