Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add argc to struct optparse #7

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

ComerLater
Copy link

struct optparse结构体原始定义里面没有argc,optparse()函数根据option==0来判断argv[]是否解析结束了,这样是判断会存在隐患

int optparse(struct optparse *options, const char *optstring)
{
    int type;
    char *next;
    char *option = options->argv[options->optind];
    options->errmsg[0] = '\0';
    options->optopt = 0;
    options->optarg = 0;
    if (option == 0)

本次提交在struct optparse中增加了argc,并修改optparse_init()和optparse(),增加了根据argc来判断是否解析结束。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant