Exemple #1
0
static void
test_pkg_list_prepend(void)
{
	struct pkg_list *head = NULL, *l1, *l2, *l3;
	struct pkginfo pkg;

	pkg_list_prepend(&head, &pkg);
	test_pass(head != NULL);
	test_pass(head->next == NULL);
	test_pass(head->pkg == &pkg);
	l1 = head;

	pkg_list_prepend(&head, &pkg);
	test_pass(head != NULL);
	test_pass(head->next == l1);
	test_pass(head->pkg == &pkg);
	l2 = head;

	pkg_list_prepend(&head, &pkg);
	test_pass(head != NULL);
	test_pass(head->next == l2);
	test_pass(head->pkg == &pkg);
	l3 = head;

	pkg_list_prepend(&head, &pkg);
	test_pass(head != NULL);
	test_pass(head->next == l3);
	test_pass(head->pkg == &pkg);

	pkg_list_free(head);
}
Exemple #2
0
static void
set_ignore_depends(const struct cmdinfo *cip, const char *value)
{
  char *copy, *p;

  copy= m_malloc(strlen(value)+2);
  strcpy(copy,value);
  copy[strlen(value) + 1] = '\0';
  for (p=copy; *p; p++) {
    if (*p != ',') continue;
    *p++ = '\0';
    if (!*p || *p==',' || p==copy+1)
      badusage(_("null package name in --%s comma-separated list '%.250s'"),
               cip->olong, value);
  }
  p= copy;
  while (*p) {
    struct pkginfo *pkg;

    pkg = dpkg_options_parse_pkgname(cip, p);
    pkg_list_prepend(&ignoredependss, pkg);

    p+= strlen(p)+1;
  }

  free(copy);
}
Exemple #3
0
static void ignoredepends(const struct cmdinfo *cip, const char *value) {
  char *copy, *p;
  const char *pnerr;

  copy= m_malloc(strlen(value)+2);
  strcpy(copy,value);
  copy[strlen(value) + 1] = '\0';
  for (p=copy; *p; p++) {
    if (*p != ',') continue;
    *p++ = '\0';
    if (!*p || *p==',' || p==copy+1)
      badusage(_("null package name in --ignore-depends comma-separated list `%.250s'"),
               value);
  }
  p= copy;
  while (*p) {
    pnerr = illegal_packagename(p, NULL);
    if (pnerr) ohshite(_("--ignore-depends requires a legal package name. "
                       "`%.250s' is not; %s"), p, pnerr);

    pkg_list_prepend(&ignoredependss, findpackage(p));

    p+= strlen(p)+1;
  }

  free(copy);
}
Exemple #4
0
void
trig_awaited_pend_enqueue(struct pkginfo *pend)
{
	struct pkg_list *tp;

	for (tp = trig_awaited_pend_head; tp; tp = tp->next)
		if (tp->pkg == pend)
			return;

	pkg_list_prepend(&trig_awaited_pend_head, pend);
}