20 wchar_t *seps = L"-.?!";
21 wchar_t *nonseps = L"\'";
23 void capitalize(wchar_t *str)
25 wchar_t *p, *p2, **ce;
31 while(!iswalnum(*p)) {
34 if(wcschr(seps, *p) != NULL)
39 while(iswalnum(*p) || (wcschr(nonseps, *p) != NULL)) {
47 for(ce = exclude; *ce != NULL; ce++) {
48 if(!wcsncmp(*ce, p2, p - p2) && ((*ce)[p - p2] == L'\0'))
57 int main(int argc, char **argv)
62 setlocale(LC_ALL, "");
64 for(i = 1; i < argc; i++) {
65 mbstowcs(buf, argv[i], sizeof(buf) / sizeof(*buf));
68 fputwc(L'\n', stdout);
72 if(fgetws(buf, sizeof(buf) / sizeof(*buf), stdin) == NULL) {
75 perror("reading input");
87 * compile-command: "gcc -Wall -g -o capitalize capitalize.c"