00001 #ifndef __J2K__JString_Function_HPP__
00002 #define __J2K__JString_Function_HPP__
00003
00004 #include <stdio.h>
00005 #include <string.h>
00006 #include <time.h>
00007 #include <ctype.h>
00008
00009 #if defined(__sun) || defined(__SUN__) || defined( linux )
00010
00011
00012 char* strrev( char* s )
00013 {
00014 if ( s == NULL || *s == '\0' ) return NULL;
00015
00016 register ULONG i = 0;
00017 register ULONG j = strlen( s ) - 1;
00018 j >> 1;
00019
00020 register char c = 0;
00021 while( i < j )
00022 {
00023 c = s[i];
00024 s[i] = s[j];
00025 s[j] = c;
00026 i++;
00027 j--;
00028 }
00029
00030 return s;
00031 }
00032
00033 char* strupr( char* s )
00034 {
00035 if ( s == NULL || *s == '\0' ) return NULL;
00036
00037 ULONG i = 0;
00038 while( s[i] != '\0' ) {
00039 s[i] = (char)toupper( (int)s[i] );
00040 i++;
00041 }
00042 return s;
00043 }
00044
00045 char* strlwr( char* s ) {
00046 if ( s == NULL || *s == '\0' ) return NULL;
00047
00048 ULONG i = 0;
00049 while( s[i] != '\0' ) {
00050 s[i] = (char)tolower( (int)s[i] );
00051 i++;
00052 }
00053
00054 return s;
00055 }
00056
00057 char* _strdate( const char* s ) {
00058 printf("_strdate() function doesn't exist.");
00059 abort();
00060 }
00061
00062 char* _strtime( const char* s ) {
00063 printf( "\n\n[ BETA _strtime() ]\n\n" );
00064 time_t tloc;
00065 time( &tloc );
00066 return asctime( localtime( &tloc ) );
00067 }
00068
00069 char* strnset( const char* s, char c, size_t sz ) {
00070 printf("strnset() function doesn't exist.");
00071 abort();
00072 }
00073
00074 #endif
00075
00076 #endif