1 # $OpenBSD: sftp-glob.sh,v 1.4 2009/08/13 01:11:55 djm Exp $
2 # Placed in the Public Domain.
6 config_defined FILESYSTEM_NO_BACKSLASH
&& nobs
="not supported on this platform"
14 if test "x$skip" != "x" ; then
15 verbose
"$tid: $errtag (skipped: $skip)"
18 verbose
"$tid: $errtag"
19 printf "ls -l %s" "${target}" | \
20 ${SFTP} -b - -D ${SFTPSERVER} 2>/dev
/null | \
21 grep -v "^sftp>" > ${RESULTS}
25 if test "x$expected" != "x" ; then
26 if fgrep
"$expected" ${RESULTS} >/dev
/null
2>&1 ; then
29 fail
"$expected missing from $errtag results"
32 if test "x$unexpected" != "x" && \
33 fgrep
"$unexpected" ${RESULTS} >/dev
/null
2>&1 ; then
34 fail
"$unexpected present in $errtag results"
40 RESULTS
=${OBJ}/results
44 GLOB1
="${DIR}/g-wild*"
45 GLOB2
="${DIR}/g-wildx"
46 QUOTE
="${DIR}/g-quote\""
47 SLASH
="${DIR}/g-sl\\ash"
48 ESLASH
="${DIR}/g-slash\\"
49 QSLASH
="${DIR}/g-qs\\\""
50 SPACE
="${DIR}/g-q space"
54 touch "${DATA}" "${GLOB1}" "${GLOB2}" "${QUOTE}" "${SPACE}"
55 test "x$nobs" = "x" && touch "${QSLASH}" "${ESLASH}" "${SLASH}"
57 # target message expected unexpected
58 sftp_ls
"${DIR}/fil*" "file glob" "${DATA}" ""
59 sftp_ls
"${BASE}/d*" "dir glob" "`basename ${DATA}`" ""
60 sftp_ls
"${DIR}/g-wild\"*\"" "quoted glob" "g-wild*" "g-wildx"
61 sftp_ls
"${DIR}/g-wild\*" "escaped glob" "g-wild*" "g-wildx"
62 sftp_ls
"${DIR}/g-quote\\\"" "escaped quote" "g-quote\"" ""
63 sftp_ls
"\"${DIR}/g-quote\\\"\"" "quoted quote" "g-quote\"" ""
64 sftp_ls
"'${DIR}/g-quote\"'" "single-quoted quote" "g-quote\"" ""
65 sftp_ls
"${DIR}/g-q\\ space" "escaped space" "g-q space" ""
66 sftp_ls
"'${DIR}/g-q space'" "quoted space" "g-q space" ""
67 sftp_ls
"${DIR}/g-sl\\\\ash" "escaped slash" "g-sl\\ash" "" "$nobs"
68 sftp_ls
"'${DIR}/g-sl\\\\ash'" "quoted slash" "g-sl\\ash" "" "$nobs"
69 sftp_ls
"${DIR}/g-slash\\\\" "escaped slash at EOL" "g-slash\\" "" "$nobs"
70 sftp_ls
"'${DIR}/g-slash\\\\'" "quoted slash at EOL" "g-slash\\" "" "$nobs"
71 sftp_ls
"${DIR}/g-qs\\\\\\\"" "escaped slash+quote" "g-qs\\\"" "" "$nobs"
72 sftp_ls
"'${DIR}/g-qs\\\\\"'" "quoted slash+quote" "g-qs\\\"" "" "$nobs"