Skip to content

Commit

Permalink
Version 1.11.1a.
Browse files Browse the repository at this point in the history
Another attempt to fix Issue #10.
OPML: fixed issue where the first and last items in expansionState
got skipped on open/read.
  • Loading branch information
larrykollar committed Dec 9, 2017
1 parent 5d6ceaa commit cbf1904
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 26 deletions.
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ target_os != uname

# Set install flags based on OS
ifeq "$(target_os)" "Linux"
INSTFLAGS=-D -d
else
INSTFLAGS=-d
else
INSTFLAGS=-D
endif

# Install directories
Expand Down
2 changes: 1 addition & 1 deletion src/config.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

#define PACKAGE "tines"
#define VERSION "1.11.1"
#define VERSION "1.11.1a"
#define SHAREDIR "/usr/local/share/tines/"
#define RCFILEIN "tinesrc"
#define RCFILEOUT ".tinesrc"
Expand Down
19 changes: 9 additions & 10 deletions src/file_opml.c
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ static void* export_opml (int argc, char **argv, void *data)
if( opml_owner[0] == '\0' ) /* set owner too */
strcpy( opml_owner, getenv("USER") );

strcpy( opml_scroll, argc==3?argv[2]:"1" ); /* pos = vertScrollState */
strcpy( opml_scroll, argc>=3?argv[2]:"1" ); /* pos = vertScrollState */

if( opml_top[0] == '\0' ) strcpy(opml_top, "20");
if( opml_left[0] == '\0' ) strcpy(opml_left, "20");
Expand All @@ -192,7 +192,7 @@ static void* export_opml (int argc, char **argv, void *data)

fprintf (file, "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" );
if( prefs.savepos )
fprintf(file, "<?tines pos=\"%s\"?>\n", argc==3?argv[2]:"1" );
fprintf(file, "<?tines pos=\"%s\"?>\n", argc>=3?argv[2]:"1" );
fprintf(file,
"<!-- generated by tines %s (https://github.com/larrykollar/tines) -->\n\
<opml version=\"1.0\">\n", VERSION);
Expand Down Expand Up @@ -371,7 +371,7 @@ static void* import_opml (int argc, char **argv, void *data)
char *att_name=strdup(rdata);
char *unquoted;
if(xml_tok_get(s,&rdata)!=t_val){
cli_outfun("import_opml: OPML violation: attribute has no value");
cli_outfunf("import_opml: OPML violation: attribute '%s' has no value, line %d", att_name, s->line_no);
};
unquoted=string_replace(rdata,xmlunquote);

Expand Down Expand Up @@ -413,22 +413,23 @@ char *opml_list_expanded( int init, Node *node, int saveall ) {
static char explist[1025] = "";
char entry[10];
static int explen = 0;
static int opml_nodenum = 1;
static int opml_nodenum = 0;

if( init ) { /* need to reset these for 2nd export */
explist[0] = '\0';
explen = 0;
opml_nodenum = 1;
opml_nodenum = 0;
}

while( node ) {
if (node_getflag(node,F_expanded)) {
++opml_nodenum;
if (node_getflag(node,F_expanded)) { /* add node number to list */
sprintf( entry, ",%d", opml_nodenum );
explen += strlen( entry );
if( explen < 1025 )
strcat( explist, entry );
}
if (node_right (node)) {
if (node_right (node)) { /* recurse into sub-entries */
opml_list_expanded( 0, node_right(node), 1 );
}

Expand All @@ -437,8 +438,6 @@ char *opml_list_expanded( int init, Node *node, int saveall ) {
node = node_down (node);
else
break;

++opml_nodenum;
}
return (char *)explist+1; /* skip initial comma */
}
Expand All @@ -451,7 +450,7 @@ int opml_check_expanded( int num, char *explist ) {
sprintf( fullsize, ",%s,", explist ); /* put commas on either end of list */
sprintf( entry, ",%d,", num ); /* now we only have to search once */

if( strstr(explist, entry) )
if( strstr(fullsize, entry) )
return 1;
else
return 0;
Expand Down
26 changes: 13 additions & 13 deletions src/tines.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
std. oppretting
redigering
gå til parent
--
sannsynlig grunn: feil håndtering av temporary attributte
Expand Down Expand Up @@ -85,9 +85,9 @@ Options:\n\
fprintf (stderr, "\t-s --stylized load stylized xml (using libxml2)\n");
#endif
fprintf (stderr, "\n\
\t-rc=<file> specify a different config file\n\
\t-ui=<interface> interface to use, curses (default) or CLI\n\
\t-e execute commands\n\
\t--rc=<file> specify a different config file\n\
\t--ui=<interface> interface to use, curses (default) or CLI\n\
\t-e <cmds> execute commands\n\
\n\n");
}

Expand All @@ -100,7 +100,7 @@ int main (int argc, char **argv)
int argno;

/* current commandline argument in focus */

int recover=0; /* whether in recover mode */

struct { /* initialized defaults */
Expand Down Expand Up @@ -174,7 +174,7 @@ int main (int argc, char **argv)
} else if(!strcmp(optarg, "keygrab")) {
cmdline.ui = 4;
} else {
fprintf(stderr, "unknown -ui option: %s\n", optarg);
fprintf(stderr, "unknown --ui option: %s\n", optarg);
usage( progname );
exit(1);
}
Expand Down Expand Up @@ -277,16 +277,16 @@ int main (int argc, char **argv)
char file_to_load[PREFS_FN_LEN];

strcpy(file_to_load, prefs.db_file);

{ /* check for recovery file */
char recovery_file[PREFS_FN_LEN];
FILE *tfile;

struct stat statbuf;
long file_modified;
stat(prefs.db_file, &statbuf);
file_modified=statbuf.st_ctime;

snprintf(recovery_file, PREFS_FN_LEN, "%s_tines_rescue", prefs.db_file);
tfile = fopen(recovery_file, "r");
if(tfile){
Expand All @@ -299,7 +299,7 @@ int main (int argc, char **argv)

if(ui_inited)
ui_end();

fclose(tfile);
while(!got_response){
fprintf(stderr, "A recovery file (%s) exists.\n\
Expand Down Expand Up @@ -339,7 +339,7 @@ o)pen read_only\n\
ui_init();
}
}

if (!recover && (
!strcmp(prefs.format,"opml") ||
!strcmp(prefs.format,"hnb") ||
Expand Down Expand Up @@ -430,8 +430,8 @@ o)pen read_only\n\
ui_end ();
break;
case 0: /* -e */
pos = (Node *) cli_docmd (cmdline.cmd, pos);
while (argno < argc) {
/* pos = (Node *) cli_docmd (cmdline.cmd, pos); */ /* issue #12 */
while (argno <= argc) {
pos = (Node *) cli_docmd (argv[argno++], pos);
}
break;
Expand Down

0 comments on commit cbf1904

Please sign in to comment.