#include #include #include #include #include #include #include #include #include #include char *Convert(char *a) { int b,g; char j[80]; char c[80]; char e[80]; char *f = malloc(strlen(a) + 2); int k,m; if ((strchr(a, '.')) == NULL) { strcpy(j, ""); } else { strcpy(j, (strchr(a, '.'))); } k = ((strlen(a)) - (strlen(j))); strncpy(c, a, k); c[0] = toupper(c[0]); if ((strchr(c, '1')) == NULL && (strchr(c, '2')) == NULL && (strchr(c, '3')) == NULL) { strcpy(j, ""); } if ((strchr(c, '1')) != NULL) { strcpy(j, (strchr(c, '1'))); } else if ((strchr(c, '2')) != NULL) { strcpy(j, (strchr(c, '2'))); } else if ((strchr(c, '3')) != NULL) { strcpy(j, (strchr(c, '3'))); } k = ((strlen(c)) - (strlen(j))); strncpy(e, c, k); if (j != "") { strcat(e, " "); } strcat(e, j); b = 1; g = 0; while (b < 20) { k = 0; if (isupper(e[b])) { strcpy(j, (strchr(e, e[b]))); k = ((strlen(e)) - (strlen(j))); g = 1; break; } b++; } if (k == 0) { strcpy(f, e); } else { strncpy(f, e, k); strcat(f, " "); strcat(f, j); } return f; } int main() { int i,b,g,k,m,inc; char a[20][80]; char f[20][80]; char exec[100]; int r = 15; DIR *di; struct dirent *dir; i = 0; di = opendir("/mnt/G:"); inc = 0; if (di) { while ((dir = readdir(di)) && i < 20) {inc++; strcpy(a[i], dir->d_name); i++; } closedir(di); } for (g = 0; g < i; g++) { strcpy(f[g], Convert(a[g])); printf("%s\n", f[g]); } return 0; }