summaryrefslogtreecommitdiff
path: root/support/texlab/crates/bibutils_sys/src/is_ws.c
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2019-12-03 03:01:24 +0000
committerNorbert Preining <norbert@preining.info>2019-12-03 03:01:24 +0000
commitb8d4bb76703bcb15578e2b23c5d256532180b894 (patch)
treebedd1df7a00521a2bd986b3c0289d6556a59e39b /support/texlab/crates/bibutils_sys/src/is_ws.c
parent02e4625a78a5029e8b5dc2a4ec70193b232f497e (diff)
CTAN sync 201912030301
Diffstat (limited to 'support/texlab/crates/bibutils_sys/src/is_ws.c')
-rw-r--r--support/texlab/crates/bibutils_sys/src/is_ws.c48
1 files changed, 48 insertions, 0 deletions
diff --git a/support/texlab/crates/bibutils_sys/src/is_ws.c b/support/texlab/crates/bibutils_sys/src/is_ws.c
new file mode 100644
index 0000000000..4f9e22e35b
--- /dev/null
+++ b/support/texlab/crates/bibutils_sys/src/is_ws.c
@@ -0,0 +1,48 @@
+/*
+ * is_ws.c
+ *
+ * Copyright (c) Chris Putnam 2003-2019
+ *
+ * Source code released under the GPL version 2
+ *
+ */
+#include "is_ws.h"
+
+/* is_ws(), is whitespace */
+int
+is_ws( const char ch )
+{
+ if ( ch==' ' || ch=='\n' || ch=='\t' || ch=='\r' ) return 1;
+ else return 0;
+}
+
+const char *
+skip_ws( const char *p )
+{
+ if ( p ) {
+ while ( is_ws( *p ) ) p++;
+ }
+ return p;
+}
+
+const char *
+skip_notws( const char *p )
+{
+ if ( p ) {
+ while ( *p && !is_ws( *p ) ) p++;
+ }
+ return p;
+}
+
+const char *
+skip_line( const char *p )
+{
+ /* ...skip until end-of-line markers */
+ while ( *p && *p!='\n' && *p!='\r' ) p++;
+
+ /* ...skip end-of-line marker */
+ if ( *p=='\r' ) p++; /* for CR LF or just CR end of lines */
+ if ( *p=='\n' ) p++;
+
+ return p;
+}