summaryrefslogtreecommitdiff
path: root/atari/ctxmenu.c
diff options
context:
space:
mode:
authorOle Loots <ole@monochrom.net>2013-11-24 02:26:52 +0100
committerOle Loots <ole@monochrom.net>2013-11-24 02:26:52 +0100
commit2874fbd248da526a9b01dd038d266172d238b1f3 (patch)
treebd400ed42080d18c4d12bc9deb330663a89c5258 /atari/ctxmenu.c
parent26218a47c8ca28000b5450a8d794e2722aaa6595 (diff)
downloadnetsurf-2874fbd248da526a9b01dd038d266172d238b1f3.tar.gz
netsurf-2874fbd248da526a9b01dd038d266172d238b1f3.tar.bz2
Fix "View Source" by setting first byte of cmdline to length of cmdline
Diffstat (limited to 'atari/ctxmenu.c')
-rw-r--r--atari/ctxmenu.c43
1 files changed, 11 insertions, 32 deletions
diff --git a/atari/ctxmenu.c b/atari/ctxmenu.c
index 5b33fe45f..c81ea349d 100644
--- a/atari/ctxmenu.c
+++ b/atari/ctxmenu.c
@@ -122,10 +122,10 @@ void context_popup(struct gui_window * gw, short x, short y)
unsigned long size;
const char * data;
FILE * fp_tmpfile;
- char * tempfile;
+ char cmdline[128];
+ char * tempfile = &cmdline[1];
int err = 0;
- char * editor, *lastslash;
- char cmdline[PATH_MAX];
+ char * editor, *lastslash;
MENU pop_menu, me_data;
pop = gemtk_obj_get_tree( POP_CTX );
@@ -273,39 +273,18 @@ void context_popup(struct gui_window * gw, short x, short y)
if (editor != NULL && strlen(editor)>0) {
data = content_get_source_data(gw->browser->bw->current_content,
&size);
- if (size > 0 && data != NULL){
- tempfile = tmpnam( NULL );
- fp_tmpfile = fopen( tempfile, "w" );
+ if (size > 0 && data != NULL){
+ snprintf(tempfile, 127, "%s%s.htm", "u:", tmpnam(NULL));
+ cmdline[0] = (unsigned char)strlen(tempfile);
+ LOG(("Creating temporay source file: %s\n", tempfile));
+ fp_tmpfile = fopen(tempfile, "w");
if (fp_tmpfile != NULL){
fwrite(data, size, 1, fp_tmpfile);
- fclose(fp_tmpfile );
- /*
- lastslash = strrchr(editor, '/');
- if (lastslash == NULL)
- lastslash = strrchr(editor, '\\');
- if (lastslash == NULL)
- lastslash = editor;
- else
- lastslash++;
- */
+ fclose(fp_tmpfile);
if(strlen(tempfile)<=125){
- shel_write(1,1,0,editor,tempfile);
+ shel_write(1, 1, 1, editor, cmdline);
}
-
- /*if(is_process_running(lastslash)){
- if(strlen(tempfile)<=125){
- shel_write(1,1,0,editor,tempfile);
- }
- } else {
- // check for max length of simple commandline param:
- if(strlen(tempfile)<=125){
- sprintf(cmdline, "%c%s", (char)strlen(tempfile),
- tempfile);
- Pexec(100, editor, cmdline, NULL);
- }
- }
- */
} else {
printf("Could not open temp file: %s!\n", tempfile );
}
@@ -314,7 +293,7 @@ void context_popup(struct gui_window * gw, short x, short y)
LOG(("Invalid content!"));
}
} else {
- form_alert(0, "[1][Set option \"option_atari_editor\".][OK]");
+ form_alert(0, "[1][Set option \"atari_editor\".][OK]");
}
break;