27 |
/* This is a file in which newly implemented functionality is first |
/* This is a file in which newly implemented functionality is first |
28 |
implemented. */ |
implemented. */ |
29 |
|
|
30 |
|
void |
31 |
|
antiright_get_file_type(char *filename) |
32 |
|
{ |
33 |
|
int counter; |
34 |
|
int period_char; |
35 |
|
int filename_length=strlen(filename); |
36 |
|
Boolean has_period=False; |
37 |
|
for(counter=filename_length; counter>0; counter--) |
38 |
|
{ |
39 |
|
if(filename[counter]=='.') |
40 |
|
{ |
41 |
|
has_period=True; |
42 |
|
period_char=counter; |
43 |
|
break; |
44 |
|
} |
45 |
|
} |
46 |
|
if(has_period) |
47 |
|
{ |
48 |
|
int extension_counter=0; |
49 |
|
char extension[period_char]; |
50 |
|
for(counter=(filename_length-period_char); filename[counter]!='\0'; counter++) |
51 |
|
{ |
52 |
|
extension[extension_counter]=filename[counter]; |
53 |
|
extension_counter++; |
54 |
|
} |
55 |
|
if(!strncmp("c", extension, period_char)) |
56 |
|
{ |
57 |
|
antiright.workfile_type=C; |
58 |
|
} |
59 |
|
else if(!strncmp("h", extension, period_char)) |
60 |
|
{ |
61 |
|
antiright.workfile_type=H; |
62 |
|
} |
63 |
|
else if(!strncmp("txt", extension, period_char)) |
64 |
|
{ |
65 |
|
antiright.workfile_type=TXT; |
66 |
|
} |
67 |
|
else if(!strncmp("sh", extension, period_char)) |
68 |
|
{ |
69 |
|
antiright.workfile_type=SH; |
70 |
|
} |
71 |
|
else |
72 |
|
{ |
73 |
|
antiright.workfile_type=MISC; |
74 |
|
} |
75 |
|
} |
76 |
|
else |
77 |
|
antiright.workfile_type=MISC; |
78 |
|
} |
79 |
|
|
80 |
|
|
81 |
|
|