Main Page   Modules   Data Structures   File List   Data Fields   Globals   Related Pages  

lib/misc.h File Reference

More...

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. More...

void freeSplitString (char **list)
 Free split string argv array. More...

char * stripTrailingChar (char *s, char c)
 Remove occurences of trailing character from string. More...

int dosetenv (const char *name, const char *value, int overwrite)
 Like the libc function, but malloc()'s the space needed. More...

int doputenv (const char *str)
 Like the libc function, but malloc()'s the space needed. More...

int makeTempFile (const char *prefix, const char **fnptr, FD_t *fdptr)
 Return file handle for a temporaray file. More...

char * currentDirectory (void)
 Return (malloc'd) current working directory. More...

void compressFilelist (Header h)
 Convert absolute path tag to (dirname,basename,dirindex) tags. More...

void expandFilelist (Header h)
 Convert (dirname,basename,dirindex) tags to absolute path tag. More...

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. More...

int domd5 (const char *fn, unsigned char *digest, int asAscii)
 Calculate MD5 sum for file. More...

int mdfile (const char *fn, unsigned char *digest)
 Return MD5 sum of file as ASCII string. More...

int mdbinfile (const char *fn, unsigned char *bindigest)
 Return MD5 sum of file as binary data. More...


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.

Referenced by doGetRecord, genCpioListAndHeader, and readPackageHeaders.

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.

Referenced by genCpioListAndHeader, mdbinfile, and mdfile.

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
overwrite  should an existing variable be changed?
Returns:
0 on success

Definition at line 108 of file misc.c.

Referenced by checkPassPhrase, makeGPGSignature, makePGPSignature, verifyGPGSignature, and verifyPGPSignature.

void expandFilelist Header    h
 

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

Parameters:
h  header

Definition at line 436 of file misc.c.

Referenced by dbiUpdateRecord, genCpioListAndHeader, and rpmdbAdd.

void freeSplitString char **    list
 

Free split string argv array.

Parameters:
list  argv array

Definition at line 59 of file misc.c.

Referenced by parsePrep, processPackageFiles, and processSourceFiles.

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.

Referenced by doScript, manageFile, verifyGPGSignature, verifyPGPSignature, and writeRPM.

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.

References domd5.

Referenced by rpmAddSignature.

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.

References domd5.

int myGlobPatternP const char *    patternURL
 

Definition at line 476 of file misc.c.

Referenced by processBinaryFile, and rpmGlob.

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.

Referenced by doGetRecord, packageBinaries, readPackageHeaders, and writeRPM.

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

Definition at line 508 of file misc.c.

Referenced by IDTXglob, processBinaryFile, rpmInstall, rpmQueryVerify, and rpmReadPackageManifest.

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.

Referenced by parsePrep, processPackageFiles, and processSourceFiles.

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.

Referenced by readPackageHeaders.


Generated on Fri Apr 4 14:39:43 2003 for rpm by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002