2 (c) 2009 by Leon Winter
3 (c) 2009, 2010 by Hannes Schueller
4 (c) 2009, 2010 by Matto Fransen
9 #include "vimprobable.h"
11 #include "utilities.h"
13 extern char commandhistory
[COMMANDHISTSIZE
][255];
14 extern int lastcommand
, maxcommands
, commandpointer
;
16 gboolean
read_rcfile(void)
22 gboolean returnval
= TRUE
;
24 rcfile
= g_strdup_printf(RCFILE
);
25 if ((fpin
= fopen(rcfile
, "r")) == NULL
)
27 while (fgets(s
, 254, fpin
)) {
29 * ignore lines that begin with #, / and such
42 void save_command_history(char *line
)
47 while (isspace(*c
) && *c
)
51 strncpy(commandhistory
[lastcommand
], c
, 254);
53 if (maxcommands
< COMMANDHISTSIZE
- 1)
55 if (lastcommand
== COMMANDHISTSIZE
)
57 commandpointer
= lastcommand
;
61 process_save_qmark(const char *bm
, WebKitWebView
*webview
)
65 const char *uri
= webkit_web_view_get_uri(webview
);
72 if ( mark
< 1 || mark
> 9 )
75 a
.s
= g_strdup_printf("Invalid quickmark, only 1-9");
80 if ( uri
== NULL
) return FALSE
;
81 for( i
=0; i
< 9; ++i
) strcpy( qmarks
[i
], "");
83 filename
= g_strdup_printf(QUICKMARK_FILE
);
85 /* get current quickmarks */
87 fp
= fopen(filename
, "r");
89 for( i
=0; i
< 10; ++i
) {
95 while (buf
[l
] && l
< 100 && buf
[l
] != '\n') {
104 /* save quickmarks */
105 strcpy( qmarks
[mark
-1], uri
);
106 fp
= fopen(filename
, "w");
107 if (fp
== NULL
) return FALSE
;
108 for( i
=0; i
< 10; ++i
)
109 fprintf(fp
, "%s\n", qmarks
[i
]);
112 a
.s
= g_strdup_printf("Saved as quickmark %d: %s", mark
, uri
);