分类: LINUX
2009-07-02 16:30:32
diff -uNr omnitty-0.3.0/main.c omnitty-0.3.0-patched/main.c --- omnitty-0.3.0/main.c 2005-10-26 06:08:25.000000000 +0800 +++ omnitty-0.3.0-patched/main.c 2009-07-03 16:44:03.000000000 +0800 @@ -20,6 +20,8 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * Copyright (c) 2002 Bruno T. C. de Oliveira */ +#define _GNU_SOURCE +#include #include #include @@ -243,10 +245,19 @@ } static void add_machines_from_file(const char *file) { - static char buf[128]; + //Fixed by WangYao 09-07-03 + //static char buf[128]; + char *buf = NULL; bool pipe = false; FILE *f; + buf = (char *)malloc(128); + if(buf == NULL) + { + perror("malloc"); + exit(-1); + } + if (getenv("OMNITTY_AT_COMMAND")) { /* popen() a command */ pipe = true; @@ -268,7 +279,19 @@ minibuf_put(minibuf, pipe ? "Adding machines supplied by command..." : "Adding machines from file...", 0x70); - while (1 == fscanf(f, "%s", buf)) machmgr_add(buf); + //Fixed by WangYao 09-07-03 + //-p 10000 root@192.168.1.1 + //while (1 == fscanf(f, "%s", buf)) machmgr_add(buf); + ssize_t nread=0; + size_t len=127; + while ((nread = getline(&buf, &len, f)) != -1) + { + machmgr_add(buf); + memset(buf, 0, sizeof(buf)); + } + + if(buf) + free(buf); if (pipe) { if (0 != pclose(f)) |
|
$ dsh -M -c -f host -o -p10000 uname |
#!/bin/sh DSH=/usr/bin/dsh #$DSH -M -c -f hosts/root@host "$@" $DSH -M -c -f hosts/root@host $* |
#!/bin/sh if [ $# -ne 2 ];then echo "Usage: scpl2r.sh localfile remotefile" exit fi srcfile=$1 dstfile=$2 PSCP=/usr/bin/parallel-scp $PSCP -h hosts/host -l root $srcfile $dstfile |
#!/bin/sh if [ $# -ne 2 ];then echo "Usage: scpl2r.sh localfile remotefile" exit fi srcfile=$1 dstfile=$2 PSLURP=/usr/bin/parallel-slurp $PSLURP -h hosts/host -l root -L log/ $srcfile $dstfile |