Guest User

lc.c by FrozenVoid

a guest
Aug 8th, 2013
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.61 KB | None | 0 0
  1. /* LINE COUNT UTILITY
  2. lc.c 1.00 by FrozenVoid
  3. licensed under UFIL1.02 http://pastebin.com/L3p9XK3T
  4. @..\dmc  -gg -Nc -Jm  -o+all -o-dv %1.c -o%1.exe
  5.  
  6. */
  7. #include "void.h" // http://pastebin.com/L4bT9u1b
  8.  
  9. STDSTART
  10.  
  11. u4 i;
  12. if(argc<2){epr("Syntax: lc filename");exit(1);}
  13. u4 fsize;u1p c=getfile(argv[1],&fsize);
  14. if(!fsize||!c){epr("File %s cannot be opened or empty",argv[1]);exit(2);};
  15. u8 exstart=rdtsc();//start of operation
  16. u4 reg count=1;
  17. i=fsize;
  18. wh(i--){count+=(!(c[i]^'\n'));};
  19. u8 endbench=rdtsc()-exstart;
  20. pr("%"PRIu32" lines in file %s \n cycles spent:%"PRIu64,count,argv[1],endbench);
  21.  
  22. STDEND
Advertisement
Add Comment
Please, Sign In to add comment