Lines Matching defs:ncp
123 struct netconfig *ncp;
248 struct netconfig_vars *ncp = handlep;
256 if (ncp == NULL || nc_file == NULL) {
261 switch (ncp->valid) {
272 if (ncp->flag == 0) { /* first time */
273 ncp->flag = 1;
274 ncp->nc_configs = ni.head;
275 if (ncp->nc_configs != NULL) /* entry already exist */
276 return ncp->nc_configs->ncp;
278 else if (ncp->nc_configs != NULL &&
279 ncp->nc_configs->next != NULL) {
280 ncp->nc_configs = ncp->nc_configs->next;
281 return ncp->nc_configs->ncp;
329 list->ncp = np;
331 list->ncp->nc_lookups = NULL;
333 if (parse_ncp(stringp, list->ncp) == -1) {
351 ncp->nc_configs = ni.tail;
352 return ni.tail->ncp;
401 if (q->ncp->nc_lookups != NULL) free(q->ncp->nc_lookups);
402 free(q->ncp);
428 struct netconfig *ncp = NULL; /* returned value */
445 if (strcmp(list->ncp->nc_netid, netid) == 0)
446 return dup_ncp(list->ncp);
478 if ((ncp = malloc(sizeof(*ncp))) == NULL)
480 ncp->nc_lookups = NULL;
481 if (parse_ncp(linep, ncp) == -1) {
482 free(ncp);
483 ncp = NULL;
488 if (ncp == NULL)
491 return ncp;
519 * we set the ncp's string field pointers to point to these tokens within
526 struct netconfig *ncp) /* where to put results */
532 _DIAGASSERT(ncp != NULL);
538 if ((ncp->nc_netid = strtok_r(stringp, "\t ", &lasts)) == NULL)
545 ncp->nc_semantics = NC_TPI_COTS_ORD;
547 ncp->nc_semantics = NC_TPI_COTS;
549 ncp->nc_semantics = NC_TPI_CLTS;
551 ncp->nc_semantics = NC_TPI_RAW;
558 for (ncp->nc_flag = NC_NOFLAG; *tokenp != '\0'; tokenp++) {
563 ncp->nc_flag |= NC_VISIBLE;
566 ncp->nc_flag |= NC_BROADCAST;
573 if ((ncp->nc_protofmly = strtok_r(NULL, "\t ", &lasts)) == NULL)
576 if ((ncp->nc_proto = strtok_r(NULL, "\t ", &lasts)) == NULL)
579 if ((ncp->nc_device = strtok_r(NULL, "\t ", &lasts)) == NULL)
584 ncp->nc_nlookups = 0;
585 ncp->nc_lookups = NULL;
589 if (ncp->nc_lookups != NULL) /* from last visit */
590 free(ncp->nc_lookups);
592 ncp->nc_lookups = malloc(sizeof(*ncp->nc_lookups));
593 ncp->nc_nlookups = 0;
596 ncp->nc_lookups[(size_t)ncp->nc_nlookups++] = cp;
597 ncp->nc_lookups = (char **)
598 realloc(ncp->nc_lookups,
599 (size_t)(ncp->nc_nlookups+1) *sizeof(char *));
649 dup_ncp(struct netconfig *ncp)
655 _DIAGASSERT(ncp != NULL);
672 *p = *ncp;
673 p->nc_netid = strcpy(tmp, ncp->nc_netid);
675 p->nc_protofmly = strcpy(tmp, ncp->nc_protofmly);
677 p->nc_proto = strcpy(tmp, ncp->nc_proto);
679 p->nc_device = strcpy(tmp, ncp->nc_device);
688 p->nc_lookups[i] = strcpy(tmp, ncp->nc_lookups[i]);