Lines Matching refs:buf

188 execrate(const char* path, char* buf, int size, int physical)
197 if (physical || strlen(path) >= size || !(s = pathcanon(strcpy(buf, path), size, PATH_PHYSICAL|PATH_DOTDOT|PATH_EXISTS)))
198 snprintf(buf, size, "%s.exe", path);
199 else if (!suffix(buf) && ((buf + size) - s) >= 4)
220 unsigned char buf[512];
222 unsigned char buf[2];
230 n = sizeof(buf);
234 r = (m = sysread(fd, buf, n)) >= 2 && (buf[1] == 0x5a && (buf[0] == 0x4c || buf[0] == 0x4d) || ux && buf[0] == '#' && buf[1] == '!' && (*ux = 1) && !(ux = 0)) ? 0 : -1;
240 else if (m > 61 && (n = buf[60] | (buf[61]<<8) + 92) < (m - 1))
241 *ux = (buf[n] | (buf[n+1]<<8)) == 3;
269 char buf[PATH_MAX];
272 if ((r = sysaccess(path, op)) && errno == ENOENT && execrate(path, buf, sizeof(buf), 0))
275 r = sysaccess(buf, op);
311 char buf[PATH_MAX];
313 if ((r = syschmod(path, mode)) && errno == ENOENT && execrate(path, buf, sizeof(buf), 0))
316 return syschmod(buf, mode);
321 (strlen(path) + 4) < sizeof(buf))
326 snprintf(buf, sizeof(buf), "%s.exe", path);
327 sysrename(path, buf);
455 char buf[PATH_MAX];
485 if (execrate(path, buf, sizeof(buf), 0))
487 if (!sysstat(buf, &st))
488 path = (const char*)buf;
492 if (path != (const char*)buf && sysstat(path, &st))
710 char buf[PATH_MAX];
723 snprintf(buf, sizeof(buf), "%s.exe", exe[fd]->path);
724 sysrename(exe[fd]->path, buf);
734 write(int fd, const void* buf, size_t n)
737 exe[fd]->test = n >= 2 && ((unsigned char*)buf)[1] == 0x5a && (((unsigned char*)buf)[0] == 0x4c || ((unsigned char*)buf)[0] == 0x4d) && !lseek(fd, (off_t)0, SEEK_CUR);
738 return syswrite(fd, buf, n);
749 char buf[PATH_MAX];
760 if (fd < 0 && errno == ENOENT && execrate(path, buf, sizeof(buf), 0))
763 fd = sysopen(buf, flags, mode);
827 char buf[PATH_MAX];
830 if ((r = sysstat(path, st)) && errno == ENOENT && execrate(path, buf, sizeof(buf), 0))
833 r = sysstat(buf, st);
847 char buf[PATH_MAX];
850 if ((r = systruncate(path, offset)) && errno == ENOENT && execrate(path, buf, sizeof(buf), 0))
853 r = systruncate(buf, offset);
872 char buf[PATH_MAX];
909 if (path == (const char*)buf || !execrate(path, buf, sizeof(buf), 1))
914 path = (const char*)buf;
920 if (errno != ENOENT || !execrate(path, buf, sizeof(buf), 1) || sysaccess(buf, 0))
922 path = (const char*)buf;
972 if (execrate(path, buf, sizeof(buf), 1) && !sysrename(buf, tmp))
1054 char buf[PATH_MAX];
1057 if ((r = sysutimes(path, ut)) && errno == ENOENT && execrate(path, buf, sizeof(buf), 0))
1060 r = sysutimes(path = buf, ut);
1072 char buf[PATH_MAX];
1075 if ((r = sysutime(path, ut)) && errno == ENOENT && execrate(path, buf, sizeof(buf), 0))
1078 r = sysutime(path = buf, ut);