summaryrefslogtreecommitdiffstats
path: root/afm-client/bower_components/foundation-icon-fonts/svgs/fi-anchor.svg
diff options
context:
space:
mode:
Diffstat (limited to 'afm-client/bower_components/foundation-icon-fonts/svgs/fi-anchor.svg')
-rw-r--r--afm-client/bower_components/foundation-icon-fonts/svgs/fi-anchor.svg20
1 files changed, 20 insertions, 0 deletions
diff --git a/afm-client/bower_components/foundation-icon-fonts/svgs/fi-anchor.svg b/afm-client/bower_components/foundation-icon-fonts/svgs/fi-anchor.svg
new file mode 100644
index 0000000..204db43
--- /dev/null
+++ b/afm-client/bower_components/foundation-icon-fonts/svgs/fi-anchor.svg
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 17.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="100px" height="100px" viewBox="0 0 100 100" enable-background="new 0 0 100 100" xml:space="preserve">
+<g>
+ <path d="M88.189,67.115l0.007-0.004l-9.393-16.27l-0.009,0.005c-0.268-0.487-0.781-0.822-1.376-0.822
+ c-0.677,0-1.25,0.429-1.474,1.027l-9.158,15.862c-0.219,0.271-0.356,0.611-0.356,0.987c0,0.873,0.706,1.578,1.577,1.578h2.39
+ c-3.983,4.39-9.356,7.487-15.42,8.6v-29.2h9.079c0.871,0,1.578-0.705,1.578-1.578l-0.001-0.008V40.5c0,0,0-0.001,0-0.001
+ c0-0.871-0.706-1.577-1.577-1.577h-0.001h-9.078v-5.36c3.905-1.864,6.611-5.838,6.611-10.454c0-6.401-5.189-11.589-11.589-11.589
+ c-6.4,0-11.589,5.188-11.589,11.589c0,4.617,2.705,8.59,6.611,10.454v5.36h-9.079c0,0,0,0-0.001,0
+ c-0.871,0-1.577,0.706-1.577,1.576h-0.001v6.803h0.001c0.001,0.873,0.706,1.577,1.576,1.577h9.08v29.2
+ c-6.064-1.112-11.437-4.21-15.42-8.6h2.389c0.872,0,1.578-0.705,1.578-1.578c0-0.287-0.083-0.553-0.217-0.785l0.007-0.004
+ l-9.393-16.27l-0.009,0.005c-0.268-0.487-0.781-0.822-1.377-0.822c-0.675,0-1.246,0.427-1.471,1.022l-9.162,15.869
+ c-0.218,0.271-0.354,0.61-0.354,0.985c0,0.873,0.706,1.578,1.577,1.578h4.219C23.835,80.823,36.017,88.482,50,88.482
+ c13.983,0,26.165-7.658,32.611-19.003h4.218c0.872,0,1.577-0.705,1.577-1.578C88.406,67.614,88.324,67.348,88.189,67.115z
+ M50,29.634c-3.604,0-6.526-2.923-6.526-6.524c0-3.604,2.922-6.527,6.526-6.527c3.603,0,6.526,2.923,6.526,6.527
+ C56.526,26.71,53.603,29.634,50,29.634z"/>
+</g>
+</svg>
a id='n210' href='#n210'>210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333
/*
 Copyright (C) 2015-2020 IoT.bzh

 author: José Bollo <jose.bollo@iot.bzh>

 Licensed under the Apache License, Version 2.0 (the "License");
 you may not use this file except in compliance with the License.
 You may obtain a copy of the License at

     http://www.apache.org/licenses/LICENSE-2.0

 Unless required by applicable law or agreed to in writing, software
 distributed under the License is distributed on an "AS IS" BASIS,
 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 See the License for the specific language governing permissions and
 limitations under the License.
*/
#define _GNU_SOURCE
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <assert.h>
#include <dirent.h>
#include <stdio.h>
#include <fcntl.h>
#include <unistd.h>
#include <limits.h>
#include <fcntl.h>
#include <sys/stat.h>

