Annotation of freem/examples/libfreem/get/get.c, revision 1.1
1.1 ! snw 1: #include <stdio.h>
! 2: #include <sys/types.h>
! 3: #include <unistd.h>
! 4: #include <string.h>
! 5: #include <freem.h>
! 6: #include <stdlib.h>
! 7:
! 8: int main(int argc, char **argv, char)
! 9: {
! 10: pid_t pid;
! 11: freem_ref_t ref;
! 12:
! 13: /* get the PID of this process */
! 14: pid = getpid();
! 15:
! 16: /* we want to access an SSVN */
! 17: ref.reftype = MREF_RT_SSVN;
! 18:
! 19: /* set up the name and subscripts */
! 20: strcpy(ref.name, "JOB");
! 21:
! 22: ref.subscript_count = 2;
! 23: sprintf(ref.subscripts[0], "%d", pid);
! 24: strcpy(ref.subscripts[1], "CHARACTER");
! 25:
! 26: /* initialize libfreem, using the USER namespace */
! 27: freem_init("USER");
! 28:
! 29: /* call libfreem API */
! 30: freem_get(&ref);
! 31:
! 32: /* output the character set info */
! 33: printf("PID %d character set is '%s'\n", pid, ref.value);
! 34:
! 35: ref.reftype = MREF_RT_GLOBAL;
! 36: strcpy(ref.name, "snw");
! 37: ref.subscript_count = 0;
! 38:
! 39: freem_get(&ref);
! 40:
! 41: printf("^snw = '%s'\n", ref.value);
! 42:
! 43: char *foo;
! 44: foo = malloc (MLIB_ERRLEN);
! 45:
! 46: freem_errmsg (146, foo);
! 47:
! 48: printf("errmsg for 146: '%s'\n", foo);
! 49:
! 50: }
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>