From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-1.1 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 32168 invoked from network); 23 Jul 2021 21:44:31 -0000 Received: from tb-ob21.topicbox.com (173.228.157.67) by inbox.vuxu.org with ESMTPUTF8; 23 Jul 2021 21:44:31 -0000 Received: from tb-mx1.topicbox.com (tb-mx1.nyi.icgroup.com [10.90.30.61]) by tb-ob21.topicbox.com (Postfix) with ESMTP id 998DB3329F for ; Fri, 23 Jul 2021 17:44:28 -0400 (EDT) (envelope-from bounce.mM27ffc8edbf9c9fa1390479dd.r522be890-2105-11eb-b15e-8d699134e1fa@9fans.bounce.topicbox.com) Received: by tb-mx1.topicbox.com (Postfix, from userid 1132) id 7BAB62EAB710; Fri, 23 Jul 2021 17:44:28 -0400 (EDT) ARC-Authentication-Results: i=2; topicbox.com; arc=pass; dkim=none (no signatures found); dmarc=pass policy.published-domain-policy=quarantine policy.published-subdomain-policy=quarantine policy.applied-disposition=none policy.evaluated-disposition=none (p=quarantine,sp=quarantine,d=none,d.eval=none) policy.policy-from=p header.from=sdf.org; spf=pass smtp.mailfrom=adr@SDF.ORG smtp.helo=mx.sdf.org; x-internal-arc=fail (as.1.topicbox.com=pass, ams.1.topicbox.com=fail (message has been altered)) (Message modified while forwarding at Topicbox) ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d= topicbox.com; h=date:to:subject:in-reply-to:message-id :references:mime-version:content-type:from:list-help:list-id :list-post:list-subscribe:reply-to:content-transfer-encoding :list-unsubscribe; s=sysmsg-1; t=1627076668; bh=o63YHqb1OIhP4x10 xTPBtqSBZgSAMqop+zfch/FeRDQ=; b=MS1YaHM9jIpNSyGjoyvj1ZMjc3M/cuWg WDn7jY+ekL9EuMEeqvgvtyt8Bhm2Ucvmn3OV+IPW3/WUoRihqyfYnOKvf74Q99yg gc0Wazi+PvP5uTpn5qSnhBe2sPjbqOjsd72HPFHBANKVM0M6CK/XsFE8tFhGGoE7 yKZ6onFthB4= ARC-Seal: i=2; a=rsa-sha256; cv=pass; d=topicbox.com; s=sysmsg-1; t= 1627076668; b=h07o2W8SPJbgtbMU4eNTboBkgst/4oeXw3wX1SaIXx4eAowhtw m1vvt6atSEioe49W3Sjvh8MgKNfz12FpSoAoJ7dg5LCpWqJhuDt/pzQCtUiKPJOI mby/frU9vIESNcvjb25yQUJws7QQ0sp9gghNK324O8PLHlxKIs5F58RQ4= Authentication-Results: topicbox.com; arc=pass; dkim=none (no signatures found); dmarc=pass policy.published-domain-policy=quarantine policy.published-subdomain-policy=quarantine policy.applied-disposition=none policy.evaluated-disposition=none (p=quarantine,sp=quarantine,d=none,d.eval=none) policy.policy-from=p header.from=sdf.org; spf=pass smtp.mailfrom=adr@SDF.ORG smtp.helo=mx.sdf.org; x-internal-arc=fail (as.1.topicbox.com=pass, ams.1.topicbox.com=fail (message has been altered)) (Message modified while forwarding at Topicbox) X-Received-Authentication-Results: tb-mx1.topicbox.com; arc=none (no signatures found); bimi=none (No BIMI records found); dkim=none (no signatures found); dmarc=pass policy.published-domain-policy=quarantine policy.published-subdomain-policy=quarantine policy.applied-disposition=none policy.evaluated-disposition=none (p=quarantine,sp=quarantine,d=none,d.eval=none) policy.policy-from=p header.from=sdf.org; iprev=pass smtp.remote-ip=205.166.94.24 (mx.sdf.org); spf=pass smtp.mailfrom=adr@SDF.ORG smtp.helo=mx.sdf.org; x-aligned-from=pass (Address match); x-me-sender=none; x-ptr=pass smtp.helo=mx.sdf.org policy.ptr=mx.sdf.org; x-return-mx=pass header.domain=sdf.org policy.is_org=yes (MX Records found: mx.sdf.org); x-return-mx=pass smtp.domain=sdf.org policy.is_org=yes (MX Records found: mx.sdf.org); x-tls=pass smtp.version=TLSv1.2 smtp.cipher=ECDHE-RSA-AES256-GCM-SHA384 smtp.bits=256/256; x-vs=clean score=0 state=0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed; d=9fans.net; h=date:to :subject:in-reply-to:message-id:references:mime-version :content-type:from:list-help:list-id:list-post:list-subscribe :reply-to:content-transfer-encoding:list-unsubscribe; s=dkim-1; bh=VSgBS4NcZiyMo9k00pVoXyJuwB/h/lqaxMlRWx2F/Qs=; b=Mv/SQ+abOPVe XHeWZxQTgqpzNpYKN3VN3Vfj0MRRiw8rfAxqKAdlHXpE6B+LrpsFFqpWGqqAVTIn dHVMOvi1xrBBS0HcmgmG9bfsCDqflB0Lgv5cJmz7FR0nzbZAPJxwJ3SNEtwbRSzx a7WFZSuiNa3XBb90fEnszZy1eIJ/4X4= Received: from tb-mx1.topicbox.com (localhost.local [127.0.0.1]) by tb-mx1.topicbox.com (Postfix) with ESMTP id AB8D72EAB30B for <9fans@9fans.net>; Fri, 23 Jul 2021 17:44:16 -0400 (EDT) (envelope-from adr@SDF.ORG) Received: from tb-mx1.topicbox.com (localhost [127.0.0.1]) by tb-mx1.topicbox.com (Authentication Milter) with ESMTP id EE480C76543; Fri, 23 Jul 2021 17:44:16 -0400 ARC-Seal: i=1; a=rsa-sha256; cv=none; d=topicbox.com; s=arcseal; t= 1627076656; b=Tbbmo20w+8nQEGw4WTAIVsffZg/H8bLFYWsIAJrkW+60iCHflK 8vlGE28xgL1uvBzswZRg8nQAdroSrp/35OD/dgEF62xbKr5w0OxSy+kZ/9ONYtLo Yoid94EYbmpxXBID0IARpPIf/NB6IAoRRweliRGR2p8/6U3/3wWfETyp3zxzD+vP dDHUZJsNBlB6QNCICnGOoPvibdrjzoWJ59EUmmsQwwXXeAbhfXJQhGYcUPddzWaP ZHo0x2LrJnBHLCCF0OHTajRRnxHOlZ3UWNHEtnEGw8r963KHWZK4jBJec8Puy2Yu Ilfc5AEpZVTNNqfR03B04lYNYJkVWLQ3wycw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d= topicbox.com; h=date:from:to:subject:in-reply-to:message-id :references:mime-version:content-type; s=arcseal; t=1627076656; bh=m+R0bg1KrLA1Ax3KNiwERA5d8rtq+JxMOFt6rmx8SVs=; b=sqAA+AygC0Bw 36/9vfYwmSuyh8X+WhXTGFcmXtz1fBDw0vZYMJUAo6zAw0+aALBApdIxoEkYkcWG qO2fA7Zt8kXSoPWi2TF9V1HQVHXFANkMZMmKnIs5KnF2fW1sw1VmWrK339Zb0J/L SNYqAHHcAVm+r/wPC7Dm6YycPTWzKRhvz1vkBoPVXOjXQlWP6Iqf0SF9zma+X+I0 DZQNry8FaGlN8AHjbnxgJCGL+HwfpHMf3bKw9de/TGgSd5+llTkto3PoENPaz8ho 8tuGbIArFMluxhdYnQBwMetZYL6ov1EJuKig/rS70b/JsiPtt/gVOmZ4r0reWTyE T5X76KrT1A== ARC-Authentication-Results: i=1; tb-mx1.topicbox.com; arc=none (no signatures found); bimi=none (No BIMI records found); dkim=none (no signatures found); dmarc=pass policy.published-domain-policy=quarantine policy.published-subdomain-policy=quarantine policy.applied-disposition=none policy.evaluated-disposition=none (p=quarantine,sp=quarantine,d=none,d.eval=none) policy.policy-from=p header.from=sdf.org; iprev=pass smtp.remote-ip=205.166.94.24 (mx.sdf.org); spf=pass smtp.mailfrom=adr@SDF.ORG smtp.helo=mx.sdf.org; x-aligned-from=pass (Address match); x-me-sender=none; x-ptr=pass smtp.helo=mx.sdf.org policy.ptr=mx.sdf.org; x-return-mx=pass header.domain=sdf.org policy.is_org=yes (MX Records found: mx.sdf.org); x-return-mx=pass smtp.domain=sdf.org policy.is_org=yes (MX Records found: mx.sdf.org); x-tls=pass smtp.version=TLSv1.2 smtp.cipher=ECDHE-RSA-AES256-GCM-SHA384 smtp.bits=256/256; x-vs=clean score=0 state=0 X-ME-VSCause: gggruggvucftvghtrhhoucdtuddrgedvtddrfeekgddutdejucdltddurdegudelrddttd dmucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdggtfgf nhhsuhgsshgtrhhisggvpdfurfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttd enucenucfjughrpeffhffvufgjkfhfgggtsehttdertddttddvnecuhfhrohhmpegrughr uceorggurhesufffhfdrqfftifeqnecuggftrfgrthhtvghrnhepkeehtdevffehvefhtd eghfehgfevleevudejteejtdehuddvfedvkeegtdffhfffnecukfhppedvtdehrdduieei rdelgedrvdegpddvtdehrdduieeirdelgedrudeinecuvehluhhsthgvrhfuihiivgeptd enucfrrghrrghmpehinhgvthepvddthedrudeiiedrleegrddvgedphhgvlhhopehmgidr shgufhdrohhrghdpmhgrihhlfhhrohhmpeeorggurhesufffhfdrqfftifeq X-ME-VSScore: 0 X-ME-VSCategory: clean Received-SPF: pass (sdf.org: 205.166.94.24 is authorized to use 'adr@SDF.ORG' in 'mfrom' identity (mechanism 'ip4:205.166.94.0/24' matched)) receiver=tb-mx1.topicbox.com; identity=mailfrom; envelope-from="adr@SDF.ORG"; helo=mx.sdf.org; client-ip=205.166.94.24 Received: from mx.sdf.org (mx.sdf.org [205.166.94.24]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by tb-mx1.topicbox.com (Postfix) with ESMTPS for <9fans@9fans.net>; Fri, 23 Jul 2021 17:44:15 -0400 (EDT) (envelope-from adr@SDF.ORG) Received: from sdf.org (IDENT:adr@sdf.org [205.166.94.16]) by mx.sdf.org (8.15.2/8.14.5) with ESMTPS id 16NLiEOn004531 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256 bits) verified NO) for <9fans@9fans.net>; Fri, 23 Jul 2021 21:44:15 GMT Received: from localhost (adr@localhost) by sdf.org (8.15.2/8.12.8/Submit) with ESMTP id 16NLiEeh015676 for <9fans@9fans.net>; Fri, 23 Jul 2021 21:44:14 GMT Date: Fri, 23 Jul 2021 21:44:14 +0000 (UTC) To: 9fans <9fans@9fans.net> Subject: Re: [9fans] sam label and rio snarf buffer In-Reply-To: Message-ID: <2eabf32-bcd4-2cd8-cd18-dd2c7f708a4e@SDF.ORG> References: <1B8C5F4A23067128E181B22317E4EB83@eigenstate.org> MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8"; format="flowed" Topicbox-Policy-Reasoning: allow: sender is a member Topicbox-Message-UUID: 23c45698-ebff-11eb-a15e-fb9aa1e0dd1f Archived-At: =?UTF-8?B?PGh0dHBzOi8vOWZhbnMudG9waWNib3guY29tL2dyb3Vwcy85?= =?UTF-8?B?ZmFucy9UYzgwOWFkNjAwN2NjZDJiZC1NMjdmZmM4ZWRiZjljOWZhMTM5MDQ3?= =?UTF-8?B?OWRkPg==?= From: "adr via 9fans" <9fans@9fans.net> List-Help: List-Id: "9fans" <9fans.9fans.net> List-Post: List-Software: Topicbox v0 List-Subscribe: Precedence: list Reply-To: 9fans <9fans@9fans.net> Content-Transfer-Encoding: quoted-printable List-Unsubscribe: , Topicbox-Delivery-ID: 2:9fans:437d30aa-c441-11e9-8a57-d036212d11b0:522be890-2105-11eb-b15e-8d699134e1fa:M27ffc8edbf9c9fa1390479dd:1:4WEL8WCyqivsoZo4cTcIzBBOCTILtQ6Z7iiOLf9RB08 In case someone was playing with this, last patch was really naive (and buggy). I tried different approaches while learning more about how the two parts of the editor interact with each other and after some back-and-forths it's working now. I enabled again the menu item when samriosnarf is defined, so the internal buffer can be used as a temporal storage. I've to think about the plumber and the the named pipe to be able to plumb a file and bring to the front a sam instance if it has the file open, moving the file's window to the front with dot set at the address, if one is given. If you don't set samriosnarf you wont notice anything, this patch doesn't change the normal behavior of sam. I've to revise the code and test it more, but I don't like the idea of a buggy patch floting on the list, even if no one is using it. Regards, adr. --- sys/src/cmd/samterm/main.c Sat Jun 26 21:12:44 2021 +++ /sys/src/cmd/samterm/main.c Fri Jul 23 21:49:09 2021 @@ -1,5 +1,6 @@ #include #include +#include #include #include #include @@ -24,6 +25,7 @@ long modified =3D 0; /* strange lookahead for menus */ char hostlock =3D 1; char hasunlocked =3D 0; +char riosnarf =3D 0; int maxtab =3D 8; int autoindent; @@ -35,6 +37,8 @@ Rectangle r; Flayer *nwhich; + if(getenv("samriosnarf")) + riosnarf =3D 1; getscreen(argc, argv); iconinit(); initio(); @@ -250,10 +254,27 @@ snarf(Text *t, int w) { Flayer *l =3D &t->l[w]; + int fd; + int n; + long p; if(l->p1>l->p0){ snarflen =3D l->p1-l->p0; - outTsll(Tsnarf, t->tag, l->p0, l->p1); + if(riosnarf){ + if((fd=3Dopen("/dev/snarf", OWRITE)) < 0){ + fprint(2, "samterm:snarf: can't open /dev/s= narf for writing"); + return; + } + t =3D l->user1; + for(p=3Dl->p0; pp1; p+=3Dn){ + n =3D l->p1-p>BLOCKSIZE? BLOCKSIZE : l->p1-= p; + rload(&t->rasp, p, p+n, nil); + if(fprint(fd, "%.*S", n, scratch) < 0) + break; + } + close(fd); + }else + outTsll(Tsnarf, t->tag, l->p0, l->p1); } } @@ -280,14 +301,75 @@ hcheck(t->tag); } +#define HSIZE 3 +#define MAXCSTR (DATASIZE-HSIZE-sizeof(int)-2*sizeof(long)) /* Max cstring= allowed by outTsllS */ void paste(Text *t, int w) { - if(snarflen){ - cut(t, w, 0, 0); - t->lock++; - outTsl(Tpaste, t->tag, t->l[w].p0); + Rune *rstr, *rp; + Biobuf *bp; + int rstrsize; + int len; /* size in bytes of current rstr converted to UTF */ + int m, n; /* n: number of runes already on rstr */ + long offset, last; + + if(!riosnarf){ + if(snarflen){ + cut(t, w, 0, 0); + t->lock++; + outTsllS(Tpaste, t->tag, 0, t->l[w].p0, L""); + } + return; + } + rstrsize =3D MAXCSTR; + if((bp=3DBopen("/dev/snarf", OREAD)) =3D=3D 0){ + fprint(2, "samterm:paste: can't open /dev/snarf"); + return; + } + offset =3D t->l[w].p0; + rp =3D rstr =3D alloc(rstrsize); + len =3D n =3D 0; + if((last=3DBgetrune(bp)) <=3D 0) + return; + cut(t, w, 0, 0); + while((long)(*rp=3Dlast?last:Bgetrune(bp)) > 0){ + last =3D 0; + if((len+=3Drunelen(*rp)) > MAXCSTR){ + Bungetrune(bp); + --n; + last =3D *(rp-1); /* can't Bungetrune again... */ + *(rp-1) =3D 0; + if(t->lock =3D=3D 0) + t->lock =3D 1; + if(Bgetrune(bp) <=3D 0){ /* Last chunk */ + outTsllS(Tpaste, t->tag, t->l[w].p0, offset= , rstr); + break; + } + Bungetrune(bp); + outTsllS(Tpaste, t->tag, -1, offset, rstr); + offset +=3D n; + rp =3D rstr; + n =3D len =3D 0; + continue; + } + if(RUNESIZE*(rp-rstr+2) > rstrsize){ + m =3D rp - rstr; + rstr =3D realloc(rstr, rstrsize+=3DMAXCSTR); + if(!rstr) + panic("realloc"); + rp =3D rstr + m; + } + ++rp; + ++n; + } + *rp =3D 0; + if(*rstr){ + if(t->lock =3D=3D 0) + t->lock =3D 1; + outTsllS(Tpaste, t->tag, t->l[w].p0, offset, rstr); } + free(rstr); + Bterm(bp); } void --- sys/src/cmd/samterm/mesg.c Thu Mar 29 19:35:49 2012 +++ /sys/src/cmd/samterm/mesg.c Fri Jul 23 19:23:28 2021 @@ -97,6 +97,7 @@ int i, m; long l; Flayer *lp; + char *str, c; m =3D inshort(0); l =3D inlong(2); @@ -107,6 +108,18 @@ fprint(2, "type %d\n", type); panic("rcv unknown"); + case Hlabel: + str =3D (char *)indata; + if((m =3D open("/dev/label", OWRITE)) < 0){ + fprint(2, "samterm:label: can't open /dev/label for= writing"); + break; + } + while((c=3D*str)=3D=3D' ' || c=3D=3D'\t') + str++; + fprint(m, "%s", str); + close(m); + break; + case Hversion: hversion =3D m; break; @@ -432,6 +445,24 @@ outstart(type); outshort(s1); outlong(l1); + c =3D buf; + while(*s) + c +=3D runetochar(c, s++); + *c++ =3D 0; + outcopy(c-buf, (uchar *)buf); + outsend(); +} + +void +outTsllS(Tmesg type, int s1, long l1, long l2, Rune *s) +{ + char buf[DATASIZE*3+1]; + char *c; + + outstart(type); + outshort(s1); + outlong(l1); + outlong(l2); c =3D buf; while(*s) c +=3D runetochar(c, s++); --- sys/src/cmd/samterm/samterm.h Sat Jun 26 21:13:32 2021 +++ /sys/src/cmd/samterm/samterm.h Fri Jul 23 11:59:07 2021 @@ -1,5 +1,6 @@ #define SAMTERM +#define BLOCKSIZE 2048 #define RUNESIZE sizeof(Rune) #define MAXFILES 256 #define READBUFSIZE (16*1024) @@ -72,6 +73,7 @@ extern long nscralloc; extern char hostlock; extern char hasunlocked; +extern char riosnarf; extern long snarflen; extern Mousectl* mousectl; extern Keyboardctl* keyboardctl; @@ -167,6 +169,7 @@ void outT0(Tmesg); void outTl(Tmesg, long); void outTslS(Tmesg, int, long, Rune*); +void outTsllS(Tmesg, int, long, long, Rune*); void outTsll(Tmesg, int, long, long); void outTsl(Tmesg, int, long); void outTsv(Tmesg, int, vlong); --- sys/src/cmd/sam/cmd.c Wed Apr 24 00:06:05 2013 +++ /sys/src/cmd/sam/cmd.c Sun Jul 18 18:23:06 2021 @@ -17,6 +17,7 @@ 'g', 0, 1, 0, 'p', aDot, 0, 0, g_c= md, 'i', 1, 0, 0, 0, aDot, 0, 0, i_c= md, 'k', 0, 0, 0, 0, aDot, 0, 0, k_c= md, + 'l', 0, 0, 0, 0, aNo, 0, linex, l_c= md, 'm', 0, 0, 1, 0, aDot, 0, 0, m_c= md, 'n', 0, 0, 0, 0, aNo, 0, 0, n_c= md, 'p', 0, 0, 0, 0, aDot, 0, 0, p_c= md, --- sys/src/cmd/sam/disk.c Thu Feb 28 21:08:58 2002 +++ /sys/src/cmd/sam/disk.c Fri Jul 23 19:34:38 2021 @@ -48,7 +48,7 @@ /* last bucket holds blocks of exactly Maxblock */ if(ip) *ip =3D size/Blockincr; - return size * sizeof(Rune); + return size * RUNESIZE; } Block* @@ -101,7 +101,7 @@ b =3D disknewblock(d, n); *bp =3D b; } - if(pwrite(d->fd, r, n*sizeof(Rune), b->addr) !=3D n*sizeof(Rune)) + if(pwrite(d->fd, r, n*RUNESIZE, b->addr) !=3D n*RUNESIZE) panic("write error to temp file"); b->n =3D n; } @@ -113,6 +113,6 @@ panic("internal error: diskread"); ntosize(b->n, nil); /* called only for sanity check on Maxblock= */ - if(pread(d->fd, r, n*sizeof(Rune), b->addr) !=3D n*sizeof(Rune)) + if(pread(d->fd, r, n*RUNESIZE, b->addr) !=3D n*RUNESIZE) panic("read error from temp file"); } --- sys/src/cmd/sam/file.c Fri Jul 30 18:29:06 2010 +++ /sys/src/cmd/sam/file.c Fri Jul 23 19:35:49 2021 @@ -35,7 +35,7 @@ enum { Maxmerge =3D 50, - Undosize =3D sizeof(Undo)/sizeof(Rune), + Undosize =3D sizeof(Undo)/RUNESIZE, }; static Merge merge; --- sys/src/cmd/sam/mesg.c Fri Jan 12 17:02:55 2007 +++ /sys/src/cmd/sam/mesg.c Fri Jul 23 19:50:39 2021 @@ -1,4 +1,5 @@ #include "sam.h" +#include Header h; uchar indata[DATASIZE]; @@ -347,7 +348,28 @@ case Tpaste: f =3D whichfile(inshort()); p0 =3D inlong(); + p =3D inlong(); journaln(0, p0); + + if(*(char*)inp !=3D 0){ + str =3D tmpcstr((char*)inp); + m =3D str->n; + loginsert(f, p, str->s, m); + freetmpstr(str); + if(fileupdate(f, FALSE, TRUE)) + seq++; + /* there's another chunk? */ + if(p0 < 0){ + rcv(); + break; + } + f->dot.r.p1 =3D p0; + f->dot.r.p2 =3D p+m; + f->tdot.p1 =3D -1; /* force telldot to tell (arguab= ly a BUG) */ + telldot(f); + outTs(Hunlockfile, f->tag); + break; + } for(l=3D0; lBLOCKSIZE) @@ -359,7 +381,7 @@ seq++; f->dot.r.p1 =3D p0; f->dot.r.p2 =3D p0+snarfbuf.nc; - f->tdot.p1 =3D -1; /* force telldot to tell (arguably a BUG= ) */ + f->tdot.p1 =3D -1; telldot(f); outTs(Hunlockfile, f->tag); break; @@ -477,7 +499,7 @@ m =3D SNARFSIZE; dprint("?warning: snarf buffer truncated\n"); } - rp =3D malloc(m*sizeof(Rune)); + rp =3D malloc(m*RUNESIZE); if(rp){ bufread(&snarfbuf, 0, rp, m); c =3D Strtoc(tmprstr(rp, m)); --- sys/src/cmd/sam/mesg.h Fri Mar 18 22:33:33 2005 +++ /sys/src/cmd/sam/mesg.h Wed Jul 21 22:46:19 2021 @@ -67,6 +67,7 @@ Hack, /* request acknowledgement */ Hexit, Hplumb, /* return plumb message to terminal - version 1 */ + Hlabel, /* set /dev/label on terminal */ HMAX, }Hmesg; typedef struct Header{ --- sys/src/cmd/sam/parse.h Thu Oct 27 15:36:34 2005 +++ /sys/src/cmd/sam/parse.h Sat Jul 17 19:55:51 2021 @@ -55,13 +55,12 @@ int nl_cmd(File*, Cmd*), a_cmd(File*, Cmd*), b_cmd(File*, Cmd*); int c_cmd(File*, Cmd*), cd_cmd(File*, Cmd*), d_cmd(File*, Cmd*); -int D_cmd(File*, Cmd*), e_cmd(File*, Cmd*); -int f_cmd(File*, Cmd*), g_cmd(File*, Cmd*), i_cmd(File*, Cmd*); -int k_cmd(File*, Cmd*), m_cmd(File*, Cmd*), n_cmd(File*, Cmd*); -int p_cmd(File*, Cmd*), q_cmd(File*, Cmd*); -int s_cmd(File*, Cmd*), u_cmd(File*, Cmd*), w_cmd(File*, Cmd*); -int x_cmd(File*, Cmd*), X_cmd(File*, Cmd*), plan9_cmd(File*, Cmd*); -int eq_cmd(File*, Cmd*); +int D_cmd(File*, Cmd*), e_cmd(File*, Cmd*), f_cmd(File*, Cmd*); +int g_cmd(File*, Cmd*), i_cmd(File*, Cmd*), k_cmd(File*, Cmd*); +int l_cmd(File*, Cmd*), m_cmd(File*, Cmd*), n_cmd(File*, Cmd*); +int p_cmd(File*, Cmd*), q_cmd(File*, Cmd*), s_cmd(File*, Cmd*); +int u_cmd(File*, Cmd*), w_cmd(File*, Cmd*), x_cmd(File*, Cmd*); +int X_cmd(File*, Cmd*), plan9_cmd(File*, Cmd*), eq_cmd(File*, Cmd*); String *getregexp(int); --- sys/src/cmd/sam/sam.c Tue Dec 6 17:05:45 2005 +++ /sys/src/cmd/sam/sam.c Tue Jul 20 12:23:28 2021 @@ -25,6 +25,7 @@ int termlocked; char *samterm =3D SAMTERM; char *rsamname =3D RSAM; +char *samtermlabel =3D nil; File *lastfile; Disk *disk; long seq; @@ -57,6 +58,9 @@ case 's': rsamname =3D EARGF(usage()); break; + case 'l': + samtermlabel =3D EARGF(usage()); + break; default: dprint("sam: unknown flag %c\n", ARGC()); usage(); @@ -82,6 +86,11 @@ startup(machine, Rflag, termargs, argv); notify(notifyf); getcurwd(); + if(samtermlabel){ + t=3Dtmpcstr(samtermlabel); + outTS(Hlabel, t); + freetmpstr(t); + } if(argc>0){ for(i=3D0; iunread) load(f); if(f=3D=3D0 && (cp->addr=3D=3D0 || cp->addr->type!=3D'"') && - !utfrune("bBnqUXY!", cp->cmdc) && + !utfrune("bBnqUXY!l", cp->cmdc) && cp->cmdc!=3D('c'|0x100) && !(cp->cmdc=3D=3D'D' && cp->ctext)) error(Enofile); i =3D lookup(cp->cmdc); @@ -150,6 +150,14 @@ { USED(cp); f->mark =3D addr.r; + return TRUE; +} + +int +l_cmd(File *f, Cmd *cp) +{ + USED(f); + outTS(Hlabel, cp->ctext); return TRUE; } ------------------------------------------ 9fans: 9fans Permalink: https://9fans.topicbox.com/groups/9fans/Tc809ad6007ccd2bd-M27ffc= 8edbf9c9fa1390479dd Delivery options: https://9fans.topicbox.com/groups/9fans/subscription