Changeset 7afb4a5 in mainline
- Timestamp:
- 2009-04-09T21:28:50Z (16 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 095003a8
- Parents:
- 92fd52d7
- Location:
- uspace
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/libc/generic/getopt.c
r92fd52d7 r7afb4a5 242 242 } 243 243 if ((optchar = (int)*place++) == (int)':' || 244 (oli = str chr(options + (IGNORE_FIRST ? 1 : 0), optchar)) == NULL) {244 (oli = str_chr(options + (IGNORE_FIRST ? 1 : 0), optchar)) == NULL) { 245 245 /* option letter unknown or ':' */ 246 246 if (!*place) … … 378 378 return -1; 379 379 } 380 if ((has_equal = str chr(current_argv, '=')) != NULL) {380 if ((has_equal = str_chr(current_argv, '=')) != NULL) { 381 381 /* argument found (--option=arg) */ 382 382 current_argv_len = has_equal - current_argv; -
uspace/lib/libc/generic/string.c
r92fd52d7 r7afb4a5 536 536 * 537 537 * @return Pointer to character in @a str or NULL if not found. 538 *539 538 */ 540 539 const char *str_chr(const char *str, wchar_t ch) … … 549 548 550 549 return NULL; 550 } 551 552 /** Find last occurence of character in string. 553 * 554 * @param str String to search. 555 * @param ch Character to look for. 556 * 557 * @return Pointer to character in @a str or NULL if not found. 558 */ 559 const char *str_rchr(const char *str, wchar_t ch) 560 { 561 wchar_t acc; 562 size_t off = 0; 563 char *res; 564 565 res = NULL; 566 while ((acc = str_decode(str, &off, STR_NO_LIMIT)) != 0) { 567 if (acc == ch) 568 res = (str + off); 569 } 570 571 return res; 551 572 } 552 573 … … 626 647 627 648 return (tolower(a[c]) - tolower(b[c])); 628 }629 630 /** Return pointer to the first occurence of character c in string.631 *632 * @param str Scanned string.633 * @param c Searched character (taken as one byte).634 * @return Pointer to the matched character or NULL if it is not635 * found in given string.636 */637 char *strchr(const char *str, int c)638 {639 while (*str != '\0') {640 if (*str == (char) c)641 return (char *) str;642 str++;643 }644 645 return NULL;646 }647 648 /** Return pointer to the last occurence of character c in string.649 *650 * @param str Scanned string.651 * @param c Searched character (taken as one byte).652 * @return Pointer to the matched character or NULL if it is not653 * found in given string.654 */655 char *strrchr(const char *str, int c)656 {657 char *retval = NULL;658 659 while (*str != '\0') {660 if (*str == (char) c)661 retval = (char *) str;662 str++;663 }664 665 return (char *) retval;666 649 } 667 650 … … 870 853 871 854 /* Skip over leading delimiters. */ 872 while (*s && (str chr(delim, *s) != NULL)) ++s;855 while (*s && (str_chr(delim, *s) != NULL)) ++s; 873 856 start = s; 874 857 875 858 /* Skip over token characters. */ 876 while (*s && (str chr(delim, *s) == NULL)) ++s;859 while (*s && (str_chr(delim, *s) == NULL)) ++s; 877 860 end = s; 878 861 *next = (*s ? s + 1 : s); -
uspace/lib/libc/include/string.h
r92fd52d7 r7afb4a5 74 74 75 75 extern const char *str_chr(const char *str, wchar_t ch); 76 extern const char *str_rchr(const char *str, wchar_t ch); 76 77 77 78 extern bool wstr_linsert(wchar_t *str, wchar_t ch, count_t pos, count_t max_pos); … … 92 93 extern char *strdup(const char *); 93 94 94 extern char *strchr(const char *, int);95 extern char *strrchr(const char *, int);96 97 95 extern long int strtol(const char *, char **, int); 98 96 extern unsigned long strtoul(const char *, char **, int); -
uspace/srv/fs/fat/fat_dentry.c
r92fd52d7 r7afb4a5 67 67 if (!(rc = stricmp(name, component))) 68 68 return rc; 69 if (!str chr(name, '.')) {69 if (!str_chr(name, '.')) { 70 70 /* 71 71 * There is no '.' in the name, so we know that there is enough -
uspace/srv/loader/main.c
r92fd52d7 r7afb4a5 276 276 277 277 /* Set the task name. */ 278 cp = str rchr(pathname, '/');278 cp = str_rchr(pathname, '/'); 279 279 cp = (cp == NULL) ? pathname : (cp + 1); 280 280 task_set_name(cp);
Note:
See TracChangeset
for help on using the changeset viewer.