cofyc/argparse

Why the memmove at the end of argparse ?

UffeJakobsen opened this issue · 3 comments

Hi,

Why the memmove at the end of argparse ?
It destroys the original argv array

To remove parsed command-line arguments. For example, <command> [-<s>|--switch]... files, remaining arguments are files only, it's convenient to separate switches and files arguments.

You do realize that you by that approach destroy the original look of that process in process listings such at "ps -ef", "top" ?

That is not very "compatible" - there are other more non-intrusive approaches:

The getopt() approach return an index indicating how far into the argv[] you have processed

There will be warning when compile with vs2017 express:
argparse.c(281): warning C4090: 'function': different 'const' qualifiers

in struct out is announced as "const char **out", there is a "const" declaration, but you change the content at memmove() operation?