#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <errno.h>
#include <string.h>
#include <math.h>
#include <ctype.h>
#include <glib.h>
#include "libuau.h"
#include "network.h"
#include "error.h"
#include "util.h"
#include "install.h"
#include "ftp.h"
Go to the source code of this file.
Functions | |
int | compareAlphaNumeric (const char *v1, const char *v2) |
void | categorizeUpdates (GPtrArray *updates, const AProgInfo *progInfo) |
gboolean | isIncompatible (AUpdate *update, const AProgInfo *progInfo) |
gboolean | isOld (AUpdate *update, const AProgInfo *progInfo) |
gboolean | luau_getUpdateInfo (AUpdate *updateInfo, const char *updateID, const AProgInfo *progInfo) |
Retrieve update info (type, description, etc.) corresponding to the given ID (and program). | |
GPtrArray * | luau_checkForUpdates (const AProgInfo *info) |
Retrieve any new updates for the specified program. | |
gboolean | luau_installUpdate (const AProgInfo *info, const AUpdate *newUpdate, const APkgType type) |
Download and install an update of type type . | |
char * | luau_downloadUpdate (const AProgInfo *info, const AUpdate *newUpdate, const APkgType type, const char *downloadTo) |
Download but do not install an update of type type to filename . | |
gboolean | luau_installPackage (const char *filename, const APkgType type) |
Install an already downloaded package. | |
void | luau_registerErrorFunc (AErrorFunc errorFunc) |
Set a new function for outputting errors with. | |
void | luau_registerPromptFunc (APromptFunc promptFunc) |
Set a new function for prompting the user for input with. | |
void | luau_registerProgressCallback (AProgressCallback callback) |
Set a new function to callback (in order to show download progress) when downloading. | |
void | luau_resetErrorFunc (void) |
Reset the error function to the default function. | |
void | luau_resetPromptFunc (void) |
Reset the prompting function to the default function. | |
void | luau_resetProgressCallback (void) |
Reset the download callback function to the default function. | |
APackage * | luau_getUpdatePackage (const AUpdate *update, APkgType pkgType) |
Find the package of type pkgType in update . | |
char * | luau_dateString (const ADate *date) |
Convert an ADate struct into a string. | |
gboolean | luau_parseDate (ADate *date, const char *string) |
Convert a date string ("MM/DD/YYYY") into an ADate struct. | |
int | luau_datecmp (ADate *d1, ADate *d2) |
Compare two dates (works like strcmp but for ADate's). | |
int | luau_versioncmp (const char *required, const char *current) |
Compare two versions (works like strcmp but for version strings). | |
gboolean | luau_isOfType (APkgType query, APkgType type) |
Check if package type type is included in package aggregate query . | |
char * | luau_multPackageTypeString (APkgType types) |
Convert an APkgType (of many types) into a string. | |
const char * | luau_packageTypeString (APkgType type) |
Convert an APkgType (of one type) into a (constant) string. | |
APkgType | luau_parsePkgType (const char *typeString) |
Convert a package type string into an APkgType. | |
char * | luau_getPackageURL (APackage *pkgInfo) |
GSList * | luau_packageTypeList (APkgType types) |
Convert an APkgType into a list of APkgType's. | |
const char * | luau_updateTypeString (AUpdateType type) |
Convert an AUpdateType into a string. | |
char * | luau_progInfoString (const AProgInfo *info) |
Convert an AProgInfo ptr into a string. | |
char * | luau_keywordsString (const GPtrArray *keywords) |
Convert an array of keywords into a string. | |
void | luau_setKeyword (GPtrArray *keywords, const char *newKeyword) |
Sets a keyword. | |
gboolean | luau_unsetKeyword (GPtrArray *keywords, const char *oldKeyword) |
Unsets a keyword. | |
gboolean | luau_checkKeyword (const GPtrArray *keywords, const char *needle) |
Checks to see if a keyword is set. | |
gboolean | luau_isIncompatible (AUpdate *update) |
See if an update has been marked as "Incompatible". | |
gboolean | luau_isHidden (AUpdate *update) |
See if an update has been marked as "Hidden". | |
gboolean | luau_isOld (AUpdate *update) |
See if an update has been marked as "Old". | |
gboolean | luau_isVisible (AUpdate *update) |
See if an updates is visible (has not been marked as old, hidden, or incompatible). | |
gboolean | luau_satisfiesInterface (const AInterface *wanted, const AInterface *needed) |
Check if a given interface matches an interface that is needed. | |
gboolean | luau_satisfiesQuant (const AQuantifier *needed, const AProgInfo *installed) |
AQuantDataType | luau_parseQuantDataType (const char *str) |
gboolean | luau_parseInterface (AInterface *interface, const char *intStr) |
Convert an interface string ("x.y") into an AInterface. | |
char * | luau_interfaceString (const AInterface *interface) |
Convert an AInterface into a string. | |
void | luau_copyUpdate (AUpdate *dest, const AUpdate *src) |
Copy an AUpdate struct. | |
void | luau_copyPackage (APackage *dest, const APackage *src) |
Copy an APackage struct. | |
void | luau_copyProgInfo (AProgInfo *dest, const AProgInfo *src) |
Copy an AProgInfo struct. | |
void | luau_copyInterface (AInterface *dest, const AInterface *src) |
Copy an AInterfacestruct. | |
void | luau_copyDate (ADate *dest, const ADate *src) |
Copy an ADate struct. | |
void | luau_copyQuants (GPtrArray *dest, const GPtrArray *src) |
Copy an array of AQuantifiers. | |
void | luau_copyQuant (AQuantifier *dest, const AQuantifier *src) |
Copy an AQuantifier struct. | |
void | luau_freeUpdateArray (GPtrArray *updates) |
Free an array of AUpdate's. | |
void | luau_freeProgInfo (AProgInfo *ptr) |
Free an AProgInfo struct pointer. | |
void | luau_freeUpdateInfo (AUpdate *ptr) |
Free an AUpdate struct pointer. | |
void | luau_freePkgInfo (APackage *ptr) |
Free an APackage struct pointer. |
|
Take an updates array and apply the appropriate internal keywords ("_hidden" and/or "_incompatible") to them.
Definition at line 1432 of file libuau.c. References isIncompatible(), isOld(), AUpdate::keywords, and luau_setKeyword(). Referenced by luau_checkForUpdates(). |
|
Definition at line 1348 of file libuau.c. Referenced by luau_versioncmp(). |
|
Check if an update for the specified program is incompatible with the program in question.
Definition at line 1457 of file libuau.c. References luau_satisfiesQuant(), and AUpdate::quantifiers. Referenced by categorizeUpdates(). |
|
Definition at line 1479 of file libuau.c. References luau_versioncmp(), AUpdate::newVersion, and AProgInfo::version. Referenced by categorizeUpdates(). |
|
Retrieve any new updates for the specified program. Check for updates for the given ID by contacting the server for the program and downloading and parsing the updates file. Returned GPtrArray must be free'd (use luau_freeUpdateArray).
Definition at line 101 of file libuau.c. References categorizeUpdates(), DBUGOUT, AProgInfo::id, luau_net_queryServer(), and AProgInfo::url. Referenced by luau_getUpdateInfo(). |
|
Checks to see if a keyword is set. See if a keyword exists in a keyword array.
Definition at line 821 of file libuau.c. References g_container_free(), g_container_new_from_data(), GCONT_PTR_ARRAY, and lutil_findString(). Referenced by luau_isHidden(), luau_isIncompatible(), luau_isOld(), and luau_satisfiesQuant(). |
|
Copy an ADate struct.
Copy an ADate
Definition at line 1177 of file libuau.c. References ADate::day, DBUGOUT, ADate::month, and ADate::year. Referenced by luau_copyProgInfo(), luau_copyQuant(), and luau_copyUpdate(). |
|
Copy an AInterfacestruct.
Copy an AInterface
Definition at line 1161 of file libuau.c. References DBUGOUT, AInterface::major, and AInterface::minor. Referenced by luau_copyProgInfo(), and luau_copyUpdate(). |
|
Copy an APackage struct.
Definition at line 1086 of file libuau.c. References DBUGOUT, APackage::md5sum, APackage::mirrors, APackage::size, and APackage::type. Referenced by luau_copyUpdate(). |
|
Copy an AProgInfo struct.
Copy an AProgInfo
Definition at line 1121 of file libuau.c. References AProgInfo::date, DBUGOUT, AProgInfo::desc, AProgInfo::fullname, g_container_copy(), g_container_free(), g_container_new_from_data(), GCONT_PTR_ARRAY, AProgInfo::id, AProgInfo::interface, AProgInfo::keywords, luau_copyDate(), luau_copyInterface(), AProgInfo::shortname, AProgInfo::url, and AProgInfo::version. |
|
Copy an AQuantifier struct.
Definition at line 1200 of file libuau.c. References AQuantifier::data, AQuantifier::dtype, ERROR, luau_copyDate(), LUAU_QUANT_DATA_DATE, LUAU_QUANT_DATA_INTERFACE, LUAU_QUANT_DATA_KEYWORD, LUAU_QUANT_DATA_VERSION, and AQuantifier::qtype. Referenced by luau_copyQuants(). |
|
Copy an array of AQuantifiers.
Definition at line 1188 of file libuau.c. References luau_copyQuant(). Referenced by luau_copyUpdate(). |
|
Copy an AUpdate struct.
Copy an AUpdate
Definition at line 1019 of file libuau.c. References AUpdate::availableFormats, AUpdate::date, DBUGOUT, AUpdate::fullDesc, g_container_copy(), g_container_free(), g_container_new_from_data(), GCONT_PTR_ARRAY, AUpdate::id, AUpdate::interface, AUpdate::keywords, luau_copyDate(), luau_copyInterface(), luau_copyPackage(), luau_copyQuants(), AUpdate::newURL, AUpdate::newVersion, AUpdate::packages, AUpdate::quantifiers, AUpdate::shortDesc, and AUpdate::type. Referenced by luau_getUpdateInfo(). |
|
Compare two dates (works like
Compare two dates and return an integer accordingly (in style of
Definition at line 421 of file libuau.c. References ADate::day, lutil_intcmp(), ADate::month, and ADate::year. Referenced by luau_satisfiesQuant(). |
|
Convert an ADate struct into a string.
Convert an ADate into a string ("MM/DD/YYYY"). Returns "(null)" if
Definition at line 373 of file libuau.c. References ADate::day, lutil_mprintf(), ADate::month, and ADate::year. Referenced by luau_progInfoString(). |
|
Download but do not install an update of type
Download an update to the specified location. Returned string must be examined and must be free'd. Do not assume that the update was downloaded exactly to
Definition at line 152 of file libuau.c. References DBUGOUT, ERROR, luau_getPackageURL(), luau_getUpdatePackage(), luau_net_downloadUpdate(), lutil_error_prompt(), and lutil_vstrcreate(). Referenced by luau_installUpdate(). |
|
Free an APackage struct pointer. Free an APackage struct.
Definition at line 1323 of file libuau.c. References ERROR, and APackage::mirrors. Referenced by luau_freeUpdateInfo(). |
|
Free an AProgInfo struct pointer. Free an AProgInfo struct.
Definition at line 1251 of file libuau.c. References AProgInfo::date, AProgInfo::desc, AProgInfo::displayVersion, ERROR, AProgInfo::fullname, AProgInfo::id, AProgInfo::keywords, nnull_g_free, AProgInfo::shortname, AProgInfo::url, and AProgInfo::version. |
|
Free an array of AUpdate's. Free an update array, as returned by luau_checkForUpdates
Definition at line 1230 of file libuau.c. References luau_freeUpdateInfo(). Referenced by luau_getUpdateInfo(). |
|
Free an AUpdate struct pointer. Free an AUpdate struct
Definition at line 1278 of file libuau.c. References AQuantifier::data, AUpdate::date, ERROR, AUpdate::fullDesc, AUpdate::id, AUpdate::keywords, luau_freePkgInfo(), AUpdate::newURL, AUpdate::newVersion, nnull_g_free, AUpdate::packages, AUpdate::quantifiers, and AUpdate::shortDesc. Referenced by luau_freeUpdateArray(). |
|
Definition at line 656 of file libuau.c. References DBUGOUT, and APackage::mirrors. Referenced by luau_downloadUpdate(), and luau_net_downloadUpdate(). |
|
Retrieve update info (type, description, etc.) corresponding to the given ID (and program).
Retrieve information for update
Definition at line 71 of file libuau.c. References AUpdate::id, luau_checkForUpdates(), luau_copyUpdate(), luau_freeUpdateArray(), and lutil_streq(). |
|
Find the package of type
Find and return an APackage struct of the type
Definition at line 344 of file libuau.c. References ERROR, luau_packageTypeString(), AUpdate::packages, and APackage::type. Referenced by luau_downloadUpdate(). |
|
Install an already downloaded package. Installs a package that has already been downloaded.
Definition at line 223 of file libuau.c. References ERROR, LUAU_AUTOPKG, LUAU_DEB, LUAU_EXEC, luau_install_autopkg(), luau_install_deb(), luau_install_exec(), luau_install_rpm(), luau_install_src(), LUAU_RPM, and LUAU_SRC. Referenced by luau_installUpdate(). |
|
Download and install an update of type Install an update.
Definition at line 122 of file libuau.c. References luau_downloadUpdate(), luau_installPackage(), and lutil_getTempFilename(). |
|
Convert an AInterface into a string. Take an AInterface struct and convert it into a string of form "x.y", where x is the major and y the minor interface version. If the major and minor values are both -1, then NULL will be returned. The returned string is allocated dynamically and must be free'd.
Definition at line 998 of file libuau.c. References lutil_mprintf(), AInterface::major, and AInterface::minor. |
|
See if an update has been marked as "Hidden". Check if an update has been marked as "hidden"
Definition at line 857 of file libuau.c. References AUpdate::keywords, and luau_checkKeyword(). Referenced by luau_isVisible(). |
|
See if an update has been marked as "Incompatible". Check if an update has been marked as "incompatible"
Definition at line 843 of file libuau.c. References AUpdate::keywords, and luau_checkKeyword(). Referenced by luau_isVisible(). |
|
Check if package type
Check to see if
Definition at line 561 of file libuau.c. Referenced by luau_multPackageTypeString(), and luau_packageTypeList(). |
|
See if an update has been marked as "Old".
Definition at line 865 of file libuau.c. References AUpdate::keywords, and luau_checkKeyword(). Referenced by luau_isVisible(). |
|
See if an updates is visible (has not been marked as old, hidden, or incompatible).
Definition at line 873 of file libuau.c. References luau_isHidden(), luau_isIncompatible(), and luau_isOld(). |
|
Convert an array of keywords into a string. Convert an array of keywords into a string, separated by commas. Resultant string must be free'd.
Definition at line 760 of file libuau.c. References g_container_free(), g_container_new_from_data(), GCONT_PTR_ARRAY, and lutil_strjoin(). Referenced by luau_progInfoString(). |
|
Convert an APkgType (of many types) into a string. Convert an APkgType of multiple package types into a string. Resultant string must be free'd.
Definition at line 575 of file libuau.c. References ERROR, LUAU_AUTOPKG, LUAU_DEB, LUAU_EMPTY, LUAU_EXEC, luau_isOfType(), LUAU_RPM, LUAU_SRC, and lutil_createString(). |
|
Convert an APkgType into a list of APkgType's. Take an APkgType of multiple types and convert it into a list of single APkgType's.
Definition at line 697 of file libuau.c. References LUAU_AUTOPKG, LUAU_DEB, LUAU_EXEC, luau_isOfType(), LUAU_RPM, and LUAU_SRC. |
|
Convert an APkgType (of one type) into a (constant) string. Convert an APkgType of one package type into a string. Resultant string should not be free'd (constant string).
Definition at line 613 of file libuau.c. References LUAU_AUTOPKG, LUAU_DEB, LUAU_EMPTY, LUAU_EXEC, LUAU_RPM, and LUAU_SRC. Referenced by luau_getUpdatePackage(). |
|
Convert a date string ("MM/DD/YYYY") into an ADate struct.
Convert a string of format "MM/DD/YYYY" into an ADate. If
Definition at line 394 of file libuau.c. References ADate::day, ADate::month, and ADate::year. Referenced by parseGenericInfo(), and parseQuantData(). |
|
Convert an interface string ("x.y") into an AInterface.
Take a string ("x.y", where x is the major and y the minor interface version)and convert it into an AInterface, writing the data into
Definition at line 970 of file libuau.c. References lutil_isCompletelyBlank(), AInterface::major, and AInterface::minor. Referenced by luau_parseUpdateFileXML(), parseQuantData(), and parseSoftware(). |
|
Convert a package type string into an APkgType. Take a string representing a package type ("RPM", "DEB", etc.) and convert it into an APkgType.
Definition at line 644 of file libuau.c. References APkgType, LUAU_AUTOPKG, LUAU_DEB, LUAU_EXEC, LUAU_RPM, LUAU_SRC, LUAU_UNKNOWN, and lutil_streq(). Referenced by parsePackage(). |
|
Definition at line 942 of file libuau.c. References AQuantDataType, LUAU_QUANT_DATA_DATE, LUAU_QUANT_DATA_INTERFACE, LUAU_QUANT_DATA_INVALID, LUAU_QUANT_DATA_KEYWORD, LUAU_QUANT_DATA_VERSION, and lutil_strcaseeq(). Referenced by parseGenericInfo(). |
|
Convert an AProgInfo ptr into a string. Convert an AProgInfo struct into a string. Resultant string must be free'd.
Definition at line 738 of file libuau.c. References AProgInfo::date, AProgInfo::desc, AProgInfo::fullname, AProgInfo::id, AProgInfo::keywords, luau_dateString(), luau_keywordsString(), lutil_mprintf(), AProgInfo::url, and AProgInfo::version. |
|
Set a new function for outputting errors with. Set the function to display luau errors with. See the definition of AErrorFunc for specific function parameters.
Definition at line 262 of file libuau.c. References lutil_error_setErrorFunc(). |
|
Set a new function to callback (in order to show download progress) when downloading. Set the function to display download progress with. See the definition of AProgressFunc for specific function parameters (and maybe the libcurl documentation too while you're at it - specifically the CURLOPT_PROGRESSFUNC option). Default behavior is not to display anything.
Definition at line 292 of file libuau.c. References lutil_ftp_setCallbackFunc(). |
|
Set a new function for prompting the user for input with. Set the function to prompt the user for input with. See the definition of APromptFunc for specific function parameters. Note that the default behavior (if you don't define a new one) is simply not to prompt the user and select the default choice. This is probably not what you want!
Definition at line 277 of file libuau.c. References lutil_error_setPromptFunc(). |
|
Reset the error function to the default function. Reset the error facilities to their default behavior (that is, simply displaying errors to the command line).
Definition at line 303 of file libuau.c. References lutil_error_resetErrorFunc(). |
|
Reset the download callback function to the default function. Reset the progress callback (which doesn't display anything).
Definition at line 324 of file libuau.c. References lutil_ftp_resetCallbackFunc(). |
|
Reset the prompting function to the default function. Reset the prompting facilities to their default behavior (that is, don't ask but just select the default option).
Definition at line 314 of file libuau.c. References lutil_error_resetPromptFunc(). |
|
Check if a given interface matches an interface that is needed. Check if a given program/update interface satisfies the one needed. Conditions for being satisfactory:
Definition at line 890 of file libuau.c. References AInterface::major, and AInterface::minor. Referenced by luau_parseUpdateFileXML(), and luau_satisfiesQuant(). |
|
Definition at line 895 of file libuau.c. References AQuantifier::data, AProgInfo::date, AQuantifier::dtype, ERROR, AProgInfo::interface, AProgInfo::keywords, luau_checkKeyword(), luau_datecmp(), LUAU_QUANT_DATA_DATE, LUAU_QUANT_DATA_INTERFACE, LUAU_QUANT_DATA_KEYWORD, LUAU_QUANT_DATA_VERSION, LUAU_QUANT_FOR, LUAU_QUANT_FROM, LUAU_QUANT_TO, luau_satisfiesInterface(), luau_versioncmp(), AQuantifier::qtype, and AProgInfo::version. Referenced by isIncompatible(). |
|
Sets a keyword. Add a new keyword to a keyword array.
Definition at line 782 of file libuau.c. Referenced by categorizeUpdates(). |
|
Unsets a keyword. Remove a keyword from a keyword array. Return if it was there in the first place.
Definition at line 796 of file libuau.c. References lutil_streq(). |
|
Convert an AUpdateType into a string. Convert an AUpdateType into a constant string. Resultant string should not be free'd.
Definition at line 722 of file libuau.c. References LUAU_LIBUPDATE, LUAU_MESSAGE, and LUAU_SOFTWARE. |
|
Compare two versions (works like
Definition at line 473 of file libuau.c. References compareAlphaNumeric(), g_container_destroy(), g_container_index(), GContainer::len, lutil_containsAlpha(), lutil_gsplit(), lutil_streq(), and lutil_strToLower(). Referenced by isOld(), and luau_satisfiesQuant(). |