]> mj.ucw.cz Git - libucw.git/blobdiff - lib/object.c
Added obj_find_anum() which is obj_find_aval() combined with atol() and
[libucw.git] / lib / object.c
index ab882c12a139479db0e0f007f41bdb87c0dc6ccb..6a2a90c5b5d46aeec6c8709be842121bd553f41a 100644 (file)
@@ -15,6 +15,7 @@
 
 #include <string.h>
 #include <stdio.h>
+#include <stdlib.h>
 
 void
 obj_dump(struct odes *o)
@@ -117,6 +118,13 @@ obj_find_aval(struct odes *o, uns x)
   return a ? a->val : NULL;
 }
 
+uns
+obj_find_anum(struct odes *o, uns x, uns def)
+{
+  struct oattr *a = obj_find_attr(o, x);
+  return a ? (uns)atol(a->val) : def;
+}
+
 struct oattr *
 obj_set_attr(struct odes *o, uns x, byte *v)
 {