Пример #1
0
/**
 * API to mute/unmute audio
 * @param [in] val - TRUE=> mute FALSE => unmute
 * @return SUCCESS or FAILURE
 * NOTE: The mute state is persisted within the stack and shall be remembered across hold/resume.
 * This API doesn't perform the mute operation but simply caches the mute state of the session.
 */
cc_return_t CCAPI_Call_setAudioMute (cc_call_handle_t handle, cc_boolean val) {
	unsigned int session_id = ccpro_get_sessionId_by_callid(GET_CALL_ID(handle));
        session_data_t * sess_data_p = (session_data_t *)findhash(session_id);
	DEF_DEBUG(DEB_F_PREFIX": val=%d, handle=%d datap=%p",
           DEB_F_PREFIX_ARGS(SIP_CC_PROV, "CCAPI_Call_setAudioMute"), val, handle, sess_data_p);
	if ( sess_data_p != NULL ) {
		sess_data_p->audio_mute = val;
	}
        return CC_SUCCESS;
}
Пример #2
0
/**
 * Returns the Video  mute state for this call
 * @return boolean true=muted false=not muted
 */
cc_boolean CCAPI_CallInfo_isVideoMuted (cc_callinfo_ref_t handle){
  static const char *fname="CCAPI_CallInfo_isVideoMuted";
  session_data_t *data = (session_data_t *)handle;
  session_data_t * sess_data_p;

  CCAPP_DEBUG(DEB_F_PREFIX"Entering\n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname));
  if ( data != NULL){
      sess_data_p = (session_data_t *)findhash(data->sess_id);
      if ( sess_data_p != NULL ) {
          CCAPP_DEBUG(DEB_F_PREFIX"returned %d\n", DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname), sess_data_p->video_mute);
          return sess_data_p->video_mute;
      }
  }

  return FALSE;
}
Пример #3
0
/**
 * Get call info snapshot
 * @param [in] handle - call handle
 * @return cc_call_info_snap_t
 */
