File:
[Coherent Logic Development] /
freem /
examples /
libfreem /
get /
get.c
Revision
1.1.1.1 (vendor branch):
download - view:
text,
annotated -
select for diffs
Sun Jan 19 02:04:04 2025 UTC (2 months, 2 weeks ago) by
snw
Branches:
MAIN,
CoherentLogicDevelopment
CVS tags:
v0-63-1-rc1,
v0-63-0-rc1,
v0-63-0,
v0-62-3,
v0-62-2,
v0-62-1,
v0-62-0,
start,
HEAD
FreeM
#include <stdio.h>
#include <sys/types.h>
#include <unistd.h>
#include <string.h>
#include <freem.h>
#include <stdlib.h>
int main(int argc, char **argv, char)
{
pid_t pid;
freem_ref_t ref;
/* get the PID of this process */
pid = getpid();
/* we want to access an SSVN */
ref.reftype = MREF_RT_SSVN;
/* set up the name and subscripts */
strcpy(ref.name, "JOB");
ref.subscript_count = 2;
sprintf(ref.subscripts[0], "%d", pid);
strcpy(ref.subscripts[1], "CHARACTER");
/* initialize libfreem, using the USER namespace */
freem_init("USER");
/* call libfreem API */
freem_get(&ref);
/* output the character set info */
printf("PID %d character set is '%s'\n", pid, ref.value);
ref.reftype = MREF_RT_GLOBAL;
strcpy(ref.name, "snw");
ref.subscript_count = 0;
freem_get(&ref);
printf("^snw = '%s'\n", ref.value);
char *foo;
foo = malloc (MLIB_ERRLEN);
freem_errmsg (146, foo);
printf("errmsg for 146: '%s'\n", foo);
}
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>