Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012 #include <string.h>
00013 #include <ctype.h>
00014
00015
00016 void chartoname(register char *name,
00017 char c,
00018 const char *dir) {
00019 char file[3];
00020 int index;
00021 static const char *namelist[] = {
00022 "!bang",
00023 "\"doubleq",
00024 "#hash",
00025 "$dollar",
00026 "%percent",
00027 "&and",
00028 "'quote",
00029 "(lround",
00030 ")rround",
00031 "*asterisk",
00032 "+plus",
00033 ",comma",
00034 "-minus",
00035 ".dot",
00036 "/slash",
00037 ":colon",
00038 ";semic",
00039 "<less",
00040 "=equal",
00041 ">greater",
00042 "?question",
00043 "@at",
00044 "[lsquare",
00045 "\\backsl",
00046 "]rsquare",
00047 "^uparr",
00048 "_unders",
00049 "`grave",
00050 "{lbrace",
00051 "|bar",
00052 "}rbrace",
00053 "~tilde"
00054 };
00055
00056 strcpy(name, dir);
00057 for (index = 0; index < sizeof namelist / sizeof (char *)
00058 && c != namelist[index][0]; index++);
00059 if (index < sizeof namelist / sizeof (char *))
00060
00061 strcat (name, &namelist[index][1]);
00062 else {
00063 if (isupper (c)) {
00064 file[0] = 'c';
00065 file[1] = c;
00066 file[2] = '\0';
00067 }
00068 else {
00069 file[0] = c;
00070 file[1] = '\0';
00071 }
00072 strcat(name, file);
00073 }
00074 }