Enlightenment CVS committal
Author : handyande
Project : misc
Module : enotes
Dir : misc/enotes/src
Modified Files:
note.c
Log Message:
Fix note title for blank first lines and blank messages
===================================================================
RCS file: /cvsroot/enlightenment/misc/enotes/src/note.c,v
retrieving revision 1.56
retrieving revision 1.57
diff -u -3 -r1.56 -r1.57
--- note.c 3 Feb 2006 22:41:15 -0000 1.56
+++ note.c 12 Mar 2006 17:20:46 -0000 1.57
@@ -778,25 +778,31 @@
char *
get_title_by_content(char *content)
{
- char *cont;
- int newlength;
+ char *cont, *start;
+ int newlength, i;
if (!content)
return NULL;
- newlength = 0;
+ newlength = i = 0;
- while (newlength < TITLE_LENGTH && cont != NULL) {
- if (content[newlength] == '\n') {
- break;
+ start = content;
+ while (newlength < TITLE_LENGTH && content[i] != '\0') {
+ if (content[i++] == '\n') {
+ if (newlength == 0) {
+ start++;
+ continue;
+ } else {
+ break;
+ }
}
newlength++;
}
if (newlength == 0)
- newlength = TITLE_LENGTH;
+ return "(blank)";
cont = malloc((newlength + 1) * sizeof(char));
- snprintf(cont, newlength + 1, "%s", content);
+ snprintf(cont, newlength + 1, "%s", start);
return cont;
}
-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
enlightenment-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs