From e90857dea1cb25cbb58ac68896158e4674110522 Mon Sep 17 00:00:00 2001 From: Rangi Date: Tue, 17 Jul 2018 20:07:39 -0400 Subject: [PATCH] Add tools/free_space.awk --- tools/free_space.awk | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 tools/free_space.awk diff --git a/tools/free_space.awk b/tools/free_space.awk new file mode 100644 index 000000000..1f2b04415 --- /dev/null +++ b/tools/free_space.awk @@ -0,0 +1,13 @@ +#!/usr/bin/awk -f + +# Usage: tools/free_space.awk pokecrystal.map + +BEGIN { + total = free = 16384 * 128 +} +/^ SECTION: \$[0-7]/ { + free -= strtonum("0x" substr($3, 3)) +} +END { + printf "Free space: %d/%d (%.2f%%)\n", free, total, free * 100 / total +}