summaryrefslogtreecommitdiff
path: root/tools/snapshot_viewer.c
diff options
context:
space:
mode:
authorauric <104602845+ihateamongus@users.noreply.github.com>2025-09-11 09:38:59 -0500
committerGitHub <noreply@github.com>2025-09-11 09:38:59 -0500
commit0408cb4803e0b2c82affb16e2eac8dfd73895343 (patch)
tree928938f4d2d0c8e7447c6c69cdb0463c60d21dd2 /tools/snapshot_viewer.c
parent8f03aa9417b06d91182e7adc2e0b8c53e7cf6069 (diff)
parent4da4c90adba63332f305725f6dcff9d0e0665b96 (diff)
Merge pull request #24 from ihateamongus/codex/create-system-snapshot-tool-for-gentoo
Add Gentoo system snapshot script and viewer
Diffstat (limited to 'tools/snapshot_viewer.c')
-rw-r--r--tools/snapshot_viewer.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/tools/snapshot_viewer.c b/tools/snapshot_viewer.c
new file mode 100644
index 0000000..30ece56
--- /dev/null
+++ b/tools/snapshot_viewer.c
@@ -0,0 +1,27 @@
+#include <stdio.h>
+#include <string.h>
+
+int main(int argc, char *argv[]) {
+ const char *file = (argc > 1) ? argv[1] : "gentoo_snapshot.txt";
+ FILE *fp = fopen(file, "r");
+ if (!fp) {
+ perror("fopen");
+ return 1;
+ }
+
+ char line[1024];
+ while (fgets(line, sizeof line, fp)) {
+ if (strncmp(line, "=====", 5) == 0) {
+ printf("\033[1;32m%s\033[0m", line);
+ } else if (strncmp(line, "##", 2) == 0) {
+ printf("\033[1;34m%s\033[0m", line);
+ } else if (strncmp(line, "###", 3) == 0) {
+ printf("\033[1;36m%s\033[0m", line);
+ } else {
+ fputs(line, stdout);
+ }
+ }
+
+ fclose(fp);
+ return 0;
+}