[9722] in Athena Bugs

home help back first fref pref prev next nref lref last post

Re: rsaix 7.4G: pmtg

daemon@ATHENA.MIT.EDU (lwvanels@Athena.MIT.EDU)
Fri Jul 31 13:45:27 1992

From: lwvanels@Athena.MIT.EDU
Date: Fri, 31 Jul 92 13:44:20 -0400
To: bugs@Athena.MIT.EDU
Cc: bug-discuss@Athena.MIT.EDU
Reply-To: lwvanels@MIT.EDU

pmtg was using the old discuss library calls, which was causing it problems.
Here's the patches necessary to make it work with the new calls, and (as an
extra bonus) to be able to print more than one meeting at a time.

*** /source/athena/athena.bin/discuss/mclient/pmtg.c	Sat Jun  3 00:31:59 1989
--- pmtg.c	Fri Jul 31 13:40:29 1992
***************
*** 16,23 ****
  #include <stdio.h>
  #include <string.h>
  
  tfile unix_tfile();
- mtg_info minfo;
  
  #ifndef	lint
  static char rcsid_pmtg_c[] =
--- 16,24 ----
  #include <stdio.h>
  #include <string.h>
  
+ #define MAX_MEETINGS 128
+ 
  tfile unix_tfile();
  
  #ifndef	lint
  static char rcsid_pmtg_c[] =
***************
*** 30,93 ****
  {
  	int result;
  	trn_nums trn;
! 	trn_info tinfo;
  	tfile tfstdout;
! 	char machine [50],mtg_name[100];
  
  	init_dsc_err_tbl();
- 	argc--; argv++;
- 	if (argc != 1)
- 		goto lusage;
- 
- 	resolve_mtg(*argv, machine, mtg_name);
- 
- 	init_rpc();
- 	if (open_rpc (machine, "discuss", &result) == 0) {
- 	     (void) fprintf (stderr, "%s\n", error_message(result));
- 	     exit(1);
- 	}
- 	if (result) {
- 	     (void) fprintf (stderr, "Warning: %s\n", error_message(result));
- 	}
  
! 	get_mtg_info (mtg_name, &minfo, &result);
  	if (result != 0) {
! 		(void) fprintf (stderr, "%s\n", error_message (result));
! 		exit(1);
  	}
  
! 	/* set up stdout tfile */
! 	tfstdout = unix_tfile (1);
! 
! 	trn = minfo.first;
! 	while (trn != 0) {
! 		get_trn_info (mtg_name, trn, &tinfo, &result);
! 		if (result != 0) {
! 			if (result != DELETED_TRN) {
! 				(void) fprintf (stderr, "%s\n",
! 						error_message (result));
! 				exit (1);
! 			}
! 		} else {
! 			write_header (&tinfo, tfstdout);
! 			get_trn (mtg_name, trn, tfstdout, &result);
! 			if (result != 0) {
! 				(void) fprintf (stderr, "%s\n",
! 						error_message(result));
! 				exit (1);
! 			}
! 			write_trailer (&tinfo, tfstdout);
! 		}
! 		trn = tinfo.next;
! 		free (tinfo.author);
! 		free (tinfo.subject);
  	}
- 
  	tdestroy (tfstdout);
- 	term_rpc ();
  	return 0;
! 
!  lusage:
  	(void) fprintf (stderr, "Usage: pmtg {mtg_name}\n");
  	exit (1);
  }
