File: t_unescstr.sh

package info (click to toggle)
typespeed 0.6.5-7
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 1,584 kB
  • sloc: sh: 4,267; ansic: 3,794; makefile: 88; sed: 16
file content (32 lines) | stat: -rw-r--r-- 381 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#!/bin/sh

checkword() {
	if [ $# -ne 3 ]
	then
		return 1
	fi

	./t_unescstr "$1" "$2"
	ret=$?

	echo -n "$1 -> $2: "
	if [ $ret -eq 0 ]
	then
		echo -n "ok: "
	else
		echo -n "nok: "
	fi

	if [ $ret -eq $3 ]
	then
		echo "success"
	else
		echo "failure"
	fi
}

checkword user user 0
checkword "a	b" "a	b" 0
checkword "a\\	b" "a	b" 0
checkword "\\" "\\" 1
checkword "\\\\" "\\" 0