root/opal/mca/hwloc/hwloc201/hwloc/hwloc/dolib.c

/* [<][>][^][v][top][bottom][index][help] */

DEFINITIONS

This source file includes following definitions.
  1. main

   1 /*
   2  * Copyright © 2009 CNRS
   3  * Copyright © 2009 inria.  All rights reserved.
   4  * Copyright © 2009, 2012 Université Bordeaux
   5  * See COPYING in top-level directory.
   6  */
   7 
   8 /* Wrapper to avoid msys' tendency to turn / into \ and : into ;  */
   9 
  10 #ifdef HAVE_UNISTD_H
  11 #include <unistd.h>
  12 #endif
  13 #include <stdio.h>
  14 #include <stdlib.h>
  15 
  16 int main(int argc, char *argv[]) {
  17   char *prog, *arch, *def, *version, *lib;
  18   char s[1024];
  19   char name[16];
  20   int current, age, revision;
  21 
  22   if (argc != 6) {
  23     fprintf(stderr,"bad number of arguments");
  24     exit(EXIT_FAILURE);
  25   }
  26 
  27   prog = argv[1];
  28   arch = argv[2];
  29   def = argv[3];
  30   version = argv[4];
  31   lib = argv[5];
  32 
  33   if (sscanf(version, "%d:%d:%d", &current, &revision, &age) != 3)
  34     exit(EXIT_FAILURE);
  35 
  36   _snprintf(name, sizeof(name), "libhwloc-%d", current - age);
  37   printf("using soname %s\n", name);
  38 
  39   _snprintf(s, sizeof(s), "\"%s\" /machine:%s /def:%s /name:%s /out:%s",
  40       prog, arch, def, name, lib);
  41   if (system(s)) {
  42     fprintf(stderr, "%s failed\n", s);
  43     exit(EXIT_FAILURE);
  44   }
  45 
  46   exit(EXIT_SUCCESS);
  47 }

/* [<][>][^][v][top][bottom][index][help] */