File: demo_io

package info (click to toggle)
runawk 1.6.1-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 712 kB
  • sloc: awk: 1,127; ansic: 736; sh: 420; makefile: 103
file content (24 lines) | stat: -rw-r--r-- 780 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#!/usr/bin/env runawk

#use "io.awk"

# This is a demo for io.awk module
#
# Input files for this demo: examples/demo_tokenre.in*

BEGIN {
	FS = "\t" # a part of regression test, useless here
}

{
	printf "File %s is a generic file: %d\n", $0, is_file($0)
	printf "File %s is a socket: %d\n", $0, is_socket($0)
	printf "File %s is a directory: %d\n", $0, is_dir($0)
	printf "File %s is executable: %d\n", $0, is_exec($0)
	printf "File %s is a FIFO: %d\n", $0, is_fifo($0)
	printf "File %s is a symlink: %d\n", $0, is_symlink($0)
	printf "File %s is a block device file: %d\n", $0, is_blockdev($0)
	printf "File %s is a character device file: %d\n", $0, is_chardev($0)
	printf "The size of %s is %d bytes\n", $0, file_size($0)
	printf "The type of %s is %s\n", $0, file_type($0)
}