tags 198840 + patch thanks On Thu, 26 Jun 2003, Guus Sliepen wrote: > On Thu, Jun 26, 2003 at 04:27:45AM +0200, Marc Lehmann wrote: > > 1. rsh ignores it's name: > > > > ln -s /usr/bin/rsh ahostname > > ./ahostname > > ahostname: No host specified! > > > > this is a major showstopper for many people around me. > > Hm, I never knew rsh did that, and I don't know if I want to implement > that functionality.
Attached is a patch that should implement this functionality. > What about replacing the symbolic link with a simple shell script? > > #!/bin/sh > exec rsh $* ahostname That would probably be something like: exec rsh `basename $0` ${1+"$@"} -- -- arthur de jong - [EMAIL PROTECTED] - west consulting b.v. --
Index: rsh.c =================================================================== --- rsh.c (revision 71) +++ rsh.c (working copy) @@ -136,15 +136,32 @@ return 1; } } - - if(optind == argc) { - fprintf(stderr, "%s: No host specified!\n", argv0); - usage(); - return 1; + + /* figure out basename of executable */ + host = strrchr(argv0, '/'); + if (host == NULL) { + host = argv0; } + else { + host++; + } + + /* if we were called with something else from rsh use the name as host */ + if ( strcmp(host, "rsh") == 0 || strcmp(host, "rsh-redone-rsh") == 0 ) { + host = NULL; + } + + /* get host from the command line */ + if (host == NULL) + { + if(optind == argc) { + fprintf(stderr, "%s: No host specified!\n", argv0); + usage(); + return 1; + } + host = argv[optind++]; + } - host = argv[optind++]; - if((p = strchr(host, '@'))) { user = host; *p = '\0';