summaryrefslogtreecommitdiffstats
path: root/lib/gajim/settings-smudge
blob: db1221be624da63c4ab459214c57a84904cd529d (plain)
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
33
34
35
36
#!/bin/sh

set -eu

sql_to_db()
{
	local db=

	db="$(mktemp)"  ||                  return 1     # Create new empty DB.
	sqlite3 "${db}" || { rm -f "${db}"; return 1; }  # Fill DB from stdin.
	cat "${db}"     || { rm -f "${db}"; return 1; }  # Output DB.
	rm -f "${db}"   ||                  return 1     # Clean up.

	return 0
}

usage()
{
	printf 'Usage: %s\n' "${0}"

	return 0
}

main()
{
	if [ ${#} -ne 0 ]; then
		usage 1>&2
		return 1
	fi

	sql_to_db || return 1

	return 0
}

main "${@}"