home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   comp.os.vms      DEC's VAX* line of computers & VMS.      264,096 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 262,395 of 264,096   
   jayjwa to Lawrence D'Oliveiro   
   Re: Local Versus Global Command Options   
   17 Feb 25 18:46:49   
   
   From: jayjwa@atr2.ath.cx.invalid   
      
   Lawrence D'Oliveiro  writes:   
      
   > Can you show us a simple C program that just prints out its command   
   > arguments, and how it responds to some sample command lines?   
   VMS seems to be alone in converting case.   
      
   ✔≻ cat cmdlin.c   
   /* A program to demo printing of command line args under various OSs. */   
   #include    
      
      
   int main( int argc, char *argv[] ) {   
           printf( "Did I hear you say %s?\n", argv[1] );   
           return 0;   
   }   
   ✔≻ gcc -o cmdlin cmdlin.c   
   ✔≻ ./cmdlin Hello World   
   Did I hear you say Hello?   
   ✔≻ ./cmdlin "Hello World"   
   Did I hear you say Hello World?   
      
   @compile cmdlin.c   
   KCC:    CMDLIN   
    "CMDLIN.C", line 9: [Note] Parameter "argc" not used   
          (main+4, p.1 l.8):  "Did I hear you say %s?\n", argv[1] );  return 0; }   
      
   CMDLIN.PRE.1   
   CMDLIN.FAI.1   
   FAIL:  CMDLIN   
   @load cmdlin   
   LINK:   Loading   
   @save cmdlin   
    CMDLIN.EXE.2 Saved   
   @cmdlin Hello World   
   Did I hear you say Hello?   
   @cmdlin "Hello World"   
   Did I hear you say Hello World?   
      
   c:\bcc32 -5 -ecmdlin.exe cmdlin.c   
   c:\cmdlin Hello World   
   Did I hear you say Hello?   
   c:\cmdlin "Hello World"   
   Did I hear you say Hello World?   
      
   $ cc /version   
   Compaq C V6.4-005 on OpenVMS VAX V7.3   
   $ cc cmdlin.c   
   $ link cmdlin   
   $ mcr DUA1:[JAYJWA.PROGRAMMING.C]cmdlin Hello World   
   Did I hear you say hello?   
   $ mcr DUA1:[JAYJWA.PROGRAMMING.C]cmdlin "Hello World"   
   Did I hear you say Hello World?   
      
   This matters with tools like curl (-O vs -o) and zip (-V and -v).   
      
   --   
   PGP Key ID: 781C A3E2 C6ED 70A6 B356  7AF5 B510 542E D460 5CAE   
          "The Internet should always be the Wild West!"   
      
   --- SoupGate-DOS v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca