shithub: neatroff

ref: d11408e98db95f4463e5c74cdab2ec1eeadaa0a9
dir: /reg.c/

View raw version
#include <stdlib.h>
#include "xroff.h"

#define NREGS		(1 << 16)

int nreg[NREGS];

int num_get(int id)
{
	return nreg[id];
}

int num_set(int id, int n)
{
	int o = nreg[id];
	nreg[id] = n;
	return o;
}

void tr_nr(int argc, char **args)
{
	int id;
	if (argc < 3)
		return;
	id = N_ID(args[1][0], args[1][1]);
	nreg[id] = tr_int(args[2], nreg[id], 'u');
}