Added strrev function to getch.c
This commit is contained in:
parent
382ca844d5
commit
95c5b66fdc
|
@ -4,6 +4,22 @@
|
|||
#include <stdlib.h>
|
||||
static struct termios oldattr;
|
||||
|
||||
static char *strrev(char *str)
|
||||
{
|
||||
char *p1, *p2;
|
||||
|
||||
if (! str || ! *str)
|
||||
return str;
|
||||
for (p1 = str, p2 = str + wcslen(str) - 1; p2 > p1; ++p1, --p2)
|
||||
{
|
||||
*p1 ^= *p2;
|
||||
*p2 ^= *p1;
|
||||
*p1 ^= *p2;
|
||||
}
|
||||
return str;
|
||||
}
|
||||
|
||||
|
||||
static void setRawMode(void)
|
||||
{
|
||||
struct termios newattr;
|
||||
|
|
Loading…
Reference in New Issue