This file is indexed.

/usr/share/zomg/screenoutput is in zomg 0.7.1-1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  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
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
# screenoutput: ZOMG screen output functions
#   Copyright (C) 2008-2013  Clint Adams

# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.

# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.

# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.

zomgcurses_drawwindows() {
  # This should be more dynamic; tw probably only needs to be this long
  # if the window is narrow.
  zcurses addwin tw 11 $(( COLUMNS )) 0 0
  zcurses border tw
  zcurses move tw 1 1
  zcurses attr tw green/black
  zcurses refresh tw
  zcurses addwin mw 3 $(( COLUMNS )) 11 0
  zcurses border mw
  zcurses move mw 1 1
  zcurses attr mw cyan/black
  zcurses refresh mw
  zcurses addwin bw $(( LINES - 14 )) $(( COLUMNS )) 14 0
  zcurses border bw
  zcurses move bw 1 1
  zcurses refresh bw
}

zomgcurses_init() {
  if (( COLUMNS < 40 )) || (( LINES < 20 )); then
    print "Your screen is too small for the curses interface."
    return 1
  fi
  zcurses init || return 1
  wehavecurses=1

  zomgcurses_drawwindows
  trap 'zcurses refresh' WINCH
}

writetowindow() {
# check for right number of args
#
local win="$1"
local str="$2"
local frag mark

zcurses position $win winloc
# y x cornery cornerx sizey sizex

if (( $winloc[2] + $#str < $winloc[6] )); then
  if (( $winloc[1] + 3 > $winloc[5] )); then
    zcurses scroll $win -1
    zcurses scroll $win 3
    zcurses border $win
    zcurses move $win $(( $winloc[1] - 2 )) 1
  fi
  zcurses string $win "$str"
  zcurses position $win winloc
  zcurses move $win $(( $winloc[1] + 1 )) 1
  zcurses refresh $win
else
  mark=${${str[1,$winloc[6]]}[(I) ]}
  if (( $mark < 1 )) || (( $mark > $winloc[6] - 2 )); then
    (( mark = $winloc[6] - 2 ))
  fi
  frag=$str[1,$mark]
  str=$str[$mark+1,-1]
  writetowindow $win "${frag}"
  writetowindow $win "${str}"
fi
}

status_msg() {
  if (( wehavecurses == 1 )); then
    writetowindow bw "$1"
    zcurses refresh bw
  else
    print "$1"
  fi
}

play_msg() {
  if (( wehavecurses == 1 )); then
    writetowindow tw "$1"
    zcurses refresh tw
  else
    print "$1"
  fi
}

current_msg() {
  if (( wehavecurses == 1 )); then
    writetowindow mw "$1"
    zcurses refresh mw
  else
    print "Station: $1"
  fi
}

time_status_msg() {
  status_msg "$(strftime "[%H:%M]" $EPOCHSECONDS) $1"
}

log_msg() {
  print -r  -- "$(strftime "[%H:%M:%S]" $EPOCHSECONDS) $1" >>$zomgdatadir/log
}

scrollclear() {
  case "$1" in
    (tw)
      zcurses scroll tw 11 && zcurses move tw 1 1 && zcurses border tw
      ;;
    (mw)
      zcurses scroll mw 3 && zcurses move mw 1 1 && zcurses border mw
      ;;
    (*)
      zcurses scroll $i 20 && zcurses move $i 1 1 && zcurses border $i
      ;;
  esac
}

truncate_log_new() {
  zmodload -F zsh/stat b:zstat
  if [[ $(zstat +size $zomgdatadir/log) -gt 100000 ]]; then
    tail -n 1000 $zomgdatadir/log >$zomgdatadir/log.tmp
    mv $zomgdatadir/log.tmp $zomgdatadir/log
  fi
}

truncate_log_ancient() {
    tail -n 1000 $zomgdatadir/log >$zomgdatadir/log.tmp
    mv $zomgdatadir/log.tmp $zomgdatadir/log
}

autoload -Uz is-at-least
if is-at-least 4.3.9; then
  truncate_log() { truncate_log_new "$@"; };
else
  truncate_log() { truncate_log_ancient "$@"; };
fi