Various Changes
[tpg/acess2.git] / Usermode / Libraries / ld-acess.so_src / lib.c
index 0d01dc2..3acc129 100644 (file)
@@ -6,25 +6,57 @@
 #include "common.h"\r
 \r
 // === CODE ===\r
-void strcpy(char *dest, char *src)\r
+char *strcpy(char *dest, const char *src)\r
 {\r
+       char    *ret = dest;\r
        while(*src) {\r
                *dest = *src;\r
                src ++; dest ++;\r
        }\r
        *dest = '\0';\r
+       return ret;\r
+}\r
+\r
+char *strcat(char *dest, const char *src)\r
+{\r
+       char    *ret = dest;\r
+       while(*dest)    dest++;\r
+       while(*src)             *dest++ = *src++;\r
+       *dest = '\0';\r
+       return ret;\r
 }
-
-int strcmp(char *s1, char *s2)
+\r
+/**\r
+ * \fn int strcmp(const char *s1, const char *s2)\r
+ * \brief Compare two strings\r
+ */
+int strcmp(const char *s1, const char *s2)
 {
        while(*s1 && *s1 == *s2) s1++,s2++;
        return *s1-*s2;
 }\r
 \r
-int strlen(char *str)\r
+/**\r
+ * \fn int strlen(const char *str)\r
+ * \brief \r
+ */\r
+int strlen(const char *str)\r
 {\r
         int    len = 0;\r
        while(*str)     len++,str++;\r
        return len;\r
 }
-
+\r
+/**\r
+ * \fn int file_exists(char *filename)\r
+ * \brief Checks if a file exists\r
+ */
+int file_exists(char *filename)\r
+{\r
+        int    fd;\r
+        //fd = open(filename, OPENFLAG_READ);\r
+        fd = open(filename, 0);\r
+        if(fd == -1)   return 0;\r
+        close(fd);\r
+        return 1;\r
+}\r

UCC git Repository :: git.ucc.asn.au