Questions tagged [getopt-long]

Getopt::Long is a command line switch parsing library for Perl. For C-programming: The getopt and getopt_long functions automate some of the chores involved in parsing typical unix command line options.

The Getopt::Long Perl module is a parser for the POSIX command line switch syntax with GNU extensions. Both the traditional -s single character switches and the longer --longer switches are supported.

For C-programming: The getopt and getopt_long functions automate some of the chores involved in parsing typical unix command line options. For details, please see here.

190 questions
-1
votes
1 answer

how to use long options in c?

how to use long options via getopt_long: for example like this: --wide-option I have --wide and -w. And on --wide-option it gives the following error: "unrecognized option" int main(int argc, char **argv) {     struct option opts[] =     {      …
Kuttubek
  • 3
  • 4
-1
votes
1 answer

How to use getopt for parsing long in bash

I have a use case in which I have to execute functionality of different methods in shell script. User will call my shell script as I have to read the value of options and on basis of it have to call methods. Please find the sample code…
umesh
  • 312
  • 3
  • 4
  • 15
-1
votes
1 answer

C - getopt_long not parsing all arguments?

I am writing the following code for a command called fp which exists within a framework for handling these commands that's already in place. I'm fairly new to C and I'm trying to parse some the arguments for this command using getopt_long().…
SamH
  • 203
  • 1
  • 2
  • 13
-1
votes
1 answer

Ruby GetoptLong how do I parse comma separated arguments?

How can i parse arguments separated by comma in ruby? For example: $> Main.rb --xmlid 1,2,3,4,5 I want to parse and store 1,2,3,4,5 in an array. How can I do that? Thanks.
user384070
  • 81
  • 2
  • 2
  • 9
-1
votes
1 answer

Perl DNS Validation using modules Net::DNS, Data::Dumper and Getopt::Long errors

#!/usr/bin/perl # S Validation Script use strict; use Net::DNS; use Data::Dumper; use Getopt::Long; $| = 1; my $USAGE = "$0 --file "; my $input_filename = ""; GetOptions("--file=s" => \$input_filename) or die $USAGE; if…
technerdius
  • 253
  • 3
  • 6
  • 16
-1
votes
1 answer

Value Invalid for Option Input (Number Expected)

I am passing the input file location and output file location through the command line and I am getting these errors: Value "C:\Users\Mruppe2\workspace\Perl" invalid for option input (number expected) Value "C:\temp\output.csv" invalid for…
rupes0610
  • 261
  • 1
  • 6
  • 20
-2
votes
1 answer

How do I retrieve the exact value passed as an option value using Getopt::Long?

I am trying the Getopt::Long module to read command line arguments, but for some reason when I try to print the variable in a print statement it prints '1' and not the value that has been passed to the variable. Example: use Getopt::Long; use…
-2
votes
1 answer

Can't figure out seg fault

Why do I keep getting a set fault when I try and pass -H in the command line as a flag? -h (help) is working perfectly but -H(header) messes up every single time. I have a main function as well which calls parse_command_line by passing the argc &…
Anon
  • 27
  • 1
  • 7
-2
votes
1 answer

run perl script with argument from command line

i wrote perl script that take argument from command line and print simple line with this argument. this is the code: #!/usr/bin/perl -w use Getopt::Long; use strict; my $aviad; GetOptions( "aviad:s" => \$aviad, …
user3205436
  • 57
  • 1
  • 8
-3
votes
2 answers

Command-line options in C

I would like to create a C program that accepts an argument of the form -aK where K is some integer from 0-9. How would I parse/specify this option?
nope
  • 223
  • 4
  • 15
1 2 3
12
13