Name: Anonymous 2009-08-16 9:37
Lain.
#define __STDC_ISO_10646__ 200104L
#define _GNU_SOURCE
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <wchar.h>
#include <locale.h>
void print_it(char c)
{
if (c >= '!' && c <= '~')
printf("%lc", c + 0xfee0);
else if (c == ' ')
printf("%lc", 0x2003);
else
printf("%c", c);
}
int main(int argc, char **argv)
{
if (!setlocale(LC_CTYPE, "")) {
fprintf(stderr, "Locale not specified. Fix this.\n");
return 2;
}
if (argc > 1) {
int i = 1;
while (i < argc) {
int j = 0, len = strlen(argv[i]);
while (j < len) {
print_it(argv[i][j]);
j++;
}
printf("%lc", 0x2003);
++i;
}
printf("\n");
} else {
char *buffa = NULL;
unsigned int n;
while (getline(&buffa, &n, stdin) != -1) {
unsigned int j = 0;
while (j < n && buffa[j] != 0) {
print_it(buffa[j]);
j++;
}
free(buffa);
buffa = NULL;
n = 0;
}
}
return 0;
}