summaryrefslogtreecommitdiffstats
path: root/src/pacman/util.c
AgeCommit message (Collapse)AuthorFilesLines
2008-03-23strsplit(): memleak fixDan McGee1-1/+1
We dup-ed the string but then duped it again. Fix it. Signed-off-by: Dan McGee <dan@archlinux.org>
2008-02-24Add some NULL checks into recently modified output functionsDan McGee1-8/+15
After a merge with master where some strings we print (such as descriptions) could be NULL, a few segfaults popped up due to strlen() calls on null pointers. Fix this by doing some preemptive checks and returning from functions early if the string was null. Signed-off-by: Dan McGee <dan@archlinux.org>
2008-02-23A few more wide character output fixesDan McGee1-19/+43
Fix up the indentprint and list printing functions so they work properly. This output can be seen in places such as -Ss, -Si, -Qs, and -Qi. Signed-off-by: Dan McGee <dan@archlinux.org>
2008-02-06pacman/util.c: add mdirname functionDan McGee1-0/+28
This function mirrors mbasename and will be used by the 'owns' machinery. Signed-off-by: Dan McGee <dan@archlinux.org>
2008-01-20Remove frontend translation of "debug:" messageDan McGee1-2/+2
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-12-11Update GNU GPL boilerplate and copyright datesDan McGee1-4/+2
Update the GPL boilerplate to direct people to the GNU website for a copy of the license, as well as bump all of Judd's copyrights to 2007. Signed-off-by: Dan McGee <dan@archlinux.org>
2007-12-04Delay output during progress barChantry Xavier1-0/+35
This fixes the output issue related to the progress bar by delaying the output. We can decide later (post-release) if we like this method or we want to switch to something else. Signed-off-by: Chantry Xavier <shiningxc@gmail.com> [Dan: just some minor cleanups] Signed-off-by: Dan McGee <dan@archlinux.org>
2007-12-01Unify dump_pkg_full in pacman [-Si, -Qip, -Qi and -Qii]Nagy Gabor1-0/+10
dump_pkg_sync is now a trivial wrapper for dump_pkg_full Some smaller changes: * string_display function added to util.c [prints None in case of empty string] * Filename field added to -Qip * rename License to Licenses * 'Compressed Size' used instead of 'Download Size' for -Qip Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu> [Dan: fix whitespace errors, spacing issues, const modifiers] Signed-off-by: Dan McGee <dan@archlinux.org>
2007-11-25Move mbasename from pacman.c to util.cChantry Xavier1-0/+22
This function can be useful in other places. Signed-off-by: Chantry Xavier <shiningxc@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
2007-11-17War on whitespaceDan McGee1-7/+7
Run the kernel's cleanfile script on all of our source files. Signed-off-by: Dan McGee <dan@archlinux.org>
2007-11-14Make it easier to ignore multiple packages.Nathan Jones1-0/+34
This makes --ignore and --ignoregroup able to accept multiple packages/groups by separating each with a comma. For instance: pacman -Su --ignore kernel26,udev,glibc This was requested in the comments of FS#8054. Signed-off-by: Nathan Jones <nathanj@insightbb.com> Signed-off-by: Dan McGee <dan@archlinux.org>
2007-11-11Remove 'Total Package Size'Dan McGee1-7/+3
Having 'Total Installed Size' and 'Total Download Size' makes this size unnecessary. Signed-off-by: Dan McGee <dan@archlinux.org>
2007-11-11Add a missing newline in sync confirmation outputDan McGee1-0/+1
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-11-04Clean up usage of extern variablesDan McGee1-2/+0
Instead of declaring the extern variable in every *.c file, include it in the header file that makes sense. This means handle.h for the handle, and conf.h for the pacman side config object. Signed-off-by: Dan McGee <dan@archlinux.org>
2007-10-24Add strndup implemention for environments that are missing itDan McGee1-0/+22
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-10-23Fix broken or missing includesDan McGee1-0/+1
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-10-20Add download size to target list.Nathan Jones1-4/+8
This displays the download size, taking into account delta files and cached files. This closes FS#4182. Signed-off-by: Nathan Jones <nathanj@insightbb.com> Signed-off-by: Dan McGee <dan@archlinux.org>
2007-10-16Remove rounding on package size totalsDan McGee1-14/+2
We print the total to two decimal places, so there is no real need for rounding of the values. Remove the rounding and switch all output to two decimal places. Signed-off-by: Dan McGee <dan@archlinux.org>
2007-10-05Fix -Sy and -Sp operations.Chantry Xavier1-2/+1
When the -Sy operation failed, the lock wasn't removed because alpm_trans_release wasn't called. This is fixed now. Also, after my last change in commit 52e7e6d74733f7a431376a9e528c4fe4d3732068 , Sp didn't do anything anymore. That's because needs_transaction returned false for -Sp, so the sync transaction wasn't run. However, the current implementation of -Sp requires a sync transaction. Also, since a transaction creates the lock file at the beginning, and releases it at the end, this mean that -Sp requires root access anyway.. I think I understand now why Aaron found that the current -Sp implementation is hackish :) Signed-off-by: Chantry Xavier <shiningxc@gmail.com> Signed-off-by: Aaron Griffin <aaronmgriffin@gmail.com>
2007-10-04needs_transaction adjustmentsChantry Xavier1-4/+1
I just moved the root path check out of needs_transaction, and put it directly in pacman.c . I think this part is alright. For the other problems, I thought about doing the transaction first, in a new sync trans function, which will init and release a transaction. And then doing the commands like -Ss / -Sl / -Sg / -Si. The problem is that for commands like -Sys / -Syl / etc, only the refresh part of the transaction should be done. So I had to introduce an ugly sync_only hack. Signed-off-by: Aaron Griffin <aaronmgriffin@gmail.com>
2007-09-28Break out transaction test to a separate functionAaron Griffin1-0/+19
Added needs_transaction, putting out "hey do we need root?" tests in one place. Signed-off-by: Aaron Griffin <aaronmgriffin@gmail.com>
2007-09-07Add a few missing includes, caught while compiling on cygwinDan McGee1-0/+1
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-08-24libalpm: add newlines to all strings passed to log callbackDan McGee1-2/+0
This allows us to remove the hack in the frontend where we added a newline to everything coming out of the pm_printf functions, and instead let the developer put newlines where they want them. This should be the last hangover of that auto-newline stuff. Signed-off-by: Dan McGee <dan@archlinux.org>
2007-08-16Fix some errors spit out by -WextraDan McGee1-1/+1
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-07-11Use mbstowcs instead of strlen where applicableSergej Pupykin1-3/+3
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-06-09Add a series of pm_printf functions to pacman frontendDan McGee1-7/+80
Add pm_printf, pm_fprintf, and pm_vfprintf to the pacman frontend for use by debug printing and other output messages from pacman. These will be incorporated into the log callback functions in the next iteration of changes. Signed-off-by: Dan McGee <dan@archlinux.org>
2007-06-05Const correctness!Dan McGee1-4/+4
Add some 'const' keywords all over the code to make it a bit more strict on what you can and can't do with data. This is especially important when we return pointers to the pacman frontend- ideally this would always be untouchable data. Signed-off-by: Dan McGee <dan@archlinux.org>
2007-06-05Rip alpm_parse_config out of libalpmDan McGee1-2/+2
Switch over to the new frontend parseconfig. * Fix a few issues in parseconfig * Remove unused callback upon database registration * Remove conf file related errors from error.c/alpm.h Signed-off-by: Dan McGee <dan@archlinux.org>
2007-06-05Add a parseconfig to the pacman frontend that compilesDan McGee1-1/+56
Warning: this compiles but may not work as intended quite yet. :) Signed-off-by: Dan McGee <dan@archlinux.org>
2007-06-01Change -z|--showsize flag to ShowSize pacman.conf optionNathan Jones1-1/+2
Also cleaned up some duplicate printf lines related to the ShowSize option. Signed-off-by: Nathan Jones <nathanj@insightbb.com> Signed-off-by: Dan McGee <dan@archlinux.org>
2007-05-31Move DB and cache dirs away from there dependence on ROOTDIRDan McGee1-2/+2
This change allows us to use all autoconf specified paths, most notably $(localstatedir). It is quite a change and touches a lot of files, as all references to the DB and cache were done with the ROOTDIR as a prefix. * add --lock command-line option to pacman to specify the location of the lockfile (this can now be specified at configure time by setting the $localstatedir path). * Rip quite a few settings out of configure.ac as they are now picked by setting the paths during configure or make. * Fix bug with /tmp fallback for sync downloads not working correctly (related to root location, now the system tmp dir is used). * Simplified the parameters to some libalpm functions, and added get/set for the new lockfile option. * Renamed several of the DEFS to names without the PM_ prefix. Signed-off-by: Dan McGee <dan@archlinux.org>
2007-05-14Remove unnecessary casts on malloc and elsewhereDan McGee1-1/+1
We had many unnecessary casts, most of them dealing with malloc and other memory allocations. The variable type should take care of it; no need to do it explicitly. In addition, I caught a const error while removing the casts. Signed-off-by: Dan McGee <dan@archlinux.org>
2007-05-14Display size for packagesNathan Jones1-7/+17
This patch adds a -z|--showsize option to the -Q and -S commands. The option displays the size of individual packages. This is something that I have wanted for a while, and there is a feature request for it. Signed-off-by: Nathan Jones <nathanj@insightbb.com> Signed-off-by: Dan McGee <dan@archlinux.org>
2007-04-27Remove output.c and output.hDan McGee1-1/+34
One function was left in this set of files after the earlier cleansing, so I moved yesno to util.c. Signed-off-by: Dan McGee <dan@archlinux.org>
2007-04-27Start of the newline fixes after switching over the outputDan McGee1-36/+0
* A few quick newline fixes, mostly related to sync operations. * Moved get_update_timediff to callback.c as it is not used outside of that file. Signed-off-by: Dan McGee <dan@archlinux.org>
2007-04-26Remove MSG output macro (#define and in code)Dan McGee1-10/+13
This is the first step of converting output to standard functions such as printf, and eventually allowing compiliation with the -pedantic flag as is done on the libalpm side. Signed-off-by: Dan McGee <dan@archlinux.org>
2007-04-26Move log.c/h -> output.c/h to properly reflect what is containedDan McGee1-1/+1
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-04-26Pacman side code consolidation- unify callback functions to one fileDan McGee1-67/+0
Some more major code reorginization here. The download progress callback function has been renamed and moved to callback.c, which is the former trans.c with the download and log callbacks added. In addition, this allows util.c to be cleaned up as fill_progress can now be static in callback.c. We've also cut two more source files out. Signed-off-by: Dan McGee <dan@archlinux.org>
2007-04-26More pacman side cleanupDan McGee1-8/+2
* Cleaned up more of the header #includes, and got rid of a lot of stuff that was due to trying to make it compile on BSD/Darwin/CYGWIN. We can add it later but lets keep it simple for now and do it in seperate files if possible later. * Removed a lot of #define MACROS. Some were not even used, and others were only used a few times. Signed-off-by: Dan McGee <dan@archlinux.org>
2007-04-25Remove more unnecessary stuffDan McGee1-1/+0
* Remove libintl.h from most files, as we only need to include it once in util.h where _() is defined. * Remove other unnecessary header inclusions. * Remove a macro that was only used once and replaced it with actual code. Signed-off-by: Dan McGee <dan@archlinux.org>
2007-03-13* Resizing terminal while progress bars were displayed caused some weirdDan McGee1-34/+42
issues, this should fix it. Progress bars now go from displaying, to showing percent only, to not displaying at all. Changed unsigned -> signed to prevent wraparound errors in integer comparison.
2007-03-05This commit looks much more monumental than it is. Almost all just #includeDan McGee1-2/+3
reordering and adding ones that were forgotten (noticed when trying to compile after reordering). * Updated the HACKING file to include information on #include usage. * print -> vprint in "making dir" function in pactest.
2007-02-26* pacman hidden arguments: removed -Y and -D. -T is the only hidden arg now, toAaron Griffin1-2/+7
be used in place of -Y. Also, -D was rather silly, as it does mostly what -S does. * Cleaned up pacman_deptest - removed the goofy faketarget stuff (NEEDS testing still) * libalpm function renames
2007-02-10Cleaned up some more outputAaron Griffin1-1/+3
* Questions no longer start with "error:" * downloaded size is output as a float now
2007-02-08* Hopefully fixed the download progres bar for real. We should no longerDan McGee1-32/+39
have issues with crazy speeds being displayed. * Minor string updates to remove unnecessary 1-off translations.
2007-02-04Implemented a crappy version of -Qu (query upgrades). This simply outputs theAaron Griffin1-2/+2
packages to be upgraded in a -Su operation. Much of the code is duplicated from sync.c. TODO: move the implementation to upgrades.c, and reimplement the sync_sysupgrade function in terms of this: trans->packages = alpm_get_upgrades();
2007-02-04* unified the progress bars (fill_progress function)Aaron Griffin1-0/+162
* fixed progress output (needs an fflush to move cursor properly) * broke display_targets function out, to display a list of syncpkgs in preparation for a -Qu option * added get_update_time function to deal with progress functions that shouldn't update too fast due to output redraw speeds
2007-02-01* Tried to clean up newline display a bit in the frontend.Dan McGee1-29/+3
* Removed useless buildstring function from util.h; replaced all calls of it with list_display. * Made list_display output 2 spaces instead of 1 between each item.
2007-01-26Dan McGee <dpmcgee@gmail.com>Aaron Griffin1-1/+1
* Lots of code cleanup, and type fixes * Make 'makeworld' a bit more in-line with the other stuff * Make -Si and -Qi operations appear the same
2007-01-24Cleanup 'neednl' usage - make it staticAaron Griffin1-1/+0