mirror of
https://github.com/roswell/roswell.git
synced 2026-09-10 07:16:17 -04:00
use bash if available
This commit is contained in:
parent
088038cf09
commit
5a87eed6a7
|
|
@ -1,4 +1,3 @@
|
|||
#include <stdio.h>
|
||||
#include "opt.h"
|
||||
#include "util.h"
|
||||
|
||||
|
|
@ -24,15 +23,24 @@ int cmd_uname (int argc,char **argv,struct sub_command* cmd) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
int cmd_which (int argc,char **argv,struct sub_command* cmd) {
|
||||
if(argc==2) {
|
||||
char* str=which(argv[1]);
|
||||
printf("%s\n",str);
|
||||
s(str);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void register_cmd_internal(void) {
|
||||
LVal cmds=internal_commands;
|
||||
cmds=add_command(cmds,"tar" ,NULL,cmd_tar,0,1,NULL,NULL);
|
||||
cmds=add_command(cmds,"download",NULL,cmd_download,0,1,NULL,NULL);
|
||||
cmds=add_command(cmds,"uname",NULL,cmd_uname,0,1,NULL,NULL);
|
||||
cmds=add_command(cmds,"which",NULL,cmd_which,0,1,NULL,NULL);
|
||||
internal_commands=cmds;
|
||||
}
|
||||
|
||||
int cmd_internal(int argc,char **argv,struct sub_command* cmd)
|
||||
{
|
||||
int cmd_internal(int argc,char **argv,struct sub_command* cmd) {
|
||||
return proccmd(argc-1,&(argv[1]),(LVal)NULL,internal_commands);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -59,6 +59,11 @@ exec ros -Q +R -L sbcl-bin -- $0 "$@"
|
|||
(defun uname-m ()
|
||||
(ros:roswell '("roswell-internal-use uname -m") :string t))
|
||||
|
||||
(defun which (cmd)
|
||||
(let ((result (ros:roswell (list "roswell-internal-use which" cmd) :string t)))
|
||||
(unless (zerop (length result))
|
||||
result)))
|
||||
|
||||
(defun date (&optional (universal-time (get-universal-time)))
|
||||
(multiple-value-bind (second minute hour date month year day daylight time-zone)
|
||||
(decode-universal-time universal-time)
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@
|
|||
(defun sh ()
|
||||
(or #+win32
|
||||
(format nil "~A -l" (merge-pathnames (format nil "impls/~A/~A/~A/~A/msys/1.0/bin/sh" (uname-m) (uname) "msys" "mingw32") (homedir)))
|
||||
(which "bash")
|
||||
"sh"))
|
||||
|
||||
(defun sbcl-get-version ()
|
||||
|
|
|
|||
Loading…
Reference in a new issue