summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Bushnell <thomas@gnu.org>1996-11-13 00:23:55 +0000
committerThomas Bushnell <thomas@gnu.org>1996-11-13 00:23:55 +0000
commitae63ea3f8d3d677a5d47ca8d7cc46137e947030e (patch)
tree60311ba8c06f025f8c6956eb5cc9dadeffb13d83
parentfc0e2647c036addc727aa347af734f1f33a258f1 (diff)
Tue Nov 12 19:22:58 1996 Thomas Bushnell, n/BSG <thomas@gnu.ai.mit.edu>
* idvec.h (idvec_set, idvec_set_ids): New functions. * idvec.c (idvec_set, idvec_set_ids): Ditto. Tue Nov 5 21:16:10 1996 Thomas Bushnell, n/BSG <thomas@gnu.ai.mit.edu> * idvec.h (idvec_setid): Doc fix.
-rw-r--r--libshouldbeinlibc/ChangeLog9
-rw-r--r--libshouldbeinlibc/idvec.c23
-rw-r--r--libshouldbeinlibc/idvec.h9
3 files changed, 40 insertions, 1 deletions
diff --git a/libshouldbeinlibc/ChangeLog b/libshouldbeinlibc/ChangeLog
index d67c536f..414e9b2d 100644
--- a/libshouldbeinlibc/ChangeLog
+++ b/libshouldbeinlibc/ChangeLog
@@ -1,3 +1,12 @@
+Tue Nov 12 19:22:58 1996 Thomas Bushnell, n/BSG <thomas@gnu.ai.mit.edu>
+
+ * idvec.h (idvec_set, idvec_set_ids): New functions.
+ * idvec.c (idvec_set, idvec_set_ids): Ditto.
+
+Tue Nov 5 21:16:10 1996 Thomas Bushnell, n/BSG <thomas@gnu.ai.mit.edu>
+
+ * idvec.h (idvec_setid): Doc fix.
+
Thu Oct 24 15:15:27 1996 Miles Bader <miles@gnu.ai.mit.edu>
* argp-help.c (hol_entry_help: comma): Only print cluster headers for
diff --git a/libshouldbeinlibc/idvec.c b/libshouldbeinlibc/idvec.c
index 6daa639a..67c8aea0 100644
--- a/libshouldbeinlibc/idvec.c
+++ b/libshouldbeinlibc/idvec.c
@@ -159,6 +159,29 @@ idvec_insert_new (struct idvec *idvec, unsigned pos, id_t id)
return idvec_insert (idvec, pos, id);
}
+/* Set the ids in IDVEC to IDS (NUM elements long); delete whatever
+ the previous ids were. */
+error_t
+idvec_set_ids (struct idvec *idvec, id_t *ids, unsigned num)
+{
+ error_t err;
+
+ err = idvec_ensure (idvec, num);
+ if (!err)
+ {
+ bcopy (ids, idvec->ids);
+ ids->num = num;
+ }
+ return err;
+}
+
+/* Like idvec_set_ids, but get the new ids from new. */
+error_t
+idvec_set (struct idvec *idvec, struct idvec *new)
+{
+ return idvec_set_ids (idvec, new->ids, new->num);
+}
+
/* Adds each id in the vector IDS (NUM elements long) to IDVEC, as long as it
wasn't previously in IDVEC. */
error_t
diff --git a/libshouldbeinlibc/idvec.h b/libshouldbeinlibc/idvec.h
index efef22f5..53ed552b 100644
--- a/libshouldbeinlibc/idvec.h
+++ b/libshouldbeinlibc/idvec.h
@@ -86,6 +86,13 @@ error_t idvec_add_new (struct idvec *idvec, uid_t id);
returning ENOMEM if there's not enough memory; otherwise, do nothing. */
error_t idvec_insert_new (struct idvec *idvec, unsigned pos, uid_t id);
+/* Set the ids in IDVEC to IDS (NUM elements long); delete whatever
+ the previous ids were. */
+error_t idvec_set_ids (struct idvec *idvec, id_t *ids, unsigned num);
+
+/* Like idvec_set_ids, but get the new ids from new. */
+error_t idvec_set (struct idvec *idvec, struct idvec *new);
+
/* Adds each id in the vector IDS (NUM elements long) to IDVEC, as if with
idvec_add_new(). */
error_t idvec_merge_ids (struct idvec *idvec, uid_t *ids, unsigned num);
@@ -105,7 +112,7 @@ void idvec_delete (struct idvec *idvec, unsigned pos);
otherwise 0. */
error_t idvec_insert_only (struct idvec *idvec, unsigned pos, uid_t id);
-/* EFF and AVAIL should be idvec's corresponding to a processes effective and
+/* EFF and AVAIL should be idvec's corresponding to a process's effective and
available ids. ID replaces the first id in EFF, and what it replaces is
preserved by adding it to AVAIL (if not already present). If SECURE is
non-NULL, and ID was not previously present in either EFF or AVAIL, then