version 1.12, 2004/10/14 10:08:09 |
version 1.16, 2013/09/20 06:02:19 |
|
|
/* $OpenXM: OpenXM/src/kan96xx/Kan/shell.c,v 1.11 2004/02/23 09:03:42 takayama Exp $ */ |
/* $OpenXM: OpenXM/src/kan96xx/Kan/shell.c,v 1.15 2012/10/29 02:51:41 takayama Exp $ */ |
#include <stdio.h> |
#include <stdio.h> |
|
#include <string.h> |
#include <sys/types.h> |
#include <sys/types.h> |
#include <sys/stat.h> |
#include <sys/stat.h> |
#include <fcntl.h> |
#include <fcntl.h> |
Line 83 void KoxShellHelp(char *key,FILE *fp) { |
|
Line 84 void KoxShellHelp(char *key,FILE *fp) { |
|
s[1] = "cmdname arg1 arg2 ... "; |
s[1] = "cmdname arg1 arg2 ... "; |
s[2] = "Example 1: /afo (Hello! ) def [(cat) (stringIn://afo)] oxshell"; |
s[2] = "Example 1: /afo (Hello! ) def [(cat) (stringIn://afo)] oxshell"; |
s[3] = "Example 2: [(polymake) (stringInOut://afo.poly) (FACETS)] oxshell"; |
s[3] = "Example 2: [(polymake) (stringInOut://afo.poly) (FACETS)] oxshell"; |
s[4] = NULL; |
s[4] = "A temporary file afo.poly* with the contents of the variable afo.poly is generated under $TMP and \"polymake $TMP FACETS\" will be executed. cf. kan96xx/trans/doPolymake.sm1, Doc/oxshell.oxw, Doc/changelog-ja.tex"; |
|
s[5] = "Example 3: [(ls) (-l) (>) (stringOut://ff)] oxshell"; |
|
s[6] = NULL; |
}else if (strcmp(key,"redirect")==0) { |
}else if (strcmp(key,"redirect")==0) { |
s[0] = "The following redirect operators are implemented."; |
s[0] = "The following redirect operators are implemented."; |
s[1] = "< > 2>"; |
s[1] = "< > 2>"; |
Line 96 void KoxShellHelp(char *key,FILE *fp) { |
|
Line 99 void KoxShellHelp(char *key,FILE *fp) { |
|
}else if (strcmp(key,"keep_tmp_files")==0) { |
}else if (strcmp(key,"keep_tmp_files")==0) { |
s[0] = "keep_tmp_files value"; |
s[0] = "keep_tmp_files value"; |
s[1] = "If value is zero, then temporary files are removed after execution."; |
s[1] = "If value is zero, then temporary files are removed after execution."; |
s[2] = NULL; |
s[2] = "Example 1: [(keep_tmp_files) (1)] oxshell ; temporary files will be kept in /tmp or $TMP or ..."; |
|
s[3] = NULL; |
}else{ |
}else{ |
} |
} |
i = 0; |
i = 0; |
Line 108 void KoxShellHelp(char *key,FILE *fp) { |
|
Line 112 void KoxShellHelp(char *key,FILE *fp) { |
|
|
|
static struct object KoxShell_test1(struct object ob) { |
static struct object KoxShell_test1(struct object ob) { |
/* A simple shell. It does not implement a parser. */ |
/* A simple shell. It does not implement a parser. */ |
struct object rob; |
struct object rob = OINIT; |
char *cmd; |
char *cmd; |
char *arg1,*arg2; |
char *arg1,*arg2; |
int i,n; |
int i,n; |
Line 159 static struct object KoxShell_test1(struct object ob) |
|
Line 163 static struct object KoxShell_test1(struct object ob) |
|
|
|
/* Functions for ox_shell */ |
/* Functions for ox_shell */ |
struct object KoxWhich(struct object cmdo,struct object patho) { |
struct object KoxWhich(struct object cmdo,struct object patho) { |
struct object rob; |
struct object rob = OINIT; |
char *sss; |
char *sss; |
rob = NullObject; |
rob = NullObject; |
if (cmdo.tag != Sdollar) errorKan1("%s\n","KoxWhich(str-obj,str-obj)"); |
if (cmdo.tag != Sdollar) errorKan1("%s\n","KoxWhich(str-obj,str-obj)"); |
Line 201 static myunsetenv(char *name) { |
|
Line 205 static myunsetenv(char *name) { |
|
|
|
/* Example. [(export) (PATH) (=) (/usr/new/bin:$PATH)] */ |
/* Example. [(export) (PATH) (=) (/usr/new/bin:$PATH)] */ |
static struct object oxsSetenv(struct object ob) { |
static struct object oxsSetenv(struct object ob) { |
struct object rob; |
struct object rob = OINIT; |
int i,n; |
int i,n; |
char *envp; |
char *envp; |
char *new; |
char *new; |
Line 375 char *oxsURIgetFileName(char *s) { |
|
Line 379 char *oxsURIgetFileName(char *s) { |
|
|
|
|
|
static struct object testmain(struct object ob) { |
static struct object testmain(struct object ob) { |
struct object rob; |
struct object rob = OINIT; |
char *s; |
char *s; |
struct object ot; |
struct object ot = OINIT; |
char **av; |
char **av; |
int i; |
int i; |
rob = NullObject; |
rob = NullObject; |
Line 406 char *oxsVarToFile(char *v,char *ext,char *command,int |
|
Line 410 char *oxsVarToFile(char *v,char *ext,char *command,int |
|
FILE *fp; |
FILE *fp; |
int n,i,prevc,c; |
int n,i,prevc,c; |
char *prog; |
char *prog; |
struct object vv; |
struct object vv = OINIT; |
|
|
/*bug; winname must be automatically set by looking at command. |
/*bug; winname must be automatically set by looking at command. |
If command is win32-native-application, then winname=1; else winname=0. |
If command is win32-native-application, then winname=1; else winname=0. |
Line 488 static char **oxsBuildArgv(struct object ob) { |
|
Line 492 static char **oxsBuildArgv(struct object ob) { |
|
char *ext, *v; |
char *ext, *v; |
int usetmp=1; |
int usetmp=1; |
int win=0; |
int win=0; |
struct object ocmd; |
struct object ocmd = OINIT; |
|
|
/* bug: win variable must be properly set on windows native. */ |
/* bug: win variable must be properly set on windows native. */ |
|
|