delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/2009/04/11/18:22:16

X-Authentication-Warning: delorie.com: mail set sender to djgpp-workers-bounces using -f
X-Recipient: djgpp-workers AT delorie DOT com
X-Authenticated: #27081556
X-Provags-ID: V01U2FsdGVkX1/KeHYi3x/K6EHUaskSdUb8RJDTOrP7YsWDdsrY/s
qoFcPk8HrVWVdh
Message-ID: <000501c9baf3$e9fbc3a0$2602a8c0@computername>
From: "Juan Manuel Guerrero" <juan DOT guerrero AT gmx DOT de>
To: <djgpp-workers AT delorie DOT com>
Subject: mkstemp() declaration
Date: Sun, 12 Apr 2009 00:21:51 +0200
MIME-Version: 1.0
X-Priority: 3
X-MSMail-Priority: Normal
X-Mailer: Microsoft Outlook Express 6.00.2800.1106
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106
X-Y-GMX-Trusted: 0
X-FuHaFi: 0.53
Reply-To: djgpp-workers AT delorie DOT com

According to <http://www.opengroup.org/onlinepubs/009695399/functions/mkstemp.html>
and <http://www.opengroup.org/onlinepubs/009695399/functions/mktemp.html> mkstemp()
and mktemp() shall be declared stdlib.h and not in stdio.h as they are declared now.
If the function declarations are in the wrong header section let me know.
Any objections to apply the patch below.

Regards,
Juan M. Guerrero


2009-04-11  Juan Manuel Guerrero  <juan DOT guerrero AT gmx DOT de>

 * include/stdio.h: Remove mktemp() and mkstemp() declarations.  Now in
 stdlib.h.
 * include/stdlib.h: Declarations for mktemp() and mkstemp() added.
 * src/libc/compat/stdio/mkstemp.c: Include stdlib.h instead of stdio.h
 for function prototype.
 * src/libc/compat/stdio/mkstemp.txh: Change example code.  Include stdlib.h
 instead of stdio.h for function prototype.
 * src/libc/compat/stdio/mktemp.c: Include stdlib.h instead of stdio.h
 for function prototype.
 * src/libc/compat/stdio/mktemp.txh: Change example code.  Include stdlib.h
 instead of stdio.h for function prototype.





diff -aprNU3 djgpp.orig/include/stdio.h djgpp/include/stdio.h
--- djgpp.orig/include/stdio.h 2008-04-06 23:51:00 +0000
+++ djgpp/include/stdio.h 2009-04-12 00:00:04 +0000
@@ -140,7 +140,6 @@ int vsscanf(const char *_s, const char *
 
 int fileno(FILE *_stream);
 FILE * fdopen(int _fildes, const char *_type);
-int mkstemp(char *_template);
 int pclose(FILE *_pf);
 FILE * popen(const char *_command, const char *_mode);
 char * tempnam(const char *_dir, const char *_prefix);
@@ -159,7 +158,6 @@ int _doscan(FILE *_f, const char *_fmt, 
 int _doscan_low(FILE *, int (*)(FILE *_get), int (*_unget)(int, FILE *), const char *_fmt, va_list _args);
 int fpurge(FILE *_f);
 int getw(FILE *_f);
-char * mktemp(char *_template);
 int putw(int _v, FILE *_f);
 void setbuffer(FILE *_f, void *_buf, int _size);
 void setlinebuf(FILE *_f);
diff -aprNU3 djgpp.orig/include/stdlib.h djgpp/include/stdlib.h
--- djgpp.orig/include/stdlib.h 2003-02-20 19:06:14 +0000
+++ djgpp/include/stdlib.h 2009-04-12 00:00:06 +0000
@@ -101,6 +101,8 @@ unsigned long long int strtoull(const ch
 
 long a64l(const char *_string);
 char * l64a(long _value);
+char * mktemp(char *_template);
+int mkstemp(char *_template);
 int putenv(char *_val);
 char * realpath(const char *_path, char *_resolved);
 int setenv(const char *_var, const char *_val, int _overwrite);
diff -aprNU3 djgpp.orig/src/libc/compat/stdio/mkstemp.c djgpp/src/libc/compat/stdio/mkstemp.c
--- djgpp.orig/src/libc/compat/stdio/mkstemp.c 2002-10-17 23:00:24 +0000
+++ djgpp/src/libc/compat/stdio/mkstemp.c 2009-04-12 00:00:04 +0000
@@ -1,10 +1,11 @@
+/* Copyright (C) 2009 DJ Delorie, see COPYING.DJ for details */
 /* Copyright (C) 2001 DJ Delorie, see COPYING.DJ for details */
 /* Copyright (C) 2000 DJ Delorie, see COPYING.DJ for details */
 /* Copyright (C) 1998 DJ Delorie, see COPYING.DJ for details */
 /* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
 #include <libc/symlink.h>
 #include <string.h>
-#include <stdio.h>
+#include <stdlib.h>
 #include <fcntl.h>
 #include <errno.h>
 #include <io.h>
diff -aprNU3 djgpp.orig/src/libc/compat/stdio/mkstemp.txh djgpp/src/libc/compat/stdio/mkstemp.txh
--- djgpp.orig/src/libc/compat/stdio/mkstemp.txh 2003-01-29 12:39:18 +0000
+++ djgpp/src/libc/compat/stdio/mkstemp.txh 2009-04-12 00:00:04 +0000
@@ -3,7 +3,7 @@
 @subheading Syntax
 
 @example
-#include <stdio.h>
+#include <stdlib.h>
 
 int mkstemp(char *template);
 @end example
diff -aprNU3 djgpp.orig/src/libc/compat/stdio/mktemp.c djgpp/src/libc/compat/stdio/mktemp.c
--- djgpp.orig/src/libc/compat/stdio/mktemp.c 2000-08-28 13:29:30 +0000
+++ djgpp/src/libc/compat/stdio/mktemp.c 2009-04-12 00:00:04 +0000
@@ -1,3 +1,4 @@
+/* Copyright (C) 2009 DJ Delorie, see COPYING.DJ for details */
 /* Copyright (C) 2000 DJ Delorie, see COPYING.DJ for details */
 /* Copyright (C) 1996 DJ Delorie, see COPYING.DJ for details */
 /* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
@@ -5,7 +6,7 @@
 #include <libc/bss.h>
 #include <libc/symlink.h>
 #include <unistd.h>
-#include <stdio.h>
+#include <stdlib.h>
 #include <string.h>
 
 static int mktemp_count = -1;
diff -aprNU3 djgpp.orig/src/libc/compat/stdio/mktemp.txh djgpp/src/libc/compat/stdio/mktemp.txh
--- djgpp.orig/src/libc/compat/stdio/mktemp.txh 2003-01-29 12:39:18 +0000
+++ djgpp/src/libc/compat/stdio/mktemp.txh 2009-04-12 00:00:02 +0000
@@ -3,7 +3,7 @@
 @subheading Syntax
 
 @example
-#include <stdio.h>
+#include <stdlib.h>
 
 char *mktemp(char *template);
 @end example

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019