popt/popt.c File Reference

#include "system.h"
#include <math.h>
#include "findme.h"
#include "poptint.h"

Go to the source code of this file.

Defines

#define _ABS(a)   ((((a) - 0.0) < DBL_EPSILON) ? -(a) : (a))

Functions

static char * strerror (int errno)
void poptSetExecPath (poptContext con, const char *path, int allowAbsolute)
 Limit search for executables.
static void invokeCallbacksPRE (poptContext con, const struct poptOption *opt)
static void invokeCallbacksPOST (poptContext con, const struct poptOption *opt)
static void invokeCallbacksOPTION (poptContext con, const struct poptOption *opt, const struct poptOption *myOpt, const void *myData, int shorty)
poptContext poptGetContext (const char *name, int argc, const char **argv, const struct poptOption *options, int flags)
 Initialize popt context.
static void cleanOSE (struct optionStackEntry *os)
void poptResetContext (poptContext con)
 Reinitialize popt context.
static int handleExec (poptContext con, const char *longName, char shortName)
static int handleAlias (poptContext con, const char *longName, char shortName, const char *nextCharArg)
static int execCommand (poptContext con)
static const struct poptOptionfindOption (const struct poptOption *opt, const char *longName, char shortName, poptCallbackType *callback, const void **callbackData, int singleDash)
static const char * findNextArg (poptContext con, unsigned argx, int delete_arg)
static const char * expandNextArg (poptContext con, const char *s)
static void poptStripArg (poptContext con, int which)
static int poptSaveLong (const struct poptOption *opt, long aLong)
static int poptSaveInt (const struct poptOption *opt, long aLong)
int poptGetNextOpt (poptContext con)
 Return value of next option found.
const char * poptGetOptArg (poptContext con)
 Return next option argument (if any).
const char * poptGetArg (poptContext con)
 Return current option's argument.
const char * poptPeekArg (poptContext con)
 Peek at current option's argument.
const char ** poptGetArgs (poptContext con)
 Return remaining arguments.
poptContext poptFreeContext (poptContext con)
 Destroy context.
int poptAddAlias (poptContext con, struct poptAlias alias, int flags)
 Add alias to context.
int poptAddItem (poptContext con, poptItem newItem, int flags)
 Add alias/exec item to context.
const char * poptBadOption (poptContext con, int flags)
 Return the option which caused the most recent error.
const char *const poptStrerror (const int error)
 Return formatted error string for popt failure.
int poptStuffArgs (poptContext con, const char **argv)
 Add arguments to context.
const char * poptGetInvocationName (poptContext con)
 Return argv[0] from context.
int poptStrippedArgv (poptContext con, int argc, char **argv)
 Shuffle argv pointers to remove stripped args, returns new argc.


Detailed Description

Definition in file popt.c.


Define Documentation

#define _ABS  )     ((((a) - 0.0) < DBL_EPSILON) ? -(a) : (a))
 

Referenced by poptGetNextOpt().


Function Documentation

static void cleanOSE struct optionStackEntry os  )  [static]
 

Definition at line 195 of file popt.c.

References _free(), optionStackEntry::argb, optionStackEntry::argv, optionStackEntry::nextArg, and PBM_FREE.

Referenced by poptGetNextOpt(), and poptResetContext().

static int execCommand poptContext  con  )  [static]
 

Definition at line 349 of file popt.c.

References alloca(), poptItem_s::argc, poptItem_s::argv, poptContext_s::doExec, poptContext_s::execAbsolute, poptContext_s::execPath, poptContext_s::finalArgv, poptContext_s::finalArgvCount, findProgramPath(), poptContext_s::leftovers, poptContext_s::numLeftovers, POPT_ERROR_ERRNO, POPT_ERROR_MALLOC, and POPT_ERROR_NOARG.

Referenced by poptGetNextOpt().

static const char* expandNextArg poptContext  con,
const char *  s
[static]
 

Definition at line 538 of file popt.c.

References findNextArg().

Referenced by poptGetNextOpt().

static const char* findNextArg poptContext  con,
unsigned  argx,
int  delete_arg
[static]
 

Definition at line 500 of file popt.c.

References optionStackEntry::argb, optionStackEntry::argc, optionStackEntry::argv, optionStackEntry::next, poptContext_s::optionStack, poptContext_s::os, PBM_ALLOC, PBM_ISSET, and PBM_SET.

Referenced by expandNextArg().

static const struct poptOption* findOption const struct poptOption opt,
const char *  longName,
char  shortName,
poptCallbackType callback,
const void **  callbackData,
int  singleDash
[static]
 

Definition at line 434 of file popt.c.

