ref: 3cecf018179e6240cd1d1266fcb4bd0bb601dcec
parent: 15fdd6eed8b3fbf509de2dc11e4ea1ac7564d19b
author: Ali Gholami Rudi <[email protected]>
date: Fri Jul 18 23:04:10 EDT 2014
reg: add \n($$
--- a/reg.c
+++ b/reg.c
@@ -5,6 +5,7 @@
#include <stdlib.h>
#include <string.h>
#include <time.h>
+#include <unistd.h>
#include "roff.h"
#define NENVS 64 /* number of environment registers */
@@ -89,7 +90,11 @@
}
if (s[0] == '.' && !strcmp(".neat", s))
return "1";
- if (id == map("yr")) {
+ if (s[0] == '$' && s[1] == '$' && !s[2]) {
+ sprintf(numbuf, "%d", getpid());
+ return numbuf;
+ }
+ if (s[0] == 'y' && s[1] == 'r' && !s[2]) {
sprintf(numbuf, "%02d", nregs[id]);
return numbuf;
}