[783] in athena10

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

Re: /svn/athena r23271 - in trunk/athena/bin: delete discuss/client discuss/dsgrep discuss/edsc discuss/libds discuss/mclient discuss/server

daemon@ATHENA.MIT.EDU (Greg Price)
Wed Jan 7 17:17:35 2009

Date: Wed, 7 Jan 2009 17:16:33 -0500
From: Greg Price <price@MIT.EDU>
To: broder@mit.edu
Cc: Anders Kaseorg <andersk@mit.edu>, athena10@mit.edu
Message-ID: <20090107221633.GX3199@vinegar-pot.mit.edu>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <200901072147.QAA04420@drugstore.mit.edu>

After seeing the change, I agree with Anders' earlier suggestion: this
would be cleaner if you can put in some common header file just the
following.

#if defined(__APPLE__) && defined(__MACH__)
#define initialize_del_error_table()  add_error_table(&et_del_error_table)
#define initialize_disc_error_table() add_error_table(&et_disc_error_table)
#define initialize_dsc_error_table()  add_error_table(&et_dsc_error_table)
#define initialize_krb_error_table()  add_error_table(&et_krb_error_table)
#define initialize_rpc_error_table()  add_error_table(&et_rpc_error_table)
#define initialize_usp_error_table()  add_error_table(&et_usp_error_table)
#endif

That puts the logic in one place and avoids cluttering lots of places in
the code with #ifdefs.  The Linux kernel does this pervasively.

Greg


