lib/misc.h File Reference

Go to the source code of this file.

Functions

char ** splitString (const char *str, int length, char sep)
 Split string into fields separated by a character.
void freeSplitString (char **list)
 Free split string argv array.
static char * stripTrailingChar (char *s, char c)
 Remove occurences of trailing character from string.
int dosetenv (const char *name, const char *value, int overwrite)
 Like the libc function, but malloc()'s the space needed.
int doputenv (const char *str)
 Like the libc function, but malloc()'s the space needed.
int makeTempFile (const char *prefix, const char **fnptr, FD_t *fdptr)
 Return file handle for a temporaray file.
char * currentDirectory (void)
 Return (malloc'd) current working directory.
void compressFilelist (Header h)
 Convert absolute path tag to (dirname,basename,dirindex) tags.
void expandFilelist (Header h)
 Convert (dirname,basename,dirindex) tags to absolute path tag.
void buildOrigFileList (Header h, const char ***fileListPtr, int *fileCountPtr)
int myGlobPatternP (const char *patternURL)
int rpmGlob (const char *patterns, int *argcPtr, const char ***argvPtr)
void providePackageNVR (Header h)
 Retrofit a Provides: name = version-release dependency into legacy packages.
int domd5 (const char *fn, unsigned char *digest, int asAscii)
 Calculate MD5 sum for file.
static int mdfile (const char *fn, unsigned char *digest)
 Return MD5 sum of file as ASCII string.
static int mdbinfile (const char *fn, unsigned char *bindigest)
 Return MD5 sum of file as binary data.


Detailed Description

Definition in file misc.h.


Function Documentation

void buildOrigFileList ( Header  h,
const char ***  fileListPtr,
int *  fileCountPtr 
)

Parameters:
h header

Definition at line 465 of file misc.c.

void compressFilelist ( Header  h  ) 

Convert absolute path tag to (dirname,basename,dirindex) tags.

Parameters:
h header

Definition at line 298 of file misc.c.

char* currentDirectory ( void   ) 

Return (malloc'd) current working directory.

Returns:
current working directory (malloc'ed)

Definition at line 274 of file misc.c.

int domd5 ( const char *  fn,
unsigned char *  digest,
int  asAscii 
)

Calculate MD5 sum for file.

Todo:
Eliminate, use beecrypt instead.
Parameters:
fn file name
Return values:
digest address of md5sum
Parameters:
asAscii return md5sum as ascii string?
Returns:
0 on success, 1 on error

Definition at line 791 of file misc.c.

int doputenv ( const char *  str  ) 

Like the libc function, but malloc()'s the space needed.

Parameters:
str "name=value" string
Returns:
0 on success

Definition at line 98 of file misc.c.

int dosetenv ( const char *  name,
const char *  value,
int  overwrite 
)

Like the libc function, but malloc()'s the space needed.

Parameters:
name variable name
value variable value
overwrte should an existing variable be changed?
Returns:
0 on success

Definition at line 108 of file misc.c.

void expandFilelist ( Header  h  ) 

Convert (dirname,basename,dirindex) tags to absolute path tag.

Parameters:
h header

Definition at line 436 of file misc.c.

void freeSplitString ( char **  list  ) 

Free split string argv array.

Parameters:
list argv array

Definition at line 59 of file misc.c.

int makeTempFile ( const char *  prefix,
const char **  fnptr,
FD_t fdptr 
)

Return file handle for a temporaray file.

A unique temporaray file path will be generated using rpmGenPath(prefix, "%{_tmppath}/", "rpm-tmp.XXXXX") where "XXXXXX" is filled in using rand(3). The file is opened, and the link count and (dev,ino) location are verified after opening. The file name and the open file handle are returned.

Parameters:
prefix leading part of temp file path
Return values:
fnptr temp file name (or NULL)
fdptr temp file handle
Returns:
0 on success

Definition at line 170 of file misc.c.

static int mdbinfile ( const char *  fn,
unsigned char *  bindigest 
) [inline, static]

Return MD5 sum of file as binary data.

Todo:
Eliminate, use beecrypt instead.
Parameters:
fn file name
Return values:
bindigest MD5 digest
Returns:
0 on success, 1 on error

Definition at line 175 of file misc.h.

static int mdfile ( const char *  fn,
unsigned char *  digest 
) [inline, static]

Return MD5 sum of file as ASCII string.

Todo:
Eliminate, use beecrypt instead.
Parameters:
fn file name
Return values:
digest MD5 digest
Returns:
0 on success, 1 on error

Definition at line 160 of file misc.h.

int myGlobPatternP ( const char *  patternURL  ) 

Definition at line 476 of file misc.c.

void providePackageNVR ( Header  h  ) 

Retrofit a Provides: name = version-release dependency into legacy packages.

Parameters:
h header

Definition at line 712 of file misc.c.

int rpmGlob ( const char *  patterns,
int *  argcPtr,
const char ***  argvPtr 
)

Definition at line 508 of file misc.c.

char** splitString ( const char *  str,
int  length,
char  sep 
)

Split string into fields separated by a character.

Parameters:
str string
length length of string
sep separator character
Returns:
(malloc'd) argv array

Definition at line 23 of file misc.c.

static char* stripTrailingChar ( char *  s,
char  c 
) [inline, static]

Remove occurences of trailing character from string.

Parameters:
s string
c character to strip
Returns:
string

Definition at line 37 of file misc.h.


Generated on Tue Nov 25 04:38:15 2008 for rpm by  doxygen 1.5.6