diff options
author | Robin Haberkorn <robin.haberkorn@googlemail.com> | 2011-10-14 04:55:05 +0200 |
---|---|---|
committer | Robin Haberkorn <robin.haberkorn@googlemail.com> | 2011-10-14 04:55:05 +0200 |
commit | 6aa0e0017d7d0cddc006da885946934b06949a91 (patch) | |
tree | 66b688ec32e2f91266db760b1762f2a50cc52036 /libslang/slsh/scripts/htmlstrip | |
parent | a966db5b71328f6adf9dd767e64b322a3bd7ed9c (diff) | |
download | erlang-slang-fork-6aa0e0017d7d0cddc006da885946934b06949a91.tar.gz |
include libslang-1.4.9 and automatically build it and link erlang-slang against it
few (erlang) people will still have libslang-1.4.9 installed or spend time
to get it to link against the driver
Diffstat (limited to 'libslang/slsh/scripts/htmlstrip')
-rwxr-xr-x | libslang/slsh/scripts/htmlstrip | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/libslang/slsh/scripts/htmlstrip b/libslang/slsh/scripts/htmlstrip new file mode 100755 index 0000000..c6a6b36 --- /dev/null +++ b/libslang/slsh/scripts/htmlstrip @@ -0,0 +1,48 @@ +#! /usr/bin/env slsh +% -*- mode: slang -*- +%_debug_info = 1; + +% This file strips HTML tags from one or more html files and write the result +% to stdout. It is very simple minded. + +define process_file (file) +{ + variable fp, l; + + if (file != NULL) + { + fp = fopen (file, "r"); + if (fp == NULL) + { + () = fputs (sprintf ("Unable to open %s\n", file), stderr); + return; + } + } + else fp = stdin; + + foreach (fp) + { + l = (); + + l = strtrim (str_uncomment_string (l, "<", ">")); + !if (strlen (l)) + continue; + + () = fputs (l, stdout); + () = fputs ("\n", stdout); + } +} + +if (__argc == 1) +{ + if (isatty (stdin)) + { + () = fprintf (stderr, "Usage: %s [files...]\n", __argv[0]); + exit (1); + } + process_file (NULL); + exit (0); +} + +foreach (__argv[[1:]]) process_file (); +exit (0); |