On Fri, 2007-04-27 at 14:55 +0200, Noah Heusser wrote:
> Hi
Hi,
> Sorry, i have no idea how to create a pach file.
You could create a patch with the "diff" command:
[EMAIL PROTECTED]:~/Desktop> diff -uN nohup.orig.c nohup.c > nohup.c.patch
To apply the created patch to a file use "patch":
patch -p1 < nohup.c.patch
I have attached a patch for your code.
Regards
Johannes
--- nohup.orig.c 2007-03-18 22:36:43.000000000 +0100
+++ nohup.c 2007-04-27 15:15:54.000000000 +0200
@@ -44,6 +44,15 @@
NOHUP_FAILURE = 127
};
+static struct option const long_options[] =
+ {
+ {"out-file", optional_argument, NULL, 'f'},
+ {GETOPT_HELP_OPTION_DECL},
+ {GETOPT_VERSION_OPTION_DECL},
+ {NULL, 0, NULL, 0}
+ };
+
+
char *program_name;
void
@@ -66,6 +75,7 @@
"), stdout);
fputs (HELP_OPTION_DESCRIPTION, stdout);
fputs (VERSION_OPTION_DESCRIPTION, stdout);
+ printf(" --out-file The File, the output of the Program should be written to.\n");
printf (USAGE_BUILTIN_WARNING, PROGRAM_NAME);
printf (_("\nReport bugs to <%s>.\n"), PACKAGE_BUGREPORT);
}
@@ -75,12 +85,14 @@
int
main (int argc, char **argv)
{
+ int c = 0;
int out_fd = STDOUT_FILENO;
int saved_stderr_fd = STDERR_FILENO;
bool ignoring_input;
bool redirecting_stdout;
bool stdout_is_closed;
bool redirecting_stderr;
+ char *file = "nohup.out";
initialize_main (&argc, &argv);
program_name = argv[0];
@@ -91,10 +103,22 @@
initialize_exit_failure (NOHUP_FAILURE);
atexit (close_stdout);
- parse_long_options (argc, argv, PROGRAM_NAME, GNU_PACKAGE, VERSION,
- usage, AUTHORS, (char const *) NULL);
- if (getopt_long (argc, argv, "+", NULL, NULL) != -1)
- usage (NOHUP_FAILURE);
+ // parse_long_options (argc, argv, PROGRAM_NAME, GNU_PACKAGE, VERSION,
+ // usage, AUTHORS, (char const *) NULL);
+ while((c = getopt_long (argc, argv, "f:", long_options, NULL)) != -1)
+ {
+ switch(c)
+ {
+ case 'f':
+ file = strdup(optarg);
+ break;
+
+ case_GETOPT_HELP_CHAR;
+ case_GETOPT_VERSION_CHAR (PROGRAM_NAME, AUTHORS);
+ default:
+ usage(NOHUP_FAILURE);
+ }
+ }
if (argc <= optind)
{
@@ -124,7 +148,6 @@
if (redirecting_stdout || (redirecting_stderr && stdout_is_closed))
{
char *in_home = NULL;
- char const *file = "nohup.out";
int flags = O_CREAT | O_WRONLY | O_APPEND;
mode_t mode = S_IRUSR | S_IWUSR;
mode_t umask_value = umask (~mode);
_______________________________________________
Bug-coreutils mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/bug-coreutils