crete an idle task to run when theres ... umm. .. nothing to do ..
[AROS.git] / compiler / clib / strrev.c
blob80dbf3d2be59ffae5fdbfc36317599c20772805f
1 /*
2 Copyright © 1995-2001, The AROS Development Team. All rights reserved.
3 $Id$
5 SAS C function strrev().
6 */
8 #include <stdio.h>
10 /*****************************************************************************
12 NAME */
13 #include <string.h>
15 char * strrev (
17 /* SYNOPSIS */
18 char * s)
20 /* FUNCTION
21 Reverse a string (rotate it about its midpoint)
23 INPUTS
24 s - The string to be reversed
26 RESULT
27 The original string pointer
29 NOTES
30 SAS C specific
32 EXAMPLE
33 char buffer[64];
35 strcpy (buffer, "Hello);
36 strrev(buffer);
38 // buffer now contains "olleH"
41 BUGS
43 SEE ALSO
45 INTERNALS
47 ******************************************************************************/
49 char *start, *end, c1, c2;
51 start = end = s;
53 while(*end) end++;
54 end--;
56 while(end > start)
58 c1 = *start;
59 c2 = *end;
61 *start++ = c2;
62 *end-- = c1;
65 return s;
67 } /* strrev */