예제 #1
0
bool
CssmDbAttributeInfo::operator <(const CssmDbAttributeInfo& other) const
{
	if (nameFormat() < other.nameFormat()) return true;
	if (other.nameFormat() < nameFormat()) return false;
	// nameFormat's are equal.
	switch (nameFormat())
	{
	case CSSM_DB_ATTRIBUTE_NAME_AS_STRING:
	{
		int res = strcmp(static_cast<const char *>(*this), static_cast<const char *>(other));
		if (res < 0) return true;
		if (res > 0) return false;
		break;
	}
	case CSSM_DB_ATTRIBUTE_NAME_AS_OID:
		if (static_cast<const CssmOid &>(*this) < static_cast<const CssmOid &>(other)) return true;
		if (static_cast<const CssmOid &>(other) < static_cast<const CssmOid &>(*this)) return false;
		break;
	case CSSM_DB_ATTRIBUTE_NAME_AS_INTEGER:
		if (static_cast<uint32>(*this) < static_cast<uint32>(other)) return true;
		if (static_cast<uint32>(other) < static_cast<uint32>(*this)) return false;
		break;
	default:
		CssmError::throwMe(CSSMERR_DL_INVALID_FIELD_NAME);
	}

	return format() < other.format();
}
예제 #2
0
bool
CssmDbAttributeInfo::operator ==(const CssmDbAttributeInfo& other) const
{
	if (nameFormat() != other.nameFormat()) return false;
	if (format() != other.format()) return false;
	switch (nameFormat())
	{
	case CSSM_DB_ATTRIBUTE_NAME_AS_STRING:
		return !strcmp(static_cast<const char *>(*this), static_cast<const char *>(other));
	case CSSM_DB_ATTRIBUTE_NAME_AS_OID:
		return static_cast<const CssmOid &>(*this) == static_cast<const CssmOid &>(other);
	case CSSM_DB_ATTRIBUTE_NAME_AS_INTEGER:
		return static_cast<uint32>(*this) == static_cast<uint32>(other);
	default:
		CssmError::throwMe(CSSMERR_DL_INVALID_FIELD_NAME);
	}
}
예제 #3
0
void showOneLs(char* filename)
{
	struct stat buf;
	memset(&buf,0,sizeof(buf));
	int ret = stat(filename,&buf);
	if(-1 == ret)
	{
		perror("stat");
		return;
	}
	char t[128];
	char c_mode[20];
	char name[128];
	strcpy(name,nameFormat(filename));
	strcpy(t,ctime(&buf.st_mtime));
	timeFormat(t);
	modeFormat(c_mode,buf.st_mode);
	printf("%s %2d %s %s %7ld %s %s\n",c_mode,buf.st_nlink,getpwuid(buf.st_uid)->pw_name,getgrgid(buf.st_gid)->gr_name,buf.st_size,t+4,name);	
}