Modify os in README

This commit is contained in:
Heng Guo 2023-09-06 15:59:53 +08:00
parent 37411450ba
commit 18863a065b
2 changed files with 21 additions and 21 deletions

View File

@ -63,22 +63,22 @@ chsrc set ubuntu
chsrc set debian
chsrc set fedora
chsrc set kali
chsrc set arch
chsrc set gentoo
chsrc set openbsd
chsrc set netbsd
chsrc set msys2 或 chsrc set msys
```
TODO:
- [ ] `chsrc set arch`
- [ ] `chsrc set gentoo`
- [ ] `chsrc set manjaro`
- [ ] `chsrc set deepin`
- [ ] `chsrc set openkylin`
- [ ] `chsrc set openeuler`
- [ ] `chsrc set netbsd`
## 软件

36
xy.h
View File

@ -459,29 +459,29 @@ xy_getcmd(const char * cmd, bool (*func)(const char*))
// 执行命令,并将输出保存到 stream 指针指向的文件中。
stream = popen(cmd, "r");
if (stream == NULL) {
printf("命令执行失败。\n");
return NULL;
printf("命令执行失败。\n");
return NULL;
}
// 从 stream 指针指向的文件中读取数据。
char *ret;
do {
if(fgets(buf, sizeof(buf), stream)==NULL)
{
break;
}
if(func==NULL)
{
ret = buf;
}
else
{
if(func(buf))
{
ret = buf;
break;
}
}
if(fgets(buf, sizeof(buf), stream)==NULL)
{
break;
}
if(func==NULL)
{
ret = buf;
}
else
{
if(func(buf))
{
ret = buf;
break;
}
}
}while(1);
// 关闭 stream 指针。