commit cc8d5d7

uint  ·  2026-06-23 12:35:27 +0000 UTC
parent ba2838b
Add version
1 files changed,  +9, -3
M tmtm.c
M tmtm.c
+9, -3
 1@@ -1,6 +1,9 @@
 2 #include <stdarg.h>
 3 #include <stdio.h>
 4 #include <stdlib.h>
 5+#include <string.h>
 6+
 7+#define TMTM_VER "26.6"
 8 
 9 /* print line number, message, exit with error code `ec` */
10 static void die(int ln, int ec, const char* fmt, ...);
11@@ -21,9 +24,12 @@ static void die(int ln, int ec, const char* fmt, ...)
12 
13 int main(int argc, char* argv[])
14 {
15-	printf("Hello tmtm!\n");
16-
17-	die(__LINE__, EXIT_SUCCESS, "died!");
18+	if (argc > 1) {
19+		if (strcmp("-v", argv[1]) == 0) {
20+			printf("tmtm v%s", TMTM_VER);
21+			return EXIT_SUCCESS;
22+		}
23+	}
24 
25 	return EXIT_SUCCESS;
26 }