Index: uspace/lib/posix/string.c
===================================================================
--- uspace/lib/posix/string.c	(revision ef6dd3ff76d4e4721f5217c80db03a9033e4a9ec)
+++ uspace/lib/posix/string.c	(revision 491e1ee9881202f1429aea1ba68be1c132608e3c)
@@ -43,21 +43,31 @@
 #include <errno.h>
 
-/* Defined for convenience. Returns pointer to the terminating nul character.
+/**
+ * Defined for convenience. Returns pointer to the terminating nul character.
+ *
+ * @param s
+ * @return
  */
 static char *strzero(const char *s)
 {
-	while (*s != '\0')
-		s ++;
-
-	return (char*) s;
-}
-
-/* Returns true if s2 is a prefix of s1.
+	while (*s != '\0') {
+		s++;
+	}
+
+	return (char *) s;
+}
+
+/**
+ * Returns true if s2 is a prefix of s1.
+ *
+ * @param s1
+ * @param s2
+ * @return
  */
 static bool begins_with(const char *s1, const char *s2)
 {
 	while (*s1 == *s2 && *s2 != '\0') {
-		s1 ++;
-		s2 ++;
+		s1++;
+		s2++;
 	}
 	
@@ -66,11 +76,16 @@
 }
 
-/* The same as strpbrk, except it returns pointer to the nul terminator
+/**
+ * The same as strpbrk, except it returns pointer to the nul terminator
  * if no occurence is found.
+ *
+ * @param s1
+ * @param s2
+ * @return
  */
 static char *strpbrk_null(const char *s1, const char *s2)
 {
 	while (!posix_strchr(s2, *s1)) {
-		++ s1;
+		++s1;
 	}
 	
@@ -82,5 +97,5 @@
  * @param dest
  * @param src
- * @return dest
+ * @return
  */
 char *posix_strcpy(char *dest, const char *src)
@@ -95,5 +110,5 @@
  * @param src
  * @param n
- * @return dest
+ * @return
  */
 char *posix_strncpy(char *dest, const char *src, size_t n)
@@ -114,5 +129,5 @@
 	assert(src != NULL);
 
-	for (size_t i = 0; ; ++ i) {
+	for (size_t i = 0; ; ++i) {
 		dest[i] = src[i];
 		
@@ -139,5 +154,5 @@
 	assert(src != NULL);
 
-	for (size_t i = 0; i < n; ++ i) {
+	for (size_t i = 0; i < n; ++i) {
 		dest[i] = src[i];
 	
@@ -147,5 +162,5 @@
 		if (src[i] == '\0') {
 			char *result = &dest[i];
-			for (++ i; i < n; ++ i) {
+			for (++i; i < n; ++i) {
 				dest[i] = '\0';
 			}
@@ -161,5 +176,5 @@
  * @param dest
  * @param src
- * @return dest
+ * @return
  */
 char *posix_strcat(char *dest, const char *src)
@@ -177,5 +192,5 @@
  * @param src
  * @param n
- * @return dest
+ * @return
  */
 char *posix_strncat(char *dest, const char *src, size_t n)
@@ -198,5 +213,5 @@
  * @return Pointer to the first byte after c in dest if found, NULL otherwise.
  */
-void *posix_memccpy(void *restrict dest, const void *restrict src, int c, size_t n)
+void *posix_memccpy(void *dest, const void *src, int c, size_t n)
 {
 	assert(dest != NULL);
@@ -206,5 +221,5 @@
 	const unsigned char* bsrc = src;
 	
-	for (size_t i = 0; i < n; ++ i) {
+	for (size_t i = 0; i < n; ++i) {
 		bdest[i] = bsrc[i];
 	
@@ -257,5 +272,5 @@
  * @param n
  * @return Difference of the first pair of inequal bytes,
- *          or 0 if areas have the same content
+ *     or 0 if areas have the same content
  */
 int posix_memcmp(const void *mem1, const void *mem2, size_t n)
@@ -267,5 +282,5 @@
 	const unsigned char *s2 = mem2;
 	
-	for (size_t i = 0; i < n; ++ i) {
+	for (size_t i = 0; i < n; ++i) {
 		if (s1[i] != s2[i]) {
 			return s2[i] - s1[i];
@@ -302,5 +317,5 @@
 	assert(s2 != NULL);
 
-	for (size_t i = 0; i < n; ++ i) {
+	for (size_t i = 0; i < n; ++i) {
 		if (s1[i] != s2[i]) {
 			return s2[i] - s1[i];
@@ -327,5 +342,5 @@
 	const unsigned char *s = mem;
 	
-	for (size_t i = 0; i < n; ++ i) {
+	for (size_t i = 0; i < n; ++i) {
 		if (s[i] == (unsigned char) c) {
 			return (void *) &s[i];
@@ -346,13 +361,15 @@
 	
 	/* special handling for the case that zero is searched for */
-	if (c == '\0')
+	if (c == '\0') {
 		return strzero(s);
+	}
 	
 	/* otherwise just loop through the string until found */
 	while (*s != (char) c) {
-		if (*s == '\0')
+		if (*s == '\0') {
 			return NULL;
-
-		s ++;
+		}
+
+		s++;
 	}
 	
@@ -374,8 +391,9 @@
 	/* the same as in strchr, except it loops in reverse direction */
 	while (*ptr != (char) c) {
-		if (ptr == s)
+		if (ptr == s) {
 			return NULL;
-
-		ptr ++;
+		}
+
+		ptr++;
 	}
 
@@ -425,7 +443,8 @@
 
 	const char *ptr;
-	for (ptr = s1; *ptr != '\0'; ++ ptr) {
-		if (!posix_strchr(s2, *ptr))
+	for (ptr = s1; *ptr != '\0'; ++ptr) {
+		if (!posix_strchr(s2, *ptr)) {
 			break;
+		}
 	}
 	return ptr - s1;
@@ -444,14 +463,16 @@
 
 	/* special case - needle is an empty string */
-	if (*s2 == '\0')
+	if (*s2 == '\0') {
 		return (char *) s1;
+	}
 
 	// TODO: use faster algorithm
 	/* check for prefix from every position - quadratic complexity */
 	while (*s1 != '\0') {
-		if (begins_with(s1, s2))
+		if (begins_with(s1, s2)) {
 			return (char *) s1;
+		}
 		
-		s1 ++;
+		s1++;
 	}
 	
@@ -489,6 +510,7 @@
 	size_t len = posix_strlen(s2);
 
-	if (n > len)
+	if (n > len) {
 		posix_strcpy(s1, s2);
+	}
 
 	return len;
@@ -503,6 +525,7 @@
 {
 	/* uses function from libc, we just have to negate errno
-	   (POSIX uses positive errorcodes, HelenOS has negative) */
-	return (char *) str_error (-errnum);
+	 * (POSIX uses positive errorcodes, HelenOS has negative)
+	 */
+	return (char *) str_error(-errnum);
 }
 
@@ -510,6 +533,6 @@
  *
  * @param errnum Error code
- * @param buf    Buffer to store a human readable string to
- * @param bufsz  Size of buffer pointed to by buf
+ * @param buf Buffer to store a human readable string to
+ * @param bufsz Size of buffer pointed to by buf
  * @return
  */
@@ -552,5 +575,5 @@
 	assert(s != NULL);
 	
-	for (size_t sz = 0; sz < n; ++ sz) {
+	for (size_t sz = 0; sz < n; ++sz) {
 		
 		if (s[sz] == '\0') {
