🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: news.software.nn
Article #2247

Simple shar post frontend to 'nnpost'

#2247
From: Gunnar Forsgren
Date: Thu, 14 Nov 1991 16:00
156 lines
5142 bytes
#!/bin/sh
# This is a shell archive (produced by shar 3.49)
# To extract the files from this archive, save it to a file, remove
# everything above the "!/bin/sh" line above, and type "sh file_name".
#
# made 11/14/1991 16:13 UTC by gunnar@falcon
#
# existing files will NOT be overwritten unless -c is specified
#
# This shar contains:
# length  mode       name
# ------ ---------- ------------------------------------------
#   1072 -rw-r--r-- README
#   1869 -rw-r--r-- postpart.c
#
# ============= README ==============
if test -f 'README' -a X"$1" != X"-c"; then
	echo 'x - skipping README (File already exists)'
else
echo 'x - extracting README (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'README' &&
This is a simple 'frontend' to 'nnpost'.
X
Do  'cc postpart.c -o pp'
X
to compile into program 'pp'.
X
Should work on all systems that has successfully installed
'nnpost' (I think).
X
I have only tried it on Sun4 systems.
X
Do what you want with the code, but don't blame me if
you do some unpredicted mistake and post garbage somewhere.
Comment away line 84 that does the 'nnpost' call and try
it to just display text first if you want to be sure
it works OK for you. 
X
'pp' will prompt for parameters, or takes them from
arguments if given.
X
I have used it to post shell archive parts generated by
'shar 3.49' which generates parts in the form 'name.nn'
where 'nn' is a number 01-99.
X
______________________________________________________________________
Gunnar Forsgren                   |  E-mail: gunnar@beppe.ericsson.se
Ericsson Telecom AB  VB/ETX/TM/FM |  Phone.: +46 8 719 61 18
Standard Computer Systems         |  Fax...: +46 8 719 29 00
S-126 25 Stockholm, SWEDEN        |  Memo..: ETX.ETXGFN
__________________________________|___________________________________
SHAR_EOF
chmod 0644 README ||
echo 'restore of README failed'
Wc_c="`wc -c < 'README'`"
test 1072 -eq "$Wc_c" ||
	echo 'README: original size 1072, current size' "$Wc_c"
fi
# ============= postpart.c ==============
if test -f 'postpart.c' -a X"$1" != X"-c"; then
	echo 'x - skipping postpart.c (File already exists)'
else
echo 'x - extracting postpart.c (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'postpart.c' &&
#include <stdio.h>
X
/* This C program is a simple 'frontend' to 'nnpost' that
X   sends shell archive parts of the form xxxx.nn
X   Where nn is a part number '.01, .02, .03....09,10,11,etc)
X   that has been created with the 'shar' archiver.
X
X   The is a public domain program, and no responsibility
X   is assumed for maintenance or any damage caused by
X   using it.
X
X   Gunnar Forsgren  <gunnar@beppe.ericsson.se>      */
X
main( argc,argv)
int argc;
char **argv;
{
X char com [80], xdest[40], xdist[20], xsubj[60], xfile[30];
X int n,res,xparts,xdelay;
if (argc < 2) {
X  system("clear");
X  printf("\n%s\n",
X    "POSTPART, Posts shar archive parts to a newsgroup.\n");
}
if (argc >= 2) {
X  xparts = atoi(argv[1]);
}
else {
X  printf("Number of parts to send........: ");
X  scanf("%d",&xparts);
}
X
fflush(stdin);
if (argc >= 3)
X  strcpy(xfile,argv[2]);
else {
X  printf("Name of file parts.............: ");
X  gets(xfile);
}
X
if (argc >=4) {
X  xdelay = atoi(argv[3]);
}
else {
X  printf("Delay (seconds) between parts..: ");
X  scanf("%d",&xdelay);
}
X
fflush(stdin);
if (argc >=5)
X  strcpy(xdest,argv[4]);
else {
X  printf("Newsgroup(s)...................: ");
X  gets(xdest);
}
fflush(stdin);
if (argc >=6)
X  strcpy(xdist,argv[5]);
else {
X  printf("Distribution...................: ");
X  gets(xdist);
}
X
if (argc >=7)
X  strcpy(xsubj,argv[6]);
else {
X  printf("Subject........................: ");
X  gets(xsubj);
}
X if (argc < 8) 
X   printf("\n");
X for (n=1; n <= xparts; n++) {
X   sprintf(com,"nnpost -d %s -s %c%s, part %d(%d)%c -f %s.%.2d -p %s",xdist,0x22,xsubj,n,xparts,0x22,xfile,n,xdest);
X   if (argc < 8) 
X     printf ("Command = %s\n",com);
X   system(com);
X   if (n < xparts) {
X     if (argc < 8) 
X       printf("Part %d(%d) posted, sleeping %d seconds..\n",n,xparts,xdelay);
X     sleep(xdelay);
X   }
X }
X printf("\n'%s' - posting of shar parts completed.\n\n",argv[0]);
}
SHAR_EOF
chmod 0644 postpart.c ||
echo 'restore of postpart.c failed'
Wc_c="`wc -c < 'postpart.c'`"
test 1869 -eq "$Wc_c" ||
	echo 'postpart.c: original size 1869, current size' "$Wc_c"
fi
exit 0
Technical Details
Message-ID: <gunnar.690134441@falcon>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!archive!mbox2nntp-news.software.nn.mbox.zip!gmdzi!ieee.org!dorm.rutgers.edu!rutgers!cs.utexas.edu!swrinde!gatech!bloom-beacon!eru!hagbard!sunic!seunet!sics.se!eua.ericsson.se!ericom!falcon!gunnar

Show Full Headers
Complete Article Headers
Message-ID: <gunnar.690134441@falcon>
Subject: Simple shar post frontend to 'nnpost'
Date: Thu, 14 Nov 1991 16:00:41 +0000
From: gunnar@falcon.ericsson.se (Gunnar Forsgren)
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!archive!mbox2nntp-news.software.nn.mbox.zip!gmdzi!ieee.org!dorm.rutgers.edu!rutgers!cs.utexas.edu!swrinde!gatech!bloom-beacon!eru!hagbard!sunic!seunet!sics.se!eua.ericsson.se!ericom!falcon!gunnar
Newsgroups: news.software.nn
Sender: news@ericsson.se
Organization: Ericsson
Lines: 156
Nntp-Posting-Host: falcon.ericsson.se