File: doslist.awk

package info (click to toggle)
mawk 1.3.3-5
  • links: PTS
  • area: main
  • in suites: potato
  • size: 1,204 kB
  • ctags: 1,530
  • sloc: ansic: 13,023; yacc: 994; awk: 629; sh: 330; makefile: 164
file content (34 lines) | stat: -rw-r--r-- 545 bytes parent folder | download | duplicates (11)
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

# print truncated DOS file names
# from packing.list (packing.lis)
#
#  mawk -f doslist.awk packing.lis


# discard blanks and comments
/^#/ || /^[ \t]*$/ {next}


function dos_name(s,	n, front, X)
{
  #lowercase, split on extension and truncate pieces
  s = tolower(s)
  n = split(s, X, ".")

  front = substr(X[1],1,8)

  if ( n == 1 )  return front
  else return front "." substr(X[2], 1, 3)
}

{
  n = split($1, X, "/")
  new = dos_name(X[1])

  for( i = 2 ; i <= n ; i++ )
	new = new "\\" dos_name(X[i])

  printf "%-30s%s\n", $1, new
}