fork(1) download
  1. #include <string.h>
  2. #include <stdio.h>
  3. #define TOKS 7
  4. int main(int argc,char *pArgv[])
  5. {
  6. const char *ptoken[TOKS] = {"-rp","-ip","-dw","-tp","-lp","-f","-b"},*pPar[TOKS]={0};
  7. for(int i(1); i < argc-1; i++)
  8. for(int n(0); n < TOKS; n++)
  9. if(!pPar[n]) pPar[n] = !strcmp(ptoken[n],pArgv[i])?pArgv[(i+=1)]:0;
  10.  
  11. for(int n(0); n < TOKS; n++)
  12. printf("%s=%s\r\n",ptoken[n],pPar[n]);
  13.  
  14. return 0;
  15. }
Success #stdin #stdout 0s 15240KB
stdin
Standard input is empty
stdout
-rp=(null)
-ip=(null)
-dw=(null)
-tp=(null)
-lp=(null)
-f=(null)
-b=(null)