<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: language and scripting in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/language-and-scripting/m-p/4659100#M677340</link>
    <description>Hi:&lt;BR /&gt;&lt;BR /&gt;&amp;gt; but if we want to give the input like&lt;BR /&gt;./a.out -f Mandoc.doc Relese.doc .....&lt;BR /&gt;&lt;BR /&gt;As Bill said, quote the argument and 'getopt()' will see it as one.  I suspect that you come from Windows environments where spaces are common in filenames.  Spaces (whitespace) in Unix separates arguments when the shell parses a command line/&lt;BR /&gt;&lt;BR /&gt;Hence:&lt;BR /&gt;&lt;BR /&gt;# ./a.out -f "Mandoc.doc Relese.doc"&lt;BR /&gt;&lt;BR /&gt;...will leave you with *one* argument to the '-f' option.&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
    <pubDate>Fri, 09 Jul 2010 12:02:32 GMT</pubDate>
    <dc:creator>James R. Ferguson</dc:creator>
    <dc:date>2010-07-09T12:02:32Z</dc:date>
    <item>
      <title>language and scripting</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/language-and-scripting/m-p/4659082#M677322</link>
      <description>I am new in Unix&lt;BR /&gt; please forgive me if my question looks&lt;BR /&gt; very simple to you.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt; I am writing this &lt;BR /&gt;&lt;BR /&gt; program in c&lt;BR /&gt; .....&lt;BR /&gt; while((c=getopt(..,..,..))!=-1)&lt;BR /&gt;  {&lt;BR /&gt;   ...&lt;BR /&gt;    ...&lt;BR /&gt;......&lt;BR /&gt; }&lt;BR /&gt;&lt;BR /&gt;but my two of my options in my program need more than two arguments&lt;BR /&gt; how do I do it please help.</description>
      <pubDate>Fri, 09 Jul 2010 05:11:40 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/language-and-scripting/m-p/4659082#M677322</guid>
      <dc:creator>Soumya Poddar</dc:creator>
      <dc:date>2010-07-09T05:11:40Z</dc:date>
    </item>
    <item>
      <title>Re: language and scripting</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/language-and-scripting/m-p/4659083#M677323</link>
      <description>&lt;BR /&gt;#include &lt;STDIO.H&gt;&lt;BR /&gt;#include &lt;UNISTD.H&gt;&lt;BR /&gt;           main (int argc, char *argv[])&lt;BR /&gt;           {&lt;BR /&gt;               int c;&lt;BR /&gt;               int bflg, aflg=0, errflg=0;&lt;BR /&gt;               extern char *optarg;&lt;BR /&gt;               char *ifile,*ofile;&lt;BR /&gt;&lt;BR /&gt;               extern int optind, optopt;&lt;BR /&gt;               while ((c = getopt(argc, argv, ":abf:o:")) != -1)&lt;BR /&gt;                   switch (c) {&lt;BR /&gt;                   case 'a':&lt;BR /&gt;                           aflg++;&lt;BR /&gt;                       break;&lt;BR /&gt;                   case 'f':&lt;BR /&gt;                       ifile = optarg++;&lt;BR /&gt;                       if (optarg[0]=='-')&lt;BR /&gt;                              errflg++;&lt;BR /&gt;                       else&lt;BR /&gt;                       {&lt;BR /&gt;                           ofile = ++optarg;&lt;BR /&gt;                           optind++;&lt;BR /&gt;                       }&lt;BR /&gt;                       break;&lt;BR /&gt;                   case ':':        /* -f or -o without arguments */&lt;BR /&gt;                       fprintf(stderr, "Option -%c requires an argument\n",&lt;BR /&gt;                           optopt);&lt;BR /&gt;                       errflg++;&lt;BR /&gt;                       break;&lt;BR /&gt;                   case '?':&lt;BR /&gt;                       fprintf(stderr, "Unrecognized option: - %c\n",&lt;BR /&gt;                           optopt);&lt;BR /&gt;                       errflg++;&lt;BR /&gt;                   }&lt;BR /&gt;               if (errflg) {&lt;BR /&gt;                   fprintf(stderr, "usage: . . . ");&lt;BR /&gt;                   exit (2);&lt;BR /&gt;               }&lt;BR /&gt;           printf("f= %s..%s..%d\n",ifile,ofile,aflg);&lt;BR /&gt;               for ( ; optind &amp;lt; argc; optind++)&lt;BR /&gt;    printf("%d %s\n",optind,argv[optind]);&lt;BR /&gt;}&lt;BR /&gt;&lt;/UNISTD.H&gt;&lt;/STDIO.H&gt;</description>
      <pubDate>Fri, 09 Jul 2010 07:54:46 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/language-and-scripting/m-p/4659083#M677323</guid>
      <dc:creator>Laurent Menase</dc:creator>
      <dc:date>2010-07-09T07:54:46Z</dc:date>
    </item>
    <item>
      <title>Re: language and scripting</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/language-and-scripting/m-p/4659084#M677324</link>
      <description>Thank you&lt;BR /&gt;</description>
      <pubDate>Fri, 09 Jul 2010 08:04:58 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/language-and-scripting/m-p/4659084#M677324</guid>
      <dc:creator>Soumya Poddar</dc:creator>
      <dc:date>2010-07-09T08:04:58Z</dc:date>
    </item>
    <item>
      <title>Re: language and scripting</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/language-and-scripting/m-p/4659085#M677325</link>
      <description>sir&lt;BR /&gt; your program is not taking two arguments&lt;BR /&gt; i takes first arguments properly but for the second one the program takes it as a string except the first two charecters of the first argument..&lt;BR /&gt; I want to mean that&lt;BR /&gt; &lt;BR /&gt;if input is&lt;BR /&gt;&lt;BR /&gt;./a.out -f 4567 7890&lt;BR /&gt; &lt;BR /&gt;the output gets&lt;BR /&gt;f= 4567..67..0&lt;BR /&gt;&lt;BR /&gt;so it does not taking the second argument&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt; please help sir</description>
      <pubDate>Fri, 09 Jul 2010 09:55:46 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/language-and-scripting/m-p/4659085#M677325</guid>
      <dc:creator>Soumya Poddar</dc:creator>
      <dc:date>2010-07-09T09:55:46Z</dc:date>
    </item>
    <item>
      <title>Re: language and scripting</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/language-and-scripting/m-p/4659086#M677326</link>
      <description>indeed it is &lt;BR /&gt;                   case 'f':&lt;BR /&gt;                       ifile = optarg;&lt;BR /&gt;                       if (optarg[0]=='-')&lt;BR /&gt;                              errflg++;&lt;BR /&gt;                       else&lt;BR /&gt;                       {&lt;BR /&gt;                           ofile = argv[ optind++];&lt;BR /&gt;                       }&lt;BR /&gt;                       break;&lt;BR /&gt;                  &lt;BR /&gt;&lt;BR /&gt;sorry</description>
      <pubDate>Fri, 09 Jul 2010 10:21:46 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/language-and-scripting/m-p/4659086#M677326</guid>
      <dc:creator>Laurent Menase</dc:creator>
      <dc:date>2010-07-09T10:21:46Z</dc:date>
    </item>
    <item>
      <title>Re: language and scripting</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/language-and-scripting/m-p/4659087#M677327</link>
      <description>&lt;!--!*#--&gt;thank you&lt;BR /&gt;sir&lt;BR /&gt; it helps me a lot</description>
      <pubDate>Fri, 09 Jul 2010 10:26:29 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/language-and-scripting/m-p/4659087#M677327</guid>
      <dc:creator>Soumya Poddar</dc:creator>
      <dc:date>2010-07-09T10:26:29Z</dc:date>
    </item>
    <item>
      <title>Re: language and scripting</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/language-and-scripting/m-p/4659088#M677328</link>
      <description>actually here the getopt does not parse the argument by it-self fully&lt;BR /&gt; but our intervention is needed there&lt;BR /&gt;is there any way to avoid this&lt;BR /&gt; is there any function of technique is there&lt;BR /&gt;&lt;BR /&gt;plese help me sir</description>
      <pubDate>Fri, 09 Jul 2010 10:41:26 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/language-and-scripting/m-p/4659088#M677328</guid>
      <dc:creator>Soumya Poddar</dc:creator>
      <dc:date>2010-07-09T10:41:26Z</dc:date>
    </item>
    <item>
      <title>Re: language and scripting</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/language-and-scripting/m-p/4659089#M677329</link>
      <description>can you clarify?&lt;BR /&gt;I am not sure I understand what you are trying to do.&lt;BR /&gt;&lt;BR /&gt;just an example could help&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Fri, 09 Jul 2010 10:50:01 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/language-and-scripting/m-p/4659089#M677329</guid>
      <dc:creator>Laurent Menase</dc:creator>
      <dc:date>2010-07-09T10:50:01Z</dc:date>
    </item>
    <item>
      <title>Re: language and scripting</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/language-and-scripting/m-p/4659090#M677330</link>
      <description>actually&lt;BR /&gt;&lt;BR /&gt;we write&lt;BR /&gt;while((c=getopt(...,...,":abc:")!=-1)&lt;BR /&gt; {&lt;BR /&gt;....&lt;BR /&gt;....&lt;BR /&gt;....&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;here the getopt can easily understand that the option c should need a argument with it&lt;BR /&gt;hence, it searchs for the argument when it sees the option -c in the string of one of it's strings stored in argv[] vector.&lt;BR /&gt;&lt;BR /&gt;just like that do we have any other kind of option where the function it self searches for the two arguments or the argument list.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;please help&lt;BR /&gt;sir&lt;BR /&gt;&lt;BR /&gt;if u need any more clarification please reply me</description>
      <pubDate>Fri, 09 Jul 2010 10:55:49 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/language-and-scripting/m-p/4659090#M677330</guid>
      <dc:creator>Soumya Poddar</dc:creator>
      <dc:date>2010-07-09T10:55:49Z</dc:date>
    </item>
    <item>
      <title>Re: language and scripting</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/language-and-scripting/m-p/4659091#M677331</link>
      <description>I am sorry I don't follow&lt;BR /&gt;&lt;BR /&gt;./a.out -f toto tata -c arg1 arg2 arg3 arg4 ... -z &lt;BR /&gt;you want to get the list of -c args?&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Fri, 09 Jul 2010 11:07:36 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/language-and-scripting/m-p/4659091#M677331</guid>
      <dc:creator>Laurent Menase</dc:creator>
      <dc:date>2010-07-09T11:07:36Z</dc:date>
    </item>
    <item>
      <title>Re: language and scripting</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/language-and-scripting/m-p/4659092#M677332</link>
      <description>yes&lt;BR /&gt;but using the function getopt itself&lt;BR /&gt;&lt;BR /&gt;as using the getopt&lt;BR /&gt;for single argument we can get it using oparg&lt;BR /&gt;&lt;BR /&gt;for the same thing using a list og arguments&lt;BR /&gt; can we get it using some standard syntax&lt;BR /&gt;&lt;BR /&gt;plese reply sir</description>
      <pubDate>Fri, 09 Jul 2010 11:20:48 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/language-and-scripting/m-p/4659092#M677332</guid>
      <dc:creator>Soumya Poddar</dc:creator>
      <dc:date>2010-07-09T11:20:48Z</dc:date>
    </item>
    <item>
      <title>Re: language and scripting</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/language-and-scripting/m-p/4659093#M677333</link>
      <description>&amp;gt; ./a.out -f toto tata -c arg1 arg2 arg3 arg4 ... -z&lt;BR /&gt;&amp;gt; you want to get the list of -c args?&lt;BR /&gt; &lt;BR /&gt;The shell is separating each space-delimited string as a separate item for getopt. To supply multiple arguments to a single option, keep the arguments together. I like to use commas (more readable) or use quotes:&lt;BR /&gt; &lt;BR /&gt;./a.out -f toto,tata -c arg1,arg2,arg3,arg4 ... -z&lt;BR /&gt; &lt;BR /&gt;or&lt;BR /&gt; &lt;BR /&gt;./a.out -f "toto tata" -c "arg1 arg2 arg3 arg4" ... -z</description>
      <pubDate>Fri, 09 Jul 2010 11:27:35 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/language-and-scripting/m-p/4659093#M677333</guid>
      <dc:creator>Bill Hassell</dc:creator>
      <dc:date>2010-07-09T11:27:35Z</dc:date>
    </item>
    <item>
      <title>Re: language and scripting</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/language-and-scripting/m-p/4659094#M677334</link>
      <description>in that case is my program need to parse them&lt;BR /&gt;or these list of arguments will be passed to me through some standard external variable&lt;BR /&gt;like optagr&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;plese reply &lt;BR /&gt;sir</description>
      <pubDate>Fri, 09 Jul 2010 11:30:35 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/language-and-scripting/m-p/4659094#M677334</guid>
      <dc:creator>Soumya Poddar</dc:creator>
      <dc:date>2010-07-09T11:30:35Z</dc:date>
    </item>
    <item>
      <title>Re: language and scripting</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/language-and-scripting/m-p/4659095#M677335</link>
      <description>getopt stop to the first identified -x&lt;BR /&gt;now  if optarg points to the first string after the identified option if there is a : in the description&lt;BR /&gt;optind points to the next arg&lt;BR /&gt;&lt;BR /&gt;so to get a variable number of params you can do for instance:&lt;BR /&gt;&lt;BR /&gt;char * v2;&lt;BR /&gt;char *allcparms[256];&lt;BR /&gt;int indexcparms=0;&lt;BR /&gt;......&lt;BR /&gt;case 'c':&lt;BR /&gt;     allcparms[indexcparms++]=optarg;&lt;BR /&gt;     while(v2=argv[optind])&lt;BR /&gt;     {&lt;BR /&gt;        if ( v2[0]=='-' ) break;&lt;BR /&gt;        allcparms[indexcparms++]=v2;&lt;BR /&gt;        optind++;&lt;BR /&gt;     }&lt;BR /&gt;     break; &lt;BR /&gt;&lt;BR /&gt;so &lt;BR /&gt;./a.out -c 1 2 3 4 5 6 -f xx yy&lt;BR /&gt;will put 1 2 3 4 5 6 in allcparms[0..5]&lt;BR /&gt;./a.out -c 1 2 3 4 5 6 &lt;BR /&gt;also&lt;BR /&gt;./a.out -c 1 2 3 4 5 6 -- xx yy&lt;BR /&gt;also&lt;BR /&gt;&lt;BR /&gt;is it what you are trying to make?</description>
      <pubDate>Fri, 09 Jul 2010 11:36:06 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/language-and-scripting/m-p/4659095#M677335</guid>
      <dc:creator>Laurent Menase</dc:creator>
      <dc:date>2010-07-09T11:36:06Z</dc:date>
    </item>
    <item>
      <title>Re: language and scripting</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/language-and-scripting/m-p/4659096#M677336</link>
      <description>in one of my previous answer I wrote:&lt;BR /&gt;if (optarg[0]=='-')&lt;BR /&gt;in fact it is if (argv[optind][0]=='-')</description>
      <pubDate>Fri, 09 Jul 2010 11:37:54 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/language-and-scripting/m-p/4659096#M677336</guid>
      <dc:creator>Laurent Menase</dc:creator>
      <dc:date>2010-07-09T11:37:54Z</dc:date>
    </item>
    <item>
      <title>Re: language and scripting</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/language-and-scripting/m-p/4659097#M677337</link>
      <description>yes&lt;BR /&gt;&lt;BR /&gt;but here in that case i parse those arguments using my programs&lt;BR /&gt;&lt;BR /&gt;but i am asking that is there any standard function is there like getopt using which&lt;BR /&gt;i get my varriable number of arguments using some standard varriable like optarg in getopt&lt;BR /&gt;&lt;BR /&gt;plese reply sir</description>
      <pubDate>Fri, 09 Jul 2010 11:40:45 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/language-and-scripting/m-p/4659097#M677337</guid>
      <dc:creator>Soumya Poddar</dc:creator>
      <dc:date>2010-07-09T11:40:45Z</dc:date>
    </item>
    <item>
      <title>Re: language and scripting</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/language-and-scripting/m-p/4659098#M677338</link>
      <description>please give an example&lt;BR /&gt;I don't follow what you are trying to get and how?&lt;BR /&gt;&lt;BR /&gt;are you trying to do it in script?&lt;BR /&gt;</description>
      <pubDate>Fri, 09 Jul 2010 11:47:43 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/language-and-scripting/m-p/4659098#M677338</guid>
      <dc:creator>Laurent Menase</dc:creator>
      <dc:date>2010-07-09T11:47:43Z</dc:date>
    </item>
    <item>
      <title>Re: language and scripting</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/language-and-scripting/m-p/4659099#M677339</link>
      <description>&lt;BR /&gt;like&lt;BR /&gt;in C&lt;BR /&gt;&lt;BR /&gt;while((c=getopt(...,...,":abf:"))!=-1)&lt;BR /&gt;  {&lt;BR /&gt;    .....&lt;BR /&gt;    .....&lt;BR /&gt;    .....&lt;BR /&gt;   }&lt;BR /&gt;&lt;BR /&gt;now if my input is&lt;BR /&gt; ./a.out -f Mandoc.doc&lt;BR /&gt; we can get it like&lt;BR /&gt;&lt;BR /&gt; ifile=optagr&lt;BR /&gt;&lt;BR /&gt;but if we want to give the input like&lt;BR /&gt; ./a.out -f Mandoc.doc Relese.doc .....&lt;BR /&gt;&lt;BR /&gt;then is there any standard function which will&lt;BR /&gt; give same oppurtunity access those argument list&lt;BR /&gt;&lt;BR /&gt;like&lt;BR /&gt; arguments=optargarr;&lt;BR /&gt;&lt;BR /&gt;where&lt;BR /&gt; arguments is declared like&lt;BR /&gt;&lt;BR /&gt;char* arguments[];&lt;BR /&gt;&lt;BR /&gt;and optagr declared as&lt;BR /&gt;&lt;BR /&gt;extern char* optarg[];&lt;BR /&gt;&lt;BR /&gt;i want to use it in simple C program&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Fri, 09 Jul 2010 11:56:50 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/language-and-scripting/m-p/4659099#M677339</guid>
      <dc:creator>Soumya Poddar</dc:creator>
      <dc:date>2010-07-09T11:56:50Z</dc:date>
    </item>
    <item>
      <title>Re: language and scripting</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/language-and-scripting/m-p/4659100#M677340</link>
      <description>Hi:&lt;BR /&gt;&lt;BR /&gt;&amp;gt; but if we want to give the input like&lt;BR /&gt;./a.out -f Mandoc.doc Relese.doc .....&lt;BR /&gt;&lt;BR /&gt;As Bill said, quote the argument and 'getopt()' will see it as one.  I suspect that you come from Windows environments where spaces are common in filenames.  Spaces (whitespace) in Unix separates arguments when the shell parses a command line/&lt;BR /&gt;&lt;BR /&gt;Hence:&lt;BR /&gt;&lt;BR /&gt;# ./a.out -f "Mandoc.doc Relese.doc"&lt;BR /&gt;&lt;BR /&gt;...will leave you with *one* argument to the '-f' option.&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Fri, 09 Jul 2010 12:02:32 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/language-and-scripting/m-p/4659100#M677340</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2010-07-09T12:02:32Z</dc:date>
    </item>
    <item>
      <title>Re: language and scripting</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/language-and-scripting/m-p/4659101#M677341</link>
      <description>ya&lt;BR /&gt;I am a fresher i am new in company and i am new in unix i came from windows enviourment&lt;BR /&gt;&lt;BR /&gt;so hence&lt;BR /&gt;we have make our program in such a way that it can parse the arguments by it self&lt;BR /&gt;&lt;BR /&gt;and there is no way to parse multiple arguments uning getopt() in c&lt;BR /&gt;&lt;BR /&gt;ok sir thank you&lt;BR /&gt;for helping me&lt;BR /&gt;and shareing your knowladge with me&lt;BR /&gt;&lt;BR /&gt;thank you</description>
      <pubDate>Fri, 09 Jul 2010 12:09:09 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/language-and-scripting/m-p/4659101#M677341</guid>
      <dc:creator>Soumya Poddar</dc:creator>
      <dc:date>2010-07-09T12:09:09Z</dc:date>
    </item>
  </channel>
</rss>

