xsupconfcheck_common.c

来自「linux 下通过802.1认证的安装包」· C语言 代码 · 共 45 行

C
45
字号
/**
 * Routines for checking the "completeness" of a piece of the configuration.
 *
 * Licensed under the dual GPL/BSD license.  (See LICENSE file for more info.)
 *
 * \file xsupconfcheck_int.c
 *
 * \author chris@open1x.org
 *
 * $Id: xsupconfcheck_common.c,v 1.1.2.1 2007/06/02 01:38:59 chessing Exp $
 * $Date: 2007/06/02 01:38:59 $
 **/

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#include "../libxsupconfig/xsupconfig.h"
#include "../libxsupconfig/xsupconfig_structs.h"
#include "../../src/error_prequeue.h"
#include "../../src/interfaces.h"

/**
 * \brief Check to see if the interface listed is actually live on this system right now.
 *
 * @param[in] devdesc   The device description for the interface we want to look for.
 *
 * \retval NULL on error
 * \retval ptr to an interfaces struct on success
 **/
struct interfaces *xsupconfcheck_common_is_live_int(char *devdesc)
{
	struct interfaces *cur = NULL;

	cur = interfaces_get_cache_head();
	if (cur == NULL) return NULL;

	while ((cur != NULL) && (strcmp(cur->desc, devdesc) != 0))
		cur = cur->next;

	if (cur == NULL) return NULL;

	// Otherwise, it should be a live one.
	return cur;
}

⌨️ 快捷键说明

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