=================================================================== RCS file: /home/cvs/OpenXM/src/util/ox_pathfinder.c,v retrieving revision 1.26 retrieving revision 1.29 diff -u -p -r1.26 -r1.29 --- OpenXM/src/util/ox_pathfinder.c 2004/03/05 06:26:52 1.26 +++ OpenXM/src/util/ox_pathfinder.c 2006/01/10 11:52:56 1.29 @@ -1,4 +1,4 @@ -/* $OpenXM: OpenXM/src/util/ox_pathfinder.c,v 1.25 2004/03/04 12:22:47 takayama Exp $ */ +/* $OpenXM: OpenXM/src/util/ox_pathfinder.c,v 1.28 2004/10/14 10:08:09 takayama Exp $ */ /* Moved from misc-2003/07/cygwin/test.c */ #include @@ -37,15 +37,24 @@ static void msgPathFinder(char *s); static int Verbose_get_home = 0; static int Verbose = 1; static int NoX = 0; +static int ErrorVerbose = 1; - #define nomemory(a) {fprintf(stderr,"(%d) no more memory.\n",a);exit(10);} #define mymalloc(a) sGC_malloc(a) +void pathFinderErrorVerbose(int k) { + static int prev; + if (k >= 0) { + prev = ErrorVerbose; + ErrorVerbose = k; + }else{ + ErrorVerbose = prev; + } +} static void errorPathFinder(char *s) { /* Todo; we need to return the error message to the client if it is used in ox_shell */ - fprintf(stderr,"Error: %s",s); + if (ErrorVerbose) fprintf(stderr,"Error: %s",s); } static void msgPathFinder(char *s) { /* Todo; we need to return the error message to the client if it is used @@ -1011,7 +1020,7 @@ char *getCommandPath(char *cmdname) if (getFileSize(cmdname) >= 0) { /* Todo: isExecutableFile() */ }else{ msg = (char *)mymalloc(strlen(cmdname)+30); - sprintf(msg,"getCommandPath: %s is not found."); + sprintf(msg,"getCommandPath: %s is not found.",cmdname); errorPathFinder(msg); return NULL; } @@ -1159,4 +1168,39 @@ char *oxTermWhich_unix(int *typep) { if (s != NULL) return s; return NULL; +} + +int oxpSendStringAsFile(char *user,char *hostname, char *filename, char *str) +{ + FILE *fp; + int i; + char *comm; + char *argv[10]; + mode_t oumask; + oumask = umask((mode_t) (64-1)); + /* 077=111 111 */ + fp = fopen(filename,"w"); + umask(oumask); + if (fp == NULL) { + return -1; + } + for (i=0; i