summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPaul Smith <psmith@gnu.org>2023-01-08 18:44:25 -0500
committerPaul Smith <psmith@gnu.org>2023-01-08 18:44:25 -0500
commitb99b6cdf3c18ee96da1775f7300d463fe5fe7ebb (patch)
tree27f48ebdc15c65e5042b39aab130ac2f50a70e3e /src
parent36f955b0e8d2c1b5be292eb84475c44eea6403c8 (diff)
downloadmake-git-b99b6cdf3c18ee96da1775f7300d463fe5fe7ebb.tar.gz
Update support for OS/2
Patches provided by KO Myung-Hun <komh78@gmail.com> * NEWS: Add a note. * AUTHORS: Add a new author. * README.OS2: Updates to build instructions. * src/dir.c (dir_contents_file_exists_p): Use a stack copy when modifying a const string. * src/job.c (construct_command_argv_internal): Ditto. Reuse variables rather than re-defining them. (exec_command): Cast a const string (we don't change it anyway). * src/getopt.c (_getopt_initialize): Reference unused variables. (_getopt_internal): Add block braces to quiet the compiler. * src/main.c (main): Cast argument to child_execute_job(). * src/posixos.c (set_blocking): Reference unused variables. * src/remake.c (f_mtime): Delete useless code.
Diffstat (limited to 'src')
-rw-r--r--src/dir.c8
-rw-r--r--src/getopt.c27
-rw-r--r--src/job.c14
-rw-r--r--src/main.c2
-rw-r--r--src/posixos.c3
-rw-r--r--src/remake.c8
6 files changed, 37 insertions, 25 deletions
diff --git a/src/dir.c b/src/dir.c
index aa50db6c..3e94b98e 100644
--- a/src/dir.c
+++ b/src/dir.c
@@ -659,7 +659,13 @@ dir_contents_file_exists_p (struct directory *dir,
#ifdef __EMX__
if (filename != NULL)
- _fnlwr (filename); /* lower case for FAT drives */
+ {
+ size_t len = strlen (filename);
+ char *fname = alloca (len + 1);
+ memcpy (fname, filename, len + 1);
+ _fnlwr (fname); /* lower case for FAT drives */
+ filename = fname;
+ }
#endif
if (filename != NULL)
{
diff --git a/src/getopt.c b/src/getopt.c
index bc1f1caf..7a792de8 100644
--- a/src/getopt.c
+++ b/src/getopt.c
@@ -436,6 +436,10 @@ _getopt_initialize (int argc, char *const *argv, const char *optstring)
nonoption_flags_len = 0;
#endif
+ /* Make the compiler happy. */
+ (void)argc;
+ (void)argv;
+
return optstring;
}
@@ -677,17 +681,18 @@ _getopt_internal (int argc, char *const *argv, const char *optstring,
else
{
if (opterr)
- if (argv[optind - 1][1] == '-')
- /* --option */
- fprintf (stderr,
- _("%s: option '--%s' doesn't allow an argument\n"),
- argv[0], pfound->name);
- else
- /* +option or -option */
- fprintf (stderr,
- _("%s: option '%c%s' doesn't allow an argument\n"),
- argv[0], argv[optind - 1][0], pfound->name);
-
+ {
+ if (argv[optind - 1][1] == '-')
+ /* --option */
+ fprintf (stderr,
+ _("%s: option '--%s' doesn't allow an argument\n"),
+ argv[0], pfound->name);
+ else
+ /* +option or -option */
+ fprintf (stderr,
+ _("%s: option '%c%s' doesn't allow an argument\n"),
+ argv[0], argv[optind - 1][0], pfound->name);
+ }
nextchar += strlen (nextchar);
optopt = pfound->val;
diff --git a/src/job.c b/src/job.c
index 3fab8012..7533553f 100644
--- a/src/job.c
+++ b/src/job.c
@@ -2641,7 +2641,7 @@ exec_command (char **argv, char **envp)
# ifdef __EMX__
if (!unixy_shell)
{
- new_argv[1] = "/c";
+ new_argv[1] = (char *)"/c";
++i;
--argc;
}
@@ -3270,7 +3270,13 @@ construct_command_argv_internal (char *line, char **restp, const char *shell,
# ifdef __EMX__ /* is this necessary? */
if (!unixy_shell && shellflags)
- shellflags[0] = '/'; /* "/c" */
+ {
+ size_t len = strlen (shellflags);
+ char *shflags = alloca (len + 1);
+ memcpy (shflags, shellflags, len + 1);
+ shflags[0] = '/'; /* "/c" */
+ shellflags = shflags;
+ }
# endif
/* In .ONESHELL mode we are allowed to throw the entire current
@@ -3593,9 +3599,9 @@ construct_command_argv_internal (char *line, char **restp, const char *shell,
/* new_line is local, must not be freed therefore
We use line here instead of new_line because we run the shell
manually. */
- size_t line_len = strlen (line);
- char *p = new_line;
char *q = new_line;
+ line_len = strlen (line);
+ p = new_line;
memcpy (new_line, line, line_len + 1);
/* Replace all backslash-newline combination and also following tabs.
Important: stop at the first '\n' because that's what the loop above
diff --git a/src/main.c b/src/main.c
index cf2324d1..8ad750b8 100644
--- a/src/main.c
+++ b/src/main.c
@@ -2800,7 +2800,7 @@ main (int argc, char **argv, char **envp)
child.output.syncout = 0;
child.environment = environ;
- pid = child_execute_job (&child, 1, nargv);
+ pid = child_execute_job (&child, 1, (char **)nargv);
/* is this loop really necessary? */
do {
diff --git a/src/posixos.c b/src/posixos.c
index 164e0fba..0fe0948a 100644
--- a/src/posixos.c
+++ b/src/posixos.c
@@ -136,6 +136,9 @@ set_blocking (int fd, int blocking)
if (r < 0)
pfatal_with_name ("fcntl(O_NONBLOCK)");
}
+#else
+ (void) fd;
+ (void) blocking;
#endif
}
diff --git a/src/remake.c b/src/remake.c
index 8e2547eb..62b3d791 100644
--- a/src/remake.c
+++ b/src/remake.c
@@ -1477,14 +1477,6 @@ f_mtime (struct file *file, int search)
FILE_TIMESTAMP adjustment = FAT_ADJ_OFFSET << FILE_TIMESTAMP_LO_BITS;
if (ORDINARY_MTIME_MIN + adjustment <= adjusted_mtime)
adjusted_mtime -= adjustment;
-#elif defined(__EMX__)
- /* FAT filesystems round time to the nearest even second!
- Allow for any file (NTFS or FAT) to perhaps suffer from this
- brain damage. */
- FILE_TIMESTAMP adjustment = (((FILE_TIMESTAMP_S (adjusted_mtime) & 1) == 0
- && FILE_TIMESTAMP_NS (adjusted_mtime) == 0)
- ? (FILE_TIMESTAMP) 1 << FILE_TIMESTAMP_LO_BITS
- : 0);
#endif
/* If the file's time appears to be in the future, update our