Permalink
Browse files

Added zenburn colorscheme and uninstall option in Makefile. xlsh now …

…waits for SIGTERM on reboot/shutdown.
  • Loading branch information...
1 parent 4ebbe74 commit 50d8d2958d311a5475376edbbf331d8fd1d32f34 @Nadrin committed Oct 14, 2011
Showing with 42 additions and 31 deletions.
  1. +4 −0 Makefile
  2. +1 −0 README
  3. +3 −3 etc/Xresources
  4. +4 −1 etc/xlshrc
  5. +29 −27 src/xlsh.c
  6. +1 −0 src/xlshd.c
View
@@ -26,6 +26,10 @@ install: all
install -m 644 etc/xlshrc ${CONFDIR}/xlsh
install -m 644 etc/Xresources ${CONFDIR}/xlsh
+uninstall:
+ rm -f ${DESTDIR}/sbin/xlsh
+ rm -f ${DESTDIR}/sbin/xlshd
+
clean:
rm -f xlsh xlshd
View
@@ -19,6 +19,7 @@ Features:
* Only *three* important commands: 'login', 'reboot' and 'shutdown'.
* New commands can be easily added (if you need any) by editing xlsh.c
* Username autocompletion on TAB.
+ * Zenburn color scheme (when run under X).
The only build dependencies are: make, a decent C compiler, libreadline and libpam.
Configuration options can be edited in include/config.h before compiling.
View
@@ -1,5 +1,5 @@
! Default resources for XLSH xterm instance.
-*foreground: white
-*background: black
-*cursorColor: grey90
+*foreground: #FFD7AF
+*background: #1F1F1F
+*cursorColor: #B99B86
*visualBell: off
View
@@ -2,6 +2,7 @@
# XLSH default startup script for X11.
TERMINAL=xterm
XRESFILE=/etc/xlsh/Xresources
+BGCOLOR="rgb:1E/23/1F"
screen_w=$(xwininfo -root | grep Width | cut -f2 -d':')
screen_h=$(xwininfo -root | grep Height | cut -f2 -d':')
@@ -12,5 +13,7 @@ if ! which xlsh; then
xmessage -center 'xlsh cannot be found in PATH!'
exit 1
fi
-[ -f "$XRESFILE" ] && xrdb "$XRESFILE"
+
+xrdb -merge "$XRESFILE"
+xsetroot -solid "$BGCOLOR"
exec $TERMINAL -g 80x24+$px+$py $(which xlsh)
View
@@ -45,7 +45,7 @@ static xlsh_command_t xlsh_commands[] = {
{ "login", " : Logins specified user into the system", xlsh_func_login },
{ "reboot", " : Reboots the system", xlsh_func_reboot },
{ "shutdown", ": Halts the system", xlsh_func_shutdown },
- { "exit", " : Quits login shell", xlsh_func_exit },
+ { "exit", " : Exits (reloads) login shell", xlsh_func_exit },
{ "help", " : Prints all available commands", xlsh_func_help },
{ "version", " : Prints copyright and version information", xlsh_func_version },
{ NULL, NULL, NULL },
@@ -121,7 +121,8 @@ int xlsh_func_reboot(int argc, char** argv)
xlshd_pid = libxlsh_pid_read(XLSHD_PIDFILE);
if(xlshd_pid > 0)
kill(xlshd_pid, SIGTERM);
-
+
+ pause();
return XLSH_EDONE;
}
@@ -138,7 +139,8 @@ int xlsh_func_shutdown(int argc, char** argv)
xlshd_pid = libxlsh_pid_read(XLSHD_PIDFILE);
if(xlshd_pid > 0)
kill(xlshd_pid, SIGTERM);
-
+
+ pause();
return XLSH_EDONE;
}
@@ -285,7 +287,7 @@ int xlsh_session_exec(pam_handle_t* handle, const char* session, const char* arg
const char* pwname;
char terminal[256];
pid_t proc_shell;
- int proc_wait = 0;
+ int proc_wait = 0;
const char* _arg0 = arg0;
if(!arg0) _arg0 = session;
@@ -318,9 +320,9 @@ int xlsh_session_exec(pam_handle_t* handle, const char* session, const char* arg
if(xlsh_X) {
setenv("DISPLAY", xlsh_config[XLSH_ID_DISPLAY].value, 1);
- if(libxlsh_proc_exec(XLSH_XRDB, 0) > 0)
- wait(&proc_wait);
- }
+ if(libxlsh_proc_exec(XLSH_XRDB, 0) > 0)
+ wait(&proc_wait);
+ }
else
setenv("SHELL", session, 1);
@@ -499,27 +501,27 @@ static char* xlsh_cmd_readline(const char* prompt)
static char* xlsh_cmd_match(const char* text, int state)
{
- static size_t index, len;
- char* cmd_name;
-
- if(!state) {
- index = 0;
- len = strlen(text);
- }
- while((cmd_name = (char*)xlsh_commands[index++].name)) {
- if(strncmp(cmd_name, text, len) == 0)
- return strdup(cmd_name);
- }
- return NULL;
+ static size_t index, len;
+ char* cmd_name;
+
+ if(!state) {
+ index = 0;
+ len = strlen(text);
+ }
+ while((cmd_name = (char*)xlsh_commands[index++].name)) {
+ if(strncmp(cmd_name, text, len) == 0)
+ return strdup(cmd_name);
+ }
+ return NULL;
}
static char** xlsh_cmd_complete(const char* text, int start, int end)
{
- if(start == 0)
- return rl_completion_matches((char*)text, xlsh_cmd_match);
- else
- return rl_completion_matches((char*)text,
- rl_username_completion_function);
+ if(start == 0)
+ return rl_completion_matches((char*)text, xlsh_cmd_match);
+ else
+ return rl_completion_matches((char*)text,
+ rl_username_completion_function);
}
int xlsh_cmd_loop(void)
@@ -537,7 +539,7 @@ int xlsh_cmd_loop(void)
xlsh_sys_getinfo(&sysinfo);
snprintf(prompt, 256, XLSH_PROMPT, sysinfo.ttyname);
- rl_attempted_completion_function = xlsh_cmd_complete;
+ rl_attempted_completion_function = xlsh_cmd_complete;
while((line = xlsh_cmd_readline(prompt))) {
cmd_argc = 0;
argptr = strtok(line, " ");
@@ -549,7 +551,7 @@ int xlsh_cmd_loop(void)
command = xlsh_commands;
do {
if(strcmp(command->name, cmd_argv[0]) == 0)
- break;
+ break;
} while((++command)->name);
if(command->name)
@@ -653,7 +655,7 @@ int xlsh_sys_issue(const char* issuefile)
curptr += (printf("%s", curptr) + 2);
if(value)
- printf("%s", value);
+ printf("%s", value);
}
else
curptr += printf("%s", curptr);
View
@@ -85,6 +85,7 @@ int main(int argc, char** argv)
{
int opt_index = 1;
int opt_nodaemon = 0;
+
const char* opt_display = XLSHD_XDISPLAY;
char buffer[PATH_MAX];

0 comments on commit 50d8d29

Please sign in to comment.