Here is my problem, I wrote a program a.exe, it can take several options, like "r:e:m:".
r: and m: can’t appear together, which means they run totally different tasks inside a.exe. And e: is an optional option, if it shows up, then it should be with r:.
How should I implement this logic with getopt?
You have to manually check for incompatible options. For example, when you see the
-roption you set a flag saying “-ris found”, if you then see the-moption you check to see if the “-ris found” flag is set, and print an error message telling the user about it.