aboutsummaryrefslogtreecommitdiff
path: root/src/utils.c
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2010-08-16 15:44:35 +0200
committerThomas White <taw@physics.org>2012-02-22 15:26:55 +0100
commit02e1ef093dc34e79e832764029db838cd5c13261 (patch)
tree959fb50440d764a44092a9f53d35a8999283487b /src/utils.c
parent7cac57dd3a4fe1e2be8102c03e4fad0fa997273e (diff)
Read symmetry from PDB and store in unit cell structure
Diffstat (limited to 'src/utils.c')
-rw-r--r--src/utils.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/utils.c b/src/utils.c
index 0f20435e..a47f234f 100644
--- a/src/utils.c
+++ b/src/utils.c
@@ -18,15 +18,21 @@
#include "image.h"
-size_t skipspace(const char *s)
+size_t notrail(char *s)
{
size_t i;
+ size_t munched = 0;
- for ( i=0; i<strlen(s); i++ ) {
- if ( (s[i] != ' ') && (s[i] != '\t') ) return i;
+ for ( i=strlen(s)-1; i>=0; i-- ) {
+ if ( (s[i] == ' ') || (s[i] == '\t') ) {
+ s[i] = '\0';
+ munched++;
+ } else {
+ return munched;
+ }
}
- return strlen(s);
+ return munched;
}