| 3875 | */ |
| 3876 | |
| 3877 | static void |
| 3878 | print_json_string( |
| 3879 | ipptool_test_t *data, /* I - Test data */ |
| 3880 | const char *s, /* I - String to print */ |
| 3881 | size_t len) /* I - Length of string */ |
| 3882 | { |
| 3883 | cupsFilePutChar(data->outfile, '\"'); |
| 3884 | while (len > 0) |
| 3885 | { |
| 3886 | switch (*s) |
| 3887 | { |
| 3888 | case '\"' : |
| 3889 | case '\\' : |
| 3890 | cupsFilePutChar(data->outfile, '\\'); |
| 3891 | cupsFilePutChar(data->outfile, *s); |
| 3892 | break; |
| 3893 | |
| 3894 | case '\n' : |
| 3895 | cupsFilePuts(data->outfile, "\\n"); |
| 3896 | break; |
| 3897 | |
| 3898 | case '\r' : |
| 3899 | cupsFilePuts(data->outfile, "\\r"); |
| 3900 | break; |
| 3901 | |
| 3902 | case '\t' : |
| 3903 | cupsFilePuts(data->outfile, "\\t"); |
| 3904 | break; |
| 3905 | |
| 3906 | default : |
| 3907 | if (*s < ' ' && *s >= 0) |
| 3908 | cupsFilePrintf(data->outfile, "\\%03o", *s); |
| 3909 | else |
| 3910 | cupsFilePutChar(data->outfile, *s); |
| 3911 | break; |
| 3912 | } |
| 3913 | |
| 3914 | s ++; |
| 3915 | len --; |
| 3916 | } |
| 3917 | cupsFilePutChar(data->outfile, '\"'); |
| 3918 | } |
| 3919 | |
| 3920 | |
| 3921 | /* |
no test coverage detected