/*************************************************************************** rlcutil.cpp - description ------------------- begin : Wed Dec 11 2002 copyright : (C) 2002 by Rainer Lehrig email : lehrig@t-online.de ***************************************************************************/ /*************************************************************************** * * * This library is free software; you can redistribute it and/or modify * * it under the terms of the GNU LESSER GENERAL PUBLIC LICENSE as * * published by the Free Software Foundation * * * ***************************************************************************/ /*!
Some C functions.
*/ #ifndef _RL_CUTIL_H_ #define _RL_CUTIL_H_ #include #include #include "rldefine.h" /*!
  like printf for debugging 
*/ int rlSetDebugPrintf(int state); int rlDebugPrintf(const char *format, ...); /*!
  like printf in the last line of a terminal
*/ int rlLastLinePrintf(const char *format, ...); #ifdef RLUNIX /*!
  call execvp(arg[0],arg) on unix
*/ int rlexec(const char *command); #endif /*!
  encode plain text password p
*/ const char *rlpass(const char *p); /*!
  strncpy + terminate with '\\0'
*/ char *rlstrncpy(char *dest, const char *source, int n); /*!
  like vsnprintf but portable
*/ #ifndef SWIG_SESSION int rlvsnprintf(char *text, int len, const char *format, va_list ap); #endif /*!
  like snprintf but portable
*/ int rlsnprintf(char *text, int len, const char *format, ...); /*!
  set signal handler for signal SIGTERM
*/ void rlSetSigtermHandler(void (*handler)(void *arg), void *arg); /*!
  context = 0 must be 0 on first call
*/ const char *rlFindFile(const char *pattern, int *context); /**
returns:
~/.name               on Linux/Unix
sys$login:name        on OpenVMS
%USERPROFILE%\\name    on Windows
*/ const char *rlGetInifile(const char *name); /**
swaps bytes
*/ int rlSwapShort(int val); /**
Send command to a bus system
*/ int rlEib1 (int command); int rlEib2 (int command); int rlLon1 (int command); int rlLon2 (int command); int rlProfibus1(int command); int rlProfibus2(int command); int rlCan1 (int command); int rlCan2 (int command); /**
Call internet browser
*/ int rlBrowser(const char *htmlfile); /**
Call system(command)
*/ int rlsystem(const char *command); /**
Get option from string
return = 0 # not found
return = 1 # found
*/ int rlOption(const char *string, const char *option); /**
Get option from string
*/ int rlIntOption(const char *string, const char *option, int _default); /**
Get option from string
*/ float rlFloatOption(const char *string, const char *option, float _default); /**
Get option from string
*/ const char *rlTextOption(const char *string, const char *option, const char *_default); /**
Copy a Textfile (no binary file)
*/ int rlCopyTextfile(const char *source, const char *destination); /**
convert str to upper case
*/ int rlupper(char *str); /**
convert str to lower case
*/ int rllower(char *str); /**
test if str starts with startstr
*/ int rlStartsWith(const char *str, const char *startstr); #endif