Skip to content
Snippets Groups Projects
Commit 6eb20859 authored by rswindell's avatar rswindell
Browse files

Replaced my brute force strrev() with a much "finer" example submitted by amcleod.

parent 582388ff
No related branches found
No related tags found
No related merge requests found
......@@ -265,29 +265,23 @@ char* DLLCALL ultoa(ulong val, char* str, int radix)
#endif
/****************************************************************************/
/* Reverse characters of a string */
/* Reverse characters of a string (provided by amcleod) */
/****************************************************************************/
#ifdef __unix__
char* strrev(char* str)
{
char* newstr;
int i;
int len;
len=strlen(str);
if((newstr=malloc(len+1))==NULL)
return(str);
for(i=0;i<len;i++)
newstr[i]=str[len-(i+1)];
newstr[i]=0;
strcpy(str,newstr);
free(newstr);
return(str);
char t, *i=str, *j=str+strlen(str);
while (i<j) {
t=*i; *(i++)=*(--j); *j=t;
}
return str;
}
#endif
/****************************************************************************/
/* Create an absolute or full path name for the specified relative path. */
/* e.g. convert "/sbbs/node1/../data" to "/sbbs/data/" */
/****************************************************************************/
#ifdef __unix__
char* _fullpath(char* absPath, const char* relPath, size_t maxLength)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment