2 * Copyright (c) 2014, Juniper Networks, Inc.
4 * This SOFTWARE is licensed under the LICENSE provided in the
5 * ../Copyright file. By downloading, installing, copying, or otherwise
6 * using the SOFTWARE, you agree to be bound by the terms of that
8 * Phil Shafer, July 2014
18 { "employee", "object", "Employee data" },
19 { "first-name", "string", "First name of employee" },
20 { "last-name", "string", "Last name of employee" },
21 { "department", "number", "Department number" },
22 { "percent-time", "number", "Percentage of full & part time (%)" },
24 int info_count = (sizeof(info) / sizeof(info[0]));
27 main (int argc, char **argv)
36 { "Jim", "რეგტ", "გთხოვთ ახ", 431, 90 },
37 { "Terry", "<one", "Οὐχὶ ταὐτὰ παρίσταταί μοι Jones", 660, 90 },
38 { "Leslie", "Les", "Patterson", 341,60 },
39 { "Ashley", "Ash", "Meter & Smith", 1440, 40 },
40 { "0123456789", "0123456789", "012345678901234567890", 1440, 40 },
41 { "ახლა", "გაიარო", "საერთაშორისო", 123, 90 },
42 { "෴ණ්ණ෴෴ණ්ණ෴", "Mick",
43 "෴ණ්ණ෴෴ණ්ණ෴෴ණ්ණ෴෴෴", 110, 20 },
48 argc = xo_parse_args(argc, argv);
52 xo_set_info(NULL, info, info_count);
53 xo_set_flags(NULL, XOF_COLUMNS);
55 xo_open_container("employees");
57 xo_emit("Οὐχὶ ταὐτὰ παρίσταταί μοι {:v1/%s}, {:v2/%s}\n",
58 "γιγνώσκειν", "ὦ ἄνδρες ᾿Αθηναῖοι");
60 rc = xo_emit("გთხოვთ {:v1/%s} {:v2/%s}\n",
61 "ახლავე გაიაროთ რეგისტრაცია",
62 "Unicode-ის მეათე საერთაშორისო");
63 xo_emit("{Twc:Width}{:width/%d}\n", rc);
65 /* Okay, Sinhala is uber cool ... */
66 rc = xo_emit("[{:sinhala}]\n", "෴ණ්ණ෴");
67 xo_emit("{Twc:Width}{:width/%d}\n", rc);
68 rc = xo_emit("[{:sinhala}]\n", "෴");
69 xo_emit("{Twc:Width}{:width/%d}\n", rc);
70 rc = xo_emit("[{:sinhala/%-4..4s/%s}]\n", "෴ණ්ණ෴෴ණ්ණ෴");
71 xo_emit("[{:not-sinhala/%-4..4s/%s}]\n", "123456");
72 rc = xo_emit("[{:tag/%s}]\n", "ර්ඝ");
73 xo_emit("{Twc:Width}{:width/%d}\n", rc);
75 xo_open_list("employee");
77 xo_emit("{T:First Name/%-25s}{T:Last Name/%-14s}"
78 "{T:/%-12s}{T:Time (%)}\n", "Department");
79 for ( ; ep->e_first; ep++) {
80 xo_open_instance("employee");
81 xo_emit("{[:-25}{:first-name/%s} ({:nic-name/\"%s\"}){]:}"
82 "{:last-name/%-14..14s/%s}"
83 "{:department/%8u/%u}{:percent-time/%8u/%u}\n",
84 ep->e_first, ep->e_nic, ep->e_last, ep->e_dept, ep->e_percent);
85 if (ep->e_percent > 50) {
86 xo_attr("full-time", "%s", "honest & for true");
87 xo_emit("{e:benefits/%s}", "full");
89 xo_close_instance("employee");
92 xo_close_list("employee");
93 xo_close_container("employees");