guile-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

guile/guile-core NEWS libguile/ChangeLog libgui...


From: Gary Houston
Subject: guile/guile-core NEWS libguile/ChangeLog libgui...
Date: Sun, 18 Mar 2001 12:29:58 -0800

CVSROOT:        /cvs
Module name:    guile
Changes by:     Gary Houston <address@hidden>   01/03/18 12:29:58

Modified files:
        guile-core     : NEWS 
        guile-core/libguile: ChangeLog posix.c posix.h 

Log message:
        * posix.c (scm_tmpnam): check that return value from tmpnam is not
        NULL.  rewrote the docstring.
        (scm_mkstemp): new procedure implementing "mkstemp!".
        * posix.h: declare scm_mkstemp.
        
        * net_db.c: declare h_errno if configure didn't define HAVE_H_ERRNO.
        normally it would be found in netdb.h.

CVSWeb URLs:
http://subversions.gnu.org/cgi-bin/cvsweb/guile/guile-core/NEWS.diff?r1=1.260&r2=1.261
http://subversions.gnu.org/cgi-bin/cvsweb/guile/guile-core/libguile/ChangeLog.diff?r1=1.1331&r2=1.1332
http://subversions.gnu.org/cgi-bin/cvsweb/guile/guile-core/libguile/posix.c.diff?r1=1.85&r2=1.86
http://subversions.gnu.org/cgi-bin/cvsweb/guile/guile-core/libguile/posix.h.diff?r1=1.18&r2=1.19

Patches:
Index: guile/guile-core/NEWS
diff -u guile/guile-core/NEWS:1.260 guile/guile-core/NEWS:1.261
--- guile/guile-core/NEWS:1.260 Sat Mar 17 07:34:46 2001
+++ guile/guile-core/NEWS       Sun Mar 18 12:29:57 2001
@@ -401,6 +401,13 @@
 Set or get the hostname of the machine the current process is running
 on.
 
+** New function: mkstemp! tmpl
+mkstemp creates a new unique file in the file system and returns a
+new buffered port open for reading and writing to the file.  TMPL
+is a string specifying where the file should be created: it must
+end with `XXXXXX' and will be changed in place to return the name
+of the temporary file.
+
 ** New function: open-input-string string
 
 Return an input string port which delivers the characters from
Index: guile/guile-core/libguile/ChangeLog
diff -u guile/guile-core/libguile/ChangeLog:1.1331 
guile/guile-core/libguile/ChangeLog:1.1332
--- guile/guile-core/libguile/ChangeLog:1.1331  Sun Mar 18 03:54:25 2001
+++ guile/guile-core/libguile/ChangeLog Sun Mar 18 12:29:57 2001
@@ -1,5 +1,10 @@
 2001-03-18  Gary Houston  <address@hidden>
 
+       * posix.c (scm_tmpnam): check that return value from tmpnam is not
+       NULL.  rewrote the docstring.
+       (scm_mkstemp): new procedure implementing "mkstemp!".
+       * posix.h: declare scm_mkstemp.
+
        * net_db.c: declare h_errno if configure didn't define HAVE_H_ERRNO.
        normally it would be found in netdb.h.
 
Index: guile/guile-core/libguile/posix.c
diff -u guile/guile-core/libguile/posix.c:1.85 
guile/guile-core/libguile/posix.c:1.86
--- guile/guile-core/libguile/posix.c:1.85      Sat Mar 10 08:56:06 2001
+++ guile/guile-core/libguile/posix.c   Sun Mar 18 12:29:58 2001
@@ -1028,18 +1028,47 @@
 
 SCM_DEFINE (scm_tmpnam, "tmpnam", 0, 0, 0,
             (),
-           "Create a new file in the file system with a unique name.  The 
return\n"
-           "value is the name of the new file.  This function is implemented 
with\n"
-           "the @code{tmpnam} function in the system libraries.")
+           "tmpnam returns a name in the file system that does not match\n"
+           "any existing file.  However there is no guarantee that\n"
+           "another process will not create the file after tmpnam\n"
+           "is called.  Care should be taken if opening the file,\n"
+           "e.g., use the O_EXCL open flag or use @code{mkstemp!} instead.")
 #define FUNC_NAME s_scm_tmpnam
 {
   char name[L_tmpnam];
-  SCM_SYSCALL (tmpnam (name););
+  char *rv;
+
+  SCM_SYSCALL (rv = tmpnam (name));
+  if (rv == NULL)
+    /* not SCM_SYSERROR since errno probably not set.  */
+    SCM_MISC_ERROR ("tmpnam failed", SCM_EOL);
   return scm_makfrom0str (name);
 }
 #undef FUNC_NAME
 
 #endif
+
+SCM_DEFINE (scm_mkstemp, "mkstemp!", 1, 0, 0,
+           (SCM tmpl),
+           "mkstemp creates a new unique file in the file system and\n"
+           "returns a new buffered port open for reading and writing to\n"
+           "the file.  @var{tmpl} is a string specifying where the\n"
+           "file should be created: it must end with @code{XXXXXX}\n"
+           "and will be changed in place to return the name of the\n"
+           "temporary file.\n")
+#define FUNC_NAME s_scm_mkstemp
+{
+  char *c_tmpl;
+  int rv;
+  
+  SCM_STRING_COERCE_0TERMINATION_X (tmpl);
+  SCM_VALIDATE_STRING_COPY (1, tmpl, c_tmpl);
+  SCM_SYSCALL (rv = mkstemp (c_tmpl));
+  if (rv == -1)
+    SCM_SYSERROR;
+  return scm_fdes_to_port (rv, "w+", tmpl);
+}
+#undef FUNC_NAME
 
 SCM_DEFINE (scm_utime, "utime", 1, 2, 0,
             (SCM pathname, SCM actime, SCM modtime),
Index: guile/guile-core/libguile/posix.h
diff -u guile/guile-core/libguile/posix.h:1.18 
guile/guile-core/libguile/posix.h:1.19
--- guile/guile-core/libguile/posix.h:1.18      Fri Mar  9 02:03:47 2001
+++ guile/guile-core/libguile/posix.h   Sun Mar 18 12:29:58 2001
@@ -2,7 +2,7 @@
 
 #ifndef POSIXH
 #define POSIXH
-/*     Copyright (C) 1995, 1996, 1997, 1998, 2000 Free Software Foundation, 
Inc.
+/*     Copyright (C) 1995, 1996, 1997, 1998, 2000, 2001 Free Software 
Foundation, Inc.
  * 
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -85,6 +85,7 @@
 extern SCM scm_uname (void);
 extern SCM scm_environ (SCM env);
 extern SCM scm_tmpnam (void);
+extern SCM scm_mkstemp (SCM tmpl);
 extern SCM scm_open_pipe (SCM pipestr, SCM modes);
 extern SCM scm_close_pipe (SCM port);
 extern SCM scm_utime (SCM pathname, SCM actime, SCM modtime);



reply via email to

[Prev in Thread] Current Thread [Next in Thread]