586
587
588
589
590
591
592
593
594
595
596
597
598
599
|
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
|
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
|
const char *zTail = file_tail(z);
if( zTail && zTail!=z ){
return mprintf("%.*s", (int)(zTail-z-1), z);
}else{
return 0;
}
}
/*
** Return the basename of the putative executable in a command (w/o arguments).
** The returned memory should be freed via fossil_free().
*/
char *command_basename(const char *z){
const char *zTail = command_tail(z);
const char *zEnd = zTail;
while( zEnd[0] && !fossil_isspace(zEnd[0]) && zEnd[0]!='"' && zEnd[0]!='\'' ){
zEnd++;
}
if( zEnd ){
return mprintf("%.*s", (int)(zEnd-zTail), zTail);
}else{
return 0;
}
}
/* SQL Function: file_dirname(NAME)
**
** Return the directory for NAME
*/
void file_dirname_sql_function(
sqlite3_context *context,
|