| 1 |
#include "comparer.h" |
| 2 |
|
| 3 |
#ifndef COMPARER_INCLUDED |
| 4 |
#error "comparer.h not included" |
| 5 |
#endif |
| 6 |
|
| 7 |
/* This converts foo\\\\bar\\\\ to "foo\\bar\\" (string literal) */ |
| 8 |
#define Q(x) #x |
| 9 |
#define QUOTE(x) Q(x) |
| 10 |
|
| 11 |
#define COMPARE_WITH "foo\\bar\\" /* This is the literal `foo\bar\` */ |
| 12 |
|
| 13 |
int main(void) { |
| 14 |
if(strcmp(QUOTE(DEF_WITH_BACKSLASH), COMPARE_WITH)) { |
| 15 |
printf("Arg string is quoted incorrectly: %s instead of %s\n", |
| 16 |
QUOTE(DEF_WITH_BACKSLASH), COMPARE_WITH); |
| 17 |
return 1; |
| 18 |
} |
| 19 |
return 0; |
| 20 |
} |