⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 settimer.c

📁 speech signal process tools
💻 C
字号:
/* * This material contains unpublished, proprietary software of  * Entropic Research Laboratory, Inc. Any reproduction, distribution,  * or publication of this work must be authorized in writing by Entropic  * Research Laboratory, Inc., and must bear the notice:  * *    "Copyright (c) 1995 Entropic Research Laboratory, Inc.  *                   All rights reserved" * * The copyright notice above does not evidence any actual or intended  * publication of this source code.      * * Written by:   Alan Parker * Checked by: * Revised by: * * Brief description: handles license stuff for xwaves * */static char *sccs_id = "@(#)settimer.c	1.8 28 Oct 1999 ERL";#include <elm.h>#include <elm_erl.h>#include <Objects.h>static char expired_feature[ELM_FEATURE_LEN+1];#define ALARM_TIME 30#define EXIT 1#define NOEXIT 0/* #define DEBUG 1 */static void lm_message();static Notify_value lm_alarm();#define ITIMER_NULL ((struct itimerval *)0)static Notify_value ln_alarm();#define DOWN_MSG "The license manager server cannot be reached.  Either\n\it is not running, or the environment variable ESI_HOST is not set to\n\the correct hostname.    If the license server is running on this host\n\then ESI_HOST should either be undefined or contain the name of this host.\n\If the license manager server is running on another host, then ESI_HOST\n\should contain that hostname.\n"voidset_timer(){	int ret;	static int my_client_object;	int *elm_client = &my_client_object;	struct itimerval elm_timer;#ifdef NO_LIC        return;#endif	elm_timer.it_interval.tv_usec =0;	elm_timer.it_interval.tv_sec =ALARM_TIME;	elm_timer.it_value.tv_usec =0;	elm_timer.it_value.tv_sec =ALARM_TIME;	(void)notify_set_itimer_func(elm_client, lm_alarm,ITIMER_REAL,		&elm_timer, ITIMER_NULL);			return;}#define MESSAGE1 \"xwaves: You've lost your license (probably taken while you suspended\n\this program).  You have about 30 seconds to clean up unless another license\n\is freed.\n"#define MESSAGE2 \"xwaves: You've lost your license (probably taken while you suspended\n\this program).  Program terminated\n"static Notify_valuelm_alarm(client, which)Notify_client client;int which;{	int ret;        static int already_lost=0;	static int pid = 0;#ifdef NO_LIC	return(NOTIFY_DONE);#else		if(!pid) pid=getpid();#ifdef DEBUG	fprintf(stderr,"[pid: %d]: lm_alarm called\n",pid);#endif	ret = elm_alive(expired_feature);	if (ret == ELM_OK && !already_lost) {		return (NOTIFY_DONE);	} else if (ret == ELM_LOST || already_lost) {		fprintf(stderr,		 "[pid: %d]: License lost.. trying to get it back..",pid);		(void)elm_retlicense(WAVES_FEATURE,0);		ret = elm_getlicense(WAVES_FEATURE, ELM_GETLIC,0);		if (ret != ELM_OK) {			if(!already_lost) {			   fprintf(stderr,"\n[pid: %d]\n%s\n",pid,MESSAGE1);			   already_lost=1;			   return(NOTIFY_DONE);			}                        else {			   fprintf(stderr,"\n[pid: %d]\n%s\n",pid,MESSAGE2);			   quit_proc();			}		}		else {			already_lost = 0;			fprintf(stderr,"OK\n");			return(NOTIFY_DONE);		}	}			lm_message(ret,NOEXIT);	quit_proc();#endif}static voidlm_message(code,flag)int code,flag;{#ifdef NO_LIC	return;#else	fprintf(stderr,"xwaves: %s\n",elm_message(NULL,"xwaves",code));	if (flag == EXIT) {		fprintf(stderr,"Program exiting.\n");		exit(1);	}	return;#endif}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -