02110-1301, USA. */
#include <config.h>
-#include "message.h"
+#include <libpspp/message.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <errno.h>
-#include "settings.h"
-#include "command.h"
-#include "message.h"
-#include "lexer.h"
-#include "misc.h"
+#include <data/settings.h>
+#include <language/command.h>
+#include <libpspp/message.h>
+#include <language/lexer/lexer.h>
+#include <libpspp/misc.h>
#include "stat-macros.h"
-#include "str.h"
+#include <libpspp/str.h>
#include "gettext.h"
#define _(msgid) gettext (msgid)
enum PER {PER_RO, PER_RW};
-int change_permissions(const char *filename, enum PER per);
+int change_permissions(const char *file_name, enum PER per);
/* Parses the PERMISSIONS command. */
if (lex_match_id ("FILE"))
lex_match ('=');
- fn = strdup(ds_c_str(&tokstr));
+ fn = ds_xstrdup (&tokstr);
lex_force_match(T_STRING);
}
else
{
- msg(ME, _("Expecting %s or %s."), "WRITEABLE", "READONLY");
+ msg (SE, _("Expecting %s or %s."), "WRITEABLE", "READONLY");
goto error;
}
int
-change_permissions(const char *filename, enum PER per)
+change_permissions(const char *file_name, enum PER per)
{
struct stat buf;
mode_t mode;
}
- if ( -1 == stat(filename, &buf) )
+ if ( -1 == stat(file_name, &buf) )
{
const int errnum = errno;
- msg(ME,_("Cannot stat %s: %s"), filename, strerror(errnum));
+ msg (SE, _("Cannot stat %s: %s"), file_name, strerror(errnum));
return 0;
}
else
mode = buf.st_mode & ~( S_IWOTH | S_IWUSR | S_IWGRP );
- if ( -1 == chmod(filename, mode))
+ if ( -1 == chmod(file_name, mode))
{
const int errnum = errno;
- msg(ME,_("Cannot change mode of %s: %s"), filename, strerror(errnum));
+ msg (SE, _("Cannot change mode of %s: %s"), file_name, strerror(errnum));
return 0;
}