#include "verbose.h"
#include "wgtpkg-workdir.h"
#include "wgtpkg-files.h"

struct fdb {
	unsigned int count;
	struct filedesc **files;
};

static struct fdb allfiles = { .count = 0, .files = NULL };
static struct fdb allsignatures = { .count = 0, .files = NULL };

static const char author_file[] = "author-signature.xml";
static const char distributor_file_prefix[] = "signature";
static const char distributor_file_suffix[] = ".xml";

static unsigned int what_signature(const char *name)
{
	unsigned int len, id, nid;

	if (!strcmp(name, author_file))
		return UINT_MAX;

	len = sizeof(distributor_file_prefix)-1;
	if (strncmp(name, distributor_file_prefix, len))
		return 0;
	if (name[len] <= '0' || name[len] > '9')
		return 0;
	id = (unsigned int)(name[len++] - '0');
	while ('0' <= name[len] && name[len] <= '9') {
		nid = 10 * id + (unsigned int)(name[len++] - '0');
		if (nid < id || nid == UINT_MAX) {
			WARNING("number too big for %s", name);
			return 0;
		}
		id = nid;
	}
	if (strcmp(name+len, distributor_file_suffix))
		return 0;

	return id;
}

static struct filedesc *get_filedesc(const char *name, int create)
{
	int cmp;
	unsigned int low, up, mid, sig;
	struct filedesc *result, **grow;

	/* search */
	low = 0;
	up = allfiles.count;
	while(low < up) {
		mid = (low + up) >> 1;
		result = allfiles.files[mid];
		cmp = strcmp(result->name, name);
		if (!cmp)
			return result; /* found */
		if (cmp > 0)
			up = mid;
		else
			low = mid + 1;
	}

	/* not found, can create ? */
	if (!create)
		return NULL;

	sig = what_signature(name);

	/* allocations */
	grow = realloc(allfiles.files, (allfiles.count + 1) * sizeof(struct filedesc *));
	if (grow == NULL) {
		ERROR("realloc failed in get_filedesc");
		return NULL;
	}
	allfiles.files = grow;

	if (sig) {
		grow = realloc(allsignatures.files, (allsignatures.count + 1) * sizeof(struct filedesc *));
		if (grow == NULL) {
			ERROR("second realloc failed in get_filedesc");
			return NULL;
		}
		allsignatures.files = grow;
	}

	result = malloc(sizeof(struct filedesc) + strlen(name));
	if (!result) {
		ERROR("calloc failed in get_filedesc");
		return NULL;
	}

	/* initialisation */
	result->type = type_unset;
	result->flags = sig == 0 ? 0 : sig == UINT_MAX ? flag_author_signature : flag_distributor_signature;
	result->zindex = 0;
	result->signum = sig;
	strcpy(result->name, name);

	/* insertion */
	if (low < allfiles.count)
		memmove(allfiles.files+low+1, allfiles.files+low, (allfiles.count - low) * sizeof(struct filedesc *));
	allfiles.files[low] = result;
	allfiles.count++;
	if (sig) {
		for (low = 0 ; low < allsignatures.count && sig > allsignatures.files[low]->signum ; low++);
		if (low < allsignatures.count)
			memmove(allsignatures.files+low+1, allsignatures.files+low, (allsignatures.count - low) * sizeof(struct filedesc *));
		allsignatures.files[low] = result;
		allsignatures.count++;
	}

	return result;
}
	

static struct filedesc *file_add(const char *name, enum entrytype type)
{
	struct filedesc *desc;

	desc = get_filedesc(name, 1);
	if (!desc)
		errno = ENOMEM;
	else if (desc->type == type_unset)
		desc->type = type;
	else {
		ERROR("redeclaration of %s in file_add", name);
		errno = EEXIST;
		desc = NULL;
	}
	return desc;
}

