chiark / gitweb /
does modexps, makes signatures, needs sane hexstring handling
[chiark-tcl.git] / hbytes / hook.c
index f364978c200db68dde9b2ba53c0a3e8faa898533..0adb6b5d5804bb54e7669ef485987a69fb38a9a9 100644 (file)
@@ -210,6 +210,18 @@ int do_hbytes_overwrite(ClientData cd, Tcl_Interp *ip,
   return TCL_OK;
 }
 
+int do_hbytes_trimleft(ClientData cd, Tcl_Interp *ip, HBytes_Var v) {
+  const Byte *o, *p, *e;
+  o= p= hbytes_data(v.hb);
+  e= p + hbytes_len(v.hb);
+
+  while (p<e && !*p) p++;
+  if (p != o)
+    hbytes_unprepend(v.hb, p-o);
+
+  return TCL_OK;
+}
+
 int do_hbytes_repeat(ClientData cd, Tcl_Interp *ip,
                     HBytes_Value sub, int count, HBytes_Value *result) {
   int sub_l;