openbmc/build/tmp/deploy/sdk/witherspoon-2019-08-08/sysroots/armv6-openbmc-linux-gnueabi/usr/src/debug/base-passwd/3.5.29-r0/base-passwd-3.5.29/update-passwd.c
void add_node(struct _node** head, struct _node* node, int new_entry)
{
    node->prev = NULL;
    node->next = NULL;

    if (*head == NULL)
    {
        *head = node;
        node->last = node;
        return;
    }

    if (new_entry)
    {
        /* Make sure NIS compat entries stay at the end when adding new
         * entries.
         */
        struct _node* walk;
        for (walk = *head; walk; walk = walk->next)
        {
            if (strcmp(walk->name, "+") == 0)
                break;
        }
        /* Was there a "+" entry at all?
         */
        if (walk)
        {
            node->prev = walk->prev;
            node->next = walk;
            if (walk->prev)
                walk->prev->next = node;
            walk->prev = node;
            if (walk == *head)
            {
                node->last = (*head)->last;
                *head = node;
            }
            return;
        }
        /* Otherwise fall through and add as normal.
         */
    }

    (*head)->last->next = node;
    node->prev = (*head)->last;
    (*head)->last = node;
}
/* Add a new item to a list
 */
Add a new item to a list
Add a new item to a list
void add_node(struct _node** head, struct _node* node, int new_entry)
{
    node->prev = NULL;
    node->next = NULL;
    if (*head == NULL)
    {
        *head = node;
        node->last = node;
        return;
    }
    if (new_entry)
    {
        struct _node* walk;
        for (walk = *head; walk; walk = walk->next)
        {
            if (strcmp(walk->name, "+") == 0)
                break;
        }
        if (walk)
        {
            node->prev = walk->prev;
            node->next = walk;
            if (walk->prev)
                walk->prev->next = node;
            walk->prev = node;
            if (walk == *head)
            {
                node->last = (*head)->last;
                *head = node;
            }
            return;
        }
    }
    (*head)->last->next = node;
    node->prev = (*head)->last;
    (*head)->last = node;
}
void add_node ( struct _node * * head , struct _node * node , int new_entry ) { node -> prev = NULL ; node -> next = NULL ; if ( * head == NULL ) { * head = node ; node -> last = node ; return ; } if ( new_entry ) { struct _node * walk ; for ( walk = * head ; walk ; walk = walk -> next ) { if ( strcmp ( walk -> name , " " ) == 0 ) break ; } if ( walk ) { node -> prev = walk -> prev ; node -> next = walk ; if ( walk -> prev ) walk -> prev -> next = node ; walk -> prev = node ; if ( walk == * head ) { node -> last = ( * head ) -> last ; * head = node ; } return ; } } ( * head ) -> last -> next = node ; node -> prev = ( * head ) -> last ; ( * head ) -> last = node ; }
Add a new item to a list
Add a new item to a list
/* Make sure NIS compat entries stay at the end when adding new
         * entries.
         */ /* Was there a "+" entry at all?
         */ /* Otherwise fall through and add as normal.
         */