ab4bc8a24e
Move some of the RHEL QE testcases upstream to Fedora.
358 lines
9.1 KiB
C
358 lines
9.1 KiB
C
#include <wchar.h>
|
|
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
#include <string.h>
|
|
#include <locale.h>
|
|
|
|
wchar_t *numbers[301] = {
|
|
L"zero\n",
|
|
L"one\n",
|
|
L"two\n",
|
|
L"three\n",
|
|
L"four\n",
|
|
L"five\n",
|
|
L"six\n",
|
|
L"seven\n",
|
|
L"eight\n",
|
|
L"nine\n",
|
|
L"ten\n",
|
|
L"eleven\n",
|
|
L"twelve\n",
|
|
L"thirteen\n",
|
|
L"fourteen\n",
|
|
L"fifteen\n",
|
|
L"sixteen\n",
|
|
L"seventeen\n",
|
|
L"eighteen\n",
|
|
L"nineteen\n",
|
|
L"twenty\n",
|
|
L"twenty one\n",
|
|
L"twenty two\n",
|
|
L"twenty three\n",
|
|
L"twenty four\n",
|
|
L"twenty five\n",
|
|
L"twenty six\n",
|
|
L"twenty seven\n",
|
|
L"twenty eight\n",
|
|
L"twenty nine\n",
|
|
L"thirty\n",
|
|
L"thirty one\n",
|
|
L"thirty two\n",
|
|
L"thirty three\n",
|
|
L"thirty four\n",
|
|
L"thirty five\n",
|
|
L"thirty six\n",
|
|
L"thirty seven\n",
|
|
L"thirty eight\n",
|
|
L"thirty nine\n",
|
|
L"forty\n",
|
|
L"forty one\n",
|
|
L"forty two\n",
|
|
L"forty three\n",
|
|
L"forty four\n",
|
|
L"forty five\n",
|
|
L"forty six\n",
|
|
L"forty seven\n",
|
|
L"forty eight\n",
|
|
L"forty nine\n",
|
|
L"fifty\n",
|
|
L"fifty one\n",
|
|
L"fifty two\n",
|
|
L"fifty three\n",
|
|
L"fifty four\n",
|
|
L"fifty five\n",
|
|
L"fifty six\n",
|
|
L"fifty seven\n",
|
|
L"fifty eight\n",
|
|
L"fifty nine\n",
|
|
L"sixty\n",
|
|
L"sixty one\n",
|
|
L"sixty two\n",
|
|
L"sixty three\n",
|
|
L"sixty four\n",
|
|
L"sixty five\n",
|
|
L"sixty six\n",
|
|
L"sixty seven\n",
|
|
L"sixty eight\n",
|
|
L"sixty nine\n",
|
|
L"seventy\n",
|
|
L"seventy one\n",
|
|
L"seventy two\n",
|
|
L"seventy three\n",
|
|
L"seventy four\n",
|
|
L"seventy five\n",
|
|
L"seventy six\n",
|
|
L"seventy seven\n",
|
|
L"seventy eight\n",
|
|
L"seventy nine\n",
|
|
L"eighty\n",
|
|
L"eighty one\n",
|
|
L"eighty two\n",
|
|
L"eighty three\n",
|
|
L"eighty four\n",
|
|
L"eighty five\n",
|
|
L"eighty six\n",
|
|
L"eighty seven\n",
|
|
L"eighty eight\n",
|
|
L"eighty nine\n",
|
|
L"ninety\n",
|
|
L"ninety one\n",
|
|
L"ninety two\n",
|
|
L"ninety three\n",
|
|
L"ninety four\n",
|
|
L"ninety five\n",
|
|
L"ninety six\n",
|
|
L"ninety seven\n",
|
|
L"ninety eight\n",
|
|
L"ninety nine\n",
|
|
L"one hundred\n",
|
|
L"one hundred and one\n",
|
|
L"one hundred and two\n",
|
|
L"one hundred and three\n",
|
|
L"one hundred and four\n",
|
|
L"one hundred and five\n",
|
|
L"one hundred and six\n",
|
|
L"one hundred and seven\n",
|
|
L"one hundred and eight\n",
|
|
L"one hundred and nine\n",
|
|
L"one hundred and ten\n",
|
|
L"one hundred and eleven\n",
|
|
L"one hundred and twelve\n",
|
|
L"one hundred and thirteen\n",
|
|
L"one hundred and fourteen\n",
|
|
L"one hundred and fifteen\n",
|
|
L"one hundred and sixteen\n",
|
|
L"one hundred and seventeen\n",
|
|
L"one hundred and eighteen\n",
|
|
L"one hundred and nineteen\n",
|
|
L"one hundred and twenty\n",
|
|
L"one hundred and twenty one\n",
|
|
L"one hundred and twenty two\n",
|
|
L"one hundred and twenty three\n",
|
|
L"one hundred and twenty four\n",
|
|
L"one hundred and twenty five\n",
|
|
L"one hundred and twenty six\n",
|
|
L"one hundred and twenty seven\n",
|
|
L"one hundred and twenty eight\n",
|
|
L"one hundred and twenty nine\n",
|
|
L"one hundred and thirty\n",
|
|
L"one hundred and thirty one\n",
|
|
L"one hundred and thirty two\n",
|
|
L"one hundred and thirty three\n",
|
|
L"one hundred and thirty four\n",
|
|
L"one hundred and thirty five\n",
|
|
L"one hundred and thirty six\n",
|
|
L"one hundred and thirty seven\n",
|
|
L"one hundred and thirty eight\n",
|
|
L"one hundred and thirty nine\n",
|
|
L"one hundred and forty\n",
|
|
L"one hundred and forty one\n",
|
|
L"one hundred and forty two\n",
|
|
L"one hundred and forty three\n",
|
|
L"one hundred and forty four\n",
|
|
L"one hundred and forty five\n",
|
|
L"one hundred and forty six\n",
|
|
L"one hundred and forty seven\n",
|
|
L"one hundred and forty eight\n",
|
|
L"one hundred and forty nine\n",
|
|
L"one hundred and fifty\n",
|
|
L"one hundred and fifty one\n",
|
|
L"one hundred and fifty two\n",
|
|
L"one hundred and fifty three\n",
|
|
L"one hundred and fifty four\n",
|
|
L"one hundred and fifty five\n",
|
|
L"one hundred and fifty six\n",
|
|
L"one hundred and fifty seven\n",
|
|
L"one hundred and fifty eight\n",
|
|
L"one hundred and fifty nine\n",
|
|
L"one hundred and sixty\n",
|
|
L"one hundred and sixty one\n",
|
|
L"one hundred and sixty two\n",
|
|
L"one hundred and sixty three\n",
|
|
L"one hundred and sixty four\n",
|
|
L"one hundred and sixty five\n",
|
|
L"one hundred and sixty six\n",
|
|
L"one hundred and sixty seven\n",
|
|
L"one hundred and sixty eight\n",
|
|
L"one hundred and sixty nine\n",
|
|
L"one hundred and seventy\n",
|
|
L"one hundred and seventy one\n",
|
|
L"one hundred and seventy two\n",
|
|
L"one hundred and seventy three\n",
|
|
L"one hundred and seventy four\n",
|
|
L"one hundred and seventy five\n",
|
|
L"one hundred and seventy six\n",
|
|
L"one hundred and seventy seven\n",
|
|
L"one hundred and seventy eight\n",
|
|
L"one hundred and seventy nine\n",
|
|
L"one hundred and eighty\n",
|
|
L"one hundred and eighty one\n",
|
|
L"one hundred and eighty two\n",
|
|
L"one hundred and eighty three\n",
|
|
L"one hundred and eighty four\n",
|
|
L"one hundred and eighty five\n",
|
|
L"one hundred and eighty six\n",
|
|
L"one hundred and eighty seven\n",
|
|
L"one hundred and eighty eight\n",
|
|
L"one hundred and eighty nine\n",
|
|
L"one hundred and ninety\n",
|
|
L"one hundred and ninety one\n",
|
|
L"one hundred and ninety two\n",
|
|
L"one hundred and ninety three\n",
|
|
L"one hundred and ninety four\n",
|
|
L"one hundred and ninety five\n",
|
|
L"one hundred and ninety six\n",
|
|
L"one hundred and ninety seven\n",
|
|
L"one hundred and ninety eight\n",
|
|
L"one hundred and ninety nine\n",
|
|
L"two hundred\n",
|
|
L"two hundred and one\n",
|
|
L"two hundred and two\n",
|
|
L"two hundred and three\n",
|
|
L"two hundred and four\n",
|
|
L"two hundred and five\n",
|
|
L"two hundred and six\n",
|
|
L"two hundred and seven\n",
|
|
L"two hundred and eight\n",
|
|
L"two hundred and nine\n",
|
|
L"two hundred and ten\n",
|
|
L"two hundred and eleven\n",
|
|
L"two hundred and twelve\n",
|
|
L"two hundred and thirteen\n",
|
|
L"two hundred and fourteen\n",
|
|
L"two hundred and fifteen\n",
|
|
L"two hundred and sixteen\n",
|
|
L"two hundred and seventeen\n",
|
|
L"two hundred and eighteen\n",
|
|
L"two hundred and nineteen\n",
|
|
L"two hundred and twenty\n",
|
|
L"two hundred and twenty one\n",
|
|
L"two hundred and twenty two\n",
|
|
L"two hundred and twenty three\n",
|
|
L"two hundred and twenty four\n",
|
|
L"two hundred and twenty five\n",
|
|
L"two hundred and twenty six\n",
|
|
L"two hundred and twenty seven\n",
|
|
L"two hundred and twenty eight\n",
|
|
L"two hundred and twenty nine\n",
|
|
L"two hundred and thirty\n",
|
|
L"two hundred and thirty one\n",
|
|
L"two hundred and thirty two\n",
|
|
L"two hundred and thirty three\n",
|
|
L"two hundred and thirty four\n",
|
|
L"two hundred and thirty five\n",
|
|
L"two hundred and thirty six\n",
|
|
L"two hundred and thirty seven\n",
|
|
L"two hundred and thirty eight\n",
|
|
L"two hundred and thirty nine\n",
|
|
L"two hundred and forty\n",
|
|
L"two hundred and forty one\n",
|
|
L"two hundred and forty two\n",
|
|
L"two hundred and forty three\n",
|
|
L"two hundred and forty four\n",
|
|
L"two hundred and forty five\n",
|
|
L"two hundred and forty six\n",
|
|
L"two hundred and forty seven\n",
|
|
L"two hundred and forty eight\n",
|
|
L"two hundred and forty nine\n",
|
|
L"two hundred and fifty\n",
|
|
L"two hundred and fifty one\n",
|
|
L"two hundred and fifty two\n",
|
|
L"two hundred and fifty three\n",
|
|
L"two hundred and fifty four\n",
|
|
L"two hundred and fifty five\n",
|
|
L"two hundred and fifty six\n",
|
|
L"two hundred and fifty seven\n",
|
|
L"two hundred and fifty eight\n",
|
|
L"two hundred and fifty nine\n",
|
|
L"two hundred and sixty\n",
|
|
L"two hundred and sixty one\n",
|
|
L"two hundred and sixty two\n",
|
|
L"two hundred and sixty three\n",
|
|
L"two hundred and sixty four\n",
|
|
L"two hundred and sixty five\n",
|
|
L"two hundred and sixty six\n",
|
|
L"two hundred and sixty seven\n",
|
|
L"two hundred and sixty eight\n",
|
|
L"two hundred and sixty nine\n",
|
|
L"two hundred and seventy\n",
|
|
L"two hundred and seventy one\n",
|
|
L"two hundred and seventy two\n",
|
|
L"two hundred and seventy three\n",
|
|
L"two hundred and seventy four\n",
|
|
L"two hundred and seventy five\n",
|
|
L"two hundred and seventy six\n",
|
|
L"two hundred and seventy seven\n",
|
|
L"two hundred and seventy eight\n",
|
|
L"two hundred and seventy nine\n",
|
|
L"two hundred and eighty\n",
|
|
L"two hundred and eighty one\n",
|
|
L"two hundred and eighty two\n",
|
|
L"two hundred and eighty three\n",
|
|
L"two hundred and eighty four\n",
|
|
L"two hundred and eighty five\n",
|
|
L"two hundred and eighty six\n",
|
|
L"two hundred and eighty seven\n",
|
|
L"two hundred and eighty eight\n",
|
|
L"two hundred and eighty nine\n",
|
|
L"two hundred and ninety\n",
|
|
L"two hundred and ninety one\n",
|
|
L"two hundred and ninety two\n",
|
|
L"two hundred and ninety three\n",
|
|
L"two hundred and ninety four\n",
|
|
L"two hundred and ninety five\n",
|
|
L"two hundred and ninety six\n",
|
|
L"two hundred and ninety seven\n",
|
|
L"two hundred and ninety eight\n",
|
|
L"two hundred and ninety nine\n",
|
|
L"three hundred\n"
|
|
};
|
|
|
|
long offset[301];
|
|
|
|
int main(int argc, char **argv)
|
|
{
|
|
int i, n;
|
|
FILE *fp;
|
|
char *s, buf[256];
|
|
wchar_t wbuf[64];
|
|
|
|
#ifdef UTF8
|
|
setlocale(LC_ALL, "en_US.utf8");
|
|
#else
|
|
setlocale(LC_ALL, "en_US");
|
|
#endif
|
|
fp = fopen("output.txt", "w+");
|
|
if (fp == NULL) {
|
|
perror("fopen");
|
|
exit(1);
|
|
}
|
|
for (i = 0; i <= 300; i++) {
|
|
offset[i] = ftell(fp);
|
|
if (fputws(numbers[i], fp) == -1) {
|
|
perror("fputws");
|
|
exit(1);
|
|
}
|
|
}
|
|
#ifdef TESTREAD
|
|
fclose(fp);
|
|
fp = fopen("output.txt", "r");
|
|
#endif
|
|
for ( ; ; ) {
|
|
s = fgets(buf, 256, stdin);
|
|
n = atoi(buf);
|
|
if (s == NULL || n < 0 || n > 300)
|
|
break;
|
|
if (fseek(fp, offset[n], SEEK_SET) == -1) {
|
|
perror("fseek");
|
|
exit(1);
|
|
}
|
|
printf("%d: (%ld->%ld) ", n, offset[n], ftell(fp));
|
|
fgetws(wbuf, 64, fp);
|
|
wcstombs(buf, wbuf, 256);
|
|
printf("%s", buf);
|
|
}
|
|
fclose(fp);
|
|
return 0;
|
|
}
|