Created
March 22, 2015 16:04
-
-
Save skreuzer/38ff31589733582b3903 to your computer and use it in GitHub Desktop.
Example code to demonstrate using libxo
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <sys/utsname.h> | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <libxo/xo.h> | |
int main(int argc, char *argv[]) | |
{ | |
argc = xo_parse_args(argc, argv); | |
if (argc < 0) | |
exit(1); | |
struct utsname utsname; | |
uname(&utsname); | |
xo_open_container("uname"); | |
xo_emit("{:sysname/%s} ", utsname.sysname); | |
xo_emit("{:nodename/%s} ", utsname.nodename); | |
xo_emit("{:release/%s} ", utsname.release); | |
xo_emit("{:version/%s} ", utsname.version); | |
xo_emit("{:machine/%s}", utsname.machine); | |
xo_close_container("uname"); | |
xo_finish(); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment