Welcome, Guest. Please login or register.

Author Topic: Coding: CLI args parsing and resident purity  (Read 1977 times)

Description:

0 Members and 1 Guest are viewing this topic.

Offline nyteschaydeTopic starter

  • VIP / Donor - Lifetime Member
  • Hero Member
  • *****
  • Join Date: Mar 2002
  • Posts: 644
    • Show all replies
    • http://www.nyteshade.com
Coding: CLI args parsing and resident purity
« on: January 11, 2012, 12:46:54 AM »
Almost all CLI commands in AmigaOS use syntax where you can pass ? and you get prompted with a list of parameters and they're relative required'ness based on an obscure /M /A /K /S type of reference.

I believe they stand for

/A Required argument
/F Final argument in list
/K Keyword must be entered with argument
/M Multiple arguments
/N Number
/S Switch (optional)

Anyhow, I doubt people manually parse these each time. Is there a known API for handling this type of input in Amiga C?

Also, where can I find information on how to make the command resident safe?


Any help would be appreciated.
Senior MTS Software Engineer with PayPal
Amigas: A1200T 060/603e PPC • A1200T 060 • A4000D 040 • A3000 (x2) • A2000 Vamp/V2 • A1200 (x4) • A1000 (x3) • A600 Vamp/V1 • A500
 

Offline nyteschaydeTopic starter

  • VIP / Donor - Lifetime Member
  • Hero Member
  • *****
  • Join Date: Mar 2002
  • Posts: 644
    • Show all replies
    • http://www.nyteshade.com
Re: Coding: CLI args parsing and resident purity
« Reply #1 on: January 11, 2012, 12:56:21 AM »
Thanks, you're both awesome!
Senior MTS Software Engineer with PayPal
Amigas: A1200T 060/603e PPC • A1200T 060 • A4000D 040 • A3000 (x2) • A2000 Vamp/V2 • A1200 (x4) • A1000 (x3) • A600 Vamp/V1 • A500
 

Offline nyteschaydeTopic starter

  • VIP / Donor - Lifetime Member
  • Hero Member
  • *****
  • Join Date: Mar 2002
  • Posts: 644
    • Show all replies
    • http://www.nyteshade.com
Re: Coding: CLI args parsing and resident purity
« Reply #2 on: January 11, 2012, 08:38:55 PM »
So I tried to compile something that uses ReadArgs. I can successfully get it to prompt me using the template string I pass in but I don't fully understand the second parameter (the LONG* array). I am also not 100% clear on how to check the parsed args afterwards.

Do you guys have any example usages anywhere. Google failed me on this account.
Senior MTS Software Engineer with PayPal
Amigas: A1200T 060/603e PPC • A1200T 060 • A4000D 040 • A3000 (x2) • A2000 Vamp/V2 • A1200 (x4) • A1000 (x3) • A600 Vamp/V1 • A500
 

Offline nyteschaydeTopic starter

  • VIP / Donor - Lifetime Member
  • Hero Member
  • *****
  • Join Date: Mar 2002
  • Posts: 644
    • Show all replies
    • http://www.nyteshade.com
Re: Coding: CLI args parsing and resident purity
« Reply #3 on: January 11, 2012, 09:12:27 PM »
Wow, ask and you shall receive. You guys rock. I wish I could just pull example source out of my back pocket like that. I really appreciate it.
Senior MTS Software Engineer with PayPal
Amigas: A1200T 060/603e PPC • A1200T 060 • A4000D 040 • A3000 (x2) • A2000 Vamp/V2 • A1200 (x4) • A1000 (x3) • A600 Vamp/V1 • A500