#endif
#include "commands.h"
-extern int use_dialog_box;
-extern int use_file_dialog;
#ifndef O_WRONLY
#define O_WRONLY 1
/* Lisp function for recursively deleting directories. */
Lisp_Object Qdelete_directory;
-extern Lisp_Object Vuser_login_name;
-
#ifdef WINDOWSNT
extern Lisp_Object Vw32_get_true_file_attributes;
#endif
-extern int minibuf_level;
-
-extern int minibuffer_auto_raise;
-
/* These variables describe handlers that have "already" had a chance
to handle the current operation.
any handlers that are members of `inhibit-file-name-handlers',
but we still do run any other handlers. This lets handlers
use the standard functions without calling themselves recursively. */)
- (filename, operation)
- Lisp_Object filename, operation;
+ (Lisp_Object filename, Lisp_Object operation)
{
/* This function must not munge the match data. */
Lisp_Object chain, inhibited_handlers, result;
Return nil if FILENAME does not include a directory.
Otherwise return a directory name.
Given a Unix syntax file name, returns a string ending in slash. */)
- (filename)
- Lisp_Object filename;
+ (Lisp_Object filename)
{
#ifndef DOS_NT
register const unsigned char *beg;
filename = FILE_SYSTEM_CASE (filename);
#ifdef DOS_NT
beg = (unsigned char *) alloca (SBYTES (filename) + 1);
- bcopy (SDATA (filename), beg, SBYTES (filename) + 1);
+ memcpy (beg, SDATA (filename), SBYTES (filename) + 1);
#else
beg = SDATA (filename);
#endif
For example, in a Unix-syntax file name,
this is everything after the last slash,
or the entire name if it contains no slash. */)
- (filename)
- Lisp_Object filename;
+ (Lisp_Object filename)
{
register const unsigned char *beg, *p, *end;
Lisp_Object handler;
then this should return nil.
The `call-process' and `start-process' functions use this function to
get a current directory to run processes in. */)
- (filename)
- Lisp_Object filename;
+ (Lisp_Object filename)
{
Lisp_Object handler;
The result can be used as the value of `default-directory'
or passed as second argument to `expand-file-name'.
For a Unix-syntax file name, just appends a slash. */)
- (file)
- Lisp_Object file;
+ (Lisp_Object file)
{
char *buf;
Lisp_Object handler;
This operation exists because a directory is also a file, but its name as
a directory is different from its name as a file.
In Unix-syntax, this function just removes the final slash. */)
- (directory)
- Lisp_Object directory;
+ (Lisp_Object directory)
{
char *buf;
Lisp_Object handler;
if (!STRING_MULTIBYTE (prefix))
STRING_SET_UNIBYTE (val);
data = SDATA (val);
- bcopy(SDATA (prefix), data, len);
+ memcpy (data, SDATA (prefix), len);
p = data + len;
- bcopy (pidbuf, p, pidlen);
+ memcpy (p, pidbuf, pidlen);
p += pidlen;
/* Here we try to minimize useless stat'ing when this function is
* If you are creating the file in the user's home directory.
* If you are creating a directory rather than an ordinary file.
* If you are taking special precautions as `make-temp-file' does. */)
- (prefix)
- Lisp_Object prefix;
+ (Lisp_Object prefix)
{
return make_temp_name (prefix, 0);
}
\(expand-file-name ".." "/") returns "/..". For this reason, use
(directory-file-name (file-name-directory dirname)) to traverse a
filesystem tree, not (expand-file-name ".." dirname). */)
- (name, default_directory)
- Lisp_Object name, default_directory;
+ (Lisp_Object name, Lisp_Object default_directory)
{
/* These point to SDATA and need to be careful with string-relocation
during GC (via DECODE_FILE). */
To avoid this, we set default_directory to the root of the
current drive. */
- extern char *emacs_root_dir (void);
-
default_directory = build_string (emacs_root_dir ());
#else
default_directory = build_string ("/");
/* Make a local copy of nm[] to protect it from GC in DECODE_FILE below. */
nm = (unsigned char *) alloca (SBYTES (name) + 1);
- bcopy (SDATA (name), nm, SBYTES (name) + 1);
+ memcpy (nm, SDATA (name), SBYTES (name) + 1);
#ifdef DOS_NT
/* Note if special escape prefix is present, but remove for now. */
unsigned char *o, *p;
for (p = nm; *p && (!IS_DIRECTORY_SEP (*p)); p++);
o = alloca (p - nm + 1);
- bcopy ((char *) nm, o, p - nm);
+ memcpy (o, nm, p - nm);
o [p - nm] = 0;
BLOCK_INPUT;
)
{
unsigned char *temp = (unsigned char *) alloca (length);
- bcopy (newdir, temp, length - 1);
+ memcpy (temp, newdir, length - 1);
temp[length - 1] = 0;
newdir = temp;
}
/* Get past ~ to user */
unsigned char *user = nm + 1;
/* Find end of name. */
- unsigned char *ptr = (unsigned char *) index (user, '/');
+ unsigned char *ptr = (unsigned char *) strchr (user, '/');
int len = ptr ? ptr - user : strlen (user);
/* Copy the user name into temp storage. */
o = (unsigned char *) alloca (len + 1);
- bcopy ((char *) user, o, len);
+ memcpy (o, user, len);
o[len] = 0;
/* Look up the user name. */
{
unsigned char *o = alloca (s - p + 1);
struct passwd *pw;
- bcopy (p, o, s - p);
+ memcpy (o, p, s - p);
o [s - p] = 0;
/* If we have ~user and `user' exists, discard
If `/~' appears, all of FILENAME through that `/' is discarded.
If `//' appears, everything up to and including the first of
those `/' is discarded. */)
- (filename)
- Lisp_Object filename;
+ (Lisp_Object filename)
{
unsigned char *nm;
decode of environment variables, causing the original Lisp_String
data to be relocated. */
nm = (unsigned char *) alloca (SBYTES (filename) + 1);
- bcopy (SDATA (filename), nm, SBYTES (filename) + 1);
+ memcpy (nm, SDATA (filename), SBYTES (filename) + 1);
#ifdef DOS_NT
dostounix_filename (nm);
If QUICK is nonzero, we ask for y or n, not yes or no. */
void
-barf_or_query_if_file_exists (Lisp_Object absname, unsigned char *querystring, int interactive, struct stat *statptr, int quick)
+barf_or_query_if_file_exists (Lisp_Object absname, const unsigned char *querystring, int interactive, struct stat *statptr, int quick)
{
register Lisp_Object tem, encoded_filename;
struct stat statbuf;
tem = format2 ("File %s already exists; %s anyway? ",
absname, build_string (querystring));
if (quick)
- tem = Fy_or_n_p (tem);
+ tem = call1 (intern ("y-or-n-p"), tem);
else
tem = do_yes_or_no_p (tem);
UNGCPRO;
If PRESERVE-SELINUX-CONTEXT is non-nil and SELinux is enabled
on the system, we copy the SELinux context of FILE to NEWNAME. */)
- (file, newname, ok_if_already_exists, keep_time, preserve_uid_gid, preserve_selinux_context)
- Lisp_Object file, newname, ok_if_already_exists, keep_time;
- Lisp_Object preserve_uid_gid, preserve_selinux_context;
+ (Lisp_Object file, Lisp_Object newname, Lisp_Object ok_if_already_exists, Lisp_Object keep_time, Lisp_Object preserve_uid_gid, Lisp_Object preserve_selinux_context)
{
int ifd, ofd, n;
char buf[16 * 1024];
DEFUN ("make-directory-internal", Fmake_directory_internal,
Smake_directory_internal, 1, 1, 0,
doc: /* Create a new directory named DIRECTORY. */)
- (directory)
- Lisp_Object directory;
+ (Lisp_Object directory)
{
const unsigned char *dir;
Lisp_Object handler;
DEFUN ("delete-directory-internal", Fdelete_directory_internal,
Sdelete_directory_internal, 1, 1, 0,
doc: /* Delete the directory named DIRECTORY. Does not follow symlinks. */)
- (directory)
- Lisp_Object directory;
+ (Lisp_Object directory)
{
const unsigned char *dir;
Lisp_Object handler;
When called interactively, TRASH is t if no prefix argument is given.
With a prefix argument, TRASH is nil. */)
- (filename, trash)
- Lisp_Object filename;
- Lisp_Object trash;
+ (Lisp_Object filename, Lisp_Object trash)
{
Lisp_Object handler;
Lisp_Object encoded_file;
unless optional third argument OK-IF-ALREADY-EXISTS is non-nil.
A number as third arg means request confirmation if NEWNAME already exists.
This is what happens in interactive use with M-x. */)
- (file, newname, ok_if_already_exists)
- Lisp_Object file, newname, ok_if_already_exists;
+ (Lisp_Object file, Lisp_Object newname, Lisp_Object ok_if_already_exists)
{
Lisp_Object handler;
struct gcpro gcpro1, gcpro2, gcpro3, gcpro4, gcpro5;
unless optional third argument OK-IF-ALREADY-EXISTS is non-nil.
A number as third arg means request confirmation if NEWNAME already exists.
This is what happens in interactive use with M-x. */)
- (file, newname, ok_if_already_exists)
- Lisp_Object file, newname, ok_if_already_exists;
+ (Lisp_Object file, Lisp_Object newname, Lisp_Object ok_if_already_exists)
{
Lisp_Object handler;
Lisp_Object encoded_file, encoded_newname;
unless optional third argument OK-IF-ALREADY-EXISTS is non-nil.
A number as third arg means request confirmation if LINKNAME already exists.
This happens for interactive use with M-x. */)
- (filename, linkname, ok_if_already_exists)
- Lisp_Object filename, linkname, ok_if_already_exists;
+ (Lisp_Object filename, Lisp_Object linkname, Lisp_Object ok_if_already_exists)
{
Lisp_Object handler;
Lisp_Object encoded_filename, encoded_linkname;
1, 1, 0,
doc: /* Return t if file FILENAME specifies an absolute file name.
On Unix, this is a name starting with a `/' or a `~'. */)
- (filename)
- Lisp_Object filename;
+ (Lisp_Object filename)
{
CHECK_STRING (filename);
return file_name_absolute_p (SDATA (filename)) ? Qt : Qnil;
/* Return nonzero if file FILENAME exists and can be written. */
static int
-check_writable (char *filename)
+check_writable (const char *filename)
{
#ifdef MSDOS
struct stat st;
See also `file-readable-p' and `file-attributes'.
This returns nil for a symlink to a nonexistent file.
Use `file-symlink-p' to test for such links. */)
- (filename)
- Lisp_Object filename;
+ (Lisp_Object filename)
{
Lisp_Object absname;
Lisp_Object handler;
DEFUN ("file-executable-p", Ffile_executable_p, Sfile_executable_p, 1, 1, 0,
doc: /* Return t if FILENAME can be executed by you.
For a directory, this means you can access files in that directory. */)
- (filename)
- Lisp_Object filename;
+ (Lisp_Object filename)
{
Lisp_Object absname;
Lisp_Object handler;
DEFUN ("file-readable-p", Ffile_readable_p, Sfile_readable_p, 1, 1, 0,
doc: /* Return t if file FILENAME exists and you can read it.
See also `file-exists-p' and `file-attributes'. */)
- (filename)
- Lisp_Object filename;
+ (Lisp_Object filename)
{
Lisp_Object absname;
Lisp_Object handler;
on the RT/PC. */
DEFUN ("file-writable-p", Ffile_writable_p, Sfile_writable_p, 1, 1, 0,
doc: /* Return t if file FILENAME can be written or created by you. */)
- (filename)
- Lisp_Object filename;
+ (Lisp_Object filename)
{
Lisp_Object absname, dir, encoded;
Lisp_Object handler;
doc: /* Access file FILENAME, and get an error if that does not work.
The second argument STRING is used in the error message.
If there is no error, returns nil. */)
- (filename, string)
- Lisp_Object filename, string;
+ (Lisp_Object filename, Lisp_Object string)
{
Lisp_Object handler, encoded_filename, absname;
int fd;
This function returns t when given the name of a symlink that
points to a nonexistent file. */)
- (filename)
- Lisp_Object filename;
+ (Lisp_Object filename)
{
Lisp_Object handler;
{
bufsize *= 2;
buf = (char *) xrealloc (buf, bufsize);
- bzero (buf, bufsize);
+ memset (buf, 0, bufsize);
errno = 0;
valsize = readlink (SDATA (filename), buf, bufsize);
while (valsize >= bufsize);
val = make_string (buf, valsize);
- if (buf[0] == '/' && index (buf, ':'))
+ if (buf[0] == '/' && strchr (buf, ':'))
val = concat2 (build_string ("/:"), val);
xfree (buf);
val = DECODE_FILE (val);
doc: /* Return t if FILENAME names an existing directory.
Symbolic links to directories count as directories.
See `file-symlink-p' to distinguish symlinks. */)
- (filename)
- Lisp_Object filename;
+ (Lisp_Object filename)
{
register Lisp_Object absname;
struct stat st;
A directory name spec may be given instead; then the value is t
if the directory so specified exists and really is a readable and
searchable directory. */)
- (filename)
- Lisp_Object filename;
+ (Lisp_Object filename)
{
Lisp_Object handler;
int tem;
This is the sort of file that holds an ordinary stream of data bytes.
Symbolic links to regular files count as regular files.
See `file-symlink-p' to distinguish symlinks. */)
- (filename)
- Lisp_Object filename;
+ (Lisp_Object filename)
{
register Lisp_Object absname;
struct stat st;
doc: /* Return SELinux context of file named FILENAME,
as a list ("user", "role", "type", "range"). Return (nil, nil, nil, nil)
if file does not exist, is not accessible, or SELinux is disabled */)
- (filename)
- Lisp_Object filename;
+ (Lisp_Object filename)
{
Lisp_Object absname;
Lisp_Object values[4];
doc: /* Set SELinux context of file named FILENAME to CONTEXT
as a list ("user", "role", "type", "range"). Has no effect if SELinux
is disabled. */)
- (filename, context)
- Lisp_Object filename, context;
+ (Lisp_Object filename, Lisp_Object context)
{
Lisp_Object absname, encoded_absname;
Lisp_Object handler;
DEFUN ("file-modes", Ffile_modes, Sfile_modes, 1, 1, 0,
doc: /* Return mode bits of file named FILENAME, as an integer.
Return nil, if file does not exist or is not accessible. */)
- (filename)
- Lisp_Object filename;
+ (Lisp_Object filename)
{
Lisp_Object absname;
struct stat st;
Interactively, mode bits are read by `read-file-modes', which accepts
symbolic notation, like the `chmod' command from GNU Coreutils. */)
- (filename, mode)
- Lisp_Object filename, mode;
+ (Lisp_Object filename, Lisp_Object mode)
{
Lisp_Object absname, encoded_absname;
Lisp_Object handler;
doc: /* Set the file permission bits for newly created files.
The argument MODE should be an integer; only the low 9 bits are used.
This setting is inherited by subprocesses. */)
- (mode)
- Lisp_Object mode;
+ (Lisp_Object mode)
{
CHECK_NUMBER (mode);
DEFUN ("default-file-modes", Fdefault_file_modes, Sdefault_file_modes, 0, 0, 0,
doc: /* Return the default file protection for created files.
The value is an integer. */)
- ()
+ (void)
{
int realmask;
Lisp_Object value;
return value;
}
\f
-extern int lisp_time_argument (Lisp_Object, time_t *, int *);
DEFUN ("set-file-times", Fset_file_times, Sset_file_times, 1, 2, 0,
doc: /* Set times of file FILENAME to TIME.
Return t on success, else nil.
Use the current time if TIME is nil. TIME is in the format of
`current-time'. */)
- (filename, time)
- Lisp_Object filename, time;
+ (Lisp_Object filename, Lisp_Object time)
{
Lisp_Object absname, encoded_absname;
Lisp_Object handler;
#ifdef HAVE_SYNC
DEFUN ("unix-sync", Funix_sync, Sunix_sync, 0, 0, "",
doc: /* Tell Unix to finish all pending disk updates. */)
- ()
+ (void)
{
sync ();
return Qnil;
doc: /* Return t if file FILE1 is newer than file FILE2.
If FILE1 does not exist, the answer is nil;
otherwise, if FILE2 does not exist, the answer is t. */)
- (file1, file2)
- Lisp_Object file1, file2;
+ (Lisp_Object file1, Lisp_Object file2)
{
Lisp_Object absname1, absname2;
struct stat st;
This function does code conversion according to the value of
`coding-system-for-read' or `file-coding-system-alist', and sets the
variable `last-coding-system-used' to the coding system actually used. */)
- (filename, visit, beg, end, replace)
- Lisp_Object filename, visit, beg, end, replace;
+ (Lisp_Object filename, Lisp_Object visit, Lisp_Object beg, Lisp_Object end, Lisp_Object replace)
{
struct stat st;
register int fd;
conversion_buffer);
unprocessed = coding.carryover_bytes;
if (coding.carryover_bytes > 0)
- bcopy (coding.carryover, read_buf, unprocessed);
+ memcpy (read_buf, coding.carryover, unprocessed);
}
UNGCPRO;
emacs_close (fd);
This calls `write-region-annotate-functions' at the start, and
`write-region-post-annotation-function' at the end. */)
- (start, end, filename, append, visit, lockname, mustbenew)
- Lisp_Object start, end, filename, append, visit, lockname, mustbenew;
+ (Lisp_Object start, Lisp_Object end, Lisp_Object filename, Lisp_Object append, Lisp_Object visit, Lisp_Object lockname, Lisp_Object mustbenew)
{
register int desc;
int failure;
DEFUN ("car-less-than-car", Fcar_less_than_car, Scar_less_than_car, 2, 2, 0,
doc: /* Return t if (car A) is numerically less than (car B). */)
- (a, b)
- Lisp_Object a, b;
+ (Lisp_Object a, Lisp_Object b)
{
return Flss (Fcar (a), Fcar (b));
}
doc: /* Return t if last mod time of BUF's visited file matches what BUF records.
This means that the file has not been changed since it was visited or saved.
See Info node `(elisp)Modification Time' for more details. */)
- (buf)
- Lisp_Object buf;
+ (Lisp_Object buf)
{
struct buffer *b;
struct stat st;
Sclear_visited_file_modtime, 0, 0, 0,
doc: /* Clear out records of last mod time of visited file.
Next attempt to save will certainly not complain of a discrepancy. */)
- ()
+ (void)
{
current_buffer->modtime = 0;
current_buffer->modtime_size = -1;
that `file-attributes' returns. If the current buffer has no recorded
file modification time, this function returns 0.
See Info node `(elisp)Modification Time' for more details. */)
- ()
+ (void)
{
if (! current_buffer->modtime)
return make_number (0);
An argument specifies the modification time value to use
\(instead of that of the visited file), in the form of a list
\(HIGH . LOW) or (HIGH LOW). */)
- (time_list)
- Lisp_Object time_list;
+ (Lisp_Object time_list)
{
if (!NILP (time_list))
{
GCPRO1 (msg);
nbytes = SBYTES (msg);
SAFE_ALLOCA (msgbuf, char *, nbytes);
- bcopy (SDATA (msg), msgbuf, nbytes);
+ memcpy (msgbuf, SDATA (msg), nbytes);
for (i = 0; i < 3; ++i)
{
A non-nil NO-MESSAGE argument means do not print any message if successful.
A non-nil CURRENT-ONLY argument means save only current buffer. */)
- (no_message, current_only)
- Lisp_Object no_message, current_only;
+ (Lisp_Object no_message, Lisp_Object current_only)
{
struct buffer *old = current_buffer, *b;
Lisp_Object tail, buf;
Sset_buffer_auto_saved, 0, 0, 0,
doc: /* Mark current buffer as auto-saved with its current text.
No auto-save file will be written until the buffer changes again. */)
- ()
+ (void)
{
/* FIXME: This should not be called in indirect buffers, since
they're not autosaved. */
DEFUN ("clear-buffer-auto-save-failure", Fclear_buffer_auto_save_failure,
Sclear_buffer_auto_save_failure, 0, 0, 0,
doc: /* Clear any record of a recent auto-save failure in the current buffer. */)
- ()
+ (void)
{
current_buffer->auto_save_failure_time = -1;
return Qnil;
More precisely, if it has been auto-saved since last read from or saved
in the visited file. If the buffer has no visited file,
then any auto-save counts as "recent". */)
- ()
+ (void)
{
/* FIXME: maybe we should return nil for indirect buffers since
they're never autosaved. */
doc: /* Return t if a call to `read-file-name' will use a dialog.
The return value is only relevant for a call to `read-file-name' that happens
before any other event (mouse or keypress) is handled. */)
- ()
+ (void)
{
#if defined (USE_MOTIF) || defined (HAVE_NTGUI) || defined (USE_GTK)
if ((NILP (last_nonmenu_event) || CONSP (last_nonmenu_event))