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"))
65 editor
= (char *) "gvim";
68 editor
= (char *) "emacs";
71 editor
= (char *) "nano";
88 printf ("Editors.\n");
89 printf ("Version: 1.0\n");
90 printf ("Few editors for SilentBob:\n"
91 "\t-g --gvim\t-\tGVim\n"
92 "\t--emacs\t\t-\tEmacs\n"
93 "\t--nano\t\t-\tnano\n");
96 DArray
* plugin_init (struct env_t
*env
)
101 plug
= CNEW (mod_t
, 1);
102 memset (plug
, 0, sizeof (mod_t
));
103 plug
->Version
= strdup ("1.0");
104 plug
->opt
= editor_opt
;
105 plug
->Name
= strdup ("Editors");
106 plug
->short_info
= short_info
;
107 plug
->long_info
= long_info
;
109 ENV
->listOptions
->add ( "-g");
110 ENV
->listOptions
->add ( "--gvim");
111 ENV
->listOptions
->add ( "--emacs");
112 ENV
->listOptions
->add ( "--nano");
115 Ret
= new DArray (1);
116 Ret
->add (LPCHAR (plug
));