https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=204207

            Bug ID: 204207
           Summary: getsubopt invalid parsing
           Product: Base System
           Version: 9.3-RELEASE
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Some People
          Priority: ---
         Component: bin
          Assignee: freebsd-bugs@FreeBSD.org
          Reporter: temporary.en...@gmail.com

Following code will have invalid output.

#include <stdio.h>
#include <stdlib.h>

int main()
{
    char text[] = "text=1 2";
    char* subopts = text;
    char* line_subopts[] = {"text", 0};
    char* subopt_value;
    int opt = ::getsubopt(&subopts, line_subopts, &subopt_value);
    printf("%d, %s\n", opt, subopt_value);
    return 0;
}

$ clang++ bug.cpp
$ ./a.out
0, 1

Same thing happens with g++. I've tried on other platforms and it correctly
outputs "0, 1 2"

-- 
You are receiving this mail because:
You are the assignee for the bug.
_______________________________________________
freebsd-bugs@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-bugs
To unsubscribe, send any mail to "freebsd-bugs-unsubscr...@freebsd.org"

Reply via email to