gcc/testsuite/gcc.target/arc/pr9001090948.c
raw| 1 | /* { dg-do compile } */ |
| 2 | /* { dg-skip-if "ARC600 doesn't support pic" { arc6xx } } */ |
| 3 | /* { dg-options "-Os -fPIC" } */ |
| 4 | #include <stdio.h> |
| 5 | #include <string.h> |
| 6 | |
| 7 | char * |
| 8 | strip_trail (const char str[], size_t n) |
| 9 | { |
| 10 | static char buf[1025]; |
| 11 | int j; |
| 12 | |
| 13 | strncpy (buf, str, n); |
| 14 | buf[n] = '\0'; |
| 15 | |
| 16 | for (j = strlen (buf) - 1; j >= 0; j--) |
| 17 | { |
| 18 | if (buf[j] != ' ') |
| 19 | break; |
| 20 | |
| 21 | buf[j] = '\0'; |
| 22 | } |
| 23 | |
| 24 | return buf; |
| 25 | } |