3 Star 22 Fork 10

matrixy/jtt1078-video-publisher

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
opts.c 852 Bytes
一键复制 编辑 原始数据 按行查看 历史
matrixy 提交于 2019-12-04 23:56 . optional parameter testing
#include <stdio.h>
int get_opt(int argc, char **args, char *prefix, char *dest, int max_len)
{
int i, k, len, pLen;
char chr;
char *text;
for (i = 0; i < argc; i++)
{
text = *args++;
if (str_starts_with(text, prefix))
{
pLen = strlen(prefix);
printf("found: ");
for (k = 0, len = strlen(text); chr = text[k + pLen]; k++)
{
fputc(chr, stdout);
}
printf("\n");
fflush(stdout);
}
}
}
int str_starts_with(char *a, char *b)
{
printf("is %s starts with %s\n", a, b);
int i, k, j;
char cha, chb;
for (i = 0; ; i++)
{
cha = a[i];
chb = b[i];
if (cha == 0 || chb == 0) return 1;
if (cha != chb) return 0;
}
return 1;
}
int main(int argc, char **argv)
{
get_opt(argc, argv, "--video-encoding=", NULL, NULL);
return 0;
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/matrixy/jtt1078-video-publisher.git
git@gitee.com:matrixy/jtt1078-video-publisher.git
matrixy
jtt1078-video-publisher
jtt1078-video-publisher
master

搜索帮助

A270a887 8829481 3d7a4017 8829481