Tokenizer that handles two delimiters by returning an empty string. First param (input) is a string to be tokenized, second is a delimiter (input) This tokenizer accepts only one delimiter! \param s - string to divide on first run, NULL on each next \param delim - delimiter \return pointer to token, or NULL if there are no more tokens \sa "man strtok" */
| 259 | \sa "man strtok" |
| 260 | */ |
| 261 | static char *mystrtok(char *s, char delim) |
| 262 | { |
| 263 | static size_t pos = 0, length = 0; |
| 264 | static char *str = 0; |
| 265 | size_t i, ent_pos; |
| 266 | |
| 267 | if (s != NULL) |
| 268 | { |
| 269 | str = s; |
| 270 | pos = 0; |
| 271 | length = strlen(str); |
| 272 | } |
| 273 | else |
| 274 | { |
| 275 | return NULL; |
| 276 | } |
| 277 | |
| 278 | if (str && str[ pos + 1 ] == '\0') |
| 279 | { |
| 280 | return NULL; |
| 281 | } |
| 282 | |
| 283 | ent_pos = pos; |
| 284 | |
| 285 | for (i = pos; i < length;) |
| 286 | { |
| 287 | if (str[i] == delim) |
| 288 | { |
| 289 | str[i] = '\0'; |
| 290 | pos = i + 1; |
| 291 | return str + ent_pos; |
| 292 | } |
| 293 | else |
| 294 | { |
| 295 | i++; |
| 296 | } |
| 297 | } |
| 298 | |
| 299 | return str + ent_pos; |
| 300 | } |
| 301 | |
| 302 | |
| 303 | static int print_parm_name(RIG *rig, |