/* * Copyright © 2009 CNRS * Copyright © 2009-2015 Inria. All rights reserved. * Copyright © 2009 Université Bordeaux * Copyright © 2009-2011 Cisco Systems, Inc. All rights reserved. * See COPYING in top-level directory. */ #include #include #include #include #include "lstopo.h" void output_xml(struct lstopo_output *loutput, const char *filename) { struct stat st; if (!filename || !strcasecmp(filename, "-.xml")) filename = "-"; /* hwloc_topology_export_xml() writes to stdout if "-" is given */ if (strcmp(filename, "-") && !stat(filename, &st) && !loutput->overwrite) { fprintf(stderr, "Failed to export XML to %s (%s)\n", filename, strerror(EEXIST)); return; } if (hwloc_topology_export_xml(loutput->topology, filename) < 0) { fprintf(stderr, "Failed to export XML to %s (%s)\n", filename, strerror(errno)); return; } }