/* * 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 #include #include #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", "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; }