#include <stdlib.h>
#include <iostream.h>
#include <string.h>
#include <math.h>

int myatoi(char *s, int *i) {
  float wert;
  int   rc=0;
  char  *endp;

  wert=strtod(s, &endp);
  if (s==endp) {
    rc=0;
  }
  else {
    *i=(int)floor(wert);
    rc=1;
  }
  return(rc);
}

int myatof(char *s, float *f) {
  double wert;
  int    rc=0;
  char   *endp;

  wert=strtod(s, &endp);
  if (s==endp) {
    rc=0;
  }
  else {
    *f=(float)wert;
    rc=1;
  }
  return(rc);
}

char *getsig(char *s) {
  char *a, *b, *rc;
  /* allocates memory for a string in */
  /* doublequotes and returns a pointer to it */
  if (strchr(s, '"')) {
    a=strchr(s, '"');
    b=strrchr(s, '"');
    if (a<b) {
      rc=new char[b-a];
      strncpy(rc, (a+1), b-a-1);
      rc[b-a-1]='\0';
    }
    else {
      rc=new char[1];
      strcpy(rc,"\0");
    }
  }
  else {
    rc=new char[1];
    strcpy(rc,"\0");
  }
  return rc;
}
