diff -rup chkconfig-1.9/chkconfig.c chkconfig-1.9-new/chkconfig.c --- chkconfig-1.9/chkconfig.c 2017-04-07 15:34:37.692467316 -0700 +++ chkconfig-1.9-new/chkconfig.c 2017-04-07 15:39:56.900460105 -0700 @@ -841,17 +841,29 @@ int main(int argc, const char ** argv) { } } 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 (isXinetdEnabled()) 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) {