--- a/chkconfig.c 2015-12-01 18:23:52.047031136 +0000 +++ b/chkconfig.c 2015-12-01 19:01:41.428995360 +0000 @@ -837,17 +837,29 @@ } } rc = readServiceInfo(name, type, &s, 0); - if (rc) + if (rc) { + fprintf(stderr, "%s: unknown service\n", name); return 1; + } if (s.type == TYPE_XINETD) { if (isOn("xinetd",level)) return !s.levels; else return 1; } else { - if (level == -1) + if (level == -1) { level = currentRunlevel(); - return s.currentLevels & (1 << level) ? 0 : 1; + if (level == -1) { + fprintf(stderr, "can not detect the current runlevel\n"); + return 1; + } + } + if (s.currentLevels & (1 << level)) { + printf("%s on\n", name); + } else { + printf("%s off\n", name); + } + return 0; } } else if (!strcmp(state, "on")) { if (!noRedirectItem) {