Add -q option to tix-install(8).

This commit is contained in:
Jonas 'Sortie' Termansen 2017-04-10 16:03:36 +02:00
parent 7bc9e067ec
commit 8d66162301
1 changed files with 7 additions and 1 deletions

View File

@ -150,6 +150,7 @@ static void version(FILE* fp, const char* argv0)
static char* collection = NULL; static char* collection = NULL;
static bool reinstall = false; static bool reinstall = false;
static bool quiet = false;
static char* tix_directory_path = NULL; static char* tix_directory_path = NULL;
static int generation; static int generation;
static const char* coll_prefix; static const char* coll_prefix;
@ -175,6 +176,7 @@ int main(int argc, char* argv[])
char c; char c;
while ( (c = *++arg) ) switch ( c ) while ( (c = *++arg) ) switch ( c )
{ {
case 'q': quiet = true; break;
default: default:
fprintf(stderr, "%s: unknown option -- '%c'\n", argv0, c); fprintf(stderr, "%s: unknown option -- '%c'\n", argv0, c);
help(stderr, argv0); help(stderr, argv0);
@ -188,6 +190,8 @@ int main(int argc, char* argv[])
else if ( GET_OPTION_VARIABLE("--collection", &collection) ) { } else if ( GET_OPTION_VARIABLE("--collection", &collection) ) { }
else if ( !strcmp(arg, "--reinstall") ) else if ( !strcmp(arg, "--reinstall") )
reinstall = true; reinstall = true;
else if ( !strcmp(arg, "--quiet") )
quiet = true;
else else
{ {
fprintf(stderr, "%s: unknown option: %s\n", argv0, arg); fprintf(stderr, "%s: unknown option: %s\n", argv0, arg);
@ -300,7 +304,9 @@ void InstallPackage(const char* tix_path)
"--host=%s\".", coll_platform); "--host=%s\".", coll_platform);
} }
printf("Installing `%s' into `%s'...\n", package_name, collection); if ( !quiet )
printf("Installing `%s' into `%s'...\n", package_name, collection);
char* data_and_prefix = package_prefix && package_prefix[0] ? char* data_and_prefix = package_prefix && package_prefix[0] ?
print_string("data%s", package_prefix) : print_string("data%s", package_prefix) :
strdup("data"); strdup("data");