X-Git-Url: http://mj.ucw.cz/gitweb/?a=blobdiff_plain;f=judge%2Fio.c;h=39e220f17f00ba53474d05e57f558ca1d5884d41;hb=0964fde49f014747a8252c6e02a1373d3763b44a;hp=bfc828ac4242c67952b62a2fdb8cd7e4e6e806d4;hpb=f678481e6b7a13bde86300040a9373934e49d6f0;p=eval.git diff --git a/judge/io.c b/judge/io.c index bfc828a..39e220f 100644 --- a/judge/io.c +++ b/judge/io.c @@ -15,12 +15,14 @@ struct stream *sopen_fd(char *name, int fd) { - struct stream *s = xmalloc(sizeof(*s) + BUFSIZE + strlen(name) + 1); + char *slash = strrchr(name, '/'); + char *basename = (slash ? slash+1 : name); + struct stream *s = xmalloc(sizeof(*s) + BUFSIZE + strlen(basename) + 1); s->fd = fd; s->pos = s->stop = s->buf; s->end = s->buf + BUFSIZE; s->name = s->end; - strcpy(s->name, name); + strcpy(s->name, basename); return s; }