X-Git-Url: https://diplodocus.org/git/nmh/blobdiff_plain/a9f9e3d5387e31c404fd24ee71b2a72b005b85eb..7d84b3018062dc30bcb886704012d92712b70f92:/sbr/fmt_scan.c diff --git a/sbr/fmt_scan.c b/sbr/fmt_scan.c index 436b1ec4..c5e9877c 100644 --- a/sbr/fmt_scan.c +++ b/sbr/fmt_scan.c @@ -579,20 +579,25 @@ fmt_scan (struct format *format, charstring_t scanlp, int width, int *dat, case FT_LS_ORDINAL: { int digit = value % 10; + int seconddigit = (value / 10) % 10; const char *suffix; - switch (digit) { - case 1: - suffix = "st"; - break; - case 2: - suffix = "nd"; - break; - case 3: - suffix = "rd"; - break; - default: + if (seconddigit == 1) { suffix = "th"; + } else { + switch (digit) { + case 1: + suffix = "st"; + break; + case 2: + suffix = "nd"; + break; + case 3: + suffix = "rd"; + break; + default: + suffix = "th"; + } } strncpy(buffer, suffix, sizeof(buffer));