Main Page   Compound List   File List   Compound Members   File Members  

alternatives-update.cpp File Reference

Include dependency graph for alternatives-update.cpp:

Include dependency graph

Typedefs

typedef std::map< std::string,
bool > 
bool_hash

Enumerations

enum  command_type { UNKNOWN, OBSOLETE, IGNORE }

Functions

bool dir_in_alt (const char *linkname)
bool relink (const char *points_to, const char *linkname, bool is_update=false)
void remove_alternative (const char *int_link, const char *ext_link)
bool update_alternative (const char *link_dir, const char *int_link, const char *ext_link, const char *points_to)
bool update_remove (const std::string &linkdir)
bool setup_new (const std::string &linkdir)
void remove_compat (const std::string &linkdir, const char *oldname)
void usage (int retcode)
int main (int argc, char *argv[])

Variables

AltStoragealts = 0
bool verbose = false
bool_hash done

Typedef Documentation

typedef std::map<std::string, bool> bool_hash
 

hash, to process altarnatives only once. key -> alternative name, value -> present flag


Enumeration Type Documentation

enum command_type
 

type of the command

Enumeration values:
UNKNOWN  unknown, for error messages
OBSOLETE  remove obsolete links before update
IGNORE 


Function Documentation

bool dir_in_alt const char *    linkname
 

checks if directory is in alternatives too

Parameters:
linkname  name of the symlink
Returns:
true if directory of alternative is alternative, otherwise false

int main int    argc,
char *    argv[]
 

Main function

bool relink const char *    points_to,
const char *    linkname,
bool    is_update = false
 

check where link points to and relink if nesessary

Parameters:
points_to  where must link points to
linkname  path to symlink
is_update  made warnings about recreation only on update
Returns:
true if symlinks was recreated, otherwise false
Exceptions:
Ing::glibc_error 

void remove_alternative const char *    int_link,
const char *    ext_link
 

remove symlinks for removed alternative

Parameters:
int_link  internal alternative link (in /etc/alternatives)
ext_link  external (real) alternative link
Exceptions:
Ing::glibc_error 

void remove_compat const std::string &    linkdir,
const char *    oldname
 

remove old style alternatives symlink, we will remove only if symlink corresponds to some new existing alternative

Parameters:
linkdir  directory with symlinks
oldname  name of the obsoleted symlink
Exceptions:
Ing::internal_error 
Ing::glibc_error 

bool setup_new const std::string &    linkdir
 

setup new alternative, create both internal and external symlinks

Parameters:
linkdir  direcrory with symlinks
Returns:
true on changes, otherwise false

bool update_alternative const char *    link_dir,
const char *    int_link,
const char *    ext_link,
const char *    points_to
 

update alternative symlink

Parameters:
link_dir  directory with internal symlinks
int_link  internal symlink's name
ext_link  external symlinks's name
points_to  where internal symlinks must points to
Returns:
true on changes, otherwise false
Exceptions:
Ing::internal_error 
Ing::glibc_error 

bool update_remove const std::string &    linkdir
 

walk throw directory with internal symlinks, remove, or update some of them

Parameters:
linkdir  directory with symlinks
Returns:
true on changes, otherwise false

void usage int    retcode
 

help screen for command-line utility

Parameters:
retcode  exit code, possible values EXIT_SUCCESS, EXIT_FAILURE


Variable Documentation

AltStorage* alts = 0
 

Main alternatives storage

bool_hash done
 

list of already proceed alternatives

bool verbose = false
 

verbose program's output


Generated on Thu Jun 26 15:28:37 2003 for Alternatives by doxygen1.2.18