static int _parse_route(RouteRef route) { char *actionorid,*next; char* url = route->_url; if (url[0]=='/') url++; route->_application = url; if ((route->_model = _tok(url)) == NULL) return 0; if ((actionorid = _tok(route->_model)) == NULL) return 1; next = _tok(actionorid); if (_isid(actionorid)) { route->_id = actionorid; route->_action = next; } else { route->_id = next; route->_action = actionorid; } _tok(next); return 1; }
static bool _GetRoute(char* url, RouteRef route) { char *actionorid,*next; memset(route, 0, sizeof(route[0])); if (url[0]=='/') url++; route->_application = url; if ((route->_model = _tok(url)) == NULL) return false; if ((actionorid = _tok(route->_model)) == NULL) return true; next = _tok(actionorid); if (_isid(actionorid)) { route->_id = actionorid; route->_action = next; } else { route->_id = next; route->_action = actionorid; } _tok(next); return true; }