shashankkandimalla
commited on
Commit
•
288007d
1
Parent(s):
39a9a37
Upload folder using huggingface_hub
Browse filesThis view is limited to 50 files because it contains too many changes.
See raw diff
- .env +4 -0
- .gitattributes +29 -0
- .github/workflows/update_space.yml +28 -0
- README.md +2 -8
- app.py +112 -0
- ocr-application/bin/2to3 +5 -0
- ocr-application/bin/2to3-3.11 +5 -0
- ocr-application/bin/bunzip2 +0 -0
- ocr-application/bin/bzcat +0 -0
- ocr-application/bin/bzcmp +76 -0
- ocr-application/bin/bzdiff +76 -0
- ocr-application/bin/bzegrep +85 -0
- ocr-application/bin/bzfgrep +85 -0
- ocr-application/bin/bzgrep +85 -0
- ocr-application/bin/bzip2 +0 -0
- ocr-application/bin/bzip2recover +0 -0
- ocr-application/bin/bzless +61 -0
- ocr-application/bin/bzmore +61 -0
- ocr-application/bin/c_rehash +252 -0
- ocr-application/bin/captoinfo +0 -0
- ocr-application/bin/clear +0 -0
- ocr-application/bin/distro +8 -0
- ocr-application/bin/dotenv +8 -0
- ocr-application/bin/email_validator +8 -0
- ocr-application/bin/f2py +8 -0
- ocr-application/bin/fastapi +8 -0
- ocr-application/bin/fonttools +8 -0
- ocr-application/bin/gradio +8 -0
- ocr-application/bin/httpx +8 -0
- ocr-application/bin/huggingface-cli +8 -0
- ocr-application/bin/idle3 +5 -0
- ocr-application/bin/idle3.11 +5 -0
- ocr-application/bin/infocmp +0 -0
- ocr-application/bin/infotocap +0 -0
- ocr-application/bin/lzcat +0 -0
- ocr-application/bin/lzcmp +215 -0
- ocr-application/bin/lzdiff +215 -0
- ocr-application/bin/lzegrep +298 -0
- ocr-application/bin/lzfgrep +298 -0
- ocr-application/bin/lzgrep +298 -0
- ocr-application/bin/lzless +59 -0
- ocr-application/bin/lzma +0 -0
- ocr-application/bin/lzmadec +0 -0
- ocr-application/bin/lzmainfo +0 -0
- ocr-application/bin/lzmore +79 -0
- ocr-application/bin/markdown-it +8 -0
- ocr-application/bin/ncursesw6-config +331 -0
- ocr-application/bin/normalizer +8 -0
- ocr-application/bin/numpy-config +8 -0
- ocr-application/bin/openai +8 -0
.env
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
RAPIDAPI_KEY=5a696b0394msh0cd412236e3a960p1e9b93jsn024e50e3cf38
|
2 |
+
OPENAI_API_KEY=sk-proj-HuKZeBLHxlovlNrXz0sYT3BlbkFJOUvgR40paSXuxrgQFice
|
3 |
+
IMGBB_API_KEY=81b9cf806504b27cb58b457d211e21df
|
4 |
+
|
.gitattributes
CHANGED
@@ -33,3 +33,32 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
36 |
+
ocr-application/bin/python filter=lfs diff=lfs merge=lfs -text
|
37 |
+
ocr-application/bin/python3 filter=lfs diff=lfs merge=lfs -text
|
38 |
+
ocr-application/bin/python3.1 filter=lfs diff=lfs merge=lfs -text
|
39 |
+
ocr-application/bin/python3.11 filter=lfs diff=lfs merge=lfs -text
|
40 |
+
ocr-application/bin/ruff filter=lfs diff=lfs merge=lfs -text
|
41 |
+
ocr-application/bin/sqlite3 filter=lfs diff=lfs merge=lfs -text
|
42 |
+
ocr-application/lib/libcrypto.3.dylib filter=lfs diff=lfs merge=lfs -text
|
43 |
+
ocr-application/lib/libcrypto.a filter=lfs diff=lfs merge=lfs -text
|
44 |
+
ocr-application/lib/libcrypto.dylib filter=lfs diff=lfs merge=lfs -text
|
45 |
+
ocr-application/lib/libpython3.11.dylib filter=lfs diff=lfs merge=lfs -text
|
46 |
+
ocr-application/lib/libsqlite3.0.dylib filter=lfs diff=lfs merge=lfs -text
|
47 |
+
ocr-application/lib/libsqlite3.dylib filter=lfs diff=lfs merge=lfs -text
|
48 |
+
ocr-application/lib/libtcl8.6.dylib filter=lfs diff=lfs merge=lfs -text
|
49 |
+
ocr-application/lib/libtk8.6.dylib filter=lfs diff=lfs merge=lfs -text
|
50 |
+
ocr-application/lib/python3.11/ensurepip/_bundled/pip-24.0-py3-none-any.whl filter=lfs diff=lfs merge=lfs -text
|
51 |
+
ocr-application/lib/python3.11/ensurepip/_bundled/setuptools-65.5.0-py3-none-any.whl filter=lfs diff=lfs merge=lfs -text
|
52 |
+
ocr-application/lib/python3.11/lib-dynload/unicodedata.cpython-311-darwin.so filter=lfs diff=lfs merge=lfs -text
|
53 |
+
ocr-application/lib/python3.11/site-packages/PIL/.dylibs/libfreetype.6.dylib filter=lfs diff=lfs merge=lfs -text
|
54 |
+
ocr-application/lib/python3.11/site-packages/PIL/.dylibs/libharfbuzz.0.dylib filter=lfs diff=lfs merge=lfs -text
|
55 |
+
ocr-application/lib/python3.11/site-packages/gradio/frpc_darwin_arm64_v0.2 filter=lfs diff=lfs merge=lfs -text
|
56 |
+
ocr-application/lib/python3.11/site-packages/numpy/_core/_multiarray_umath.cpython-311-darwin.so filter=lfs diff=lfs merge=lfs -text
|
57 |
+
ocr-application/lib/python3.11/site-packages/pandas/_libs/algos.cpython-311-darwin.so filter=lfs diff=lfs merge=lfs -text
|
58 |
+
ocr-application/lib/python3.11/site-packages/pandas/_libs/groupby.cpython-311-darwin.so filter=lfs diff=lfs merge=lfs -text
|
59 |
+
ocr-application/lib/python3.11/site-packages/pandas/_libs/hashtable.cpython-311-darwin.so filter=lfs diff=lfs merge=lfs -text
|
60 |
+
ocr-application/lib/python3.11/site-packages/pandas/_libs/interval.cpython-311-darwin.so filter=lfs diff=lfs merge=lfs -text
|
61 |
+
ocr-application/lib/python3.11/site-packages/pandas/_libs/join.cpython-311-darwin.so filter=lfs diff=lfs merge=lfs -text
|
62 |
+
ocr-application/lib/python3.11/site-packages/pydantic_core/_pydantic_core.cpython-311-darwin.so filter=lfs diff=lfs merge=lfs -text
|
63 |
+
ocr-application/lib/python3.11/site-packages/uvloop/loop.cpython-311-darwin.so filter=lfs diff=lfs merge=lfs -text
|
64 |
+
ocr-application/lib/sqlite3.44.2/libsqlite3.44.2.dylib filter=lfs diff=lfs merge=lfs -text
|
.github/workflows/update_space.yml
ADDED
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
name: Run Python script
|
2 |
+
|
3 |
+
on:
|
4 |
+
push:
|
5 |
+
branches:
|
6 |
+
- main
|
7 |
+
|
8 |
+
jobs:
|
9 |
+
build:
|
10 |
+
runs-on: ubuntu-latest
|
11 |
+
|
12 |
+
steps:
|
13 |
+
- name: Checkout
|
14 |
+
uses: actions/checkout@v2
|
15 |
+
|
16 |
+
- name: Set up Python
|
17 |
+
uses: actions/setup-python@v2
|
18 |
+
with:
|
19 |
+
python-version: '3.9'
|
20 |
+
|
21 |
+
- name: Install Gradio
|
22 |
+
run: python -m pip install gradio
|
23 |
+
|
24 |
+
- name: Log in to Hugging Face
|
25 |
+
run: python -c 'import huggingface_hub; huggingface_hub.login(token="${{ secrets.hf_token }}")'
|
26 |
+
|
27 |
+
- name: Deploy to Spaces
|
28 |
+
run: gradio deploy
|
README.md
CHANGED
@@ -1,12 +1,6 @@
|
|
1 |
---
|
2 |
-
title:
|
3 |
-
|
4 |
-
colorFrom: green
|
5 |
-
colorTo: indigo
|
6 |
sdk: gradio
|
7 |
sdk_version: 4.39.0
|
8 |
-
app_file: app.py
|
9 |
-
pinned: false
|
10 |
---
|
11 |
-
|
12 |
-
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
|
|
1 |
---
|
2 |
+
title: ocr-text-processing
|
3 |
+
app_file: app.py
|
|
|
|
|
4 |
sdk: gradio
|
5 |
sdk_version: 4.39.0
|
|
|
|
|
6 |
---
|
|
|
|
app.py
ADDED
@@ -0,0 +1,112 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
import http.client
|
3 |
+
import json
|
4 |
+
import requests
|
5 |
+
import base64
|
6 |
+
import os
|
7 |
+
from dotenv import load_dotenv
|
8 |
+
from openai import OpenAI
|
9 |
+
|
10 |
+
# Load environment variables
|
11 |
+
load_dotenv()
|
12 |
+
|
13 |
+
# Function to upload image to imgbb
|
14 |
+
def upload_image_to_imgbb(image_path):
|
15 |
+
try:
|
16 |
+
with open(image_path, "rb") as file:
|
17 |
+
url = "https://api.imgbb.com/1/upload"
|
18 |
+
payload = {
|
19 |
+
"key": os.getenv("IMGBB_API_KEY"),
|
20 |
+
"image": base64.b64encode(file.read()).decode()
|
21 |
+
}
|
22 |
+
res = requests.post(url, data=payload)
|
23 |
+
res.raise_for_status() # Raises an HTTPError for bad responses
|
24 |
+
return res.json()['data']['url']
|
25 |
+
except Exception as e:
|
26 |
+
return f"Error uploading image: {str(e)}"
|
27 |
+
|
28 |
+
# OCR API request
|
29 |
+
def get_ocr_results(image_url):
|
30 |
+
try:
|
31 |
+
conn = http.client.HTTPSConnection("ocr43.p.rapidapi.com")
|
32 |
+
payload = f"-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"url\"\r\n\r\n{image_url}\r\n-----011000010111000001101001--\r\n\r\n"
|
33 |
+
headers = {
|
34 |
+
'x-rapidapi-key': os.getenv("RAPIDAPI_KEY"),
|
35 |
+
'x-rapidapi-host': "ocr43.p.rapidapi.com",
|
36 |
+
'Content-Type': "multipart/form-data; boundary=---011000010111000001101001"
|
37 |
+
}
|
38 |
+
conn.request("POST", "/v1/results", payload, headers)
|
39 |
+
res = conn.getresponse()
|
40 |
+
data = res.read()
|
41 |
+
return data.decode("utf-8")
|
42 |
+
except Exception as e:
|
43 |
+
return f"Error in OCR processing: {str(e)}"
|
44 |
+
|
45 |
+
# OpenAI API configuration
|
46 |
+
openai_client = OpenAI(api_key=os.getenv("OPENAI_API_KEY"))
|
47 |
+
|
48 |
+
# Function to process OCR results with OpenAI
|
49 |
+
def process_ocr_with_gpt(ocr_results):
|
50 |
+
try:
|
51 |
+
prompt = f"""
|
52 |
+
You are an AI assistant tasked with processing OCR results and providing a clean, formatted output.
|
53 |
+
Here are the OCR results:
|
54 |
+
|
55 |
+
{ocr_results}
|
56 |
+
|
57 |
+
Please process this information and provide a clean, well-formatted output. If there are any obvious errors in the OCR, please correct them. Format the output in a clear and readable manner.
|
58 |
+
"""
|
59 |
+
|
60 |
+
response = openai_client.chat.completions.create(
|
61 |
+
model="gpt-3.5-turbo",
|
62 |
+
messages=[
|
63 |
+
{"role": "system", "content": "You are a helpful assistant that processes OCR results."},
|
64 |
+
{"role": "user", "content": prompt}
|
65 |
+
]
|
66 |
+
)
|
67 |
+
|
68 |
+
return response.choices[0].message.content
|
69 |
+
except Exception as e:
|
70 |
+
return f"Error in GPT processing: {str(e)}"
|
71 |
+
|
72 |
+
# Gradio interface function
|
73 |
+
def process_image(image):
|
74 |
+
try:
|
75 |
+
# Save the image temporarily and get its path
|
76 |
+
image_path = "temp_image.png"
|
77 |
+
image.save(image_path)
|
78 |
+
|
79 |
+
# Upload image to imgbb and get URL
|
80 |
+
image_url = upload_image_to_imgbb(image_path)
|
81 |
+
if image_url.startswith("Error"):
|
82 |
+
return image_url, "Failed to process due to image upload error"
|
83 |
+
|
84 |
+
# Get OCR results
|
85 |
+
ocr_results = get_ocr_results(image_url)
|
86 |
+
if ocr_results.startswith("Error"):
|
87 |
+
return ocr_results, "Failed to process due to OCR error"
|
88 |
+
|
89 |
+
# Process with GPT
|
90 |
+
processed_results = process_ocr_with_gpt(ocr_results)
|
91 |
+
|
92 |
+
# Clean up temporary file
|
93 |
+
os.remove(image_path)
|
94 |
+
|
95 |
+
return ocr_results, processed_results
|
96 |
+
except Exception as e:
|
97 |
+
return f"Error in image processing: {str(e)}", "Failed to process due to an error"
|
98 |
+
|
99 |
+
# Create Gradio interface
|
100 |
+
iface = gr.Interface(
|
101 |
+
fn=process_image,
|
102 |
+
inputs=gr.Image(type="pil"),
|
103 |
+
outputs=[
|
104 |
+
gr.Textbox(label="OCR Results"),
|
105 |
+
gr.Textbox(label="Processed Results")
|
106 |
+
],
|
107 |
+
title="OCR and Text Processing App",
|
108 |
+
description="Upload an image to extract text and process it."
|
109 |
+
)
|
110 |
+
|
111 |
+
# Launch the app
|
112 |
+
iface.launch()
|
ocr-application/bin/2to3
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#!/Users/shashankreddykandimalla/Desktop/ocr-application/ocr-application/bin/python3.11
|
2 |
+
import sys
|
3 |
+
from lib2to3.main import main
|
4 |
+
|
5 |
+
sys.exit(main("lib2to3.fixes"))
|
ocr-application/bin/2to3-3.11
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#!/Users/shashankreddykandimalla/Desktop/ocr-application/ocr-application/bin/python3.11
|
2 |
+
import sys
|
3 |
+
from lib2to3.main import main
|
4 |
+
|
5 |
+
sys.exit(main("lib2to3.fixes"))
|
ocr-application/bin/bunzip2
ADDED
Binary file (147 kB). View file
|
|
ocr-application/bin/bzcat
ADDED
Binary file (147 kB). View file
|
|
ocr-application/bin/bzcmp
ADDED
@@ -0,0 +1,76 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#!/bin/sh
|
2 |
+
# sh is buggy on RS/6000 AIX 3.2. Replace above line with #!/bin/ksh
|
3 |
+
|
4 |
+
# Bzcmp/diff wrapped for bzip2,
|
5 |
+
# adapted from zdiff by Philippe Troin <phil@fifi.org> for Debian GNU/Linux.
|
6 |
+
|
7 |
+
# Bzcmp and bzdiff are used to invoke the cmp or the diff pro-
|
8 |
+
# gram on compressed files. All options specified are passed
|
9 |
+
# directly to cmp or diff. If only 1 file is specified, then
|
10 |
+
# the files compared are file1 and an uncompressed file1.gz.
|
11 |
+
# If two files are specified, then they are uncompressed (if
|
12 |
+
# necessary) and fed to cmp or diff. The exit status from cmp
|
13 |
+
# or diff is preserved.
|
14 |
+
|
15 |
+
PATH="/usr/bin:/bin:$PATH"; export PATH
|
16 |
+
prog=`echo $0 | sed 's|.*/||'`
|
17 |
+
case "$prog" in
|
18 |
+
*cmp) comp=${CMP-cmp} ;;
|
19 |
+
*) comp=${DIFF-diff} ;;
|
20 |
+
esac
|
21 |
+
|
22 |
+
OPTIONS=
|
23 |
+
FILES=
|
24 |
+
for ARG
|
25 |
+
do
|
26 |
+
case "$ARG" in
|
27 |
+
-*) OPTIONS="$OPTIONS $ARG";;
|
28 |
+
*) if test -f "$ARG"; then
|
29 |
+
FILES="$FILES $ARG"
|
30 |
+
else
|
31 |
+
echo "${prog}: $ARG not found or not a regular file"
|
32 |
+
exit 1
|
33 |
+
fi ;;
|
34 |
+
esac
|
35 |
+
done
|
36 |
+
if test -z "$FILES"; then
|
37 |
+
echo "Usage: $prog [${comp}_options] file [file]"
|
38 |
+
exit 1
|
39 |
+
fi
|
40 |
+
set $FILES
|
41 |
+
if test $# -eq 1; then
|
42 |
+
FILE=`echo "$1" | sed 's/.bz2$//'`
|
43 |
+
bzip2 -cd "$FILE.bz2" | $comp $OPTIONS - "$FILE"
|
44 |
+
STAT="$?"
|
45 |
+
|
46 |
+
elif test $# -eq 2; then
|
47 |
+
case "$1" in
|
48 |
+
*.bz2)
|
49 |
+
case "$2" in
|
50 |
+
*.bz2)
|
51 |
+
F=`echo "$2" | sed 's|.*/||;s|.bz2$||'`
|
52 |
+
tmp=`mktemp "${TMPDIR:-/tmp}"/bzdiff.XXXXXXXXXX` || {
|
53 |
+
echo 'cannot create a temporary file' >&2
|
54 |
+
exit 1
|
55 |
+
}
|
56 |
+
bzip2 -cdfq "$2" > "$tmp"
|
57 |
+
bzip2 -cdfq "$1" | $comp $OPTIONS - "$tmp"
|
58 |
+
STAT="$?"
|
59 |
+
/bin/rm -f "$tmp";;
|
60 |
+
|
61 |
+
*) bzip2 -cdfq "$1" | $comp $OPTIONS - "$2"
|
62 |
+
STAT="$?";;
|
63 |
+
esac;;
|
64 |
+
*) case "$2" in
|
65 |
+
*.bz2)
|
66 |
+
bzip2 -cdfq "$2" | $comp $OPTIONS "$1" -
|
67 |
+
STAT="$?";;
|
68 |
+
*) $comp $OPTIONS "$1" "$2"
|
69 |
+
STAT="$?";;
|
70 |
+
esac;;
|
71 |
+
esac
|
72 |
+
else
|
73 |
+
echo "Usage: $prog [${comp}_options] file [file]"
|
74 |
+
exit 1
|
75 |
+
fi
|
76 |
+
exit "$STAT"
|
ocr-application/bin/bzdiff
ADDED
@@ -0,0 +1,76 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#!/bin/sh
|
2 |
+
# sh is buggy on RS/6000 AIX 3.2. Replace above line with #!/bin/ksh
|
3 |
+
|
4 |
+
# Bzcmp/diff wrapped for bzip2,
|
5 |
+
# adapted from zdiff by Philippe Troin <phil@fifi.org> for Debian GNU/Linux.
|
6 |
+
|
7 |
+
# Bzcmp and bzdiff are used to invoke the cmp or the diff pro-
|
8 |
+
# gram on compressed files. All options specified are passed
|
9 |
+
# directly to cmp or diff. If only 1 file is specified, then
|
10 |
+
# the files compared are file1 and an uncompressed file1.gz.
|
11 |
+
# If two files are specified, then they are uncompressed (if
|
12 |
+
# necessary) and fed to cmp or diff. The exit status from cmp
|
13 |
+
# or diff is preserved.
|
14 |
+
|
15 |
+
PATH="/usr/bin:/bin:$PATH"; export PATH
|
16 |
+
prog=`echo $0 | sed 's|.*/||'`
|
17 |
+
case "$prog" in
|
18 |
+
*cmp) comp=${CMP-cmp} ;;
|
19 |
+
*) comp=${DIFF-diff} ;;
|
20 |
+
esac
|
21 |
+
|
22 |
+
OPTIONS=
|
23 |
+
FILES=
|
24 |
+
for ARG
|
25 |
+
do
|
26 |
+
case "$ARG" in
|
27 |
+
-*) OPTIONS="$OPTIONS $ARG";;
|
28 |
+
*) if test -f "$ARG"; then
|
29 |
+
FILES="$FILES $ARG"
|
30 |
+
else
|
31 |
+
echo "${prog}: $ARG not found or not a regular file"
|
32 |
+
exit 1
|
33 |
+
fi ;;
|
34 |
+
esac
|
35 |
+
done
|
36 |
+
if test -z "$FILES"; then
|
37 |
+
echo "Usage: $prog [${comp}_options] file [file]"
|
38 |
+
exit 1
|
39 |
+
fi
|
40 |
+
set $FILES
|
41 |
+
if test $# -eq 1; then
|
42 |
+
FILE=`echo "$1" | sed 's/.bz2$//'`
|
43 |
+
bzip2 -cd "$FILE.bz2" | $comp $OPTIONS - "$FILE"
|
44 |
+
STAT="$?"
|
45 |
+
|
46 |
+
elif test $# -eq 2; then
|
47 |
+
case "$1" in
|
48 |
+
*.bz2)
|
49 |
+
case "$2" in
|
50 |
+
*.bz2)
|
51 |
+
F=`echo "$2" | sed 's|.*/||;s|.bz2$||'`
|
52 |
+
tmp=`mktemp "${TMPDIR:-/tmp}"/bzdiff.XXXXXXXXXX` || {
|
53 |
+
echo 'cannot create a temporary file' >&2
|
54 |
+
exit 1
|
55 |
+
}
|
56 |
+
bzip2 -cdfq "$2" > "$tmp"
|
57 |
+
bzip2 -cdfq "$1" | $comp $OPTIONS - "$tmp"
|
58 |
+
STAT="$?"
|
59 |
+
/bin/rm -f "$tmp";;
|
60 |
+
|
61 |
+
*) bzip2 -cdfq "$1" | $comp $OPTIONS - "$2"
|
62 |
+
STAT="$?";;
|
63 |
+
esac;;
|
64 |
+
*) case "$2" in
|
65 |
+
*.bz2)
|
66 |
+
bzip2 -cdfq "$2" | $comp $OPTIONS "$1" -
|
67 |
+
STAT="$?";;
|
68 |
+
*) $comp $OPTIONS "$1" "$2"
|
69 |
+
STAT="$?";;
|
70 |
+
esac;;
|
71 |
+
esac
|
72 |
+
else
|
73 |
+
echo "Usage: $prog [${comp}_options] file [file]"
|
74 |
+
exit 1
|
75 |
+
fi
|
76 |
+
exit "$STAT"
|
ocr-application/bin/bzegrep
ADDED
@@ -0,0 +1,85 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#!/bin/sh
|
2 |
+
|
3 |
+
# Bzgrep wrapped for bzip2,
|
4 |
+
# adapted from zgrep by Philippe Troin <phil@fifi.org> for Debian GNU/Linux.
|
5 |
+
## zgrep notice:
|
6 |
+
## zgrep -- a wrapper around a grep program that decompresses files as needed
|
7 |
+
## Adapted from a version sent by Charles Levert <charles@comm.polymtl.ca>
|
8 |
+
|
9 |
+
PATH="/usr/bin:$PATH"; export PATH
|
10 |
+
|
11 |
+
prog=`echo $0 | sed 's|.*/||'`
|
12 |
+
case "$prog" in
|
13 |
+
*egrep) grep=${EGREP-egrep} ;;
|
14 |
+
*fgrep) grep=${FGREP-fgrep} ;;
|
15 |
+
*) grep=${GREP-grep} ;;
|
16 |
+
esac
|
17 |
+
pat=""
|
18 |
+
while test $# -ne 0; do
|
19 |
+
case "$1" in
|
20 |
+
-e | -f) opt="$opt $1"; shift; pat="$1"
|
21 |
+
if test "$grep" = grep; then # grep is buggy with -e on SVR4
|
22 |
+
grep=egrep
|
23 |
+
fi;;
|
24 |
+
-A | -B) opt="$opt $1 $2"; shift;;
|
25 |
+
-*) opt="$opt $1";;
|
26 |
+
*) if test -z "$pat"; then
|
27 |
+
pat="$1"
|
28 |
+
else
|
29 |
+
break;
|
30 |
+
fi;;
|
31 |
+
esac
|
32 |
+
shift
|
33 |
+
done
|
34 |
+
|
35 |
+
if test -z "$pat"; then
|
36 |
+
echo "grep through bzip2 files"
|
37 |
+
echo "usage: $prog [grep_options] pattern [files]"
|
38 |
+
exit 1
|
39 |
+
fi
|
40 |
+
|
41 |
+
list=0
|
42 |
+
silent=0
|
43 |
+
op=`echo "$opt" | sed -e 's/ //g' -e 's/-//g'`
|
44 |
+
case "$op" in
|
45 |
+
*l*) list=1
|
46 |
+
esac
|
47 |
+
case "$op" in
|
48 |
+
*h*) silent=1
|
49 |
+
esac
|
50 |
+
|
51 |
+
if test $# -eq 0; then
|
52 |
+
bzip2 -cdfq | $grep $opt "$pat"
|
53 |
+
exit $?
|
54 |
+
fi
|
55 |
+
|
56 |
+
res=0
|
57 |
+
for i do
|
58 |
+
if test -f "$i"; then :; else if test -f "$i.bz2"; then i="$i.bz2"; fi; fi
|
59 |
+
if test $list -eq 1; then
|
60 |
+
bzip2 -cdfq "$i" | $grep $opt "$pat" 2>&1 > /dev/null && echo $i
|
61 |
+
r=$?
|
62 |
+
elif test $# -eq 1 -o $silent -eq 1; then
|
63 |
+
bzip2 -cdfq "$i" | $grep $opt "$pat"
|
64 |
+
r=$?
|
65 |
+
else
|
66 |
+
j=$(echo "$i" | sed 's/\\/&&/g;s/|/\\&/g;s/&/\\&/g')
|
67 |
+
j=`printf "%s" "$j" | tr '\n' ' '`
|
68 |
+
# A trick adapted from
|
69 |
+
# https://groups.google.com/forum/#!original/comp.unix.shell/x1345iu10eg/Nn1n-1r1uU0J
|
70 |
+
# that has the same effect as the following bash code:
|
71 |
+
# bzip2 -cdfq "$i" | $grep $opt "$pat" | sed "s|^|${j}:|"
|
72 |
+
# r=${PIPESTATUS[1]}
|
73 |
+
exec 3>&1
|
74 |
+
eval `
|
75 |
+
exec 4>&1 >&3 3>&-
|
76 |
+
{
|
77 |
+
bzip2 -cdfq "$i" 4>&-
|
78 |
+
} | {
|
79 |
+
$grep $opt "$pat" 4>&-; echo "r=$?;" >&4
|
80 |
+
} | sed "s|^|${j}:|"
|
81 |
+
`
|
82 |
+
fi
|
83 |
+
test "$r" -ne 0 && res="$r"
|
84 |
+
done
|
85 |
+
exit $res
|
ocr-application/bin/bzfgrep
ADDED
@@ -0,0 +1,85 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#!/bin/sh
|
2 |
+
|
3 |
+
# Bzgrep wrapped for bzip2,
|
4 |
+
# adapted from zgrep by Philippe Troin <phil@fifi.org> for Debian GNU/Linux.
|
5 |
+
## zgrep notice:
|
6 |
+
## zgrep -- a wrapper around a grep program that decompresses files as needed
|
7 |
+
## Adapted from a version sent by Charles Levert <charles@comm.polymtl.ca>
|
8 |
+
|
9 |
+
PATH="/usr/bin:$PATH"; export PATH
|
10 |
+
|
11 |
+
prog=`echo $0 | sed 's|.*/||'`
|
12 |
+
case "$prog" in
|
13 |
+
*egrep) grep=${EGREP-egrep} ;;
|
14 |
+
*fgrep) grep=${FGREP-fgrep} ;;
|
15 |
+
*) grep=${GREP-grep} ;;
|
16 |
+
esac
|
17 |
+
pat=""
|
18 |
+
while test $# -ne 0; do
|
19 |
+
case "$1" in
|
20 |
+
-e | -f) opt="$opt $1"; shift; pat="$1"
|
21 |
+
if test "$grep" = grep; then # grep is buggy with -e on SVR4
|
22 |
+
grep=egrep
|
23 |
+
fi;;
|
24 |
+
-A | -B) opt="$opt $1 $2"; shift;;
|
25 |
+
-*) opt="$opt $1";;
|
26 |
+
*) if test -z "$pat"; then
|
27 |
+
pat="$1"
|
28 |
+
else
|
29 |
+
break;
|
30 |
+
fi;;
|
31 |
+
esac
|
32 |
+
shift
|
33 |
+
done
|
34 |
+
|
35 |
+
if test -z "$pat"; then
|
36 |
+
echo "grep through bzip2 files"
|
37 |
+
echo "usage: $prog [grep_options] pattern [files]"
|
38 |
+
exit 1
|
39 |
+
fi
|
40 |
+
|
41 |
+
list=0
|
42 |
+
silent=0
|
43 |
+
op=`echo "$opt" | sed -e 's/ //g' -e 's/-//g'`
|
44 |
+
case "$op" in
|
45 |
+
*l*) list=1
|
46 |
+
esac
|
47 |
+
case "$op" in
|
48 |
+
*h*) silent=1
|
49 |
+
esac
|
50 |
+
|
51 |
+
if test $# -eq 0; then
|
52 |
+
bzip2 -cdfq | $grep $opt "$pat"
|
53 |
+
exit $?
|
54 |
+
fi
|
55 |
+
|
56 |
+
res=0
|
57 |
+
for i do
|
58 |
+
if test -f "$i"; then :; else if test -f "$i.bz2"; then i="$i.bz2"; fi; fi
|
59 |
+
if test $list -eq 1; then
|
60 |
+
bzip2 -cdfq "$i" | $grep $opt "$pat" 2>&1 > /dev/null && echo $i
|
61 |
+
r=$?
|
62 |
+
elif test $# -eq 1 -o $silent -eq 1; then
|
63 |
+
bzip2 -cdfq "$i" | $grep $opt "$pat"
|
64 |
+
r=$?
|
65 |
+
else
|
66 |
+
j=$(echo "$i" | sed 's/\\/&&/g;s/|/\\&/g;s/&/\\&/g')
|
67 |
+
j=`printf "%s" "$j" | tr '\n' ' '`
|
68 |
+
# A trick adapted from
|
69 |
+
# https://groups.google.com/forum/#!original/comp.unix.shell/x1345iu10eg/Nn1n-1r1uU0J
|
70 |
+
# that has the same effect as the following bash code:
|
71 |
+
# bzip2 -cdfq "$i" | $grep $opt "$pat" | sed "s|^|${j}:|"
|
72 |
+
# r=${PIPESTATUS[1]}
|
73 |
+
exec 3>&1
|
74 |
+
eval `
|
75 |
+
exec 4>&1 >&3 3>&-
|
76 |
+
{
|
77 |
+
bzip2 -cdfq "$i" 4>&-
|
78 |
+
} | {
|
79 |
+
$grep $opt "$pat" 4>&-; echo "r=$?;" >&4
|
80 |
+
} | sed "s|^|${j}:|"
|
81 |
+
`
|
82 |
+
fi
|
83 |
+
test "$r" -ne 0 && res="$r"
|
84 |
+
done
|
85 |
+
exit $res
|
ocr-application/bin/bzgrep
ADDED
@@ -0,0 +1,85 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#!/bin/sh
|
2 |
+
|
3 |
+
# Bzgrep wrapped for bzip2,
|
4 |
+
# adapted from zgrep by Philippe Troin <phil@fifi.org> for Debian GNU/Linux.
|
5 |
+
## zgrep notice:
|
6 |
+
## zgrep -- a wrapper around a grep program that decompresses files as needed
|
7 |
+
## Adapted from a version sent by Charles Levert <charles@comm.polymtl.ca>
|
8 |
+
|
9 |
+
PATH="/usr/bin:$PATH"; export PATH
|
10 |
+
|
11 |
+
prog=`echo $0 | sed 's|.*/||'`
|
12 |
+
case "$prog" in
|
13 |
+
*egrep) grep=${EGREP-egrep} ;;
|
14 |
+
*fgrep) grep=${FGREP-fgrep} ;;
|
15 |
+
*) grep=${GREP-grep} ;;
|
16 |
+
esac
|
17 |
+
pat=""
|
18 |
+
while test $# -ne 0; do
|
19 |
+
case "$1" in
|
20 |
+
-e | -f) opt="$opt $1"; shift; pat="$1"
|
21 |
+
if test "$grep" = grep; then # grep is buggy with -e on SVR4
|
22 |
+
grep=egrep
|
23 |
+
fi;;
|
24 |
+
-A | -B) opt="$opt $1 $2"; shift;;
|
25 |
+
-*) opt="$opt $1";;
|
26 |
+
*) if test -z "$pat"; then
|
27 |
+
pat="$1"
|
28 |
+
else
|
29 |
+
break;
|
30 |
+
fi;;
|
31 |
+
esac
|
32 |
+
shift
|
33 |
+
done
|
34 |
+
|
35 |
+
if test -z "$pat"; then
|
36 |
+
echo "grep through bzip2 files"
|
37 |
+
echo "usage: $prog [grep_options] pattern [files]"
|
38 |
+
exit 1
|
39 |
+
fi
|
40 |
+
|
41 |
+
list=0
|
42 |
+
silent=0
|
43 |
+
op=`echo "$opt" | sed -e 's/ //g' -e 's/-//g'`
|
44 |
+
case "$op" in
|
45 |
+
*l*) list=1
|
46 |
+
esac
|
47 |
+
case "$op" in
|
48 |
+
*h*) silent=1
|
49 |
+
esac
|
50 |
+
|
51 |
+
if test $# -eq 0; then
|
52 |
+
bzip2 -cdfq | $grep $opt "$pat"
|
53 |
+
exit $?
|
54 |
+
fi
|
55 |
+
|
56 |
+
res=0
|
57 |
+
for i do
|
58 |
+
if test -f "$i"; then :; else if test -f "$i.bz2"; then i="$i.bz2"; fi; fi
|
59 |
+
if test $list -eq 1; then
|
60 |
+
bzip2 -cdfq "$i" | $grep $opt "$pat" 2>&1 > /dev/null && echo $i
|
61 |
+
r=$?
|
62 |
+
elif test $# -eq 1 -o $silent -eq 1; then
|
63 |
+
bzip2 -cdfq "$i" | $grep $opt "$pat"
|
64 |
+
r=$?
|
65 |
+
else
|
66 |
+
j=$(echo "$i" | sed 's/\\/&&/g;s/|/\\&/g;s/&/\\&/g')
|
67 |
+
j=`printf "%s" "$j" | tr '\n' ' '`
|
68 |
+
# A trick adapted from
|
69 |
+
# https://groups.google.com/forum/#!original/comp.unix.shell/x1345iu10eg/Nn1n-1r1uU0J
|
70 |
+
# that has the same effect as the following bash code:
|
71 |
+
# bzip2 -cdfq "$i" | $grep $opt "$pat" | sed "s|^|${j}:|"
|
72 |
+
# r=${PIPESTATUS[1]}
|
73 |
+
exec 3>&1
|
74 |
+
eval `
|
75 |
+
exec 4>&1 >&3 3>&-
|
76 |
+
{
|
77 |
+
bzip2 -cdfq "$i" 4>&-
|
78 |
+
} | {
|
79 |
+
$grep $opt "$pat" 4>&-; echo "r=$?;" >&4
|
80 |
+
} | sed "s|^|${j}:|"
|
81 |
+
`
|
82 |
+
fi
|
83 |
+
test "$r" -ne 0 && res="$r"
|
84 |
+
done
|
85 |
+
exit $res
|
ocr-application/bin/bzip2
ADDED
Binary file (147 kB). View file
|
|
ocr-application/bin/bzip2recover
ADDED
Binary file (69.3 kB). View file
|
|
ocr-application/bin/bzless
ADDED
@@ -0,0 +1,61 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#!/bin/sh
|
2 |
+
|
3 |
+
# Bzmore wrapped for bzip2,
|
4 |
+
# adapted from zmore by Philippe Troin <phil@fifi.org> for Debian GNU/Linux.
|
5 |
+
|
6 |
+
PATH="/usr/bin:$PATH"; export PATH
|
7 |
+
|
8 |
+
prog=`echo $0 | sed 's|.*/||'`
|
9 |
+
case "$prog" in
|
10 |
+
*less) more=less ;;
|
11 |
+
*) more=more ;;
|
12 |
+
esac
|
13 |
+
|
14 |
+
if test "`echo -n a`" = "-n a"; then
|
15 |
+
# looks like a SysV system:
|
16 |
+
n1=''; n2='\c'
|
17 |
+
else
|
18 |
+
n1='-n'; n2=''
|
19 |
+
fi
|
20 |
+
oldtty=`stty -g 2>/dev/null`
|
21 |
+
if stty -cbreak 2>/dev/null; then
|
22 |
+
cb='cbreak'; ncb='-cbreak'
|
23 |
+
else
|
24 |
+
# 'stty min 1' resets eof to ^a on both SunOS and SysV!
|
25 |
+
cb='min 1 -icanon'; ncb='icanon eof ^d'
|
26 |
+
fi
|
27 |
+
if test $? -eq 0 -a -n "$oldtty"; then
|
28 |
+
trap 'stty $oldtty 2>/dev/null; exit' 0 2 3 5 10 13 15
|
29 |
+
else
|
30 |
+
trap 'stty $ncb echo 2>/dev/null; exit' 0 2 3 5 10 13 15
|
31 |
+
fi
|
32 |
+
|
33 |
+
if test $# = 0; then
|
34 |
+
if test -t 0; then
|
35 |
+
echo usage: $prog files...
|
36 |
+
else
|
37 |
+
bzip2 -cdfq | eval $more
|
38 |
+
fi
|
39 |
+
else
|
40 |
+
FIRST=1
|
41 |
+
for FILE
|
42 |
+
do
|
43 |
+
if test $FIRST -eq 0; then
|
44 |
+
echo $n1 "--More--(Next file: $FILE)$n2"
|
45 |
+
stty $cb -echo 2>/dev/null
|
46 |
+
ANS=`dd bs=1 count=1 2>/dev/null`
|
47 |
+
stty $ncb echo 2>/dev/null
|
48 |
+
echo " "
|
49 |
+
if test "$ANS" = 'e' -o "$ANS" = 'q'; then
|
50 |
+
exit
|
51 |
+
fi
|
52 |
+
fi
|
53 |
+
if test "$ANS" != 's'; then
|
54 |
+
echo "------> $FILE <------"
|
55 |
+
bzip2 -cdfq "$FILE" | eval $more
|
56 |
+
fi
|
57 |
+
if test -t; then
|
58 |
+
FIRST=0
|
59 |
+
fi
|
60 |
+
done
|
61 |
+
fi
|
ocr-application/bin/bzmore
ADDED
@@ -0,0 +1,61 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#!/bin/sh
|
2 |
+
|
3 |
+
# Bzmore wrapped for bzip2,
|
4 |
+
# adapted from zmore by Philippe Troin <phil@fifi.org> for Debian GNU/Linux.
|
5 |
+
|
6 |
+
PATH="/usr/bin:$PATH"; export PATH
|
7 |
+
|
8 |
+
prog=`echo $0 | sed 's|.*/||'`
|
9 |
+
case "$prog" in
|
10 |
+
*less) more=less ;;
|
11 |
+
*) more=more ;;
|
12 |
+
esac
|
13 |
+
|
14 |
+
if test "`echo -n a`" = "-n a"; then
|
15 |
+
# looks like a SysV system:
|
16 |
+
n1=''; n2='\c'
|
17 |
+
else
|
18 |
+
n1='-n'; n2=''
|
19 |
+
fi
|
20 |
+
oldtty=`stty -g 2>/dev/null`
|
21 |
+
if stty -cbreak 2>/dev/null; then
|
22 |
+
cb='cbreak'; ncb='-cbreak'
|
23 |
+
else
|
24 |
+
# 'stty min 1' resets eof to ^a on both SunOS and SysV!
|
25 |
+
cb='min 1 -icanon'; ncb='icanon eof ^d'
|
26 |
+
fi
|
27 |
+
if test $? -eq 0 -a -n "$oldtty"; then
|
28 |
+
trap 'stty $oldtty 2>/dev/null; exit' 0 2 3 5 10 13 15
|
29 |
+
else
|
30 |
+
trap 'stty $ncb echo 2>/dev/null; exit' 0 2 3 5 10 13 15
|
31 |
+
fi
|
32 |
+
|
33 |
+
if test $# = 0; then
|
34 |
+
if test -t 0; then
|
35 |
+
echo usage: $prog files...
|
36 |
+
else
|
37 |
+
bzip2 -cdfq | eval $more
|
38 |
+
fi
|
39 |
+
else
|
40 |
+
FIRST=1
|
41 |
+
for FILE
|
42 |
+
do
|
43 |
+
if test $FIRST -eq 0; then
|
44 |
+
echo $n1 "--More--(Next file: $FILE)$n2"
|
45 |
+
stty $cb -echo 2>/dev/null
|
46 |
+
ANS=`dd bs=1 count=1 2>/dev/null`
|
47 |
+
stty $ncb echo 2>/dev/null
|
48 |
+
echo " "
|
49 |
+
if test "$ANS" = 'e' -o "$ANS" = 'q'; then
|
50 |
+
exit
|
51 |
+
fi
|
52 |
+
fi
|
53 |
+
if test "$ANS" != 's'; then
|
54 |
+
echo "------> $FILE <------"
|
55 |
+
bzip2 -cdfq "$FILE" | eval $more
|
56 |
+
fi
|
57 |
+
if test -t; then
|
58 |
+
FIRST=0
|
59 |
+
fi
|
60 |
+
done
|
61 |
+
fi
|
ocr-application/bin/c_rehash
ADDED
@@ -0,0 +1,252 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#!/var/folders/nz/j6p8yfhx1mv_0grj5xl4650h0000gp/T/abs_0b9u2d318b/croot/openssl_1718384848925/_build_env/bin/perl
|
2 |
+
|
3 |
+
# WARNING: do not edit!
|
4 |
+
# Generated by Makefile from tools/c_rehash.in
|
5 |
+
# Copyright 1999-2022 The OpenSSL Project Authors. All Rights Reserved.
|
6 |
+
#
|
7 |
+
# Licensed under the Apache License 2.0 (the "License"). You may not use
|
8 |
+
# this file except in compliance with the License. You can obtain a copy
|
9 |
+
# in the file LICENSE in the source distribution or at
|
10 |
+
# https://www.openssl.org/source/license.html
|
11 |
+
|
12 |
+
# Perl c_rehash script, scan all files in a directory
|
13 |
+
# and add symbolic links to their hash values.
|
14 |
+
|
15 |
+
my $dir = "";
|
16 |
+
my $prefix = "/Users/shashankreddykandimalla/Desktop/ocr-application/ocr-application";
|
17 |
+
|
18 |
+
my $errorcount = 0;
|
19 |
+
my $openssl = $ENV{OPENSSL} || "openssl";
|
20 |
+
my $pwd;
|
21 |
+
my $x509hash = "-subject_hash";
|
22 |
+
my $crlhash = "-hash";
|
23 |
+
my $verbose = 0;
|
24 |
+
my $symlink_exists=eval {symlink("",""); 1};
|
25 |
+
my $removelinks = 1;
|
26 |
+
|
27 |
+
## Parse flags.
|
28 |
+
while ( $ARGV[0] =~ /^-/ ) {
|
29 |
+
my $flag = shift @ARGV;
|
30 |
+
last if ( $flag eq '--');
|
31 |
+
if ( $flag eq '-old') {
|
32 |
+
$x509hash = "-subject_hash_old";
|
33 |
+
$crlhash = "-hash_old";
|
34 |
+
} elsif ( $flag eq '-h' || $flag eq '-help' ) {
|
35 |
+
help();
|
36 |
+
} elsif ( $flag eq '-n' ) {
|
37 |
+
$removelinks = 0;
|
38 |
+
} elsif ( $flag eq '-v' ) {
|
39 |
+
$verbose++;
|
40 |
+
}
|
41 |
+
else {
|
42 |
+
print STDERR "Usage error; try -h.\n";
|
43 |
+
exit 1;
|
44 |
+
}
|
45 |
+
}
|
46 |
+
|
47 |
+
sub help {
|
48 |
+
print "Usage: c_rehash [-old] [-h] [-help] [-v] [dirs...]\n";
|
49 |
+
print " -old use old-style digest\n";
|
50 |
+
print " -h or -help print this help text\n";
|
51 |
+
print " -v print files removed and linked\n";
|
52 |
+
exit 0;
|
53 |
+
}
|
54 |
+
|
55 |
+
eval "require Cwd";
|
56 |
+
if (defined(&Cwd::getcwd)) {
|
57 |
+
$pwd=Cwd::getcwd();
|
58 |
+
} else {
|
59 |
+
$pwd=`pwd`;
|
60 |
+
chomp($pwd);
|
61 |
+
}
|
62 |
+
|
63 |
+
# DOS/Win32 or Unix delimiter? Prefix our installdir, then search.
|
64 |
+
my $path_delim = ($pwd =~ /^[a-z]\:/i) ? ';' : ':';
|
65 |
+
$ENV{PATH} = "$prefix/bin" . ($ENV{PATH} ? $path_delim . $ENV{PATH} : "");
|
66 |
+
|
67 |
+
if (! -x $openssl) {
|
68 |
+
my $found = 0;
|
69 |
+
foreach (split /$path_delim/, $ENV{PATH}) {
|
70 |
+
if (-x "$_/$openssl") {
|
71 |
+
$found = 1;
|
72 |
+
$openssl = "$_/$openssl";
|
73 |
+
last;
|
74 |
+
}
|
75 |
+
}
|
76 |
+
if ($found == 0) {
|
77 |
+
print STDERR "c_rehash: rehashing skipped ('openssl' program not available)\n";
|
78 |
+
exit 0;
|
79 |
+
}
|
80 |
+
}
|
81 |
+
|
82 |
+
if (@ARGV) {
|
83 |
+
@dirlist = @ARGV;
|
84 |
+
} elsif ($ENV{SSL_CERT_DIR}) {
|
85 |
+
@dirlist = split /$path_delim/, $ENV{SSL_CERT_DIR};
|
86 |
+
} else {
|
87 |
+
$dirlist[0] = "$dir/certs";
|
88 |
+
}
|
89 |
+
|
90 |
+
if (-d $dirlist[0]) {
|
91 |
+
chdir $dirlist[0];
|
92 |
+
$openssl="$pwd/$openssl" if (!-x $openssl);
|
93 |
+
chdir $pwd;
|
94 |
+
}
|
95 |
+
|
96 |
+
foreach (@dirlist) {
|
97 |
+
if (-d $_ ) {
|
98 |
+
if ( -w $_) {
|
99 |
+
hash_dir($_);
|
100 |
+
} else {
|
101 |
+
print "Skipping $_, can't write\n";
|
102 |
+
$errorcount++;
|
103 |
+
}
|
104 |
+
}
|
105 |
+
}
|
106 |
+
exit($errorcount);
|
107 |
+
|
108 |
+
sub copy_file {
|
109 |
+
my ($src_fname, $dst_fname) = @_;
|
110 |
+
|
111 |
+
if (open(my $in, "<", $src_fname)) {
|
112 |
+
if (open(my $out, ">", $dst_fname)) {
|
113 |
+
print $out $_ while (<$in>);
|
114 |
+
close $out;
|
115 |
+
} else {
|
116 |
+
warn "Cannot open $dst_fname for write, $!";
|
117 |
+
}
|
118 |
+
close $in;
|
119 |
+
} else {
|
120 |
+
warn "Cannot open $src_fname for read, $!";
|
121 |
+
}
|
122 |
+
}
|
123 |
+
|
124 |
+
sub hash_dir {
|
125 |
+
my $dir = shift;
|
126 |
+
my %hashlist;
|
127 |
+
|
128 |
+
print "Doing $dir\n";
|
129 |
+
|
130 |
+
if (!chdir $dir) {
|
131 |
+
print STDERR "WARNING: Cannot chdir to '$dir', $!\n";
|
132 |
+
return;
|
133 |
+
}
|
134 |
+
|
135 |
+
opendir(DIR, ".") || print STDERR "WARNING: Cannot opendir '.', $!\n";
|
136 |
+
my @flist = sort readdir(DIR);
|
137 |
+
closedir DIR;
|
138 |
+
if ( $removelinks ) {
|
139 |
+
# Delete any existing symbolic links
|
140 |
+
foreach (grep {/^[\da-f]+\.r{0,1}\d+$/} @flist) {
|
141 |
+
if (-l $_) {
|
142 |
+
print "unlink $_\n" if $verbose;
|
143 |
+
unlink $_ || warn "Can't unlink $_, $!\n";
|
144 |
+
}
|
145 |
+
}
|
146 |
+
}
|
147 |
+
FILE: foreach $fname (grep {/\.(pem)|(crt)|(cer)|(crl)$/} @flist) {
|
148 |
+
# Check to see if certificates and/or CRLs present.
|
149 |
+
my ($cert, $crl) = check_file($fname);
|
150 |
+
if (!$cert && !$crl) {
|
151 |
+
print STDERR "WARNING: $fname does not contain a certificate or CRL: skipping\n";
|
152 |
+
next;
|
153 |
+
}
|
154 |
+
link_hash_cert($fname) if ($cert);
|
155 |
+
link_hash_crl($fname) if ($crl);
|
156 |
+
}
|
157 |
+
|
158 |
+
chdir $pwd;
|
159 |
+
}
|
160 |
+
|
161 |
+
sub check_file {
|
162 |
+
my ($is_cert, $is_crl) = (0,0);
|
163 |
+
my $fname = $_[0];
|
164 |
+
|
165 |
+
open(my $in, "<", $fname);
|
166 |
+
while(<$in>) {
|
167 |
+
if (/^-----BEGIN (.*)-----/) {
|
168 |
+
my $hdr = $1;
|
169 |
+
if ($hdr =~ /^(X509 |TRUSTED |)CERTIFICATE$/) {
|
170 |
+
$is_cert = 1;
|
171 |
+
last if ($is_crl);
|
172 |
+
} elsif ($hdr eq "X509 CRL") {
|
173 |
+
$is_crl = 1;
|
174 |
+
last if ($is_cert);
|
175 |
+
}
|
176 |
+
}
|
177 |
+
}
|
178 |
+
close $in;
|
179 |
+
return ($is_cert, $is_crl);
|
180 |
+
}
|
181 |
+
|
182 |
+
sub compute_hash {
|
183 |
+
my $fh;
|
184 |
+
if ( $^O eq "VMS" ) {
|
185 |
+
# VMS uses the open through shell
|
186 |
+
# The file names are safe there and list form is unsupported
|
187 |
+
if (!open($fh, "-|", join(' ', @_))) {
|
188 |
+
print STDERR "Cannot compute hash on '$fname'\n";
|
189 |
+
return;
|
190 |
+
}
|
191 |
+
} else {
|
192 |
+
if (!open($fh, "-|", @_)) {
|
193 |
+
print STDERR "Cannot compute hash on '$fname'\n";
|
194 |
+
return;
|
195 |
+
}
|
196 |
+
}
|
197 |
+
return (<$fh>, <$fh>);
|
198 |
+
}
|
199 |
+
|
200 |
+
# Link a certificate to its subject name hash value, each hash is of
|
201 |
+
# the form <hash>.<n> where n is an integer. If the hash value already exists
|
202 |
+
# then we need to up the value of n, unless its a duplicate in which
|
203 |
+
# case we skip the link. We check for duplicates by comparing the
|
204 |
+
# certificate fingerprints
|
205 |
+
|
206 |
+
sub link_hash_cert {
|
207 |
+
link_hash($_[0], 'cert');
|
208 |
+
}
|
209 |
+
|
210 |
+
# Same as above except for a CRL. CRL links are of the form <hash>.r<n>
|
211 |
+
|
212 |
+
sub link_hash_crl {
|
213 |
+
link_hash($_[0], 'crl');
|
214 |
+
}
|
215 |
+
|
216 |
+
sub link_hash {
|
217 |
+
my ($fname, $type) = @_;
|
218 |
+
my $is_cert = $type eq 'cert';
|
219 |
+
|
220 |
+
my ($hash, $fprint) = compute_hash($openssl,
|
221 |
+
$is_cert ? "x509" : "crl",
|
222 |
+
$is_cert ? $x509hash : $crlhash,
|
223 |
+
"-fingerprint", "-noout",
|
224 |
+
"-in", $fname);
|
225 |
+
chomp $hash;
|
226 |
+
$hash =~ s/^.*=// if !$is_cert;
|
227 |
+
chomp $fprint;
|
228 |
+
return if !$hash;
|
229 |
+
$fprint =~ s/^.*=//;
|
230 |
+
$fprint =~ tr/://d;
|
231 |
+
my $suffix = 0;
|
232 |
+
# Search for an unused hash filename
|
233 |
+
my $crlmark = $is_cert ? "" : "r";
|
234 |
+
while(exists $hashlist{"$hash.$crlmark$suffix"}) {
|
235 |
+
# Hash matches: if fingerprint matches its a duplicate cert
|
236 |
+
if ($hashlist{"$hash.$crlmark$suffix"} eq $fprint) {
|
237 |
+
my $what = $is_cert ? 'certificate' : 'CRL';
|
238 |
+
print STDERR "WARNING: Skipping duplicate $what $fname\n";
|
239 |
+
return;
|
240 |
+
}
|
241 |
+
$suffix++;
|
242 |
+
}
|
243 |
+
$hash .= ".$crlmark$suffix";
|
244 |
+
if ($symlink_exists) {
|
245 |
+
print "link $fname -> $hash\n" if $verbose;
|
246 |
+
symlink $fname, $hash || warn "Can't symlink, $!";
|
247 |
+
} else {
|
248 |
+
print "copy $fname -> $hash\n" if $verbose;
|
249 |
+
copy_file($fname, $hash);
|
250 |
+
}
|
251 |
+
$hashlist{$hash} = $fprint;
|
252 |
+
}
|
ocr-application/bin/captoinfo
ADDED
Binary file (123 kB). View file
|
|
ocr-application/bin/clear
ADDED
Binary file (68.4 kB). View file
|
|
ocr-application/bin/distro
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#!/Users/shashankreddykandimalla/Desktop/ocr-application/ocr-application/bin/python
|
2 |
+
# -*- coding: utf-8 -*-
|
3 |
+
import re
|
4 |
+
import sys
|
5 |
+
from distro.distro import main
|
6 |
+
if __name__ == '__main__':
|
7 |
+
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
8 |
+
sys.exit(main())
|
ocr-application/bin/dotenv
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#!/Users/shashankreddykandimalla/Desktop/ocr-application/ocr-application/bin/python
|
2 |
+
# -*- coding: utf-8 -*-
|
3 |
+
import re
|
4 |
+
import sys
|
5 |
+
from dotenv.__main__ import cli
|
6 |
+
if __name__ == '__main__':
|
7 |
+
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
8 |
+
sys.exit(cli())
|
ocr-application/bin/email_validator
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#!/Users/shashankreddykandimalla/Desktop/ocr-application/ocr-application/bin/python
|
2 |
+
# -*- coding: utf-8 -*-
|
3 |
+
import re
|
4 |
+
import sys
|
5 |
+
from email_validator.__main__ import main
|
6 |
+
if __name__ == '__main__':
|
7 |
+
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
8 |
+
sys.exit(main())
|
ocr-application/bin/f2py
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#!/Users/shashankreddykandimalla/Desktop/ocr-application/ocr-application/bin/python
|
2 |
+
# -*- coding: utf-8 -*-
|
3 |
+
import re
|
4 |
+
import sys
|
5 |
+
from numpy.f2py.f2py2e import main
|
6 |
+
if __name__ == '__main__':
|
7 |
+
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
8 |
+
sys.exit(main())
|
ocr-application/bin/fastapi
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#!/Users/shashankreddykandimalla/Desktop/ocr-application/ocr-application/bin/python
|
2 |
+
# -*- coding: utf-8 -*-
|
3 |
+
import re
|
4 |
+
import sys
|
5 |
+
from fastapi_cli.cli import main
|
6 |
+
if __name__ == '__main__':
|
7 |
+
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
8 |
+
sys.exit(main())
|
ocr-application/bin/fonttools
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#!/Users/shashankreddykandimalla/Desktop/ocr-application/ocr-application/bin/python
|
2 |
+
# -*- coding: utf-8 -*-
|
3 |
+
import re
|
4 |
+
import sys
|
5 |
+
from fontTools.__main__ import main
|
6 |
+
if __name__ == '__main__':
|
7 |
+
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
8 |
+
sys.exit(main())
|
ocr-application/bin/gradio
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#!/Users/shashankreddykandimalla/Desktop/ocr-application/ocr-application/bin/python
|
2 |
+
# -*- coding: utf-8 -*-
|
3 |
+
import re
|
4 |
+
import sys
|
5 |
+
from gradio.cli import cli
|
6 |
+
if __name__ == '__main__':
|
7 |
+
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
8 |
+
sys.exit(cli())
|
ocr-application/bin/httpx
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#!/Users/shashankreddykandimalla/Desktop/ocr-application/ocr-application/bin/python
|
2 |
+
# -*- coding: utf-8 -*-
|
3 |
+
import re
|
4 |
+
import sys
|
5 |
+
from httpx import main
|
6 |
+
if __name__ == '__main__':
|
7 |
+
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
8 |
+
sys.exit(main())
|
ocr-application/bin/huggingface-cli
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#!/Users/shashankreddykandimalla/Desktop/ocr-application/ocr-application/bin/python
|
2 |
+
# -*- coding: utf-8 -*-
|
3 |
+
import re
|
4 |
+
import sys
|
5 |
+
from huggingface_hub.commands.huggingface_cli import main
|
6 |
+
if __name__ == '__main__':
|
7 |
+
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
8 |
+
sys.exit(main())
|
ocr-application/bin/idle3
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#!/Users/shashankreddykandimalla/Desktop/ocr-application/ocr-application/bin/python3.11
|
2 |
+
|
3 |
+
from idlelib.pyshell import main
|
4 |
+
if __name__ == '__main__':
|
5 |
+
main()
|
ocr-application/bin/idle3.11
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#!/Users/shashankreddykandimalla/Desktop/ocr-application/ocr-application/bin/python3.11
|
2 |
+
|
3 |
+
from idlelib.pyshell import main
|
4 |
+
if __name__ == '__main__':
|
5 |
+
main()
|
ocr-application/bin/infocmp
ADDED
Binary file (105 kB). View file
|
|
ocr-application/bin/infotocap
ADDED
Binary file (123 kB). View file
|
|
ocr-application/bin/lzcat
ADDED
Binary file (130 kB). View file
|
|
ocr-application/bin/lzcmp
ADDED
@@ -0,0 +1,215 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#!/bin/sh
|
2 |
+
|
3 |
+
# Copyright (C) 1998, 2002, 2006, 2007 Free Software Foundation
|
4 |
+
# Copyright (C) 1993 Jean-loup Gailly
|
5 |
+
|
6 |
+
# Modified for XZ Utils by Andrew Dudman and Lasse Collin.
|
7 |
+
|
8 |
+
# This program is free software; you can redistribute it and/or modify
|
9 |
+
# it under the terms of the GNU General Public License as published by
|
10 |
+
# the Free Software Foundation; either version 2 of the License, or
|
11 |
+
# (at your option) any later version.
|
12 |
+
|
13 |
+
# This program is distributed in the hope that it will be useful,
|
14 |
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
15 |
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
16 |
+
# GNU General Public License for more details.
|
17 |
+
|
18 |
+
|
19 |
+
#SET_PATH - This line is a placeholder to ease patching this script.
|
20 |
+
|
21 |
+
# Instead of unsetting XZ_OPT, just make sure that xz will use file format
|
22 |
+
# autodetection. This way memory usage limit and thread limit can be
|
23 |
+
# specified via XZ_OPT. With gzip, bzip2, and lzop it's OK to just unset the
|
24 |
+
# environment variables.
|
25 |
+
xz='xz --format=auto'
|
26 |
+
unset GZIP BZIP BZIP2 LZOP
|
27 |
+
|
28 |
+
case ${0##*/} in
|
29 |
+
*cmp*) prog=xzcmp; cmp=${CMP:-cmp};;
|
30 |
+
*) prog=xzdiff; cmp=${DIFF:-diff};;
|
31 |
+
esac
|
32 |
+
|
33 |
+
version="$prog (XZ Utils) 5.4.6"
|
34 |
+
|
35 |
+
usage="Usage: ${0##*/} [OPTION]... FILE1 [FILE2]
|
36 |
+
Compare FILE1 to FILE2, using their uncompressed contents if they are
|
37 |
+
compressed. If FILE2 is omitted, then the files compared are FILE1 and
|
38 |
+
FILE1 from which the compression format suffix has been stripped.
|
39 |
+
|
40 |
+
Do comparisons like '$cmp' does. OPTIONs are the same as for '$cmp'.
|
41 |
+
|
42 |
+
Report bugs to <xz@tukaani.org>."
|
43 |
+
|
44 |
+
# sed script to escape all ' for the shell, and then (to handle trailing
|
45 |
+
# newlines correctly) turn trailing X on last line into '.
|
46 |
+
escape='
|
47 |
+
s/'\''/'\''\\'\'''\''/g
|
48 |
+
$s/X$/'\''/
|
49 |
+
'
|
50 |
+
|
51 |
+
while :; do
|
52 |
+
case $1 in
|
53 |
+
--h*) printf '%s\n' "$usage" || exit 2; exit;;
|
54 |
+
--v*) printf '%s\n' "$version" || exit 2; exit;;
|
55 |
+
--) shift; break;;
|
56 |
+
-*\'*) cmp="$cmp '"`printf '%sX\n' "$1" | sed "$escape"`;;
|
57 |
+
-?*) cmp="$cmp '$1'";;
|
58 |
+
*) break;;
|
59 |
+
esac
|
60 |
+
shift
|
61 |
+
done
|
62 |
+
cmp="$cmp --"
|
63 |
+
|
64 |
+
for file; do
|
65 |
+
test "X$file" = X- || <"$file" || exit 2
|
66 |
+
done
|
67 |
+
|
68 |
+
# xz needs -qQ to ignore warnings like unsupported check type.
|
69 |
+
xz1="$xz -qQ"
|
70 |
+
xz2="$xz -qQ"
|
71 |
+
xz_status=0
|
72 |
+
exec 3>&1
|
73 |
+
|
74 |
+
if test $# -eq 1; then
|
75 |
+
case $1 in
|
76 |
+
*[-.]xz | *[-.]lzma | *[-.]lz | *.t[lx]z)
|
77 |
+
;;
|
78 |
+
*[-.]bz2 | *.tbz | *.tbz2)
|
79 |
+
xz1=bzip2;;
|
80 |
+
*[-.][zZ] | *_z | *[-.]gz | *.t[ag]z)
|
81 |
+
xz1=gzip;;
|
82 |
+
*[-.]lzo | *.tzo)
|
83 |
+
xz1=lzop;;
|
84 |
+
*[-.]zst | *.tzst)
|
85 |
+
xz1='zstd -q';;
|
86 |
+
*)
|
87 |
+
printf '%s\n' "$0: $1: Unknown compressed file name suffix" >&2
|
88 |
+
exit 2;;
|
89 |
+
esac
|
90 |
+
case $1 in
|
91 |
+
*[-.][zZ] | *_z | *[-.][gx]z | *[-.]bz2 | *[-.]lzma | *[-.]lz | *[-.]lzo | *[-.]zst)
|
92 |
+
FILE=`expr "X$1" : 'X\(.*\)[-.][abglmostxzZ2]*$'`;;
|
93 |
+
*.t[abglx]z)
|
94 |
+
FILE=`expr "X$1" : 'X\(.*[-.]t\)[abglx]z$'`ar;;
|
95 |
+
*.tbz2)
|
96 |
+
FILE=`expr "X$1" : 'X\(.*[-.]t\)bz2$'`ar;;
|
97 |
+
*.tzo)
|
98 |
+
FILE=`expr "X$1" : 'X\(.*[-.]t\)zo$'`ar;;
|
99 |
+
*.tzst)
|
100 |
+
FILE=`expr "X$1" : 'X\(.*[-.]t\)zst$'`ar;;
|
101 |
+
esac
|
102 |
+
xz_status=$(
|
103 |
+
exec 4>&1
|
104 |
+
($xz1 -cd -- "$1" 4>&-; echo $? >&4) 3>&- | eval "$cmp" - '"$FILE"' >&3
|
105 |
+
)
|
106 |
+
elif test $# -eq 2; then
|
107 |
+
case $1 in
|
108 |
+
*[-.]bz2 | *.tbz | *.tbz2) xz1=bzip2;;
|
109 |
+
*[-.][zZ] | *_z | *[-.]gz | *.t[ag]z) xz1=gzip;;
|
110 |
+
*[-.]lzo | *.tzo) xz1=lzop;;
|
111 |
+
*[-.]zst | *.tzst) xz1='zstd -q';;
|
112 |
+
esac
|
113 |
+
case $2 in
|
114 |
+
*[-.]bz2 | *.tbz | *.tbz2) xz2=bzip2;;
|
115 |
+
*[-.][zZ] | *_z | *[-.]gz | *.t[ag]z) xz2=gzip;;
|
116 |
+
*[-.]lzo | *.tzo) xz2=lzop;;
|
117 |
+
*[-.]zst | *.tzst) xz2='zstd -q';;
|
118 |
+
esac
|
119 |
+
case $1 in
|
120 |
+
*[-.][zZ] | *_z | *[-.][gx]z | *[-.]bz2 | *[-.]lzma | *[-.]lz | *.t[abglx]z | *.tbz2 | *[-.]lzo | *.tzo | *[-.]zst | *.tzst | -)
|
121 |
+
case "$2" in
|
122 |
+
*[-.][zZ] | *_z | *[-.][gx]z | *[-.]bz2 | *[-.]lzma | *[-.]lz | *.t[abglx]z | *.tbz2 | *[-.]lzo | *.tzo | *[-.]zst | *.tzst | -)
|
123 |
+
if test "$1$2" = --; then
|
124 |
+
xz_status=$(
|
125 |
+
exec 4>&1
|
126 |
+
($xz1 -cdf - 4>&-; echo $? >&4) 3>&- |
|
127 |
+
eval "$cmp" - - >&3
|
128 |
+
)
|
129 |
+
elif # Reject Solaris 8's buggy /bin/bash 2.03.
|
130 |
+
echo X | (echo X | eval "$cmp" /dev/fd/5 - >/dev/null 2>&1) 5<&0; then
|
131 |
+
# NOTE: xz_status will contain two numbers.
|
132 |
+
xz_status=$(
|
133 |
+
exec 4>&1
|
134 |
+
($xz1 -cdf -- "$1" 4>&-; echo $? >&4) 3>&- |
|
135 |
+
( ($xz2 -cdf -- "$2" 4>&-; echo $? >&4) 3>&- 5<&- </dev/null |
|
136 |
+
eval "$cmp" /dev/fd/5 - >&3) 5<&0
|
137 |
+
)
|
138 |
+
else
|
139 |
+
F=`expr "/$2" : '.*/\(.*\)[-.][ablmotxz2]*$'` || F=$prog
|
140 |
+
tmp=
|
141 |
+
trap '
|
142 |
+
test -n "$tmp" && rm -rf "$tmp"
|
143 |
+
(exit 2); exit 2
|
144 |
+
' HUP INT PIPE TERM 0
|
145 |
+
if type mktemp >/dev/null 2>&1; then
|
146 |
+
# Note that FreeBSD's mktemp isn't fully compatible with
|
147 |
+
# the implementations from mktemp.org and GNU coreutils.
|
148 |
+
# It is important that the -t argument is the last argument
|
149 |
+
# and that no "--" is used between -t and the template argument.
|
150 |
+
# This way this command works on all implementations.
|
151 |
+
tmp=`mktemp -d -t "$prog.XXXXXXXXXX"` || exit 2
|
152 |
+
else
|
153 |
+
# Fallback code if mktemp is missing. This isn't as
|
154 |
+
# robust as using mktemp since this doesn't try with
|
155 |
+
# different file names in case of a file name conflict.
|
156 |
+
#
|
157 |
+
# There's no need to save the original umask since
|
158 |
+
# we don't create any non-temp files. Note that using
|
159 |
+
# mkdir -m 0077 isn't secure since some mkdir implementations
|
160 |
+
# create the dir with the default umask and chmod the
|
161 |
+
# the dir afterwards.
|
162 |
+
umask 0077
|
163 |
+
mkdir -- "${TMPDIR-/tmp}/$prog.$$" || exit 2
|
164 |
+
tmp="${TMPDIR-/tmp}/$prog.$$"
|
165 |
+
fi
|
166 |
+
$xz2 -cdf -- "$2" > "$tmp/$F" || exit 2
|
167 |
+
xz_status=$(
|
168 |
+
exec 4>&1
|
169 |
+
($xz1 -cdf -- "$1" 4>&-; echo $? >&4) 3>&- |
|
170 |
+
eval "$cmp" - '"$tmp/$F"' >&3
|
171 |
+
)
|
172 |
+
cmp_status=$?
|
173 |
+
rm -rf "$tmp" || xz_status=$?
|
174 |
+
trap - HUP INT PIPE TERM 0
|
175 |
+
(exit $cmp_status)
|
176 |
+
fi;;
|
177 |
+
*)
|
178 |
+
xz_status=$(
|
179 |
+
exec 4>&1
|
180 |
+
($xz1 -cdf -- "$1" 4>&-; echo $? >&4) 3>&- |
|
181 |
+
eval "$cmp" - '"$2"' >&3
|
182 |
+
);;
|
183 |
+
esac;;
|
184 |
+
*)
|
185 |
+
case "$2" in
|
186 |
+
*[-.][zZ] | *_z | *[-.][gx]z | *[-.]bz2 | *[-.]lzma | *[-.]lz | *.t[abglx]z | *.tbz2 | *[-.]lzo | *.tzo | *[-.]zst | *.tzst | -)
|
187 |
+
xz_status=$(
|
188 |
+
exec 4>&1
|
189 |
+
($xz2 -cdf -- "$2" 4>&-; echo $? >&4) 3>&- |
|
190 |
+
eval "$cmp" '"$1"' - >&3
|
191 |
+
);;
|
192 |
+
*)
|
193 |
+
eval "$cmp" '"$1"' '"$2"';;
|
194 |
+
esac;;
|
195 |
+
esac
|
196 |
+
else
|
197 |
+
printf '%s\n' "$0: Invalid number of operands; try \`${0##*/} --help' for help" >&2
|
198 |
+
exit 2
|
199 |
+
fi
|
200 |
+
|
201 |
+
cmp_status=$?
|
202 |
+
for num in $xz_status ; do
|
203 |
+
# 0 from decompressor means successful decompression. SIGPIPE from
|
204 |
+
# decompressor is possible when diff or cmp exits before the whole file
|
205 |
+
# has been decompressed. In that case we want to retain the exit status
|
206 |
+
# from diff or cmp. Note that using "trap '' PIPE" is not possible
|
207 |
+
# because gzip changes its behavior (including exit status) if SIGPIPE
|
208 |
+
# is ignored.
|
209 |
+
test "$num" -eq 0 && continue
|
210 |
+
test "$num" -ge 128 \
|
211 |
+
&& test "$(kill -l "$num" 2> /dev/null)" = "PIPE" \
|
212 |
+
&& continue
|
213 |
+
exit 2
|
214 |
+
done
|
215 |
+
exit $cmp_status
|
ocr-application/bin/lzdiff
ADDED
@@ -0,0 +1,215 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#!/bin/sh
|
2 |
+
|
3 |
+
# Copyright (C) 1998, 2002, 2006, 2007 Free Software Foundation
|
4 |
+
# Copyright (C) 1993 Jean-loup Gailly
|
5 |
+
|
6 |
+
# Modified for XZ Utils by Andrew Dudman and Lasse Collin.
|
7 |
+
|
8 |
+
# This program is free software; you can redistribute it and/or modify
|
9 |
+
# it under the terms of the GNU General Public License as published by
|
10 |
+
# the Free Software Foundation; either version 2 of the License, or
|
11 |
+
# (at your option) any later version.
|
12 |
+
|
13 |
+
# This program is distributed in the hope that it will be useful,
|
14 |
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
15 |
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
16 |
+
# GNU General Public License for more details.
|
17 |
+
|
18 |
+
|
19 |
+
#SET_PATH - This line is a placeholder to ease patching this script.
|
20 |
+
|
21 |
+
# Instead of unsetting XZ_OPT, just make sure that xz will use file format
|
22 |
+
# autodetection. This way memory usage limit and thread limit can be
|
23 |
+
# specified via XZ_OPT. With gzip, bzip2, and lzop it's OK to just unset the
|
24 |
+
# environment variables.
|
25 |
+
xz='xz --format=auto'
|
26 |
+
unset GZIP BZIP BZIP2 LZOP
|
27 |
+
|
28 |
+
case ${0##*/} in
|
29 |
+
*cmp*) prog=xzcmp; cmp=${CMP:-cmp};;
|
30 |
+
*) prog=xzdiff; cmp=${DIFF:-diff};;
|
31 |
+
esac
|
32 |
+
|
33 |
+
version="$prog (XZ Utils) 5.4.6"
|
34 |
+
|
35 |
+
usage="Usage: ${0##*/} [OPTION]... FILE1 [FILE2]
|
36 |
+
Compare FILE1 to FILE2, using their uncompressed contents if they are
|
37 |
+
compressed. If FILE2 is omitted, then the files compared are FILE1 and
|
38 |
+
FILE1 from which the compression format suffix has been stripped.
|
39 |
+
|
40 |
+
Do comparisons like '$cmp' does. OPTIONs are the same as for '$cmp'.
|
41 |
+
|
42 |
+
Report bugs to <xz@tukaani.org>."
|
43 |
+
|
44 |
+
# sed script to escape all ' for the shell, and then (to handle trailing
|
45 |
+
# newlines correctly) turn trailing X on last line into '.
|
46 |
+
escape='
|
47 |
+
s/'\''/'\''\\'\'''\''/g
|
48 |
+
$s/X$/'\''/
|
49 |
+
'
|
50 |
+
|
51 |
+
while :; do
|
52 |
+
case $1 in
|
53 |
+
--h*) printf '%s\n' "$usage" || exit 2; exit;;
|
54 |
+
--v*) printf '%s\n' "$version" || exit 2; exit;;
|
55 |
+
--) shift; break;;
|
56 |
+
-*\'*) cmp="$cmp '"`printf '%sX\n' "$1" | sed "$escape"`;;
|
57 |
+
-?*) cmp="$cmp '$1'";;
|
58 |
+
*) break;;
|
59 |
+
esac
|
60 |
+
shift
|
61 |
+
done
|
62 |
+
cmp="$cmp --"
|
63 |
+
|
64 |
+
for file; do
|
65 |
+
test "X$file" = X- || <"$file" || exit 2
|
66 |
+
done
|
67 |
+
|
68 |
+
# xz needs -qQ to ignore warnings like unsupported check type.
|
69 |
+
xz1="$xz -qQ"
|
70 |
+
xz2="$xz -qQ"
|
71 |
+
xz_status=0
|
72 |
+
exec 3>&1
|
73 |
+
|
74 |
+
if test $# -eq 1; then
|
75 |
+
case $1 in
|
76 |
+
*[-.]xz | *[-.]lzma | *[-.]lz | *.t[lx]z)
|
77 |
+
;;
|
78 |
+
*[-.]bz2 | *.tbz | *.tbz2)
|
79 |
+
xz1=bzip2;;
|
80 |
+
*[-.][zZ] | *_z | *[-.]gz | *.t[ag]z)
|
81 |
+
xz1=gzip;;
|
82 |
+
*[-.]lzo | *.tzo)
|
83 |
+
xz1=lzop;;
|
84 |
+
*[-.]zst | *.tzst)
|
85 |
+
xz1='zstd -q';;
|
86 |
+
*)
|
87 |
+
printf '%s\n' "$0: $1: Unknown compressed file name suffix" >&2
|
88 |
+
exit 2;;
|
89 |
+
esac
|
90 |
+
case $1 in
|
91 |
+
*[-.][zZ] | *_z | *[-.][gx]z | *[-.]bz2 | *[-.]lzma | *[-.]lz | *[-.]lzo | *[-.]zst)
|
92 |
+
FILE=`expr "X$1" : 'X\(.*\)[-.][abglmostxzZ2]*$'`;;
|
93 |
+
*.t[abglx]z)
|
94 |
+
FILE=`expr "X$1" : 'X\(.*[-.]t\)[abglx]z$'`ar;;
|
95 |
+
*.tbz2)
|
96 |
+
FILE=`expr "X$1" : 'X\(.*[-.]t\)bz2$'`ar;;
|
97 |
+
*.tzo)
|
98 |
+
FILE=`expr "X$1" : 'X\(.*[-.]t\)zo$'`ar;;
|
99 |
+
*.tzst)
|
100 |
+
FILE=`expr "X$1" : 'X\(.*[-.]t\)zst$'`ar;;
|
101 |
+
esac
|
102 |
+
xz_status=$(
|
103 |
+
exec 4>&1
|
104 |
+
($xz1 -cd -- "$1" 4>&-; echo $? >&4) 3>&- | eval "$cmp" - '"$FILE"' >&3
|
105 |
+
)
|
106 |
+
elif test $# -eq 2; then
|
107 |
+
case $1 in
|
108 |
+
*[-.]bz2 | *.tbz | *.tbz2) xz1=bzip2;;
|
109 |
+
*[-.][zZ] | *_z | *[-.]gz | *.t[ag]z) xz1=gzip;;
|
110 |
+
*[-.]lzo | *.tzo) xz1=lzop;;
|
111 |
+
*[-.]zst | *.tzst) xz1='zstd -q';;
|
112 |
+
esac
|
113 |
+
case $2 in
|
114 |
+
*[-.]bz2 | *.tbz | *.tbz2) xz2=bzip2;;
|
115 |
+
*[-.][zZ] | *_z | *[-.]gz | *.t[ag]z) xz2=gzip;;
|
116 |
+
*[-.]lzo | *.tzo) xz2=lzop;;
|
117 |
+
*[-.]zst | *.tzst) xz2='zstd -q';;
|
118 |
+
esac
|
119 |
+
case $1 in
|
120 |
+
*[-.][zZ] | *_z | *[-.][gx]z | *[-.]bz2 | *[-.]lzma | *[-.]lz | *.t[abglx]z | *.tbz2 | *[-.]lzo | *.tzo | *[-.]zst | *.tzst | -)
|
121 |
+
case "$2" in
|
122 |
+
*[-.][zZ] | *_z | *[-.][gx]z | *[-.]bz2 | *[-.]lzma | *[-.]lz | *.t[abglx]z | *.tbz2 | *[-.]lzo | *.tzo | *[-.]zst | *.tzst | -)
|
123 |
+
if test "$1$2" = --; then
|
124 |
+
xz_status=$(
|
125 |
+
exec 4>&1
|
126 |
+
($xz1 -cdf - 4>&-; echo $? >&4) 3>&- |
|
127 |
+
eval "$cmp" - - >&3
|
128 |
+
)
|
129 |
+
elif # Reject Solaris 8's buggy /bin/bash 2.03.
|
130 |
+
echo X | (echo X | eval "$cmp" /dev/fd/5 - >/dev/null 2>&1) 5<&0; then
|
131 |
+
# NOTE: xz_status will contain two numbers.
|
132 |
+
xz_status=$(
|
133 |
+
exec 4>&1
|
134 |
+
($xz1 -cdf -- "$1" 4>&-; echo $? >&4) 3>&- |
|
135 |
+
( ($xz2 -cdf -- "$2" 4>&-; echo $? >&4) 3>&- 5<&- </dev/null |
|
136 |
+
eval "$cmp" /dev/fd/5 - >&3) 5<&0
|
137 |
+
)
|
138 |
+
else
|
139 |
+
F=`expr "/$2" : '.*/\(.*\)[-.][ablmotxz2]*$'` || F=$prog
|
140 |
+
tmp=
|
141 |
+
trap '
|
142 |
+
test -n "$tmp" && rm -rf "$tmp"
|
143 |
+
(exit 2); exit 2
|
144 |
+
' HUP INT PIPE TERM 0
|
145 |
+
if type mktemp >/dev/null 2>&1; then
|
146 |
+
# Note that FreeBSD's mktemp isn't fully compatible with
|
147 |
+
# the implementations from mktemp.org and GNU coreutils.
|
148 |
+
# It is important that the -t argument is the last argument
|
149 |
+
# and that no "--" is used between -t and the template argument.
|
150 |
+
# This way this command works on all implementations.
|
151 |
+
tmp=`mktemp -d -t "$prog.XXXXXXXXXX"` || exit 2
|
152 |
+
else
|
153 |
+
# Fallback code if mktemp is missing. This isn't as
|
154 |
+
# robust as using mktemp since this doesn't try with
|
155 |
+
# different file names in case of a file name conflict.
|
156 |
+
#
|
157 |
+
# There's no need to save the original umask since
|
158 |
+
# we don't create any non-temp files. Note that using
|
159 |
+
# mkdir -m 0077 isn't secure since some mkdir implementations
|
160 |
+
# create the dir with the default umask and chmod the
|
161 |
+
# the dir afterwards.
|
162 |
+
umask 0077
|
163 |
+
mkdir -- "${TMPDIR-/tmp}/$prog.$$" || exit 2
|
164 |
+
tmp="${TMPDIR-/tmp}/$prog.$$"
|
165 |
+
fi
|
166 |
+
$xz2 -cdf -- "$2" > "$tmp/$F" || exit 2
|
167 |
+
xz_status=$(
|
168 |
+
exec 4>&1
|
169 |
+
($xz1 -cdf -- "$1" 4>&-; echo $? >&4) 3>&- |
|
170 |
+
eval "$cmp" - '"$tmp/$F"' >&3
|
171 |
+
)
|
172 |
+
cmp_status=$?
|
173 |
+
rm -rf "$tmp" || xz_status=$?
|
174 |
+
trap - HUP INT PIPE TERM 0
|
175 |
+
(exit $cmp_status)
|
176 |
+
fi;;
|
177 |
+
*)
|
178 |
+
xz_status=$(
|
179 |
+
exec 4>&1
|
180 |
+
($xz1 -cdf -- "$1" 4>&-; echo $? >&4) 3>&- |
|
181 |
+
eval "$cmp" - '"$2"' >&3
|
182 |
+
);;
|
183 |
+
esac;;
|
184 |
+
*)
|
185 |
+
case "$2" in
|
186 |
+
*[-.][zZ] | *_z | *[-.][gx]z | *[-.]bz2 | *[-.]lzma | *[-.]lz | *.t[abglx]z | *.tbz2 | *[-.]lzo | *.tzo | *[-.]zst | *.tzst | -)
|
187 |
+
xz_status=$(
|
188 |
+
exec 4>&1
|
189 |
+
($xz2 -cdf -- "$2" 4>&-; echo $? >&4) 3>&- |
|
190 |
+
eval "$cmp" '"$1"' - >&3
|
191 |
+
);;
|
192 |
+
*)
|
193 |
+
eval "$cmp" '"$1"' '"$2"';;
|
194 |
+
esac;;
|
195 |
+
esac
|
196 |
+
else
|
197 |
+
printf '%s\n' "$0: Invalid number of operands; try \`${0##*/} --help' for help" >&2
|
198 |
+
exit 2
|
199 |
+
fi
|
200 |
+
|
201 |
+
cmp_status=$?
|
202 |
+
for num in $xz_status ; do
|
203 |
+
# 0 from decompressor means successful decompression. SIGPIPE from
|
204 |
+
# decompressor is possible when diff or cmp exits before the whole file
|
205 |
+
# has been decompressed. In that case we want to retain the exit status
|
206 |
+
# from diff or cmp. Note that using "trap '' PIPE" is not possible
|
207 |
+
# because gzip changes its behavior (including exit status) if SIGPIPE
|
208 |
+
# is ignored.
|
209 |
+
test "$num" -eq 0 && continue
|
210 |
+
test "$num" -ge 128 \
|
211 |
+
&& test "$(kill -l "$num" 2> /dev/null)" = "PIPE" \
|
212 |
+
&& continue
|
213 |
+
exit 2
|
214 |
+
done
|
215 |
+
exit $cmp_status
|
ocr-application/bin/lzegrep
ADDED
@@ -0,0 +1,298 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#!/bin/sh
|
2 |
+
|
3 |
+
# xzgrep -- a wrapper around a grep program that decompresses files as needed
|
4 |
+
# Adapted from a version sent by Charles Levert <charles@comm.polymtl.ca>
|
5 |
+
|
6 |
+
# Copyright (C) 1998, 2001, 2002, 2006, 2007 Free Software Foundation
|
7 |
+
# Copyright (C) 1993 Jean-loup Gailly
|
8 |
+
|
9 |
+
# Modified for XZ Utils by Andrew Dudman and Lasse Collin.
|
10 |
+
|
11 |
+
# This program is free software; you can redistribute it and/or modify
|
12 |
+
# it under the terms of the GNU General Public License as published by
|
13 |
+
# the Free Software Foundation; either version 2 of the License, or
|
14 |
+
# (at your option) any later version.
|
15 |
+
|
16 |
+
# This program is distributed in the hope that it will be useful,
|
17 |
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
18 |
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
19 |
+
# GNU General Public License for more details.
|
20 |
+
|
21 |
+
|
22 |
+
#SET_PATH - This line is a placeholder to ease patching this script.
|
23 |
+
|
24 |
+
# Instead of unsetting XZ_OPT, just make sure that xz will use file format
|
25 |
+
# autodetection. This way memory usage limit and thread limit can be
|
26 |
+
# specified via XZ_OPT. With gzip, bzip2, and lzop it's OK to just unset the
|
27 |
+
# environment variables.
|
28 |
+
xz='xz --format=auto'
|
29 |
+
unset GZIP BZIP BZIP2 LZOP
|
30 |
+
|
31 |
+
case ${0##*/} in
|
32 |
+
*egrep*) prog=xzegrep; grep=${GREP:-grep -E};;
|
33 |
+
*fgrep*) prog=xzfgrep; grep=${GREP:-grep -F};;
|
34 |
+
*) prog=xzgrep; grep=${GREP:-grep};;
|
35 |
+
esac
|
36 |
+
|
37 |
+
version="$prog (XZ Utils) 5.4.6"
|
38 |
+
|
39 |
+
usage="Usage: ${0##*/} [OPTION]... [-e] PATTERN [FILE]...
|
40 |
+
Look for instances of PATTERN in the input FILEs, using their
|
41 |
+
uncompressed contents if they are compressed.
|
42 |
+
|
43 |
+
OPTIONs are the same as for '$grep'.
|
44 |
+
|
45 |
+
Report bugs to <xz@tukaani.org>."
|
46 |
+
|
47 |
+
# sed script to escape all ' for the shell, and then (to handle trailing
|
48 |
+
# newlines correctly) turn trailing X on last line into '.
|
49 |
+
escape='
|
50 |
+
s/'\''/'\''\\'\'''\''/g
|
51 |
+
$s/X$/'\''/
|
52 |
+
'
|
53 |
+
operands=
|
54 |
+
have_pat=0
|
55 |
+
files_with_matches=0
|
56 |
+
files_without_matches=0
|
57 |
+
no_filename=0
|
58 |
+
with_filename=0
|
59 |
+
|
60 |
+
# See if -H and --label options are supported (GNU and *BSDs).
|
61 |
+
if test f:x = "$(eval "echo x | $grep -H --label=f x 2> /dev/null")"; then
|
62 |
+
grep_supports_label=1
|
63 |
+
else
|
64 |
+
grep_supports_label=0
|
65 |
+
fi
|
66 |
+
|
67 |
+
while test $# -ne 0; do
|
68 |
+
option=$1
|
69 |
+
shift
|
70 |
+
optarg=
|
71 |
+
|
72 |
+
case $option in
|
73 |
+
(-[0123456789abcdEFGhHiIKlLnoPqrRsTuUvVwxyzZ]*[!0123456789]*)
|
74 |
+
# Something like -Fiv was specified, that is, $option contains more
|
75 |
+
# than one option of which the first option (in this example -F)
|
76 |
+
# doesn't take an argument. Split the first option into a standalone
|
77 |
+
# argument and continue parsing the rest of the options (in this example,
|
78 |
+
# replace -Fiv with -iv in the argument list and set option=-F).
|
79 |
+
#
|
80 |
+
# If there are digits [0-9] they are treated as if they were a single
|
81 |
+
# option character because this syntax is an alias for -C for GNU grep.
|
82 |
+
# For example, "grep -25F" is equivalent to "grep -C25 -F". If only
|
83 |
+
# digits are specified like "grep -25" we don't get here because the
|
84 |
+
# above pattern in the case-statement doesn't match such strings.
|
85 |
+
arg2=-\'$(LC_ALL=C expr "X${option}X" : 'X-.[0-9]*\(.*\)' |
|
86 |
+
LC_ALL=C sed "$escape")
|
87 |
+
eval "set -- $arg2 "'${1+"$@"}'
|
88 |
+
option=$(LC_ALL=C expr "X$option" : 'X\(-.[0-9]*\)');;
|
89 |
+
(--binary-*=* | --[lm]a*=* | --reg*=*)
|
90 |
+
# These options require an argument and an argument has been provided
|
91 |
+
# with the --foo=argument syntax. All is good.
|
92 |
+
;;
|
93 |
+
(-[ABCDefmX] | --binary-* | --file | --[lm]a* | --reg*)
|
94 |
+
# These options require an argument which should now be in $1.
|
95 |
+
# If it isn't, display an error and exit.
|
96 |
+
case ${1?"$option option requires an argument"} in
|
97 |
+
(*\'*)
|
98 |
+
optarg=" '"$(printf '%sX\n' "$1" | LC_ALL=C sed "$escape");;
|
99 |
+
(*)
|
100 |
+
optarg=" '$1'";;
|
101 |
+
esac
|
102 |
+
shift;;
|
103 |
+
(--)
|
104 |
+
break;;
|
105 |
+
(-?*)
|
106 |
+
;;
|
107 |
+
(*)
|
108 |
+
case $option in
|
109 |
+
(*\'*)
|
110 |
+
operands="$operands '"$(printf '%sX\n' "$option" |
|
111 |
+
LC_ALL=C sed "$escape");;
|
112 |
+
(*)
|
113 |
+
operands="$operands '$option'";;
|
114 |
+
esac
|
115 |
+
${POSIXLY_CORRECT+break}
|
116 |
+
continue;;
|
117 |
+
esac
|
118 |
+
|
119 |
+
case $option in
|
120 |
+
(-[drRzZ] | --di* | --exc* | --inc* | --rec* | --nu*)
|
121 |
+
printf >&2 '%s: %s: Option not supported\n' "$0" "$option"
|
122 |
+
exit 2;;
|
123 |
+
(-[ef]* | --file | --file=* | --reg*)
|
124 |
+
have_pat=1;;
|
125 |
+
(--h | --he | --hel | --help)
|
126 |
+
printf '%s\n' "$usage" || exit 2
|
127 |
+
exit;;
|
128 |
+
(-H | --wi | --wit | --with | --with- | --with-f | --with-fi \
|
129 |
+
| --with-fil | --with-file | --with-filen | --with-filena | --with-filenam \
|
130 |
+
| --with-filename)
|
131 |
+
with_filename=1
|
132 |
+
continue;;
|
133 |
+
(-l | --files-with-*)
|
134 |
+
files_with_matches=1
|
135 |
+
continue;;
|
136 |
+
(-L | --files-witho*)
|
137 |
+
files_without_matches=1
|
138 |
+
continue;;
|
139 |
+
(-h | --no-f*)
|
140 |
+
no_filename=1;;
|
141 |
+
(-V | --v | --ve | --ver | --vers | --versi | --versio | --version)
|
142 |
+
printf '%s\n' "$version" || exit 2
|
143 |
+
exit;;
|
144 |
+
esac
|
145 |
+
|
146 |
+
case $option in
|
147 |
+
(*\'?*)
|
148 |
+
option=\'$(printf '%sX\n' "$option" | LC_ALL=C sed "$escape");;
|
149 |
+
(*)
|
150 |
+
option="'$option'";;
|
151 |
+
esac
|
152 |
+
|
153 |
+
grep="$grep $option$optarg"
|
154 |
+
done
|
155 |
+
|
156 |
+
eval "set -- $operands "'${1+"$@"}'
|
157 |
+
|
158 |
+
if test $have_pat -eq 0; then
|
159 |
+
case ${1?"Missing pattern; try \`${0##*/} --help' for help"} in
|
160 |
+
(*\'*)
|
161 |
+
grep="$grep -e '"$(printf '%sX\n' "$1" | LC_ALL=C sed "$escape");;
|
162 |
+
(*)
|
163 |
+
grep="$grep -e '$1'";;
|
164 |
+
esac
|
165 |
+
shift
|
166 |
+
fi
|
167 |
+
|
168 |
+
if test $# -eq 0; then
|
169 |
+
set -- -
|
170 |
+
fi
|
171 |
+
|
172 |
+
exec 3>&1
|
173 |
+
|
174 |
+
# res=1 means that no file matched yet
|
175 |
+
res=1
|
176 |
+
|
177 |
+
for i; do
|
178 |
+
case $i in
|
179 |
+
*[-.][zZ] | *_z | *[-.]gz | *.t[ag]z) uncompress="gzip -cdf";;
|
180 |
+
*[-.]bz2 | *[-.]tbz | *.tbz2) uncompress="bzip2 -cdf";;
|
181 |
+
*[-.]lzo | *[-.]tzo) uncompress="lzop -cdf";;
|
182 |
+
*[-.]zst | *[-.]tzst) uncompress="zstd -cdfq";; # zstd needs -q.
|
183 |
+
*) uncompress="$xz -cdfqQ";; # -qQ to ignore warnings like unsupp. check.
|
184 |
+
esac
|
185 |
+
# xz_status will hold the decompressor's exit status.
|
186 |
+
# Exit status of grep (and in rare cases, printf or sed) is
|
187 |
+
# available as the exit status of this assignment command.
|
188 |
+
xz_status=$(
|
189 |
+
exec 5>&1
|
190 |
+
($uncompress -- "$i" 5>&-; echo $? >&5) 3>&- |
|
191 |
+
if test $files_with_matches -eq 1; then
|
192 |
+
eval "$grep -q" && { printf '%s\n' "$i" || exit 2; }
|
193 |
+
elif test $files_without_matches -eq 1; then
|
194 |
+
eval "$grep -q" || {
|
195 |
+
r=$?
|
196 |
+
if test $r -eq 1; then
|
197 |
+
printf '%s\n' "$i" || r=2
|
198 |
+
fi
|
199 |
+
exit $r
|
200 |
+
}
|
201 |
+
elif test $with_filename -eq 0 &&
|
202 |
+
{ test $# -eq 1 || test $no_filename -eq 1; }; then
|
203 |
+
eval "$grep"
|
204 |
+
elif test $grep_supports_label -eq 1; then
|
205 |
+
# The grep implementation in use allows us to specify the filename
|
206 |
+
# that grep will prefix to the output lines. This is faster and
|
207 |
+
# less prone to security bugs than the fallback method that uses sed.
|
208 |
+
# This also avoids confusing output with GNU grep >= 3.5 (2020-09-27)
|
209 |
+
# which prints "binary file matches" to stderr instead of stdout.
|
210 |
+
#
|
211 |
+
# If reading from stdin, let grep use whatever name it prefers for
|
212 |
+
# stdin. With GNU grep it is a locale-specific translated string.
|
213 |
+
if test "x$i" = "x-"; then
|
214 |
+
eval "$grep -H"
|
215 |
+
else
|
216 |
+
eval "$grep -H --label \"\$i\""
|
217 |
+
fi
|
218 |
+
else
|
219 |
+
# Append a colon so that the last character will never be a newline
|
220 |
+
# which would otherwise get lost in shell command substitution.
|
221 |
+
i="$i:"
|
222 |
+
|
223 |
+
# Escape & \ | and newlines only if such characters are present
|
224 |
+
# (speed optimization).
|
225 |
+
case $i in
|
226 |
+
(*'
|
227 |
+
'* | *'&'* | *'\'* | *'|'*)
|
228 |
+
# If sed fails, set i to a known safe string to ensure that
|
229 |
+
# failing sed did not create a half-escaped dangerous string.
|
230 |
+
i=$(printf '%s\n' "$i" | LC_ALL=C sed 's/[&\|]/\\&/g; $!s/$/\\/') ||
|
231 |
+
i='(unknown filename):';;
|
232 |
+
esac
|
233 |
+
|
234 |
+
# $i already ends with a colon so do not add it here.
|
235 |
+
sed_script="s|^|$i|"
|
236 |
+
|
237 |
+
# If grep or sed fails, pick the larger value of the two exit statuses.
|
238 |
+
# If sed fails, use at least 2 since we use >= 2 to indicate errors.
|
239 |
+
r=$(
|
240 |
+
exec 4>&1
|
241 |
+
(eval "$grep" 4>&-; echo $? >&4) 3>&- |
|
242 |
+
LC_ALL=C sed "$sed_script" >&3 4>&-
|
243 |
+
) || {
|
244 |
+
sed_status=$?
|
245 |
+
test "$sed_status" -lt 2 && sed_status=2
|
246 |
+
test "$r" -lt "$sed_status" && r=$sed_status
|
247 |
+
}
|
248 |
+
exit $r
|
249 |
+
fi >&3 5>&-
|
250 |
+
)
|
251 |
+
r=$?
|
252 |
+
|
253 |
+
# If grep or sed or other non-decompression command failed with a signal,
|
254 |
+
# exit immediately and ignore the possible remaining files.
|
255 |
+
#
|
256 |
+
# NOTE: Instead of 128 + signal_number, some shells use
|
257 |
+
# 256 + signal_number (ksh) or 384 + signal_number (yash).
|
258 |
+
# This is fine for us since their "exit" and "kill -l" commands take
|
259 |
+
# this into account. (At least the versions I tried do but there is
|
260 |
+
# a report of an old ksh variant whose "exit" truncates the exit status
|
261 |
+
# to 8 bits without any special handling for values indicating a signal.)
|
262 |
+
test "$r" -ge 128 && exit "$r"
|
263 |
+
|
264 |
+
if test -z "$xz_status"; then
|
265 |
+
# Something unusual happened, for example, we got a signal and
|
266 |
+
# the exit status of the decompressor was never echoed and thus
|
267 |
+
# $xz_status is empty. Exit immediately and ignore the possible
|
268 |
+
# remaining files.
|
269 |
+
exit 2
|
270 |
+
elif test "$xz_status" -ge 128; then
|
271 |
+
# The decompressor died due to a signal. SIGPIPE is ignored since it can
|
272 |
+
# occur if grep exits before the whole file has been decompressed (grep -q
|
273 |
+
# can do that). If the decompressor died with some other signal, exit
|
274 |
+
# immediately and ignore the possible remaining files.
|
275 |
+
test "$(kill -l "$xz_status" 2> /dev/null)" != "PIPE" && exit "$xz_status"
|
276 |
+
elif test "$xz_status" -gt 0; then
|
277 |
+
# Decompression failed but we will continue with the remaining
|
278 |
+
# files anwyway. Set exit status to at least 2 to indicate an error.
|
279 |
+
test "$r" -lt 2 && r=2
|
280 |
+
fi
|
281 |
+
|
282 |
+
# Since res=1 is the initial value, we only need to care about
|
283 |
+
# matches (r == 0) and errors (r >= 2) here; r == 1 can be ignored.
|
284 |
+
if test "$r" -ge 2; then
|
285 |
+
# An error occurred in decompressor, grep, or some other command. Update
|
286 |
+
# res unless a larger error code has been seen with an earlier file.
|
287 |
+
test "$res" -lt "$r" && res=$r
|
288 |
+
elif test "$r" -eq 0; then
|
289 |
+
# grep found a match and no errors occurred. Update res if no errors have
|
290 |
+
# occurred with earlier files.
|
291 |
+
test "$res" -eq 1 && res=0
|
292 |
+
fi
|
293 |
+
done
|
294 |
+
|
295 |
+
# 0: At least one file matched and no errors occurred.
|
296 |
+
# 1: No matches were found and no errors occurred.
|
297 |
+
# >=2: Error. It's unknown if matches were found.
|
298 |
+
exit "$res"
|
ocr-application/bin/lzfgrep
ADDED
@@ -0,0 +1,298 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#!/bin/sh
|
2 |
+
|
3 |
+
# xzgrep -- a wrapper around a grep program that decompresses files as needed
|
4 |
+
# Adapted from a version sent by Charles Levert <charles@comm.polymtl.ca>
|
5 |
+
|
6 |
+
# Copyright (C) 1998, 2001, 2002, 2006, 2007 Free Software Foundation
|
7 |
+
# Copyright (C) 1993 Jean-loup Gailly
|
8 |
+
|
9 |
+
# Modified for XZ Utils by Andrew Dudman and Lasse Collin.
|
10 |
+
|
11 |
+
# This program is free software; you can redistribute it and/or modify
|
12 |
+
# it under the terms of the GNU General Public License as published by
|
13 |
+
# the Free Software Foundation; either version 2 of the License, or
|
14 |
+
# (at your option) any later version.
|
15 |
+
|
16 |
+
# This program is distributed in the hope that it will be useful,
|
17 |
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
18 |
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
19 |
+
# GNU General Public License for more details.
|
20 |
+
|
21 |
+
|
22 |
+
#SET_PATH - This line is a placeholder to ease patching this script.
|
23 |
+
|
24 |
+
# Instead of unsetting XZ_OPT, just make sure that xz will use file format
|
25 |
+
# autodetection. This way memory usage limit and thread limit can be
|
26 |
+
# specified via XZ_OPT. With gzip, bzip2, and lzop it's OK to just unset the
|
27 |
+
# environment variables.
|
28 |
+
xz='xz --format=auto'
|
29 |
+
unset GZIP BZIP BZIP2 LZOP
|
30 |
+
|
31 |
+
case ${0##*/} in
|
32 |
+
*egrep*) prog=xzegrep; grep=${GREP:-grep -E};;
|
33 |
+
*fgrep*) prog=xzfgrep; grep=${GREP:-grep -F};;
|
34 |
+
*) prog=xzgrep; grep=${GREP:-grep};;
|
35 |
+
esac
|
36 |
+
|
37 |
+
version="$prog (XZ Utils) 5.4.6"
|
38 |
+
|
39 |
+
usage="Usage: ${0##*/} [OPTION]... [-e] PATTERN [FILE]...
|
40 |
+
Look for instances of PATTERN in the input FILEs, using their
|
41 |
+
uncompressed contents if they are compressed.
|
42 |
+
|
43 |
+
OPTIONs are the same as for '$grep'.
|
44 |
+
|
45 |
+
Report bugs to <xz@tukaani.org>."
|
46 |
+
|
47 |
+
# sed script to escape all ' for the shell, and then (to handle trailing
|
48 |
+
# newlines correctly) turn trailing X on last line into '.
|
49 |
+
escape='
|
50 |
+
s/'\''/'\''\\'\'''\''/g
|
51 |
+
$s/X$/'\''/
|
52 |
+
'
|
53 |
+
operands=
|
54 |
+
have_pat=0
|
55 |
+
files_with_matches=0
|
56 |
+
files_without_matches=0
|
57 |
+
no_filename=0
|
58 |
+
with_filename=0
|
59 |
+
|
60 |
+
# See if -H and --label options are supported (GNU and *BSDs).
|
61 |
+
if test f:x = "$(eval "echo x | $grep -H --label=f x 2> /dev/null")"; then
|
62 |
+
grep_supports_label=1
|
63 |
+
else
|
64 |
+
grep_supports_label=0
|
65 |
+
fi
|
66 |
+
|
67 |
+
while test $# -ne 0; do
|
68 |
+
option=$1
|
69 |
+
shift
|
70 |
+
optarg=
|
71 |
+
|
72 |
+
case $option in
|
73 |
+
(-[0123456789abcdEFGhHiIKlLnoPqrRsTuUvVwxyzZ]*[!0123456789]*)
|
74 |
+
# Something like -Fiv was specified, that is, $option contains more
|
75 |
+
# than one option of which the first option (in this example -F)
|
76 |
+
# doesn't take an argument. Split the first option into a standalone
|
77 |
+
# argument and continue parsing the rest of the options (in this example,
|
78 |
+
# replace -Fiv with -iv in the argument list and set option=-F).
|
79 |
+
#
|
80 |
+
# If there are digits [0-9] they are treated as if they were a single
|
81 |
+
# option character because this syntax is an alias for -C for GNU grep.
|
82 |
+
# For example, "grep -25F" is equivalent to "grep -C25 -F". If only
|
83 |
+
# digits are specified like "grep -25" we don't get here because the
|
84 |
+
# above pattern in the case-statement doesn't match such strings.
|
85 |
+
arg2=-\'$(LC_ALL=C expr "X${option}X" : 'X-.[0-9]*\(.*\)' |
|
86 |
+
LC_ALL=C sed "$escape")
|
87 |
+
eval "set -- $arg2 "'${1+"$@"}'
|
88 |
+
option=$(LC_ALL=C expr "X$option" : 'X\(-.[0-9]*\)');;
|
89 |
+
(--binary-*=* | --[lm]a*=* | --reg*=*)
|
90 |
+
# These options require an argument and an argument has been provided
|
91 |
+
# with the --foo=argument syntax. All is good.
|
92 |
+
;;
|
93 |
+
(-[ABCDefmX] | --binary-* | --file | --[lm]a* | --reg*)
|
94 |
+
# These options require an argument which should now be in $1.
|
95 |
+
# If it isn't, display an error and exit.
|
96 |
+
case ${1?"$option option requires an argument"} in
|
97 |
+
(*\'*)
|
98 |
+
optarg=" '"$(printf '%sX\n' "$1" | LC_ALL=C sed "$escape");;
|
99 |
+
(*)
|
100 |
+
optarg=" '$1'";;
|
101 |
+
esac
|
102 |
+
shift;;
|
103 |
+
(--)
|
104 |
+
break;;
|
105 |
+
(-?*)
|
106 |
+
;;
|
107 |
+
(*)
|
108 |
+
case $option in
|
109 |
+
(*\'*)
|
110 |
+
operands="$operands '"$(printf '%sX\n' "$option" |
|
111 |
+
LC_ALL=C sed "$escape");;
|
112 |
+
(*)
|
113 |
+
operands="$operands '$option'";;
|
114 |
+
esac
|
115 |
+
${POSIXLY_CORRECT+break}
|
116 |
+
continue;;
|
117 |
+
esac
|
118 |
+
|
119 |
+
case $option in
|
120 |
+
(-[drRzZ] | --di* | --exc* | --inc* | --rec* | --nu*)
|
121 |
+
printf >&2 '%s: %s: Option not supported\n' "$0" "$option"
|
122 |
+
exit 2;;
|
123 |
+
(-[ef]* | --file | --file=* | --reg*)
|
124 |
+
have_pat=1;;
|
125 |
+
(--h | --he | --hel | --help)
|
126 |
+
printf '%s\n' "$usage" || exit 2
|
127 |
+
exit;;
|
128 |
+
(-H | --wi | --wit | --with | --with- | --with-f | --with-fi \
|
129 |
+
| --with-fil | --with-file | --with-filen | --with-filena | --with-filenam \
|
130 |
+
| --with-filename)
|
131 |
+
with_filename=1
|
132 |
+
continue;;
|
133 |
+
(-l | --files-with-*)
|
134 |
+
files_with_matches=1
|
135 |
+
continue;;
|
136 |
+
(-L | --files-witho*)
|
137 |
+
files_without_matches=1
|
138 |
+
continue;;
|
139 |
+
(-h | --no-f*)
|
140 |
+
no_filename=1;;
|
141 |
+
(-V | --v | --ve | --ver | --vers | --versi | --versio | --version)
|
142 |
+
printf '%s\n' "$version" || exit 2
|
143 |
+
exit;;
|
144 |
+
esac
|
145 |
+
|
146 |
+
case $option in
|
147 |
+
(*\'?*)
|
148 |
+
option=\'$(printf '%sX\n' "$option" | LC_ALL=C sed "$escape");;
|
149 |
+
(*)
|
150 |
+
option="'$option'";;
|
151 |
+
esac
|
152 |
+
|
153 |
+
grep="$grep $option$optarg"
|
154 |
+
done
|
155 |
+
|
156 |
+
eval "set -- $operands "'${1+"$@"}'
|
157 |
+
|
158 |
+
if test $have_pat -eq 0; then
|
159 |
+
case ${1?"Missing pattern; try \`${0##*/} --help' for help"} in
|
160 |
+
(*\'*)
|
161 |
+
grep="$grep -e '"$(printf '%sX\n' "$1" | LC_ALL=C sed "$escape");;
|
162 |
+
(*)
|
163 |
+
grep="$grep -e '$1'";;
|
164 |
+
esac
|
165 |
+
shift
|
166 |
+
fi
|
167 |
+
|
168 |
+
if test $# -eq 0; then
|
169 |
+
set -- -
|
170 |
+
fi
|
171 |
+
|
172 |
+
exec 3>&1
|
173 |
+
|
174 |
+
# res=1 means that no file matched yet
|
175 |
+
res=1
|
176 |
+
|
177 |
+
for i; do
|
178 |
+
case $i in
|
179 |
+
*[-.][zZ] | *_z | *[-.]gz | *.t[ag]z) uncompress="gzip -cdf";;
|
180 |
+
*[-.]bz2 | *[-.]tbz | *.tbz2) uncompress="bzip2 -cdf";;
|
181 |
+
*[-.]lzo | *[-.]tzo) uncompress="lzop -cdf";;
|
182 |
+
*[-.]zst | *[-.]tzst) uncompress="zstd -cdfq";; # zstd needs -q.
|
183 |
+
*) uncompress="$xz -cdfqQ";; # -qQ to ignore warnings like unsupp. check.
|
184 |
+
esac
|
185 |
+
# xz_status will hold the decompressor's exit status.
|
186 |
+
# Exit status of grep (and in rare cases, printf or sed) is
|
187 |
+
# available as the exit status of this assignment command.
|
188 |
+
xz_status=$(
|
189 |
+
exec 5>&1
|
190 |
+
($uncompress -- "$i" 5>&-; echo $? >&5) 3>&- |
|
191 |
+
if test $files_with_matches -eq 1; then
|
192 |
+
eval "$grep -q" && { printf '%s\n' "$i" || exit 2; }
|
193 |
+
elif test $files_without_matches -eq 1; then
|
194 |
+
eval "$grep -q" || {
|
195 |
+
r=$?
|
196 |
+
if test $r -eq 1; then
|
197 |
+
printf '%s\n' "$i" || r=2
|
198 |
+
fi
|
199 |
+
exit $r
|
200 |
+
}
|
201 |
+
elif test $with_filename -eq 0 &&
|
202 |
+
{ test $# -eq 1 || test $no_filename -eq 1; }; then
|
203 |
+
eval "$grep"
|
204 |
+
elif test $grep_supports_label -eq 1; then
|
205 |
+
# The grep implementation in use allows us to specify the filename
|
206 |
+
# that grep will prefix to the output lines. This is faster and
|
207 |
+
# less prone to security bugs than the fallback method that uses sed.
|
208 |
+
# This also avoids confusing output with GNU grep >= 3.5 (2020-09-27)
|
209 |
+
# which prints "binary file matches" to stderr instead of stdout.
|
210 |
+
#
|
211 |
+
# If reading from stdin, let grep use whatever name it prefers for
|
212 |
+
# stdin. With GNU grep it is a locale-specific translated string.
|
213 |
+
if test "x$i" = "x-"; then
|
214 |
+
eval "$grep -H"
|
215 |
+
else
|
216 |
+
eval "$grep -H --label \"\$i\""
|
217 |
+
fi
|
218 |
+
else
|
219 |
+
# Append a colon so that the last character will never be a newline
|
220 |
+
# which would otherwise get lost in shell command substitution.
|
221 |
+
i="$i:"
|
222 |
+
|
223 |
+
# Escape & \ | and newlines only if such characters are present
|
224 |
+
# (speed optimization).
|
225 |
+
case $i in
|
226 |
+
(*'
|
227 |
+
'* | *'&'* | *'\'* | *'|'*)
|
228 |
+
# If sed fails, set i to a known safe string to ensure that
|
229 |
+
# failing sed did not create a half-escaped dangerous string.
|
230 |
+
i=$(printf '%s\n' "$i" | LC_ALL=C sed 's/[&\|]/\\&/g; $!s/$/\\/') ||
|
231 |
+
i='(unknown filename):';;
|
232 |
+
esac
|
233 |
+
|
234 |
+
# $i already ends with a colon so do not add it here.
|
235 |
+
sed_script="s|^|$i|"
|
236 |
+
|
237 |
+
# If grep or sed fails, pick the larger value of the two exit statuses.
|
238 |
+
# If sed fails, use at least 2 since we use >= 2 to indicate errors.
|
239 |
+
r=$(
|
240 |
+
exec 4>&1
|
241 |
+
(eval "$grep" 4>&-; echo $? >&4) 3>&- |
|
242 |
+
LC_ALL=C sed "$sed_script" >&3 4>&-
|
243 |
+
) || {
|
244 |
+
sed_status=$?
|
245 |
+
test "$sed_status" -lt 2 && sed_status=2
|
246 |
+
test "$r" -lt "$sed_status" && r=$sed_status
|
247 |
+
}
|
248 |
+
exit $r
|
249 |
+
fi >&3 5>&-
|
250 |
+
)
|
251 |
+
r=$?
|
252 |
+
|
253 |
+
# If grep or sed or other non-decompression command failed with a signal,
|
254 |
+
# exit immediately and ignore the possible remaining files.
|
255 |
+
#
|
256 |
+
# NOTE: Instead of 128 + signal_number, some shells use
|
257 |
+
# 256 + signal_number (ksh) or 384 + signal_number (yash).
|
258 |
+
# This is fine for us since their "exit" and "kill -l" commands take
|
259 |
+
# this into account. (At least the versions I tried do but there is
|
260 |
+
# a report of an old ksh variant whose "exit" truncates the exit status
|
261 |
+
# to 8 bits without any special handling for values indicating a signal.)
|
262 |
+
test "$r" -ge 128 && exit "$r"
|
263 |
+
|
264 |
+
if test -z "$xz_status"; then
|
265 |
+
# Something unusual happened, for example, we got a signal and
|
266 |
+
# the exit status of the decompressor was never echoed and thus
|
267 |
+
# $xz_status is empty. Exit immediately and ignore the possible
|
268 |
+
# remaining files.
|
269 |
+
exit 2
|
270 |
+
elif test "$xz_status" -ge 128; then
|
271 |
+
# The decompressor died due to a signal. SIGPIPE is ignored since it can
|
272 |
+
# occur if grep exits before the whole file has been decompressed (grep -q
|
273 |
+
# can do that). If the decompressor died with some other signal, exit
|
274 |
+
# immediately and ignore the possible remaining files.
|
275 |
+
test "$(kill -l "$xz_status" 2> /dev/null)" != "PIPE" && exit "$xz_status"
|
276 |
+
elif test "$xz_status" -gt 0; then
|
277 |
+
# Decompression failed but we will continue with the remaining
|
278 |
+
# files anwyway. Set exit status to at least 2 to indicate an error.
|
279 |
+
test "$r" -lt 2 && r=2
|
280 |
+
fi
|
281 |
+
|
282 |
+
# Since res=1 is the initial value, we only need to care about
|
283 |
+
# matches (r == 0) and errors (r >= 2) here; r == 1 can be ignored.
|
284 |
+
if test "$r" -ge 2; then
|
285 |
+
# An error occurred in decompressor, grep, or some other command. Update
|
286 |
+
# res unless a larger error code has been seen with an earlier file.
|
287 |
+
test "$res" -lt "$r" && res=$r
|
288 |
+
elif test "$r" -eq 0; then
|
289 |
+
# grep found a match and no errors occurred. Update res if no errors have
|
290 |
+
# occurred with earlier files.
|
291 |
+
test "$res" -eq 1 && res=0
|
292 |
+
fi
|
293 |
+
done
|
294 |
+
|
295 |
+
# 0: At least one file matched and no errors occurred.
|
296 |
+
# 1: No matches were found and no errors occurred.
|
297 |
+
# >=2: Error. It's unknown if matches were found.
|
298 |
+
exit "$res"
|
ocr-application/bin/lzgrep
ADDED
@@ -0,0 +1,298 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#!/bin/sh
|
2 |
+
|
3 |
+
# xzgrep -- a wrapper around a grep program that decompresses files as needed
|
4 |
+
# Adapted from a version sent by Charles Levert <charles@comm.polymtl.ca>
|
5 |
+
|
6 |
+
# Copyright (C) 1998, 2001, 2002, 2006, 2007 Free Software Foundation
|
7 |
+
# Copyright (C) 1993 Jean-loup Gailly
|
8 |
+
|
9 |
+
# Modified for XZ Utils by Andrew Dudman and Lasse Collin.
|
10 |
+
|
11 |
+
# This program is free software; you can redistribute it and/or modify
|
12 |
+
# it under the terms of the GNU General Public License as published by
|
13 |
+
# the Free Software Foundation; either version 2 of the License, or
|
14 |
+
# (at your option) any later version.
|
15 |
+
|
16 |
+
# This program is distributed in the hope that it will be useful,
|
17 |
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
18 |
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
19 |
+
# GNU General Public License for more details.
|
20 |
+
|
21 |
+
|
22 |
+
#SET_PATH - This line is a placeholder to ease patching this script.
|
23 |
+
|
24 |
+
# Instead of unsetting XZ_OPT, just make sure that xz will use file format
|
25 |
+
# autodetection. This way memory usage limit and thread limit can be
|
26 |
+
# specified via XZ_OPT. With gzip, bzip2, and lzop it's OK to just unset the
|
27 |
+
# environment variables.
|
28 |
+
xz='xz --format=auto'
|
29 |
+
unset GZIP BZIP BZIP2 LZOP
|
30 |
+
|
31 |
+
case ${0##*/} in
|
32 |
+
*egrep*) prog=xzegrep; grep=${GREP:-grep -E};;
|
33 |
+
*fgrep*) prog=xzfgrep; grep=${GREP:-grep -F};;
|
34 |
+
*) prog=xzgrep; grep=${GREP:-grep};;
|
35 |
+
esac
|
36 |
+
|
37 |
+
version="$prog (XZ Utils) 5.4.6"
|
38 |
+
|
39 |
+
usage="Usage: ${0##*/} [OPTION]... [-e] PATTERN [FILE]...
|
40 |
+
Look for instances of PATTERN in the input FILEs, using their
|
41 |
+
uncompressed contents if they are compressed.
|
42 |
+
|
43 |
+
OPTIONs are the same as for '$grep'.
|
44 |
+
|
45 |
+
Report bugs to <xz@tukaani.org>."
|
46 |
+
|
47 |
+
# sed script to escape all ' for the shell, and then (to handle trailing
|
48 |
+
# newlines correctly) turn trailing X on last line into '.
|
49 |
+
escape='
|
50 |
+
s/'\''/'\''\\'\'''\''/g
|
51 |
+
$s/X$/'\''/
|
52 |
+
'
|
53 |
+
operands=
|
54 |
+
have_pat=0
|
55 |
+
files_with_matches=0
|
56 |
+
files_without_matches=0
|
57 |
+
no_filename=0
|
58 |
+
with_filename=0
|
59 |
+
|
60 |
+
# See if -H and --label options are supported (GNU and *BSDs).
|
61 |
+
if test f:x = "$(eval "echo x | $grep -H --label=f x 2> /dev/null")"; then
|
62 |
+
grep_supports_label=1
|
63 |
+
else
|
64 |
+
grep_supports_label=0
|
65 |
+
fi
|
66 |
+
|
67 |
+
while test $# -ne 0; do
|
68 |
+
option=$1
|
69 |
+
shift
|
70 |
+
optarg=
|
71 |
+
|
72 |
+
case $option in
|
73 |
+
(-[0123456789abcdEFGhHiIKlLnoPqrRsTuUvVwxyzZ]*[!0123456789]*)
|
74 |
+
# Something like -Fiv was specified, that is, $option contains more
|
75 |
+
# than one option of which the first option (in this example -F)
|
76 |
+
# doesn't take an argument. Split the first option into a standalone
|
77 |
+
# argument and continue parsing the rest of the options (in this example,
|
78 |
+
# replace -Fiv with -iv in the argument list and set option=-F).
|
79 |
+
#
|
80 |
+
# If there are digits [0-9] they are treated as if they were a single
|
81 |
+
# option character because this syntax is an alias for -C for GNU grep.
|
82 |
+
# For example, "grep -25F" is equivalent to "grep -C25 -F". If only
|
83 |
+
# digits are specified like "grep -25" we don't get here because the
|
84 |
+
# above pattern in the case-statement doesn't match such strings.
|
85 |
+
arg2=-\'$(LC_ALL=C expr "X${option}X" : 'X-.[0-9]*\(.*\)' |
|
86 |
+
LC_ALL=C sed "$escape")
|
87 |
+
eval "set -- $arg2 "'${1+"$@"}'
|
88 |
+
option=$(LC_ALL=C expr "X$option" : 'X\(-.[0-9]*\)');;
|
89 |
+
(--binary-*=* | --[lm]a*=* | --reg*=*)
|
90 |
+
# These options require an argument and an argument has been provided
|
91 |
+
# with the --foo=argument syntax. All is good.
|
92 |
+
;;
|
93 |
+
(-[ABCDefmX] | --binary-* | --file | --[lm]a* | --reg*)
|
94 |
+
# These options require an argument which should now be in $1.
|
95 |
+
# If it isn't, display an error and exit.
|
96 |
+
case ${1?"$option option requires an argument"} in
|
97 |
+
(*\'*)
|
98 |
+
optarg=" '"$(printf '%sX\n' "$1" | LC_ALL=C sed "$escape");;
|
99 |
+
(*)
|
100 |
+
optarg=" '$1'";;
|
101 |
+
esac
|
102 |
+
shift;;
|
103 |
+
(--)
|
104 |
+
break;;
|
105 |
+
(-?*)
|
106 |
+
;;
|
107 |
+
(*)
|
108 |
+
case $option in
|
109 |
+
(*\'*)
|
110 |
+
operands="$operands '"$(printf '%sX\n' "$option" |
|
111 |
+
LC_ALL=C sed "$escape");;
|
112 |
+
(*)
|
113 |
+
operands="$operands '$option'";;
|
114 |
+
esac
|
115 |
+
${POSIXLY_CORRECT+break}
|
116 |
+
continue;;
|
117 |
+
esac
|
118 |
+
|
119 |
+
case $option in
|
120 |
+
(-[drRzZ] | --di* | --exc* | --inc* | --rec* | --nu*)
|
121 |
+
printf >&2 '%s: %s: Option not supported\n' "$0" "$option"
|
122 |
+
exit 2;;
|
123 |
+
(-[ef]* | --file | --file=* | --reg*)
|
124 |
+
have_pat=1;;
|
125 |
+
(--h | --he | --hel | --help)
|
126 |
+
printf '%s\n' "$usage" || exit 2
|
127 |
+
exit;;
|
128 |
+
(-H | --wi | --wit | --with | --with- | --with-f | --with-fi \
|
129 |
+
| --with-fil | --with-file | --with-filen | --with-filena | --with-filenam \
|
130 |
+
| --with-filename)
|
131 |
+
with_filename=1
|
132 |
+
continue;;
|
133 |
+
(-l | --files-with-*)
|
134 |
+
files_with_matches=1
|
135 |
+
continue;;
|
136 |
+
(-L | --files-witho*)
|
137 |
+
files_without_matches=1
|
138 |
+
continue;;
|
139 |
+
(-h | --no-f*)
|
140 |
+
no_filename=1;;
|
141 |
+
(-V | --v | --ve | --ver | --vers | --versi | --versio | --version)
|
142 |
+
printf '%s\n' "$version" || exit 2
|
143 |
+
exit;;
|
144 |
+
esac
|
145 |
+
|
146 |
+
case $option in
|
147 |
+
(*\'?*)
|
148 |
+
option=\'$(printf '%sX\n' "$option" | LC_ALL=C sed "$escape");;
|
149 |
+
(*)
|
150 |
+
option="'$option'";;
|
151 |
+
esac
|
152 |
+
|
153 |
+
grep="$grep $option$optarg"
|
154 |
+
done
|
155 |
+
|
156 |
+
eval "set -- $operands "'${1+"$@"}'
|
157 |
+
|
158 |
+
if test $have_pat -eq 0; then
|
159 |
+
case ${1?"Missing pattern; try \`${0##*/} --help' for help"} in
|
160 |
+
(*\'*)
|
161 |
+
grep="$grep -e '"$(printf '%sX\n' "$1" | LC_ALL=C sed "$escape");;
|
162 |
+
(*)
|
163 |
+
grep="$grep -e '$1'";;
|
164 |
+
esac
|
165 |
+
shift
|
166 |
+
fi
|
167 |
+
|
168 |
+
if test $# -eq 0; then
|
169 |
+
set -- -
|
170 |
+
fi
|
171 |
+
|
172 |
+
exec 3>&1
|
173 |
+
|
174 |
+
# res=1 means that no file matched yet
|
175 |
+
res=1
|
176 |
+
|
177 |
+
for i; do
|
178 |
+
case $i in
|
179 |
+
*[-.][zZ] | *_z | *[-.]gz | *.t[ag]z) uncompress="gzip -cdf";;
|
180 |
+
*[-.]bz2 | *[-.]tbz | *.tbz2) uncompress="bzip2 -cdf";;
|
181 |
+
*[-.]lzo | *[-.]tzo) uncompress="lzop -cdf";;
|
182 |
+
*[-.]zst | *[-.]tzst) uncompress="zstd -cdfq";; # zstd needs -q.
|
183 |
+
*) uncompress="$xz -cdfqQ";; # -qQ to ignore warnings like unsupp. check.
|
184 |
+
esac
|
185 |
+
# xz_status will hold the decompressor's exit status.
|
186 |
+
# Exit status of grep (and in rare cases, printf or sed) is
|
187 |
+
# available as the exit status of this assignment command.
|
188 |
+
xz_status=$(
|
189 |
+
exec 5>&1
|
190 |
+
($uncompress -- "$i" 5>&-; echo $? >&5) 3>&- |
|
191 |
+
if test $files_with_matches -eq 1; then
|
192 |
+
eval "$grep -q" && { printf '%s\n' "$i" || exit 2; }
|
193 |
+
elif test $files_without_matches -eq 1; then
|
194 |
+
eval "$grep -q" || {
|
195 |
+
r=$?
|
196 |
+
if test $r -eq 1; then
|
197 |
+
printf '%s\n' "$i" || r=2
|
198 |
+
fi
|
199 |
+
exit $r
|
200 |
+
}
|
201 |
+
elif test $with_filename -eq 0 &&
|
202 |
+
{ test $# -eq 1 || test $no_filename -eq 1; }; then
|
203 |
+
eval "$grep"
|
204 |
+
elif test $grep_supports_label -eq 1; then
|
205 |
+
# The grep implementation in use allows us to specify the filename
|
206 |
+
# that grep will prefix to the output lines. This is faster and
|
207 |
+
# less prone to security bugs than the fallback method that uses sed.
|
208 |
+
# This also avoids confusing output with GNU grep >= 3.5 (2020-09-27)
|
209 |
+
# which prints "binary file matches" to stderr instead of stdout.
|
210 |
+
#
|
211 |
+
# If reading from stdin, let grep use whatever name it prefers for
|
212 |
+
# stdin. With GNU grep it is a locale-specific translated string.
|
213 |
+
if test "x$i" = "x-"; then
|
214 |
+
eval "$grep -H"
|
215 |
+
else
|
216 |
+
eval "$grep -H --label \"\$i\""
|
217 |
+
fi
|
218 |
+
else
|
219 |
+
# Append a colon so that the last character will never be a newline
|
220 |
+
# which would otherwise get lost in shell command substitution.
|
221 |
+
i="$i:"
|
222 |
+
|
223 |
+
# Escape & \ | and newlines only if such characters are present
|
224 |
+
# (speed optimization).
|
225 |
+
case $i in
|
226 |
+
(*'
|
227 |
+
'* | *'&'* | *'\'* | *'|'*)
|
228 |
+
# If sed fails, set i to a known safe string to ensure that
|
229 |
+
# failing sed did not create a half-escaped dangerous string.
|
230 |
+
i=$(printf '%s\n' "$i" | LC_ALL=C sed 's/[&\|]/\\&/g; $!s/$/\\/') ||
|
231 |
+
i='(unknown filename):';;
|
232 |
+
esac
|
233 |
+
|
234 |
+
# $i already ends with a colon so do not add it here.
|
235 |
+
sed_script="s|^|$i|"
|
236 |
+
|
237 |
+
# If grep or sed fails, pick the larger value of the two exit statuses.
|
238 |
+
# If sed fails, use at least 2 since we use >= 2 to indicate errors.
|
239 |
+
r=$(
|
240 |
+
exec 4>&1
|
241 |
+
(eval "$grep" 4>&-; echo $? >&4) 3>&- |
|
242 |
+
LC_ALL=C sed "$sed_script" >&3 4>&-
|
243 |
+
) || {
|
244 |
+
sed_status=$?
|
245 |
+
test "$sed_status" -lt 2 && sed_status=2
|
246 |
+
test "$r" -lt "$sed_status" && r=$sed_status
|
247 |
+
}
|
248 |
+
exit $r
|
249 |
+
fi >&3 5>&-
|
250 |
+
)
|
251 |
+
r=$?
|
252 |
+
|
253 |
+
# If grep or sed or other non-decompression command failed with a signal,
|
254 |
+
# exit immediately and ignore the possible remaining files.
|
255 |
+
#
|
256 |
+
# NOTE: Instead of 128 + signal_number, some shells use
|
257 |
+
# 256 + signal_number (ksh) or 384 + signal_number (yash).
|
258 |
+
# This is fine for us since their "exit" and "kill -l" commands take
|
259 |
+
# this into account. (At least the versions I tried do but there is
|
260 |
+
# a report of an old ksh variant whose "exit" truncates the exit status
|
261 |
+
# to 8 bits without any special handling for values indicating a signal.)
|
262 |
+
test "$r" -ge 128 && exit "$r"
|
263 |
+
|
264 |
+
if test -z "$xz_status"; then
|
265 |
+
# Something unusual happened, for example, we got a signal and
|
266 |
+
# the exit status of the decompressor was never echoed and thus
|
267 |
+
# $xz_status is empty. Exit immediately and ignore the possible
|
268 |
+
# remaining files.
|
269 |
+
exit 2
|
270 |
+
elif test "$xz_status" -ge 128; then
|
271 |
+
# The decompressor died due to a signal. SIGPIPE is ignored since it can
|
272 |
+
# occur if grep exits before the whole file has been decompressed (grep -q
|
273 |
+
# can do that). If the decompressor died with some other signal, exit
|
274 |
+
# immediately and ignore the possible remaining files.
|
275 |
+
test "$(kill -l "$xz_status" 2> /dev/null)" != "PIPE" && exit "$xz_status"
|
276 |
+
elif test "$xz_status" -gt 0; then
|
277 |
+
# Decompression failed but we will continue with the remaining
|
278 |
+
# files anwyway. Set exit status to at least 2 to indicate an error.
|
279 |
+
test "$r" -lt 2 && r=2
|
280 |
+
fi
|
281 |
+
|
282 |
+
# Since res=1 is the initial value, we only need to care about
|
283 |
+
# matches (r == 0) and errors (r >= 2) here; r == 1 can be ignored.
|
284 |
+
if test "$r" -ge 2; then
|
285 |
+
# An error occurred in decompressor, grep, or some other command. Update
|
286 |
+
# res unless a larger error code has been seen with an earlier file.
|
287 |
+
test "$res" -lt "$r" && res=$r
|
288 |
+
elif test "$r" -eq 0; then
|
289 |
+
# grep found a match and no errors occurred. Update res if no errors have
|
290 |
+
# occurred with earlier files.
|
291 |
+
test "$res" -eq 1 && res=0
|
292 |
+
fi
|
293 |
+
done
|
294 |
+
|
295 |
+
# 0: At least one file matched and no errors occurred.
|
296 |
+
# 1: No matches were found and no errors occurred.
|
297 |
+
# >=2: Error. It's unknown if matches were found.
|
298 |
+
exit "$res"
|
ocr-application/bin/lzless
ADDED
@@ -0,0 +1,59 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#!/bin/sh
|
2 |
+
|
3 |
+
# Copyright (C) 1998, 2002, 2006, 2007 Free Software Foundation
|
4 |
+
|
5 |
+
# The original version for gzip was written by Paul Eggert.
|
6 |
+
# Modified for XZ Utils by Andrew Dudman and Lasse Collin.
|
7 |
+
|
8 |
+
# This program is free software; you can redistribute it and/or modify
|
9 |
+
# it under the terms of the GNU General Public License as published by
|
10 |
+
# the Free Software Foundation; either version 2 of the License, or
|
11 |
+
# (at your option) any later version.
|
12 |
+
|
13 |
+
# This program is distributed in the hope that it will be useful,
|
14 |
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
15 |
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
16 |
+
# GNU General Public License for more details.
|
17 |
+
|
18 |
+
|
19 |
+
#SET_PATH - This line is a placeholder to ease patching this script.
|
20 |
+
|
21 |
+
# Instead of unsetting XZ_OPT, just make sure that xz will use file format
|
22 |
+
# autodetection. This way memory usage limit and thread limit can be
|
23 |
+
# specified via XZ_OPT.
|
24 |
+
xz='xz --format=auto'
|
25 |
+
|
26 |
+
version='xzless (XZ Utils) 5.4.6'
|
27 |
+
|
28 |
+
usage="Usage: ${0##*/} [OPTION]... [FILE]...
|
29 |
+
Like 'less', but operate on the uncompressed contents of xz compressed FILEs.
|
30 |
+
|
31 |
+
Options are the same as for 'less'.
|
32 |
+
|
33 |
+
Report bugs to <xz@tukaani.org>."
|
34 |
+
|
35 |
+
case $1 in
|
36 |
+
--help) printf '%s\n' "$usage" || exit 2; exit;;
|
37 |
+
--version) printf '%s\n' "$version" || exit 2; exit;;
|
38 |
+
esac
|
39 |
+
|
40 |
+
if test "${LESSMETACHARS+set}" != set; then
|
41 |
+
# Work around a bug in less 394 and earlier;
|
42 |
+
# it mishandles the metacharacters '$%=~'.
|
43 |
+
space=' '
|
44 |
+
tab=' '
|
45 |
+
nl='
|
46 |
+
'
|
47 |
+
LESSMETACHARS="$space$tab$nl'"';*?"()<>[|&^`#\$%=~'
|
48 |
+
fi
|
49 |
+
|
50 |
+
if test "$(less -V | { read _ ver _ && echo ${ver%%.*}; })" -ge 429; then
|
51 |
+
# less 429 or later: LESSOPEN pipe will be used on
|
52 |
+
# standard input if $LESSOPEN begins with |-.
|
53 |
+
LESSOPEN="|-$xz -cdfqQ -- %s"
|
54 |
+
else
|
55 |
+
LESSOPEN="|$xz -cdfqQ -- %s"
|
56 |
+
fi
|
57 |
+
export LESSMETACHARS LESSOPEN
|
58 |
+
|
59 |
+
exec less "$@"
|
ocr-application/bin/lzma
ADDED
Binary file (130 kB). View file
|
|
ocr-application/bin/lzmadec
ADDED
Binary file (68.7 kB). View file
|
|
ocr-application/bin/lzmainfo
ADDED
Binary file (68.4 kB). View file
|
|
ocr-application/bin/lzmore
ADDED
@@ -0,0 +1,79 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#!/bin/sh
|
2 |
+
|
3 |
+
# Copyright (C) 2001, 2002, 2007 Free Software Foundation
|
4 |
+
# Copyright (C) 1992, 1993 Jean-loup Gailly
|
5 |
+
|
6 |
+
# Modified for XZ Utils by Andrew Dudman and Lasse Collin.
|
7 |
+
|
8 |
+
# This program is free software; you can redistribute it and/or modify
|
9 |
+
# it under the terms of the GNU General Public License as published by
|
10 |
+
# the Free Software Foundation; either version 2 of the License, or
|
11 |
+
# (at your option) any later version.
|
12 |
+
|
13 |
+
# This program is distributed in the hope that it will be useful,
|
14 |
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
15 |
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
16 |
+
# GNU General Public License for more details.
|
17 |
+
|
18 |
+
|
19 |
+
#SET_PATH - This line is a placeholder to ease patching this script.
|
20 |
+
|
21 |
+
# Instead of unsetting XZ_OPT, just make sure that xz will use file format
|
22 |
+
# autodetection. This way memory usage limit and thread limit can be
|
23 |
+
# specified via XZ_OPT.
|
24 |
+
xz='xz --format=auto'
|
25 |
+
|
26 |
+
version='xzmore (XZ Utils) 5.4.6'
|
27 |
+
|
28 |
+
usage="Usage: ${0##*/} [OPTION]... [FILE]...
|
29 |
+
Like 'more', but operate on the uncompressed contents of xz compressed FILEs.
|
30 |
+
|
31 |
+
Report bugs to <xz@tukaani.org>."
|
32 |
+
|
33 |
+
case $1 in
|
34 |
+
--help) printf '%s\n' "$usage" || exit 2; exit;;
|
35 |
+
--version) printf '%s\n' "$version" || exit 2; exit;;
|
36 |
+
esac
|
37 |
+
|
38 |
+
oldtty=`stty -g 2>/dev/null`
|
39 |
+
if stty -cbreak 2>/dev/null; then
|
40 |
+
cb='cbreak'; ncb='-cbreak'
|
41 |
+
else
|
42 |
+
# 'stty min 1' resets eof to ^a on both SunOS and SysV!
|
43 |
+
cb='min 1 -icanon'; ncb='icanon eof ^d'
|
44 |
+
fi
|
45 |
+
if test $? -eq 0 && test -n "$oldtty"; then
|
46 |
+
trap 'stty $oldtty 2>/dev/null; exit' 0 2 3 5 10 13 15
|
47 |
+
else
|
48 |
+
trap 'stty $ncb echo 2>/dev/null; exit' 0 2 3 5 10 13 15
|
49 |
+
fi
|
50 |
+
|
51 |
+
if test $# = 0; then
|
52 |
+
if test -t 0; then
|
53 |
+
printf '%s\n' "$usage"; exit 1
|
54 |
+
else
|
55 |
+
$xz -cdfqQ | eval "${PAGER:-more}"
|
56 |
+
fi
|
57 |
+
else
|
58 |
+
FIRST=1
|
59 |
+
for FILE; do
|
60 |
+
< "$FILE" || continue
|
61 |
+
if test $FIRST -eq 0; then
|
62 |
+
printf "%s--More--(Next file: %s)" "" "$FILE"
|
63 |
+
stty $cb -echo 2>/dev/null
|
64 |
+
ANS=`dd bs=1 count=1 2>/dev/null`
|
65 |
+
stty $ncb echo 2>/dev/null
|
66 |
+
echo " "
|
67 |
+
case "$ANS" in
|
68 |
+
[eq]) exit;;
|
69 |
+
esac
|
70 |
+
fi
|
71 |
+
if test "$ANS" != 's'; then
|
72 |
+
printf '%s\n' "------> $FILE <------"
|
73 |
+
$xz -cdfqQ -- "$FILE" | eval "${PAGER:-more}"
|
74 |
+
fi
|
75 |
+
if test -t 1; then
|
76 |
+
FIRST=0
|
77 |
+
fi
|
78 |
+
done
|
79 |
+
fi
|
ocr-application/bin/markdown-it
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#!/Users/shashankreddykandimalla/Desktop/ocr-application/ocr-application/bin/python
|
2 |
+
# -*- coding: utf-8 -*-
|
3 |
+
import re
|
4 |
+
import sys
|
5 |
+
from markdown_it.cli.parse import main
|
6 |
+
if __name__ == '__main__':
|
7 |
+
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
8 |
+
sys.exit(main())
|
ocr-application/bin/ncursesw6-config
ADDED
@@ -0,0 +1,331 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#!/bin/sh
|
2 |
+
# $Id: ncurses-config.in,v 1.52 2022/07/26 21:36:28 tom Exp $
|
3 |
+
##############################################################################
|
4 |
+
# Copyright 2018-2021,2022 Thomas E. Dickey #
|
5 |
+
# Copyright 2006-2015,2017 Free Software Foundation, Inc. #
|
6 |
+
# #
|
7 |
+
# Permission is hereby granted, free of charge, to any person obtaining a #
|
8 |
+
# copy of this software and associated documentation files (the "Software"), #
|
9 |
+
# to deal in the Software without restriction, including without limitation #
|
10 |
+
# the rights to use, copy, modify, merge, publish, distribute, distribute #
|
11 |
+
# with modifications, sublicense, and/or sell copies of the Software, and to #
|
12 |
+
# permit persons to whom the Software is furnished to do so, subject to the #
|
13 |
+
# following conditions: #
|
14 |
+
# #
|
15 |
+
# The above copyright notice and this permission notice shall be included in #
|
16 |
+
# all copies or substantial portions of the Software. #
|
17 |
+
# #
|
18 |
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR #
|
19 |
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, #
|
20 |
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL #
|
21 |
+
# THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER #
|
22 |
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING #
|
23 |
+
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER #
|
24 |
+
# DEALINGS IN THE SOFTWARE. #
|
25 |
+
# #
|
26 |
+
# Except as contained in this notice, the name(s) of the above copyright #
|
27 |
+
# holders shall not be used in advertising or otherwise to promote the sale, #
|
28 |
+
# use or other dealings in this Software without prior written #
|
29 |
+
# authorization. #
|
30 |
+
##############################################################################
|
31 |
+
#
|
32 |
+
# Author: Thomas E. Dickey, 2006-on
|
33 |
+
|
34 |
+
LANG=C; export LANG
|
35 |
+
LANGUAGE=C; export LANGUAGE
|
36 |
+
LC_ALL=C; export LC_ALL
|
37 |
+
LC_CTYPE=C; export LC_CTYPE
|
38 |
+
|
39 |
+
prefix="/Users/shashankreddykandimalla/Desktop/ocr-application/ocr-application"
|
40 |
+
exec_prefix="${prefix}"
|
41 |
+
|
42 |
+
bindir="${exec_prefix}/bin"
|
43 |
+
includedir="${prefix}/include"
|
44 |
+
libdir="${exec_prefix}/lib"
|
45 |
+
datarootdir="${prefix}/share"
|
46 |
+
datadir="${datarootdir}"
|
47 |
+
mandir="${datarootdir}/man"
|
48 |
+
|
49 |
+
THIS="ncursesw"
|
50 |
+
TINFO_LIB="tinfow"
|
51 |
+
RPATH_LIST="${libdir}"
|
52 |
+
|
53 |
+
includesubdir="${prefix}/include/${THIS}"
|
54 |
+
|
55 |
+
# Ensure that RPATH_LIST contains only absolute pathnames, if it is nonempty.
|
56 |
+
# We cannot filter it out within the build-process since the variable is used
|
57 |
+
# in some special cases of installation using a relative path.
|
58 |
+
if [ -n "$RPATH_LIST" ]
|
59 |
+
then
|
60 |
+
save_IFS="$IFS"
|
61 |
+
IFS=':'
|
62 |
+
filtered=
|
63 |
+
for item in $RPATH_LIST
|
64 |
+
do
|
65 |
+
case "$item" in
|
66 |
+
./*|../*|*/..|*/../*)
|
67 |
+
;;
|
68 |
+
*)
|
69 |
+
[ -n "$filtered" ] && filtered="${filtered}:"
|
70 |
+
filtered="${filtered}${item}"
|
71 |
+
;;
|
72 |
+
esac
|
73 |
+
done
|
74 |
+
IFS="$save_IFS"
|
75 |
+
# if the result is empty, there is little we can do to fix it
|
76 |
+
RPATH_LIST="$filtered"
|
77 |
+
fi
|
78 |
+
|
79 |
+
# with --disable-overwrite, we installed into a subdirectory, but transformed
|
80 |
+
# the headers to include like this:
|
81 |
+
# <ncursesw/curses.h>
|
82 |
+
if [ xno = xno ]; then
|
83 |
+
case $includedir in
|
84 |
+
$prefix/include/ncursesw)
|
85 |
+
includedir=`echo "$includedir" | sed -e 's,/[^/]*$,,'`
|
86 |
+
;;
|
87 |
+
esac
|
88 |
+
fi
|
89 |
+
|
90 |
+
LIBS=""
|
91 |
+
if [ "tinfo" = "ncurses" ]; then
|
92 |
+
LIBS="-l${THIS} $LIBS"
|
93 |
+
else
|
94 |
+
LIBS="-l${THIS} -l${TINFO_LIB} $LIBS"
|
95 |
+
fi
|
96 |
+
|
97 |
+
# Ignore -L options which do not correspond to an actual directory, or which
|
98 |
+
# are standard library directories (i.e., the linker is supposed to search
|
99 |
+
# those directories).
|
100 |
+
#
|
101 |
+
# There is no portable way to find the list of standard library directories.
|
102 |
+
# Require a POSIX shell anyway, to keep this simple.
|
103 |
+
lib_flags=
|
104 |
+
for opt in -L$libdir -Wl,-pie -Wl,-headerpad_max_install_names -Wl,-dead_strip_dylibs -Wl,-rpath,/Users/shashankreddykandimalla/Desktop/ocr-application/ocr-application/lib -L/Users/shashankreddykandimalla/Desktop/ocr-application/ocr-application/lib -Wl,-search_paths_first $LIBS
|
105 |
+
do
|
106 |
+
case $opt in
|
107 |
+
-specs*) # ignore linker specs-files which were used to build library
|
108 |
+
continue
|
109 |
+
;;
|
110 |
+
-Wl,-z,*) # ignore flags used to manipulate shared image
|
111 |
+
continue
|
112 |
+
;;
|
113 |
+
-Wl,--dynamic-linker*) # ignore ELF interpreter
|
114 |
+
continue
|
115 |
+
;;
|
116 |
+
-Wl,--as-needed|-Wl,--build-id=*|-Wl,-dT,*|-Wl,-T,*)
|
117 |
+
continue
|
118 |
+
;;
|
119 |
+
-L*)
|
120 |
+
lib_check=`echo "x$opt" | sed -e 's/^.-L//'`
|
121 |
+
[ -d "$lib_check" ] || continue
|
122 |
+
case "$lib_check" in
|
123 |
+
$HOME/lib|/usr/lib) # skip standard libdir
|
124 |
+
if [ "$lib_check" = "$libdir" ]
|
125 |
+
then
|
126 |
+
lib_first=yes
|
127 |
+
IFS_save="$IFS"
|
128 |
+
IFS='|'
|
129 |
+
LIBDIRS="$HOME/lib|/usr/lib"
|
130 |
+
for lib_check in $LIBDIRS
|
131 |
+
do
|
132 |
+
if [ -d "$lib_check" ]
|
133 |
+
then
|
134 |
+
if [ "$lib_check" != "$libdir" ]
|
135 |
+
then
|
136 |
+
lib_first=no
|
137 |
+
fi
|
138 |
+
break
|
139 |
+
fi
|
140 |
+
done
|
141 |
+
IFS="$IFS_save"
|
142 |
+
[ $lib_first = yes ] && continue
|
143 |
+
found=no
|
144 |
+
for check in $lib_flags
|
145 |
+
do
|
146 |
+
if [ "x$check" = "x$opt" ]
|
147 |
+
then
|
148 |
+
found=yes
|
149 |
+
break
|
150 |
+
fi
|
151 |
+
done
|
152 |
+
[ $found = yes ] && continue
|
153 |
+
:
|
154 |
+
else
|
155 |
+
continue
|
156 |
+
fi
|
157 |
+
;;
|
158 |
+
*)
|
159 |
+
found=no
|
160 |
+
for check in $lib_flags
|
161 |
+
do
|
162 |
+
if [ "x$check" = "x$opt" ]
|
163 |
+
then
|
164 |
+
found=yes
|
165 |
+
break
|
166 |
+
fi
|
167 |
+
done
|
168 |
+
[ $found = yes ] && continue
|
169 |
+
;;
|
170 |
+
esac
|
171 |
+
;;
|
172 |
+
esac
|
173 |
+
lib_flags="$lib_flags $opt"
|
174 |
+
done
|
175 |
+
|
176 |
+
[ $# = 0 ] && exec /bin/sh "$0" --error
|
177 |
+
|
178 |
+
while [ $# -gt 0 ]; do
|
179 |
+
case "$1" in
|
180 |
+
# basic configuration
|
181 |
+
--prefix)
|
182 |
+
echo "$prefix"
|
183 |
+
;;
|
184 |
+
--exec-prefix)
|
185 |
+
echo "$exec_prefix"
|
186 |
+
;;
|
187 |
+
# compile/link
|
188 |
+
--cflags)
|
189 |
+
INCS=" -D_DARWIN_C_SOURCE -DNCURSES_WIDECHAR"
|
190 |
+
if [ "xno" = xno ]; then
|
191 |
+
INCS="$INCS -I${includesubdir}"
|
192 |
+
fi
|
193 |
+
if [ "${includedir}" != /usr/include ]; then
|
194 |
+
INCS="$INCS -I${includedir}"
|
195 |
+
fi
|
196 |
+
sed -e 's,^[ ]*,,' -e 's, [ ]*, ,g' -e 's,[ ]*$,,' <<-ENDECHO
|
197 |
+
$INCS
|
198 |
+
ENDECHO
|
199 |
+
;;
|
200 |
+
--libs)
|
201 |
+
OPTS=
|
202 |
+
for opt in $lib_flags
|
203 |
+
do
|
204 |
+
[ -n "$OPTS" ] && OPTS="$OPTS "
|
205 |
+
OPTS="${OPTS}${opt}"
|
206 |
+
done
|
207 |
+
printf '%s\n' "$OPTS"
|
208 |
+
;;
|
209 |
+
--libs-only-L)
|
210 |
+
OPTS=
|
211 |
+
for opt in $lib_flags
|
212 |
+
do
|
213 |
+
case "x$opt" in
|
214 |
+
x-L*)
|
215 |
+
[ -n "$OPTS" ] && OPTS="$OPTS "
|
216 |
+
OPTS="${OPTS}${opt}"
|
217 |
+
;;
|
218 |
+
esac
|
219 |
+
done
|
220 |
+
printf '%s\n' "$OPTS"
|
221 |
+
;;
|
222 |
+
--libs-only-l)
|
223 |
+
OPTS=
|
224 |
+
for opt in $lib_flags
|
225 |
+
do
|
226 |
+
case "x$opt" in
|
227 |
+
x-l*)
|
228 |
+
[ -n "$OPTS" ] && OPTS="$OPTS "
|
229 |
+
OPTS="${OPTS}${opt}"
|
230 |
+
;;
|
231 |
+
esac
|
232 |
+
done
|
233 |
+
printf '%s\n' "$OPTS"
|
234 |
+
;;
|
235 |
+
--libs-only-other)
|
236 |
+
OPTS=
|
237 |
+
for opt in $lib_flags
|
238 |
+
do
|
239 |
+
case "x$opt" in
|
240 |
+
x-[lL]*)
|
241 |
+
;;
|
242 |
+
*)
|
243 |
+
[ -n "$OPTS" ] && OPTS="$OPTS "
|
244 |
+
OPTS="${OPTS}${opt}"
|
245 |
+
;;
|
246 |
+
esac
|
247 |
+
done
|
248 |
+
printf '%s\n' "$OPTS"
|
249 |
+
;;
|
250 |
+
# identification
|
251 |
+
--version)
|
252 |
+
echo "6.4.20221231"
|
253 |
+
;;
|
254 |
+
--abi-version)
|
255 |
+
echo "6"
|
256 |
+
;;
|
257 |
+
--mouse-version)
|
258 |
+
echo "2"
|
259 |
+
;;
|
260 |
+
# locations
|
261 |
+
--bindir)
|
262 |
+
echo "${bindir}"
|
263 |
+
;;
|
264 |
+
--datadir)
|
265 |
+
echo "${datadir}"
|
266 |
+
;;
|
267 |
+
--includedir)
|
268 |
+
INCS=
|
269 |
+
if [ "xno" = xno ]; then
|
270 |
+
INCS="${includesubdir}"
|
271 |
+
elif [ "${includedir}" != /usr/include ]; then
|
272 |
+
INCS="${includedir}"
|
273 |
+
fi
|
274 |
+
echo "$INCS"
|
275 |
+
;;
|
276 |
+
--libdir)
|
277 |
+
echo "${libdir}"
|
278 |
+
;;
|
279 |
+
--mandir)
|
280 |
+
echo "${mandir}"
|
281 |
+
;;
|
282 |
+
--terminfo)
|
283 |
+
echo "/Users/shashankreddykandimalla/Desktop/ocr-application/ocr-application/share/terminfo"
|
284 |
+
;;
|
285 |
+
--terminfo-dirs)
|
286 |
+
echo "/Users/shashankreddykandimalla/Desktop/ocr-application/ocr-application/share/terminfo"
|
287 |
+
;;
|
288 |
+
--termpath)
|
289 |
+
echo "/etc/termcap:/usr/share/misc/termcap"
|
290 |
+
;;
|
291 |
+
# general info
|
292 |
+
--help)
|
293 |
+
cat <<ENDHELP
|
294 |
+
Usage: `basename "$0"` [options]
|
295 |
+
|
296 |
+
Options:
|
297 |
+
--prefix echos the package-prefix of ${THIS}
|
298 |
+
--exec-prefix echos the executable-prefix of ${THIS}
|
299 |
+
|
300 |
+
--cflags echos the C compiler flags needed to compile with ${THIS}
|
301 |
+
--libs echos the libraries needed to link with ${THIS}
|
302 |
+
|
303 |
+
--libs-only-L echos -L linker options (search path) for ${THIS}
|
304 |
+
--libs-only-l echos -l linker options (libraries) for ${THIS}
|
305 |
+
--libs-only-other echos linker options other than -L/-l
|
306 |
+
|
307 |
+
--version echos the release+patchdate version of ${THIS}
|
308 |
+
--abi-version echos the ABI version of ${THIS}
|
309 |
+
--mouse-version echos the mouse-interface version of ${THIS}
|
310 |
+
|
311 |
+
--bindir echos the directory containing ${THIS} programs
|
312 |
+
--datadir echos the directory containing ${THIS} data
|
313 |
+
--includedir echos the directory containing ${THIS} header files
|
314 |
+
--libdir echos the directory containing ${THIS} libraries
|
315 |
+
--mandir echos the directory containing ${THIS} manpages
|
316 |
+
--terminfo echos the \$TERMINFO terminfo database path
|
317 |
+
--terminfo-dirs echos the \$TERMINFO_DIRS directory list
|
318 |
+
--termpath echos the \$TERMPATH termcap list
|
319 |
+
|
320 |
+
--help prints this message
|
321 |
+
ENDHELP
|
322 |
+
;;
|
323 |
+
--error|*)
|
324 |
+
/bin/sh "$0" --help 1>&2
|
325 |
+
exit 1
|
326 |
+
;;
|
327 |
+
esac
|
328 |
+
shift
|
329 |
+
done
|
330 |
+
# vi:ts=4 sw=4
|
331 |
+
# vile:shmode
|
ocr-application/bin/normalizer
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#!/Users/shashankreddykandimalla/Desktop/ocr-application/ocr-application/bin/python
|
2 |
+
# -*- coding: utf-8 -*-
|
3 |
+
import re
|
4 |
+
import sys
|
5 |
+
from charset_normalizer.cli import cli_detect
|
6 |
+
if __name__ == '__main__':
|
7 |
+
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
8 |
+
sys.exit(cli_detect())
|
ocr-application/bin/numpy-config
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#!/Users/shashankreddykandimalla/Desktop/ocr-application/ocr-application/bin/python
|
2 |
+
# -*- coding: utf-8 -*-
|
3 |
+
import re
|
4 |
+
import sys
|
5 |
+
from numpy._configtool import main
|
6 |
+
if __name__ == '__main__':
|
7 |
+
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
8 |
+
sys.exit(main())
|
ocr-application/bin/openai
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#!/Users/shashankreddykandimalla/Desktop/ocr-application/ocr-application/bin/python
|
2 |
+
# -*- coding: utf-8 -*-
|
3 |
+
import re
|
4 |
+
import sys
|
5 |
+
from openai.cli import main
|
6 |
+
if __name__ == '__main__':
|
7 |
+
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
8 |
+
sys.exit(main())
|