summaryrefslogtreecommitdiff
path: root/miniany/cc.c
diff options
context:
space:
mode:
authorAndreas Baumann <mail@andreasbaumann.cc>2021-07-18 19:16:08 +0200
committerAndreas Baumann <mail@andreasbaumann.cc>2021-07-18 19:16:08 +0200
commit1a741c1c0168e8b2383a62100709c625a5a8961f (patch)
tree9b62cecba87e6ba8725cb1cadbb6d505d2880399 /miniany/cc.c
parent6c6fe33b224dc3342d8d8fc5fc2d27777eb55b89 (diff)
downloadcompilertests-1a741c1c0168e8b2383a62100709c625a5a8961f.tar.gz
compilertests-1a741c1c0168e8b2383a62100709c625a5a8961f.tar.bz2
another test with c4 and a minic compiler
Diffstat (limited to 'miniany/cc.c')
-rw-r--r--miniany/cc.c39
1 files changed, 39 insertions, 0 deletions
diff --git a/miniany/cc.c b/miniany/cc.c
new file mode 100644
index 0000000..df89ff7
--- /dev/null
+++ b/miniany/cc.c
@@ -0,0 +1,39 @@
+int col;
+int row;
+
+int getChar( )
+{
+ int c;
+
+ c = getchar( );
+ if( c == EOF ) {
+ return c;
+ }
+ col++;
+ if( c == '\n' ) {
+ col = 1;
+ row++;
+ putchar( '$' );
+ }
+ return c;
+}
+
+int main( int argc, char **argv )
+{
+ int c;
+
+ col = 1;
+ row = 1;
+
+ puts( "Hello CC" );
+
+ c = getChar( );
+ while( c != EOF ) {
+ putchar( c );
+ c = getChar( );
+ }
+
+ exit( EXIT_SUCCESS );
+
+ return EXIT_SUCCESS;
+}