[cig-commits] [commit] pluggable: Add license and usage (c973ab5)
cig_noreply at geodynamics.org
cig_noreply at geodynamics.org
Wed Apr 9 08:55:36 PDT 2014
Repository : ssh://geoshell/specfem3d_globe
On branch : pluggable
Link : https://github.com/geodynamics/specfem3d_globe/compare/64e1b38f0c5ebb4056cce0b15d41c0b9f94ab6e5...099a4d330d5b173b21e51ad441f9f429e5d37842
>---------------------------------------------------------------
commit c973ab5c572c6ae1db85696adf644040ff1f2bb0
Author: Eh Tan <tan2 at earth.sinica.edu.tw>
Date: Wed May 6 18:29:03 2009 +0000
Add license and usage
>---------------------------------------------------------------
c973ab5c572c6ae1db85696adf644040ff1f2bb0
UTILS/seis_process/asc2sac.c | 41 +++++++++++++++++++++++++++++++++--------
1 file changed, 33 insertions(+), 8 deletions(-)
diff --git a/UTILS/seis_process/asc2sac.c b/UTILS/seis_process/asc2sac.c
index c1c1db8..455ed69 100644
--- a/UTILS/seis_process/asc2sac.c
+++ b/UTILS/seis_process/asc2sac.c
@@ -1,4 +1,22 @@
-/* License
+/*
+ * asc2sac.c by Eh Tan
+ *
+ * Copyright (C) 2009, California Institute of Technology.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
*/
#include <stdio.h>
@@ -20,23 +38,30 @@ main(int argc, char *argv[])
FILE *f;
if(argc < 4) {
- fprintf(stderr, "%s ascii-file npts sac-file\n", argv[0]);
+ fprintf(stderr,
+ "Converting evenly spaced time series ASCII file to SAC binary\n"
+ "usage: %s ascii-file npts sac-file\n\n"
+ "ascii-file: name of the input file. The file must have two columns,\n"
+ " 1st column must be evenly spaced.\n"
+ "npts: number of lines in the input file.\n"
+ "sac-file: name of the output file.\n",
+ argv[0]);
exit(1);
}
str = argv[2];
errno = 0;
+ endptr = str;
npts = strtol(str, &endptr, 10);
/* Check for various possible errors */
- if ((errno == ERANGE && (npts == INT_MAX || npts == INT_MIN))
- || (errno != 0 && npts <= 0)) {
- perror("strtol");
- exit(EXIT_FAILURE);
+ if (errno || (*endptr != 0)) {
+ fprintf(stderr, "Error when converting '%s' to integer\n", str);
+ exit(-1);
}
- if (endptr == str) {
- fprintf(stderr, "No npts were found\n");
+ if (npts <= 0) {
+ fprintf(stderr, "npts must be positive\n");
exit(EXIT_FAILURE);
}
More information about the CIG-COMMITS
mailing list