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_07.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" }, { "percent-time", "number", "Percentage of full & part time (%)" }, }; int info_count = (sizeof(info) / sizeof(info[0])); int main (int argc, char **argv) { struct employee { const char *e_first; const char *e_nic; const char *e_last; unsigned e_dept; unsigned e_percent; } employees[] = { { "Jim", "á ááá˘", "áááŽááá ááŽ", 431, 90 }, { "Terry", "<one", "Îá˝Ď὜ ĎÎąá˝Ďá˝° ĎÎąĎὡĎĎÎąĎιὡ ΟοΚ Jones", 660, 90 }, { "Leslie", "Les", "Patterson", 341,60 }, { "Ashley", "Ash", "Meter & Smith", 1440, 40 }, { "0123456789", "0123456789", "012345678901234567890", 1440, 40 }, { "ááŽáá", "ááááá á", "áĄááá ááá¨áá ááĄá", 123, 90 }, { NULL, NULL } }, *ep = employees; int rc; argc = xo_parse_args(argc, argv); if (argc < 0) return 1; xo_set_info(NULL, info, info_count); xo_set_flags(NULL, XOF_COLUMNS); xo_open_container("employees"); xo_open_list("test"); xo_open_instance("test"); xo_emit("{ek:filename/%s}", NULL); xo_close_instance("test"); xo_close_list("test"); rc = xo_emit("Îá˝Ď὜ ĎÎąá˝Ďá˝° ĎÎąĎὡĎĎÎąĎιὡ ΟοΚ {:v1/%s}, {:v2/%s}\n", "γΚγνώĎκξΚν", "Ὄ áźÎ˝Î´ĎÎľĎ ážżÎθΡνιáżÎżÎš"); rc = xo_emit("{:columns/%d}\n", rc); xo_emit("{:columns/%d}\n", rc); rc = xo_emit("áááŽááá {:v1/%s} {:v2/%s}\n", "ááŽáááá ááááá áá á ááááĄá˘á ááŞáá", "Unicode-áᥠááááá áĄááá ááá¨áá ááĄá"); xo_emit("{:columns/%d}\n", rc); rc = xo_emit("{T:First Name/%-25s}{T:Last Name/%-14s}" "{T:/%-12s}{T:Time (%)}\n", "Department"); xo_emit("{:columns/%d}\n", rc); xo_open_list("employee"); for ( ; ep->e_first; ep++) { xo_open_instance("employee"); rc = xo_emit("{[:-25}{:first-name/%s} ({:nic-name/\"%s\"}){]:}" "{:last-name/%-14..14s/%s}" "{:department/%8u/%u}{:percent-time/%8u/%u}\n", ep->e_first, ep->e_nic, ep->e_last, ep->e_dept, ep->e_percent); xo_emit("{:columns/%d}\n", rc); if (ep->e_percent > 50) { xo_attr("full-time", "%s", "honest & for true"); xo_emit("{e:benefits/%s}", "full"); } xo_close_instance("employee"); } xo_close_list("employee"); xo_close_container("employees"); xo_finish(); return 0; }
Upload File
Create Folder