dsum? Dsum - , . , - - -. - , , . - - -. . dsum - , . . dsum - , . 1. . 2. - . 3. , , - . 4. diff , , - . , - , - Dsum , - , . - , , . . , - . , *.c ( ). , .c. -c -o. -c *.c . - *.c . -o , *.o. 1. $ mount /dev/fd0 /mnt $ cp /usr/include/* /mnt $ dsum /usr/include /mnt /mnt. - /usr/include . , dsum . : *, /usr/include/sys. 2. $ dsum . .. , . 4-9 . - , / - . - , , - -c , . ( ) . 11-21 FLIST. FLIST - , , - . - ($# = 2), FLIST * ( ) 12. * FLIST - ( - ). ($# = 3), - FLIST , *.c *.o. , - . 23-31 . for, , FLIST. 23 FLIST * . for . , FLIST - . 25 , 19. BASEF FILE. - , , , . ( UNIX - basename , .. , .) 26-29 . if-then , , . 26 - , expr. expr - . " " (*), . ( - expr(1), .) test - , : . , , - . - , - . ( 3-6 , , .. .) - , - , . , . , . - , ( , ). - " ", . - sum. : -------------------------------- | 4243 3 autobkp | 247 1 can | 25167 6 cpiobr | 186 3 dosflp | 56864 2 dsum | 2782 1 log | , dsum , . . 27 ( 7 ) 28 ( ). echo , - , . -, , . , - , . ( ). , FILE - . sum ( , - , , ). - , sum - cut, . , , \c . . 30. - ($2 ) , , . , sum.   , dsum , , , . . , - . , - . , . . , , : for FILE in $1/$FLIST do BASEF=`basename $FILE` S1=`sum $FILE 2>&1 | cut -d' ' -f1` S2=`sum $2/$BASEF 2>&1 | cut -d' ' -f1` if [ "$S1" = "$S2" ] then M="" else M="<---" fi if [ ` expr $BASEF : '.*'` -lt 7 ] then echo "$BASEF: \t$S1\t$S2 $M" else echo "$BASEF:\t$S1\t$S2 $M" fi done , - dsum, . sum . , , . , M . , M , , . 3.4.2. log - -------------------------------------------------------------------------- : log _________________________________________________________________________ log  , autobkp.   log log log 1 : 2 # @(#) log v1.0 Menu access to backup logfiles Author: Russ Sage 4 c 5 set `date` 6 echo " 8 $1, $2 $3 $4 10 Logfile Menu 11 ---------------- 12 1 - list all log file names 13 2 - display log of home backup 14 3 - display log of product backup 15 to exit 17 Enter command (1-3,<>): \c" 18 read CMD 20 case $CMD in 21 "") exit;; 22 1) echo "\nLogfile names:" 23 sed -n -e "/more/s/^.*more \(.*\);;$/\1/p" $HOME/bin/log;; 24 2) more $HOME/bin/autobkplog.home;; 25 3) more$HOME/bin/auto2.bkplogm;; 26 *) echo "log: $CMD is not a command";; 27 esac CMD , HOME log? , , autobkp. autobkp . , , cron. . - . - cron , autobkp . , autobkp. , pathlist, cron . , - , ? - log. log? log - . , . , more . cpiobr, , - . log - , . , log - "" . - . log . Log , . ( sed) log- more, . , log - , - , . - , - . log - , . , , , log, - ( , -). , - more , . 4 , c, . ( clear, .) 5 date. , cpiobr. 6-17 . echo, cpiobr. - 13 . 20-27 . ( ), . 23 sed $HOME/bin/log. , log - . - , . sed -n, , , - . -e . sed. - , - . : more (/more/), , - "more". , , more. , more, - sed. sed . , .*, - "more" - . log, "more", , , . sed - "pattern 1". "Pattern 1" - sed - " " . , - sed - , . more, . log , sed. , sed - "more". , , - . , . , . , log. $ log 1 . 1 , log-. , , - , . , .  * 4. *  4.1. 4.2. 4.2.1. stripc - 4.2.2. stripf - - 4.2.3. strips - Shell 4.3. ctags -  . - . , , , . . - . , . , - . , , ( ), , - . ? - , , , , . , . - , . , , , - . , . , , , , , - . , - , . cg 10. 4.1.  - . . , , " " , , - "" - . . - , , , UNIX . stripc, stripf strips. Stripc stripf , strips - . - ( ) . , , - . ctags - , . Ctags vi/ex , . Ctags , vi, , . - , , , . , . Ctags - UNIX . , - , , . - Trantor TR-101? ctags . , , , , . . ? UNIX. , - , UNIX (sed, awk ..), . -, , - . , - , . 4.2. 4.2.1. stripc - ------------------------------------------------------------ : stripc ------------------------------------------------------------ stripc .  , .  stripc [...]   stripc prog*.c > header header. stripc 1 : 2 # @(#) stripc v1.0 Strip comment header Author: Russ Sage 4 if [ "$#" -eq "0" ] 5 then echo "stripc: arg count error" >&2 6 echo "usage: stripc file [...]" >&2 7 exit 1 8 fi 10 for FILE in $@ 11 do 12 if [ ! -s $FILE ] 13 then echo "file \"$FILE\" does not exist" >&2 14 continue 15 fi 17 awk '/^\/\*/, /^ \*\// { if ($0 != " */") 18 print 19 else {print;exit} 20 }' $FILE 21 echo "^L" 22 done ( , , 21 control- L, , , .)   FILE , .  stripc? - . - , - , , , , .. - , . , , - , . , , . , , , . , . stripc? Stripc . , - : , , , .. - . , - . , . /* * * . * , (, , * ..) . * */ . ^L control-L . /* . * , * . , * . */ main() { /* - */ } ^L /* , * . - * , * . */ func(arg1,arg2) int arg1; char arg2; { /* */ } ^L /* , * . * * . */ func(arg1,arg2) int arg1, arg2; { /* */ } , main , , , - , . , , - , , . . , . stripc. . - stripf. . stripf, - . , ( control-L ASCII). ^L, - . control-L ^L - . - , . ( main ) - . - , - , , . stripc - . , , . , - . , - (/*). , (*/) stdout. , , , . , , -. , . , "" ("strip") - , . . , - .  1. $ stripc test?.c > test.filehdrs , - "test", , .c. test1, testA, testb .. - test.filehdrs , for. 2. $ for DIR in src1 src2 src3 > do > stripc $DIR/*.c > /tmp/$DIR.hdrs > done src1, src2 src3. , - . , stripc - . , .. , - /tmp. /tmp /tmp/src1.hdrs, /tmp/src2.hdrs /tmp/src3.hdrs. , , - stripc, 255 . - . 4-8 . - , . stripc . for 10-22 . , 12-15 . , . 17-20 - awk, . awk , for. awk, , - : awk - , : { } , . awk , - . stripc (/*) (*/) /^\/\*/ /^ \*\// - ed, sed grep. () - ( /). awk , , . " (^), ( , , .. \/) - (\*), , ". - (.. ), - awk . ( stripf - .) , - , , "". 17, 18 19 if-then= else, - . $0 ( ) (*/), . if, , - . , "", else-. , , - , awk. , ({}), . awk - . , . 4.2.2. stripf - - ------------------------------------------------------------ : stripf ------------------------------------------------------------ stripf -.  , - - .  stripf file [...]   stripf lib1.c lib1.c. stripf 1 : 2 # @(#) stripf v1.0 Strip function header Author: Russ Sage 4 for FILE in $@ 5 do 6 sed -n -e ' 7 /^L$/ { 8 s/^L$/.bp/p 9 : loop 10 n 11 /^{/b exit 12 p 13 b loop 14 : exit 15 i\ 16 {} 17 b 18 }' $FILE 19 done   FILE .  stripf? , - , stripc. . , , , . , - , . ? stripf? stripf . , ( "main", ). stripf , . Stripf stdout. , . , - nroff, - . .bp,