view interps/cfunge/cfunge-src/src/instructions/sysinfo-misc/safe_env.gperf @ 12518:2d8fe55c6e65 draft default tip

<int-e> learn The password of the month is release incident pilot.
author HackEso <hackeso@esolangs.org>
date Sun, 03 Nov 2024 00:31:02 +0000
parents 859f9b4339e6
children
line wrap: on
line source

%language=ANSI-C
%define hash-function-name safe_env_hash
%define lookup-function-name safe_in_word_set
%compare-lengths
%compare-strncmp
%readonly-tables
%{
#include <string.h>
#include <stdbool.h>
#include "safe_env.h"
%}
%%
COLORTERM
COLUMNS
DISPLAY
EDITOR
GROUP
HOME
HOST
LANG
LC_ADDRESS
LC_ALL
LC_COLLATE
LC_CTYPE
LC_IDENTIFICATION
LC_MEASUREMENT
LC_MESSAGES
LC_MONETARY
LC_NAME
LC_NUMERIC
LC_PAPER
LC_TELEPHONE
LC_TIME
MACHTYPE
OSTYPE
PAGER
PATH
PS1
PWD
SHELL
TERM
TZ
USER
VISUAL
%%

FUNGE_ATTR_FAST bool check_env_is_safe(const char *envvar) {
	const char * p;

	p = strchr(envvar, '=');
	if (!p)
		return false;
	else
		return (safe_in_word_set(envvar, p - envvar) != NULL);
}