monotone

monotone Mtn Source Tree

Root/src/luaext_mkstemp.cc

1// Copyright (C) 2006 Timothy Brownawell <tbrownaw@gmail.com>
2//
3// This program is made available under the GNU GPL version 2.0 or
4// greater. See the accompanying file COPYING for details.
5//
6// This program is distributed WITHOUT ANY WARRANTY; without even the
7// implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
8// PURPOSE.
9
10#include "base.hh"
11#include "lua.hh"
12#include "file_io.hh"
13
14#include <errno.h>
15#include <cstring>
16
17using std::string;
18using std::strerror;
19
20LUAEXT(mkstemp, )
21{
22 char const *filename = luaL_checkstring (LS, 1);
23 string dup(filename);
24
25 if (!monotone_mkstemp(dup))
26 return 0;
27
28 lua_pushstring(LS, dup.c_str());
29 return 1;
30}
31
32// Local Variables:
33// mode: C++
34// fill-column: 76
35// c-file-style: "gnu"
36// indent-tabs-mode: nil
37// End:
38// vim: et:sw=2:sts=2:ts=2:cino=>2s,{s,\:s,+s,t0,g0,^-2,e-2,n-2,p2s,(0,=s:

Archive Download this file

Branches

Tags

Quick Links:     www.monotone.ca    -     Downloads    -     Documentation    -     Wiki    -     Code Forge    -     Build Status