--- 31,118 ----
  {
  	int result;
  	trn_nums trn;
! 	trn_info2 tinfo;
  	tfile tfstdout;
! 	name_blk *meetings,*tmp_mtg;
! 	mtg_info meeting_info[MAX_MEETINGS];
! 	int cur_meeting,n_meetings,i;
  
  	init_dsc_err_tbl();
  
! 	switch (argc) {
! 	case 1:
! 	  goto lusage;
! 	case 2:
! 	  dsc_expand_mtg_set(NULL,argv[1],&meetings,&cur_meeting,&result);
! 	  break;
! 	default:
! 	  meetings = (name_blk *)calloc((unsigned)MAX_MEETINGS,
! 					sizeof(name_blk));
! 	  cur_meeting = 0;
! 	  for(i=1;i<argc;i++) {
! 	    dsc_expand_mtg_set(NULL,argv[i],&tmp_mtg,&n_meetings,&result);
! 	    if ((n_meetings == 0) && (result == 0)) {
! 	      fprintf(stderr,"pmtg: no such meeting %s\n",argv[i]);
! 	      continue;
! 	    }
! 	    if (result != 0) {
! 	      fprintf(stderr,"dsgrep: error expanding meeting %s: %s\n",
! 		      argv[i],error_message(result));
! 	      exit(1);
! 	    }
! 	    bcopy((char *)tmp_mtg, (char *)&meetings[cur_meeting],
! 		  sizeof(name_blk));
! 	    cur_meeting++;
! 	  }
!   }
! 
  	if (result != 0) {
! 	  fprintf(stderr,"pmtg: error expanding meeting %s: %s\n",
! 		  *argv, error_message(result));
! 	  exit(1);
  	}
  
! 	for(i=0;i<cur_meeting;i++) {
! 	  dsc_get_mtg_info(&meetings[i],&meeting_info[i],&result);
! 	  if (result != 0) {
! 	    fprintf(stderr,"pmtg: error getting meeting info for meeting '%s:%s': %s\n",
! 		    meetings[i].hostname, meetings[i].pathname,
! 		    error_message(result));
! 	    exit(1);
! 	  }
! 
! 	  /* set up stdout tfile */
! 	  tfstdout = unix_tfile (1);
! 
! 	  trn = meeting_info[i].first;
! 	  while (trn != 0) {
! 	    dsc_get_trn_info2(&meetings[i],trn,&tinfo,&result);
! 	    if (result != 0) {
! 	      if (result != DELETED_TRN) {
! 		(void) fprintf (stderr, "%s\n",
! 				error_message (result));
! 		exit (1);
! 	      }
! 	    } else {
! 	      write_header (&tinfo, tfstdout,meeting_info[i].long_name);
! 	      dsc_get_trn (&meetings[i], trn, tfstdout, &result);
! 	      if (result != 0) {
! 		(void) fprintf (stderr, "pmtg: error getting transaction %s[%d]: %s\n",
! 				meetings[i].hostname, meetings[i].pathname,
! 				error_message(result));
! 		exit(1);
! 	      }
! 	      write_trailer (&tinfo, tfstdout);
! 	    }
! 	    trn = tinfo.next;
! 	    free (tinfo.author);
! 	    free (tinfo.subject);
! 	  }
  	}
  	tdestroy (tfstdout);
  	return 0;
! 	
!       lusage:
  	(void) fprintf (stderr, "Usage: pmtg {mtg_name}\n");
  	exit (1);
  }
***************
*** 94,102 ****
  
  char *ctime();
  
! write_header(info, tf)
  	trn_info *info;
  	tfile tf;
  {
  	char line [255];
  	char newtime [26];
--- 119,128 ----
  
  char *ctime();
  
! write_header(info, tf, long_name)
  	trn_info *info;
  	tfile tf;
+ 	char *long_name;
  {
  	char line [255];
  	char newtime [26];
***************
*** 112,118 ****
  		plural = "";
       
  	(void) sprintf (line, "[%04d] %s %s %s (%d line%s)\n",
! 			info -> current, info -> author, minfo.long_name,
  			&newtime[4], info -> num_lines, plural);
  	twrite (tf, line, strlen (line),&dummy);
  	if (info -> subject [0] != '\0') {
--- 138,144 ----
  		plural = "";
       
  	(void) sprintf (line, "[%04d] %s %s %s (%d line%s)\n",
! 			info -> current, info -> author, long_name,
  			&newtime[4], info -> num_lines, plural);
  	twrite (tf, line, strlen (line),&dummy);
  	if (info -> subject [0] != '\0') {

home help back first fref pref prev next nref lref last post