Hi, I prepared a patch which adds a -b option which prevents irattach from forking to the background. I also added corresponding information to the README and man-irattach-inc.sgml [1].
Regards, Tino [1] The changes in the sgml file have no effect since the irattach.8.gz file won't be rebuilt if I do a dpkg-buildpackage, I opened another bug for this.
diff -ru irda-utils-0.9.16.orig/irattach/irattach.c irda-utils-0.9.16/irattach/irattach.c --- irda-utils-0.9.16.orig/irattach/irattach.c 2003-11-13 15:55:09.000000000 +0100 +++ irda-utils-0.9.16/irattach/irattach.c 2005-10-15 00:15:59.000000000 +0200 @@ -239,7 +239,7 @@ static void print_usage(void) { int i; - fprintf(stderr, "Usage: irattach <dev> [-d dongle] [-s] [-v] [-h]\n"); + fprintf(stderr, "Usage: irattach <dev> [-d dongle] [-s] [-b] [-v] [-h]\n"); fprintf(stderr, " <dev> is tty name, device name or module name\n"); fprintf(stderr, "Dongles supported :\n"); for (i = 0; dongle_list[i].dongle != NULL; i++) @@ -658,6 +658,7 @@ int discovery = -1; /* True if discovery requested */ int c; int ret; + int daemonize = 1; /* Go to background by default */ //printf("%s\n", VERSION); if ((argc < 2) || (argc > 5)) { @@ -673,7 +674,7 @@ /* Look for options */ /* Do this before processing device, to handle "-h" and -v" * properly. Jean II */ - while ((c = getopt(argc, argv, "d:hsv")) != -1) { + while ((c = getopt(argc, argv, "d:hsvb")) != -1) { switch (c) { case 's': /* User wants to start discovery */ @@ -694,6 +695,10 @@ case 'h': print_usage(); exit(0); + case 'b': + /* Do not fork to background */ + daemonize = 0; + break; default: print_usage(); exit(-1); @@ -725,8 +730,10 @@ } } - /* Go as a background daemon */ - fork_now(devfd); + if(daemonize) { + /* Go as a background daemon */ + fork_now(devfd); + } /* --- Deamon mode --- */ /* We can no longer print out directly to the terminal, we diff -ru irda-utils-0.9.16.orig/irattach/README irda-utils-0.9.16/irattach/README --- irda-utils-0.9.16.orig/irattach/README 2003-11-13 15:55:09.000000000 +0100 +++ irda-utils-0.9.16/irattach/README 2005-10-15 00:32:33.000000000 +0200 @@ -24,12 +24,13 @@ irattach must be run as root or installed setuid root, as it requires root privileges -Usage: irattach <dev> [-d dongle] [-s] +Usage: irattach <dev> [-d dongle] [-s] [-b] where <dev> usually the name of a tty, but can also be a FIR device -d dongle attaches a dongle driver (see below for more info) -s starts discovery of remote IrDA devices + -b do not fork to background Dongles: diff -ru irda-utils-0.9.16.orig/man/man-irattach-inc.sgml irda-utils-0.9.16/man/man-irattach-inc.sgml --- irda-utils-0.9.16.orig/man/man-irattach-inc.sgml 2003-11-13 15:55:09.000000000 +0100 +++ irda-utils-0.9.16/man/man-irattach-inc.sgml 2005-10-15 00:35:26.000000000 +0200 @@ -23,6 +23,7 @@ <ARG><REPLACEABLE>-s</REPLACEABLE></ARG> <ARG><REPLACEABLE>-d dongle</REPLACEABLE></ARG> <ARG><REPLACEABLE>-v</REPLACEABLE></ARG> + <ARG><REPLACEABLE>-b</REPLACEABLE></ARG> <ARG><REPLACEABLE>-h</REPLACEABLE></ARG> </CMDSYNOPSIS> </REFSYNOPSISDIV> @@ -136,6 +137,10 @@ </PARA> <PARA> +<OPTION>-b</OPTION> : do not fork to background +</PARA> + +<PARA> <OPTION>-h</OPTION> : shows help information. </PARA>