void file_reset()
{
	unsigned int i;

	allsignatures.count = 0;
	for (i = 0 ; i < allfiles.count ; i++)
		free(allfiles.files[i]);
	allfiles.count = 0;
}

unsigned int file_count()
{
	return allfiles.count;
}

struct filedesc *file_of_index(unsigned int index)
{
	assert(index < allfiles.count);
	return allfiles.files[index];
}

struct filedesc *file_of_name(const char *name)
{
	return get_filedesc(name, 0);
}

struct filedesc *file_add_directory(const char *name)
{
	return file_add(name, type_directory);
}

struct filedesc *file_add_file(const char *name)
{
	return file_add(name, type_file);
}

unsigned int signature_count()
{
	return allsignatures.count;
}

struct filedesc *signature_of_index(unsigned int index)
{
	assert(index < allsignatures.count);
	return allsignatures.files[index];
}

struct filedesc *get_signature(unsigned int number)
{
	unsigned int idx;

	if (number == 0)
		number = UINT_MAX;
	for (idx = 0 ; idx < allsignatures.count ; idx++)
		if (allsignatures.files[idx]->signum == number)
			return allsignatures.files[idx];
	return NULL;
}

struct filedesc *create_signature(unsigned int number)
{
	struct filedesc *result;
	char *name;
	int len;

	result = NULL;
	if (number == 0 || number == UINT_MAX)
		len = asprintf(&name, "%s", author_file);
	else
		len = asprintf(&name, "%s%u%s", distributor_file_prefix, number, distributor_file_suffix);

	if (len < 0)
		ERROR("asprintf failed in create_signature");
	else {
		assert(len > 0);
		result = file_of_name(name);
		if (result == NULL)
			result = file_add_file(name);
		free(name);
	}

	return result;
}

/* remove flags that are not related to being signature */
void file_clear_flags()
{
	unsigned int i;
	for (i = 0 ; i < allfiles.count ; i++)
		allfiles.files[i]->flags &= flag_signature;
}

static int fill_files_rec(char name[PATH_MAX], unsigned offset)
{
	int err, fd;
	unsigned len;
	DIR *dir;
	struct dirent *ent;
	struct stat st;

	fd = openat(workdirfd, offset ? name : ".", O_DIRECTORY|O_RDONLY);
	if (fd < 0) {
		ERROR("openat %.*s failed in fill_files_rec", offset, name);
		return -1;
	}
	dir = fdopendir(fd);
	if (!dir) {
		ERROR("opendir %.*s failed in fill_files_rec", offset, name);
		close(fd);
		return -1;
	}
	if (offset)
		name[offset++] = '/';

	ent = readdir(dir);
	while (ent != NULL) {
		len = (unsigned)strlen(ent->d_name);
		if (ent->d_name[0] == '.' && (len == 1 || 
			(ent->d_name[1] == '.' && len == 2)))
			;
		else if (offset + len >= PATH_MAX) {
			closedir(dir);
			ERROR("name too long in fill_files_rec");
			errno = ENAMETOOLONG;
			return -1;
		} else {
			memcpy(name + offset, ent->d_name, 1+len);
			if (ent->d_type == DT_UNKNOWN) {
				fstatat(fd, ent->d_name, &st, 0);
				if (S_ISREG(st.st_mode))
					ent->d_type = DT_REG;
				else if (S_ISDIR(st.st_mode))
					ent->d_type = DT_DIR;
			}
			switch (ent->d_type) {
			case DT_DIR:
				if (file_add_directory(name) == NULL) {
					closedir(dir);
					return -1;
				}
				err = fill_files_rec(name, offset + len);
				if (err) {
					closedir(dir);
					return err;
				}
				break;
			case DT_REG:
				if (file_add_file(name) == NULL) {
					closedir(dir);
					return -1;
				}
				break;
			default:
				break;
			}
		}
		ent = readdir(dir);
	}

	closedir(dir);
	return 0;
}

int fill_files()
{
	char name[PATH_MAX];
	return fill_files_rec(name, 0);
}