1
/* $Id: strrev.c,v 1.1 2007/03/01 13:10:55 dmix Exp $ */
10
#ifndef __AVR__ /* strrev() is't a standart function */
11
char * strrev (char *s)
15
for (p2 = s; *p2; ) p2++;
27
void Check (int line, const char *s, const char *expect)
35
if (strlen_P(s) > sizeof(t) - 1)
43
if (strcmp_P (t, expect)) {
47
p = (char *)s; /* change strings */
54
printf ("\nLine %d: expect: \"%s\""
55
"\n result: \"%s\"\n",
57
if (code > 255) code = 255;
64
#define CHECK(s, expect) do { \
65
Check (__LINE__, PSTR(s), PSTR(expect)); \
75
CHECK ("\001", "\001");
76
CHECK ("\377", "\377");
82
/* 3 and more chars long */
84
CHECK ("qwer", "rewq");
85
CHECK ("12345", "54321");
86
CHECK ("[];'./", "/.';][");
87
CHECK ("\001\177\200\201\377", "\377\201\200\177\001");
88
CHECK ("The quick brown fox jumps over the lazy dog.",
89
".god yzal eht revo spmuj xof nworb kciuq ehT");
91
/* Very long string. */
92
CHECK ("1..............................................................2"
93
"3..............................................................4"
94
"5..............................................................6"
95
"7..............................................................",
96
"..............................................................7"
97
"6..............................................................5"
98
"4..............................................................3"
99
"2..............................................................1");
101
CHECK ("1..............................................................2"
102
"3..............................................................4"
103
"5..............................................................6"
104
"7..............................................................8",
105
"8..............................................................7"
106
"6..............................................................5"
107
"4..............................................................3"
108
"2..............................................................1");
110
CHECK ("1..............................................................2"
111
"3..............................................................4"
112
"5..............................................................6"
113
"7..............................................................89",
114
"98..............................................................7"
115
"6..............................................................5"
116
"4..............................................................3"
117
"2..............................................................1");