linux/bootstrap: use Forbid/Permit only when thread is main AROS thread
[AROS.git] / compiler / stdc / strrev.c
blobea00c8c8ca1ba8aff2cff997c6a49cdbe78628f2
1 /*
2 Copyright © 1995-2012, The AROS Development Team. All rights reserved.
3 $Id$
5 SAS/C function strrev().
6 */
8 /*****************************************************************************
10 NAME */
11 #include <string.h>
13 char * strrev (
15 /* SYNOPSIS */
16 char * s)
18 /* FUNCTION
19 Reverse a string (rotate it about its midpoint)
21 INPUTS
22 s - The string to be reversed
24 RESULT
25 The original string pointer
27 NOTES
28 SAS C specific
30 EXAMPLE
31 char buffer[64];
33 strcpy (buffer, "Hello);
34 strrev(buffer);
36 // buffer now contains "olleH"
39 BUGS
41 SEE ALSO
43 INTERNALS
45 ******************************************************************************/
47 char *start, *end, c1, c2;
49 start = end = s;
51 while(*end) end++;
52 end--;
54 while(end > start)
56 c1 = *start;
57 c2 = *end;
59 *start++ = c2;
60 *end-- = c1;
63 return s;
65 } /* strrev */