2 * (c) Oleg Puchinin 2006
3 * graycardinalster@gmail.com
11 #include <gclib/gclib.h>
17 #define TMP_FILE "/tmp/.silent_bob.tmp.cpp"
18 extern "C" DArray
* plugin_init (struct env_t
*env
);
35 fd
= open (TMP_FILE
, O_WRONLY
| O_CREAT
);
36 fchmod (fd
, S_IREAD
| S_IWRITE
);
41 dup2 (fd
, fileno (stdout
));
44 if ((waitpid (pid
, &status
, 0) < 0) ||
48 sprintf (m_buf
, "%s %s", editor
, TMP_FILE
);
54 char editor_opt (DArray
* d_opts
, int * i
)
64 if (EQ(S
, "-g") || EQ(S
, "--gvim"))
83 printf ("Editors.\n");
84 printf ("Version: 1.0\n");
85 printf ("Few editors for SilentBob:\n"
86 "\t-g --gvim\t-\tGVim\n"
87 "\t--emacs\t\t-\tEmacs\n"
88 "\t--nano\t\t-\tnano\n");
91 DArray
* plugin_init (struct env_t
*env
)
94 struct mod_feature
* pm
;
98 pm
= CNEW (mod_feature
, 1);
99 memset (pm
, 0, sizeof (mod_feature
));
100 pm
->mod
.Type
= TYPE_FEATURE
;
101 pm
->mod
.Version
= strdup ("1.0");
102 pm
->opt
= editor_opt
;
103 pm
->mod
.Name
= strdup ("Editors");
107 Ret
->add (LPCHAR (pm
));