File: xls.csh

package info (click to toggle)
iceweasel 2.0.0.19-0etch1
  • links: PTS
  • area: main
  • in suites: etch
  • size: 298,784 kB
  • ctags: 317,912
  • sloc: cpp: 1,796,902; ansic: 987,677; xml: 109,036; makefile: 47,777; asm: 35,201; perl: 26,983; sh: 20,879; cs: 6,232; java: 5,513; python: 3,249; pascal: 459; lex: 306; php: 244; csh: 132; objc: 97; yacc: 79; ada: 49; awk: 14; sql: 4; sed: 4
file content (81 lines) | stat: -rwxr-xr-x 1,873 bytes parent folder | download | duplicates (9)
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
#!/bin/csh
# xls.csh: a C-shell XMLterm wrapper for the UNIX "ls" command
# Usage: xls.csh [-i] [-x]

set files=(`/bin/ls -d $cwd/*`)
set ncols=4

##set echocmd="/usr/bin/echo"
set echocmd="/bin/echo -e"

set iconic=0
set create=0

set options=""
foreach arg ($*)
   switch ($arg)
   case "-i":
      set iconic=1
      set options=($options $arg)
      breaksw
   case "-c":
      set create=1
      set options=($options $arg)
      breaksw
   endsw
end

$echocmd "\033{S${LTERM_COOKIE}\007\c"
$echocmd '<TABLE FRAME=none BORDER=0>'
$echocmd "<COLGROUP COLSPAN=$ncols WIDTH=1*>"

set rowimg=""
set rowtxt=""
set nfile=0
foreach file ($files)
   if (-d $file) then       #directory
      set filetype="directory"
      set sendtxt="cd $file; xls $options"
      set sendimg="file:/usr/share/pixmaps/mc/i-directory.png"
#      set sendimg="chrome://xmlterm/skin/default/images/ficon3.gif"
   else if (-x $file) then  #executable
      set filetype="executable"
      set sendtxt="$file"
      set sendimg="file:/usr/share/pixmaps/mc/i-executable.png"
   else                     #plain file
      set filetype="plainfile"
      set sendtxt=""
      set sendimg="file:/usr/share/pixmaps/mc/i-regular.png"
   endif

   set tail=${file:t}

   if ($create) then
      set cmd="createln"
   else
      set cmd="sendln"
   endif
   set clickcmd="onClick="'"'"return ClickXMLTerm('$cmd',-1,'$sendtxt')"'"'

   set rowimg="${rowimg}<TD><IMG SRC='$sendimg' $clickcmd>"
   set rowtxt="${rowtxt}<TD><SPAN CLASS='$filetype' $clickcmd>"
   set rowtxt="${rowtxt}$tail<SPAN/>"
@  nfile++

   if (($nfile % $ncols) == 0) then
      if ($iconic) $echocmd "<TR>$rowimg"
      $echocmd "<TR>$rowtxt"
      set rowimg=""
      set rowtxt=""
   endif

end

if ("$rowtxt" != "") then
   if ($iconic) $echocmd "<TR>$rowimg"
   $echocmd "<TR>$rowtxt"
endif

$echocmd '</TABLE>'
$echocmd '\000\c'