亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? config.c

?? 斯坦福大學密碼學家Boneh的基于身份的公鑰密碼系統
?? C
字號:
/*------------------------------------------------------------------------*//*--									--*//*--	config.c							--*//*--									--*//*--	Utility for reading/writing configuration paramters	       	--*//*--	See  config.h  for a detailed description.			--*//*--									--*//*--	NOTE:  these utilities are NOT designed for high performance	--*//*--           and should NOT be called from within inner loops.	--*//*--									--*//*------------------------------------------------------------------------*//*  * Dan Boneh *//* Mon Jan 29 20:56:58 PST 2001 *  Modified to get rid of some warnings. *  Ben Lynn *//*Copyright (C) 2001 Dan BonehSee LICENSE for license*/#include "config.h"#include <stdio.h>//#include <strings.h>#include <string.h>#include <stdlib.h>#include <ctype.h>/*------------------------------------------------------------------------*//*--	GetFullName							--*//*------------------------------------------------------------------------*//* *   Get full config parameter name, including index.	 *   Assumes fullname is sufficiently big		 */PRIVATE char *GetFullName(char *fullname, char *name, 			      const int index){  char *look = name;  char indstr[6];  /* Add index parameter if required */  if ((index > 0) & (index < 0xFFFF)) {    look = fullname;    strncpy(fullname, name, strlen(name)+1);    sprintf(indstr, "#%X", index);    strncat(fullname, indstr, 6);  }  return look;}/*------------------------------------------------------------------------*//*--	GetIndex							--*//*------------------------------------------------------------------------*/PRIVATE int GetIndex(		const CONF_CTX *ctx, char *name, const int index){  int i;  char *look;  char fullname[MAX_NAMLEN+6];  look = GetFullName(fullname, name, index);  for(i=0; i<ctx->NumParam; i++)    if ( strncmp(ctx->ConfigParam[i].type, look, MAX_NAMLEN) == 0)      return i;  return NOT_FOUND;}/*------------------------------------------------------------------------*//*--	GetStringParam						--*//*--									--*//*--	Returns value of config parameter.				--*//*--	Returned value must NOT be deallocated by caller.		--*//*------------------------------------------------------------------------*/extern PUBLIC char *GetStringParam(		const CONF_CTX *ctx, char *name, const int index, 		char *deflt) {  int i;  i = GetIndex(ctx, name, index);  if (i<0)     return deflt;   return ctx->ConfigParam[i].value;}/*------------------------------------------------------------------------*//*--	SetStringParam						--*//*------------------------------------------------------------------------*/extern PUBLIC int SetStringParam(		CONF_CTX *ctx, char *name, const int index, 		const char *value) {  int pos, len;  char *look;  char fullname[MAX_NAMLEN+6];  if ( (!ctx) || (strlen(value) > MAXLINE)  ||       (strlen(name) > MAX_NAMLEN) ||       (index < 0) ||  (index > 0xFFFF) )    return 1;  pos = GetIndex(ctx, name, index);  if (pos < 0) {		/*  A new config parameter  */    pos = ctx->NumParam;    ctx->NumParam ++ ;    look = GetFullName(fullname, name, index);    len = strlen(look)+1;    ctx->ConfigParam[pos].type = (char *)malloc(len);    if (ctx->ConfigParam[pos].type == NULL) {      fprintf(stderr, "SetStringParam: failed to allocate memory.\n");      return 1;    }    strncpy(ctx->ConfigParam[pos].type, look, len);  }  else {		/*  A modification of an existing parameter */    free(ctx->ConfigParam[pos].value);    if (!ctx->ConfigParam[pos].path)      free(ctx->ConfigParam[pos].path);  }  len = strlen(value)+1;  ctx->ConfigParam[pos].value = (char *)malloc(len);  if (ctx->ConfigParam[pos].value == NULL) {    fprintf(stderr, "SetStringParam: failed to allocate memory.\n");    return 1;  }  strncpy(ctx->ConfigParam[pos].value, value, len);  ctx->ConfigParam[pos].path = NULL;  return 0;}/*------------------------------------------------------------------------*//*--	RelativeToFile						--*//*------------------------------------------------------------------------*//* * Interprets 'filespec' as a file pathname, and interprets 'newfile' * relative to it.  Result is written to 'out'.  'out' can be the same * as either input. */PRIVATE char *RelativeToFile(char *out, 				 const char *filespec, const char *newfile){  char * p;  int len;  if(newfile == NULL)    return NULL;  if ((filespec == NULL) || (*filespec == '\0') || (*newfile == '/') ||     ((p = (char *)strrchr(filespec, '/')) == NULL)) {    len = strlen(newfile) + 1;    if(out == NULL)      out = (char *)malloc(len);    if(out)      strncpy(out, newfile, len);    return out;  }  if(out == NULL)    out = (char *)malloc((p - filespec) + strlen(newfile) + 2);  /* Handle duplicate/overlapped args correctly */  memmove(out + (p - filespec) + 1, newfile, strlen(newfile) + 1);  if(out != filespec)    memmove(out, filespec, (p - filespec) + 1);  return out;}/*------------------------------------------------------------------------*//*--	GetPathParam						--*//*--									--*//*--	Returns value of config parameter.				--*//*--    The value is interpreted as a pathname.				--*//*--    Relative filenames are interpreted relative to location of	--*//*--	config file.							--*//*--	Returned value must NOT be deallocated by caller.		--*//*------------------------------------------------------------------------*/extern PUBLIC char *GetPathParam(		CONF_CTX *ctx, char *name, const int index, 		char *deflt) {  int i;  i = GetIndex(ctx, name, index);  if (i<0)     return deflt;  if (ctx->ConfigParam[i].path)    return ctx->ConfigParam[i].path;  else    return (ctx->ConfigParam[i].path =	        RelativeToFile(NULL, ctx->ConfigFilespec, 				   ctx->ConfigParam[i].value));}/*------------------------------------------------------------------------*//*--	GetIntParam							--*//*--									--*//*--	Returns value of integer config parameter.			--*//*------------------------------------------------------------------------*/extern PUBLIC int GetIntParam(		const CONF_CTX *ctx, char *name, const int index, 		const int deflt){  int i;  char *temp;  temp = GetStringParam(ctx, name, index, NULL);  if (!temp)     return deflt;  /* Check if string is an integer */  for (i=0; (temp[i] != '\0'); ++i)    if ((!isdigit((int)temp[i])) || (i>10))      return deflt;    /* Convert to integer */  return atoi(temp);}/*------------------------------------------------------------------------*//*--	SetIntParam							--*//*------------------------------------------------------------------------*/extern PUBLIC int SetIntParam(		CONF_CTX *ctx, char *name, const int index, 		const int value) {  char str[20];  sprintf(str, "%d", value);    return SetStringParam(ctx, name, index, str);}/*------------------------------------------------------------------------*//*--	GetBoolParam						--*//*--									--*//*--	Returns value of bool config parameter or default if parameter  --*//*--    is not defined.							--*//*--	Parameter is considered 'true' if it's value is one of		--*//*--   	    "1"   ||  "true"  || "yes"   (case insensative)		--*//*------------------------------------------------------------------------*/extern PUBLIC int GetBoolParam(		const CONF_CTX *ctx, char *name, const int index, 		const int deflt){  char *temp;  temp = GetStringParam(ctx, name, index, NULL);  if (!temp)     return deflt;  if ((*temp == '1')     ||       (*temp == 't')     ||  (*temp == 'T')    ||            (*temp == 'y')     ||  (*temp == 'Y'))    return 1;	/* true */  else    return 0;	/* false */}/*------------------------------------------------------------------------*//*--	SetBoolParam						--*//*------------------------------------------------------------------------*/extern PUBLIC int SetBoolParam(		CONF_CTX *ctx, char *name, const int index, 		const int value) {  char *str;  if (value)    str = "True";  else    str = "False";    return SetStringParam(ctx, name, index, str);}/*------------------------------------------------------------------------*//*--	GetListParam						--*//*--									--*//*--	Returns a list config parameter as a NULL terminated list.	--*//*--	Caller must dellocated return value.				--*//*--	To deallocate call free(list[0]) and then free(list)		--*//*------------------------------------------------------------------------*/extern PUBLIC char **GetListParam(		const CONF_CTX *ctx, char *name, const int index,		char **deflt){  int cnt, len;  //char *temp, *temp1, *lasts; //got rid of *s  char *temp, *temp1; //got rid of *s  char **list;  temp = GetStringParam(ctx, name, index, NULL);  if (!temp)     return deflt;  /* Convert string to list */  len = strlen(temp)+1;  if ((temp1 = (char *)malloc(len)) == NULL) {    fprintf(stderr, "GetListParam: Error creating space for %s\n", name);    return NULL;  }  strncpy(temp1, temp, len);  //  Count number of tokens in string.  cnt = 0;  if (strtok(temp1, " ,;") != NULL)     for(cnt=1; (strtok(NULL, " ,;") != NULL); ++cnt);  strncpy(temp1, temp, len);  if ((list = (char **)malloc( (cnt+1)*(sizeof (char *)) )) == NULL) {    fprintf(stderr, "GetListParam: Error creating list for %s\n", name);    return NULL;  }  //  Put tokens into list.  list[0] = (char *)strtok(temp1, " ,;");  cnt = 0;    while (list[cnt]) {    list[++cnt] = (char *)strtok(NULL, " ,;");  }   return list;}/*------------------------------------------------------------------------*//*--	SetListParam						--*//*------------------------------------------------------------------------*/extern PUBLIC int SetListParam(		CONF_CTX *ctx, char *name, const int index, 		char **value) {  char str[MAXLINE], *pos;  int cur, len, size=0;  pos = str;  /* Construct a string seperate by ';' out of list  */  for(cur = 0; (value[cur] != NULL); ++cur) {    len = strlen(value[cur])+1;    if (size + len > MAXLINE)      return 1;    strncpy(pos, value[cur], len);    pos += len;    *(pos-1) = ';';    size += len;  }  *(pos-1) = '\0';  return SetStringParam(ctx, name, index, str);}/*------------------------------------------------------------------------*//*--	LoadConfig							--*//*--									--*//*--	Load configuration file.  Must be called before configuration	--*//*--    access functions can be used.					--*//*------------------------------------------------------------------------*/extern PUBLIC CONF_CTX *LoadConfig(const char *filename){  FILE *fp;  char line[MAXLINE], *c, *c1;  CONF_CTX *ctx;  int len;  if ((ctx = constructCTX()) == NULL)     return NULL;  /*--  Open configuration file  --*/    fp = fopen(filename, "r");  if (!fp) {    fprintf(stderr, "LoadConfig: Unable to open config file %s\n", 	            filename);    return NULL;  }  if ((ctx->ConfigFilespec = (char *)malloc(strlen(filename)+1)) == NULL) {    fprintf(stderr, "LoadConfig: Unable to allocate space for %s\n", 	    filename);    return NULL;  }  strcpy(ctx->ConfigFilespec, filename);  /*--  Loop on lines in config file  --*/  while ( (fgets(line, MAXLINE, fp)) ) {    if (line[0] == ';')		    // Ignore comments.      continue;    // Scan for start of parameter name.    for(c=line; isspace((int)*c) && *c; ++c);    // Scan for end of parameter name.    for(c1=c; !isspace((int)*c1) && (*c1 != SEP) && *c1; ++c1);    if (*c1 == '\0')	//  Blank or malformed line.      continue;          *c1 = '\0';    if (ctx->NumParam >= MAX_PARAM) {      fprintf(stderr, 	       "LoadConfig: Too many parameters in configuration file.\n");      return NULL;    }    len = strlen(c);    if (len > MAX_NAMLEN) {      fprintf(stderr, 	      "LoadConfig: Parameter name %s too long in file %s\n", 	       c, filename);      return NULL;    }    // Copy parameter name into config structure.    len++;    ctx->ConfigParam[ctx->NumParam].type = (char *)malloc(len);    strncpy(ctx->ConfigParam[ctx->NumParam].type, c, len);    //  Find start of parameter value.    for(c=c1+1; ((*c == SEP) || isspace((int)*c)) && *c; ++c);        //  Look for new line.    for(c1=c; *c1 && (*c1 != '\n'); ++c1);    if (*c1 != '\n') {      fprintf(stderr, "LoadConfig: Parameter %s too long in file %s\n", 		ctx->ConfigParam[ctx->NumParam].type, filename);      return NULL;    }    *c1 = '\0';    // Copy parameter value into config structure.    len = strlen(c)+1;    ctx->ConfigParam[ctx->NumParam].value = (char *)malloc(len);    strncpy(ctx->ConfigParam[ctx->NumParam].value, c, len);    ctx->ConfigParam[ctx->NumParam].path = NULL;    ctx->NumParam ++ ;  }  fclose(fp);  /*--  Print config params  --*/#if 0  printf("\nConfiguration parameters: \n");  printf("----------------------------------------\n");  for(len=0; len<ctx->NumParam; ++len)    printf("%s: %s \n", ctx->ConfigParam[len].type, 	                ctx->ConfigParam[len].value);  printf("----------------------------------------\n\n");#endif  return ctx;}/*------------------------------------------------------------------------*//*--	WriteConfig							--*//*------------------------------------------------------------------------*/extern PUBLIC int WriteConfig(CONF_CTX *ctx, const char *filename){  FILE *fp;  int i;  /*--  Open configuration file  --*/    fp = fopen(filename, "w");  if (!fp) {    fprintf(stderr, "WriteConfig: Unable to open config file %s\n", 	    filename);    return 1;  }  fprintf(fp, "; DO NOT EDIT THIS FILE.\n");  fprintf(fp, "; The file is generated automatically.\n");  fprintf(fp, ";\n");  for(i=0; i<ctx->NumParam; i++)    fprintf(fp, "%s = %s\n", ctx->ConfigParam[i].type, 	                     ctx->ConfigParam[i].value);  fclose(fp);  return 0;}/*------------------------------------------------------------------------*//*--	constructCTX						--*//*------------------------------------------------------------------------*/extern PUBLIC CONF_CTX *constructCTX(){  CONF_CTX *ctx;  if ( (ctx = (CONF_CTX *)malloc(sizeof(CONF_CTX))) == NULL) {    fprintf(stderr, 	      "constructCTX: Unable to allocate space for context\n");    return NULL;  }  ctx->NumParam = 0;  return ctx;}/*------------------------------------------------------------------------*//*--	destructCTX							--*//*------------------------------------------------------------------------*/extern PUBLIC int destructCTX(CONF_CTX *ctx){  int i;  for(i=0; i<ctx->NumParam; i++) {    free(ctx->ConfigParam[i].type);    free(ctx->ConfigParam[i].value);    if(ctx->ConfigParam[i].path)      free(ctx->ConfigParam[i].path);  }  ctx->NumParam = 0;  return 0;}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
在线影院国内精品| 久久精品视频在线免费观看| 精品日韩一区二区三区 | 51精品秘密在线观看| 精品免费国产二区三区| 亚洲精品五月天| 岛国精品在线观看| 91精品国产色综合久久ai换脸| 亚洲欧美另类在线| 成人性生交大合| 精品国产不卡一区二区三区| 亚洲一本大道在线| 9人人澡人人爽人人精品| 欧美zozozo| 欧美aaaaaa午夜精品| 欧美日韩一二三区| 一区二区三区欧美日| 成人丝袜视频网| 久久综合一区二区| 老鸭窝一区二区久久精品| 欧美日本一道本| 午夜精品福利久久久| 精品视频资源站| 一区二区三区在线免费观看| 91小视频在线观看| 国产精品久久久久久久午夜片| 国产高清精品久久久久| 久久这里都是精品| 国产一本一道久久香蕉| 久久久综合精品| 国产精华液一区二区三区| 日本高清视频一区二区| 欧美巨大另类极品videosbest| 中文字幕在线视频一区| 欧美日本一区二区三区四区| 麻豆国产欧美一区二区三区| jlzzjlzz欧美大全| 国产亚洲短视频| 亚洲免费观看高清| 精品制服美女丁香| 日韩一区二区三区四区| 欧美一区二区三区四区五区| 久久99日本精品| 欧美精品一区二区久久久| 老汉av免费一区二区三区| 99re在线精品| 国产精品国产三级国产aⅴ中文| 久久草av在线| 国产精品你懂的在线欣赏| av一区二区不卡| 亚洲国产乱码最新视频 | 日韩精品一区在线| 国产麻豆精品一区二区| 色欧美88888久久久久久影院| 国产日韩精品一区二区三区 | 国产精品一品视频| 久久亚洲欧美国产精品乐播| 国产午夜精品理论片a级大结局| 成人做爰69片免费看网站| 国产婷婷色一区二区三区| 九色综合狠狠综合久久| 久久久久9999亚洲精品| 91免费版pro下载短视频| 亚洲免费观看高清在线观看| 国产一区二区久久| 亚洲激情男女视频| 在线不卡中文字幕| 国产91富婆露脸刺激对白| 亚洲免费视频中文字幕| 国产99精品国产| 一区二区三区在线免费| 欧美日韩精品一区视频| 国产精品一区二区无线| 亚洲人妖av一区二区| 日韩欧美高清dvd碟片| 97久久久精品综合88久久| 偷偷要91色婷婷| 国产精品久久久久久久岛一牛影视| 欧美人体做爰大胆视频| a在线播放不卡| 欧美性猛交一区二区三区精品| 欧美日韩高清影院| 成人app网站| 男女激情视频一区| 亚洲一二三四区不卡| 欧美影视一区二区三区| 国内精品伊人久久久久av影院 | 青青草视频一区| 亚洲国产精品传媒在线观看| 欧美专区日韩专区| 日韩电影在线观看电影| 亚洲精选视频免费看| 日本一区二区三区视频视频| 69堂精品视频| 色婷婷久久久亚洲一区二区三区| 亚洲.国产.中文慕字在线| 精品国产乱码久久久久久久| 国产91精品在线观看| 欧美成人女星排名| 国产麻豆视频一区二区| 成人黄色777网| 亚洲国产成人高清精品| 在线综合+亚洲+欧美中文字幕| 国产精品第四页| 欧美在线|欧美| 久久久亚洲午夜电影| 久久网这里都是精品| 日韩视频一区在线观看| 欧美久久久一区| 国产成人自拍高清视频在线免费播放| 国产精品福利一区| 欧美性感一类影片在线播放| 懂色av噜噜一区二区三区av| 国产一区二区三区美女| 亚洲理论在线观看| 亚洲美女屁股眼交| 91蝌蚪porny成人天涯| 精品一区二区久久久| 全国精品久久少妇| 欧美激情综合网| 国产亚洲欧美色| gogo大胆日本视频一区| 久久精品国产精品亚洲综合| 91香蕉视频污在线| 9191精品国产综合久久久久久| 日韩一区二区三区三四区视频在线观看| 国产成人综合网站| 国产精品国产a级| 91美女在线看| 日韩在线一区二区| 欧美伦理电影网| 一区二区三区成人| 国产精品一区一区三区| 亚洲免费视频中文字幕| jiyouzz国产精品久久| 亚洲一区在线观看免费观看电影高清 | 欧美日本一区二区| 国产经典欧美精品| 色综合亚洲欧洲| 欧美日韩久久一区| www日韩大片| 亚洲美女屁股眼交3| 亚洲国产sm捆绑调教视频| 日韩三级.com| 精品少妇一区二区三区视频免付费 | 亚洲精品亚洲人成人网| 亚洲曰韩产成在线| 亚洲小说欧美激情另类| 久久成人av少妇免费| aaa欧美大片| 欧美性色aⅴ视频一区日韩精品| 在线欧美日韩精品| 日韩精品一区在线| 日韩一区中文字幕| 麻豆国产一区二区| 色综合久久久久网| 日韩欧美一区在线观看| 最新成人av在线| 青青草国产精品亚洲专区无| 国产成人av电影免费在线观看| 91麻豆自制传媒国产之光| 精品日韩欧美在线| 亚洲夂夂婷婷色拍ww47| 久久99热狠狠色一区二区| 色美美综合视频| 欧美一区二区三区在线看| 中文字幕一区免费在线观看| 男男视频亚洲欧美| 日本乱人伦aⅴ精品| 久久精品欧美一区二区三区不卡 | 色婷婷久久久久swag精品| 日韩精品一区二区三区视频播放 | 欧美不卡一二三| 亚洲乱码日产精品bd| 国产一区二区三区久久久| 欧美日韩情趣电影| 中文字幕日韩av资源站| 精品一区二区三区在线观看| 欧美日韩亚洲综合一区| 日韩毛片视频在线看| 国产精品一级黄| 欧美日韩国产在线播放网站| 中文字幕一区视频| 国产成人av电影在线播放| 精品日韩成人av| 免费欧美日韩国产三级电影| 在线观看日韩高清av| 亚洲日本韩国一区| 成人aa视频在线观看| 国产校园另类小说区| 激情av综合网| 337p粉嫩大胆色噜噜噜噜亚洲| 日韩精品亚洲一区二区三区免费| 欧美亚日韩国产aⅴ精品中极品| 一区二区中文视频| 99精品国产91久久久久久| 中文天堂在线一区| 丰满放荡岳乱妇91ww| 日本一区二区三级电影在线观看| 国产精品资源站在线|