]>
Commit | Line | Data |
---|---|---|
fdbb3b19 AJ |
1 | #!/bin/sh |
2 | # | |
4ac4a490 | 3 | ## Copyright (C) 1996-2017 The Squid Software Foundation and contributors |
ca02e0ec AJ |
4 | ## |
5 | ## Squid software is distributed under GPLv2+ license and includes | |
6 | ## contributions from numerous individuals and organizations. | |
7 | ## Please see the COPYING and CONTRIBUTORS files for details. | |
8 | ## | |
9 | # | |
8432a09e AJ |
10 | # Copyright (c) 2009-2014, Treehouse Networks Ltd. New Zealand |
11 | # All rights reserved. | |
fdbb3b19 | 12 | # |
8432a09e AJ |
13 | # Redistribution and use in source and binary forms, with or without |
14 | # modification, are permitted provided that the following conditions | |
15 | # are met: | |
fdbb3b19 | 16 | # |
8432a09e AJ |
17 | # 1. Redistributions of source code must retain the above copyright |
18 | # notice, this list of conditions and the following disclaimer. | |
19 | # | |
20 | # 2. Redistributions in binary form must reproduce the above copyright | |
21 | # notice, this list of conditions and the following disclaimer in the | |
22 | # documentation and/or other materials provided with the distribution. | |
23 | # | |
24 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | |
25 | # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | |
26 | # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS | |
27 | # FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE | |
28 | # COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, | |
29 | # INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, | |
30 | # BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | |
31 | # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER | |
32 | # CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
33 | # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN | |
34 | # ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | |
35 | # POSSIBILITY OF SUCH DAMAGE. | |
ca02e0ec | 36 | # |
fdbb3b19 | 37 | |
1db8047a AJ |
38 | if test "${1}" = "-h" ; then |
39 | echo "Usage: $0 [-h] [-c] [-d logfile]" | |
fdbb3b19 | 40 | echo " -h Help: this help text" |
1db8047a | 41 | echo " -c Accept concurrent request format" |
fdbb3b19 AJ |
42 | echo " -d logfile Debug: log all data received to the named file" |
43 | exit 1 | |
44 | fi | |
45 | ||
1db8047a AJ |
46 | concurrent=0 |
47 | if test "${1}" = "-c" ; then | |
48 | concurrent=1 | |
49 | shift | |
50 | fi | |
51 | ||
fdbb3b19 AJ |
52 | DEBUG=0 |
53 | if test "${1}" = "-d" ; then | |
54 | DEBUG=1 | |
55 | LOG="${2}" | |
56 | fi | |
57 | ||
1db8047a | 58 | if test "$concurrent" = "1"; then |
32f98d1f | 59 | # read concurrent input format |
1db8047a | 60 | while read id url rest; do |
32f98d1f | 61 | if test "${DEBUG}" = "1" ; then |
1db8047a AJ |
62 | echo "ID:$id URL:$url EXTRAS:$rest" >>${LOG} |
63 | fi | |
32f98d1f AJ |
64 | # blank URL for no change, or replace with another URL. |
65 | echo "${id} " | |
1db8047a AJ |
66 | done |
67 | else | |
32f98d1f | 68 | # read old non-concurrent input format |
1db8047a | 69 | while read url rest; do |
32f98d1f | 70 | if test "${DEBUG}" = "1" ; then |
1db8047a AJ |
71 | echo "URL:$url EXTRAS:$rest" >>${LOG} |
72 | fi | |
32f98d1f AJ |
73 | # blank line/URL for no change, or replace with another URL. |
74 | echo | |
1db8047a AJ |
75 | done |
76 | fi |