"\nVersion: " VERSION " (" BDATE ") %s %s %s\n\n"
"Usage: bconsole [-s] [-c config_file] [-d debug_level]\n"
" -D <dir> select a Director\n"
+" -l list Directors defined\n"
" -c <file> set configuration file to file\n"
" -d <nn> set debug level to <nn>\n"
" -dt print timestamp in debug output\n"
if (numdir == 1) { /* No choose */
dir = (DIRRES *)GetNextRes(R_DIRECTOR, NULL);
-
- } else if (director) { /* Command line choice */
+ }
+
+ if (director) { /* Command line choice overwrite the no choose option */
LockRes();
foreach_res(dir, R_DIRECTOR) {
if (bstrcmp(dir->hdr.name, director)) {
}
}
UnlockRes();
+ if (!dir) { /* Can't find Director used as argument */
+ senditf(_("Can't find %s in Director list\n"), director);
+ return 0;
+ }
}
if (!dir) { /* prompt for director */
{
int ch;
char *director=NULL;
+ bool list_directors=false;
bool no_signals = false;
bool test_config = false;
JCR jcr;
working_directory = "/tmp";
args = get_pool_memory(PM_FNAME);
- while ((ch = getopt(argc, argv, "bc:d:nstu:D:?")) != -1) {
+ while ((ch = getopt(argc, argv, "D:lbc:d:nstu:?")) != -1) {
switch (ch) {
case 'D': /* Director */
if (director) {
director = bstrdup(optarg);
break;
+ case 'l':
+ list_directors = true;
+ test_config = true;
+ break;
+
case 'c': /* configuration file */
if (configfile != NULL) {
free(configfile);
con_init(stdin);
}
+ if (list_directors) {
+ LockRes();
+ foreach_res(dir, R_DIRECTOR) {
+ senditf("%s\n", dir->hdr.name);
+ }
+ UnlockRes();
+ }
+
if (test_config) {
terminate_console(0);
exit(0);