+
+$BUILTIN disown
+$FUNCTION disown_builtin
+$DEPENDS_ON JOB_CONTROL
+$SHORT_DOC disown [-h] [jobspec ...]
+By default, removes each JOBSPEC argument from the table of active jobs.
+If the -h option is given, the job is not removed from the table, but is
+marked so that SIGHUP is not sent to the job if the shell receives a
+SIGHUP.
+$END
+
+#if defined (JOB_CONTROL)
+int
+disown_builtin (list)
+ WORD_LIST *list;
+{
+ int opt, job, retval, nohup_only;
+ sigset_t set, oset;
+
+ nohup_only = 0;
+ reset_internal_getopt ();
+ while ((opt = internal_getopt (list, "h")) != -1)
+ {
+ switch (opt)
+ {
+ case 'h':
+ nohup_only = 1;
+ break;
+ default:
+ builtin_usage ();
+ return (EX_USAGE);
+ }
+ }
+ list = loptend;
+ retval = EXECUTION_SUCCESS;
+
+ do
+ {
+ BLOCK_CHILD (set, oset);
+ job = get_job_spec (list);
+
+ if (job == NO_JOB || jobs == 0 || jobs[job] == 0)
+ {
+ builtin_error ("no such job %s", list->word->word);
+ retval = EXECUTION_FAILURE;
+ }
+ else if (nohup_only)
+ nohup_job (job);
+ else
+ delete_job (job);
+ UNBLOCK_CHILD (oset);
+
+ if (list)
+ list = list->next;
+ }
+ while (list);
+ return (retval);
+}
+#endif /* JOB_CONTROL */