csgetval.rc 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. #!/bin/rc
  2. #
  3. # command: /bin/boddle /n/juke/plan_9/sys/src/libndb/csgetval.c /sys/src/libndb/csgetval.c
  4. # srcdir: /n/juke/plan_9/sys/src/libndb
  5. # version: 827758307
  6. # date: Mon Mar 25 07:51:47 EST 1996
  7. #
  8. myname=$0
  9. doextract=no
  10. fn usage{
  11. echo $myname: usage: $myname '[-X] [src-directory]' >[1=2]
  12. exit usage
  13. }
  14. fn sigint{
  15. rm -rf 827758307
  16. exit interrupt
  17. }
  18. while(~ $1 -*){
  19. switch($1){
  20. case -X
  21. doextract=yes
  22. case -*
  23. usage
  24. }
  25. shift
  26. }
  27. switch($#*){
  28. case 0
  29. srcdir=/sys/src/libndb
  30. case 1
  31. srcdir=$1
  32. case *
  33. usage
  34. }
  35. if(! ~ $doextract yes){
  36. echo This shell file contains a bundle of diffs representing changes
  37. echo to original source files in the Plan 9 distribution. It will run
  38. echo against the files in
  39. echo ' ' $srcdir
  40. echo '(unless overridden by the optional source directory argument)'
  41. echo and create a directory 827758307 containing the updated files.
  42. echo It will NOT automatically update the original files.
  43. echo
  44. echo Invoke with argument -X to perform the actual extraction.
  45. exit 0
  46. }
  47. rm -rf 827758307
  48. mkdir 827758307
  49. target=827758307/csgetval.c
  50. echo -n '827758307/csgetval.c: '
  51. if(! test -f $srcdir/csgetval.c || ! test -r $srcdir/csgetval.c){
  52. echo $srcdir/csgetval.c unreadable
  53. exit unreadable
  54. }
  55. sum=`{sum < $srcdir/csgetval.c}
  56. if(! ~ dd3f66a31051 $sum(1)^$sum(2)){
  57. echo $srcdir/csgetval.c is not the original distribution file
  58. exit original
  59. }
  60. cp $srcdir/csgetval.c 827758307/csgetval.c
  61. ed 827758307/csgetval.c >/dev/null >[2=1] <<'//GO.SYSIN DD VADIM csgetval.c'
  62. 57a
  63. .
  64. 25a
  65. snprint(line, sizeof(line), "!%s=%s", attr, val);
  66. if(write(fd, line, strlen(line)) < 0){
  67. close(fd);
  68. return 0;
  69. }
  70. seek(fd, 0, 0);
  71. .
  72. 24d
  73. 21c
  74. if(netroot)
  75. snprint(line, sizeof(line), "%s/cs", netroot);
  76. else
  77. strcpy(line, "/net/cs");
  78. fd = open(line, ORDWR);
  79. .
  80. 18a
  81. int fd;
  82. .
  83. 17c
  84. int n, linefound;
  85. .
  86. 14c
  87. csgetval(char *netroot, char *attr, char *val, char *rattr, char *buf)
  88. .
  89. wq
  90. //GO.SYSIN DD VADIM csgetval.c
  91. sum=`{sum < 827758307/csgetval.c}
  92. if(~ 6ccfa6031265 $sum(1)^$sum(2))
  93. echo
  94. if not{
  95. echo 827758307/csgetval.c checksum error creating updated file
  96. exit checksum
  97. }