update for HEAD-2003091401
[reactos.git] / lib / msvcrt / string / strrev.c
index d36b7a3..8827c3b 100644 (file)
@@ -1,18 +1,22 @@
 #include <msvcrt/string.h>
 
+/*
+ * @implemented
+ */
 char * _strrev(char *s)
 {
-       char  *e;
-       char   a;
-       e=s;
+       char a, *b, *e;
+       b=e=s;
        while (*e)
                e++;
-       while (s<e) {
-               a=*s;
-               *s=*e;
+       e--; /* start at last char, not NULL char */
+       while ( b < e )
+       {
+               a=*b;
+               *b=*e;
                *e=a;
-               s++;
+               b++;
                e--;
        }
-       return s;
+       return s; /* return ptr to beginning of string */
 }