diff options
author | taw27 <taw27@bf6ca9ba-c028-0410-8290-897cf20841d1> | 2007-10-02 13:47:39 +0000 |
---|---|---|
committer | taw27 <taw27@bf6ca9ba-c028-0410-8290-897cf20841d1> | 2007-10-02 13:47:39 +0000 |
commit | 49b0bf4c38f7b2ecdb25b138abc8aa5ff06267c4 (patch) | |
tree | 012dfcf4fcdc04870b829483c6d7913cfff9ef32 /src/utils.c | |
parent | b819cd1defe15f492cd313129832383bf37ca82b (diff) |
DirAx stuff
git-svn-id: svn://cook.msm.cam.ac.uk:745/diff-tomo/dtr@139 bf6ca9ba-c028-0410-8290-897cf20841d1
Diffstat (limited to 'src/utils.c')
-rw-r--r-- | src/utils.c | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/src/utils.c b/src/utils.c index 4618b44..1e750a8 100644 --- a/src/utils.c +++ b/src/utils.c @@ -14,6 +14,7 @@ #include <gsl/gsl_matrix.h> #include "utils.h" +#include "string.h" /* Return the MOST POSITIVE of two numbers */ unsigned int biggest(signed int a, signed int b) { @@ -81,3 +82,30 @@ void matrix_renormalise(gsl_matrix *m) { } +size_t skipspace(const char *s) { + + size_t i; + + for ( i=0; i<strlen(s); i++ ) { + if ( (s[i] != ' ') && (s[i] != '\t') ) return i; + } + + return strlen(s); + +} + +void chomp(char *s) { + + size_t i; + + if ( !s ) return; + + for ( i=0; i<strlen(s); i++ ) { + if ( (s[i] == '\n') || (s[i] == '\r') ) { + s[i] = '\0'; + return; + } + } + +} + |