003 File Manager
Current Path:
/usr/src/contrib/libxo/tests/core
usr
/
src
/
contrib
/
libxo
/
tests
/
core
/
📁
..
📄
Makefile.am
(4.21 KB)
📁
saved
📄
test_01.c
(7.22 KB)
📄
test_02.c
(4.67 KB)
📄
test_03.c
(2.61 KB)
📄
test_04.c
(1.5 KB)
📄
test_05.c
(5.85 KB)
📄
test_06.c
(1.43 KB)
📄
test_07.c
(2.92 KB)
📄
test_08.c
(3.52 KB)
📄
test_09.c
(2.55 KB)
📄
test_10.c
(5.82 KB)
📄
test_11.c
(2.68 KB)
📄
test_12.c
(2.54 KB)
Editing: test_06.c
/* * Copyright (c) 2014, Juniper Networks, Inc. * All rights reserved. * This SOFTWARE is licensed under the LICENSE provided in the * ../Copyright file. By downloading, installing, copying, or otherwise * using the SOFTWARE, you agree to be bound by the terms of that * LICENSE. * Phil Shafer, July 2014 */ #include <stdio.h> #include <stdlib.h> #include <string.h> #include "xo.h" xo_info_t info[] = { { "employee", "object", "Employee data" }, { "first-name", "string", "First name of employee" }, { "last-name", "string", "Last name of employee" }, { "department", "number", "Department number" }, }; int info_count = (sizeof(info) / sizeof(info[0])); int main (int argc, char **argv) { struct employee { const char *e_first; const char *e_last; unsigned e_dept; } employees[] = { { "Terry", "Jones", 660 }, { "Leslie", "Patterson", 341 }, { "Ashley", "Smith", 1440 }, { NULL, NULL } }, *ep = employees; argc = xo_parse_args(argc, argv); if (argc < 0) return 1; xo_set_info(NULL, info, info_count); xo_set_flags(NULL, XOF_DTRT); xo_open_container("employees"); xo_open_list("employee"); for ( ; ep->e_first; ep++) { xo_open_instance("employee"); xo_emit("{:first-name} {:last-name} works in dept #{:department/%u}\n", ep->e_first, ep->e_last, ep->e_dept); xo_close_instance_d(); } xo_close_list_d(); xo_close_container_d(); xo_finish(); return 0; }
Upload File
Create Folder