Dan Pop wrote...
So what everyone is saying is that this is not C ? Then what is it ?
It compiles as a .c program.
% cat test.c
static struct termios stored_settings;
void echo_off(void)
{
struct termios new_settings;
tcgetattr(0,&stored_settings);
new_settings = stored_settings;
new_settings.c_lflag &= (~ECHO);
tcsetattr(0,TCSANOW,&new_settings);
return;
}
% gcc -c test.c
test.c: In function `echo_off':
test.c:4: storage size of `new_settings' isn't known
test.c:7: `ECHO' undeclared (first use in this function)
test.c:7: (Each undeclared identifier is reported only once
test.c:7: for each function it appears in.)
test.c:8: `TCSANOW' undeclared (first use in this function)
test.c: At top level:
test.c:1: storage size of `stored_settings' isn't known
%
It doesn't matter that it compiles as a .c program; as long as
it *doesn't* compile as a C program, it's not, strictly speaking,
written in C.
Technically, what you've got there is something which *could*
be a C program, if you added some supporting code (e.g., definitions
for structures and a few enumerated constants). Then you'd have
a C program that produced undefined behavior when run.
Standard C doesn't support colors; thus, if you're claiming the
above code supports colors, then either you're mistaken, or the
above code is not standard C (which is the only kind of C we
discuss here).
HTH,
-Arthur