summaryrefslogtreecommitdiff
path: root/firmware/common/pathfuncs.c
diff options
context:
space:
mode:
authorSolomon Peachy <pizza@shaftnet.org>2024-07-26 23:35:00 -0400
committerSolomon Peachy <pizza@shaftnet.org>2024-07-28 16:54:33 -0400
commit78283bda64ee09502029cd2eee459fef1bd31385 (patch)
tree18ca528eec4e8610c659fd89c0d5de23ef9005d4 /firmware/common/pathfuncs.c
parent70b96193e7950391e7fcbdabad6daebe8b87e4f5 (diff)
downloadrockbox-78283bda64ee09502029cd2eee459fef1bd31385.tar.gz
rockbox-78283bda64ee09502029cd2eee459fef1bd31385.zip
talk: Voice the volume name when browsing and when voicing full paths
Change-Id: I56660e168edd135a09cd5c021504a58ec9d40093
Diffstat (limited to 'firmware/common/pathfuncs.c')
-rw-r--r--firmware/common/pathfuncs.c30
1 files changed, 29 insertions, 1 deletions
diff --git a/firmware/common/pathfuncs.c b/firmware/common/pathfuncs.c
index db1935db8b..b5e5ecb0cf 100644
--- a/firmware/common/pathfuncs.c
+++ b/firmware/common/pathfuncs.c
@@ -127,7 +127,35 @@ void init_volume_names(void)
127 VOL_START_TOK, voldec, volume, VOL_END_TOK); 127 VOL_START_TOK, voldec, volume, VOL_END_TOK);
128 DEBUGF("vol<%d> = %s ", volume, buffer); 128 DEBUGF("vol<%d> = %s ", volume, buffer);
129 } 129 }
130 DEBUGF("\n"); 130 DEBUGF("\n");
131}
132
133#include <stdio.h>
134
135int path_get_volume_id(const char *name)
136{
137 int v = -1;
138
139 if (!name || *name != VOL_START_TOK)
140 goto bail;
141
142 do {
143 switch (*name)
144 {
145 case '0' ... '9': /* digit; parse volume number */
146 v = (v * 10 + *name - '0') % VOL_NUM_MAX;
147 break;
148 case '\0':
149 case PATH_SEPCH: /* no closing bracket; no volume */
150 v = -1;
151 goto bail;
152 default: /* something else; reset volume */
153 v = 0;
154 }
155 } while (*++name != VOL_END_TOK); /* found end token? */
156
157bail:
158 return v;
131} 159}
132 160
133/* Returns on which volume this is and sets *nameptr to the portion of the 161/* Returns on which volume this is and sets *nameptr to the portion of the