forked from pemsley/coot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
count-loc
executable file
·46 lines (31 loc) · 1004 Bytes
/
count-loc
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
#!/usr/bin/scsh -s
!#
; -*-scheme-*-
(define add-up
(lambda (dir-name depth)
(let* ((depth-str (number->string depth))
(str
(car (run/strings (| (find ,dir-name "-maxdepth" ,depth-str
"(" -name "*.c"
-o -name "*.cc"
-o -name "*.h"
-o -name "*.hh"
-o -name "*.cpp"
-o -name "configure.in"
-o -name "Makefile.am"
-o -name "*.m4"
-o -name "ChangeLog"
-o -name "*.tex"
")")
(xargs wc -l)
(tail -1))))))
(format #t "~s: ~s~%" dir-name str)
; the number is the first part of the string, but after
; some spaces (which get transformed into "")
;
(string->number (car (cdr ((infix-splitter) str)))))))
; (let ((intl-dir-count (add-up "intl" 1))
; ( all-dir-count (add-up "." 2)))
; (format #t "Lines of code: ~s~%"
; (- all-dir-count intl-dir-count)))
(format #t "Lines of code: ~s~%" (add-up "." 2))