Files
NapCatQQ/.pnpm-store/v3/files/29/3d7ef1ee5e666280a659460bb63e5b08f83cfbbad3acb422ec09b8472b1fd788ca7f0d5153e35caf97d7caf71850dc295cd3672e143b2227d28c956f5d2f65
T
TanTan e311ca3275
Build NapCat Artifacts / Type Check & Test (push) Waiting to run
docs: 仓库链接指向本镜像仓库
2026-11-13 09:25:58 +08:00

24 lines
494 B
Plaintext

#include <errno.h>
#include <fcntl.h>
#include <string.h>
#include <unistd.h>
int main (int argc, char** argv) {
char *slave_path = ttyname(STDIN_FILENO);
// open implicit attaches a process to a terminal device if:
// - process has no controlling terminal yet
// - O_NOCTTY is not set
close(open(slave_path, O_RDWR));
char *cwd = argv[1];
char *file = argv[2];
argv = &argv[2];
if (strlen(cwd) && chdir(cwd) == -1) {
_exit(1);
}
execvp(file, argv);
return 1;
}