Check for abbreviations of strings and get words from strings.
More...
#include "initial.h"
#include <ctype.h>
#include "straux.h"
|
#define | NO_INITIAL_MACROS 1 |
|
|
int | abbrev (CONST char *s, CONST char *t) |
| Compare strings s and t. More...
|
|
int | getword (CONST char *s, int *spos, char *word, int maxlen, char blank, char endchar) |
| Copies a blank or '\0' or < endchar > delimeted word from position *spos of the string s to the string word and increment *spos to the position of the first non-blank character after the word. More...
|
|
int | stricmp (CONST char *a, CONST char *b) |
| Case independent comparison of character strings. More...
|
|
- Author
- Konrad Bernloehr
- Date
CVS $Date: 2018/11/26 12:29:34 $
- Version
CVS $Revision: 1.5 $
◆ abbrev()
int abbrev |
( |
CONST char * |
s, |
|
|
CONST char * |
t |
|
) |
| |
s may be an abbreviation of t. Upper/lower case in s is ignored. s has to be at least as long as the leading upper case, digit, and '_' part of t.
- Parameters
-
s | The string to be checked. |
t | The test string with minimum part in upper case. |
- Returns
- 1 if s is an abbreviation of t, 0 if not.
◆ getword()
int getword |
( |
CONST char * |
s, |
|
|
int * |
spos, |
|
|
char * |
word, |
|
|
int |
maxlen, |
|
|
char |
blank, |
|
|
char |
endchar |
|
) |
| |
The word must have a length less than or equal to maxlen.
- Parameters
-
s | string with any number of words. |
spos | position in the string where we start and end. |
word | the extracted word. |
maxlen | the maximum allowed length of word. |
blank | has the same effect as ' ', i.e. end-of-word. |
endchar | his terminates the whole string ( as '\0' ). |
- Returns
- -2 : Invalid string or NULL -1 : The word was longer than maxlen (without the terminating '\0'); 0 : There were no more words in the string s. 1 : ok, we have a word and there are still more of them in the string s 2 : ok, but this was the last word
◆ stricmp()
int stricmp |
( |
CONST char * |
a, |
|
|
CONST char * |
b |
|
) |
| |
- Parameters
-
a,b | – strings to be compared. |
- Returns
- 0 : strings are equal (except perhaps for case) >0 : a is lexically 'greater' than b <0 : a is lexically 'smaller' than b