forked from KolibriOS/kolibrios
Update TTE:
- Help via @notify git-svn-id: svn://kolibrios.org@8127 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
0e597e6d0a
commit
47f30eaa44
29
programs/other/tte/notify.h
Executable file
29
programs/other/tte/notify.h
Executable file
@ -0,0 +1,29 @@
|
|||||||
|
typedef unsigned int uint32_t;
|
||||||
|
|
||||||
|
static inline
|
||||||
|
int start_app(char *app_name, char *args){
|
||||||
|
#pragma pack(push, 1)
|
||||||
|
struct file_op_t
|
||||||
|
{
|
||||||
|
uint32_t fn;
|
||||||
|
uint32_t flags;
|
||||||
|
char* args;
|
||||||
|
uint32_t res1, res2;
|
||||||
|
char zero;
|
||||||
|
char* app_name __attribute__((packed));
|
||||||
|
} file_op;
|
||||||
|
#pragma pack(pop)
|
||||||
|
memset(&file_op, 0, sizeof(file_op));
|
||||||
|
file_op.fn = 7;
|
||||||
|
file_op.args = args;
|
||||||
|
file_op.app_name = app_name;
|
||||||
|
|
||||||
|
register int val;
|
||||||
|
asm volatile ("int $0x40":"=a"(val):"a"(70), "b"(&file_op));
|
||||||
|
|
||||||
|
return val;
|
||||||
|
}
|
||||||
|
|
||||||
|
void notify(char *text) {
|
||||||
|
start_app("/sys/@notify", text);
|
||||||
|
}
|
@ -14,9 +14,10 @@
|
|||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* Kolibri port by Siemargl 2018 and update by maxcodehack 2020
|
/* Kolibri port by Siemargl 2018 and update by maxcodehack 2020
|
||||||
* my fixes mostly commented with triple comment ///
|
* my fixes mostly commented with triple comment ///
|
||||||
* */
|
*/
|
||||||
|
|
||||||
/*** Include section ***/
|
/*** Include section ***/
|
||||||
|
|
||||||
@ -45,6 +46,8 @@
|
|||||||
///#include <unistd.h>
|
///#include <unistd.h>
|
||||||
#include <conio.h>
|
#include <conio.h>
|
||||||
|
|
||||||
|
/// Notify
|
||||||
|
#include "notify.h"
|
||||||
|
|
||||||
|
|
||||||
/*** Define section ***/
|
/*** Define section ***/
|
||||||
@ -1723,7 +1726,8 @@ void initEditor() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void printHelp() {
|
void printHelp() {
|
||||||
printf("Usage: tte [OPTIONS] [FILE]\n\n");
|
/*
|
||||||
|
printf("Usage: tte [OPTIONS] [FILE]\n\n");
|
||||||
printf("\nKEYBINDINGS\n-----------\n\n");
|
printf("\nKEYBINDINGS\n-----------\n\n");
|
||||||
printf("Keybinding\t\tAction\n\n");
|
printf("Keybinding\t\tAction\n\n");
|
||||||
printf("Ctrl-Q,^Z \t\tExit\n");
|
printf("Ctrl-Q,^Z \t\tExit\n");
|
||||||
@ -1734,7 +1738,7 @@ void printHelp() {
|
|||||||
printf("Ctrl-C \t\tCopy line\n");
|
printf("Ctrl-C \t\tCopy line\n");
|
||||||
printf("Ctrl-X \t\tCut line\n");
|
printf("Ctrl-X \t\tCut line\n");
|
||||||
printf("Ctrl-V \t\tPaste line\n");
|
printf("Ctrl-V \t\tPaste line\n");
|
||||||
/// printf("Ctrl-P \t\tPause tte (type \"fg\" to resume)\n");
|
/// printf("Ctrl-P \t\tPause tte (type \"fg\" to resume)\n");
|
||||||
|
|
||||||
printf("\n\nOPTIONS\n-------\n\n");
|
printf("\n\nOPTIONS\n-------\n\n");
|
||||||
printf("Option \t\tAction\n\n");
|
printf("Option \t\tAction\n\n");
|
||||||
@ -1742,6 +1746,29 @@ void printHelp() {
|
|||||||
printf("-v | --version\t\tPrints the version of tte\n");
|
printf("-v | --version\t\tPrints the version of tte\n");
|
||||||
|
|
||||||
printf("\n\nFor now, usage of ISO 8859-1 is recommended.\n");
|
printf("\n\nFor now, usage of ISO 8859-1 is recommended.\n");
|
||||||
|
*/
|
||||||
|
|
||||||
|
/// NOTIFY HOTKEYS
|
||||||
|
char* __help__ =
|
||||||
|
"'Hotkeys: \n\
|
||||||
|
^Q, ^Z Exit \n\
|
||||||
|
Ctrl-S Save \n\
|
||||||
|
Ctrl-F Search. Esc, \n\
|
||||||
|
enter and arrows to interact once searching \n\
|
||||||
|
Ctrl-E Flip line upwards \n\
|
||||||
|
Ctrl-D Flip line downwards \n\
|
||||||
|
Ctrl-C Copy line \n\
|
||||||
|
Ctrl-X Cut line \n\
|
||||||
|
Ctrl-V Paste line' -t -I";
|
||||||
|
notify(__help__);
|
||||||
|
|
||||||
|
/// NOTIFY OPTIONS
|
||||||
|
__help__ =
|
||||||
|
"'Options:\n\
|
||||||
|
-h, --help Prints the help \n\
|
||||||
|
-v, --version Prints the version of tte \n\
|
||||||
|
For now, usage of ISO 8859-1 is recommended.\n' -t -I";
|
||||||
|
notify(__help__);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 1 if editor should open, 0 otherwise, -1 if the program should exit
|
// 1 if editor should open, 0 otherwise, -1 if the program should exit
|
||||||
@ -1754,7 +1781,11 @@ int handleArgs(int argc, char* argv[]) {
|
|||||||
printHelp();
|
printHelp();
|
||||||
return -1;
|
return -1;
|
||||||
} else if(strncmp("-v", argv[1], 2) == 0 || strncmp("--version", argv[1], 9) == 0) {
|
} else if(strncmp("-v", argv[1], 2) == 0 || strncmp("--version", argv[1], 9) == 0) {
|
||||||
printf("tte - version %s\n", TTE_VERSION);
|
char* _notify_version = "'Version:\n";
|
||||||
|
strcat(_notify_version, TTE_VERSION);
|
||||||
|
strcat(_notify_version, "' -t -I");
|
||||||
|
/// printf("tte - version %s\n", TTE_VERSION);
|
||||||
|
notify(_notify_version);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user