Skip to content

Instantly share code, notes, and snippets.

@skreuzer
Created March 22, 2015 16:04
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save skreuzer/38ff31589733582b3903 to your computer and use it in GitHub Desktop.
Save skreuzer/38ff31589733582b3903 to your computer and use it in GitHub Desktop.
Example code to demonstrate using libxo
#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