tadded help message - sphere - GPU-based 3D discrete element method algorithm with optional fluid coupling
(HTM) git clone git://src.adamsgaard.dk/sphere
(DIR) Log
(DIR) Files
(DIR) Refs
(DIR) LICENSE
---
(DIR) commit ab5356655fac61353b4b0183aa4596dcb17dbb5c
(DIR) parent 30fc12a766762eb209feb56bd9ca836c5532b21c
(HTM) Author: Anders Damsgaard <anders.damsgaard@geo.au.dk>
Date: Thu, 8 May 2014 10:05:09 +0200
added help message
Diffstat:
M src/sphere_status.c | 23 ++++++++++++++++++-----
1 file changed, 18 insertions(+), 5 deletions(-)
---
(DIR) diff --git a/src/sphere_status.c b/src/sphere_status.c
t@@ -1,5 +1,8 @@
#include <stdio.h>
#include <unistd.h>
+#include <string.h>
+
+int print_usage(char* argv0, int return_status);
int main(int argc, char *argv[])
{
t@@ -13,11 +16,11 @@ int main(int argc, char *argv[])
}
// Simulation name/ID read from first input argument
- if (argc != 2) {
- fprintf(stderr, "You need to specify the simulation ID as an input "
- "parameter, e.g.\n%s particle_test\n", argv[0]);
- return 1;
- }
+ if (argc != 2)
+ return print_usage(argv[0], 1);
+
+ if (strcmp(argv[1], "-h") == 0 || strcmp(argv[1], "--help") == 0)
+ return print_usage(argv[0], 0);
char *sim_name = argv[1];
t@@ -52,4 +55,14 @@ int main(int argc, char *argv[])
return 1;
}
}
+
+int print_usage(char* argv0, int return_status)
+{
+ fprintf(stderr, "You need to specify the simulation ID as an input "
+ "parameter, e.g.\n%s particle_test\n", argv0);
+ return return_status;
+}
+
+
+
// vim: tabstop=8 expandtab shiftwidth=4 softtabstop=4