Subversion Repositories HelenOS

Compare Revisions

Ignore whitespace Rev 4012 → Rev 4013

/trunk/kernel/generic/include/string.h
41,10 → 41,8
extern int strcmp(const char *src, const char *dst);
extern int strncmp(const char *src, const char *dst, size_t len);
extern void strncpy(char *dest, const char *src, size_t len);
extern char *strcpy(char *dest, const char *src);
 
extern char *strchr(const char *s, int i);
extern char *strrchr(const char *s, int i);
 
#endif
 
/trunk/kernel/generic/src/proc/task.c
274,7 → 274,7
return (unative_t) rc;
 
namebuf[name_len] = '\0';
strcpy(TASK->name, namebuf);
strncpy(TASK->name, namebuf, TASK_NAME_BUFLEN);
 
return EOK;
}
/trunk/kernel/generic/src/lib/string.c
141,26 → 141,6
dest[i - 1] = '\0';
}
 
/** Copy string.
*
* Copy string from src address to dst address. The copying is done
* char-by-char until the null character. The source and destination memory
* areas cannot overlap.
*
* @param src Source string to copy from.
* @param dst Destination string to copy to.
*
* @return Address of the destination string.
*/
char *strcpy(char *dest, const char *src)
{
char *orig = dest;
while ((*dest++ = *src++) != '\0');
 
return orig;
}
 
/** Find first occurence of character in string.
*
* @param s String to search.
178,29 → 158,5
return NULL;
}
 
/** Find last occurence of character in string.
*
* @param s String to search.
* @param i Character to look for.
*
* @return Pointer to character in @a s or NULL if not found.
*/
extern char *strrchr(const char *s, int i)
{
const char *start;
 
start = s;
if (*s == '\0') return NULL;
 
while (*s != '\0') ++s;
 
while (s != start) {
--s;
if (*s == i) return (char *) s;
}
 
return NULL;
}
 
/** @}
*/