Update of /cvsroot/subtrick/TiTan/src/lib/ansi
In directory usw-pr-cvs1:/tmp/cvs-serv31389
Modified Files:
Makefile m_memchr.c m_memcpy.c memchr.c memcmp.c memcpy.c
memset.c strcat.c strchr.c strlen.c
Log Message:
Improved some clibs. I hope :)
Index: Makefile
===================================================================
RCS file: /cvsroot/subtrick/TiTan/src/lib/ansi/Makefile,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** Makefile 28 Aug 2002 15:32:36 -0000 1.1
--- Makefile 30 Aug 2002 19:40:25 -0000 1.2
***************
*** 3,7 ****
! all: memcpy memchr memcmp memset strcat strchr strlen strcpy
memchr:
--- 3,8 ----
! all: memcpy memchr memcmp memset strcat strchr strlen strcpy \
! isalpha isdigit isspace islower isupper
memchr:
***************
*** 29,35 ****
$(CC) -c strcpy.c
$(CC) m_strcpy.c strcpy.o -o strcpy.out
clean:
rm *.o
! rm *.out
--- 30,52 ----
$(CC) -c strcpy.c
$(CC) m_strcpy.c strcpy.o -o strcpy.out
+ isalpha:
+ $(CC) -c isalpha.c
+ $(CC) m_isalpha.c isalpha.o -o isalpha.out
+ isdigit:
+ $(CC) -c isdigit.c
+ $(CC) m_isdigit.c isdigit.o -o isdigit.out
+ isspace:
+ $(CC) -c isspace.c
+ $(CC) m_isspace.c isspace.o -o isspace.out
+ islower:
+ $(CC) -c islower.c
+ $(CC) m_islower.c islower.o -o islower.out
+ isupper:
+ $(CC) -c isupper.c
+ $(CC) m_isupper.c isupper.o -o isupper.out
+
clean:
rm *.o
! rm *.out
Index: m_memchr.c
===================================================================
RCS file: /cvsroot/subtrick/TiTan/src/lib/ansi/m_memchr.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** m_memchr.c 28 Aug 2002 15:32:36 -0000 1.1
--- m_memchr.c 30 Aug 2002 19:40:25 -0000 1.2
***************
*** 5,13 ****
{
char x[] = "123456A7890";
! char s = 'A';
char *ret;
! ret = (char *) memchr(x, s, 7);
if( ret == NULL)
printf(" out of range\n");
--- 5,13 ----
{
char x[] = "123456A7890";
! char s = '7';
char *ret;
! ret = (char *) memchr(x, s, 9);
if( ret == NULL)
printf(" out of range\n");
Index: m_memcpy.c
===================================================================
RCS file: /cvsroot/subtrick/TiTan/src/lib/ansi/m_memcpy.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** m_memcpy.c 28 Aug 2002 15:32:36 -0000 1.1
--- m_memcpy.c 30 Aug 2002 19:40:25 -0000 1.2
***************
*** 10,14 ****
ret = (char *) memcpy( x, y, 9);
! printf("x=%s,y=%s,ret=%d\n",x,y,ret);
}
--- 10,14 ----
ret = (char *) memcpy( x, y, 9);
! printf("dest=%s,source=%s,\n",x,y);
}
Index: memchr.c
===================================================================
RCS file: /cvsroot/subtrick/TiTan/src/lib/ansi/memchr.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** memchr.c 28 Aug 2002 15:32:36 -0000 1.1
--- memchr.c 30 Aug 2002 19:40:25 -0000 1.2
***************
*** 27,31 ****
if(n > 0) //Check the Restriction
! for(; n != 0; n--){
if(*mem2search++ == (unsigned char) c)
return (void*) --mem2search;
--- 27,31 ----
if(n > 0) //Check the Restriction
! for(; n ; n--){
if(*mem2search++ == (unsigned char) c)
return (void*) --mem2search;
Index: memcmp.c
===================================================================
RCS file: /cvsroot/subtrick/TiTan/src/lib/ansi/memcmp.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** memcmp.c 28 Aug 2002 15:32:36 -0000 1.1
--- memcmp.c 30 Aug 2002 19:40:25 -0000 1.2
***************
*** 32,36 ****
if(n > 0) //Check the Restriction
! for(; n != 0; n--){
if( *s1++ != *s2++)
return (*--s1 - *--s2);
--- 32,36 ----
if(n > 0) //Check the Restriction
! for(; n ; n--){
if( *s1++ != *s2++)
return (*--s1 - *--s2);
Index: memcpy.c
===================================================================
RCS file: /cvsroot/subtrick/TiTan/src/lib/ansi/memcpy.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** memcpy.c 28 Aug 2002 15:32:36 -0000 1.1
--- memcpy.c 30 Aug 2002 19:40:25 -0000 1.2
***************
*** 29,35 ****
if(n > 0) //Check the Restriction
! for(; n != 0; n--){
*to++ = *from++;
- }
return dest; //Allways Returns dest
--- 29,34 ----
if(n > 0) //Check the Restriction
! for(; n ; n--)
*to++ = *from++;
return dest; //Allways Returns dest
Index: memset.c
===================================================================
RCS file: /cvsroot/subtrick/TiTan/src/lib/ansi/memset.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** memset.c 28 Aug 2002 15:32:36 -0000 1.1
--- memset.c 30 Aug 2002 19:40:25 -0000 1.2
***************
*** 29,35 ****
if(n > 0) //Check the Restriction
! for(; n != 0; n--){
*s++ = (unsigned char) c;
! }
return ptr;
}
--- 29,35 ----
if(n > 0) //Check the Restriction
! for(; n ; n--)
*s++ = (unsigned char) c;
!
return ptr;
}
Index: strcat.c
===================================================================
RCS file: /cvsroot/subtrick/TiTan/src/lib/ansi/strcat.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** strcat.c 28 Aug 2002 15:32:36 -0000 1.1
--- strcat.c 30 Aug 2002 19:40:25 -0000 1.2
***************
*** 28,34 ****
char *p = dest;
! while (*p++ != (char)NULL);
p--;
while ( *p++ = *src++);
return dest ;
}
--- 28,35 ----
char *p = dest;
! while (*p++);
p--;
while ( *p++ = *src++);
+
return dest ;
}
Index: strchr.c
===================================================================
RCS file: /cvsroot/subtrick/TiTan/src/lib/ansi/strchr.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** strchr.c 28 Aug 2002 15:32:36 -0000 1.1
--- strchr.c 30 Aug 2002 19:40:25 -0000 1.2
***************
*** 29,33 ****
while (c != *ptr)
{
! if (*ptr++ == (char)NULL)
return NULL;
}
--- 29,33 ----
while (c != *ptr)
{
! if (*ptr++)
return NULL;
}
Index: strlen.c
===================================================================
RCS file: /cvsroot/subtrick/TiTan/src/lib/ansi/strlen.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** strlen.c 28 Aug 2002 15:32:36 -0000 1.1
--- strlen.c 30 Aug 2002 19:40:25 -0000 1.2
***************
*** 27,31 ****
size_t return_val = 0;
! for (; *ptr++ != (char) NULL ; return_val++);
return return_val;
}
--- 27,31 ----
size_t return_val = 0;
! for (; *ptr++ ; return_val++);
return return_val;
}
|