Skip to content

Commit

Permalink
Updated to version 1.6.4.
Browse files Browse the repository at this point in the history
  • Loading branch information
Wayne Davison committed Jul 27, 2002
1 parent ca23c51 commit cc248aa
Show file tree
Hide file tree
Showing 12 changed files with 1,837 additions and 649 deletions.
5 changes: 4 additions & 1 deletion popt/CHANGES
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
1.3 ->
1.5 -> 1.6
- add ability to perform callbacks for every, not just first, match.

1.3 -> 1.5
- heavy dose of const's
- poptParseArgvString() now NULL terminates the list

Expand Down
2 changes: 1 addition & 1 deletion popt/README
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ to getopt(3), it contains a number of enhancements, including:
2) popt can parse arbitrary argv[] style arrays while
getopt(2) makes this quite difficult
3) popt allows users to alias command line arguments
4) popt provides convience functions for parsting strings
4) popt provides convience functions for parsing strings
into argv[] style arrays

popt is used by rpm, the Red Hat install program, and many other Red Hat
Expand Down
9 changes: 4 additions & 5 deletions popt/README.rsync
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
Unlike zlib, this is a perfectly ordinary copy of libpopt. It's only
used on platforms that don't have a sufficiently up-to-date copy of
their own. If you build rsync on a platform which has popt, this
directory should not be used. (You can control that using
--with-included-popt.)
This is a perfectly ordinary copy of libpopt. It is only used on platforms
that do not have a sufficiently up-to-date copy of their own. If you build
rsync on a platform which has popt, this directory should not be used. (You
can control that using the --with-included-popt configure flag.)
30 changes: 17 additions & 13 deletions popt/findme.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
/* (C) 1998 Red Hat Software, Inc. -- Licensing details are in the COPYING
/** \ingroup popt
* \file popt/findme.c
*/

/* (C) 1998-2000 Red Hat, Inc. -- Licensing details are in the COPYING
file accompanying popt source distributions, available from
ftp://ftp.redhat.com/pub/code/popt */
ftp://ftp.rpm.org/pub/rpm/dist. */

#include "system.h"
#include "findme.h"
Expand All @@ -9,38 +13,38 @@ const char * findProgramPath(const char * argv0) {
char * path = getenv("PATH");
char * pathbuf;
char * start, * chptr;
char * buf, *local = NULL;
char * buf;

/* If there is a / in the argv[0], it has to be an absolute
path */
if (argv0 == NULL) return NULL; /* XXX can't happen */
/* If there is a / in the argv[0], it has to be an absolute path */
if (strchr(argv0, '/'))
return xstrdup(argv0);

if (!path) return NULL;
if (path == NULL) return NULL;

local = start = pathbuf = malloc(strlen(path) + 1);
buf = malloc(strlen(path) + strlen(argv0) + 2);
start = pathbuf = alloca(strlen(path) + 1);
buf = malloc(strlen(path) + strlen(argv0) + sizeof("/"));
if (buf == NULL) return NULL; /* XXX can't happen */
strcpy(pathbuf, path);

chptr = NULL;
/*@-branchstate@*/
do {
if ((chptr = strchr(start, ':')))
*chptr = '\0';
sprintf(buf, "%s/%s", start, argv0);

if (!access(buf, X_OK)) {
if (local) free(local);
return buf;
}
if (!access(buf, X_OK))
return buf;

if (chptr)
start = chptr + 1;
else
start = NULL;
} while (start && *start);
/*@=branchstate@*/

free(buf);
if (local) free(local);

return NULL;
}
16 changes: 13 additions & 3 deletions popt/findme.h
Original file line number Diff line number Diff line change
@@ -1,10 +1,20 @@
/* (C) 1998 Red Hat Software, Inc. -- Licensing details are in the COPYING
/** \ingroup popt
* \file popt/findme.h
*/

/* (C) 1998-2000 Red Hat, Inc. -- Licensing details are in the COPYING
file accompanying popt source distributions, available from
ftp://ftp.redhat.com/pub/code/popt */
ftp://ftp.rpm.org/pub/rpm/dist. */

#ifndef H_FINDME
#define H_FINDME

const char * findProgramPath(const char * argv0);
/**
* Return absolute path to executable by searching PATH.
* @param argv0 name of executable
* @return (malloc'd) absolute path to executable (or NULL)
*/
/*@null@*/ const char * findProgramPath(/*@null@*/ const char * argv0)
/*@*/;

#endif
Loading

0 comments on commit cc248aa

Please sign in to comment.