/* ** Tries to figure out a timeline query length limit base on ** environment parameters. If it can it returns that value, ** else it returns some statically defined default value. ** ** Never returns a negative value. 0 means no limit. */ static int json_timeline_limit(int defaultLimit){ int limit = -1; if(!g.isHTTP){/* CLI mode */ char const * arg = find_option("limit","n",1); if(arg && *arg){ limit = atoi(arg); } } if( (limit<0) && fossil_has_json() ){ limit = json_getenv_int("limit",-1); } return (limit<0) ? defaultLimit : limit; }
/* ** Convert the name in CGI parameter zParamName into a rid and return that ** rid. If the CGI parameter is missing or is not a valid artifact tag, ** return 0. If the CGI parameter is ambiguous, redirect to a page that ** shows all possibilities and do not return. */ int name_to_rid_www(const char *zParamName){ int rid; const char *zName = P(zParamName); #ifdef FOSSIL_ENABLE_JSON if(!zName && fossil_has_json()){ zName = json_find_option_cstr(zParamName,NULL,NULL); } #endif if( zName==0 || zName[0]==0 ) return 0; rid = symbolic_name_to_rid(zName, "*"); if( rid<0 ){ cgi_redirectf("%s/ambiguous/%T?src=%t", g.zTop, zName, g.zPath); rid = 0; } return rid; }