aboutsummaryrefslogtreecommitdiff
path: root/markdown2latex
diff options
context:
space:
mode:
authorroktas <roktas@788f1e2b-df1e-0410-8736-df70ead52e1b>2006-11-12 21:17:06 +0000
committerroktas <roktas@788f1e2b-df1e-0410-8736-df70ead52e1b>2006-11-12 21:17:06 +0000
commit2763382dd803916e34e6575904147d7e3594a7f6 (patch)
treec87b10e109f87a7336b9b4022ef2da6314757290 /markdown2latex
parent8e5f3e684c13a4b48d0ed24a15560f2631fc8e93 (diff)
downloadpandoc-2763382dd803916e34e6575904147d7e3594a7f6.tar.gz
Replace which(1) in all wrappers with 'pathfind', a POSIX-compliant shell
function. Expand tabs to four spaces. git-svn-id: https://pandoc.googlecode.com/svn/trunk@94 788f1e2b-df1e-0410-8736-df70ead52e1b
Diffstat (limited to 'markdown2latex')
-rw-r--r--markdown2latex21
1 files changed, 17 insertions, 4 deletions
diff --git a/markdown2latex b/markdown2latex
index 59a467fbc..0fc2077cb 100644
--- a/markdown2latex
+++ b/markdown2latex
@@ -1,11 +1,24 @@
#!/bin/sh -e
# converts markdown to latex
+pathfind () { # portable which(1), code taken from Debian Developer's Reference
+ OLDIFS="$IFS"
+ IFS=:
+ for _p in $PATH; do
+ if [ -x "$_p/$*" ]; then
+ IFS="$OLDIFS"
+ return 0
+ fi
+ done
+ IFS="$OLDIFS"
+ return 1
+}
+
for p in pandoc; do
- which $p >/dev/null 2>&1 || {
- echo >&2 "You need '$p' to use this program!"
- exit 1
- }
+ pathfind $p || {
+ echo >&2 "You need '$p' to use this program!"
+ exit 1
+ }
done
iconv -t utf-8 $* | pandoc $PANDOC_OPTS -w latex -s | iconv -f utf-8