home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #18 / NN_1992_18.iso / spool / comp / database / informix / 1721 < prev    next >
Encoding:
Internet Message Format  |  1992-08-13  |  2.9 KB

  1. Path: sparky!uunet!usc!sol.ctr.columbia.edu!emory!emory.mathcs.emory.edu
  2. From: widener!obelix.informix.com!johnl@emory.mathcs.emory.edu (Jonathan Leffler)
  3. Newsgroups: comp.databases.informix
  4. Subject: Re:  Shell Archive
  5. Message-ID: <9308@emory.mathcs.emory.edu>
  6. Date: 14 Aug 92 00:13:09 GMT
  7. Sender: walt@mathcs.emory.edu
  8. Reply-To: widener!obelix.informix.com!johnl@emory.mathcs.emory.edu (Jonathan Leffler)
  9. Lines: 115
  10. X-Informix-List-ID: <list.1379>
  11.  
  12. I attach a shell archive of the shell archiver I usually use.
  13. There are also C programs which do the same job somewhat quicker,
  14. but they are also bigger to send.
  15.  
  16. Note the customisation for the sending organsiation -- you'll want
  17. to change that (please!).
  18.  
  19. I hope it's useful.
  20. Jonathan Leffler (johnl@obelix.informix.com) #include <disclaimer.h>
  21.  
  22. :    "@(#)shar.sh    1.8"
  23. #! /bin/sh
  24. #
  25. #    This is a shell archive.
  26. #    Remove everything above this line and run sh on the resulting file.
  27. #    If this archive is complete, you will see this message at the end:
  28. #    "All files extracted"
  29. #
  30. #    Created: Thu Aug 13 23:05:56 GMT 1992 by johnl at Informix Software Ltd.
  31. #    Files archived in this archive:
  32. #    shar
  33. #
  34. #--------------------
  35. if [ -f shar -a "$1" != "-c" ]
  36. then echo shar: shar already exists
  37. else
  38. echo 'x - shar (Aug characters)'
  39. sed -e 's/^X//' >shar <<'SHAR-EOF'
  40. X
  41. X:    "@(#)shar.sh    1.8"
  42. X#
  43. X#    Create shell archive from files listed in argument list
  44. X
  45. Xcase "$1" in
  46. X-s)    silent=yes
  47. X    shift
  48. X    ;;
  49. X--)    shift
  50. X    ;;
  51. X-*)    echo "Usage: $0 [-s] file ..." >&2
  52. X    exit 1
  53. X    ;;
  54. Xesac
  55. X
  56. Xcase $# in
  57. X0)    echo "Usage: $0 [-s]  file ..." >&2
  58. X    exit 1
  59. X    ;;
  60. Xesac
  61. X
  62. Xcat <<!
  63. X:    "@(#)shar.sh    1.8"
  64. X#! /bin/sh
  65. X#
  66. X#    This is a shell archive.
  67. X#    Remove everything above this line and run sh on the resulting file.
  68. X#    If this archive is complete, you will see this message at the end:
  69. X#    "All files extracted"
  70. X#
  71. X#    Created: `date` by $LOGNAME at Informix Software Ltd.
  72. X#    Files archived in this archive:
  73. X!
  74. X
  75. Xfor file in "$@"
  76. Xdo
  77. X    if [ -f $file -a -r $file ]
  78. X    then
  79. X        echo "#    $file"
  80. X    fi
  81. Xdone
  82. Xecho "#"
  83. X
  84. Xfor file in "$@"
  85. Xdo
  86. X    if [ ! -f $file ]
  87. X    then
  88. X        echo "$0: $file is not a file" >&2
  89. X        continue
  90. X    fi
  91. X    bname=`basename $file`
  92. X    if [ "$silent" != yes ]
  93. X    then
  94. X        echo "a - $bname" >&2
  95. X    fi
  96. X    if [ ! -r $file ]
  97. X    then
  98. X        echo "$0: Can't read $file" >&2
  99. X        exit 1
  100. X    else
  101. X        size=`ls -l $file | sed 's/[     ][     ]*/    /g' | cut -f5`
  102. X        echo "#--------------------"
  103. X        echo "if [ -f $bname -a \"\$1\" != \"-c\" ]"
  104. X        echo "then echo shar: $bname already exists"
  105. X        echo "else"
  106. X        echo "echo 'x - $bname ($size characters)'"
  107. X        echo "sed -e 's/^X//' >$bname <<'SHAR-EOF'"
  108. X        sed -e 's/^/X/' $file
  109. X        echo "SHAR-EOF"
  110. X        echo "if [ \`wc -c <$bname\` -ne $size ]"
  111. X        echo "then echo shar: $bname unpacked with wrong size"
  112. X        echo "fi"
  113. X        echo "# end of overwriting check"
  114. X        echo "fi"
  115. X    fi
  116. Xdone
  117. Xecho "echo All files extracted"
  118. Xecho "exit 0"
  119. SHAR-EOF
  120. if [ `wc -c <shar` -ne Aug ]
  121. then echo shar: shar unpacked with wrong size
  122. fi
  123. # end of overwriting check
  124. fi
  125. echo All files extracted
  126. exit 0
  127.