content stringlengths 263 5.24M | pred_label stringclasses 1
value | pred_score_pos float64 0.6 1 |
|---|---|---|
/*
* Deal with duplicated lines in a file
*/
#include <u.h>
#include <libc.h>
#include <bio.h>
#include <ctype.h>
#define SIZE 8000
int fields = 0;
int letters = 0;
int linec = 0;
char mode;
int uniq;
char *b1, *b2;
long bsize;
Biobuf fin;
Biobuf fout;
int gline(char *buf);
void pline(char *buf);
int equal(char *b... | __label__POS | 0.713713 |
#include <u.h>
#include <libc.h>
#include <oventi.h>
#include "session.h"
struct {
int version;
char *s;
} vtVersions[] = {
VtVersion02, "02",
0, 0,
};
static char EBigString[] = "string too long";
static char EBigPacket[] = "packet too long";
static char ENullString[] = "missing string";
static char EBadVersion[... | __label__POS | 0.834974 |
#include <u.h>
#include <libc.h>
#include <oventi.h>
/*
* integer conversion routines
*/
#define U8GET(p) ((p)[0])
#define U16GET(p) (((p)[0]<<8)|(p)[1])
#define U32GET(p) ((u32int)(((p)[0]<<24)|((p)[1]<<16)|((p)[2]<<8)|(p)[3]))
#define U48GET(p) (((vlong)U16GET(p)<<32)|(vlong)U32GET((p)+2))
#define U64GET(p) (((vlo... | __label__POS | 0.907871 |
#include <u.h>
#include <libc.h>
#define DEFB (16*1024)
int failed;
int gflag;
int uflag;
int xflag;
void copy(char *from, char *to, int todir);
int copy1(int fdf, int fdt, char *from, char *to);
void
main(int argc, char *argv[])
{
Dir *dirb;
int todir, i;
ARGBEGIN {
case 'g':
gflag++;
break;
case 'u':
u... | __label__POS | 0.627737 |
#include <u.h>
#include <libc.h>
#include <oventi.h>
enum {
IdealAlignment = 32,
ChunkSize = 128*1024,
};
void
vtMemFree(void *p)
{
if(p == 0)
return;
free(p);
}
void *
vtMemAlloc(int size)
{
void *p;
p = malloc(size);
if(p == 0)
vtFatal("vtMemAlloc: out of memory");
setmalloctag(p, getcallerpc(&size... | __label__POS | 0.652034 |
#include <u.h>
#include <libc.h>
#include <draw.h>
#include "cons.h"
/*
* bind a pipe onto consctl and keep reading it to
* get changes to console state.
*/
Consstate*
consctl(void)
{
int i, n, fd, tries;
char buf[128];
Consstate *x;
char *field[10];
x = segattach(0, "shared", 0, sizeof *x);
if(x == (void*... | __label__POS | 0.870173 |
#include <u.h>
#include <libc.h>
#include <bio.h>
#define whsiz (sizeof(wheel)/sizeof(wheel[0]))
double wheel[] =
{
2,10, 2, 4, 2, 4, 6, 2, 6, 4,
2, 4, 6, 6, 2, 6, 4, 2, 6, 4,
6, 8, 4, 2, 4, 2, 4, 8, 6, 4,
6, 2, 4, 6, 2, 6, 6, 4, 2, 4,
6, 2, 6, 4, 2, 4, 2,10,
};
Biobuf bin;
void factor(double);
void
main... | __label__POS | 0.977817 |
/*
* mc - columnate
*
* mc[-][-LINEWIDTH][-t][file...]
* - causes break on colon
* -LINEWIDTH sets width of line in which to columnate(default 80)
* -t suppresses expanding multiple blanks into tabs
*
*/
#include <u.h>
#include <libc.h>
#include <draw.h>
#include <bio.h>
#define WIDTH 80
#define TAB 4
#defin... | __label__POS | 0.620889 |
#include <u.h>
#include <libc.h>
#include <bio.h>
#define LB 2048
int one;
int two;
int three;
char *ldr[3];
Biobuf *ib1;
Biobuf *ib2;
Biobuf *openfil(char*);
int rd(Biobuf*, char*);
void wr(char*, int);
void copy(Biobuf*, char*, int);
int compare(char*, char*);
void
main(int argc, char *argv[])
{
int l;
char lb1... | __label__POS | 0.939275 |
#include <u.h>
#include <libc.h>
#include <bio.h>
char choice[2048];
char index[] = "/sys/games/lib/fortunes.index";
char fortunes[] = "/sys/games/lib/fortunes";
void
main(int argc, char *argv[])
{
int i;
long offs;
uchar off[4];
int ix, nix;
int newindex, oldindex;
char *p;
Dir *fbuf, *ixbuf;
Biobuf *f, g;
... | __label__POS | 0.775314 |
#include <u.h>
#include <libc.h>
#include <bio.h>
/* Macros for Rune support of ctype.h-like functions */
#define isupper(r) (L'A' <= (r) && (r) <= L'Z')
#define islower(r) (L'a' <= (r) && (r) <= L'z')
#define isalpha(r) (isupper(r) || islower(r))
#define islatin1(r) (0xC0 <= (r) && (r) <= 0xFF)
#define isdigit(r) (... | __label__POS | 0.645209 |
#include <u.h>
#include <libc.h>
#include <draw.h>
#include <event.h>
typedef struct KbMap KbMap;
struct KbMap {
char *name;
char *file;
Rectangle r;
int current;
};
KbMap *map;
int nmap;
Image *lightblue;
Image *justblue;
enum {
PAD = 3,
MARGIN = 5
};
char *dir = "/sys/lib/kbmap";
void*
erealloc(void *v, ul... | __label__POS | 0.670392 |
#include <u.h>
#include <libc.h>
#include <bio.h>
#include <String.h>
#include <thread.h>
#include "wiki.h"
/*
* Get HTML and text templates from underlying file system.
* Caches them, which means changes don't take effect for
* up to Tcache seconds after they are made.
*
* If the files are deleted, we keep retu... | __label__POS | 0.60632 |
#include <u.h>
#include <libc.h>
double min = 1.0;
double max = 0.0;
double incr = 1.0;
int constant = 0;
int nsteps;
char *format;
void
usage(void)
{
fprint(2, "usage: seq [-fformat] [-w] [first [incr]] last\n");
exits("usage");
}
void
buildfmt(void)
{
char *dp;
int w, p, maxw, maxp;
static char fmt[16];
char... | __label__POS | 0.687575 |
#include <u.h>
#include <libc.h>
#include <bio.h>
#include <String.h>
#include <ctype.h>
#include <thread.h>
#include "wiki.h"
void*
erealloc(void *v, ulong n)
{
v = realloc(v, n);
if(v == nil)
sysfatal("out of memory reallocating %lud", n);
setmalloctag(v, getcallerpc(&v));
return v;
}
void*
emalloc(ulong n)
{... | __label__POS | 0.984813 |
/*
* tee-- pipe fitting
*/
#include <u.h>
#include <libc.h>
int uflag;
int aflag;
int *openf;
char in[8192];
int intignore(void*, char*);
void
main(int argc, char **argv)
{
int i;
int r, n;
ARGBEGIN {
case 'a':
aflag++;
break;
case 'i':
atnotify(intignore, 1);
break;
case 'u':
uflag++;
/* uf... | __label__POS | 0.650532 |
#include <u.h>
#include <libc.h>
#include <flate.h>
#include "zlib.h"
typedef struct ZWrite ZWrite;
struct ZWrite
{
ulong adler;
void *wr;
int (*w)(void*, void*, int);
};
static int
zlwrite(void *vzw, void *buf, int n)
{
ZWrite *zw;
zw = vzw;
zw->adler = adler32(zw->adler, buf, n);
n = (*zw->w)(zw->wr, buf, ... | __label__POS | 0.849374 |
#include <u.h>
#include <libc.h>
#include <flate.h>
enum
{
ADLERITERS = 5552, /* max iters before can overflow 32 bits */
ADLERBASE = 65521 /* largest prime smaller than 65536 */
};
ulong
adler32(ulong adler, void *vbuf, int n)
{
ulong s1, s2;
uchar *buf, *ebuf;
int m;
buf = vbuf;
s1 = adler & 0xffff;
s2 = (... | __label__POS | 0.976475 |
#include <u.h>
#include <libc.h>
#include <draw.h>
#include <thread.h>
#include <mouse.h>
#include <frame.h>
int
_frcanfit(Frame *f, Point pt, Frbox *b)
{
int left, w, nr;
uchar *p;
Rune r;
left = f->r.max.x-pt.x;
if(b->nrune < 0)
return b->minwid <= left;
if(left >= b->wid)
return b->nrune;
for(nr=0,p=b->... | __label__POS | 0.743298 |
#include <u.h>
#include <libc.h>
#include <bio.h>
#include <ip.h>
#include <plumb.h>
#include <thread.h>
#include <fcall.h>
#include <9p.h>
#include "dat.h"
#include "fns.h"
void
initibuf(Ibuf *b, Ioproc *io, int fd)
{
b->fd = fd;
b->io = io;
b->rp = b->wp = b->buf;
}
int
readibuf(Ibuf *b, char *buf, int len)
{
i... | __label__POS | 0.963846 |
#include <u.h>
#include <libc.h>
#include <bio.h>
#include <ip.h>
#include <plumb.h>
#include <thread.h>
#include <fcall.h>
#include <9p.h>
#include <mp.h>
#include <libsec.h>
#include "dat.h"
#include "fns.h"
static long
_iovfprint(va_list *arg)
{
int fd;
char *fmt;
va_list arg2;
fd = va_arg(*arg, int);
fmt = v... | __label__POS | 0.783244 |
/*
* functions to read and write an executable or file image
*/
#include <u.h>
#include <libc.h>
#include <bio.h>
#include <mach.h>
static int mget(Map*, uvlong, void*, int);
static int mput(Map*, uvlong, void*, int);
static struct segment* reloc(Map*, uvlong, vlong*);
/*
* routines to get/put various types
*/
i... | __label__POS | 0.834465 |
#include <u.h>
#include <libc.h>
void
reboot(void)
{
int fd;
fd = open("/dev/reboot", OWRITE);
if(fd >= 0)
write(fd, "reboot", 6);
exits(0);
}
char*
readenv(char *name, char *buf, int n)
{
char *ans;
int f;
char ename[200];
ans = buf;
ename[0] = 0;
strcat(ename, "/env/");
strcat(ename, name);
f = open(... | __label__POS | 0.988363 |
/*
* file map routines
*/
#include <u.h>
#include <libc.h>
#include <bio.h>
#include <mach.h>
Map *
newmap(Map *map, int n)
{
int size;
size = sizeof(Map)+(n-1)*sizeof(struct segment);
if (map == 0)
map = malloc(size);
else
map = realloc(map, size);
if (map == 0) {
werrstr("out of memory: %r");
return ... | __label__POS | 0.963453 |
#include <u.h>
#include <libc.h>
#include <auth.h>
#include <authsrv.h>
#include "authlocal.h"
enum {
ARgiveup = 100,
};
static int
dorpc(AuthRpc *rpc, char *verb, char *val, int len, AuthGetkey *getkey)
{
int ret;
for(;;){
if((ret = auth_rpc(rpc, verb, val, len)) != ARneedkey && ret != ARbadkey)
return ret;... | __label__POS | 0.707343 |
/* tc.c: find character not in table to delimit fields */
# include "t.h"
# define COMMON "\002\003\005\006\007!%&#/?,:;<=>@`^~_{}+-*" \
"ABCDEFGHIJKMNOPQRSTUVWXZabcdefgjkoqrstwxyz"
void
choochar(void)
{
/* choose funny characters to delimit fields */
int had[128], ilin, icol, k;
char *s;
for (icol = 0; icol... | __label__POS | 0.685348 |
#include <u.h>
#include <libc.h>
#include <venti.h>
#include <libsec.h>
#define MAGIC 0x54798314
#define NOTFREE(p) assert((p)->magic == MAGIC)
struct Packet
{
char *data;
int len;
void (*free)(void*);
void *arg;
int magic;
};
Packet*
packetalloc(void)
{
Packet *p;
p = vtmallocz(sizeof *p);
p->free = vtfre... | __label__POS | 0.96418 |
/* ti.c: classify line intersections */
# include "t.h"
/* determine local environment for intersections */
int
interv(int i, int c)
{
int ku, kl;
if (c >= ncol || c == 0) {
if (dboxflg) {
if (i == 0)
return(BOT);
if (i >= nlin)
return(TOP);
return(THRU);
}
if (c >= ncol)
return(0);
}
... | __label__POS | 0.959217 |
#include <u.h>
#include <libc.h>
#include <venti.h>
#include "queue.h"
int chattyventi;
VtConn*
vtconn(int infd, int outfd)
{
VtConn *z;
NetConnInfo *nci;
z = vtmallocz(sizeof(VtConn));
z->tagrend.l = &z->lk;
z->rpcfork.l = &z->lk;
z->infd = infd;
z->outfd = outfd;
z->part = packetalloc();
nci = getnetconni... | __label__POS | 0.632398 |
#include <u.h>
#include <libc.h>
#include <venti.h>
static char *okvers[] = {
"02",
nil,
};
/*
static char EBigString[] = "string too long";
static char EBigPacket[] = "packet too long";
static char ENullString[] = "missing string";
*/
static char EBadVersion[] = "bad format in version string";
static int
vtreadve... | __label__POS | 0.890318 |
/* tt.c: subroutines for drawing horizontal lines */
# include "t.h"
int
ctype(int il, int ic)
{
if (instead[il])
return(0);
if (fullbot[il])
return(0);
il = stynum[il];
return(style[ic][il]);
}
int
min(int a, int b)
{
return(a < b ? a : b);
}
int
fspan(int i, int c)
{
c++;
return(c < ncol && ctype(i, c... | __label__POS | 0.956749 |
#include <u.h>
#include <libc.h>
enum {
Soh= 0x1,
Eot= 0x4,
Ack= 0x6,
Nak= 0x15,
Cancel= 0x18,
};
int notifyf(void*, char*);
int readupto(uchar*, int);
int receive(int, uchar);
void send(int);
int debug, dfd;
void
main(int argc, char **argv)
{
int fd;
uchar seqno;
ulong bytes;
ARGBEGIN {
case 'd':
dfd ... | __label__POS | 0.777528 |
#include <u.h>
#include <libc.h>
#include <venti.h>
#include "cvt.h"
static int
checksize(int n)
{
if(n < 256 || n > VtMaxLumpSize) {
werrstr("bad block size");
return -1;
}
return 0;
}
void
vtrootpack(VtRoot *r, uchar *p)
{
uchar *op = p;
U16PUT(p, VtRootVersion);
p += 2;
memmove(p, r->name, sizeof(r->na... | __label__POS | 0.992746 |
The usage of the staked_conn interface is similar to the RPC interface, primarily providing the sendTransaction method, which directly connects to our validator node.
When calling the sendTransaction method of staked_conn, please note the following:
- A maximum of 5 calls per second is allowed.
- You need to transfer... | __label__POS | 0.615058 |
#define EXTERN
#include "gc.h"
void
listinit(void)
{
fmtinstall('A', Aconv);
fmtinstall('P', Pconv);
fmtinstall('S', Sconv);
fmtinstall('N', Nconv);
fmtinstall('D', Dconv);
fmtinstall('B', Bconv);
}
int
Bconv(Fmt *fp)
{
char str[STRINGSZ], ss[STRINGSZ], *s;
Bits bits;
int i;
str[0] = 0;
bits = va_arg(fp-... | __label__POS | 0.671403 |
#include <u.h>
#include <libc.h>
#include <venti.h>
int ventidoublechecksha1 = 1;
static int
vtfcallrpc(VtConn *z, VtFcall *ou, VtFcall *in)
{
Packet *p;
p = vtfcallpack(ou);
if(p == nil)
return -1;
if((p = _vtrpc(z, p, ou)) == nil)
return -1;
if(vtfcallunpack(in, p) < 0){
packetfree(p);
return -1;
}
... | __label__POS | 0.994628 |
#include <u.h>
#include <libc.h>
#include <auth.h>
#include <fcall.h>
#include <thread.h>
#include <9p.h>
typedef struct Afid Afid;
struct Afid
{
AuthRpc *rpc;
char *uname;
char *aname;
int authok;
int afd;
};
static uvlong authgen = 1ULL<<63;
void
auth9p(Req *r)
{
char *spec;
Afid *afid;
afid = emalloc9p... | __label__POS | 0.753546 |
/*
* SUN NFSv3 Mounter. See RFC 1813
*/
#include <u.h>
#include <libc.h>
#include <thread.h>
#include <sunrpc.h>
#include <nfs3.h>
void
nfsMount3TNullPrint(Fmt *fmt, NfsMount3TNull *x)
{
USED(x);
fmtprint(fmt, "%s\n", "NfsMount3TNull");
}
uint
nfsMount3TNullSize(NfsMount3TNull *x)
{
uint a;
USED(x);
a = 0;
r... | __label__POS | 0.874707 |
#include <u.h>
#include <libc.h>
#include <bio.h>
#include "cb.h"
#include "cbtype.h"
static void
usage(void)
{
fprint(2, "usage: cb [-sj] [-l width]\n");
exits("usage");
}
void
main(int argc, char *argv[])
{
Biobuf stdin, stdout;
ARGBEGIN{
case 'j':
join = 1;
break;
case 'l':
maxleng = atoi(EARGF(usage(... | __label__POS | 0.740062 |
#include <u.h>
#include <libc.h>
#include <thread.h>
#include <sunrpc.h>
#include <nfs3.h>
char*
nfs3StatusStr(Nfs3Status x)
{
switch(x){
case Nfs3Ok:
return "Nfs3Ok";
case Nfs3ErrNotOwner:
return "Nfs3ErrNotOwner";
case Nfs3ErrNoEnt:
return "Nfs3ErrNoEnt";
case Nfs3ErrNoMem:
return "Nfs3ErrNoMem";
case ... | __label__POS | 0.838515 |
#include <u.h>
#include <libc.h>
#include <thread.h>
#include <sunrpc.h>
/*
* RPC protocol constants
*/
enum
{
RpcVersion = 2,
/* msg type */
MsgCall = 0,
MsgReply = 1,
/* reply stat */
MsgAccepted = 0,
MsgDenied = 1,
/* accept stat */
MsgSuccess = 0,
MsgProgUnavail = 1,
MsgProgMismatch = 2,
MsgProcUn... | __label__POS | 0.747525 |
#include "headers.h"
#define BUFFER 1
#define STRUCT 2
#define PUSHED 4
struct SmbBuffer {
uchar *buf;
ulong realmaxlen;
ulong maxlen;
ulong rn;
ulong wn;
ulong savewn;
int flags;
};
void
smbbufferreset(SmbBuffer *s)
{
if (s == nil)
return;
s->rn = 0;
s->wn = 0;
s->flags &= ~PUSHED;
}
void
smbbufferset... | __label__POS | 0.864262 |
#include <u.h>
#include <libc.h>
#include <thread.h>
#include <sunrpc.h>
uint
sunAuthUnixSize(SunAuthUnix *x)
{
return 4 + sunStringSize(x->sysname) + 4 + 4 + 4 + 4*x->ng;
}
int
sunAuthUnixUnpack(uchar *a, uchar *ea, uchar **pa, SunAuthUnix *x)
{
int i;
if(sunUint32Unpack(a, ea, &a, &x->stamp) < 0) goto Err;
if(s... | __label__POS | 0.897022 |
ushort smbnhgets(uchar *);
ulong smbnhgetl(uchar *);
vlong smbnhgetv(uchar *);
void smbhnputs(uchar *, ushort);
void smbhnputl(uchar *, ulong);
void smbhnputv(uchar *, vlong);
SMBPROCESSFN smbnegotiate;
SMBPROCESSFN smbcomsessionsetupandx;
SMBPROCESSFN smbcomtreeconnectandx;
SMBPROCESSFN smbcomtransaction;
SMBPROCESSF... | __label__POS | 0.781471 |
#include <u.h>
#include <libc.h>
#include <thread.h>
#include <sunrpc.h>
SunStatus
sunCallPack(SunProg *prog, uchar *a, uchar *ea, uchar **pa, SunCall *c)
{
uchar *x;
int (*pack)(uchar*, uchar*, uchar**, SunCall*);
if(pa == nil)
pa = &x;
if(c->type < 0 || c->type >= prog->nproc || (pack=prog->proc[c->type].pack... | __label__POS | 0.916853 |
#include <u.h>
#include <libc.h>
#include <thread.h>
#include <sunrpc.h>
/*
* print formatters
*/
int
sunRpcFmt(Fmt *f)
{
SunRpc *rpc;
rpc = va_arg(f->args, SunRpc*);
sunRpcPrint(f, rpc);
return 0;
}
static SunProg **fmtProg;
static int nfmtProg;
static RWLock fmtLock;
void
sunFmtInstall(SunProg *p)
{
int i;... | __label__POS | 0.901203 |
#include <u.h>
#include <libc.h>
#include <ip.h>
#include <thread.h>
#include "netbios.h"
int
nbnsaddname(uchar *serveripaddr, NbName name, ulong ttl, uchar *ipaddr)
{
NbnsMessage *nq;
Alt aa[3];
int tries = NbnsRetryBroadcast;
NbnsAlarm *a;
int rv;
NbnsMessage *response;
nq = nbnsmessagenameregistrationreques... | __label__POS | 0.692182 |
#include <u.h>
#include <libc.h>
#include <ip.h>
#include <thread.h>
#include "netbios.h"
static int
decodehex(char c)
{
if (c >= '0' && c <= '9')
return c - '0';
else if (c >= 'A' && c <= 'F')
return c - 'A' + 10;
else if (c >= 'a' && c <= 'f')
return c - 'a' + 10;
return 0;
}
static char
encodehex(int n)
... | __label__POS | 0.872578 |
#include <u.h>
#include <libc.h>
#include <ip.h>
#include <thread.h>
#include "netbios.h"
void
nbnsmessagequestionfree(NbnsMessageQuestion **qp)
{
NbnsMessageQuestion *q = *qp;
if (q) {
free(q);
*qp = nil;
}
}
void
nbnsmessageresourcefree(NbnsMessageResource **rp)
{
NbnsMessageResource *r = *rp;
if (r) {
f... | __label__POS | 0.69698 |
#include "headers.h"
void
smbresponsereset(SmbSession *s)
{
smbbufferreset(s->response);
}
void
smbresponseinit(SmbSession *s, ushort maxlen)
{
smbbufferfree(&s->response);
s->response = smbbuffernew(maxlen);
}
int
smbresponsealignl2(SmbSession *s, int l2a)
{
return smbbufferalignl2(s->response, l2a);
}
int
smb... | __label__POS | 0.940454 |
#include <u.h>
#include <libc.h>
#include <ip.h>
#include <thread.h>
#include "netbios.h"
int
nbdgramconvM2S(NbDgram *s, uchar *ap, uchar *ep)
{
uchar *p = ap;
int n;
ushort length;
if (ap + 6 + IPv4addrlen > ep)
return 0;
s->type = *p++;
s->flags = *p++;
s->id = nhgets(p); p+= 2;
v4tov6(s->srcip, p); p+= I... | __label__POS | 0.992044 |
#include <u.h>
#include <libc.h>
#include <ctype.h>
#include <ip.h>
static Ipifc**
_readoldipifc(char *buf, Ipifc **l, int index)
{
char *f[200];
int i, n;
Ipifc *ifc;
Iplifc *lifc, **ll;
/* allocate new interface */
*l = ifc = mallocz(sizeof(Ipifc), 1);
if(ifc == nil)
return l;
l = &ifc->next;
ifc->index ... | __label__POS | 0.720272 |
#include <u.h>
#include <libc.h>
#include <ip.h>
#include <thread.h>
#include "netbios.h"
int
nbnsfindname(uchar *serveripaddr, NbName name, uchar *ipaddr, ulong *ttlp)
{
NbnsMessage *nq;
Alt aa[3];
int tries = NbnsRetryBroadcast;
NbnsAlarm *a;
int rv;
NbnsMessage *response;
nq = nbnsmessagenamequeryrequestnew... | __label__POS | 0.620355 |
#include "headers.h"
static QLock logreflock, logprintlock;
static int locked;
void
smbloglock(void)
{
qlock(&logreflock);
if (locked++ == 0)
qlock(&logprintlock);
qunlock(&logreflock);
}
void
smblogunlock(void)
{
qlock(&logreflock);
if (locked && --locked == 0)
qunlock(&logprintlock);
qunlock(&logreflock)... | __label__POS | 0.977104 |
#include <u.h>
#include <libc.h>
#include <thread.h>
#include "threadimpl.h"
#include <tos.h>
int
threadid(void)
{
return _threadgetproc()->thread->id;
}
int
threadpid(int id)
{
int pid;
Proc *p;
Thread *t;
if (id < 0)
return -1;
if (id == 0)
return _threadgetproc()->pid;
lock(&_threadpq.lock);
for (p = ... | __label__POS | 0.985995 |
#include <u.h>
#include <libc.h>
#include <bio.h>
#include <ndb.h>
#include <ndbhf.h>
/*
* look up the ip attributes 'list' for an entry that has the
* given 'attr=val' and a 'ip=' tuples.
*
* return nil if not found.
*/
Ndbtuple*
csipinfo(char *netroot, char *attr, char *val, char **list, int n)
{
Ndbtuple *... | __label__POS | 0.869232 |
#include "headers.h"
int
smbmatch(char *name, Reprog *rep)
{
Resub sub;
sub.sp = nil;
sub.ep = nil;
if (regexec(rep, name, &sub, 1) && sub.sp == name && *sub.ep == 0)
return 1;
return 0;
}
Reprog *
smbmkrep(char *pattern)
{
Reprog *r;
int l;
char *tmp, *p, *q, *t;
l = strlen(pattern);
tmp = smbemalloc(l *... | __label__POS | 0.684417 |
#include <u.h>
#include <libc.h>
#include <bio.h>
#include <ndb.h>
#include <ndbhf.h>
/*
* search for a tuple that has the given 'attr=val' and also 'rattr=x'.
* copy 'x' into 'buf' and return the whole tuple.
*
* return 0 if not found.
*/
char*
csgetvalue(char *netroot, char *attr, char *val, char *rattr, Ndb... | __label__POS | 0.913854 |
#include <u.h>
#include <libc.h>
#include <httpd.h>
static char hstates[] = "nrewE";
static char hxfers[] = " x";
static int _hflush(Hio*, int, int);
int
hinit(Hio *h, int fd, int mode)
{
if(fd == -1 || mode != Hread && mode != Hwrite)
return -1;
h->hh = nil;
h->fd = fd;
h->seek = 0;
h->state = mode;
h->start... | __label__POS | 0.812771 |
#include <u.h>
#include <libc.h>
#include <httpd.h>
/*
* print dates in the format
* Wkd, DD Mon YYYY HH:MM:SS GMT
* parse dates of formats
* Wkd, DD Mon YYYY HH:MM:SS GMT
* Weekday, DD-Mon-YY HH:MM:SS GMT
* Wkd Mon ( D|DD) HH:MM:SS YYYY
* plus anything similar
*/
static char *
weekdayname[7] =
{
"Sunday", "M... | __label__POS | 0.843272 |
#include <u.h>
#include <libc.h>
#include <bin.h>
#include <httpd.h>
int
hredirected(HConnect *c, char *how, char *uri)
{
Hio *hout;
char *s, *ss, *scheme, *host;
char sayport[NETPATHLEN];
int n, nb;
scheme = c->scheme? c->scheme: "http";
host = c->head.host;
if(strchr(uri, ':') != nil)
host = "";
else if(u... | __label__POS | 0.76547 |
#include <u.h>
#include <libc.h>
#include <bio.h>
#include <ctype.h>
#define NULL ((void *)0)
#define WORD_LIST "/sys/games/lib/anawords"
#define VOWELS "aeiouy"
#define ALPHAS 26
#define LENLIMIT 64
#define talloc(t) salloc(sizeof (t))
#define MAP(c) ((c) - 'a')
enum
{
in_fd,
out_fd,
err_fd,
};
typedef str... | __label__POS | 0.771524 |
#include "ssh.h"
#include <bio.h>
#include <ndb.h>
char Edecode[] = "error decoding input packet";
char Eencode[] = "out of space encoding output packet (BUG)";
char Ehangup[] = "hungup connection";
char Ememory[] = "out of memory";
int debuglevel;
int doabort;
void
error(char *fmt, ...)
{
va_list arg;
char buf[20... | __label__POS | 0.711371 |
#include "ssh.h"
#include <bio.h>
#include <ctype.h>
static int
parsepubkey(char *s, RSApub *key, char **sp, int base)
{
int n;
char *host, *p, *z;
z = nil;
n = strtoul(s, &p, 10);
host = nil;
if(n < 256 || !isspace(*p)){ /* maybe this is a host name */
host = s;
s = strpbrk(s, " \t");
if(s == nil)
ret... | __label__POS | 0.901071 |
#include <u.h>
#include <libc.h>
#include <draw.h>
static char channames[] = "rgbkamx";
char*
chantostr(char *buf, ulong cc)
{
ulong c, rc;
char *p;
if(chantodepth(cc) == 0)
return nil;
/* reverse the channel descriptor so we can easily generate the string in the right order */
rc = 0;
for(c=cc; c; c>>=8){
... | __label__POS | 0.84426 |
#include <u.h>
#include <libc.h>
#include <draw.h>
#define PINC 32 /* realloc granularity */
typedef struct Plist Plist;
struct Plist
{
Point *p;
int np; /* -1 if malloc/realloc failed */
};
static void
appendpt(Plist *l, Point p)
{
if(l->np == -1)
return;
if(l->np == 0)
l->p = malloc(PINC*sizeof(Point));... | __label__POS | 0.868579 |
#include <u.h>
#include <libc.h>
#include "iotrack.h"
#include "dat.h"
#include "fns.h"
int readonly;
static int
deverror(char *name, Xfs *xf, long addr, long n, long nret)
{
errno = Eio;
if(nret < 0){
chat("%s errstr=\"%r\"...", name);
close(xf->dev);
xf->dev = -1;
return -1;
}
fprint(2, "dev %d sector %... | __label__POS | 0.99982 |
#include <u.h>
#include <libc.h>
#include <draw.h>
int
_stringnwidth(Font *f, char *s, Rune *r, int len)
{
int wid, twid, n, max, l;
char *name;
enum { Max = 64 };
ushort cbuf[Max];
Rune rune, **rptr;
char *subfontname, **sptr;
Font *def;
if(s == nil){
s = "";
sptr = nil;
}else
sptr = &s;
if(r == nil)... | __label__POS | 0.954554 |
#include <u.h>
#include <libc.h>
#include <draw.h>
Subfont*
readsubfonti(Display*d, char *name, int fd, Image *ai, int dolock)
{
char hdr[3*12+4+1];
int n;
uchar *p;
Fontchar *fc;
Subfont *f;
Image *i;
i = ai;
if(i == nil){
i = readimage(d, fd, dolock);
if(i == nil)
return nil;
}
if(read(fd, hdr, 3*1... | __label__POS | 0.726399 |
#include <u.h>
#include <libc.h>
#include "plumb.h"
int
plumbopen(char *name, int omode)
{
int fd, f;
char *s, *plumber;
char buf[128], err[ERRMAX];
if(name[0] == '/')
return open(name, omode);
/* find elusive plumber */
if(access("/mnt/plumb/send", AWRITE) >= 0)
plumber = "/mnt/plumb";
else if(access("... | __label__POS | 0.842358 |
#include <u.h>
#include <libc.h>
#include <draw.h>
#include <html.h>
#include "impl.h"
// Do case-insensitive lookup of key[0:keylen] in t[0:n] (key part),
// returning 1 if found, 0 if not.
// Array t must be sorted in increasing lexicographic order of key.
// If found, return corresponding val in *pans.
int
_lookup(... | __label__POS | 0.995426 |
#include <u.h>
#include <libc.h>
#include <draw.h>
#include <html.h>
#include "impl.h"
Rune* whitespace = L" \t\n\r";
Rune* notwhitespace = L"^ \t\n\r";
// All lists start out like List structure.
// List itself can be used as list of int.
int
_listlen(List* l)
{
int n = 0;
while(l != nil) {
l = l->next;
n++;
... | __label__POS | 0.986248 |
#include <u.h>
#include <libc.h>
#include <draw.h>
#include <memdraw.h>
#include <memlayer.h>
int
memload(Memimage *dst, Rectangle r, uchar *data, int n, int iscompressed)
{
int (*loadfn)(Memimage*, Rectangle, uchar*, int);
Memimage *tmp;
Memlayer *dl;
Rectangle lr;
int dx;
loadfn = loadmemimage;
if(iscompress... | __label__POS | 0.724744 |
#include <u.h>
#include <libc.h>
#include <oventi.h>
#include "session.h"
struct {
int version;
char *s;
} vtVersions[] = {
VtVersion02, "02",
0, 0,
};
static char EBigString[] = "string too long";
static char EBigPacket[] = "packet too long";
static char ENullString[] = "missing string";
static char EBadVersion[... | __label__POS | 0.834974 |
#include <u.h>
#include <libc.h>
#include <oventi.h>
/*
* integer conversion routines
*/
#define U8GET(p) ((p)[0])
#define U16GET(p) (((p)[0]<<8)|(p)[1])
#define U32GET(p) ((u32int)(((p)[0]<<24)|((p)[1]<<16)|((p)[2]<<8)|(p)[3]))
#define U48GET(p) (((vlong)U16GET(p)<<32)|(vlong)U32GET((p)+2))
#define U64GET(p) (((vlo... | __label__POS | 0.907871 |
#include <u.h>
#include <libc.h>
#include <oventi.h>
enum {
IdealAlignment = 32,
ChunkSize = 128*1024,
};
void
vtMemFree(void *p)
{
if(p == 0)
return;
free(p);
}
void *
vtMemAlloc(int size)
{
void *p;
p = malloc(size);
if(p == 0)
vtFatal("vtMemAlloc: out of memory");
setmalloctag(p, getcallerpc(&size... | __label__POS | 0.649708 |
#include <u.h>
#include <libc.h>
#include <draw.h>
#include <thread.h>
#include <cursor.h>
#include <mouse.h>
#include <keyboard.h>
#include <frame.h>
#include <fcall.h>
#include <plumb.h>
#include "dat.h"
#include "fns.h"
#include <ctype.h>
char Ebadwr[] = "bad rectangle in wctl request";
char Ewalloc[] = "window a... | __label__POS | 0.741086 |
/*
* Stub.
*/
#include "u.h"
#include "../port/lib.h"
#include "mem.h"
#include "dat.h"
#include "fns.h"
#include "../port/error.h"
extern Dev* devtab[];
void
devtabreset(void)
{
int i;
for(i = 0; devtab[i] != nil; i++)
devtab[i]->reset();
}
void
devtabinit(void)
{
int i;
for(i = 0; devtab[i] != nil; i++)
... | __label__POS | 0.948236 |
#include <u.h>
#include <libc.h>
#include <mp.h>
#include <ctype.h>
#include <libsec.h>
#include <fcall.h>
#include <thread.h>
#include <9p.h>
#include "netssh.h"
enum {
Arbsz = 256,
};
static int
parsepubkey(char *s, RSApub *key, char **sp, int base)
{
int n;
char *host, *p, *z;
z = nil;
n = strtoul(s, &p, 10)... | __label__POS | 0.661997 |
#include "u.h"
#include "../port/lib.h"
/*
* The code makes two assumptions: strlen(ld) is 1 or 2; latintab[i].ld can be a
* prefix of latintab[j].ld only when j<i.
*/
struct cvlist
{
char *ld; /* must be seen before using this conversion */
char *si; /* options for last input characters */
Rune *so; /* the c... | __label__POS | 0.98802 |
#include "u.h"
#include "../port/lib.h"
#include "mem.h"
#include "dat.h"
#include "fns.h"
void
pshash(Proc *p)
{
int h;
h = p->pid % nelem(procalloc.ht);
lock(&procalloc);
p->pidhash = procalloc.ht[h];
procalloc.ht[h] = p;
unlock(&procalloc);
}
void
psunhash(Proc *p)
{
int h;
Proc **l;
h = p->pid % nelem(... | __label__POS | 0.615555 |
AAA pc,nopref
AAAS pc,nopref
aardvark n
Aaron n
AARP pc,nopref
AAU pc,nopref
AAUP pc,nopref
AAUW pc,nopref
ABA pc,nopref
Ababa pc
aback d
abacus n
abaft d
abalone n
abandon v,er,va
abase v,er,va
abash v,er,va
abate v,er,va
abattoir n
abbe n
abbess n
abbey n
abbot n
Abbott n
abbreviate v,ion
abc n
abcdefghijklmnopqrstuv... | __label__POS | 0.999539 |
accessorize v,ion,va
accouter v,va
acknowledgment n
aggrandize v,er,va
airplane n
allegorize v,er
aluminize v,ion
aluminum n
americanize v,ion,va
amphitheater n
analog n,na
analyze v,er,va
anapest n
anathematize v,ion
anatomize v,ion
anemia n
anemic a
anesthesia n
anesthesiology n,na
anesthetic n,na
anesthetist n
anest... | __label__POS | 0.92625 |
acclimatise v,er,ion
accoutre v,va
aeon n
aerodrome n
aeroplane n
aether n,na
aetiology n
aggrandise v,va
alarum n,v
allegorise v,er
aluminise v,ion
aluminium n
americanise v,ion,va
amphitheatre n
anaemia n
anaemic a
anaesthesia n
anaesthesiology n,na
anaesthetic n,na
anaesthetise v,ion
anaesthetist n
analyse v,er,va
a... | __label__POS | 0.964726 |
3B d
3B2 d
3B20 d
5ESS n,nopref
AAAI pc,nopref
abend n
Abhaya pc,nopref
Abramowitz n,nopref
abs d
Ackermann pc
ACR pc,nopref
Acta pc,nopref
ACU n,nopref
ADAPSO pc,nopref
ADP pc,nopref
ADPCM pc,nopref
Afek n,nopref
AFIPS pc,nopref
Agrawal n,nopref
Aho n,nopref
AI pc,nopref
AIP pc,nopref
Airey n,nopref
Alcatel pc,nopref
... | __label__POS | 0.894236 |
accessive s
accidently s
acreless s
actional s
actioning s
actless s
actorize s
adaptative s
ailless s
airyism s
alienment s
alteringly s
amenment s
analist s
anality s
analize s
andless s
anglingly s
anticede s
antichamber s
anticlimatic s
anticore s
antidate s
antidoe s
antidot s
antigent s
antigone s
antiline s
anti... | __label__POS | 0.999428 |
#include "gc.h"
/*
* Based on: Granlund, T.; Montgomery, P.L.
* "Division by Invariant Integers using Multiplication".
* SIGPLAN Notices, Vol. 29, June 1994, page 61.
*/
#define TN(n) ((uvlong)1 << (n))
#define T31 TN(31)
#define T32 TN(32)
int
multiplier(ulong d, int p, uvlong *mp)
{
int l;
uvlong mlo, mhi, t... | __label__POS | 0.950891 |
#include "mk.h"
static char *vexpand(char*, Envy*, Bufblock*);
static char *shquote(char*, Rune, Bufblock*);
static char *shbquote(char*, Bufblock*);
void
shprint(char *s, Envy *env, Bufblock *buf)
{
int n;
Rune r;
while(*s) {
n = chartorune(&r, s);
if (r == '$')
s = vexpand(s, env, buf);
else {
rinse... | __label__POS | 0.674456 |
#include "mk.h"
char *shell = "/bin/rc";
char *shellname = "rc";
static Word *encodenulls(char*, int);
void
readenv(void)
{
char *p;
int envf, f;
Dir *e;
char nam[1024];
int i, n, len;
Word *w;
rfork(RFENVG); /* use copy of the current environment variables */
envf = open("/env", OREAD);
if(envf < 0)
... | __label__POS | 0.628196 |
BEGIN{
oargc = 0;
for(argc = 1; argc < ARGC; argc++){
if(ARGV[argc] !~ /^-.+/ || ARGV[argc] ~ /--/)
break;
if(ARGV[argc] != "-D")
oargv[ARGV[argc]] = oargc++;
else
DEBUG = 1;
ARGV[argc] = "";
}
objtype = ENVIRON["objtype"];
while(getline > 0){
if(/^[ \t]*$/ || /^#/)
continue;
if(/^[^ \t]... | __label__POS | 0.623779 |
#include <u.h>
#include <libc.h>
#include <../boot/boot.h>
/*
int
plumb(char *dir, char *dest, int *efd, char *here)
{
char buf[128];
char name[128];
int n;
snprint(name, sizeof name, "%s/clone", dir);
efd[0] = open(name, ORDWR);
if(efd[0] < 0)
return -1;
n = read(efd[0], buf, sizeof(buf)-1);
if(n < 0){
c... | __label__POS | 0.995286 |
#include <u.h>
#include <libc.h>
#include <../boot/boot.h>
uchar statbuf[Statsz];
int
cache(int fd)
{
int argc, i, p[2];
char *argv[5], bd[32], buf[256], partition[64], *pp;
if(stat("/boot/cfs", statbuf, sizeof statbuf) < 0)
return fd;
*partition = 0;
bind("#S", "/dev", MAFTER);
readfile("#e/cfs", buf, siz... | __label__POS | 0.937671 |
#include <u.h>
#include <libc.h>
#include <auth.h>
#include <fcall.h>
#include "../boot/boot.h"
static long lusertime(char*);
char *timeserver = "#s/boot";
void
settime(int islocal, int afd, char *rp)
{
int n, f;
Dir dir[2];
char timebuf[64];
static int timeset;
if(timeset)
return;
print("time...");
if(isl... | __label__POS | 0.665019 |
#include "a.h"
/*
* 16. Conditional acceptance of input.
*
* conditions are
* c - condition letter (o, e, t, n)
* !c - not c
* N - N>0
* !N - N <= 0
* 'a'b' - if a==b
* !'a'b' - if a!=b
*
* \{xxx\} can be used for newline in bodies
*
* .if .ie .el
*
*/
int iftrue[20];
int niftrue;
void
startbody... | __label__POS | 0.621958 |
#include "a.h"
/*
* 11. Local Horizontal and Vertical Motions, and the Width Function.
*/
int
e_0(void)
{
/* digit-width space */
return ' ';
}
int
dv(int d)
{
Rune sub[6];
d += getnr(L(".dv"));
nr(L(".dv"), d);
runestrcpy(sub, L("<sub>"));
sub[0] = Ult;
sub[4] = Ugt;
if(d < 0){
sub[3] = 'p';
ihtml(... | __label__POS | 0.872089 |
/*
* Convert troff -ms input to HTML.
*/
#include "a.h"
Biobuf bout;
char* tmacdir;
int verbose;
int utf8 = 0;
void
usage(void)
{
fprint(2, "usage: htmlroff [-iuv] [-m mac] [-r an] [file...]\n");
exits("usage");
}
void
main(int argc, char **argv)
{
int i, dostdin;
char *p;
Rune *r;
Rune buf[2];
Binit(&... | __label__POS | 0.660342 |
#include <u.h>
#include <libc.h>
#include <bio.h>
#include "dict.h"
void
thesprintentry(Entry e, int cmd)
{
char *p, *pe;
int c, i;
p = e.start;
pe = e.end;
while(p < pe) {
c = *p++;
if(cmd == 'r') {
outchar(c);
continue;
}
switch(c) {
case '*':
c = *p++;
if(cmd == 'h' && c != 'L') {
ou... | __label__POS | 0.760432 |
#include <u.h>
#include <libc.h>
#include <bio.h>
#include "dict.h"
/*
* American Heritage Dictionary (encrypted)
*/
static Rune intab[256] = {
[0x82] L'é',
[0x85] L'à',
[0x89] L'ë',
[0x8a] L'è',
[0xa4] L'ñ',
[0xf8] L'°',
[0xf9] L'·',
};
static char tag[64];
enum{
Run, Openper, Openat, Closeat
};
void
ah... | __label__POS | 0.713829 |
/*
* push changes from client to server.
*/
#include "all.h"
int douid;
Db *db;
char **x;
int nx;
int justshow;
int verbose;
int conflicts;
char newpath[10000];
char oldpath[10000];
char *clientroot;
char *serverroot;
int copyfile(char*, char*, Dir*, int);
int metafile(char*, Dir*);
char **match;
int nmatch;
int
is... | __label__POS | 0.898412 |
#include "sam.h"
void
moveto(File *f, Range r)
{
Posn p1 = r.p1, p2 = r.p2;
f->dot.r.p1 = p1;
f->dot.r.p2 = p2;
if(f->rasp){
telldot(f);
outTsl(Hmoveto, f->tag, f->dot.r.p1);
}
}
void
telldot(File *f)
{
if(f->rasp == 0)
panic("telldot");
if(f->dot.r.p1==f->tdot.p1 && f->dot.r.p2==f->tdot.p2)
return;
... | __label__POS | 0.720273 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.