aboutsummaryrefslogtreecommitdiffstats
path: root/c/pid.c
diff options
context:
space:
mode:
Diffstat (limited to 'c/pid.c')
-rw-r--r--c/pid.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/c/pid.c b/c/pid.c
new file mode 100644
index 0000000..a282a89
--- /dev/null
+++ b/c/pid.c
@@ -0,0 +1,9 @@
+#include "gbos.h"
+/* print an unsigned byte as decimal (no runtime division: subtract-based) */
+static void putu(unsigned char n) {
+ char buf[3]; unsigned char i = 0;
+ if (n == 0) { putc('0'); return; }
+ while (n) { buf[i++] = '0' + (n % 10); n = n / 10; }
+ while (i) putc(buf[--i]);
+}
+void main(void) { putu(getpid()); nl(); }