Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!wuarchive!zaphod.mps.ohio-state.edu!uakari.primate.wisc.edu!news.larc.nasa.gov!amiga-request From: amiga-request@ab20.larc.nasa.gov (Amiga Sources/Binaries Moderator) Newsgroups: comp.sources.amiga Subject: v91i112: cutshar 1.0 - cut off the 'cut here' part of a shell archive, Part01/01 Message-ID: Date: 18 May 91 02:07:03 GMT Reply-To: RWALLACE%vax1.tcd.ie@CUNYVM.CUNY.EDU Lines: 377 Approved: tadguy@uunet.UU.NET (Tad Guy) X-Mail-Submissions-To: amiga@uunet.uu.net X-Post-Discussions-To: comp.sys.amiga.misc Submitted-by: RWALLACE%vax1.tcd.ie@CUNYVM.CUNY.EDU Posting-number: Volume 91, Issue 112 Archive-name: utilities/cutshar-1.0/part01 [ includes uuencoded executable ...tad ] Program to cut off the 'cut here' part of a shell archive Usage: cutshar \n Replaces each indicated file with a new version of that file in which everything up to and including the first line containing 'cut here' has been removed. Assumes enough memory is available to hold contents of each file ... if memory runs out, will terminate with an error message. #!/bin/sh # This is a shell archive. Remove anything before this line, then unpack # it by saving it into a file and typing "sh file". To overwrite existing # files, type "sh file -c". You can also feed this as standard input via # unshar, or by typing "sh 'cutshar.c' <<'END_OF_FILE' X/* Program to cut off the 'cut here' part of a shell archive X by Russell Wallace 5 Aug 1990 X See instructions in code for details X Written on the Amiga using Aztec C 5.0a but in generic C so it should X compile with anything X This code is in the public domain X*/ X X#include X#include X#include X X#define BUFSIZE 512 /* Maximum allowed line length */ X Xtypedef struct linestruct X{ X struct linestruct *next; X char *text; X} line; X Xvoid *Malloc (size_t bytes) X{ X void *result = malloc (bytes); X if (result == 0) X { X printf ("Out of memory\n"); X exit (1); X } X return result; X} X Xmain (int argc,char **argv) X{ X int i; X if (argc == 1 || !strcmp (argv[1],"?")) X { X printf ( X"cutshar v1.0 by Russell Wallace " __DATE__ "\n" X"Usage: cutshar \n" X"Replaces each indicated file with a new version of that file in which\n" X"everything up to and including the first line containing 'cut here' has been\n" X"removed.\n" X"Assumes enough memory is available to hold contents of each file ... if\n" X"memory runs out, will terminate with an error message.\n" X"This program is in the public domain.\n" X ); X return 1; X } X for (i=1 ; inext = Malloc (sizeof (line)); X lastLine = lastLine->next; X lastLine->text = Malloc (strlen (buf)+1); X strcpy (lastLine->text,buf); X } X lastLine->next = 0; X fclose (fp); X fp = fopen (argv[i],"w"); X if (!fp) X { X printf ("Can't open %s for output\n",argv[i]); X continue; X } X for (lastLine=lineHead ; lastLine ;) /* Write lines after cut */ X { X line *tempLine; X fputs (lastLine->text,fp); X tempLine = lastLine->next; X free (lastLine->text); X free (lastLine); X lastLine = tempLine; X } X fclose (fp); XNEXTFILE:; X } X return 0; X} X END_OF_FILE if test 2607 -ne `wc -c <'cutshar.c'`; then echo shar: \"'cutshar.c'\" unpacked with wrong size! fi # end of 'cutshar.c' fi if test -f 'cutshar.uu' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'cutshar.uu'\" else echo shar: Extracting \"'cutshar.uu'\" \(12024 characters\) sed "s/^X//" >'cutshar.uu' <<'END_OF_FILE' Xbegin 644 cutshar XM```#\P`````````#``````````(```>5```!2`````$```/I```'E4[Z!]!.6 XM5?_\2.<``"\M``A.NAEH6$\K0/_\2JW__&8``!9(>@`>3KH%@,O("W_^$'L@L;0B"\`3KH."$_O``Q*@&8``"0O+?_T("W__.6`Z XM(&T`#"\P"`!(>@,(3KH#\D_O``Q@```(8)1@`/]&+RW_Z$AX`@!(;(+&3KH#A XM*$_O``PO+?_H3KH#"EA/2H!F``!*2'@`"$ZZ_B)83R!M_^P@@"!M_^PK4/_LX XM2&R"QDZZ$MI83U*`+P!.NOX`6$\@;?_L(4``!$AL@L8@;?_L+R@`!$ZZ%ZI0* XM3V"4(&W_[$*0+RW_Z$ZZ%.!83TAZ`HD@+?_\Y8`@;0`,+S`(`$ZZ!%Q03RM`? XM_^A*K?_H9@``'B`M__SE@"!M``PO,`@`2'H"64ZZ`RY03V``_BPK;?_P_^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3.\#' XM```$L\AG#'``$!BP&5;(__IF!'``3G5C!'`!3G5P_TYU2.``K?````"#__!8:<``0`V!F",0``&#R",0``6#L",0``F#F",0``V#@6(XD7 XM+O_\2H)L!@C$``!$@A8:8%8K?````##__'0`8!@@`N>`<@`2`]"!T(+0@B0`& XM!((````P%AIP`!`#0>R``Q`P``!(@`@```)FU&`@5T!GHE]`9Z13I XM0&>.54!GA%=`9ZQ@LBM"__@D/```?<8,`P`N9EP6&@P#`"IF%%B.)"[__$J"9 XM;`8D/```?<86&F`P=`!@&"`"YX!R`!(#T('0@M"")``$@@```#`6&G``$`-!4 XM[(`#$#```$B`"````F;4#((``'W&9P@K?````"#__"H"#`,`:&8&",0`!V`65 XM#`,`;&8&",0`!F`*#`,`3&8&",0`"!8:*TH`#'``$`-@``&.8``#&@@$``=G8 XM"EB.(&[__#"'8!@(!``&9PI8CB!N__P@AV`(6(X@;O_\((=T`&```:A8CB1NT XM__PO"DZZ`P@D``R%``!]QEA/9P:TA6\")`5@``&&6(X6+O__0>W]^"1($(-T+ XM`6```7)T"&`0`$0`2'9X=!!@!@C$``1T"@P#`%AF"$'Z`IX@"&`&0?H"IR`(\ XM*T#]]`@$``9G"%B.+"[__&`4"`0`!&<(6(XL+O_\8`98CBPN__P(!``$9PI*R XMAFP&1(8(Q``%0>W_^"1(#(4``'W&9@)Z`4J&9@1*A6<<(@(@!DZZ!:P@;?WTH XM%3`(`"("(`9.N@6H+`!FY$'M__B1RB0("`0``V=N#`,`;V842H)G"@P2`#!G\ XM"+2%;00J`E*%8%0,`P!X9P8,`P!89DA*@F=$#!(`,&<^M(5L$$'M_?JQRF0(= XM%3P`,%*"8.P(!```9AP,K0```##__&82(`)4@+"M__AL""HM__A5A6#*%0,5( XM/``P5(*TA6P00>W]^+'*9`@5/``P4H)@[&!,!$``)6<`_L@$0``S9P#^V`1`< XM``MG`/ZR4T!G`/[.6T!G`/[(6T!G`/Y04T!G`/ZN4T!G`/ZL5T!G`/YL54!GN XM`/Z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I9Q!+^@`(3J[_XF`&0J?S7TYS*E]*K(3>9CQ*K(3N9S1(YP`": XM("R$ZB)LA.XL;(3*3J[_+DS?0`!(YP`"("R$YN6`6(`B;(3B+&R$RDZN_RY,G XMWT``8"1(YP`"+&R$RDZN_WQ,WT``2.<``B)LA-XL;(3*3J[^ADS?0`!(YP`"_ XM(FR$SBQLA,I.KOYB3-]``"`#+FR$QDYU3-\`#$YU2.<@("0O``QR!B`"3KH`! XM2B1`U>R$TDJ";0PP;(*\L<)O!$J29A`I?`````.$\G#_3-\$!$YU,"H`!`)`_ XM@`!F$DCG``(B$BQLA,Y.KO_<3-]``$*2<`!@V$CG<``T`<3`)@%(0\;`2$-"B XM0]2#2$#`P4A`0D#0@DS?``Y.=0```^P````!`````0``"$H````````#\@``S XM`^H```"Q`"`@("`@("`@(#`P,#`P("`@("`@("`@("`@("`@("`@D$!`0$!`^ XM0$!`0$!`0$!`0`P,#`P,#`P,#`Q`0$!`0$!`"0D)"0D)`0$!`0$!`0$!`0$!Z XM`0$!`0$!`0%`0$!`0$`*"@H*"@H"`@("`@("`@("`@("`@("`@("`D!`0$`@, XM````````````````````````````````````````````````````````````` XM````````````````````````````````````````````````````````````` XM````````````````````````````````````````````````````````````` XM`````````@````````$```````````````````0``0`````!````````````) XM```````$``(``````0``````````````````````````````````````````' XM````````````````````````````````````````````````````````````` XM````````````````````````````````````````````````````````````` XM````````````````````````````````````````````````````````````` XM````````````````````````````````````````````````````````````` XM````````````````````````````````````````````````````````````` XM````````````````````````````````````````````````````````````` XM````````````````````````````````````````````````````````````` XM````````````````````````````````````````%``````````````#\@``) X*`^L````!```#\@``D X`` Xend Xsize 8560 END_OF_FILE if test 12024 -ne `wc -c <'cutshar.uu'`; then echo shar: \"'cutshar.uu'\" unpacked with wrong size! fi # end of 'cutshar.uu' fi echo shar: End of archive 1 \(of 1\). cp /dev/null ark1isdone MISSING="" for I in 1 ; do if test ! -f ark${I}isdone ; then MISSING="${MISSING} ${I}" fi done if test "${MISSING}" = "" ; then echo You have the archive. rm -f ark[1-9]isdone else echo You still need to unpack the following archives: echo " " ${MISSING} fi ## End of shell archive. exit 0 -- Mail submissions (sources or binaries) to . Mail comments to the moderator at . Post requests for sources, and general discussion to comp.sys.amiga.misc.