diff --git a/tecs/coc_client.c b/tecs/coc_client.c index f44c49f1..d3b1ef78 100644 --- a/tecs/coc_client.c +++ b/tecs/coc_client.c @@ -8,7 +8,6 @@ #include "myc_err.h" #include "coc_util.h" #include "coc_client.h" -#include "sys_util.h" #include "myc_str.h" /* --- non ANSI signal --- */ @@ -390,8 +389,14 @@ int CocWatchLog(CocConn *conn, char *loglist) { StrBuf *buf; int fd, iret; int i, siz, n; + static int init=1; - sys_ctrl_init(); +#if __VMS + if (init) { + init=0; + DECC$CRTL_INIT(); + } +#endif fd=conn->fd; CocReset(conn); ERR_I(CocPutStr(conn, "loglist", loglist)); diff --git a/tecs/coc_server.c b/tecs/coc_server.c index 98eb5982..f7440285 100644 --- a/tecs/coc_server.c +++ b/tecs/coc_server.c @@ -1,3 +1,4 @@ +#include #include #include #include @@ -9,7 +10,6 @@ #include #include #include "myc_mem.h" -#include "sys_util.h" #include "myc_err.h" #include "coc_logfile.h" #include "coc_util.h" @@ -477,6 +477,12 @@ void CocShowHandlers(char *buf, int buf_len) { return; } +#ifdef __VMS + typedef size_t socklen_type; +#else + typedef int socklen_type; +#endif + int CocHandle1Request(int tmo_msec, int fd) { struct sockaddr_in cadr; struct hostent *h; @@ -484,7 +490,7 @@ int CocHandle1Request(int tmo_msec, int fd) { CocClient *cl, *cl0; CocVar *var; int i, lmask, newfd, n, iret; - sys_adr_len cadrlen; /* see sys_util.h */ + socklen_type cadrlen; char *err, *cmd, *arg, *varname; void *base; diff --git a/tecs/coc_util.c b/tecs/coc_util.c index b90a024b..4f61c68e 100644 --- a/tecs/coc_util.c +++ b/tecs/coc_util.c @@ -1,4 +1,5 @@ #include +#include #include #include #include diff --git a/tecs/instr_hosts.c b/tecs/instr_hosts.c index 28c81cf6..4217bc31 100644 --- a/tecs/instr_hosts.c +++ b/tecs/instr_hosts.c @@ -3,7 +3,7 @@ #include #include #include "myc_str.h" -#include "sys_util.h" +#include "myc_fortran.h" typedef struct { char *instr; char *host; int port; char *user; int cod; } Instrument; static Instrument list[]={ diff --git a/tecs/make_gen b/tecs/make_gen index 5eebf3fc..ef00c4f1 100644 --- a/tecs/make_gen +++ b/tecs/make_gen @@ -10,7 +10,7 @@ SERV_OBJ =tecs.o coc_server.o tecs_lsc.o tecs_serial.o coc_logfile.o \ tecs_data.o $(LIBR_OBJ) CLI_OBJ =tecs_cli.o coc_client.o $(LIBR_OBJ) TCLI_OBJ =$(SYS_FILE).o $(SYS_FILE)_c.o $(CLI_OBJ) -TECLI_OBJ =tecs_client.o tecs_plot.o sys_util.o str.o instr_hosts.o \ +TECLI_OBJ =tecs_client.o tecs_plot.o str.o instr_hosts.o \ $(TCLI_OBJ) #.f.o: diff --git a/tecs/myc_buf.c b/tecs/myc_buf.c index 98049393..8c0e51bb 100644 --- a/tecs/myc_buf.c +++ b/tecs/myc_buf.c @@ -4,7 +4,6 @@ #include #include #include -#include "sys_util.h" #include "myc_err.h" #include "myc_str.h" #include "myc_buf.h" diff --git a/tecs/myc_err.c b/tecs/myc_err.c index aafd26be..c92112eb 100644 --- a/tecs/myc_err.c +++ b/tecs/myc_err.c @@ -2,7 +2,7 @@ #include #include -#include "sys_util.h" +#include "myc_fortran.h" #include "myc_str.h" #include "myc_err.h" @@ -15,7 +15,7 @@ static int stack_empty=1; int ErrCode; char *ErrMessage=NULL; -void (*outrtn)()=NULL; +void (*outrtn)(void *, char *)=NULL; void *outarg; void ErrTxt(char *text, int systemError) @@ -85,7 +85,7 @@ void ErrShort(char *msg) { outrtn(outarg, msg); } -void ErrSetOutRtn(void (*rtn)(), void *arg) { +void ErrSetOutRtn(void (*rtn)(void *, char *), void *arg) { outrtn=rtn; outarg=arg; } @@ -125,7 +125,7 @@ void F_FUN(err_msg)(F_CHAR(text), int text_len) { ErrMsg(buf); } -void F_FUN(err_set_outrtn)(void (*rtn)(), void *arg) { +void F_FUN(err_set_outrtn)(void (*rtn)(void *, char*), void *arg) { ErrSetOutRtn(rtn, arg); } diff --git a/tecs/myc_err.h b/tecs/myc_err.h index 66f555e6..cd5e89a3 100644 --- a/tecs/myc_err.h +++ b/tecs/myc_err.h @@ -76,7 +76,7 @@ void ErrCod(int code); void ErrShow(char *text); /* write out error message with stack info */ void ErrShort(char *msg); /* write out short error message */ void ERR_EXIT(char *text); -void ErrSetOutRtn(void (*rtn)(), void *arg); +void ErrSetOutRtn(void (*rtn)(void *,char *), void *arg); void ErrSetOutFile(FILE *file); extern int ErrCode; diff --git a/tecs/sys_util.h b/tecs/myc_fortran.h old mode 100644 new mode 100755 similarity index 52% rename from tecs/sys_util.h rename to tecs/myc_fortran.h index 7a24c2fa..33e5cf65 --- a/tecs/sys_util.h +++ b/tecs/myc_fortran.h @@ -12,10 +12,6 @@ Use macros STR_TO_C and STR_TO_F to convert from Fortran character strings to C character arrays and vice versa. - sys_adr_len (argument of accept and gethostbyadr, system dependent) - - sys_ctrl_init() (needed in VMS only) - */ @@ -23,36 +19,37 @@ typedef struct { short size, dummy; char *text; } SysVmsChar; -#define F_CHAR(VAR) SysVmsChar *VAR##_desc -#define STR_TO_C(DST,SRC) str_ntrim(DST, SRC##_desc->text, sizeof(DST), SRC##_desc->size) -#define STR_TO_F(DST,SRC) str_npad(DST##_desc->text, SRC, DST##_desc->size) +#define F_CHAR(VAR) SysVmsChar *VAR +#define F_DCHAR(VAR,LEN) static char VAR##_str[LEN]; SysVmsChar VAR##_desc={LEN,270,&VAR##_str[0]}; SysVmsChar *VAR=&VAR##_desc +#define F_CLEN(VAR) +#define F_ALEN(VAR) +#define F_LEN(VAR) VAR->size +#define STR_TO_C(DST,SRC) str_ntrim(DST, SRC->text, sizeof(DST), SRC->size) +#define STR_TO_F(DST,SRC) str_npad(DST->text, SRC, DST->size) #define F_FUN(A) A -typedef size_t sys_adr_len; /* argument of accept and gethostbyadr */ -void sys_ctrl_init(void); - - -#elif defined __alpha || defined __unix +#elif defined __alpha || defined __unix || defined __GNUC__ #define F_CHAR(VAR) char *VAR +#define F_DCHAR(VAR,LEN) char VAR[LEN]; int VAR##_len=LEN +#define F_CLEN(VAR) ,int VAR##_len +#define F_ALEN(VAR) ,VAR##_len +#define F_LEN(VAR) VAR##_len #define STR_TO_C(DST,SRC) str_ntrim(DST, SRC, sizeof(DST), SRC##_len) #define STR_TO_F(DST,SRC) str_npad(DST, SRC, DST##_len) #ifdef __alpha #define F_FUN(A) A##_ +#elif defined __GNUC__ +#define F_FUN(A) A##__ #else #define F_FUN(A) A##__ #endif -typedef int sys_adr_len; /* argument of accept and gethostbyadr */ - -#define sys_ctrl_init() 0 - - #else -/* other machines are not supported */ +#error "other machines are not supported" #endif diff --git a/tecs/myc_str.c b/tecs/myc_str.c index b538f432..63c98e47 100644 --- a/tecs/myc_str.c +++ b/tecs/myc_str.c @@ -5,7 +5,6 @@ #include #include #include -#include "sys_util.h" #include "myc_err.h" #include "myc_str.h" #include "myc_mem.h" @@ -94,7 +93,6 @@ char *str_nsplit(char *dst, const char *src, char sep, int dstlen) { } char *str_read_until(FILE *fil, char *term, char *buf, char *end) { - char *s; char fmt[24]; int i, l, siz; char ch; @@ -122,8 +120,7 @@ char *str_read_until(FILE *fil, char *term, char *buf, char *end) { char *str_read_file(char *file) { FILE *fil; char *str, *s, *e, *p, *q; - char ch; - int i, l, size; + int i, size; struct stat statbuf; i=stat(file, &statbuf); @@ -198,7 +195,7 @@ int str_nsubstitute(char *result, char *str, char *old, char *new, int reslen) { void str_nupcase(char *dst, const char *src, int dstlen) { dstlen--; /* space for trailing nul */ while (*src!='\0' && dstlen>0) { - *dst=toupper(*src); + *dst=toupper((int)*src); dst++; src++; dstlen--; } @@ -208,13 +205,14 @@ void str_nupcase(char *dst, const char *src, int dstlen) { void str_nlowcase(char *dst, const char *src, int dstlen) { dstlen--; /* space for trailing nul */ while (*src!='\0' && dstlen>0) { - *dst=tolower(*src); + *dst=tolower((int)*src); dst++; src++; dstlen--; } *dst='\0'; } +#ifndef __GNUC__ int strcasecmp(const char *str1, const char *str2) { int i; char ch1, ch2; @@ -230,6 +228,7 @@ int strcasecmp(const char *str1, const char *str2) { } return(0); } +#endif int str_ncpy(char *dst, const char *src, int maxdest) { strncpy(dst, src, maxdest); diff --git a/tecs/myc_time.c b/tecs/myc_time.c index 03310d03..f8c88dbd 100644 --- a/tecs/myc_time.c +++ b/tecs/myc_time.c @@ -1,10 +1,14 @@ #include +#include #include +/* +#include #include -#include "sys_util.h" +int ftime (struct timeb *__timeptr); +*/ +#include "myc_fortran.h" #include "myc_time.h" -int ftime (struct timeb *__timeptr); /* for some reason not defined in timeb.h with flag -std1 */ static time_t my_base=0; @@ -34,12 +38,19 @@ int mycNow(void) { } int mycMsecSince(int since) { +/* struct timeb now; +*/ + struct timeval now; int msec; if (my_base == 0) initBase(); +/* ftime(&now); msec = (now.time - my_base) % (24*3600) * 1000 + now.millitm - since; +*/ + gettimeofday(&now, NULL); + msec = (now.tv_sec - my_base) % (24*3600) * 1000 + now.tv_usec/1000 - since; if (msec < 0) msec+=24*3600000; return msec; } diff --git a/tecs/str_buf.c b/tecs/str_buf.c deleted file mode 100644 index 5d7ea71a..00000000 --- a/tecs/str_buf.c +++ /dev/null @@ -1,189 +0,0 @@ -#include -#include -#include -#include -#include -#include -#include "sys_util.h" -#include "err_handling.h" -#include "str_util.h" -#include "str_buf.h" - -char *str_nget_str(Str_Buf *buf, char *result, int reslen) -{ char *b, *f, *e, quote; - int res, l, ll; - - if (buf->rdpos < 0 || buf->rdpos >= buf->dsize) ERR_MSG("buffer corrupt"); - b=buf->buf + buf->rdpos; - if (*b=='"' || *b=='\'') { /* take string within quotes (single or double) */ - quote=*b; b++; - f=strchr(b, quote); - if (f==NULL) ERR_MSG("missing '""'"); - l=f-b; - e=strchr(f+1, buf->sep); - if (e==NULL) { - buf->rdpos = f - buf->buf + 1 + strlen(f+1); - } else { - buf->rdpos = e - buf->buf + 1; - } - } else { - f=strchr(b, buf->sep); - if (f==NULL) { - l=strlen(b); - f=b+l; - buf->rdpos+=l; - } else { - l=f-b; - buf->rdpos+=l+1; - } - } - if (result==NULL) { - *f='\0'; - return(b); - } else { - if (l>=reslen) ERR_MSG("result too short"); - strncpy(result, b, l); - result[l]='\0'; - return(result); - } - OnError: - buf->rdpos=-1; - return(NULL); -} - -int str_get_int(Str_Buf *buf, int *res) -{ char num[32]; - int i; - - ERR_P(str_get_str(buf, num)); - i=sscanf(num, "%d", res); - if (i==0) ERR_MSG("illegal number"); - return(0); - OnError: - buf->rdpos=-1; - return(0); -} - -int str_get_float(Str_Buf *buf, float *res) -{ char num[32]; - int i; - - ERR_P(str_get_str(buf, num)); - i=sscanf(num, "%f", res); - if (i==0) ERR_MSG("illegal number"); - return(0); - OnError: - buf->rdpos=-1; - return(-1); -} - -int str_get_end(Str_Buf *buf) -{ - if (buf->rdpos < 0 || buf->rdpos >= buf->dsize) ERR_MSG("buffer corrupt"); - if (buf->rdpos != buf->wrpos) ERR_MSG("superflous content in buffer"); - return(0); - OnError: - return(-1); -} - -int str_put_str(Str_Buf *buf, const char *str) -{ int l, pos; - char quote; - - pos=buf->wrpos; - if (pos < 0 || pos >= buf->dsize) ERR_MSG("buffer corrupt"); - l=strlen(str); - quote='\0'; - if (buf->sep>STR_NOSEPARATOR) { - if (strchr(str, buf->sep)!=NULL) { - if (strchr(str, '"')==NULL) { - quote='"'; l+=2; - } else if (strchr(str, '\'')==NULL) { - quote='\''; l+=2; - } else { - ERR_MSG("str must not contain separator and both kind of quotes"); - } - } - } - if (pos+l >= buf->dsize) ERR_MSG("buffer too short"); - if (quote!='\0') { - buf->buf[pos]=quote; pos++; - strcpy(buf->buf + pos, str); - buf->buf[pos]=quote; pos++; - } else { - strcpy(buf->buf + pos, str); - } - pos+=l; - if (buf->sep!=STR_NOSEPARATOR) { - buf->buf[pos]=buf->sep; - pos++; - } else { - buf->buf[pos]='\0'; - } - buf->wrpos=pos; - return(0); - OnError: - buf->wrpos=-1; - return(-1); -} - -int str_put_int(Str_Buf *buf, int val) -{ char num[32]; - - sprintf(num, "%d", val); - ERR_I(str_put_str(buf, num)); - return(0); - OnError: - return(-1); -} - -int str_put_float(Str_Buf *buf, float val) -{ char num[32]; - - sprintf(num, "%f", val); - ERR_I(str_put_str(buf, num)); - return(0); - OnError: - return(-1); -} - -void str_get_start(Str_Buf *buf) -{ buf->rdpos=0; -} - -void str_put_start(Str_Buf *buf) -{ buf->rdpos=0; - buf->wrpos=0; -} - -Str_Buf *str_create_buf(size_t size, char separator) -{ Str_Buf *buf; - - NEW(buf); - ERR_P(buf->buf=MALLOC(size)); - buf->dsize=size; - buf->sep=separator; - buf->wrpos=0; - buf->rdpos=0; - return(buf); - OnError: - return(NULL); -} - -void str_link_buf(Str_Buf *buf, char *str, int size, char separator) { - buf->buf=str; - buf->rdpos=0; - if (size==0) { - buf->wrpos=strlen(str); - buf->dsize=buf->wrpos+1; - } else { - buf->wrpos=0; - buf->dsize=size; - } - buf->sep=separator; -} - -void str_free_buf(Str_Buf *buf) -{ FREE(buf->buf); - FREE(buf); -} diff --git a/tecs/str_buf.h b/tecs/str_buf.h deleted file mode 100644 index 24583a49..00000000 --- a/tecs/str_buf.h +++ /dev/null @@ -1,27 +0,0 @@ -#ifndef _STR_BUF_H_ -#define _STR_BUF_H_ - -typedef struct { char *buf; int dsize, rdpos, wrpos; char sep; } Str_Buf; - -#define str_get_str(BUF,RES) str_nget_str(BUF,RES,sizeof(RES)) - -/* input */ -void str_get_start(Str_Buf *buf); -char *str_nget_str(Str_Buf *buf, char *result, int reslen); -int str_get_int(Str_Buf *buf, int *res); -int str_get_float(Str_Buf *buf, float *res); -int str_get_end(Str_Buf *buf); - -/* output */ -void str_put_start(Str_Buf *buf); -int str_put_str(Str_Buf *buf, const char *str); -int str_put_int(Str_Buf *buf, int val); -int str_put_float(Str_Buf *buf, float val); - -/* common */ -#define STR_NOSEPARATOR ((char)1) -Str_Buf *str_create_buf(size_t size, char separator); -void str_link_buf(Str_Buf *buf, char *str, int size, char separator); -void str_free_buf(Str_Buf *buf); - -#endif /* _STR_BUF_H_ */ diff --git a/tecs/str_util.c b/tecs/str_util.c deleted file mode 100644 index 3674fda2..00000000 --- a/tecs/str_util.c +++ /dev/null @@ -1,242 +0,0 @@ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "sys_util.h" -#include "err_handling.h" -#include "str_util.h" - -char *str_splitx(char *str, char sep, char *list[], int *n) { - int i; - char *s, *e; - - s=str; - for (i=0; i<*n; i++) { - list[i]=s; - e=strchr(s, sep); - if (e==NULL) { *n=i+1; return(NULL); } - s=e+1; - e--; - while (e>str && *e==' ') e--; /* trim sequence */ - e[1]='\0'; - } - return(s); -} - -char *str_split1(char *str, char sep) { - char *s, *e; - - e=strchr(str, sep); - if (e==NULL) { - s=NULL; - e=str+strlen(str); - } else { - s=e+1; - } - e--; - while (e>str && *e==' ') e--; /* trim sequence */ - e[1]='\0'; - return(s); -} - -int str_ntrim(char *dest, const char *src, int ldest, int lsrc) { - int i; - - if (lsrc>=ldest) lsrc=ldest-1; - if (dest!=src) strncpy(dest, src, lsrc); - dest[lsrc]='\0'; - i=strlen(dest)-1; - while (i>=0 && dest[i]==' ') i--; /* trim sequence */ - i++; - dest[i]='\0'; - return(i); -} - -int str_npad(char *dest, const char *src, int ldest) { - int i, lsrc; - - lsrc=strlen(src); - if (lsrc>=ldest) { - if (dest!=src) strncpy(dest, src, ldest); - lsrc=ldest; - } else { - if (dest!=src) strcpy(dest, src); - for (i=lsrc; i=dstlen) { - str_copy(dst, src); - } else { - strncpy(dst, src, i); - dst[i]='\0'; - } - return(s); -} - -char *str_read_until(FILE *fil, char *term, char *buf, char *end) { - char *s; - char fmt[24]; - int i, l, siz; - char ch; - - siz=end-buf-1; - if (siz<1) return(NULL); - sprintf(fmt, "%s%d[^%s%s", "%", siz, term, "]%n%c"); - i=fscanf(fil, fmt, buf, &l, &ch); - if (i<0) { /* eof */ - buf[0]='\0'; - return(&buf[0]); - } else if (i==0) { /* fscanf returns 0 if first char is terminator */ - buf[0]=fgetc(fil); - return(&buf[0]); - } else if (i==1) { /* terminator not found -> read until eof */ - buf[l]='\0'; - return(&buf[l]); - } else { - buf[l]=ch; - if (l==siz && NULL==strchr(term, ch)) return(NULL); - return(&buf[l]); - } -} - -char *str_read_file(char *file) { - FILE *fil; - char *str, *s, *e, *p, *q; - char ch; - int i, l, size; - struct stat statbuf; - - i=stat(file, &statbuf); - if (i<0) ERR_MSG("file not found"); - size=statbuf.st_size+4; - ERR_SP(str=MALLOC(size)); - e=&str[size-1]; - ERR_SP(fil=fopen(file, "r")); - s=str; - while (1) { - p=str_read_until(fil, "!", s, e); - if (p==NULL) break; - if (*p=='!') { - q=str_read_until(fil, "\n", p, e); - if (q==NULL) { p=NULL; break; } - s=p; *s='\n'; s++; - } else { - assert(*p=='\0'); - break; - } - } - ERR_SI(fclose(fil)); - assert(strlen(str)reslen) ERR_MSG("result buffer too short"); - strncpy(r, p, l); - r+=l; reslen-=l; - if (ln>reslen) ERR_MSG("result buffer too short"); - strncpy(r, new, reslen); - r+=ln; reslen-=ln; - p=s+lo; - s=strstr(p, old); - } - l=strlen(p); - if (l>reslen) ERR_MSG("result buffer too short"); - strncpy(r, p, l); - r+=l; - *r='\0'; - return(r-result); - OnError: - result[0]='\0'; - return(-1); -} - -void str_nupcase(char *dst, const char *src, int dstlen) { - dstlen--; /* space for trailing nul */ - while (*src!='\0' && dstlen>0) { - *dst=toupper(*src); - dst++; src++; - } - *dst='\0'; -} - -int strcasecmp(const char *str1, const char *str2) { - int i; - char ch1, ch2; - ch1=tolower(*(str1++)); ch2=tolower(*(str2++)); - i=1; - while (ch1!='\0' && ch2!='\0' && ch1==ch2) { - ch1=tolower(*(str1++)); ch2=tolower(*(str2++)); i++; - } - if (ch1ch2) { - return(i); - } - return(0); -} - -int str_ncpy(char *dst, const char *src, int maxdest) { - strncpy(dst, src, maxdest); - if (dst[maxdest-1]!='\0') { - dst[maxdest-1]='\0'; - ERR_MSG("destination string too short"); - } - return(0); - OnError: return(-1); -} - -int str_ncat(char *dst, const char *src, int maxdest) { - strncat(dst, src, maxdest-strlen(dst)-1); - if (dst[maxdest-1]!='\0') { - dst[maxdest-1]='\0'; - ERR_MSG("destination string too short"); - } - return(0); - OnError: return(-1); -} diff --git a/tecs/str_util.h b/tecs/str_util.h deleted file mode 100644 index 0dbb70c8..00000000 --- a/tecs/str_util.h +++ /dev/null @@ -1,114 +0,0 @@ -#ifndef _UTIL_H_ -#define _UTIL_H_ - -/* - use these macros if DST is a fixed length character array -*/ - -#define str_trim(DST,SRC,L) str_ntrim(DST,SRC,sizeof(DST),L) -#define str_pad(DST,SRC) str_npad(DST,SRC,sizeof(DST)) -#define str_split(DST,SRC,SEP) str_nsplit(DST,SRC,SEP,sizeof(DST)) -#define str_substitute(DST,SRC,OLD,NEW) str_nsubstitute(DST,SRC,OLD,NEW,sizeof(DST)) -#define str_upcase(DST,SRC) str_nupcase(DST,SRC,sizeof(DST)) -#define str_copy(DST,SRC) str_ncpy(DST,SRC,sizeof(DST)) -#define str_append(DST,SRC) str_ncat(DST,SRC,sizeof(DST)) - - -char *str_split1(char *str, char separator); -/* - trims text before separator in *str and returns - a pointer to the first character after separator -*/ - -char *str_splitx(char *str, char sep, char *list[], int *n); -/* - split string into *n strings using separator sep. - spaces at the end of the elements are trimmed - attention: *str is modified ('\0' placed at the end of the elements) - - if *n separators are found, result points to string after *n-th separator - else result is NULL - *n contains number of elements stored in list -*/ - -int str_ntrim(char *dest, const char *src, int ldest, int lsrc); -/* - copy characters 0 to lsrc-1 from src to dest (max ldest chars). -*/ - -int str_npad(char *dest, const char *src, int ldest); -/* - copy src to dest and fill with spaces (fortran string format) -*/ - -char *str_nsplit(char *dst, const char *src, char sep, int dstlen); -/* - returns a pointer to the text after the separator sep in *src - and copies the text before the separator to *dst - when *src does not contain the separator sep - NULL is returned, and *dst is a copy of *src -*/ - -char *str_read_file(char *file); -/* - return one string containing the contents of file *file - comments separated by '!' are omitted. The caller must - free the result after use. -*/ - -void str_replace_char(char *str, char ch, char rep); -/* - replace all occurences of character ch by character rep in string *str -*/ - -int str_nsubstitute(char *result, char *str, char *old, char *new, int reslen); -/* - replace every instance of old in str by new. - the result must not overlap - if the result would be longer than reslen, the result is en empty string - and the return value is -1; - else the return value is the length of the result. - return one string containing the contents of file *file - the contents are treated in the following way: - - #0,#1,...#n is replaced by the corresponding argument *args[n] (n=0..nargs-1, nargs<10) - - at the end of each line spaces and comments separated by ! are trimmed -*/ - -void str_nupcase(char *dst, const char *src, int dstlen); -/* - convert *str to uppercase -*/ - -#ifdef __VMS_VER -#if __VMS_VER<70000000 - -int strcasecmp(const char *str1, const char *str2); -/* - compare *str1 with *str2 - the comparison is not case sensitive - if result=0: strings are equal - else - result>0 <==> *str1>*str2 - first different character is at position abs(result)-1 -*/ - -#else -#include -#endif /* __VMS_VER<70000000 */ -#else -#include -#endif /* __VMS_VER */ - -int str_ncpy(char *dst, const char *src, int maxdest); -/* - copy *src to *dest, maximal maxdest characters, - it is guaranteed, that dst contains '\0' -*/ - -int str_ncat(char *dst, const char *src, int maxdest); -/* - append *src to *dest, maximal maxdest characters, - it is guaranteed, that dst contains '\0' -*/ - -#endif /* _UTIL_H_ */ diff --git a/tecs/tecs_cli.c b/tecs/tecs_cli.c index 02b39afd..03368508 100644 --- a/tecs/tecs_cli.c +++ b/tecs/tecs_cli.c @@ -5,7 +5,7 @@ #include "myc_err.h" #include "myc_str.h" #include "myc_time.h" -#include "sys_util.h" +#include "myc_fortran.h" #include "coc_util.h" #include "tecs_cli.h" #include "tecs_data.h" diff --git a/tecs/tecs_plot.f b/tecs/tecs_plot.f index 78ea8a61..8dbd5f4d 100644 --- a/tecs/tecs_plot.f +++ b/tecs/tecs_plot.f @@ -55,7 +55,7 @@ logical loop ! functions - integer sys_gmt_off, myc_now, myc_time, myc_date, get_data + integer myc_now, myc_time, myc_date, get_data integer tecs_get_mult, tecs_get_par data window/0./ diff --git a/tecs/tecs_serial.c b/tecs/tecs_serial.c index 891bceaa..ea432a76 100644 --- a/tecs/tecs_serial.c +++ b/tecs/tecs_serial.c @@ -7,7 +7,6 @@ #include "rs232c_def.h" #include "asynsrv_def.h" #include "sinq_prototypes.h" -#include "sys_util.h" #include "myc_err.h" #include "tecs_serial.h" #include "coc_logfile.h"