Deleted Added
full compact
fileattr.c (44852) fileattr.c (66525)
1/* Implementation for file attribute munging features.
2
3 This program is free software; you can redistribute it and/or modify
4 it under the terms of the GNU General Public License as published by
5 the Free Software Foundation; either version 2, or (at your option)
6 any later version.
7
8 This program is distributed in the hope that it will be useful,

--- 112 unchanged lines hidden (view full) ---

121 newnode->delproc = fileattr_delproc;
122 newnode->key = xstrdup (line + 1);
123 newnode->data = xstrdup (p);
124 if (addnode (attrlist, newnode) != 0)
125 /* If the same filename appears twice in the file, discard
126 any line other than the first for that filename. This
127 is the way that CVS has behaved since file attributes
128 were first introduced. */
1/* Implementation for file attribute munging features.
2
3 This program is free software; you can redistribute it and/or modify
4 it under the terms of the GNU General Public License as published by
5 the Free Software Foundation; either version 2, or (at your option)
6 any later version.
7
8 This program is distributed in the hope that it will be useful,

--- 112 unchanged lines hidden (view full) ---

121 newnode->delproc = fileattr_delproc;
122 newnode->key = xstrdup (line + 1);
123 newnode->data = xstrdup (p);
124 if (addnode (attrlist, newnode) != 0)
125 /* If the same filename appears twice in the file, discard
126 any line other than the first for that filename. This
127 is the way that CVS has behaved since file attributes
128 were first introduced. */
129 free (newnode);
129 freenode (newnode);
130 }
131 else if (line[0] == 'D')
132 {
133 char *p;
134 /* Currently nothing to skip here, but for future expansion,
135 ignore anything located here. */
136 p = strchr (line, '\t');
137 if (p == NULL)

--- 370 unchanged lines hidden (view full) ---

508}
509
510void
511fileattr_write ()
512{
513 FILE *fp;
514 char *fname;
515 mode_t omask;
130 }
131 else if (line[0] == 'D')
132 {
133 char *p;
134 /* Currently nothing to skip here, but for future expansion,
135 ignore anything located here. */
136 p = strchr (line, '\t');
137 if (p == NULL)

--- 370 unchanged lines hidden (view full) ---

508}
509
510void
511fileattr_write ()
512{
513 FILE *fp;
514 char *fname;
515 mode_t omask;
516 struct unrecog *p;
516
517 if (!attrs_modified)
518 return;
519
520 if (noexec)
521 return;
522
523 /* If NULL was passed to fileattr_startdir, then it isn't kosher to set

--- 87 unchanged lines hidden (view full) ---

611 if (fileattr_default_attrs != NULL)
612 {
613 fputs ("D\t", fp);
614 fputs (fileattr_default_attrs, fp);
615 fputs ("\012", fp);
616 }
617
618 /* Then any other attributes. */
517
518 if (!attrs_modified)
519 return;
520
521 if (noexec)
522 return;
523
524 /* If NULL was passed to fileattr_startdir, then it isn't kosher to set

--- 87 unchanged lines hidden (view full) ---

612 if (fileattr_default_attrs != NULL)
613 {
614 fputs ("D\t", fp);
615 fputs (fileattr_default_attrs, fp);
616 fputs ("\012", fp);
617 }
618
619 /* Then any other attributes. */
619 while (unrecog_head != NULL)
620 for (p = unrecog_head; p != NULL; p = p->next)
620 {
621 {
621 struct unrecog *p;
622
623 p = unrecog_head;
624 fputs (p->line, fp);
625 fputs ("\012", fp);
622 fputs (p->line, fp);
623 fputs ("\012", fp);
626
627 unrecog_head = p->next;
628 free (p->line);
629 free (p);
630 }
631
632 if (fclose (fp) < 0)
633 error (0, errno, "cannot close %s", fname);
634 attrs_modified = 0;
635 free (fname);
636}
637

--- 6 unchanged lines hidden (view full) ---

644 it should be. */
645 dellist (&attrlist);
646 if (fileattr_stored_repos != NULL)
647 free (fileattr_stored_repos);
648 fileattr_stored_repos = NULL;
649 if (fileattr_default_attrs != NULL)
650 free (fileattr_default_attrs);
651 fileattr_default_attrs = NULL;
624 }
625
626 if (fclose (fp) < 0)
627 error (0, errno, "cannot close %s", fname);
628 attrs_modified = 0;
629 free (fname);
630}
631

--- 6 unchanged lines hidden (view full) ---

638 it should be. */
639 dellist (&attrlist);
640 if (fileattr_stored_repos != NULL)
641 free (fileattr_stored_repos);
642 fileattr_stored_repos = NULL;
643 if (fileattr_default_attrs != NULL)
644 free (fileattr_default_attrs);
645 fileattr_default_attrs = NULL;
646 while (unrecog_head)
647 {
648 struct unrecog *p = unrecog_head;
649 unrecog_head = p->next;
650 free (p->line);
651 free (p);
652 }
652}
653}