diff --git a/.cvsignore b/.cvsignore index e69de29..f282747 100644 --- a/.cvsignore +++ b/.cvsignore @@ -0,0 +1,2 @@ +cgnslib_2.5-4.tar.gz +usersguide.pdf diff --git a/cgnslib-2.5-4-replace-exit-to-return.patch b/cgnslib-2.5-4-replace-exit-to-return.patch new file mode 100644 index 0000000..7b4dd87 --- /dev/null +++ b/cgnslib-2.5-4-replace-exit-to-return.patch @@ -0,0 +1,924 @@ +diff -up cgnslib_2.5/adf_cond.c.exit cgnslib_2.5/adf_cond.c +--- cgnslib_2.5/adf_cond.c.exit 2007-01-01 05:23:14.000000000 +0530 ++++ cgnslib_2.5/adf_cond.c 2010-07-16 14:53:41.396262791 +0530 +@@ -383,7 +383,7 @@ static void ErrorExit( char *ermsg, int + ADF_Error_Message(ErrStat,input) ; + fprintf(stderr,"%s\n",input) ; + } +- exit(1) ; ++ return 1; + } + + #if defined (__cplusplus) +diff -up cgnslib_2.5/adfh/adf2hdf.c.exit cgnslib_2.5/adfh/adf2hdf.c +--- cgnslib_2.5/adfh/adf2hdf.c.exit 2006-10-03 04:36:46.000000000 +0530 ++++ cgnslib_2.5/adfh/adf2hdf.c 2010-07-16 14:53:41.396262791 +0530 +@@ -57,7 +57,7 @@ static int is_ADF_file(char *fname) { + + if ((fp = fopen(fname, "r+b")) == NULL) { + fprintf(stderr, "couldn't open %s for reading\n", fname); +- exit (1); ++ return 1; + } + fread (header, sizeof(char), 32, fp); + fclose (fp); +@@ -75,7 +75,7 @@ static void ErrorExit() + ADFH_Database_Close (OutputRootID, &ErrStat); + if (TempFile[0]) + unlink(TempFile); +- exit(1) ; ++ return 1; + } + + /*-------------------------------------------------------------------*/ +@@ -288,22 +288,22 @@ int main (int argc, char **argv) + IncludeLink = 1; + else { + fprintf(stderr, "unknown option %s\n", argv[n]); +- exit (1); ++ return 1; + } + } + + if (n >= argc) { + fprintf (stderr, "usage: adf2hdf [-links] [-print] InputFile [OutputFile]\n"); +- exit (1); ++ return 1; + } + inpfile = argv[n++]; + if (stat (inpfile, &inpst)) { + fprintf (stderr, "can't stat %s\n", inpfile); +- exit (1); ++ return 1; + } + if (!is_ADF_file(inpfile)) { + fprintf (stderr, "%s is not an ADF file\n", inpfile); +- exit (1); ++ return 1; + } + + /* output to temporary file */ +@@ -337,12 +337,12 @@ int main (int argc, char **argv) + unlink (outfile); + if (rename (TempFile, outfile)) { + fprintf (stderr, "rename %s -> %s failed", TempFile, outfile); +- exit (1); ++ return 1; + } + + if (stat (outfile, &outst)) { + fprintf (stderr, "can't stat %s\n", outfile); +- exit (1); ++ return 1; + } + + printf ("ADF file size = %ld bytes\n", (long)inpst.st_size); +diff -up cgnslib_2.5/adfh/ADFH.c.exit cgnslib_2.5/adfh/ADFH.c +--- cgnslib_2.5/adfh/ADFH.c.exit 2009-09-01 03:26:39.000000000 +0530 ++++ cgnslib_2.5/adfh/ADFH.c 2010-07-16 14:53:41.398276550 +0530 +@@ -254,7 +254,7 @@ static void set_error(int errcode, int * + char errmsg[ADF_MAX_ERROR_STR_LENGTH+1]; + ADFH_Error_Message(errcode, errmsg); + fprintf(stderr, "ERROR:%s\n", errmsg); +- exit(1); ++ return 1; + } + *err = errcode; + } +diff -up cgnslib_2.5/adfh/hdf2adf.c.exit cgnslib_2.5/adfh/hdf2adf.c +--- cgnslib_2.5/adfh/hdf2adf.c.exit 2006-10-03 04:36:47.000000000 +0530 ++++ cgnslib_2.5/adfh/hdf2adf.c 2010-07-16 14:53:41.398276550 +0530 +@@ -59,7 +59,7 @@ static void ErrorExit() + ADF_Database_Close (OutputRootID, &ErrStat); + if (TempFile[0]) + unlink(TempFile); +- exit(1) ; ++ return 1; + } + + /*-------------------------------------------------------------------*/ +@@ -254,22 +254,22 @@ int main (int argc, char **argv) + IncludeLink = 1; + else { + fprintf(stderr, "unknown option %s\n", argv[n]); +- exit (1); ++ return 1; + } + } + + if (n >= argc) { + fprintf (stderr, "usage: hdf2adf [-links] [-print] InputFile [OutputFile]\n"); +- exit (1); ++ return 1; + } + inpfile = argv[n++]; + if (stat (inpfile, &inpst)) { + fprintf (stderr, "can't stat %s\n", inpfile); +- exit (1); ++ return 1; + } + if (H5Fis_hdf5(inpfile) <= 0) { + fprintf (stderr, "%s is not a HDF5 file\n", inpfile); +- exit (1); ++ return 1; + } + + /* output to temporary file */ +@@ -303,12 +303,12 @@ int main (int argc, char **argv) + unlink (outfile); + if (rename (TempFile, outfile)) { + fprintf (stderr, "rename %s -> %s failed", TempFile, outfile); +- exit (1); ++ return 1; + } + + if (stat (outfile, &outst)) { + fprintf (stderr, "can't stat %s\n", outfile); +- exit (1); ++ return 1; + } + + printf ("HDF5 file size = %ld bytes\n", (long)inpst.st_size); +diff -up cgnslib_2.5/cgns_error.c.exit cgnslib_2.5/cgns_error.c +--- cgnslib_2.5/cgns_error.c.exit 2007-01-01 05:23:14.000000000 +0530 ++++ cgnslib_2.5/cgns_error.c 2010-07-16 14:53:41.398276550 +0530 +@@ -63,7 +63,7 @@ CGNSDLL void cg_error_exit() { + (*cgns_error_handler)(-1, cgns_error_mess); + else + fprintf(stderr,"%s\n",cgns_error_mess); +- exit(1); ++ return 1; + } + + CGNSDLL void cg_error_print() { +diff -up cgnslib_2.5/cgns_internals.c.exit cgnslib_2.5/cgns_internals.c +--- cgnslib_2.5/cgns_internals.c.exit 2010-07-16 14:54:46.609260208 +0530 ++++ cgnslib_2.5/cgns_internals.c 2010-07-16 14:55:05.733261395 +0530 +@@ -87,7 +87,7 @@ void *cgi_malloc(int cnt, int size) { + void *buf = calloc(cnt, size); + if (buf == NULL) { + cgi_error("calloc failed for %d values of size %d", cnt, size); +- exit (1); ++ return 1; + } + return buf; + } +@@ -96,7 +96,7 @@ void *cgi_realloc(void *oldbuf, unsigned + void *buf = realloc(oldbuf, bytes); + if (buf == NULL) { + cgi_error("realloc failed for %d bytes", bytes); +- exit (1); ++ return 1; + } + return buf; + } +diff -up cgnslib_2.5/tests/adflist.c.exit cgnslib_2.5/tests/adflist.c +--- cgnslib_2.5/tests/adflist.c.exit 2007-01-01 05:23:15.000000000 +0530 ++++ cgnslib_2.5/tests/adflist.c 2010-07-16 14:53:41.399276760 +0530 +@@ -35,7 +35,7 @@ static void err_exit (char *name, int er + fflush (stdout); + ADF_Error_Message (errcode, errmsg); + fprintf (stderr, "error in %s:%s\n", name, errmsg); +- exit (1); ++ return 1; + } + + static void print_node (double node_id) +@@ -108,7 +108,7 @@ static void print_children (double paren + + if (leader_len + indent > MAX_LEADER) { + fprintf (stderr, "nesting is too deep\n"); +- exit (1); ++ return 1; + } + leader_len += indent; + for (nc = 0; nc < indent; nc++) +@@ -168,7 +168,7 @@ int main (int argc, char *argv[]) + indent = atoi (argarg); + if (indent < 1) { + fprintf (stderr, "indent must be > 0\n"); +- exit (1); ++ return 1; + } + break; + case 'f': +@@ -230,7 +230,6 @@ int main (int argc, char *argv[]) + ADF_Database_Close (root_id, &err); + if (err > 0) + err_exit ("ADF_Database_Close", err); +- exit (0); + return 0; /* prevent compiler warning */ + } + +diff -up cgnslib_2.5/tests/dbtest.c.exit cgnslib_2.5/tests/dbtest.c +--- cgnslib_2.5/tests/dbtest.c.exit 2010-07-16 14:53:53.526385225 +0530 ++++ cgnslib_2.5/tests/dbtest.c 2010-07-16 14:54:20.292261257 +0530 +@@ -30,7 +30,7 @@ int main (int argc, char **argv) + + if (argc < 3 || argc > 4) { + fprintf (stderr, "usage: dbtest numzones numvalues [CGNSfile]\n"); +- exit (1); ++ return 1; + } + numzones = atoi(argv[1]); + numvalues = atoi(argv[2]); +@@ -40,7 +40,7 @@ int main (int argc, char **argv) + values = (float *) malloc (numvalues * sizeof(float)); + if (values == NULL) { + perror ("malloc"); +- exit (-1); ++ return -1; + } + for (i = 0; i < numvalues; i++) + values[i] = (float)i; +diff -up cgnslib_2.5/tests/getargs.c.exit cgnslib_2.5/tests/getargs.c +--- cgnslib_2.5/tests/getargs.c.exit 2006-10-03 04:36:47.000000000 +0530 ++++ cgnslib_2.5/tests/getargs.c 2010-07-16 14:53:41.399276760 +0530 +@@ -22,7 +22,7 @@ char **usgmsg, *errmsg; + fprintf (stderr, "ERROR: %s\n", errmsg); + for (n = 0; NULL != usgmsg[n]; n++) + fprintf (stderr, "%s\n", usgmsg[n]); +- exit (NULL != errmsg); ++ return (NULL != errmsg); + } + + /*---------- getargs --------------------------------------------------- +@@ -80,7 +80,7 @@ char **argv, *ostr; + (oli = strchr (ostr, argopt)) == NULL) { + if (argerr) { + fprintf (stderr, "invalid option - `%c'\n", argopt); +- exit (-1); ++ return -1; + } + return (argopt); + } +@@ -106,7 +106,7 @@ char **argv, *ostr; + if (++argind >= argc) { + if (!argerr) return (':'); + fprintf (stderr, "missing argument for option `%c'\n", argopt); +- exit (1); ++ return 1; + } + place = argv[argind]; + } +diff -up cgnslib_2.5/tests/open_cgns.c.exit cgnslib_2.5/tests/open_cgns.c +--- cgnslib_2.5/tests/open_cgns.c.exit 2008-01-19 09:15:16.000000000 +0530 ++++ cgnslib_2.5/tests/open_cgns.c 2010-07-16 14:53:41.399276760 +0530 +@@ -9,7 +9,7 @@ int main (int argc, char **argv) + + if (argc < 2 || argc > 3) { + fprintf (stderr, "open_cgns [-m] CGNSfile\n"); +- exit (1); ++ return 1; + } + if (argc > 2) { + mode = CG_MODE_MODIFY; +diff -up cgnslib_2.5/tests/test_exts.c.exit cgnslib_2.5/tests/test_exts.c +--- cgnslib_2.5/tests/test_exts.c.exit 2008-01-19 09:15:16.000000000 +0530 ++++ cgnslib_2.5/tests/test_exts.c 2010-07-16 14:53:41.400276410 +0530 +@@ -10,12 +10,12 @@ + + float coord[NUM_SIDE*NUM_SIDE*NUM_SIDE]; + +-#define CHECK(L,B) if(!(B)){fprintf(stderr,"mismatch in %s\n",L);exit(1);} ++#define CHECK(L,B) if(!(B)){fprintf(stderr,"mismatch in %s\n",L); return 1;} + + void error_exit (char *where) + { + fprintf (stderr, "ERROR:%s:%s\n", where, cg_get_error()); +- exit (1); ++ return 1; + } + + int main (int argc, char **argv) +diff -up cgnslib_2.5/tests/test_goto.c.exit cgnslib_2.5/tests/test_goto.c +--- cgnslib_2.5/tests/test_goto.c.exit 2008-01-19 09:15:16.000000000 +0530 ++++ cgnslib_2.5/tests/test_goto.c 2010-07-16 14:53:41.400276410 +0530 +@@ -10,13 +10,13 @@ + + float coord[NUM_SIDE*NUM_SIDE*NUM_SIDE]; + +-#define CHECK(L,B) if(!(B)){fprintf(stderr,"mismatch in %s\n",L);exit(1);} ++#define CHECK(L,B) if(!(B)){fprintf(stderr,"mismatch in %s\n",L); return 1;} + + void error_exit (int iserr, char *msg) + { + if (iserr) { + printf ("ERROR:%s\n", msg); +- exit (1); ++ return 1; + } + else + printf ("WARNING:%s\n", msg); +diff -up cgnslib_2.5/tests/write_array.c.exit cgnslib_2.5/tests/write_array.c +--- cgnslib_2.5/tests/write_array.c.exit 2008-01-19 09:15:16.000000000 +0530 ++++ cgnslib_2.5/tests/write_array.c 2010-07-16 14:53:41.401276620 +0530 +@@ -24,7 +24,7 @@ int main (int argc, char **argv) + array = (float *) malloc (arraysize * sizeof(float)); + if (NULL == array) { + fprintf (stderr, "malloc failed\n"); +- exit (1); ++ return 1; + } + for (na = 0; na < arraysize; na++) + array[na] = (float)na; +diff -up cgnslib_2.5/tests/write_rind.c.exit cgnslib_2.5/tests/write_rind.c +--- cgnslib_2.5/tests/write_rind.c.exit 2008-01-19 09:15:16.000000000 +0530 ++++ cgnslib_2.5/tests/write_rind.c 2010-07-16 14:53:41.401276620 +0530 +@@ -59,7 +59,7 @@ int main () + nmap = (int *) malloc((num_coord + 8 * num_element) * sizeof(int)); + if (NULL == xcoord || NULL == nmap) { + fprintf(stderr, "malloc failed for data\n"); +- exit(1); ++ return 1; + } + ycoord = xcoord + num_coord; + zcoord = ycoord + num_coord; +diff -up cgnslib_2.5/tests/write_test.c.exit cgnslib_2.5/tests/write_test.c +--- cgnslib_2.5/tests/write_test.c.exit 2007-01-01 05:23:15.000000000 +0530 ++++ cgnslib_2.5/tests/write_test.c 2010-07-16 14:53:41.405259439 +0530 +@@ -57,7 +57,7 @@ void write_mixed(), write_mismatched(); + void error_exit (char *where) + { + fprintf (stderr, "ERROR:%s:%s\n", where, cg_get_error()); +- exit (1); ++ return 1; + } + + int main () +@@ -83,7 +83,7 @@ void init_data() + xcoord = (float *) malloc (6 * num_coord * sizeof(float)); + if (NULL == xcoord) { + fprintf(stderr, "malloc failed for coordinates\n"); +- exit(1); ++ return 1; + } + ycoord = xcoord + 2 * num_coord; + zcoord = ycoord + 2 * num_coord; +@@ -103,7 +103,7 @@ void init_data() + solution = (float *) malloc (max_sol * sizeof(float)); + if (NULL == solution) { + fprintf(stderr, "malloc failed for solution\n"); +- exit(1); ++ return 1; + } + for (n = 0; n < max_sol; n++) + solution[n] = (float)(n + 1); +@@ -114,7 +114,7 @@ void init_data() + elements = (int *) malloc (8 * num_element * sizeof(int)); + if (NULL == elements) { + fprintf(stderr, "malloc failed for elements"); +- exit(1); ++ return 1; + } + for (n = 0, k = 1; k < NUM_SIDE; k++) { + for (j = 1; j < NUM_SIDE; j++) { +@@ -140,7 +140,7 @@ void init_data() + parent = (int *) malloc (4 * num_face * sizeof(int)); + if (NULL == faces || NULL == parent) { + fprintf(stderr, "malloc failed for elements"); +- exit(1); ++ return 1; + } + for (n = 0; n < 4*num_face; n++) + parent[n] = 0; +@@ -231,7 +231,7 @@ void init_data() + pts = (int *) malloc (12 * npts * sizeof(int)); + if (NULL == pts) { + fprintf(stderr, "malloc failed for connectivity points"); +- exit(1); ++ return 1; + } + d_pts = pts + 6 * npts; + +@@ -240,7 +240,7 @@ void init_data() + interp = (float *) malloc (6 * npts * sizeof(float)); + if (NULL == interp) { + fprintf(stderr, "malloc failed for interpolate array"); +- exit(1); ++ return 1; + } + } + +diff -up cgnslib_2.5/tools/cgnscheck.c.exit cgnslib_2.5/tools/cgnscheck.c +--- cgnslib_2.5/tools/cgnscheck.c.exit 2008-07-10 08:03:57.000000000 +0530 ++++ cgnslib_2.5/tools/cgnscheck.c 2010-07-16 14:53:41.410258740 +0530 +@@ -157,7 +157,7 @@ static void error_exit(char *func) + if (func != NULL && *func) + printf("%s:", func); + printf("%s\n", cg_get_error()); +- exit(1); ++ return 1; + } + + /*----------------------------------------------------------------------*/ +@@ -173,7 +173,7 @@ static void create_names (int cnt, int * + names = (CGNSNAME *) malloc (cnt * sizeof(CGNSNAME)); + if (names == NULL) { + fprintf (stderr, "malloc failed for cgns name list\n"); +- exit (1); ++ return 1; + } + *maxcnt = cnt; + *namelist = names; +@@ -242,7 +242,7 @@ static void go_absolute (char *dsname, . + num = va_arg (arg, int); + if (goDepth == MAX_GOTO_DEPTH) { + fprintf (stderr, "maximum depth of goto exceeded\n"); +- exit (1); ++ return 1; + } + strncpy (goLabel[goDepth], name, 32); + goLabel[goDepth][32] = 0; +@@ -273,7 +273,7 @@ static void go_relative (char *dsname, . + else if (strcmp (name, ".")) { + if (goDepth == MAX_GOTO_DEPTH) { + fprintf (stderr, "maximum depth of goto exceeded\n"); +- exit (1); ++ return 1; + } + strncpy (goLabel[goDepth], name, 32); + goLabel[goDepth][32] = 0; +@@ -356,7 +356,7 @@ static char *temporary_file (void) + strcpy (temp, "cgnsXXXXXX"); + if (mktemp (temp) == NULL) { + fprintf (stderr, "failed to create temporary filename\n"); +- exit (1); ++ return 1; + } + return temp; + } +@@ -370,12 +370,12 @@ static void copy_file (char *oldfile, ch + + if (NULL == (oldfp = fopen (oldfile, "rb"))) { + fprintf (stderr, "error opening input file for reading\n"); +- exit (1); ++ return 1; + } + if (NULL == (newfp = fopen (newfile, "w+b"))) { + fclose (oldfp); + fprintf (stderr, "error opening output file for writing\n"); +- exit (1); ++ return 1; + } + while (EOF != (c = getc (oldfp))) + putc (c, newfp); +@@ -424,7 +424,7 @@ static char *update_version (char *cgnsf + unlink (outfile); + if (rename (tempfile, outfile)) { + fprintf (stderr, "rename %s -> %s failed\n", tempfile, outfile); +- exit (1); ++ return 1; + } + return outfile; + } +@@ -660,7 +660,7 @@ static void read_zone (int nz) + z->sets = (ELEMSET *) malloc (nsets * sizeof(ELEMSET)); + if (NULL == z->sets) { + fprintf (stderr, "malloc failed for element sets\n"); +- exit (1); ++ return 1; + } + + /* read element sets */ +@@ -678,14 +678,14 @@ static void read_zone (int nz) + es->elements = (int *) malloc (nn * sizeof(int)); + if (NULL == es->elements) { + fprintf (stderr, "malloc failed for elements\n"); +- exit (1); ++ return 1; + } + es->parent = NULL; + if (hasparent) { + es->parent = (int *) malloc (4 * nelem * sizeof(int)); + if (NULL == es->parent) { + fprintf (stderr, "malloc failed for elemset parent data\n"); +- exit (1); ++ return 1; + } + } + if (cg_elements_read (cgnsfn, cgnsbase, nz, ns, es->elements, +@@ -792,7 +792,7 @@ static void read_zone (int nz) + z->faces = HashCreate (nn, compare_faces, hash_face); + if (z->faces == NULL) { + fprintf (stderr, "malloc failed for face hash table\n"); +- exit (1); ++ return 1; + } + + for (es = z->sets, ns = 0; ns < nsets; ns++, es++) { +@@ -839,7 +839,7 @@ static void read_zone (int nz) + pf = (FACE *) malloc (sizeof(FACE)); + if (NULL == pf) { + fprintf (stderr, "malloc failed for new face\n"); +- exit (1); ++ return 1; + } + pf->e1 = es->is + ne; + pf->f1 = j + 1; +@@ -869,7 +869,7 @@ static void read_zone (int nz) + nodes = (int *) calloc (maxnode, sizeof(int)); + if (nodes == NULL) { + fprintf (stderr, "malloc failed for zone nodes\n"); +- exit (1); ++ return 1; + } + HashList (z->faces, get_extnodes, nodes); + for (nn = 0, n = 0; n < z->nnodes; n++) { +@@ -879,7 +879,7 @@ static void read_zone (int nz) + z->extnodes = (int *) malloc (nn * sizeof(int)); + if (z->extnodes == NULL) { + fprintf (stderr, "malloc failed for zone exterior nodes\n"); +- exit (1); ++ return 1; + } + for (nn = 0, n = 0; n < z->nnodes; n++) { + if (nodes[n]) z->extnodes[nn++] = n + 1; +@@ -1081,7 +1081,7 @@ static int read_exponents (float exps[9] + } + else { + fprintf (stderr, "invalid data type for exponents\n"); +- exit (1); ++ return 1; + } + if (ierr) { + if (ierr != CG_NODE_NOT_FOUND) +@@ -1908,7 +1908,7 @@ static void check_coordinates (int ng) + } + if (NULL == (coord = (float *) malloc (np * sizeof(float)))) { + fprintf (stderr, "malloc failed for %d coordinate values\n", np); +- exit (1); ++ return 1; + } + if (z->maxnode < np) z->maxnode = np; + +@@ -2295,7 +2295,7 @@ static int check_interface (ZONE *z, Poi + p = (int *) malloc (np * z->idim * sizeof(int)); + if (p == NULL) { + fprintf (stderr, "malloc failed for point/element list\n"); +- exit (1); ++ return 1; + } + n = 0; + if (z->idim == 1) { +@@ -2509,7 +2509,7 @@ static void check_BCdata (BCType_t bctyp + pts = (int *) malloc (z->idim * npnts * sizeof(int)); + if (NULL == pts) { + fprintf (stderr, "malloc failed for BCDataSet points\n"); +- exit (1); ++ return 1; + } + if (cg_ptset_read (pts)) error_exit("cg_ptset_read"); + if (ptype == PointRange || ptype == ElementRange) { +@@ -2685,7 +2685,7 @@ static void check_BC (int nb, int parcla + pts = (int *) malloc (z->idim * npts * sizeof(int)); + if (NULL == pts) { + fprintf (stderr, "malloc failed for BC points\n"); +- exit (1); ++ return 1; + } + nrmllist = NULL; + if (nrmlflag && LibraryVersion < 2200) { +@@ -2693,7 +2693,7 @@ static void check_BC (int nb, int parcla + nrmllist = (void *) malloc (nrmlflag * n); + if (nrmllist == NULL) { + fprintf (stderr, "malloc failed for BC normals\n"); +- exit (1); ++ return 1; + } + } + if (cg_boco_read (cgnsfn, cgnsbase, cgnszone, nb, pts, nrmllist)) +@@ -3314,7 +3314,7 @@ static void check_conn (int nc) + dpts = (int *) malloc (dnpts * dz->idim * sizeof(int)); + if (NULL == pts || NULL == dpts) { + fprintf (stderr, "malloc failed for connectivity points\n"); +- exit (1); ++ return 1; + } + if (cg_conn_read (cgnsfn, cgnsbase, cgnszone, nc, pts, Integer, dpts)) + error_exit("cg_conn_read"); +@@ -3476,7 +3476,7 @@ static void check_hole (int nh) + int *pnts = (int *) malloc (np * z->idim * sizeof(int)); + if (pnts == NULL) { + fprintf (stderr, "malloc failed for hole data\n"); +- exit (1); ++ return 1; + } + if (cg_hole_read (cgnsfn, cgnsbase, cgnszone, nh, pnts)) + error_exit("cg_hole_read"); +@@ -3790,7 +3790,7 @@ static void check_zone_iter (void) + desc = (char *) malloc (size); + if (desc == NULL) { + fprintf (stderr, "malloc failed for zone iter data\n"); +- exit (1); ++ return 1; + } + if (cg_array_read (n, desc)) error_exit("cg_array_read"); + ierr = 0; +@@ -4637,7 +4637,7 @@ static void check_base_iter (void) + icnt = (int *) malloc (NumSteps * sizeof(int)); + if (icnt == NULL) { + fprintf (stderr, "malloc failed for number of families\n"); +- exit (1); ++ return 1; + } + if (cg_array_read (nnf, icnt)) error_exit("cg_array_read"); + for (ns = 0; ns < NumSteps; ns++) { +@@ -4667,7 +4667,7 @@ static void check_base_iter (void) + desc = (char *) malloc (32 * nmax * NumSteps * sizeof(char)); + if (NULL == desc) { + fprintf (stderr, "malloc failed for family pointers\n"); +- exit (1); ++ return 1; + } + if (cg_array_read (nfp, desc)) error_exit("cg_array_read"); + for (ierr = 0, n = 0, ns = 0; ns < NumSteps; ns++) { +@@ -4717,7 +4717,7 @@ static void check_base_iter (void) + icnt = (int *) malloc (NumSteps * sizeof(int)); + if (icnt == NULL) { + fprintf (stderr, "malloc failed for number of zones\n"); +- exit (1); ++ return 1; + } + if (cg_array_read (nnz, icnt)) error_exit("cg_array_read"); + for (ns = 0; ns < NumSteps; ns++) { +@@ -4747,7 +4747,7 @@ static void check_base_iter (void) + desc = (char *) malloc (32 * nmax * NumSteps * sizeof(char)); + if (NULL == desc) { + fprintf (stderr, "malloc failed for zone pointers\n"); +- exit (1); ++ return 1; + } + if (cg_array_read (nzp, desc)) error_exit("cg_array_read"); + for (ierr = 0, n = 0, ns = 0; ns < NumSteps; ns++) { +@@ -4830,7 +4830,7 @@ static void check_base (void) + Zones = (ZONE *) malloc (NumZones * sizeof(ZONE)); + if (NULL == Zones) { + fprintf (stderr, "malloc failed for zones\n"); +- exit (1); ++ return 1; + } + MaxZones = NumZones; + } +@@ -5055,7 +5055,7 @@ int main (int argc, char *argv[]) + char *newfile = argind < argc ? argv[argind] : NULL; + cgnsfile = update_version (cgnsfile, newfile); + if (update == 'U') +- exit (0); ++ return 0; + } + + printf ("reading CGNS file %s\n", cgnsfile); +diff -up cgnslib_2.5/tools/cgnsdiff.c.exit cgnslib_2.5/tools/cgnsdiff.c +--- cgnslib_2.5/tools/cgnsdiff.c.exit 2008-01-19 09:15:16.000000000 +0530 ++++ cgnslib_2.5/tools/cgnsdiff.c 2010-07-16 14:53:41.411259439 +0530 +@@ -50,7 +50,7 @@ static void err_exit (char *msg, char *n + fprintf (stderr, "%s:", name); + fprintf (stderr, "%s\n", errmsg); + } +- exit (1); ++ return 1; + } + + static size_t data_size (char *type, int ndim, int *dims, int *size) +@@ -200,12 +200,12 @@ static void compare_data (char *name1, d + data1 = malloc (bytes); + if (data1 == NULL) { + fprintf (stderr, "%s:malloc failed for node data\n", name1); +- exit (1); ++ return 1; + } + data2 = malloc (bytes); + if (data2 == NULL) { + fprintf (stderr, "%s:malloc failed for node data\n", name2); +- exit (1); ++ return 1; + } + ADF_Read_All_Data (id1, data1, &err); + if (err > 0) +@@ -318,7 +318,7 @@ static void compare_nodes (char *name1, + children1 = (char *) malloc (33 * nc1); + if (children1 == NULL) { + fprintf (stderr, "%s:malloc failed for children names\n", name1); +- exit (1); ++ return 1; + } + ADF_Children_Names (id1, 1, nc1, 32, &nret, children1, &err); + if (err > 0) +@@ -334,7 +334,7 @@ static void compare_nodes (char *name1, + children2 = (char *) malloc (33 * nc2); + if (children2 == NULL) { + fprintf (stderr, "%s:malloc failed for children names\n", name2); +- exit (1); ++ return 1; + } + ADF_Children_Names (id2, 1, nc2, 32, &nret, children2, &err); + if (err > 0) +diff -up cgnslib_2.5/tools/cgnslist.c.exit cgnslib_2.5/tools/cgnslist.c +--- cgnslib_2.5/tools/cgnslist.c.exit 2010-07-16 14:56:54.232285562 +0530 ++++ cgnslib_2.5/tools/cgnslist.c 2010-07-16 14:57:30.726261263 +0530 +@@ -35,7 +35,7 @@ static void err_exit (char *name, int er + fflush (stdout); + ADF_Error_Message (errcode, errmsg); + fprintf (stderr, "error in %s:%s\n", name, errmsg); +- exit (1); ++ return 1; + } + + static void print_node (double node_id) +@@ -108,7 +108,7 @@ static void print_children (double paren + + if (leader_len + indent > MAX_LEADER) { + fprintf (stderr, "nesting is too deep\n"); +- exit (1); ++ return 1; + } + leader_len += indent; + for (nc = 0; nc < indent; nc++) +@@ -178,7 +178,7 @@ int main (int argc, char *argv[]) + indent = atoi (argarg); + if (indent < 1) { + fprintf (stderr, "indent must be > 0\n"); +- exit (1); ++ return 1; + } + break; + case 'f': +@@ -240,7 +240,6 @@ int main (int argc, char *argv[]) + ADF_Database_Close (root_id, &err); + if (err > 0) + err_exit ("ADF_Database_Close", err); +- exit (0); + return 0; /* prevent compiler warning */ + } + +diff -up cgnslib_2.5/tools/cgnspack.c.exit cgnslib_2.5/tools/cgnspack.c +--- cgnslib_2.5/tools/cgnspack.c.exit 2010-07-16 14:55:32.576385225 +0530 ++++ cgnslib_2.5/tools/cgnspack.c 2010-07-16 14:56:30.021261676 +0530 +@@ -24,12 +24,12 @@ int main (int argc, char **argv) + + if (argc < 2 || argc > 3) { + fprintf (stderr, "usage: cgnspack CGNSfile [newCGNSfile]\n"); +- exit (1); ++ return 1; + } + inpfile = argv[1]; + if (stat (inpfile, &inpst)) { + fprintf (stderr, "can't stat %s\n", inpfile); +- exit (1); ++ return 1; + } + + if (argc == 3) +@@ -38,7 +38,7 @@ int main (int argc, char **argv) + outfile = (char *) malloc (strlen(inpfile) + 6); + if (NULL == outfile) { + fprintf (stderr, "malloc failed for temporary filename\n"); +- exit (1); ++ return 1; + } + sprintf (outfile, "%s.temp", inpfile); + } +@@ -48,13 +48,13 @@ int main (int argc, char **argv) + if (ierr > 0) { + ADF_Error_Message (ierr, errmsg); + fprintf (stderr, "ADF_Database_Open ERROR : %s\n", errmsg); +- exit (1); ++ return 1; + } + ADF_Database_Open (outfile, "NEW", "NATIVE", &outid, &ierr); + if (ierr > 0) { + ADF_Error_Message (ierr, errmsg); + fprintf (stderr, "ADF_Database_Open ERROR : %s\n", errmsg); +- exit (1); ++ return 1; + } + + ts = time (NULL); +@@ -65,7 +65,7 @@ int main (int argc, char **argv) + if (ierr > 0) { + ADF_Error_Message (ierr, errmsg); + fprintf (stderr, "ADF_Database_Close ERROR : %s\n", errmsg); +- exit (1); ++ return 1; + } + + /* output database closed in adf_cond() */ +@@ -74,14 +74,14 @@ int main (int argc, char **argv) + unlink (inpfile); + if (rename (outfile, inpfile)) { + fprintf (stderr, "rename %s -> %s failed", outfile, inpfile); +- exit (1); ++ return 1; + } + outfile = inpfile; + } + + if (stat (outfile, &outst)) { + fprintf (stderr, "can't stat %s\n", outfile); +- exit (1); ++ return 1; + } + + printf ("initial size = %ld bytes\n", (long)inpst.st_size); +diff -up cgnslib_2.5/tools/cgnsversion.c.exit cgnslib_2.5/tools/cgnsversion.c +--- cgnslib_2.5/tools/cgnsversion.c.exit 2008-01-19 09:15:16.000000000 +0530 ++++ cgnslib_2.5/tools/cgnsversion.c 2010-07-16 14:53:41.412259997 +0530 +@@ -100,7 +100,7 @@ static void error_exit (char *msg, int e + if (inproot >= 0.0) ADF_Database_Close (inproot, &ierr); + if (outroot >= 0.0) ADF_Database_Close (outroot, &ierr); + if (outfile != NULL) unlink (outfile); +- exit (1); ++ return 1; + } + + /*--------------------------------------------------------------------*/ +@@ -1082,7 +1082,7 @@ int main (int argc, char **argv) + if (FileVersion < 1200) { + fprintf (stderr, + "ADF incompatibilities do not allow versions prior to 1.2\n"); +- exit (1); ++ return 1; + } + + for (n = 0; n < nVersions; n++) { +@@ -1096,13 +1096,13 @@ int main (int argc, char **argv) + fprintf (stderr, ", %g", 0.001 * (float)VersionList[n]); + } + fprintf (stderr, " or %g\n", 0.001 * (float)LibraryVersion); +- exit (1); ++ return 1; + } + + inpfile = argv[argind++]; + if (access (inpfile, 0)) { + fprintf (stderr, "input file \"%s\" not found\n", inpfile); +- exit (1); ++ return 1; + } + + /* read the input file using the CGNS routines in order to +@@ -1118,13 +1118,13 @@ int main (int argc, char **argv) + cg_close (inpfn); + fprintf (stderr, + "file version is more recent than then CGNS library version\n"); +- exit (1); ++ return 1; + } + if (FileVersion == FromVersion) { + cg_close (inpfn); + fprintf (stderr, "file version is already at version %g\n", + FloatVersion); +- exit (1); ++ return 1; + } + + printf ("converting \"%s\" from version %g to %g\n", +@@ -1144,7 +1144,7 @@ int main (int argc, char **argv) + if (outfile == NULL) { + cg_close (inpfn); + fprintf (stderr, "failed to create a temporary file\n"); +- exit (1); ++ return 1; + } + printf ("writing output to temporary file \"%s\"\n", outfile); + +@@ -1173,7 +1173,7 @@ int main (int argc, char **argv) + unlink (inpfile); + if (rename (outfile, inpfile)) { + fprintf (stderr, "rename %s -> %s failed", outfile, inpfile); +- exit (1); ++ return 1; + } + + return 0; +diff -up cgnslib_2.5/tools/getargs.c.exit cgnslib_2.5/tools/getargs.c +--- cgnslib_2.5/tools/getargs.c.exit 2007-01-01 05:12:35.000000000 +0530 ++++ cgnslib_2.5/tools/getargs.c 2010-07-16 14:53:41.412259997 +0530 +@@ -22,7 +22,7 @@ char **usgmsg, *errmsg; + fprintf (stderr, "ERROR: %s\n", errmsg); + for (n = 0; NULL != usgmsg[n]; n++) + fprintf (stderr, "%s\n", usgmsg[n]); +- exit (NULL != errmsg); ++ return (NULL != errmsg); + } + + /*---------- getargs --------------------------------------------------- +@@ -80,7 +80,7 @@ char **argv, *ostr; + (oli = strchr (ostr, argopt)) == NULL) { + if (argerr) { + fprintf (stderr, "invalid option - `%c'\n", argopt); +- exit (-1); ++ return -1; + } + return (argopt); + } +@@ -106,7 +106,7 @@ char **argv, *ostr; + if (++argind >= argc) { + if (!argerr) return (':'); + fprintf (stderr, "missing argument for option `%c'\n", argopt); +- exit (1); ++ return 1; + } + place = argv[argind]; + } diff --git a/cgnslib-2.5-4-set-so.patch b/cgnslib-2.5-4-set-so.patch new file mode 100644 index 0000000..cfe9d2a --- /dev/null +++ b/cgnslib-2.5-4-set-so.patch @@ -0,0 +1,37 @@ +diff -up cgnslib_2.5/configure.so cgnslib_2.5/configure +--- cgnslib_2.5/configure.so 2008-07-11 05:47:50.000000000 +0530 ++++ cgnslib_2.5/configure 2010-07-15 23:47:56.101811596 +0530 +@@ -2048,8 +2048,8 @@ if test $shared = yes; then + shared=no + else + CFGFLAGS="-fPIC $CFGFLAGS" +- AR="\$(CC) -shared $SYSCFLAGS -Wl,-rpath,$cgnsdir/\$(SYSTEM)" +- LIBEXT=so ++ AR="\$(CC) -shared $SYSCFLAGS -Wl,-soname,libcgns.so.1.0 -Wl,-rpath,$cgnsdir/\$(SYSTEM)" ++ LIBEXT=so.1.0 + fi + fi + if test $shared = yes; then +diff -up cgnslib_2.5/Makefile.in.so cgnslib_2.5/Makefile.in +--- cgnslib_2.5/Makefile.in.so 2008-01-19 09:15:16.000000000 +0530 ++++ cgnslib_2.5/Makefile.in 2010-07-15 23:47:56.102811387 +0530 +@@ -50,6 +50,7 @@ $(CGNSLIB) : $(OBJDIR) $(CGNSOBJS) $(ADF + -@$(RM) $@ + $(AR) $(AROUT)$@ $(CGNSOBJS) $(ADFOBJS) $(F2COBJS) + $(RANLIB) $@ ++ cd $(SYSTEM); ln -sf libcgns.so.1.0 libcgns.so + + $(OBJDIR) : + -$(MKDIR) $(OBJDIR) +diff -up cgnslib_2.5/tests/Makefile.in.so cgnslib_2.5/tests/Makefile.in +--- cgnslib_2.5/tests/Makefile.in.so 2010-07-15 23:48:18.602061430 +0530 ++++ cgnslib_2.5/tests/Makefile.in 2010-07-15 23:49:26.214822351 +0530 +@@ -7,7 +7,7 @@ CGNSLIB = $(CGNSDIR)/$(LIBCGNS) + + COPTS = $(CFLAGS) -I$(CGNSDIR) -I$(CGNSDIR)/$(ADFDIR) + FOPTS = $(FFLAGS) -I$(CGNSDIR) +-LDLIBS = $(CGNSLIB) $(HDF5LIB) $(SZIPLIB) $(ZLIBLIB) ++LDLIBS = $(CGNSLIB) $(HDF5LIB) $(SZIPLIB) $(ZLIBLIB) -L$(CGNSDIR)/$(SYSTEM) -lcgns -Wl,-rpath,$(CGNSDIR)/$(SYSTEM) + + #---------- + diff --git a/cgnslib.spec b/cgnslib.spec new file mode 100644 index 0000000..8beb8b1 --- /dev/null +++ b/cgnslib.spec @@ -0,0 +1,129 @@ +# Package whose only architecture dependent binary is a library +%global debug_package %{nil} + +Name: cgnslib +Version: 2.5 +Release: 3.r4%{?dist} +Summary: Computational Fluid Dynamics General Notation System + +Group: Development/Libraries +License: zlib +URL: http://www.cgns.org/ + +Source: http://downloads.sourceforge.net/project/cgns/%{name}_%{version}/Release%204/%{name}_%{version}-4.tar.gz +Source1: http://www.grc.nasa.gov/WWW/cgns/user/usersguide.pdf +Patch0: cgnslib-2.5-4-set-so.patch +Patch1: cgnslib-2.5-4-replace-exit-to-return.patch + +BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) + +BuildRequires: hdf5-devel >= 1.8 +BuildRequires: zlib-devel +BuildRequires: gcc-gfortran +BuildRequires: chrpath + + +%description +The Computational Fluid Dynamics General Notation System (CGNS) provides +a general, portable, and extensible standard for the storage and +retrieval of computational fluid dynamics (CFD) analysis +data. It consists of a collection of conventions, and free +and open software implementing those conventions. It is +self-descriptive, machine-independent, well-documented, and +administered by an international steering committee. + + +%package devel +Summary: Header files for %{name} package +Group: Development/Libraries +Requires: %{name} = %{version}-%{release} + +%description devel +The %{name}-devel package contains the header files +for %{name} package. + +%prep +%setup -q -n %{name}_%{version} +%patch0 -p1 -b .so +%patch1 -p1 -b .exit + +%{__sed} -i -e "s|LIBDIR.*= @LIBDIR@|LIBDIR = \$(DESTDIR)@LIBDIR@|" \ + -e "s|INCLUDEDIR.*= @INCLUDEDIR@|INCLUDEDIR = \$(DESTDIR)@INCLUDEDIR@|" \ + make.defs.in + +%{__sed} -i "s|dbtest|./dbtest|" tests/rundbtest + +%{__cp} %{SOURCE1} %{_builddir}/%{name}_%{version} + +%build +%configure --enable-gcc \ + --enable-shared \ + --enable-lfs \ + --with-zlib \ +%ifarch x86_64 ppc64 sparc64 + --enable-64bit \ +%endif + --with-hdf5 + +%{__make} %{?_smp_mflags} + + +%install +%{__rm} -rf %{buildroot} +%{__mkdir} -p %{buildroot}%{_libdir} +%{__mkdir} -p %{buildroot}%{_includedir} +%{__mkdir} -p %{buildroot}%{_docdir} +%{__make} INSTALL="install -p" install DESTDIR=%{buildroot} + +chrpath --delete %{buildroot}%{_libdir}/libcgns.so.1.0 +chmod 0755 %{buildroot}%{_libdir}/libcgns.so.1.0 + + +%ifarch x86_64 ppc64 sparc64 +%{__cp} -pP LINUX64/libcgns.so %{buildroot}%{_libdir} +%else +%{__cp} -pP LINUX/libcgns.so %{buildroot}%{_libdir} +%endif + + +%check +cd tests +%{__make} +./rundbtest + +%post -p /sbin/ldconfig + +%postun -p /sbin/ldconfig + +%clean +%{__rm} -rf %{buildroot} + +%files +%defattr(-,root,root,-) +%doc LICENSE README +%{_libdir}/libcgns.so.1.0 + +%files devel +%defattr(-,root,root,-) +%doc usersguide.pdf +%{_includedir}/cgnslib.h +%{_includedir}/cgnslib_f.h +%{_includedir}/cgnswin_f.h +%{_libdir}/libcgns.so + +%changelog +* Sun Jul 18 2010 Shakthi Kannan 2.5-3.r4 +- Use zlib license that supercedes LGPLv2. + +* Fri Jul 16 2010 Shakthi Kannan 2.5-2.r4 +- Expanded CFD abbreviation. +- Added -devel sub-package. +- Added global debug_package nil. +- Added patch for creating shared library with soname. +- Added patch to fix library returning exit. +- Added usersguide.pdf to -devel sub-package. +- hdf5 atleast 1.8 is required. +- Added if condition for matching LINUX64 when copying library. + +* Sat Aug 15 2009 Chitlesh Goorah 2.5-1.r4 +- New Package diff --git a/import.log b/import.log new file mode 100644 index 0000000..0305767 --- /dev/null +++ b/import.log @@ -0,0 +1 @@ +cgnslib-2_5-3_r4_fc14:HEAD:cgnslib-2.5-3.r4.fc14.src.rpm:1279599368 diff --git a/sources b/sources index e69de29..21fb729 100644 --- a/sources +++ b/sources @@ -0,0 +1,2 @@ +42063efdf726c81300a51c3495d3224e cgnslib_2.5-4.tar.gz +453788d1d9f7f383f76fde08c022a9a6 usersguide.pdf