File: more

package info (click to toggle)
yash 2.60-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 6,152 kB
  • sloc: ansic: 34,578; makefile: 851; sh: 808; sed: 16
file content (75 lines) | stat: -rw-r--r-- 2,425 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
# (C) 2010 magicant

# Completion script for the "more" command.
# Supports POSIX 2008, SunOS 5.10, HP-UX 11i v3.
# (We don't support the util-linux-ng version because it's far from POSIX-
# compliance.)

function completion/more {

        case $("${WORDS[1]}" --version 2>/dev/null) in (*'less'*)
                command -f completion//reexecute less
                return
                ;;
        esac
        typeset type="$(uname 2>/dev/null)"

        typeset OPTIONS ARGOPT PREFIX
        OPTIONS=( #>#
        "c; don't scroll the screen"
        "e; exit immediately after printing the last line of the last file"
        "i; case-insensitive search"
        "n:; specify the number of lines in the screen"
        "p:; specify a command executed after loading each file"
        "s; squeeze adjacent empty lines into one"
        "t:; specify an identifier to jump"
        "u; disable special treatment of backspace"
        ) #<#

        case $type in (SunOS|HP-UX)
                OPTIONS=("$OPTIONS" #>#
                "d; display more user-friendly prompt"
                "f; don't wrap long lines"
                ) #<#
        esac
        case $type in
        (SunOS)
                OPTIONS=("$OPTIONS" #>#
                "l; don't pause at form feeds"
                "w; don't exit immediately after printing the last line of the file"
                ) #<#
                ;;
        (HP-UX)
                OPTIONS=("$OPTIONS" #>#
                "v; don't print unprintable characters like ^I or M-C"
                "W:; specify an additional option"
                "x:; specify the width of a tab"
                "z; print backspace, tab, line feed as ^H, ^I, ^M"
                ) #<#
                ;;
        esac

        command -f completion//parseoptions
        case $ARGOPT in
        (-)
                command -f completion//completeoptions
                ;;
        (t)
                if [ -r tags ]; then
                        complete -P "$PREFIX" -R "!_TAG_*" -- \
                                $(cut -f 1 tags 2>/dev/null)
                fi
                ;;
        (W) #>>#
                complete -P "$PREFIX" -D "don't initialize the screen" notite
                complete -P "$PREFIX" -D "initialize the screen" tite
                ;; #<<#
        ('')
                complete -f
                ;;
        esac

}


# vim: set ft=sh ts=8 sts=8 sw=8 et: