commit - c1973705501d05e906bd14a0dc25cc4472b5871f
commit + d51419bf4397cf13d0c50bf84c125477c6bed307
blob - 8499bb15108bbdd119afc4223b5a5051cf45a7d4
blob + 4af3a242a851fe4dc363875bbb5a7843f1e953b9
--- LICENSE
+++ LICENSE
There are a few exceptions: libutf, libfmt, and libregexp are distributed
under simpler BSD-like boilerplates. See the LICENSE files in those
-directories.
+directories. There are other exceptions, also marked with LICENSE files
+in their directories.
The bitmap fonts in the font/lucida directory are copyright B&H Inc. and Y&Y Inc.
and distributed under the following exception to the Lucent license:
blob - fa37baad5aa5b677252b3e762b0fa6c6f80741ce
blob + 602d0289b34768bd71876c03c7afd6059a10d200
--- bin/9c
+++ bin/9c
-Wno-parentheses \
-Wno-missing-braces \
-Wno-switch \
+ -Wno-comment \
-Wno-sign-compare \
"
}
blob - bb05fd4072dad22c5c98d9bfd2f9adb6d86ef81f
blob + 1395754abf4d54b1f20114a15d4baa34c5756f6b
--- bin/bundle
+++ bin/bundle
echo '# To unbundle, run this file'
for i
do
- echo 'echo '$i
- echo 'sed ''s/.//'' >'$i' <<''//GO.SYSIN DD '$i''''
- sed 's/^/-/' $i
- echo '//GO.SYSIN DD '$i
+ echo "echo $i"
+ echo "sed 's/.//' >$i <<'//GO.SYSIN DD $i'"
+ sed "s/^/-/" $i
+ echo "//GO.SYSIN DD $i"
done
blob - /dev/null
blob + 7ee2b18a0c2a9968f206d6f653375519d92a3483 (mode 644)
--- /dev/null
+++ include/complete.h
+#pragma lib "libcomplete.a"
+#pragma src "/sys/src/libcomplete"
+
+typedef struct Completion Completion;
+
+struct Completion{
+ uchar advance; /* whether forward progress has been made */
+ uchar complete; /* whether the completion now represents a file or directory */
+ char *string; /* the string to advance, suffixed " " or "/" for file or directory */
+ int nfile; /* number of files that matched */
+ char **filename; /* their names */
+};
+
+Completion* complete(char *dir, char *s);
+void freecompletion(Completion*);
blob - fa19cce81eb209f0cb1aca1cf0737a43b67d0417
blob + 99d37990621d353e651ce74479544de781cebc58
--- src/lib9/dial.c
+++ src/lib9/dial.c
#include <sys/socket.h>
#include <netinet/in.h>
+#include <netinet/tcp.h>
#include <sys/un.h>
#include <netdb.h>
close(s);
return -1;
}
+ if(proto == SOCK_STREAM){
+ int one = 1;
+ setsockopt(s, IPPROTO_TCP, TCP_NODELAY, (char*)&one, sizeof one);
+ }
return s;
Unix:
blob - 0b3dc253a836db332ecb2d7268f20375f5bfb8f2
blob + a359327b598ca6382449b1d8bacfe2495f1dc61d
--- src/libdraw/openfont.c
+++ src/libdraw/openfont.c
if(nambuf == nil)
return 0;
if((fd = open(nambuf, OREAD)) < 0){
+fprint(2, "failed at %s\n", nambuf);
free(nambuf);
return 0;
}
blob - /dev/null
blob + 3a06447a3718c4eef4f3e1fa6540697e8d4e6fa9 (mode 644)
--- /dev/null
+++ src/libcomplete/complete.c
+#include <u.h>
+#include <libc.h>
+#include "complete.h"
+
+static int
+longestprefixlength(char *a, char *b, int n)
+{
+ int i, w;
+ Rune ra, rb;
+
+ for(i=0; i<n; i+=w){
+ w = chartorune(&ra, a);
+ chartorune(&rb, b);
+ if(ra != rb)
+ break;
+ a += w;
+ b += w;
+ }
+ return i;
+}
+
+void
+freecompletion(Completion *c)
+{
+ if(c){
+ free(c->filename);
+ free(c);
+ }
+}
+
+static int
+strpcmp(const void *va, const void *vb)
+{
+ char *a, *b;
+
+ a = *(char**)va;
+ b = *(char**)vb;
+ return strcmp(a, b);
+}
+
+Completion*
+complete(char *dir, char *s)
+{
+ long i, l, n, nmatch, len, nbytes;
+ int fd, minlen;
+ Dir *dirp;
+ char **name, *p;
+ ulong* mode;
+ Completion *c;
+
+ if(strchr(s, '/') != nil){
+ werrstr("slash character in name argument to complete()");
+ return nil;
+ }
+
+ fd = open(dir, OREAD);
+ if(fd < 0)
+ return nil;
+
+ n = dirreadall(fd, &dirp);
+ if(n <= 0)
+ return nil;
+
+ /* find longest string, for allocation */
+ len = 0;
+ for(i=0; i<n; i++){
+ l = strlen(dirp[i].name) + 1 + 1; /* +1 for / +1 for \0 */
+ if(l > len)
+ len = l;
+ }
+
+ name = malloc(n*sizeof(char*));
+ mode = malloc(n*sizeof(ulong));
+ c = malloc(sizeof(Completion) + len);
+ if(name == nil || mode == nil || c == nil)
+ goto Return;
+ memset(c, 0, sizeof(Completion));
+
+ /* find the matches */
+ len = strlen(s);
+ nmatch = 0;
+ minlen = 1000000;
+ for(i=0; i<n; i++)
+ if(strncmp(s, dirp[i].name, len) == 0){
+ name[nmatch] = dirp[i].name;
+ mode[nmatch] = dirp[i].mode;
+ if(minlen > strlen(dirp[i].name))
+ minlen = strlen(dirp[i].name);
+ nmatch++;
+ }
+
+ if(nmatch > 0) {
+ /* report interesting results */
+ /* trim length back to longest common initial string */
+ for(i=1; i<nmatch; i++)
+ minlen = longestprefixlength(name[0], name[i], minlen);
+
+ /* build the answer */
+ c->complete = (nmatch == 1);
+ c->advance = c->complete || (minlen > len);
+ c->string = (char*)(c+1);
+ memmove(c->string, name[0]+len, minlen-len);
+ if(c->complete)
+ c->string[minlen++ - len] = (mode[0]&DMDIR)? '/' : ' ';
+ c->string[minlen - len] = '\0';
+ } else {
+ /* no match, so return all possible strings */
+ for(i=0; i<n; i++){
+ name[i] = dirp[i].name;
+ mode[i] = dirp[i].mode;
+ }
+ nmatch = n;
+ }
+
+ /* attach list of names */
+ nbytes = nmatch * sizeof(char*);
+ for(i=0; i<nmatch; i++)
+ nbytes += strlen(name[i]) + 1 + 1;
+ c->filename = malloc(nbytes);
+ if(c->filename == nil)
+ goto Return;
+ p = (char*)(c->filename + nmatch);
+ for(i=0; i<nmatch; i++){
+ c->filename[i] = p;
+ strcpy(p, name[i]);
+ p += strlen(p);
+ if(mode[i] & DMDIR)
+ *p++ = '/';
+ *p++ = '\0';
+ }
+ c->nfile = nmatch;
+ qsort(c->filename, c->nfile, sizeof(c->filename[0]), strpcmp);
+
+ Return:
+ free(name);
+ free(mode);
+ free(dirp);
+ return c;
+}
blob - /dev/null
blob + 233dbef8add2fd9d58aa47d1fd12b81d250e50a2 (mode 644)
--- /dev/null
+++ src/libcomplete/mkfile
+PLAN9=../..
+<$PLAN9/src/mkhdr
+
+LIB=libcomplete.a
+OFILES=\
+ complete.$O\
+
+HFILES=$PLAN9/include/complete.h
+
+<$PLAN9/src/mksyslib
blob - d9cf9d04eeee76ee27a2057c03c88ffc61cfcc7c
blob + 0577f8a04c6d86aaa7ee67e7242e91b941e1bc43
--- src/libthread/iocall.c
+++ src/libthread/iocall.c
long
iocall(Ioproc *io, long (*op)(va_list*), ...)
{
+ char e[ERRMAX];
int ret, inted;
Ioproc *msg;
va_end(io->arg);
ret = io->ret;
if(ret < 0)
- errstr(io->err, sizeof io->err);
+ strecpy(e, e+sizeof e, io->err);
io->inuse = 0;
/* release resources */
while(send(io->creply, &io) == -1)
;
+ if(ret < 0)
+ errstr(e, sizeof e);
return ret;
}
blob - 8171156c5cbfb50b258844cc9c760ee388175260
blob + 2e45cfe6291563f2b871026b48fabfe87eaa9fb3
--- src/libthread/iodial.c
+++ src/libthread/iodial.c
_iodial(va_list *arg)
{
char *addr, *local, *dir;
- int *cdfp;
+ int *cdfp, fd;
addr = va_arg(*arg, char*);
local = va_arg(*arg, char*);
dir = va_arg(*arg, char*);
cdfp = va_arg(*arg, int*);
- return dial(addr, local, dir, cdfp);
+fprint(2, "before dial\n");
+ fd = dial(addr, local, dir, cdfp);
+fprint(2, "after dial\n");
+ return fd;
}
int
blob - 664a84bf207460c9983a99b2800c8318bdf0db59
blob + 593224c28835992db94b2bd6bc36aa2b108e0e06
--- src/libthread/iowrite.c
+++ src/libthread/iowrite.c
{
int fd;
void *a;
- long n;
+ long n, nn;
fd = va_arg(*arg, int);
a = va_arg(*arg, void*);
n = va_arg(*arg, long);
- n = write(fd, a, n);
- return n;
+ nn = write(fd, a, n);
+fprint(2, "_iowrite %d %d %r\n", n, nn);
+ return nn;
}
long
blob - 739aaf84fb8a8d870a4d41df2b280acc54a3d0af
blob + 8854cde71c5940708f3ebdf0e36c77c266be866f
--- src/libthread/mkfile
+++ src/libthread/mkfile
id.$O\
iocall.$O\
ioclose.$O\
+ iodial.$O\
ioopen.$O\
ioproc.$O\
ioread.$O\
ioreadn.$O\
+ iosleep.$O\
iowrite.$O\
kill.$O\
lib.$O\
blob - b25f2b23c336de568dfbae2a0d0cfea1a7c17c4b
blob + 1136156cf815eba52db412e65e8c19d39e552bdc
--- src/libthread/note.c
+++ src/libthread/note.c
// _exits(_threadexitsallstatus);
// }
- if(strcmp(s, "threadint")==0)
+ if(strcmp(s, "threadint")==0 || strcmp(s, "interrupt")==0)
noted(NCONT);
p = _threadgetproc();