cc_callinfo_ref_t CCAPI_Call_getCallInfo(cc_call_handle_t handle) {
   unsigned int session_id = ccpro_get_sessionId_by_callid(GET_CALL_ID(handle));
   cc_callinfo_ref_t snapshot=NULL;
   session_data_t * data;

   if ( session_id != 0 ) {
      data = findhash(session_id);
      if ( data != NULL ) {
        snapshot = getDeepCopyOfSessionData(data);
        if (snapshot == NULL) {
            return NULL;
        }
        snapshot->ref_count = 1;
      }
   }
   return snapshot;
}
Пример #4
0
static void add_free_var(parse_parm *pp, char *name)
{
  hashelem *hp;

  if((hp = findhash(name, pp->Hash_tab)) == NULL) {
    char buf[256];

    sprintf(buf, "Unknown variable %s declared free, ignored", name);
    error(pp, NORMAL, buf);
  }
  else if(pp->coldata[hp->index].must_be_free) {
    char buf[256];

    sprintf(buf, "Variable %s declared free more than once, ignored", name);
    error(pp, NORMAL, buf);
  }
  else
    pp->coldata[hp->index].must_be_free = TRUE;
}
Пример #5
0
static void add_int_var(parse_parm *pp, char *name, short int_decl)
{
  hashelem *hp;

  if((hp = findhash(name, pp->Hash_tab)) == NULL) {
    char buf[256];

    sprintf(buf, "Unknown variable %s declared integer, ignored", name);
    error(pp, NORMAL, buf);
  }
  else if(pp->coldata[hp->index].must_be_int) {
    char buf[256];

    sprintf(buf, "Variable %s declared integer more than once, ignored", name);
    error(pp, NORMAL, buf);
  }
  else {
    pp->coldata[hp->index].must_be_int = TRUE;
    if(int_decl == 2) {
      if(pp->coldata[hp->index].lowbo != -DEF_INFINITE * (LPSREAL) 10.0) {
        char buf[256];

        sprintf(buf, "Variable %s: lower bound on variable redefined", name);
        error(pp, NORMAL, buf);
      }
      pp->coldata[hp->index].lowbo = 0;
      if(pp->coldata[hp->index].upbo < DEF_INFINITE) {
        char buf[256];

        sprintf(buf, "Variable %s: upper bound on variable redefined", name);
        error(pp, NORMAL, buf);
      }
      pp->coldata[hp->index].upbo = 1;
    }
    else if(int_decl == 3) {
      if(pp->coldata[hp->index].upbo == DEF_INFINITE * (LPSREAL) 10.0)
        pp->coldata[hp->index].upbo = 1.0;
    }
  }
}
Пример #6
0
/** memory leak */
int* twoSum(int* nums, int numsSize, int target) 
{
	struct twoint *hash[PERM] = {0};
	int *ret = NULL;
	int i, f;
	for(i = 0; i < numsSize; i++) {
		if ((f = findhash(hash, target - nums[i])) < 0) {
			struct twoint *t = (struct twoint *)calloc(sizeof(struct twoint), 1);
			t->index = i + 1;
			t->value = nums[i];
			add2hash(hash, t);
		} else {
			ret = (int *)calloc(sizeof(int), 2);
			ret[0] = f;
			ret[1] = i + 1;
			goto out;
		}
	}

out:
	return ret;
}
Пример #7
0
int set_sec_threshold(parse_parm *pp, char *name, LPSREAL threshold)
{
  hashelem *hp;

  if((hp = findhash(name, pp->Hash_tab)) == NULL) {
    char buf[256];

    sprintf(buf, "Unknown variable %s declared semi-continuous, ignored", name);
    error(pp, NORMAL, buf);
    return(FALSE);
  }

  if ((pp->coldata[hp->index].lowbo > 0.0) && (threshold > 0.0)) {
    char buf[256];

    pp->coldata[hp->index].must_be_sec = FALSE;
    sprintf(buf, "Variable %s declared semi-continuous, but it has a non-negative lower bound (%f), ignored", name, pp->coldata[hp->index].lowbo);
    error(pp, NORMAL, buf);
  }
  if (threshold > pp->coldata[hp->index].lowbo)
    pp->coldata[hp->index].lowbo = threshold;

  return(pp->coldata[hp->index].must_be_sec);
}
Пример #8
0
int
main(int argc, char *argv[])
{
	struct utmpx	*ut;
	struct utmpx	*utmpbegin;
	struct utmpx	*utmpend;
	struct utmpx	*utp;
	struct uproc	*up, *parent, *pgrp;
	struct psinfo	info;
	struct sigaction actinfo[ACTSIZE];
	struct pstatus	statinfo;
	size_t		size;
	struct stat	sbuf;
	DIR   		*dirp;
	struct	dirent	*dp;
	char		pname[64];
	char 		*fname;
	int		procfd;
	char		*cp;
	int		i;
	int		days, hrs, mins;
	int		entries;
	double		loadavg[3];

	/*
	 * This program needs the proc_owner privilege
	 */
	(void) __init_suid_priv(PU_CLEARLIMITSET, PRIV_PROC_OWNER,
	    (char *)NULL);

	(void) setlocale(LC_ALL, "");
#if !defined(TEXT_DOMAIN)
#define	TEXT_DOMAIN "SYS_TEST"
#endif
	(void) textdomain(TEXT_DOMAIN);

	login = (argv[0][0] == '-');
	cp = strrchr(argv[0], '/');
	firstchar = login ? argv[0][1] : (cp == 0) ? argv[0][0] : cp[1];
	prog = argv[0];

	while (argc > 1) {
		if (argv[1][0] == '-') {
			for (i = 1; argv[1][i]; i++) {
				switch (argv[1][i]) {

				case 'h':
					header = 0;
					break;

				case 'l':
					lflag++;
					break;
				case 's':
					lflag = 0;
					break;

				case 'u':
				case 'w':
					firstchar = argv[1][i];
					break;

				default:
					(void) fprintf(stderr, gettext(
					    "%s: bad flag %s\n"),
					    prog, argv[1]);
					exit(1);
				}
			}
		} else {
			if (!isalnum(argv[1][0]) || argc > 2) {
				(void) fprintf(stderr, gettext(
				    "usage: %s [ -hlsuw ] [ user ]\n"), prog);
				exit(1);
			} else
				sel_user = argv[1];
		}
		argc--; argv++;
	}

	/*
	 * read the UTMPX_FILE (contains information about each logged in user)
	 */
	if (stat(UTMPX_FILE, &sbuf) == ERR) {
		(void) fprintf(stderr, gettext("%s: stat error of %s: %s\n"),
		    prog, UTMPX_FILE, strerror(errno));
		exit(1);
	}
	entries = sbuf.st_size / sizeof (struct futmpx);
	size = sizeof (struct utmpx) * entries;
	if ((ut = malloc(size)) == NULL) {
		(void) fprintf(stderr, gettext("%s: malloc error of %s: %s\n"),
		    prog, UTMPX_FILE, strerror(errno));
		exit(1);
	}

	(void) utmpxname(UTMPX_FILE);

	utmpbegin = ut;
	utmpend = (struct utmpx *)((char *)utmpbegin + size);

	setutxent();
	while ((ut < utmpend) && ((utp = getutxent()) != NULL))
		(void) memcpy(ut++, utp, sizeof (*ut));
	endutxent();

	(void) time(&now);	/* get current time */

	if (header) {	/* print a header */
		prtat(&now);
		for (ut = utmpbegin; ut < utmpend; ut++) {
			if (ut->ut_type == USER_PROCESS) {
				if (!nonuserx(*ut))
					nusers++;
			} else if (ut->ut_type == BOOT_TIME) {
				uptime = now - ut->ut_xtime;
				uptime += 30;
				days = uptime / (60*60*24);
				uptime %= (60*60*24);
				hrs = uptime / (60*60);
				uptime %= (60*60);
				mins = uptime / 60;

				PRINTF((gettext("up")));
				if (days > 0)
					PRINTF((gettext(
					    " %d day(s),"), days));
				if (hrs > 0 && mins > 0) {
					PRINTF((" %2d:%02d,", hrs, mins));
				} else {
					if (hrs > 0)
						PRINTF((gettext(
						    " %d hr(s),"), hrs));
					if (mins > 0)
						PRINTF((gettext(
						    " %d min(s),"), mins));
				}
			}
		}

		ut = utmpbegin;	/* rewind utmp data */
		PRINTF((((nusers == 1) ?
		    gettext("  %d user") : gettext("  %d users")), nusers));
		/*
		 * Print 1, 5, and 15 minute load averages.
		 */
		(void) getloadavg(loadavg, 3);
		PRINTF((gettext(",  load average: %.2f, %.2f, %.2f\n"),
		    loadavg[LOADAVG_1MIN], loadavg[LOADAVG_5MIN],
		    loadavg[LOADAVG_15MIN]));

		if (firstchar == 'u')	/* uptime command */
			exit(0);

		if (lflag) {
			PRINTF((dcgettext(NULL, "User     tty      "
			    "login@         idle    JCPU    PCPU what\n",
			    LC_TIME)));
		} else {
			PRINTF((dcgettext(NULL,
			    "User     tty         idle what\n",
			    LC_TIME)));
		}

		if (fflush(stdout) == EOF) {
			perror((gettext("%s: fflush failed\n"), prog));
			exit(1);
		}
	}

	/*
	 * loop through /proc, reading info about each process
	 * and build the parent/child tree
	 */
	if (!(dirp = opendir(PROCDIR))) {
		(void) fprintf(stderr, gettext("%s: could not open %s: %s\n"),
		    prog, PROCDIR, strerror(errno));
		exit(1);
	}

	while ((dp = readdir(dirp)) != NULL) {
		if (dp->d_name[0] == '.')
			continue;
retry:
		(void) sprintf(pname, "%s/%s/", PROCDIR, dp->d_name);
		fname = pname + strlen(pname);
		(void) strcpy(fname, "psinfo");
		if ((procfd = open(pname, O_RDONLY)) < 0)
			continue;
		if (read(procfd, &info, sizeof (info)) != sizeof (info)) {
			int err = errno;
			(void) close(procfd);
			if (err == EAGAIN)
				goto retry;
			if (err != ENOENT)
				(void) fprintf(stderr, gettext(
				    "%s: read() failed on %s: %s \n"),
				    prog, pname, strerror(err));
			continue;
		}
		(void) close(procfd);

		up = findhash(info.pr_pid);
		up->p_ttyd = info.pr_ttydev;
		up->p_state = (info.pr_nlwp == 0? ZOMBIE : RUNNING);
		up->p_time = 0;
		up->p_ctime = 0;
		up->p_igintr = 0;
		(void) strncpy(up->p_comm, info.pr_fname,
		    sizeof (info.pr_fname));
		up->p_args[0] = 0;

		if (up->p_state != NONE && up->p_state != ZOMBIE) {
			(void) strcpy(fname, "status");

			/* now we need the proc_owner privilege */
			(void) __priv_bracket(PRIV_ON);

			procfd = open(pname, O_RDONLY);

			/* drop proc_owner privilege after open */
			(void) __priv_bracket(PRIV_OFF);

			if (procfd < 0)
				continue;

			if (read(procfd, &statinfo, sizeof (statinfo))
			    != sizeof (statinfo)) {
				int err = errno;
				(void) close(procfd);
				if (err == EAGAIN)
					goto retry;
				if (err != ENOENT)
					(void) fprintf(stderr, gettext(
					    "%s: read() failed on %s: %s \n"),
					    prog, pname, strerror(err));
				continue;
			}
			(void) close(procfd);

			up->p_time = statinfo.pr_utime.tv_sec +
			    statinfo.pr_stime.tv_sec;	/* seconds */
			up->p_ctime = statinfo.pr_cutime.tv_sec +
			    statinfo.pr_cstime.tv_sec;

			(void) strcpy(fname, "sigact");

			/* now we need the proc_owner privilege */
			(void) __priv_bracket(PRIV_ON);

			procfd = open(pname, O_RDONLY);

			/* drop proc_owner privilege after open */
			(void) __priv_bracket(PRIV_OFF);

			if (procfd < 0)
				continue;

			if (read(procfd, actinfo, sizeof (actinfo))
			    != sizeof (actinfo)) {
				int err = errno;
				(void) close(procfd);
				if (err == EAGAIN)
					goto retry;
				if (err != ENOENT)
					(void) fprintf(stderr, gettext(
					    "%s: read() failed on %s: %s \n"),
					    prog, pname, strerror(err));
				continue;
			}
			(void) close(procfd);

			up->p_igintr =
			    actinfo[SIGINT-1].sa_handler == SIG_IGN &&
			    actinfo[SIGQUIT-1].sa_handler == SIG_IGN;

			/*
			 * Process args.
			 */
			up->p_args[0] = 0;
			clnarglist(info.pr_psargs);
			(void) strcat(up->p_args, info.pr_psargs);
			if (up->p_args[0] == 0 ||
			    up->p_args[0] == '-' && up->p_args[1] <= ' ' ||
			    up->p_args[0] == '?') {
				(void) strcat(up->p_args, " (");
				(void) strcat(up->p_args, up->p_comm);
				(void) strcat(up->p_args, ")");
			}
		}

		/*
		 * link pgrp together in case parents go away
		 * Pgrp chain is a single linked list originating
		 * from the pgrp leader to its group member.
		 */
		if (info.pr_pgid != info.pr_pid) {	/* not pgrp leader */
			pgrp = findhash(info.pr_pgid);
			up->p_pgrpl = pgrp->p_pgrpl;
			pgrp->p_pgrpl = up;
		}
		parent = findhash(info.pr_ppid);

		/* if this is the new member, link it in */
		if (parent->p_upid != INITPROCESS) {
			if (parent->p_child) {
				up->p_sibling = parent->p_child;
				up->p_child = 0;
			}
			parent->p_child = up;
		}
	}

	/* revert to non-privileged user after opening */
	(void) __priv_relinquish();

	(void) closedir(dirp);
	(void) time(&now);	/* get current time */

	/*
	 * loop through utmpx file, printing process info
	 * about each logged in user
	 */
	for (ut = utmpbegin; ut < utmpend; ut++) {
		if (ut->ut_type != USER_PROCESS)
			continue;
		if (sel_user && strncmp(ut->ut_name, sel_user, NMAX) != 0)
			continue;	/* we're looking for somebody else */

		/* print login name of the user */
		PRINTF(("%-*.*s ", LOGIN_WIDTH, NMAX, ut->ut_name));

		/* print tty user is on */
		if (lflag) {
			PRINTF(("%-*.*s ", LINE_WIDTH, LMAX, ut->ut_line));
		} else {
			if (ut->ut_line[0] == 'p' && ut->ut_line[1] == 't' &&
			    ut->ut_line[2] == 's' && ut->ut_line[3] == '/') {
				PRINTF(("%-*.*s ", LINE_WIDTH, LMAX,
				    &ut->ut_line[4]));
			} else {
				PRINTF(("%-*.*s ", LINE_WIDTH, LMAX,
				    ut->ut_line));
			}
		}

		/* print when the user logged in */
		if (lflag) {
			time_t tim = ut->ut_xtime;
			prtat(&tim);
		}

		/* print idle time */
		idle = findidle(ut->ut_line);
		prttime(idle, 8);
		showtotals(findhash(ut->ut_pid));
	}
	if (fclose(stdout) == EOF) {
		perror((gettext("%s: fclose failed"), prog));
		exit(1);
	}
	return (0);
}
Пример #9
0
int main(int argc, char *argv[])
{
    FILE *fp;
    int i = 0;
    char line[MAX_LAST_NAME_SIZE];
    struct timespec start, end;
    double cpu_time1, cpu_time2;

    /* check file opening */
    fp = fopen(DICT_FILE, "r");
    if (fp == NULL) {
        printf("cannot open the file\n");
        return -1;
    }

#ifdef TABLE_SIZE
    /* Create the hashtable */
    hashtable *ht=NULL;
    ht = Create_Hash_Table();

    /*Create memory pool*/
    pool *mem_pool = (pool*)malloc(sizeof(pool));
    create_pool(mem_pool);
#else
    /* build the entry */
    entry *pHead, *e;
    pHead = (entry *) malloc(sizeof(entry));
    e = pHead;
    e->pNext = NULL;
#endif

    /* print the size of entry */
    printf("size of entry : %lu bytes\n", sizeof(entry));
    i = 0;
    clock_gettime(CLOCK_REALTIME, &start);
    while (fgets(line, sizeof(line), fp)) {
        while (line[i] != '\0')
            i++;
        line[i - 1] = '\0';
        i = 0;
#ifdef TABLE_SIZE
        appendhash(line, ht, mem_pool);
#else
        e = append(line, e);
#endif
    }
    clock_gettime(CLOCK_REALTIME, &end);
    cpu_time1 = diff_in_second(start, end);

    /* close file as soon as possible */
    fclose(fp);
    /* the givn last name to find */
    char input[MAX_LAST_NAME_SIZE] = "zora";
#ifndef TABLE_SIZE
    e = pHead;
#endif
    /* compute the execution time */
    clock_gettime(CLOCK_REALTIME, &start);
#ifdef TABLE_SIZE
    findhash(input, ht);
#else
    findName(input, e);
#endif
    clock_gettime(CLOCK_REALTIME, &end);
    cpu_time2 = diff_in_second(start, end);
	printf("%s", input);
#ifdef TABLE_SIZE
    /* Calculate the unuse of hashtable */
    int sum=0;
    for(i=0; i<TABLE_SIZE; i++) {
        if( ht->list[i] == NULL)
            sum++;
    }

    FILE *nfp=fopen("null.txt", "a");
    fprintf(nfp,"Tablesize:%d, Total of null: %d\n",TABLE_SIZE, sum);
    fclose(fp);
#endif
    printf("execution time of append() : %lf sec\n", cpu_time1);
    printf("execution time of findName() : %lf sec\n", cpu_time2);

#ifdef TABLE_SIZE
    destroy_pool(mem_pool);
#else

#endif
    return 0;
}
Пример #10
0
int main()
{
  static const char *fname="main";
  hashItr_t itr;
  void * data;

  addhash(0x01010001,0x1234);
  addhash(0x01060001,0x4567);
  addhash(0x01060002,0x9324);
  addhash(0x01070002,0x4321);
  addhash(0x01070004,0x2134);
  addhash(0x01080005,0x1324);
  addhash(0x01030001,0x1243);
  hashstats(7);

  hashItrInit(&itr);
  while ( data = hashItrNext(&itr) ) {
    CCAPPDEBUG(DEB_F_PREFIX"Itr found %lx", DEB_F_PREFIX_ARGS(SIP_SES_HASH, fname), data);
  }

  CCAPPDEBUG(DEB_F_PREFIX"%lx", DEB_F_PREFIX_ARGS(SIP_SES_HASH, fname), findhash(0x01010001));
  CCAPPDEBUG(DEB_F_PREFIX"%lx", DEB_F_PREFIX_ARGS(SIP_SES_HASH, fname), findhash(0x01060001));
  CCAPPDEBUG(DEB_F_PREFIX"%lx", DEB_F_PREFIX_ARGS(SIP_SES_HASH, fname), findhash(0x01060002));
  CCAPPDEBUG(DEB_F_PREFIX"%lx", DEB_F_PREFIX_ARGS(SIP_SES_HASH, fname), findhash(0x01070002));
  CCAPPDEBUG(DEB_F_PREFIX"%lx", DEB_F_PREFIX_ARGS(SIP_SES_HASH, fname), findhash(0x01070004));
  CCAPPDEBUG(DEB_F_PREFIX"%lx", DEB_F_PREFIX_ARGS(SIP_SES_HASH, fname), findhash(0x01080005));
  CCAPPDEBUG(DEB_F_PREFIX"%lx", DEB_F_PREFIX_ARGS(SIP_SES_HASH, fname), findhash(0x01030001));

  delhash(0x01030001);
  delhash(0x01060001);
  hashstats(7);

  hashItrInit(&itr);
  while ( data = hashItrNext(&itr) ) {
    CCAPPDEBUG(DEB_F_PREFIX"Itr found %lx", DEB_F_PREFIX_ARGS(SIP_SES_HAS, fname), data);
  }

  CCAPPDEBUG(DEB_F_PREFIX"%lx", DEB_F_PREFIX_ARGS(SIP_SES_HASH, fname), findhash(0x01010001));
  CCAPPDEBUG(DEB_F_PREFIX"%lx", DEB_F_PREFIX_ARGS(SIP_SES_HASH, fname), findhash(0x01060001));
  CCAPPDEBUG(DEB_F_PREFIX"%lx", DEB_F_PREFIX_ARGS(SIP_SES_HASH, fname), findhash(0x01060002));
  CCAPPDEBUG(DEB_F_PREFIX"%lx", DEB_F_PREFIX_ARGS(SIP_SES_HASH, fname), findhash(0x01070002));
  CCAPPDEBUG(DEB_F_PREFIX"%lx", DEB_F_PREFIX_ARGS(SIP_SES_HASH, fname), findhash(0x01070004));
  CCAPPDEBUG(DEB_F_PREFIX"%lx", DEB_F_PREFIX_ARGS(SIP_SES_HASH, fname), findhash(0x01080005));
  CCAPPDEBUG(DEB_F_PREFIX"%lx", DEB_F_PREFIX_ARGS(SIP_SES_HASH, fname), findhash(0x01030001));
}
Пример #11
0
MYBOOL __WINAPI read_params(lprec *lp, char *filename, char *options)
{
    int ret, looping, line;
    FILE *fp;
    hashtable *hashfunctions, *hashparameters;
    hashelem *hp;
    int i, j, elements, n, intvalue, state = 0;
    REAL REALvalue;
    char buf[4096], *header = NULL, *ptr, *ptr1, *ptr2;

    if((fp = ini_open(filename)) == NULL)
        ret = FALSE;
    else {
        /* create hashtable of all callable commands to find them quickly */
        hashfunctions = create_hash_table(sizeof(functions) / sizeof(*functions), 0);
        for (n = 0, i = 0; i < (int) (sizeof(functions)/sizeof(*functions)); i++) {
            puthash(functions[i].par, i, NULL, hashfunctions);
            if(functions[i].values != NULL)
                n += functions[i].elements;
        }
        /* create hashtable of all arguments to find them quickly */
        hashparameters = create_hash_table(n, 0);
        for (n = 0, i = 0; i < (int) (sizeof(functions)/sizeof(*functions)); i++) {
            if(functions[i].values != NULL) {
                elements = functions[i].elements;
                for(j = 0; j < elements; j++)
                    if((strcmp(functions[i].values[j].svalue, "0") != 0) &&
                            (strcmp(functions[i].values[j].svalue, "1") != 0))
                        puthash(functions[i].values[j].svalue, j, NULL, hashparameters);
            }
        }

        readoptions(options, &header);

        STRUPR(header);
        ret = looping = TRUE;
        line = 0;
        while((ret) && (looping)) {
            line++;
            switch(ini_readdata(fp, buf, sizeof(buf), FALSE)) {
            case 0: /* End of file */
                looping = FALSE;
                break;
            case 1: /* header */
                switch(state) {
                case 0:
                    STRUPR(buf);
                    if(strcmp(buf, header) == 0)
                        state = 1;
                    break;
                case 1:
                    looping = FALSE;
                    break;
                }
                break;
            case 2: /* data */
                if(state == 1) {
                    for(ptr = buf; (*ptr) && (isspace(*ptr)); ptr++);
                }
                else
                    ptr = NULL;
                if((ptr != NULL) && (*ptr)) {
                    STRUPR(buf);
                    ptr = strchr(buf, '=');
                    if(ptr == NULL) {
                        report(lp, IMPORTANT, "read_params: No equal sign on line %d\n", line);
                        ret = FALSE;
                    }
                    else {
                        *ptr = 0;
                        for(ptr1 = buf; isspace(*ptr1); ptr1++);
                        for(ptr2 = ptr - 1; (ptr2 >= ptr1) && (isspace(*ptr2)); ptr2--);
                        if(ptr2 <= ptr1) {
                            report(lp, IMPORTANT, "read_params: No parameter name before equal sign on line %d\n", line);
                            ret = FALSE;
                        }
                        else {
                            ptr2[1] = 0;
                            hp = findhash(ptr1, hashfunctions);
                            if(hp == NULL) {
                                report(lp, IMPORTANT, "read_params: Unknown parameter name (%s) before equal sign on line %d\n", ptr1, line);
                                ret = FALSE;
                            }
                            else {
                                i = hp->index;
                                ptr1 = ++ptr;
                                intvalue = 0;
                                REALvalue = 0;
                                if(functions[i].values == NULL) {
                                    switch(functions[i].type) {
                                    case intfunction:
                                    case longfunction:
                                    case MYBOOLfunction:
                                        intvalue = strtol(ptr1, &ptr2, 10);
                                        while((*ptr2) && (isspace(*ptr2)))
                                            ptr2++;
                                        if(*ptr2) {
                                            report(lp, IMPORTANT, "read_params: Invalid integer value on line %d\n", line);
                                            ret = FALSE;
                                        }
                                        break;
                                    case REALfunction:
                                        REALvalue = strtod(ptr1, &ptr2);
                                        while((*ptr2) && (isspace(*ptr2)))
                                            ptr2++;
                                        if(*ptr2) {
                                            report(lp, IMPORTANT, "read_params: Invalid real value on line %d\n", line);
                                            ret = FALSE;
                                        }
                                        break;
                                    }
                                }
                                else {
                                    while(ret) {
                                        ptr = strchr(ptr1, '+');
                                        if(ptr == NULL)
                                            ptr = ptr1 + strlen(ptr1);
                                        for(; isspace(*ptr1); ptr1++);
                                        for(ptr2 = ptr - 1; (ptr2 >= ptr1) && (isspace(*ptr2)); ptr2--);
                                        if(ptr2 <= ptr1)
                                            break;
                                        else {
                                            ptr2[1] = 0;
                                            hp = findhash(ptr1, hashparameters);
                                            if (hp == NULL) {
                                                report(lp, IMPORTANT, "read_params: Invalid parameter name (%s) on line %d\n", ptr1, line);
                                                ret = FALSE;
                                            }
                                            else {
                                                j = hp->index;
                                                if((j >= functions[i].elements) ||
                                                        (strcmp(functions[i].values[j].svalue, ptr1))) {
                                                    report(lp, IMPORTANT, "read_params: Inappropriate parameter name (%s) on line %d\n", ptr1, line);
                                                    ret = FALSE;
                                                }
                                                else {
                                                    intvalue += functions[i].values[j].value;
                                                }
                                            }
                                            ptr1 = ptr + 1;
                                        }
                                    }
                                }
                                if(ret) {
                                    switch(functions[i].type) {
                                    case intfunction:
                                        functions[i].set_function.int_set_function(lp, intvalue);
                                        break;
                                    case longfunction:
                                        functions[i].set_function.long_set_function(lp, intvalue);
                                        break;
                                    case MYBOOLfunction:
                                        functions[i].set_function.MYBOOL_set_function(lp, (MYBOOL) intvalue);
                                        break;
                                    case REALfunction:
                                        functions[i].set_function.REAL_set_function(lp, REALvalue);
                                        break;
                                    }
                                }
                            }
                        }
                    }
                }
                break;
            }
        }

        FREE(header);
        free_hash_table(hashfunctions);
        free_hash_table(hashparameters);

        ini_close(fp);
    }

    return( (MYBOOL) ret );
}