Dienstag, 25. Dezember 2012

popt

About

popt is a library for parsing command-line options in the style popular in GNU utilities. For example, in most GNU utilities, commands may be called with a combination of short options or long options, such as ls -arF, or the equivalent, ls -a -r -F, or the equivalent ls --all --reverse --classify.
popt is included in most Linux environments, and is also included with MinGW under Windows.

Installation / Quickstart

1. (Optional) Install popt package updates or source code using mingw-get

  • Enter the command: mingw-get update
  • Catalogues are downloaded into c:\mingw\var\lib\mingw-get\data
  • Enter the command: mingw-get list
  • This will list all packages and a description of each one. Notice the package with name mingw32-libpopt is on the list
  • Enter the command: mingw-get install mingw32-libpopt

2. Use the already-installed version of popt in MinGW


3. Make the popt manpage(s) accessible

  • Using Cygwin's setup.exe, install the "popt" development package

4. Prepare the example program

  • Go to the popt(3) manpage
  • Copy and paste the example listing from the program "robin"
  • Name the new source file with the listing popt_test.c

5. Fix the errors and warnings that appear in popt_test.c

  • The program is correct, but has a minor typographical error and missing typecasts

6. Compile popt_test using the command

  • Enter the command: gcc -Wall -std=gnu99 -o popt_test popt_test.c -lpopt

Keine Kommentare:

Kommentar veröffentlichen