diff options
author | Aaron Griffin <aaron@archlinux.org> | 2006-11-20 10:10:23 +0100 |
---|---|---|
committer | Aaron Griffin <aaron@archlinux.org> | 2006-11-20 10:10:23 +0100 |
commit | aa1c0ba9f8787fc3b1a1190103e394b0c1c95922 (patch) | |
tree | ed0c9675f7fc5da043a69b36e0b8c6c8e05cb583 /src/pacman/util.c | |
parent | b8b9596b13de957566211b0e1db3e473ed66e147 (diff) | |
download | pacman-aa1c0ba9f8787fc3b1a1190103e394b0c1c95922.tar.gz pacman-aa1c0ba9f8787fc3b1a1190103e394b0c1c95922.tar.xz |
* repo-add script - to add entries to a db file directly from package data (no PKGBUILD)
* libalpm api changes - move from a _getinfo(p, WHAT_WE_WANT) scheme to a
typesafe _get_what_we_want(p) scheme [not 100% complete yet]
* some const correctness changes
* removal of PM_* types in alpm.h in favor of the pm*_t types used throughout
libalpm
Diffstat (limited to 'src/pacman/util.c')
-rw-r--r-- | src/pacman/util.c | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/src/pacman/util.c b/src/pacman/util.c index 8dd0f11d..68f39e38 100644 --- a/src/pacman/util.c +++ b/src/pacman/util.c @@ -49,6 +49,16 @@ extern int maxcols; extern config_t *config; extern int neednl; +/* gets the current screen column width */ +int getcols() +{ + const char *cenv = getenv("COLUMNS"); + if(cenv != NULL) { + return atoi(cenv); + } + return -1; +} + /* does the same thing as 'mkdir -p' */ int makepath(char *path) { @@ -126,14 +136,14 @@ int rmrf(char *path) /* output a string, but wrap words properly with a specified indentation */ -void indentprint(char *str, int indent) +void indentprint(const char *str, int indent) { - char *p = str; + const char *p = str; int cidx = indent; while(*p) { if(*p == ' ') { - char *next = NULL; + const char *next = NULL; int len; p++; if(p == NULL || *p == ' ') continue; |