Plan 9 from Bell Labs’s /usr/web/sources/contrib/mason/rc/sloc

Copyright © 2021 Plan 9 Foundation.
Distributed under the MIT License.
Download the Plan 9 distribution.


#!/bin/awk -f

{
    if ($0 == "") { ; }
    else if ($1 ~ /^\/\*/ && $NF ~ /\*\/$/) { ; }
    else if ($0 ~ /\/\*/ && $0 !~ /\*\//) { comment = 1 }
    else if ($0 !~ /\/\*/ && $0 ~ /\*\//) { comment = 0 }
    else if (comment) { ; }
    else if ($1 ~ /^\/\//) { ; }
    else if ($1 ~ /^#/) { ppd++ }
    else { nl++ }
}

END { 
    printf("Lines: %d\n",nl+ppd)
    printf("Preprocessor: %d\n",ppd)
    printf("SLOC: %d\n",nl)
}


Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to webmaster@9p.io.