optind가 뭔가요??

envy100의 이미지

extern int optind;
하고

argc -= optind;
argv += optind;

이런 문장이 있던데요
이게 뭐하는 코드인지 모르겠네요

날씨도 더운데 짜증 내지 않는 하루 보내세요 :lol:

ageldama의 이미지

getopt()와 연관된 전역변수입니다.

man 3 getopt(맞나?;;;)

현재 몇번째 인자를 처리할 것인지 표시합니다. (option index?)

----
The future is here. It's just not widely distributed yet.
- William Gibson