diff -uNr bash-2.05.orig/builtins/complete.def bash-2.05/builtins/complete.def
--- bash-2.05.orig/builtins/complete.def	Thu May 10 20:39:19 2001
+++ bash-2.05/builtins/complete.def	Thu May 10 20:39:36 2001
@@ -82,6 +82,7 @@
   { "job",       CA_JOB,       'j' },
   { "keyword",   CA_KEYWORD,   'k' },
   { "running",   CA_RUNNING,    0 },
+  { "service",   CA_SERVICE,   's' },
   { "setopt",    CA_SETOPT,     0 },
   { "shopt",     CA_SHOPT,      0 },
   { "signal",    CA_SIGNAL,     0 },
@@ -152,7 +153,7 @@
   opt_given = 0;
 
   reset_internal_getopt ();
-  while ((opt = internal_getopt (list, "abcdefgjko:pruvA:G:W:P:S:X:F:C:")) != -1)
+  while ((opt = internal_getopt (list, "abcdefgjko:prsuvA:G:W:P:S:X:F:C:")) != -1)
     {
       opt_given = 1;
       switch (opt)
@@ -210,6 +211,9 @@
 	case 'k':
 	  acts |= CA_KEYWORD;
 	  break;
+	case 's':
+	  acts |= CA_SERVICE;
+	  break;
 	case 'u':
 	  acts |= CA_USER;
 	  break;
@@ -431,6 +435,7 @@
   PRINTOPT (CA_GROUP, "-g");
   PRINTOPT (CA_KEYWORD, "-k");
   PRINTOPT (CA_JOB, "-j");
+  PRINTOPT (CA_SERVICE, "-s");
   PRINTOPT (CA_USER, "-u");
   PRINTOPT (CA_VARIABLE, "-v");
 
@@ -495,7 +500,7 @@
 $BUILTIN compgen
 $DEPENDS_ON PROGRAMMABLE_COMPLETION
 $FUNCTION compgen_builtin
-$SHORT_DOC compgen [-abcdefgjkvu] [-o option] [-A action] [-G globpat] [-W wordlist] [-P prefix] [-S suffix] [-X filterpat] [-F function] [-C command] [word]
+$SHORT_DOC compgen [-abcdefgjksvu] [-o option] [-A action] [-G globpat] [-W wordlist] [-P prefix] [-S suffix] [-X filterpat] [-F function] [-C command] [word]
 Display the possible completions depending on the options.  Intended
 to be used from within a shell function generating possible completions.
 If the optional WORD argument is supplied, matches against WORD are
diff -uNr bash-2.05.orig/doc/bash.1 bash-2.05/doc/bash.1
--- bash-2.05.orig/doc/bash.1	Thu May 10 20:39:19 2001
+++ bash-2.05/doc/bash.1	Thu May 10 20:39:36 2001
@@ -5678,7 +5678,7 @@
 matches were generated.
 .TP
 .PD 0
-\fBcomplete\fP [\fB\-abcdefgjkvu\fP] [\fB\-o\fP \fIcomp-option\fP] [\fB\-A\fP \fIaction\fP] [\fB\-G\fP \fIglobpat\fP] [\fB\-W\fP \fIwordlist\fP] [\fB\-P\fP \fIprefix\fP] [\fB\-S\fP \fIsuffix\fP]
+\fBcomplete\fP [\fB\-abcdefgjksvu\fP] [\fB\-o\fP \fIcomp-option\fP] [\fB\-A\fP \fIaction\fP] [\fB\-G\fP \fIglobpat\fP] [\fB\-W\fP \fIwordlist\fP] [\fB\-P\fP \fIprefix\fP] [\fB\-S\fP \fIsuffix\fP]
 .br
 [\fB\-X\fP \fIfilterpat\fP] [\fB\-F\fP \fIfunction\fP] [\fB\-C\fP \fIcommand\fP] \fIname\fP [\fIname ...\fP]
 .TP
@@ -5780,6 +5780,9 @@
 .TP 8
 .B running
 Names of running jobs, if job control is active.
+.TP 8
+.B service
+Service names.  May also be specified as \fB\-s\fP.
 .TP 8
 .B setopt
 Valid arguments for the \fB\-o\fP option to the \fBset\fP builtin.
diff -uNr bash-2.05.orig/lib/readline/complete.c bash-2.05/lib/readline/complete.c
--- bash-2.05.orig/lib/readline/complete.c	Thu May 10 20:39:19 2001
+++ bash-2.05/lib/readline/complete.c	Thu May 10 20:53:52 2001
@@ -50,6 +50,8 @@
 
 #include <pwd.h>
 #include <grp.h>
+#include <netdb.h>
+
 
 #include "posixdir.h"
 #include "posixstat.h"
@@ -1490,6 +1492,58 @@
       *value = *text;
 
       strcpy (value, entry->gr_name);
+
+      return (value);
+    }
+#endif /* !__WIN32__ && !__OPENNT */
+}
+
+/* A completion function for servicenames.
+   TEXT contains a partial servicename. */
+char *
+rl_servicename_completion_function (text, state)
+     const char *text;
+     int state;
+{
+#if defined (__WIN32__) || defined (__OPENNT)
+  return (char *)NULL;
+#else /* !__WIN32__ && !__OPENNT) */
+  static char *servname = (char *)NULL;
+  static struct servent *entry;
+  static int namelen, first_char;
+  char *value;
+
+  if (state == 0)
+    {
+      FREE (servname);
+
+      first_char = *text;
+
+      servname = savestring (&text[0]);
+      namelen = strlen (servname);
+      setservent (0);
+    }
+
+  while (entry = getservent ())
+    {
+      /* Null servicenames should result in all services as possible
+         completions. */
+      if (namelen == 0 || (STREQN (servname, entry->s_name, namelen)))
+	break;
+    }
+
+  if (entry == 0)
+    {
+      endservent ();
+      return ((char *)NULL);
+    }
+  else
+    {
+      value = xmalloc (2 + strlen (entry->s_name));
+
+      *value = *text;
+
+      strcpy (value, entry->s_name);
 
       return (value);
     }
diff -uNr bash-2.05.orig/lib/readline/readline.h bash-2.05/lib/readline/readline.h
--- bash-2.05.orig/lib/readline/readline.h	Thu May 10 20:39:19 2001
+++ bash-2.05/lib/readline/readline.h	Thu May 10 20:39:36 2001
@@ -410,6 +410,7 @@
 extern char **rl_completion_matches __P((const char *, rl_compentry_func_t *));
 extern char *rl_username_completion_function __P((const char *, int));
 extern char *rl_groupname_completion_function __P((const char *, int));
+extern char *rl_servicename_completion_function __P((const char *, int));
 extern char *rl_filename_completion_function __P((const char *, int));
 
 #if 0
diff -uNr bash-2.05.orig/pcomplete.c bash-2.05/pcomplete.c
--- bash-2.05.orig/pcomplete.c	Thu May 10 20:39:19 2001
+++ bash-2.05/pcomplete.c	Thu May 10 20:40:50 2001
@@ -121,6 +121,7 @@
 ITEMLIST it_jobs = { LIST_DYNAMIC, it_init_jobs, (STRINGLIST *)0 };;
 ITEMLIST it_keywords = { 0, it_init_keywords, (STRINGLIST *)0 };
 ITEMLIST it_running = { LIST_DYNAMIC, it_init_running, (STRINGLIST *)0 };
+ITEMLIST it_services = { LIST_DYNAMIC };	/* unused */
 ITEMLIST it_setopts = { 0, it_init_setopts, (STRINGLIST *)0 };
 ITEMLIST it_shopts = { 0, it_init_shopts, (STRINGLIST *)0 };
 ITEMLIST it_signals = { 0, it_init_signals, (STRINGLIST *)0 };
@@ -724,6 +725,7 @@
   GEN_XCOMPS(flags, CA_COMMAND, text, command_word_completion_function, cmatches, ret, tmatches);
   GEN_XCOMPS(flags, CA_FILE, text, pcomp_filename_completion_function, cmatches, ret, tmatches);
   GEN_XCOMPS(flags, CA_GROUP, text, rl_groupname_completion_function, cmatches, ret, tmatches);
+  GEN_XCOMPS(flags, CA_SERVICE, text, rl_servicename_completion_function, cmatches, ret, tmatches);
   GEN_XCOMPS(flags, CA_USER, text, rl_username_completion_function, cmatches, ret, tmatches);
 
   /* And lastly, the special case for directories */
diff -uNr bash-2.05.orig/pcomplete.h bash-2.05/pcomplete.h
--- bash-2.05.orig/pcomplete.h	Thu May 10 20:39:19 2001
+++ bash-2.05/pcomplete.h	Thu May 10 20:39:36 2001
@@ -57,12 +57,13 @@
 #define CA_JOB		(1<<14)
 #define CA_KEYWORD	(1<<15)
 #define CA_RUNNING	(1<<16)
-#define CA_SETOPT	(1<<17)
-#define CA_SHOPT	(1<<18)
-#define CA_SIGNAL	(1<<19)
-#define CA_STOPPED	(1<<20)
-#define CA_USER		(1<<21)
-#define CA_VARIABLE	(1<<22)
+#define CA_SERVICE	(1<<17)
+#define CA_SETOPT	(1<<18)
+#define CA_SHOPT	(1<<19)
+#define CA_SIGNAL	(1<<20)
+#define CA_STOPPED	(1<<21)
+#define CA_USER		(1<<22)
+#define CA_VARIABLE	(1<<23)
 
 /* Values for COMPSPEC options field. */
 #define COPT_RESERVED	(1<<0)		/* reserved for other use */
@@ -112,6 +113,7 @@
 extern ITEMLIST it_jobs;
 extern ITEMLIST it_keywords;
 extern ITEMLIST it_running;
+extern ITEMLIST it_services;
 extern ITEMLIST it_setopts;
 extern ITEMLIST it_shopts;
 extern ITEMLIST it_signals;
