1 # $OpenBSD: sftp-glob.sh,v 1.4 2009/08/13 01:11:55 djm Exp $
2 # Placed in the Public Domain.
11 verbose
"$tid: $errtag"
12 printf "ls -l %s" "${target}" | \
13 ${SFTP} -b - -D ${SFTPSERVER} 2>/dev
/null | \
14 grep -v "^sftp>" > ${RESULTS}
18 if test "x$expected" != "x" ; then
19 if fgrep
"$expected" ${RESULTS} >/dev
/null
2>&1 ; then
22 fail
"$expected missing from $errtag results"
25 if test "x$unexpected" != "x" && \
26 fgrep
"$unexpected" ${RESULTS} >/dev
/null
2>&1 ; then
27 fail
"$unexpected present in $errtag results"
33 RESULTS
=${OBJ}/results
37 GLOB1
="${DIR}/g-wild*"
38 GLOB2
="${DIR}/g-wildx"
39 QUOTE
="${DIR}/g-quote\""
40 SLASH
="${DIR}/g-sl\\ash"
41 ESLASH
="${DIR}/g-slash\\"
42 QSLASH
="${DIR}/g-qs\\\""
43 SPACE
="${DIR}/g-q space"
47 touch "${DATA}" "${GLOB1}" "${GLOB2}" "${QUOTE}"
48 touch "${QSLASH}" "${ESLASH}" "${SLASH}" "${SPACE}"
50 # target message expected unexpected
51 sftp_ls
"${DIR}/fil*" "file glob" "${DATA}" ""
52 sftp_ls
"${BASE}/d*" "dir glob" "`basename ${DATA}`" ""
53 sftp_ls
"${DIR}/g-wild\"*\"" "quoted glob" "g-wild*" "g-wildx"
54 sftp_ls
"${DIR}/g-wild\*" "escaped glob" "g-wild*" "g-wildx"
55 sftp_ls
"${DIR}/g-quote\\\"" "escaped quote" "g-quote\"" ""
56 sftp_ls
"\"${DIR}/g-quote\\\"\"" "quoted quote" "g-quote\"" ""
57 sftp_ls
"'${DIR}/g-quote\"'" "single-quoted quote" "g-quote\"" ""
58 sftp_ls
"${DIR}/g-sl\\\\ash" "escaped slash" "g-sl\\ash" ""
59 sftp_ls
"'${DIR}/g-sl\\\\ash'" "quoted slash" "g-sl\\ash" ""
60 sftp_ls
"${DIR}/g-slash\\\\" "escaped slash at EOL" "g-slash\\" ""
61 sftp_ls
"'${DIR}/g-slash\\\\'" "quoted slash at EOL" "g-slash\\" ""
62 sftp_ls
"${DIR}/g-qs\\\\\\\"" "escaped slash+quote" "g-qs\\\"" ""
63 sftp_ls
"'${DIR}/g-qs\\\\\"'" "quoted slash+quote" "g-qs\\\"" ""
64 sftp_ls
"${DIR}/g-q\\ space" "escaped space" "g-q space" ""
65 sftp_ls
"'${DIR}/g-q space'" "quoted space" "g-q space" ""