From fbd48eb4ee7bf39c71bcad293158e1322400da74 Mon Sep 17 00:00:00 2001 From: AGT EMS Date: Thu, 19 Jun 2025 10:48:08 +0800 Subject: [PATCH] fix: dos2unix some files --- .gitignore | 2 + src/accountMgr/c_program/sftpSend/initKeys | 64 ++++++++--------- src/accountMgr/c_program/sftpSend/parseResult | 62 ++++++++--------- src/accountMgr/c_program/sftpSend/sendfile | 68 +++++++++---------- 4 files changed, 99 insertions(+), 97 deletions(-) diff --git a/.gitignore b/.gitignore index 61966a6..b586e8f 100644 --- a/.gitignore +++ b/.gitignore @@ -24,6 +24,8 @@ *.bak* *.exe __debug_bin*.exe +*.swp + # bin file bin/iptrans diff --git a/src/accountMgr/c_program/sftpSend/initKeys b/src/accountMgr/c_program/sftpSend/initKeys index e660d84..70055b9 100644 --- a/src/accountMgr/c_program/sftpSend/initKeys +++ b/src/accountMgr/c_program/sftpSend/initKeys @@ -1,32 +1,32 @@ -#!/usr/bin/expect - -#This script use to init the server keys, it rewrite the known_hosts config file - -#This script have 3 parameters -#remoteip: the ip of the remote server -#username: the name for logging in -#userpass: the password for logging in - -set remoteip [lindex $argv 0] -set username [lindex $argv 1] -set userpass [lindex $argv 2] - -set timeout 5 - -spawn sftp $username@$remoteip - -expect "*(yes/no)?*" - -send "yes\n" - -expect "*password*" - -send "$userpass\n" - -expect "*sftp>*" - -send "quit\n" - -expect eof -exit - +#!/usr/bin/expect + +#This script use to init the server keys, it rewrite the known_hosts config file + +#This script have 3 parameters +#remoteip: the ip of the remote server +#username: the name for logging in +#userpass: the password for logging in + +set remoteip [lindex $argv 0] +set username [lindex $argv 1] +set userpass [lindex $argv 2] + +set timeout 5 + +spawn sftp $username@$remoteip + +expect "*(yes/no)?*" + +send "yes\n" + +expect "*password*" + +send "$userpass\n" + +expect "*sftp>*" + +send "quit\n" + +expect eof +exit + diff --git a/src/accountMgr/c_program/sftpSend/parseResult b/src/accountMgr/c_program/sftpSend/parseResult index 1c9fba0..2650cf2 100644 --- a/src/accountMgr/c_program/sftpSend/parseResult +++ b/src/accountMgr/c_program/sftpSend/parseResult @@ -1,31 +1,31 @@ -#!/bin/sh - -#This script parse the result.txt file -#to judge whether the operation of sending file is successful - -#The local do not have the Permission to access the remote directory -if [ `grep -c "handle" /tmp/result$1.txt` -gt 0 ] ; then - `echo 4 >/tmp/temp$1.txt` - #echo "The local do not have the Permission to access the remote directory" - exit -fi - -#The name or the password is not fit -if [ `grep -c "Permission denied" /tmp/result$1.txt` -gt 0 ] ; then - `echo 2 >/tmp/temp$1.txt` - #echo "The name or the password is not fit" - exit -fi - -#Successful -if [ `grep -c "100%" /tmp/result$1.txt` -gt 0 ] ; then - `echo 0 >/tmp/temp$1.txt` - #echo "Send the file successfully" - exit -fi - -#The remote server is unavailable - `echo 1 >/tmp/temp$1.txt` - #echo "The remote server is unavailable" - exit - +#!/bin/sh + +#This script parse the result.txt file +#to judge whether the operation of sending file is successful + +#The local do not have the Permission to access the remote directory +if [ `grep -c "handle" /tmp/result$1.txt` -gt 0 ] ; then + `echo 4 >/tmp/temp$1.txt` + #echo "The local do not have the Permission to access the remote directory" + exit +fi + +#The name or the password is not fit +if [ `grep -c "Permission denied" /tmp/result$1.txt` -gt 0 ] ; then + `echo 2 >/tmp/temp$1.txt` + #echo "The name or the password is not fit" + exit +fi + +#Successful +if [ `grep -c "100%" /tmp/result$1.txt` -gt 0 ] ; then + `echo 0 >/tmp/temp$1.txt` + #echo "Send the file successfully" + exit +fi + +#The remote server is unavailable + `echo 1 >/tmp/temp$1.txt` + #echo "The remote server is unavailable" + exit + diff --git a/src/accountMgr/c_program/sftpSend/sendfile b/src/accountMgr/c_program/sftpSend/sendfile index d739ed1..39b6b97 100644 --- a/src/accountMgr/c_program/sftpSend/sendfile +++ b/src/accountMgr/c_program/sftpSend/sendfile @@ -1,34 +1,34 @@ -#!/usr/bin/expect - -#This script interative with the remote server, and send the file to it - -#This script have 6 parameters -#remoteip: the ip of the remote server -#username: the name for logining in -#userpass: the password for logining in -#resdir: the directory to store the files -#sendfile: the file to send to the remote server -#desdir: the directory to send the files - -set remoteip [lindex $argv 0] -set username [lindex $argv 1] -set userpass [lindex $argv 2] -set resdir [lindex $argv 3] -set sendfile [lindex $argv 4] -set desdir [lindex $argv 5] - -set timeout 120 - -spawn sftp $username@$remoteip - - - -expect "yes/no" {send "yes\n"; expect "*assword: "} "*assword: " -send "$userpass\n" -expect "*sftp>*" -send "cd $desdir\n" -send "lcd $resdir\n" -send "put $sendfile\n" - -expect "*100%*" -exit +#!/usr/bin/expect + +#This script interative with the remote server, and send the file to it + +#This script have 6 parameters +#remoteip: the ip of the remote server +#username: the name for logining in +#userpass: the password for logining in +#resdir: the directory to store the files +#sendfile: the file to send to the remote server +#desdir: the directory to send the files + +set remoteip [lindex $argv 0] +set username [lindex $argv 1] +set userpass [lindex $argv 2] +set resdir [lindex $argv 3] +set sendfile [lindex $argv 4] +set desdir [lindex $argv 5] + +set timeout 120 + +spawn sftp $username@$remoteip + + + +expect "yes/no" {send "yes\n"; expect "*assword: "} "*assword: " +send "$userpass\n" +expect "*sftp>*" +send "cd $desdir\n" +send "lcd $resdir\n" +send "put $sendfile\n" + +expect "*100%*" +exit