🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.pascal.borland
Article #155

Need very good Argument switch program

#155
From: Mr. Veli Suorsa
Date: Wed, 27 Jun 2001 19:35
132 lines
3992 bytes
Hi!

How can I write this C- program on TPascal 5.5/7.0 programming language?

It should works when you write from command line.
>argun -N -R -W -S -C -V -O

---
#include <stdio.h>
#include <string.h>

/* functions */
void doLongDistanceMobileCall();
void doNuclearPower();
void doOil();
void doRenewables();
void doSaving();
void doVote();
void doWindPower();
void doSyntax();

int main(int argc, char *argv[])
{
   int x;

   /* if no argument, show syntax help */
   if( argc == 1 )
      doSyntax();

   for (x =1; x < argc; x++)
   {
      /* Note exact string compare (strcmp()), must be -N, not -n */
      /* using case- command should be better to read? */

      if( strcmp("-C", argv[x]) == 0 )
         doLongDistanceMobileCall();
      if( strcmp("-N", argv[x]) == 0 )
         doNuclearPower();
      if( strcmp("-O", argv[x]) == 0 )
         doOil();
      if( strcmp("-R", argv[x]) == 0 )
         doRenewables();
      if( strcmp("-S", argv[x]) == 0 )
         doSaving();
      if( strcmp("-V", argv[x]) == 0 )
         doVote();
      if( strcmp("-W", argv[x]) == 0 )
         doWindPower();

      // etc
   }

   return EXIT_SUCCESS;
} // end of main()

/* all functions can run together (or separately) in one command line */

void doLongDistanceMobileCall()
{
   printf("Run doLongDistanceMobileCall() !\n");
   printf("Please, call your partner to buy to you 3G mobile phone!\n");

   // etc
}

void doNuclearPower()
{
   printf("Run doNuclearPower() !\n");
   printf("Clean, economical 35 p share in EU by 2010 (better
KIO2)!\n");
   // etc
}

void doOil()
{
   printf("Run doOil() !\n");
   printf("At public request, still driving gasoline car!\n");
   // etc
}

void doRenewables()
{
   printf("Run doRenewables() !\n");
   printf("Clean, 14 p share in EU by 2010!\n");
   // etc
}

void doSaving()
{
   printf("Run doSaving() !\n");
   printf("Clean, 15 p saving in electric power and heating in EU by
2010!\n");
   // etc
}

void doVote()
{
   printf("Run doVote() !\n");
   printf("Use your big vote! Nothing to do in the parliament, if you
have under 5 p share!\n");
   // etc
}

void doWindPower()
{
   printf("Run doWindPower() !\n");
   printf("Clean, 40 p growth/ year in EU by 2010!\n");
   // etc
}

void doSyntax()
{
   printf("Copyright (C), 1990 by VS Energy Company ;-)\n");
   printf("Syntax : argun [options]\n");
   printf("options: -R -N -C -W -V -S -O\n");

   return EXIT_FAILURE;
}
---

Have you any better ideas?

Thanks in advance!

Veli Suorsa
---
"People must believe to the future to be able to live!"
---------------------------------- J.V.Snellman, 1890.

Oulu, FINLAND
Mailto:VJSuorsa@Surfeu.Fi
http://members.surfeu.fi/veli.suorsa/
Technical Details
Message-ID: <3B3A3561.13B23C0F@surfeu.fi>
Path: arc1-ca.pugleaf.net!archiver1.google.com!newsfeed.google.com!newsfeed.stanford.edu!news.tele.dk!195.54.122.107!newsfeed1.bredband.com!bredband!newsfeed1.telenordia.se!algonet!newsfeed1.funet.fi!newsfeeds.funet.fi!193.167.100.82.MISMATCH!news.oamk.fi !not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 111659,325c6695c14dd242,start
X-Google-Attributes: gid111659,public
X-Google-Thread: 108ebd,325c6695c14dd242,start
X-Google-Attributes: gid108ebd,public
X-Google-ArrivalTime: 2001-06-27 02:39:16 PST
Path: arc1-ca.pugleaf.net!archiver1.google.com!newsfeed.google.com!newsfeed.stanford.edu!news.tele.dk!195.54.122.107!newsfeed1.bredband.com!bredband!newsfeed1.telenordia.se!algonet!newsfeed1.funet.fi!newsfeeds.funet.fi!193.167.100.82.MISMATCH!news.oamk.fi !not-for-mail
From: "Mr. Veli Suorsa" <veli.suorsa@surfeu.fi>
Newsgroups: comp.lang.pascal.borland,borland.public.turbopascal
Subject: Need very good Argument switch program
Date: Wed, 27 Jun 2001 12:35:04 -0700
Organization: Oulu
Lines: 134
Message-ID: <3B3A3561.13B23C0F@surfeu.fi>
Reply-To: veli.suorsa@surfeu.fi
NNTP-Posting-Host: otogate.otol.fi
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
X-Trace: pan.oamk.fi 993634567 7304 193.167.100.74 (27 Jun 2001 09:36:07 GMT)
X-Complaints-To: usenet@pan.oamk.fi
NNTP-Posting-Date: Wed, 27 Jun 2001 09:36:07 +0000 (UTC)
X-Mailer: Mozilla 4.08 [en] (Win16; I)