您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ strlcpy函数代码示例

51自学网 2021-06-03 08:31:02
  C++
这篇教程C++ strlcpy函数代码示例写得很实用,希望能帮到您。

本文整理汇总了C++中strlcpy函数的典型用法代码示例。如果您正苦于以下问题:C++ strlcpy函数的具体用法?C++ strlcpy怎么用?C++ strlcpy使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。

在下文中一共展示了strlcpy函数的28个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: generic_menu_iterate

/** * menu_iterate: * @input                    : input sample for this frame * @old_input                : input sample of the previous frame * @trigger_input            : difference' input sample - difference *                             between 'input' and 'old_input' * * Runs RetroArch menu for one frame. * * Returns: 0 on success, -1 if we need to quit out of the loop.  **/int generic_menu_iterate(enum menu_action action){   size_t selection;   menu_entry_t entry;   enum action_iterate_type iterate_type;   const char *label          = NULL;   int ret                    = 0;   uint32_t label_hash        = 0;   uint32_t hash              = 0;   menu_handle_t *menu        = menu_driver_get_ptr();   file_list_t *menu_stack    = menu_entries_get_menu_stack_ptr(0);   file_list_t *selection_buf = menu_entries_get_selection_buf_ptr(0);   menu_entries_get_last_stack(NULL, &label, NULL, NULL);   if (!menu)      return 0;   if (!menu_navigation_ctl(MENU_NAVIGATION_CTL_GET_SELECTION, &selection))      return 0;   menu->menu_state.msg[0]   = '/0';   hash                      = menu_hash_calculate(label);   iterate_type              = action_iterate_type(hash);   if (action != MENU_ACTION_NOOP || menu_entries_needs_refresh() || menu_display_ctl(MENU_DISPLAY_CTL_UPDATE_PENDING, NULL))   {      BIT64_SET(menu->state, MENU_STATE_RENDER_FRAMEBUFFER);   }   switch (iterate_type)   {      case ITERATE_TYPE_HELP:         ret = action_iterate_help(menu->menu_state.msg, sizeof(menu->menu_state.msg), label);         BIT64_SET(menu->state, MENU_STATE_RENDER_MESSAGEBOX);         BIT64_SET(menu->state, MENU_STATE_POST_ITERATE);         if (ret == 1 || action == MENU_ACTION_OK)            BIT64_SET(menu->state, MENU_STATE_POP_STACK);         break;      case ITERATE_TYPE_BIND:         if (menu_input_key_bind_iterate(menu->menu_state.msg, sizeof(menu->menu_state.msg)))         {            menu_entries_pop_stack(&selection, 0);            menu_navigation_ctl(MENU_NAVIGATION_CTL_SET_SELECTION, &selection);         }         else            BIT64_SET(menu->state, MENU_STATE_RENDER_MESSAGEBOX);         break;      case ITERATE_TYPE_INFO:         {            menu_file_list_cbs_t *cbs = menu_entries_get_actiondata_at_offset(selection_buf, selection);            rarch_setting_t *setting  = cbs->setting;            if (setting)            {               char needle[PATH_MAX_LENGTH];               strlcpy(needle, menu_setting_get_name(setting), sizeof(needle));               label_hash       = menu_hash_calculate(needle);            }            ret = menu_hash_get_help(label_hash, menu->menu_state.msg, sizeof(menu->menu_state.msg));         }         BIT64_SET(menu->state, MENU_STATE_RENDER_MESSAGEBOX);         BIT64_SET(menu->state, MENU_STATE_POST_ITERATE);         if (action == MENU_ACTION_OK)            BIT64_SET(menu->state, MENU_STATE_POP_STACK);         break;      case ITERATE_TYPE_DEFAULT:         /* FIXME: Crappy hack, needed for mouse controls to not be completely broken          * in case we press back.          *          * We need to fix this entire mess, mouse controls should not rely on a           * hack like this in order to work. */         selection = max(min(selection, (menu_entries_get_size() - 1)), 0);         menu_entry_get(&entry, 0, selection, NULL, false);         ret = menu_entry_action(&entry, selection, (enum menu_action)action);         if (ret)            goto end;         BIT64_SET(menu->state, MENU_STATE_POST_ITERATE);         /* Have to defer it so we let settings refresh. */         if (menu->push_help_screen)         {            menu_displaylist_info_t info = {0};            info.list = menu_stack;            strlcpy(info.label,//.........这里部分代码省略.........
开发者ID:bronnel,项目名称:RetroArch,代码行数:101,


示例2: backend_init_supplies

//.........这里部分代码省略......... /*  * See if we should be getting supply levels via SNMP...  */  if ((ppd = ppdOpenFile(getenv("PPD"))) == NULL ||      ((ppdattr = ppdFindAttr(ppd, "cupsSNMPSupplies", NULL)) != NULL &&       ppdattr->value && _cups_strcasecmp(ppdattr->value, "true")))  {    ppdClose(ppd);    return;  }  if ((ppdattr = ppdFindAttr(ppd, "cupsSNMPQuirks", NULL)) != NULL)  {    if (!_cups_strcasecmp(ppdattr->value, "capacity"))      quirks |= CUPS_SNMP_CAPACITY;  }  ppdClose(ppd); /*  * Get the device description...  */  if (!_cupsSNMPWrite(snmp_fd, addr, CUPS_SNMP_VERSION_1,		     _cupsSNMPDefaultCommunity(), CUPS_ASN1_GET_REQUEST, 1,		     hrDeviceDescr))    return;  if (!_cupsSNMPRead(snmp_fd, &packet, CUPS_SUPPLY_TIMEOUT) ||      packet.object_type != CUPS_ASN1_OCTET_STRING)  {    strlcpy(description, "Unknown", sizeof(description));    num_supplies = 0;  }  else    strlcpy(description, (char *)packet.object_value.string.bytes,            sizeof(description));  fprintf(stderr, "DEBUG2: hrDeviceDesc=/"%s/"/n", description); /*  * See if we have already queried this device...  */  httpAddrString(addr, addrstr, sizeof(addrstr));  if ((cachedir = getenv("CUPS_CACHEDIR")) == NULL)    cachedir = CUPS_CACHEDIR;  snprintf(cachefilename, sizeof(cachefilename), "%s/%s.snmp", cachedir,           addrstr);  if ((cachefile = cupsFileOpen(cachefilename, "r")) != NULL)  {   /*    * Yes, read the cache file:    *    *     2 num_supplies charset    *     device description    *     supply structures...    */    if (cupsFileGets(cachefile, value, sizeof(value)))    {
开发者ID:alfintatorkace,项目名称:osx-10.9-opensource,代码行数:67,


示例3: zfsctl_snapdir_lookup

/* ARGSUSED */static intzfsctl_snapdir_lookup(vnode_t *dvp, char *nm, vnode_t **vpp, pathname_t *pnp,    int flags, vnode_t *rdir, cred_t *cr, caller_context_t *ct,    int *direntflags, pathname_t *realpnp){	zfsctl_snapdir_t *sdp = dvp->v_data;	objset_t *snap;	char snapname[MAXNAMELEN];	char real[MAXNAMELEN];	char *mountpoint;	zfs_snapentry_t *sep, search;	struct mounta margs;	vfs_t *vfsp;	size_t mountpoint_len;	avl_index_t where;	zfsvfs_t *zfsvfs = dvp->v_vfsp->vfs_data;	int err;	/*	 * No extended attributes allowed under .zfs	 */	if (flags & LOOKUP_XATTR)		return (EINVAL);	ASSERT(dvp->v_type == VDIR);	/*	 * If we get a recursive call, that means we got called	 * from the domount() code while it was trying to look up the	 * spec (which looks like a local path for zfs).  We need to	 * add some flag to domount() to tell it not to do this lookup.	 */	if (MUTEX_HELD(&sdp->sd_lock))		return (ENOENT);	ZFS_ENTER(zfsvfs);	if (gfs_lookup_dot(vpp, dvp, zfsvfs->z_ctldir, nm) == 0) {		ZFS_EXIT(zfsvfs);		return (0);	}	if (flags & FIGNORECASE) {		boolean_t conflict = B_FALSE;		err = dmu_snapshot_realname(zfsvfs->z_os, nm, real,		    MAXNAMELEN, &conflict);		if (err == 0) {			nm = real;		} else if (err != ENOTSUP) {			ZFS_EXIT(zfsvfs);			return (err);		}		if (realpnp)			(void) strlcpy(realpnp->pn_buf, nm,			    realpnp->pn_bufsize);		if (conflict && direntflags)			*direntflags = ED_CASE_CONFLICT;	}	mutex_enter(&sdp->sd_lock);	search.se_name = (char *)nm;	if ((sep = avl_find(&sdp->sd_snaps, &search, &where)) != NULL) {		*vpp = sep->se_root;		VN_HOLD(*vpp);		err = traverse(vpp);		if (err) {			VN_RELE(*vpp);			*vpp = NULL;		} else if (*vpp == sep->se_root) {			/*			 * The snapshot was unmounted behind our backs,			 * try to remount it.			 */			goto domount;		} else {			/*			 * VROOT was set during the traverse call.  We need			 * to clear it since we're pretending to be part			 * of our parent's vfs.			 */			(*vpp)->v_flag &= ~VROOT;		}		mutex_exit(&sdp->sd_lock);		ZFS_EXIT(zfsvfs);		return (err);	}	/*	 * The requested snapshot is not currently mounted, look it up.	 */	err = zfsctl_snapshot_zname(dvp, nm, MAXNAMELEN, snapname);	if (err) {		mutex_exit(&sdp->sd_lock);		ZFS_EXIT(zfsvfs);		/*		 * handle "ls *" or "?" in a graceful manner,		 * forcing EILSEQ to ENOENT.		 * Since shell ultimately passes "*" or "?" as name to lookup//.........这里部分代码省略.........
开发者ID:BjoKaSH,项目名称:ZCE-CDDL-FILES,代码行数:101,


示例4: snd_compress_set_id

static inline void snd_compress_set_id(struct snd_compr *compr, const char *id){	strlcpy(compr->id, id, sizeof(compr->id));}
开发者ID:AK101111,项目名称:linux,代码行数:4,


示例5: parse_module

/* *	Parse a module statement. */static int parse_module(policy_lex_file_t *lexer, policy_item_t **tail){	int component;	policy_lex_t token;	policy_module_t *this;	char *p;	const char *section_name;	char filename[1024];	char buffer[2048];	CONF_SECTION *cs, *subcs;	modcallable *mc;	/*	 *	And the filename	 */	token = policy_lex_file(lexer, 0, filename, sizeof(filename));	if (token != POLICY_LEX_DOUBLE_QUOTED_STRING) {		fprintf(stderr, "%s[%d]: Expected filename, got /"%s/"/n",			lexer->filename, lexer->lineno,			fr_int2str(rlm_policy_tokens, token, "?"));		return 0;	}	/*	 *	See if we're including all of the files in a subdirectory.	 */	strlcpy(buffer, lexer->filename, sizeof(buffer));	p = strrchr(buffer, '/');	if (p) {		strlcpy(p + 1, filename, sizeof(buffer) - 1 - (p - buffer));	} else {		snprintf(buffer, sizeof(buffer), "%s/%s",			 radius_dir, filename);	}	/*	 *	Include section calling a module.	 */	debug_tokens("including module section from file %s/n", buffer);	cs = cf_file_read(buffer);	if (!cs) {		return 0;	/* it prints out error messages */	}	/*	 *	The outer section is called "main", and can be ignored.	 *	It should be a section, so there should be a subsection.	 */	subcs = cf_subsection_find_next(cs, NULL, NULL);	if (!subcs) {		fprintf(stderr, "%s[%d]: Expected section containing modules/n",			lexer->filename, lexer->lineno);		cf_section_free(&cs);		return 0;	}	section_name = cf_section_name1(subcs);	rad_assert(section_name != NULL);	component = fr_str2int(policy_component_names, section_name,				 RLM_COMPONENT_COUNT);	if (component == RLM_COMPONENT_COUNT) {		fprintf(stderr, "%s[%d]: Invalid section name /"%s/"/n",			lexer->filename, lexer->lineno, section_name);		cf_section_free(&cs);		return 0;	}	/*	 *	Compile the module entry.	 */	mc = compile_modgroup(NULL, component, subcs);	if (!mc) {		cf_section_free(&cs);		return 0;	/* more often results in calling exit... */	}	this = rad_malloc(sizeof(*this));	memset(this, 0, sizeof(*this));	this->item.type = POLICY_TYPE_MODULE;	this->item.lineno = lexer->lineno;	this->component = component;	this->cs = cs;	this->mc = mc;	*tail = (policy_item_t *) this;	return 1;}
开发者ID:greendev5,项目名称:freeradius-server-wasel,代码行数:92,


示例6: calloc

static void *gl_glsl_init(void *data, const char *path){   unsigned i;   struct shader_program_info shader_prog_info;   bool shader_support        = false;   config_file_t *conf        = NULL;   const char *stock_vertex   = NULL;   const char *stock_fragment = NULL;   glsl_shader_data_t *glsl = (glsl_shader_data_t*)      calloc(1, sizeof(glsl_shader_data_t));   if (!glsl)      return NULL;   (void)shader_support;#ifndef HAVE_OPENGLES   RARCH_LOG("Checking GLSL shader support .../n");   shader_support = glCreateProgram && glUseProgram && glCreateShader      && glDeleteShader && glShaderSource && glCompileShader && glAttachShader      && glDetachShader && glLinkProgram && glGetUniformLocation      && glUniform1i && glUniform1f && glUniform2fv && glUniform4fv       && glUniformMatrix4fv      && glGetShaderiv && glGetShaderInfoLog && glGetProgramiv       && glGetProgramInfoLog       && glDeleteProgram && glGetAttachedShaders      && glGetAttribLocation && glEnableVertexAttribArray       && glDisableVertexAttribArray      && glVertexAttribPointer      && glGenBuffers && glBufferData && glDeleteBuffers && glBindBuffer;   if (!shader_support)   {      RARCH_ERR("GLSL shaders aren't supported by your OpenGL driver./n");      goto error;   }#endif   glsl->shader = (struct video_shader*)calloc(1, sizeof(*glsl->shader));   if (!glsl->shader)      goto error;   if (!string_is_empty(path))   {      bool ret             = false;      const char *path_ext = path_get_extension(path);      if (string_is_equal(path_ext, "glsl"))      {         strlcpy(glsl->shader->pass[0].source.path, path,               sizeof(glsl->shader->pass[0].source.path));         glsl->shader->passes = 1;         glsl->shader->modern = true;         ret = true;      }      else if (string_is_equal(path_ext, "glslp"))      {         conf = config_file_new(path);         if (conf)         {            ret = video_shader_read_conf_cgp(conf, glsl->shader);            glsl->shader->modern = true;         }      }      if (!ret)      {         RARCH_ERR("[GL]: Failed to parse GLSL shader./n");         goto error;      }   }   else   {      RARCH_WARN("[GL]: Stock GLSL shaders will be used./n");      glsl->shader->passes = 1;      glsl->shader->pass[0].source.string.vertex   =          strdup(glsl_core ? stock_vertex_core : stock_vertex_modern);      glsl->shader->pass[0].source.string.fragment =          strdup(glsl_core ? stock_fragment_core : stock_fragment_modern);      glsl->shader->modern = true;   }   if (!string_is_empty(path))      video_shader_resolve_relative(glsl->shader, path);   video_shader_resolve_parameters(conf, glsl->shader);   if (conf)   {      config_file_free(conf);      conf = NULL;   }   stock_vertex = (glsl->shader->modern) ?      stock_vertex_modern : stock_vertex_legacy;   stock_fragment = (glsl->shader->modern) ?      stock_fragment_modern : stock_fragment_legacy;   if (glsl_core)   {      stock_vertex = stock_vertex_core;//.........这里部分代码省略.........
开发者ID:IlDucci,项目名称:RetroArch,代码行数:101,


示例7: netsettime

/* * Set the date in the machines controlled by timedaemons by communicating the * new date to the local timedaemon.  If the timedaemon is in the master state, * it performs the correction on all slaves.  If it is in the slave state, it * notifies the master that a correction is needed. * Returns 0 on success.  Returns > 0 on failure, setting retval to 2; */intnetsettime(time_t tval){	struct timeval tout;	struct servent *sp;	struct tsp msg;	struct sockaddr_in lsin, dest, from;	fd_set ready;	long waittime;	int s, port, timed_ack, found, lerr;	socklen_t length;	char hostname[MAXHOSTNAMELEN];	if ((sp = getservbyname("timed", "udp")) == NULL) {		warnx("timed/udp: unknown service");		return (retval = 2);	}	dest.sin_port = sp->s_port;	dest.sin_family = AF_INET;	dest.sin_addr.s_addr = htonl((u_long)INADDR_ANY);	s = socket(AF_INET, SOCK_DGRAM, 0);	if (s < 0) {		if (errno != EPROTONOSUPPORT)			warn("timed");		return (retval = 2);	}	memset(&lsin, 0, sizeof(lsin));	lsin.sin_family = AF_INET;	for (port = IPPORT_RESERVED - 1; port > IPPORT_RESERVED / 2; port--) {		lsin.sin_port = htons((u_short)port);		if (bind(s, (struct sockaddr *)&lsin, sizeof(lsin)) >= 0)			break;		if (errno == EADDRINUSE)			continue;		if (errno != EADDRNOTAVAIL)			warn("bind");		goto bad;	}	if (port == IPPORT_RESERVED / 2) {		warnx("all ports in use");		goto bad;	}	memset(&msg, 0, sizeof(msg));	msg.tsp_type = TSP_SETDATE;	msg.tsp_vers = TSPVERSION;	if (gethostname(hostname, sizeof(hostname))) {		warn("gethostname");		goto bad;	}	(void)strlcpy(msg.tsp_name, hostname, sizeof(msg.tsp_name));	msg.tsp_seq = htons((u_short)0);	msg.tsp_time.tv_sec = htonl((u_long)tval);	msg.tsp_time.tv_usec = htonl((u_long)0);	length = sizeof(struct sockaddr_in);	if (connect(s, (struct sockaddr *)&dest, length) < 0) {		warn("connect");		goto bad;	}	if (send(s, (char *)&msg, sizeof(struct tsp), 0) < 0) {		if (errno != ECONNREFUSED)			warn("send");		goto bad;	}	timed_ack = -1;	waittime = WAITACK;loop:	tout.tv_sec = waittime;	tout.tv_usec = 0;	FD_ZERO(&ready);	FD_SET(s, &ready);	found = select(FD_SETSIZE, &ready, (fd_set *)0, (fd_set *)0, &tout);	length = sizeof(lerr);	if (!getsockopt(s,	    SOL_SOCKET, SO_ERROR, (char *)&lerr, &length) && lerr) {		if (lerr != ECONNREFUSED)			warnc(lerr, "send (delayed error)");		goto bad;	}	if (found > 0 && FD_ISSET(s, &ready)) {		length = sizeof(struct sockaddr_in);		if (recvfrom(s, &msg, sizeof(struct tsp), 0,		    (struct sockaddr *)&from, &length) < 0) {			if (errno != ECONNREFUSED)				warn("recvfrom");			goto bad;		}		msg.tsp_seq = ntohs(msg.tsp_seq);//.........这里部分代码省略.........
开发者ID:ajburton,项目名称:freebsd,代码行数:101,


示例8: fill_pathname_abbreviate_special

void fill_pathname_abbreviate_special(char *out_path,      const char *in_path, size_t size){#if !defined(RARCH_CONSOLE) && defined(RARCH_INTERNAL)   unsigned i;   const char *candidates[3];   const char *notations[3];   char *application_dir     = (char*)malloc(PATH_MAX_LENGTH * sizeof(char));   const char *home          = getenv("HOME");   application_dir[0] = '/0';   /* application_dir could be zero-string. Safeguard against this.    *    * Keep application dir in front of home, moving app dir to a    * new location inside home would break otherwise. */   /* ugly hack - use application_dir pointer    * before filling it in. C89 reasons */   candidates[0] = application_dir;   candidates[1] = home;   candidates[2] = NULL;   notations [0] = ":";   notations [1] = "~";   notations [2] = NULL;   fill_pathname_application_path(application_dir,         PATH_MAX_LENGTH * sizeof(char));   path_basedir_wrapper(application_dir);   for (i = 0; candidates[i]; i++)   {      if (!string_is_empty(candidates[i]) &&            strstr(in_path, candidates[i]) == in_path)      {         size_t src_size  = strlcpy(out_path, notations[i], size);         retro_assert(src_size < size);         out_path        += src_size;         size            -= src_size;         in_path         += strlen(candidates[i]);         if (!path_char_is_slash(*in_path))         {            retro_assert(strlcpy(out_path,                     path_default_slash(), size) < size);            out_path++;            size--;         }         break; /* Don't allow more abbrevs to take place. */      }   }   free(application_dir);#endif   retro_assert(strlcpy(out_path, in_path, size) < size);}
开发者ID:libretro,项目名称:beetle-supergrafx-libretro,代码行数:61,


示例9: recovery_init

int recovery_init (void){	struct recovery_message msg;	char partition_name[32];	unsigned valid_command = 0;	int update_status = 0;	// get recovery message	if (get_recovery_message(&msg))		return -1;	msg.command[sizeof(msg.command)-1] = '/0'; //Ensure termination	if (msg.command[0] != 0 && msg.command[0] != 255) {		dprintf(INFO,"Recovery command: %d %s/n",			sizeof(msg.command), msg.command);	}	if (!strcmp("boot-recovery",msg.command))	{		if(!strcmp("RADIO",msg.status))		{			/* We're now here due to radio update, so check for update status */			int ret = get_boot_info_apps(UPDATE_STATUS, (unsigned int *) &update_status);			if(!ret && (update_status & 0x01))			{				dprintf(INFO,"radio update success/n");				strlcpy(msg.status, "OKAY", sizeof(msg.status));			}			else			{				dprintf(INFO,"radio update failed/n");				strlcpy(msg.status, "failed-update", sizeof(msg.status));			}			strlcpy(msg.command, "", sizeof(msg.command));	// clearing recovery command			set_recovery_message(&msg);	// send recovery message			boot_into_recovery = 1;		// Boot in recovery mode			return 0;		}		valid_command = 1;		strlcpy(msg.command, "", sizeof(msg.command));	// to safe against multiple reboot into recovery		strlcpy(msg.status, "OKAY", sizeof(msg.status));		set_recovery_message(&msg);	// send recovery message		boot_into_recovery = 1;		// Boot in recovery mode		return 0;	}	if (!strcmp("update-radio",msg.command)) {		dprintf(INFO,"start radio update/n");		valid_command = 1;		strlcpy(partition_name, "FOTA", sizeof(partition_name));	}	//Todo: Add support for bootloader update too.	if(!valid_command) {		//We need not to do anything		return 0; // Boot in normal mode	}#ifdef OLD_FOTA_UPGRADE	if (read_update_header_for_bootloader(&header)) {		strlcpy(msg.status, "invalid-update", sizeof(msg.status));		goto SEND_RECOVERY_MSG;	}	if (update_firmware_image (&header, partition_name)) {		strlcpy(msg.status, "failed-update", sizeof(msg.status));		goto SEND_RECOVERY_MSG;	}#else	if (set_ssd_radio_update(partition_name)) {		/* If writing to FOTA partition fails */		strlcpy(msg.command, "", sizeof(msg.command));		strlcpy(msg.status, "failed-update", sizeof(msg.status));		goto SEND_RECOVERY_MSG;	}	else {		/* Setting this to check the radio update status */		strlcpy(msg.command, "boot-recovery", sizeof(msg.command));		strlcpy(msg.status, "RADIO", sizeof(msg.status));		goto SEND_RECOVERY_MSG;	}#endif	strlcpy(msg.status, "OKAY", sizeof(msg.status));SEND_RECOVERY_MSG:	set_recovery_message(&msg);	// send recovery message	boot_into_recovery = 1;		// Boot in recovery mode	reboot_device(0);	return 0;}
开发者ID:sndnvaps,项目名称:lk-1,代码行数:92,


示例10: _emmc_recovery_init

int _emmc_recovery_init(void){	int update_status = 0;	struct recovery_message *msg;	uint32_t block_size = 0;	block_size = mmc_get_device_blocksize();	// get recovery message	msg = (struct recovery_message *)memalign(CACHE_LINE, block_size);	ASSERT(msg);	if(emmc_get_recovery_msg(msg))	{		if(msg)			free(msg);		return -1;	}	msg->command[sizeof(msg->command)-1] = '/0'; //Ensure termination	if (msg->command[0] != 0 && msg->command[0] != 255) {		dprintf(INFO,"Recovery command: %d %s/n",			sizeof(msg->command), msg->command);	}	if (!strcmp(msg->command, "boot-recovery")) {		boot_into_recovery = 1;	}	if (!strcmp("update-radio",msg->command))	{		/* We're now here due to radio update, so check for update status */		int ret = get_boot_info_apps(UPDATE_STATUS, (unsigned int *) &update_status);		if(!ret && (update_status & 0x01))		{			dprintf(INFO,"radio update success/n");			strlcpy(msg->status, "OKAY", sizeof(msg->status));		}		else		{			dprintf(INFO,"radio update failed/n");			strlcpy(msg->status, "failed-update", sizeof(msg->status));		}		boot_into_recovery = 1;		// Boot in recovery mode	}	if (!strcmp("reset-device-info",msg->command))	{		reset_device_info();	}	if (!strcmp("root-detect",msg->command))	{		set_device_root();	}	else		goto out;// do nothing	strlcpy(msg->command, "", sizeof(msg->command));	// clearing recovery command	emmc_set_recovery_msg(msg);	// send recovery messageout:	if(msg)		free(msg);	return 0;}
开发者ID:sndnvaps,项目名称:lk-1,代码行数:65,


示例11: split_nuh

/* * split_nuh() * * Fills split_nuh_item struct according to the following table: * * mask               nick     user  host * -----------------  -------  ----  ------ * [email
C++ strlenW函数代码示例
C++ strlcat函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。