removed useless getenv() calls
This commit is contained in:
parent
3125ef430f
commit
339bc1de65
1 changed files with 3 additions and 8 deletions
|
@ -37,6 +37,8 @@
|
||||||
/* pacman */
|
/* pacman */
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
|
|
||||||
|
extern int maxcols;
|
||||||
|
|
||||||
/* does the same thing as 'mkdir -p' */
|
/* does the same thing as 'mkdir -p' */
|
||||||
int makepath(char *path)
|
int makepath(char *path)
|
||||||
{
|
{
|
||||||
|
@ -118,15 +120,8 @@ int rmrf(char *path)
|
||||||
void indentprint(char *str, int indent)
|
void indentprint(char *str, int indent)
|
||||||
{
|
{
|
||||||
char *p = str;
|
char *p = str;
|
||||||
char *cenv = NULL;
|
|
||||||
int cols = 80;
|
|
||||||
int cidx = indent;
|
int cidx = indent;
|
||||||
|
|
||||||
cenv = getenv("COLUMNS");
|
|
||||||
if(cenv) {
|
|
||||||
cols = atoi(cenv);
|
|
||||||
}
|
|
||||||
|
|
||||||
while(*p) {
|
while(*p) {
|
||||||
if(*p == ' ') {
|
if(*p == ' ') {
|
||||||
char *next = NULL;
|
char *next = NULL;
|
||||||
|
@ -138,7 +133,7 @@ void indentprint(char *str, int indent)
|
||||||
next = p + strlen(p);
|
next = p + strlen(p);
|
||||||
}
|
}
|
||||||
len = next - p;
|
len = next - p;
|
||||||
if(len > (cols-cidx-1)) {
|
if(len > (maxcols-cidx-1)) {
|
||||||
/* newline */
|
/* newline */
|
||||||
int i;
|
int i;
|
||||||
fprintf(stdout, "\n");
|
fprintf(stdout, "\n");
|
||||||
|
|
Loading…
Add table
Reference in a new issue