File: scandir

package info (click to toggle)
epic4 1%3A3.0-2.2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 3,756 kB
  • sloc: ansic: 56,285; makefile: 631; sh: 161; perl: 30
file content (18 lines) | stat: -rw-r--r-- 281 bytes parent folder | download | duplicates (11)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
/*
 * scandir -- an interesting way to use $glob() to get all the files
 * in a [sub]directory.
 */
alias scandir
{
	^local retval
	^local last

	for x in ($glob($*/*))
	{
		if (!(last = after(-1 / $x))) \
			@ last = x
		push retval $last
	}
	@ function_return = retval
}
#hop'97