chiark / gitweb /
Better integration with tclreadline. Less recompilation of serpent.[ch].
[chiark-tcl.git] / base / hook.c
index 68df783561431b14b411c22fa274111b5e16fa99..b6c0c9e2128e54ad06b137cb3f1d8928a87b2329 100644 (file)
@@ -147,6 +147,25 @@ int do_hbytes_length(ClientData cd, Tcl_Interp *ip,
   return TCL_OK;
 }
 
+int do_hbytes_random(ClientData cd, Tcl_Interp *ip,
+                    int length, HBytes_Value *result) {
+  Byte *space;
+  int rc;
+  
+  space= hbytes_arrayspace(result, length);
+  rc= get_urandom(ip, space, length);
+  if (rc) { hbytes_free(result); return rc; }
+  return TCL_OK;
+}  
+  
+int do_hbytes_zeroes(ClientData cd, Tcl_Interp *ip,
+                    int length, HBytes_Value *result) {
+  Byte *space;
+  space= hbytes_arrayspace(result, length);
+  memset(space,0,length);
+  return TCL_OK;
+}
+
 int do__hbytes(ClientData cd, Tcl_Interp *ip,
               const HBytes_SubCommand *subcmd,
               int objc, Tcl_Obj *const *objv) {