On Wed, Jan 07, 2009 at 04:47:45PM -0500, broder@MIT.EDU wrote:
> Author: broder
> Date: 2009-01-07 16:47:43 -0500 (Wed, 07 Jan 2009)
> New Revision: 23271
> 
> Modified:
>    trunk/athena/bin/delete/delete.c
>    trunk/athena/bin/delete/expunge.c
>    trunk/athena/bin/delete/lsdel.c
>    trunk/athena/bin/delete/undelete.c
>    trunk/athena/bin/discuss/client/discuss.c
>    trunk/athena/bin/discuss/dsgrep/dsgrep.c
>    trunk/athena/bin/discuss/edsc/edsc.c
>    trunk/athena/bin/discuss/libds/auth_krb.c
>    trunk/athena/bin/discuss/libds/rpcall.c
>    trunk/athena/bin/discuss/mclient/crmtgs.c
>    trunk/athena/bin/discuss/mclient/dsmail.c
>    trunk/athena/bin/discuss/mclient/dspipe.c
>    trunk/athena/bin/discuss/mclient/mkds.c
>    trunk/athena/bin/discuss/mclient/pmtg.c
>    trunk/athena/bin/discuss/server/expunge.c
>    trunk/athena/bin/discuss/server/expunge2.c
>    trunk/athena/bin/discuss/server/recover.c
>    trunk/athena/bin/discuss/server/rpproc.c
> Log:
> Add com_err support for delete and discuss on OS X.
> 
> 
> Modified: trunk/athena/bin/delete/delete.c
> ===================================================================
> --- trunk/athena/bin/delete/delete.c	2009-01-07 21:27:05 UTC (rev 23270)
> +++ trunk/athena/bin/delete/delete.c	2009-01-07 21:47:43 UTC (rev 23271)
> @@ -84,7 +84,11 @@
>       
>       whoami = lastpart(argv[0]);
>  
> +#if defined(__APPLE__) && defined(__MACH__)
> +     add_error_table(&et_del_error_table);
> +#else
>       initialize_del_error_table();
> +#endif
>  
>  #ifdef HAVE_AFS
>       gettimeofday(&tvp[0], (struct timezone *)0);
> 
> Modified: trunk/athena/bin/delete/expunge.c
> ===================================================================
> --- trunk/athena/bin/delete/expunge.c	2009-01-07 21:27:05 UTC (rev 23270)
> +++ trunk/athena/bin/delete/expunge.c	2009-01-07 21:47:43 UTC (rev 23271)
> @@ -60,7 +60,11 @@
>       extern int optind;
>       int arg;
>  
> +#if defined(__APPLE__) && defined(__MACH__)
> +     add_error_table(&et_del_error_table);
> +#else
>       initialize_del_error_table();
> +#endif
>       
>       whoami = lastpart(argv[0]);
>       if (*whoami == 'p') { /* we're doing a purge */
> 
> Modified: trunk/athena/bin/delete/lsdel.c
> ===================================================================
> --- trunk/athena/bin/delete/lsdel.c	2009-01-07 21:27:05 UTC (rev 23270)
> +++ trunk/athena/bin/delete/lsdel.c	2009-01-07 21:47:43 UTC (rev 23271)
> @@ -142,7 +142,11 @@
>       int status = 0;
>       int retval;
>  
> +#if defined(__APPLE__) && defined(__MACH__)
> +     add_error_table(&et_del_error_table);
> +#else
>       initialize_del_error_table();
> +#endif
>       
>       if (retval = initialize_tree()) {
>  	  error("initialize_tree");
> 
> Modified: trunk/athena/bin/delete/undelete.c
> ===================================================================
> --- trunk/athena/bin/delete/undelete.c	2009-01-07 21:27:05 UTC (rev 23270)
> +++ trunk/athena/bin/delete/undelete.c	2009-01-07 21:47:43 UTC (rev 23271)
> @@ -41,7 +41,11 @@
>       int arg;
>       int retval;
>       
> +#if defined(__APPLE__) && defined(__MACH__)
> +     add_error_table(&et_del_error_table);
> +#else
>       initialize_del_error_table();
> +#endif
>       
>       whoami = lastpart(argv[0]);
>       interactive = recursive = verbose = directoriesonly = noop = force = 0;
> 
> Modified: trunk/athena/bin/discuss/client/discuss.c
> ===================================================================
> --- trunk/athena/bin/discuss/client/discuss.c	2009-01-07 21:27:05 UTC (rev 23270)
> +++ trunk/athena/bin/discuss/client/discuss.c	2009-01-07 21:47:43 UTC (rev 23271)
> @@ -154,8 +154,13 @@
>  		ss_perror(sci_idx, code, INFO_DIR);
>  	}
>  
> +#if defined(__APPLE__) && defined(__MACH__)
> +	add_error_table(&et_disc_error_table);
> +	add_error_table(&et_dsc_error_table);
> +#else
>  	initialize_disc_error_table();
>  	initialize_dsc_error_table();
> +#endif
>  
>  	temp_file = malloc(64);
>  	pgm = malloc(64);
> 
> Modified: trunk/athena/bin/discuss/dsgrep/dsgrep.c
> ===================================================================
> --- trunk/athena/bin/discuss/dsgrep/dsgrep.c	2009-01-07 21:27:05 UTC (rev 23270)
> +++ trunk/athena/bin/discuss/dsgrep/dsgrep.c	2009-01-07 21:47:43 UTC (rev 23271)
> @@ -60,7 +60,11 @@
>    int using_dflt_mtgs = 0;
>    struct stat statb;
>    
> +#if defined(__APPLE__) && defined(__MACH__)
> +  add_error_table(&et_dsc_error_table);
> +#else
>    initialize_dsc_error_table();
> +#endif
>  
>    n_to_look = 50;
>    print_trans = 0;
> 
> Modified: trunk/athena/bin/discuss/edsc/edsc.c
> ===================================================================
> --- trunk/athena/bin/discuss/edsc/edsc.c	2009-01-07 21:27:05 UTC (rev 23270)
> +++ trunk/athena/bin/discuss/edsc/edsc.c	2009-01-07 21:47:43 UTC (rev 23271)
> @@ -122,7 +122,11 @@
>       char *cp,*op,delim,*args;
>       struct rlimit limit;
>  
> +#if defined(__APPLE__) && defined(__MACH__)
> +     add_error_table(&et_dsc_error_table);
> +#else
>       initialize_dsc_error_table();
> +#endif
>  
>       temp_file = malloc(64);
>       pgm = malloc(64);
> 
> Modified: trunk/athena/bin/discuss/libds/auth_krb.c
> ===================================================================
> --- trunk/athena/bin/discuss/libds/auth_krb.c	2009-01-07 21:27:05 UTC (rev 23270)
> +++ trunk/athena/bin/discuss/libds/auth_krb.c	2009-01-07 21:47:43 UTC (rev 23271)
> @@ -74,7 +74,11 @@
>  	 exit(1);
>       }
>  
> +#if defined(__APPLE__) && defined(__MACH__)
> +     add_error_table(&et_krb_error_table);
> +#else
>       initialize_krb_error_table();
> +#endif
>  
>       realmp = strchr (service_id, '@');
>       if (realmp == NULL || realmp - service_id >= sizeof (serv)) {
> @@ -131,7 +135,11 @@
>  
>       static KTEXT_ST ticket;
>  
> +#if defined(__APPLE__) && defined(__MACH__)
> +     add_error_table(&et_krb_error_table);
> +#else
>       initialize_krb_error_table();
> +#endif
>  
>       realmp = strchr (service_id, '@');
>       if (realmp == NULL || realmp - service_id >= sizeof (serv)) {
> 
> Modified: trunk/athena/bin/discuss/libds/rpcall.c
> ===================================================================
> --- trunk/athena/bin/discuss/libds/rpcall.c	2009-01-07 21:27:05 UTC (rev 23270)
> +++ trunk/athena/bin/discuss/libds/rpcall.c	2009-01-07 21:47:43 UTC (rev 23271)
> @@ -181,8 +181,13 @@
>   */
>  void init_rpc ()
>  {
> +#if defined(__APPLE__) && defined(__MACH__)
> +    add_error_table(&et_rpc_error_table);
> +    add_error_table(&et_usp_error_table);
> +#else
>      initialize_rpc_error_table();
>      initialize_usp_error_table();
> +#endif
>  }
>  
>  /*
> 
> Modified: trunk/athena/bin/discuss/mclient/crmtgs.c
> ===================================================================
> --- trunk/athena/bin/discuss/mclient/crmtgs.c	2009-01-07 21:27:05 UTC (rev 23270)
> +++ trunk/athena/bin/discuss/mclient/crmtgs.c	2009-01-07 21:47:43 UTC (rev 23271)
> @@ -37,7 +37,11 @@
>  	char **aliasv;
>  	int naliases;
>  	
> +#if defined(__APPLE__) && defined(__MACH__)
> +	add_error_table(&et_dsc_error_table);
> +#else
>  	initialize_dsc_error_table();
> +#endif
>  
>  	dsc_expand_mtg_set(NULL, "*", &set, &n_matches, &code);
>  
> 
> Modified: trunk/athena/bin/discuss/mclient/dsmail.c
> ===================================================================
> --- trunk/athena/bin/discuss/mclient/dsmail.c	2009-01-07 21:27:05 UTC (rev 23270)
> +++ trunk/athena/bin/discuss/mclient/dsmail.c	2009-01-07 21:47:43 UTC (rev 23271)
> @@ -89,7 +89,11 @@
>       int i,ok_prev=0,iscont = 0, have_signature = 0, len, d;
>       char filename[60], signature[35], field_name[100];
>       
> +#if defined(__APPLE__) && defined(__MACH__)
> +     add_error_table(&et_dsc_error_table);
> +#else
>       initialize_dsc_error_table();
> +#endif
>  
>       PRS(argc,argv);				/* Parse args */
>  
> 
> Modified: trunk/athena/bin/discuss/mclient/dspipe.c
> ===================================================================
> --- trunk/athena/bin/discuss/mclient/dspipe.c	2009-01-07 21:27:05 UTC (rev 23270)
> +++ trunk/athena/bin/discuss/mclient/dspipe.c	2009-01-07 21:47:43 UTC (rev 23271)
> @@ -44,7 +44,11 @@
>  	tfile tf;
>  	int i,nread,d,exit_code;
>  
> +#if defined(__APPLE__) && defined(__MACH__)
> +	add_error_table(&et_dsc_error_table);
> +#else
>  	initialize_dsc_error_table();
> +#endif
>  	for (i = 1; i < argc; i++) {
>  		if (*argv[i] == '-')
>  			switch (argv[i][1]) {
> 
> Modified: trunk/athena/bin/discuss/mclient/mkds.c
> ===================================================================
> --- trunk/athena/bin/discuss/mclient/mkds.c	2009-01-07 21:27:05 UTC (rev 23270)
> +++ trunk/athena/bin/discuss/mclient/mkds.c	2009-01-07 21:47:43 UTC (rev 23271)
> @@ -63,7 +63,11 @@
>  	tfile tf;
>  	char hostname[256];
>  
> +#if defined(__APPLE__) && defined(__MACH__)
> +	add_error_table(&et_dsc_error_table);
> +#else
>  	initialize_dsc_error_table();
> +#endif
>  
>  	nbsrc.user_id = malloc(132);
>  
> 
> Modified: trunk/athena/bin/discuss/mclient/pmtg.c
> ===================================================================
> --- trunk/athena/bin/discuss/mclient/pmtg.c	2009-01-07 21:27:05 UTC (rev 23270)
> +++ trunk/athena/bin/discuss/mclient/pmtg.c	2009-01-07 21:47:43 UTC (rev 23271)
> @@ -35,7 +35,11 @@
>  	tfile tfstdout;
>  	char machine [50],mtg_name[100];
>  
> +#if defined(__APPLE__) && defined(__MACH__)
> +	add_error_table(&et_dsc_error_table);
> +#else
>  	initialize_dsc_error_table();
> +#endif
>  	argc--; argv++;
>  	if (argc != 1)
>  		goto lusage;
> 
> Modified: trunk/athena/bin/discuss/server/expunge.c
> ===================================================================
> --- trunk/athena/bin/discuss/server/expunge.c	2009-01-07 21:27:05 UTC (rev 23270)
> +++ trunk/athena/bin/discuss/server/expunge.c	2009-01-07 21:47:43 UTC (rev 23271)
> @@ -72,7 +72,11 @@
>       static struct flock lock;
>  
>  
> +#if defined(__APPLE__) && defined(__MACH__)
> +     add_error_table(&et_dsc_error_table);
> +#else
>       initialize_dsc_error_table();
> +#endif
>  
>       for (i = 1; i < argc; i++) {
>  	  if (*argv[i] == '-') switch (argv[i][1]) {
> 
> Modified: trunk/athena/bin/discuss/server/expunge2.c
> ===================================================================
> --- trunk/athena/bin/discuss/server/expunge2.c	2009-01-07 21:27:05 UTC (rev 23270)
> +++ trunk/athena/bin/discuss/server/expunge2.c	2009-01-07 21:47:43 UTC (rev 23271)
> @@ -55,7 +55,11 @@
>       char control_name[256];
>       int control_fd;
>       
> +#if defined(__APPLE__) && defined(__MACH__)
> +     add_error_table(&et_dsc_error_table);
> +#else
>       initialize_dsc_error_table();
> +#endif
>  
>       for (i = 1; i < argc; i++) {
>  	  if (*argv[i] == '-') switch (argv[i][1]) {
> 
> Modified: trunk/athena/bin/discuss/server/recover.c
> ===================================================================
> --- trunk/athena/bin/discuss/server/recover.c	2009-01-07 21:27:05 UTC (rev 23270)
> +++ trunk/athena/bin/discuss/server/recover.c	2009-01-07 21:47:43 UTC (rev 23271)
> @@ -101,7 +101,11 @@
>       has_privs = TRUE;
>       use_zephyr = 0;
>  
> +#if defined(__APPLE__) && defined(__MACH__)
> +     add_error_table(&et_dsc_error_table);
> +#else
>       initialize_dsc_error_table();
> +#endif
>  
>       for (i = 1; i < argc; i++) {
>  	  if (*argv[i] == '-') switch (argv[i][1]) {
> 
> Modified: trunk/athena/bin/discuss/server/rpproc.c
> ===================================================================
> --- trunk/athena/bin/discuss/server/rpproc.c	2009-01-07 21:27:05 UTC (rev 23270)
> +++ trunk/athena/bin/discuss/server/rpproc.c	2009-01-07 21:47:43 UTC (rev 23271)
> @@ -116,7 +116,11 @@
>      USPCardinal bt;
>  #endif	  
>  
> +#if defined(__APPLE__) && defined(__MACH__)
> +    add_error_table(&et_rpc_error_table);
> +#else
>      initialize_rpc_error_table();
> +#endif
>  
>  #ifdef INETD
>      d = open ("/dev/null", 2);
> 

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