References poptOption::arg, poptOption::argInfo, poptOption::descrip, poptOption::longName, POPT_ARG_INCLUDE_TABLE, POPT_ARG_MASK, and poptOption::shortName.

Referenced by poptGetNextOpt().

static int handleAlias poptContext  con,
const char *  longName,
char  shortName,
const char *  nextCharArg
[static]
 

Definition at line 297 of file popt.c.

References poptContext_s::aliases, optionStackEntry::argb, optionStackEntry::argc, poptItem_s::argc, optionStackEntry::argv, poptItem_s::argv, optionStackEntry::currAlias, poptOption::longName, optionStackEntry::next, optionStackEntry::nextArg, optionStackEntry::nextCharArg, poptContext_s::numAliases, poptItem_s::option, poptContext_s::optionStack, poptContext_s::os, POPT_ERROR_OPTSTOODEEP, POPT_OPTION_DEPTH, poptDupArgv(), poptOption::shortName, and optionStackEntry::stuffed.

Referenced by poptGetNextOpt().

static int handleExec poptContext  con,
const char *  longName,
char  shortName
[static]
 

Definition at line 238 of file popt.c.

References poptContext_s::doExec, poptContext_s::execs, poptContext_s::finalArgv, poptContext_s::finalArgvAlloced, poptContext_s::finalArgvCount, poptContext_s::flags, poptOption::longName, poptContext_s::numExecs, poptItem_s::option, POPT_CONTEXT_NO_EXEC, and poptOption::shortName.

Referenced by poptGetNextOpt().

static void invokeCallbacksOPTION poptContext  con,
const struct poptOption opt,
const struct poptOption myOpt,
const void *  myData,
int  shorty
[static]
 

Definition at line 103 of file popt.c.

References poptOption::arg, poptOption::argInfo, poptOption::longName, POPT_ARG_INCLUDE_TABLE, POPT_ARG_MASK, and poptOption::shortName.

Referenced by poptGetNextOpt().

static void invokeCallbacksPOST poptContext  con,
const struct poptOption opt
[static]
 

Definition at line 80 of file popt.c.

References poptOption::arg, poptOption::argInfo, poptOption::longName, POPT_ARG_INCLUDE_TABLE, POPT_ARG_MASK, and poptOption::shortName.

Referenced by poptGetNextOpt().

static void invokeCallbacksPRE poptContext  con,
const struct poptOption opt
[static]
 

Definition at line 57 of file popt.c.

References poptOption::arg, poptOption::argInfo, poptOption::longName, POPT_ARG_INCLUDE_TABLE, POPT_ARG_MASK, and poptOption::shortName.

Referenced by poptGetContext().

static int poptSaveInt const struct poptOption opt,
long  aLong
[static]
 

Definition at line 630 of file popt.c.

References poptOption::arg, poptOption::argInfo, POPT_ARGFLAG_AND, POPT_ARGFLAG_LOGICALOPS, POPT_ARGFLAG_NOT, POPT_ARGFLAG_OR, POPT_ARGFLAG_XOR, POPT_ERROR_BADOPERATION, and POPT_ERROR_NULLARG.

Referenced by poptGetNextOpt().

static int poptSaveLong const struct poptOption opt,
long  aLong
[static]
 

Definition at line 602 of file popt.c.

References poptOption::arg, poptOption::argInfo, POPT_ARGFLAG_AND, POPT_ARGFLAG_LOGICALOPS, POPT_ARGFLAG_NOT, POPT_ARGFLAG_OR, POPT_ARGFLAG_XOR, POPT_ERROR_BADOPERATION, and POPT_ERROR_NULLARG.

Referenced by poptGetNextOpt().

static void poptStripArg poptContext  con,
int  which
[static]
 

Definition at line 586 of file popt.c.

References poptContext_s::arg_strip, optionStackEntry::argc, poptContext_s::optionStack, PBM_ALLOC, and PBM_SET.

Referenced by poptGetNextOpt().

static char* strerror int  errno  )  [static]
 

Definition at line 22 of file popt.c.

References POPT_.

Referenced by checkOwners(), checkPassPhrase(), cpioStrerror(), dbiOpen(), doScript(), fdFgets(), fdWritable(), Fstrerror(), getFdErrstr(), getFilesystemList(), getOutputFrom(), makeGPGSignature(), makePGPSignature(), packageBinaries(), poptStrerror(), processSourceFiles(), rpmdbRebuild(), rpmProblemString(), urlStrerror(), verifyGPGSignature(), and verifyPGPSignature().


Generated on Wed Mar 8 22:44:28 2006 for rpm by  doxygen 1.4.6