home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #19 / NN_1992_19.iso / spool / vmsnet / sources / 356 < prev    next >
Encoding:
Internet Message Format  |  1992-09-04  |  17.5 KB

  1. Path: sparky!uunet!stanford.edu!agate!dog.ee.lbl.gov!network.ucsd.edu!mvb.saic.com!vmsnet-sources
  2. From: munroe@dmc.com (Dick Munroe)
  3. Newsgroups: vmsnet.sources
  4. Subject: VAXNOTES-TO-NEWS V2.2, part 01/01
  5. Message-ID: <8045498@MVB.SAIC.COM>
  6. Date: Fri, 04 Sep 1992 05:44:48 GMT
  7. Organization: Doyle, Munroe Consultants, Inc., Hudson, MA
  8. Lines: 565
  9. Approved: Mark.Berryman@Mvb.Saic.Com
  10.  
  11. Submitted-by: munroe@dmc.com (Dick Munroe)
  12. Posting-number: Volume 3, Issue 161
  13. Archive-name: vaxnotes_to_news/part01
  14.  
  15.          [ This submission provides a utility for converting a file
  16.            that results from a command similar to EXTRACT/ALL/UNSEEN
  17.            into a format suitable for submission to news. ]
  18.  
  19. $! ------------------ CUT HERE -----------------------
  20. $ v='f$verify(f$trnlnm("SHARE_VERIFY"))'
  21. $!
  22. $! This archive created by VMS_SHARE Version 7.2-010  25-Jun-1992
  23. $!   On 26-AUG-1992 09:50:35.67   By user MUNROE 
  24. $!
  25. $! This VMS_SHARE Written by:
  26. $!    Andy Harper, Kings College London UK
  27. $!
  28. $! Acknowledgements to:
  29. $!    James Gray       - Original VMS_SHARE
  30. $!    Michael Bednarek - Original Concept and implementation
  31. $!
  32. $! TO UNPACK THIS SHARE FILE, CONCATENATE ALL PARTS IN ORDER
  33. $! AND EXECUTE AS A COMMAND PROCEDURE  (  @name  )
  34. $!
  35. $! THE FOLLOWING FILE(S) WILL BE CREATED AFTER UNPACKING:
  36. $!       1. AAAREADME.1ST;1
  37. $!       2. CONVERT.C;21
  38. $!
  39. $set="set"
  40. $set symbol/scope=(nolocal,noglobal)
  41. $f=f$parse("SHARE_TEMP","SYS$SCRATCH:.TMP_"+f$getjpi("","PID"))
  42. $e="write sys$error  ""%UNPACK"", "
  43. $w="write sys$output ""%UNPACK"", "
  44. $ if f$trnlnm("SHARE_LOG") then $ w = "!"
  45. $ ve=f$getsyi("version")
  46. $ if ve-f$extract(0,1,ve) .ges. "4.4" then $ goto START
  47. $ e "-E-OLDVER, Must run at least VMS 4.4"
  48. $ v=f$verify(v)
  49. $ exit 44
  50. $UNPACK: SUBROUTINE ! P1=filename, P2=checksum
  51. $ x = P1 - f$parse(P1,,,"version")
  52. $ y = f$search(x)
  53. $ if y .eqs. "" then $ goto file_absent
  54. $ x = f$integer(f$parse(P1,,,"version")-";")
  55. $ y = f$integer(f$parse(y,,,"version")-";")
  56. $ if x .gt. y then $ goto file_absent
  57. $ if f$mode() .eqs. "INTERACTIVE" then $ goto file_interactive
  58. $ if x .eq. y then e "-W-EXISTS, File ''P1' exists. Skipped."
  59. $ if x .ne. y then e "-W-NEWERVERSION, of File ''P1' exists. Skipped."
  60. $file_delete:
  61. $ delete 'f'*
  62. $ exit
  63. $file_interactive:
  64. $ if x .eq. y then e "-W-EXISTS, File ''P1' exists."
  65. $ if x .ne. y then e "-W-NEWERVERSION, of File ''P1' exists."
  66. $ read/error=file_delete/end=file_delete-
  67.   /prompt="Create new version [y/n]: " -
  68.   sys$command x
  69. $ if .not. x then $ e "-W-SKIPPED, File ''P1' skipped."
  70. $ if .not. x then $ goto file_delete
  71. $ P1 = P1 - f$parse(P1,,,"version")
  72. $file_absent:
  73. $ if f$parse(P1) .nes. "" then $ goto dirok
  74. $ dn=f$parse(P1,,,"DIRECTORY")
  75. $ w "-I-CREDIR, Creating directory ''dn'."
  76. $ create/dir 'dn'
  77. $ if $status then $ goto dirok
  78. $ e "-E-CREDIRFAIL, Unable to create ''dn'. File skipped."
  79. $ delete 'f'*
  80. $ exit
  81. $dirok:
  82. $ w "-I-PROCESS, Processing file ''P1'."
  83. $ if .not. f$verify() then $ define/user sys$output nl:
  84. $ EDIT/TPU/NOSEC/NODIS/COM=SYS$INPUT 'f'/OUT='P1'
  85. PROCEDURE Unpacker ON_ERROR ENDON_ERROR;SET(FACILITY_NAME,"UNPACK");SET(
  86. SUCCESS,OFF);SET(INFORMATIONAL,OFF);f:=GET_INFO(COMMAND_LINE,"file_name");b:=
  87. CREATE_BUFFER(f,f);p:=SPAN(" ")@r&LINE_END;POSITION(BEGINNING_OF(b));
  88. LOOP EXITIF SEARCH(p,FORWARD)=0;POSITION(r);ERASE(r);ENDLOOP;POSITION(
  89. BEGINNING_OF(b));g:=0;LOOP EXITIF MARK(NONE)=END_OF(b);x:=ERASE_CHARACTER(1);
  90. IF g=0 THEN IF x="X" THEN MOVE_VERTICAL(1);ENDIF;IF x="V" THEN APPEND_LINE;
  91. MOVE_HORIZONTAL(-CURRENT_OFFSET);MOVE_VERTICAL(1);ENDIF;IF x="+" THEN g:=1;
  92. ERASE_LINE;ENDIF;ELSE IF x="-" THEN IF INDEX(CURRENT_LINE,"+-+-+-+-+-+-+-+")=
  93. 1 THEN g:=0;ENDIF;ENDIF;ERASE_LINE;ENDIF;ENDLOOP;t:="0123456789ABCDEF";
  94. POSITION(BEGINNING_OF(b));LOOP r:=SEARCH("`",FORWARD);EXITIF r=0;POSITION(r);
  95. ERASE(r);x1:=INDEX(t,ERASE_CHARACTER(1))-1;x2:=INDEX(t,ERASE_CHARACTER(1))-1;
  96. COPY_TEXT(ASCII(16*x1+x2));ENDLOOP;WRITE_FILE(b,GET_INFO(COMMAND_LINE,
  97. "output_file"));ENDPROCEDURE;Unpacker;QUIT;
  98. $ delete/nolog 'f'*
  99. $ CHECKSUM 'P1'
  100. $ IF CHECKSUM$CHECKSUM .eqs. P2 THEN $ EXIT
  101. $ e "-E-CHKSMFAIL, Checksum of ''P1' failed."
  102. $ ENDSUBROUTINE
  103. $START:
  104. $ create 'f'
  105. XVAXNOTES-TO-NEWS V2.2
  106. X
  107. XBasically works the same way, but it can `5Boptionally`5D consume files sent
  108. V via
  109. Xinternet mail.  It ignores the headers.  It also is more robust in the face
  110. V of
  111. Xsome of the vagaries I've seen in the output of NOTES EXTRACT/UNSEEN.
  112. X
  113. XI'm currently using it to gateway the ISVNET notes files into newsgroups and
  114. V it
  115. Xworks great for that application.
  116. X
  117. XIf you have any questions contact me.
  118. X
  119. XIf you spot any bugs or make fixes, be a sport and let me know so I can keep
  120. Xthings up to date.
  121. X
  122. XDick Munroe
  123. XDoyle, Munroe Consultants, Inc.
  124. X267 Cox St.
  125. XHudson, Ma. 01749
  126. X(508) 568-1618
  127. X(FAX) (508) 562-1133
  128. Xmunroe@dmc.com
  129. $ CALL UNPACK AAAREADME.1ST;1 1209160627
  130. $ create 'f'
  131. X/*`20
  132. X *                        COPYRIGHT (c) 1990 BY
  133. V                             *
  134. X *                MITECH CORPORATION, CONCORD, MASSACHUSETTS.
  135. V               *
  136. X *`09`09`09   ALL RIGHTS RESERVED                              *
  137. X *
  138. X * Copyright 1992 by Dick Munroe, All rights reserved.
  139. X *                   Doyle, Munroe Consultants, Inc.
  140. X *                   267 Cox St.
  141. X *                   Hudson, Ma. 01749
  142. X *
  143. XPermission to use, copy, modify, distribute and sell this software and
  144. Xits documentation for any purpose and without fee is hereby granted,
  145. Xprovided that the above copyright notice appear in all copies and that
  146. Xboth that copyright notice and this permission notice appear in
  147. Xsupporting documentation, and that the name of Mitech Corporation not
  148. Xbe used in advertising or publicity pertaining to distribution of the
  149. Xsoftware without specific, written prior permission.
  150. X
  151. XMITECH DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
  152. XALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
  153. XMITECH BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
  154. XANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
  155. XWHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
  156. XARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
  157. XSOFTWARE.
  158. X
  159. XThe above applies to Doyle, Munroe Consultants, Inc. as well.
  160. X
  161. XProgram: Notesconvert
  162. XPurpose: Convert a file generated by VAX NOTES using a command
  163. X         such as EXTRACT/ALL/UNSEEN XYZ.NOTES-DATA
  164. X         into a file suitable for usenet format news processing.
  165. X         e.g. by ANU-NEWS using a command such as
  166. X         $ NEWS/NOSCREEN ADD FILE/NETFEED XYZ.NEWS-DATA
  167. XCreated: 18-DEC-1990
  168. XAuthor:  George Carrette, GJC@MITECH.COM
  169. XVersion: 1.0
  170. X         1.1 Added msg_note_major msg_note_minor, id and references, subj cl
  171. Vean
  172. X
  173. XAuthor: Dick Munroe <munroe@dmc.com>
  174. XVersion: 2.0
  175. X`09 Rig this thing to be able to deal with messages containing notes
  176. X`09 messages.
  177. X
  178. XVersion: 2.1
  179. X`09 Apparently Notes doesn't consider blank lines trailing a note to be
  180. X`09 part of the note.
  181. X
  182. XVersion: 2.2
  183. X`09 Occasionally Notes OVERcounts the size of a note as well.  Rig the code
  184. X`09 to check for this case and scan for the next art header.  This may
  185. X`09 occasionally wind up with a bogus note entered (for example, when notes
  186. X`09 are posted to notes AND the count gets off) but there won't be THAT
  187. X`09 many of these.
  188. X
  189. X`09 Occaisionally Notes puts a blank line in BEFORE the header which
  190. X`09 specifies the source of the notes.  Skip blank lines before getting to
  191. X`09 the sources of the notes.
  192. X
  193. X`09 Occaisionally Notes breaks the topic header following the note title.
  194. X`09 I'm going to take advantage of the fact that all item header lines
  195. X`09 should be at LEAST 80 characters in length to fix this.
  196. X*/
  197. X
  198. X#include <stdio.h>
  199. X#include <ctype.h>
  200. X#include <errno.h>
  201. X
  202. Xchar *newsgroup_name;
  203. Xchar *newsgroup_prefix = "dmc.isvnet.";
  204. X
  205. Xchar *art_header;
  206. Xchar *art_sep;
  207. X
  208. Xlong header_size = 80;
  209. Xlong buffn = 1024;
  210. X
  211. Xchar *inbuff;
  212. Xchar *msg_subj;
  213. Xchar *msg_subj_sub;
  214. Xchar *outbuff;
  215. Xlong msg_note_major;
  216. Xlong msg_note_minor;
  217. Xchar *msg_id;
  218. X
  219. Xlong msg_nlines;
  220. Xchar *msg_from;
  221. Xchar *msg_date;
  222. X
  223. Xchar *output_buffer = NULL;
  224. Xlong output_buffn = 0;
  225. Xlong output_nchars = 0;
  226. X
  227. Xchar *output_pointer;
  228. X
  229. Xoutput_reset()
  230. X`7Boutput_pointer = output_buffer;
  231. X output_nchars = 0;`7D
  232. X
  233. Xoutput_flush(to)
  234. X     FILE *to;
  235. X`7Bfwrite(output_buffer,output_nchars,1,to);
  236. X output_reset();`7D
  237. X
  238. Xoutput(line)
  239. X     char *line;
  240. X`7Blong n;
  241. X n = strlen(line);
  242. X if ((n + output_nchars) >= output_buffn)
  243. X   `7Boutput_buffn *= 2;
  244. X    output_buffn += buffn;
  245. X    if (n > output_buffn) output_buffn = n;
  246. X    if (output_buffer == NULL)
  247. X      output_buffer = (char *) malloc(output_buffn);
  248. X    else
  249. X      output_buffer = (char *) realloc(output_buffer,output_buffn);
  250. X    output_pointer = output_buffer + output_nchars;`7D
  251. X memcpy(output_pointer,line,n);
  252. X output_nchars += n;
  253. X output_pointer += n;`7D
  254. X
  255. Xchar *make_header(x)
  256. X     int x;
  257. X`7Bchar *p;
  258. X p = (char *) malloc(header_size + 2);
  259. X p`5Bheader_size`5D = '\n';
  260. X p`5Bheader_size+1`5D = 0;
  261. X memset(p,x,header_size);
  262. X return(p);`7D
  263. X
  264. Xmain(argc,argv)
  265. X     int argc;
  266. X     char **argv;
  267. X`7BFILE *in,*out;
  268. X char *p,*p1,*p2;
  269. X long j;
  270. X fpos_t filePosition, headerPosition ;
  271. X int headerPositionValid = 0 ;
  272. X`20
  273. X if (argc < 3)
  274. X   `7Bfprintf(stderr,"%%NOTESCONVERT-F-ARGS wrong number of arguments\n");
  275. X    p = strrchr(argv`5B0`5D,'`5D');
  276. X    fprintf(stderr,"%s <input-file> <output-file> `5B-m`5D\n",
  277. X`09    (p) ? p+1 : "notesconvert");
  278. X    exit(44);`7D
  279. X if (!(in = fopen(argv`5B1`5D,"r")))
  280. X   `7Bperror(argv`5B1`5D);
  281. X    exit(vaxc$errno);`7D
  282. X if (!(out = fopen(argv`5B2`5D,"w")))
  283. X   `7Bperror(argv`5B2`5D);
  284. X    exit(vaxc$errno);`7D
  285. X inbuff = (char *) malloc(buffn);
  286. X outbuff = (char *) malloc(buffn);
  287. X msg_subj = (char *) malloc(buffn);
  288. X msg_subj_sub = (char *) malloc(buffn);
  289. X msg_from = (char *) malloc(buffn);
  290. X msg_date = (char *) malloc(buffn);
  291. X msg_id = (char *) malloc(buffn);
  292. X art_header = make_header('=');
  293. X art_sep = make_header('-');
  294. X
  295. X /*
  296. X ** Skip the message header, if requested.
  297. X */
  298. X`20
  299. X if (argc > 3)
  300. X `7B
  301. X  for (p1 = fgets(inbuff,buffn,in);
  302. X       ((p1 != NULL) && (*p1 != '\n'));
  303. X       p1 = fgets(inbuff,buffn,in))
  304. X  `7B
  305. X  `7D ;
  306. X  if (!p1)
  307. X  `7B
  308. X    fprintf(stderr,"%%NOTESCONVERT-F-BAD no header line\n");
  309. X    exit(44);
  310. X  `7D ;
  311. X `7D ;
  312. X`20
  313. X /*
  314. X ** Skip over blank lines while getting to the notes header.
  315. X */
  316. X`20
  317. X for (p1 = fgets(inbuff,buffn,in);
  318. X      ((p1 != NULL) && (*p1 == '\n'));
  319. X      p1 = fgets(inbuff,buffn,in))
  320. X `7B
  321. X `7D ;
  322. X
  323. X if (!p1)
  324. X `7B
  325. X  fprintf(stderr,"%%NOTESCONVERT-F-BAD no header line\n");
  326. X  exit(44);
  327. X `7D ;
  328. X
  329. X p1 = strrchr(inbuff,'`5D');
  330. X ++p1;
  331. X p2 = strchr(p1,'.');
  332. X if (!p2)
  333. X   `7Bfprintf(stderr,"%%NOTESCONVERT-F-BAD bad header line\n");
  334. X    exit(44);`7D
  335. X *p2 = 0;
  336. X newsgroup_name = (char *) malloc(strlen(newsgroup_prefix) +
  337. X`09`09`09`09  strlen(p1) + 1);
  338. X strcpy(newsgroup_name,newsgroup_prefix);
  339. X strcat(newsgroup_name,p1);
  340. X fprintf(stderr,"Newsgroups: %s\n",newsgroup_name);
  341. X fgets(inbuff,buffn,in);
  342. X while(1)
  343. X  `7B
  344. X    fgetpos(in, &filePosition) ;`09`09`09/* Get the current file position.`0
  345. V9`09`09`09`09  */
  346. X    p = fgets(inbuff,buffn,in);
  347. X    if ((!p) `7C`7C (*p == 0))
  348. X      `7Bfprintf(stderr,"%%NOTESCONVERT-I-END end of file\n");
  349. X       fclose(out);
  350. X       exit(1);`7D
  351. X    if ((inbuff`5B0`5D == '\f') && (inbuff`5B1`5D == '\n') && (inbuff`5B2`5D
  352. V == 0))
  353. X      continue;`09`09`09`09`09`09/* The line consists of exactly <ff><nl> so
  354. V ignore it.`09`09`09*/
  355. X    if ((inbuff`5B0`5D == '\n') && (inbuff`5B1`5D == 0))
  356. X      continue ;`09`09`09`09`09/* The line consists of exactly <nl>.  I've s
  357. Veen cases where notes`09*/
  358. X`09`09`09`09`09`09`09/* doesn't count blank lines which trail the end of a n
  359. Vote.  This takes`09*/
  360. X`09`09`09`09`09`09`09/* care of that case.`09`09`09`09`09`09`09*/
  361. X    if (strcmp(inbuff,art_header) != 0)
  362. X    `7B
  363. X      if (headerPositionValid == 0)
  364. X      `7B
  365. X`09/*
  366. X`09** The header position is not valid, no recovery is possible at this
  367. X`09** time.
  368. X`09*/
  369. X`09
  370. X`09fprintf(stderr,"%%NOTESCONVERT-F-BAD item header not found\n");
  371. X`09fclose(out);
  372. X`09exit(44);
  373. X      `7D ;
  374. X
  375. X      if (fsetpos (in, &headerPosition) != 0)
  376. X      `7B
  377. X`09fprintf(stderr,"%%NOTESCONVERT-F-BAD item header not found, setpos failed
  378. V\n");
  379. X`09fclose(out);
  380. X`09exit(44);
  381. X      `7D ;
  382. X
  383. X      /*
  384. X      ** The following loop terminates if end of file (the error occurred on
  385. V the
  386. X      ** last note in the batch) or the beginning of the next note in the fi
  387. Vle
  388. X      ** is detected.  Note that this can result in the occasional bogus not
  389. Ve
  390. X      ** being posted IF a counting error occurs AND the contents of the not
  391. Ve
  392. X      ** was another note.  On the other hand, this isn't all that common.
  393. X      */
  394. X     `20
  395. X      fprintf(stderr,"%%NOTESCONVERT-I-BAD item header not found, scanning f
  396. Vor item header\n");
  397. X      for (j = 0 ;  j < 2 ;)
  398. X      `7B
  399. X`09fgetpos (in, &filePosition) ;
  400. X`09p = fgets(inbuff,buffn,in);
  401. X`09if ((!p) `7C`7C (*p == 0))
  402. X`09`7B
  403. X`09  fprintf(stderr,"%%NOTESCONVERT-I-END end of file\n");
  404. X`09  fclose(out);
  405. X`09  exit(1);
  406. X`09`7D ;
  407. X`09if (strcmp(inbuff,art_header) == 0)
  408. X`09`7B
  409. X`09  j++ ;
  410. X`09`7D ;
  411. X      `7D ;
  412. X    `7D ;
  413. X   `20
  414. X    headerPosition = filePosition ;`09`09`09/* Note the position of the head
  415. Ver of the current note.`09`09`09*/
  416. X    headerPositionValid = 1 ;`09`09`09`09/* Note the header position data st
  417. Vructure is now valid.`09`09*/
  418. X
  419. X    fgets(inbuff,buffn,in) ;
  420. X    if ((j = strlen (inbuff)) < 80)
  421. X    `7B
  422. X      inbuff`5Bj-1`5D = ' ' ;
  423. X      fgets(&inbuff`5Bj`5D ,buffn- j, in) ;`09`09`09/* For short message hea
  424. Vder lines, get the next one, assuming that notes  */
  425. X`09`09`09`09`09`09`09/* has made a mistake or the user has embedded somethin
  426. Vg like a carriage  */
  427. X`09`09`09`09`09`09`09/* return in the title.`09`09`09`09`09`09`09  */
  428. X    `7D ;
  429. X
  430. X    extract_msg_subject(inbuff);
  431. X    extract_msg_info(fgets(inbuff,buffn,in));
  432. X    msg_subj_sub`5B0`5D = 0;
  433. X    while(fgets(inbuff,buffn,in))
  434. X      `7Bif (strcmp(inbuff,art_sep) == 0)
  435. X`09 break;
  436. X       else
  437. X`09 extract_msg_subj_sub(inbuff);`7D
  438. X    sprintf(outbuff,"From: %s\n",msg_from);
  439. X    output(outbuff);
  440. X    sprintf(outbuff,"Newsgroups: %s\n",newsgroup_name);
  441. X    output(outbuff);
  442. X    sprintf(outbuff,"Subject: `5B%d.%d`5D %s\n",
  443. X`09    msg_note_major,
  444. X`09    msg_note_minor,
  445. X`09    (msg_subj_sub`5B0`5D == 0) ? msg_subj : msg_subj_sub);
  446. X    output(outbuff);   `20
  447. X    set_msg_id(msg_note_major,msg_note_minor);
  448. X    sprintf(outbuff,"Message-ID: <%s>\n",msg_id);
  449. X    output(outbuff);
  450. X    sprintf(outbuff,"Date: %s\n",msg_date);
  451. X    output(outbuff);
  452. X    if (msg_note_minor != 0)
  453. X      `7Bset_msg_id(msg_note_major,0);
  454. X       sprintf(outbuff,"References: <%s>\n",msg_id);
  455. X       output(outbuff);`7D
  456. X    sprintf(outbuff,"Lines: %d\n",msg_nlines+1);
  457. X    output(outbuff);
  458. X    output("\n");
  459. X    for(j=0;j<msg_nlines;++j)
  460. X      `7Bfgets(inbuff,buffn,in);
  461. X       output(inbuff);`7D
  462. X    if (output_buffer`5Boutput_nchars-1`5D != '\n')
  463. X      output("\n");
  464. X    if (strcmp(msg_subj,"Reserved") == 0)
  465. X      output_reset();
  466. X    else
  467. X      `7Bfprintf(out,"#! rnews %d\n",output_nchars);
  468. X       output_flush(out);`7D`7D`7D
  469. X
  470. Xchar *msg_note_prefix = "Note ";
  471. Xchar *msg_note_postfix1 = "No replies";
  472. X
  473. Xextract_msg_subject(line)
  474. X     char *line;
  475. X`7Bchar *l,*p1,*p2;
  476. X long n;
  477. X if (!line)
  478. X   `7Bstrcpy(msg_subj,"UNKNOWN");
  479. X    msg_note_major = 0;
  480. X    msg_note_minor = 0;
  481. X    return;`7D
  482. X n = strlen(msg_note_prefix);
  483. X if (memcmp(line,msg_note_prefix,n) == 0)
  484. X   `7Bp1 = line + n;
  485. X    while(*p1 == ' ') ++p1;
  486. X    p2 = strchr(p1,' ');
  487. X    *p2 = 0;
  488. X    sscanf(p1,"%d.%d",&msg_note_major,&msg_note_minor);
  489. X    l = p2+1;`7D
  490. X else
  491. X   `7Bmsg_note_major = 0;
  492. X    msg_note_minor = 0;
  493. X    l = line;`7D
  494. X while(*l == ' ') ++l;
  495. X n = strlen(l);
  496. X p1 = l + n - 1;
  497. X if (*p1 == '\n') *p1-- = 0;
  498. X n = strlen(msg_note_postfix1);
  499. X if (memcmp(p1 - n + 1,msg_note_postfix1,n) == 0)
  500. X   p1 -= n;
  501. X else
  502. X   `7Bif (isdigit(*p1))
  503. X      while(isdigit(*p1)) *p1-- = 0;
  504. X    while(!isdigit(*p1)) *p1-- = 0;
  505. X    while(isdigit(*p1)) *p1-- = 0;`7D
  506. X while(*p1 == ' ') *p1-- = 0;
  507. X strcpy(msg_subj,l);`7D
  508. X
  509. Xextract_msg_info(line)
  510. X     char *line;
  511. X`7Bchar *p1,*p2,*p3;
  512. X long factor;
  513. X if (!line)
  514. X   `7Bmsg_nlines = 0;
  515. X    strcpy(msg_from,"UNKNOWN");
  516. X    strcpy(msg_date,"UNKNOWN");
  517. X    return;`7D
  518. X p1 = line + 61;
  519. X p2 = p1;
  520. X while(*p2 == ' ') ++p2;
  521. X if (p3 = strchr(p2,'\n')) *p3 = 0;
  522. X strcpy(msg_date,p2);
  523. X while(!isdigit(*p1)) --p1;
  524. X msg_nlines = 0;
  525. X factor = 1;
  526. X while(isdigit(*p1))
  527. X   `7Bmsg_nlines = msg_nlines + (factor * (*p1 - '0'));
  528. X    factor *= 10;
  529. X    --p1;`7D
  530. X while(*p1 == ' ') --p1;
  531. X *(p1+1) = 0;
  532. X strcpy(msg_from,line);`7D
  533. X
  534. X
  535. Xextract_msg_subj_sub(line)
  536. X     char *line;
  537. X`7Bchar *p,*p1;
  538. X long n;
  539. X if (!(p = strchr(line,'-'))) return;
  540. X if (p`5B1`5D != '<') return;
  541. X p += 2;
  542. X while(*p == ' ') ++p;
  543. X n = strlen(p);
  544. X p1 = p + n - 1;
  545. X while((*p1 == ' ') `7C`7C (*p1 == '\n')) *p1-- = 0;
  546. X if (*p1 != '-') return;
  547. X *p1-- = 0;
  548. X if (*p1 != '>') return;
  549. X *p1-- = 0;
  550. X while(*p1 == ' ') *p1-- = 0;
  551. X strcpy(msg_subj_sub,p);`7D
  552. X
  553. X
  554. Xset_msg_id(major,minor)
  555. X     long major,minor;
  556. X`7Bsprintf(msg_id,"%d.%d.%s@dmc.com",
  557. X`09 major,minor,
  558. X`09 newsgroup_name);`7D
  559. $ CALL UNPACK CONVERT.C;21 1798617680
  560. $ v=f$verify(v)
  561. $ EXIT
  562. -- 
  563. Dick Munroe                Internet: munroe@dmc.com
  564. Doyle Munroe Consultants, Inc.        UUCP: ...uunet!thehulk!munroe
  565. 267 Cox St.                Office: (508) 568-1618
  566. Hudson, Ma.                FAX: (508) 562-1133
  567.  
  568. GET CONNECTED!!! Send mail to info@dmc.com to find out about DMConnection.
  569. --
  570. Dick Munroe                Internet: munroe@dmc.com
  571. Doyle Munroe Consultants, Inc.        UUCP: ...uunet!thehulk!munroe
  572. 267 Cox St.                Office: (508) 568-1618
  573. Hudson, Ma. 01749 USA            FAX: (508) 562-1133
  574.  
  575. GET CONNECTED!!! Send mail to info@dmc.com to find out about DMConnection.
  576.