Sisyphus repository
Last update: 1 october 2023 | SRPMs: 18631 | Visits: 37540121
en ru br
ALT Linux repos
S:1.0-alt4.qa1
5.0: 1.0-alt4
4.1: 1.0-alt4
4.0: 1.0-alt4
3.0: 1.0-alt2

Group :: Editors
RPM: vitmp

 Main   Changelog   Spec   Patches   Sources   Download   Gear   Bugs and FR  Repocop 

/*
* This is a wrapper around the VIM editor which may be used to invoke
* the editor in a way that is guaranteed to be suitable for editing
* temporary files used with programs such as crontab(1) and edquota(8).
*
* Written by Solar Designer <solar@owl.openwall.com> and placed in the
* public domain.
*
* $Id: vitmp.c,v 1.2 2002/04/24 23:11:34 solar Exp $
*/
#include <stdio.h>
#include <string.h>
#include <unistd.h>

int main(int argc, const char *const *argv)
{
char *newargv[argc + 4]; /* GNU C */

newargv[0] = "vi";
/* No swap files, use memory only */
newargv[1] = "-n";
/* Don't make a backup before overwriting a file */
newargv[2] = "-c";
newargv[3] = "set nobackup nowritebackup patchmode=";
memcpy(&newargv[4], &argv[1], argc * sizeof(char *));

(void) execv("/bin/vi", newargv);
perror("execv");

return 1;
}
 
design & coding: Vladimir Lettiev aka crux © 2004-2005, Andrew Avramenko aka liks © 2007-2008
current maintainer: Michael Shigorin