-/* Arg parsing */
-
-int pat_sockid(Tcl_Interp *ip, Tcl_Obj *o, TuntapSocket **val) {
- int rc, sockix;
- TuntapSocket *sock;
-
- rc= Tcl_ConvertToType(ip,o,&tuntapsockid_type);
- if (rc) return rc;
-
- sockix= o->internalRep.longValue;
- if (sockix >= n_socks || !(sock= socks[sockix]))
- return staticerr(ip,"tuntap socket not open",0);
-
- assert(socks[sockix]->ix == sockix);
-
- *val= sock;
- return TCL_OK;
-}
-
-Tcl_Obj *ret_sockid(Tcl_Interp *ip, TuntapSocket *val) {
- Tcl_Obj *o;
-
- o= Tcl_NewObj();
- Tcl_InvalidateStringRep(o);
- o->internalRep.longValue= val->ix;
- o->typePtr= &tuntapsockid_type;
- return o;
-}
-
-static void sockid_t_free(Tcl_Obj *o) { }
-
-static void sockid_t_dup(Tcl_Obj *src, Tcl_Obj *dup) {
- dup->internalRep= src->internalRep;
- dup->typePtr= &tuntapsockid_type;
-}
-
-static void sockid_t_ustr(Tcl_Obj *o) {
- char buf[75];
-
- snprintf(buf,sizeof(buf), "%d", (int)o->internalRep.longValue);
- obj_updatestr_vstringls(o,
- "tuntapsock",9,
- buf, strlen(buf),
- (char*)0);