CORSIKA add-on package IACT/ATMO:  Version 1.63 (November 2020)
Macros | Functions
straux.c File Reference

Check for abbreviations of strings and get words from strings. More...

#include "initial.h"
#include <ctype.h>
#include "straux.h"
Include dependency graph for straux.c:

Macros

#define NO_INITIAL_MACROS   1
 

Functions

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...
 

Detailed Description

Author
Konrad Bernloehr
Date
CVS $Date: 2018/11/26 12:29:34 $ 
Version
CVS $Revision: 1.5 $ 

Function Documentation

◆ 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
sThe string to be checked.
tThe 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
sstring with any number of words.
sposposition in the string where we start and end.
wordthe extracted word.
maxlenthe maximum allowed length of word.
blankhas the same effect as ' ', i.e. end-of-word.
endcharhis 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
Here is the caller graph for this function:

◆ 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