console_cmds.c
changeset 1019 6bae6c11e865
parent 934 747e52f64119
child 1023 1ae7b7a78602
equal deleted inserted replaced
1018:3212d4365653 1019:6bae6c11e865
   215 	int pos = 0;
   215 	int pos = 0;
   216 	_iconsole_var* result;
   216 	_iconsole_var* result;
   217 
   217 
   218 
   218 
   219 	result = IConsoleVarAlloc(ICONSOLE_VAR_STRING);
   219 	result = IConsoleVarAlloc(ICONSOLE_VAR_STRING);
   220 	
   220 
   221 	if (argc <= 1) {
   221 	if (argc <= 1) {
   222 		IConsoleVarSetString(result, "0");
   222 		IConsoleVarSetString(result, "0");
   223 		return result; // return an zero
   223 		return result; // return an zero
   224 	}
   224 	}
   225 
   225 
   227 	BuildFileList();
   227 	BuildFileList();
   228 
   228 
   229 	/* As long as we have files */
   229 	/* As long as we have files */
   230 	while (pos < _fios_num) {
   230 	while (pos < _fios_num) {
   231 		item = _fios_list + pos;
   231 		item = _fios_list + pos;
   232 		pos++;		
   232 		pos++;
   233 		if (strcmp(argv[1], "..") == 0) {
   233 		if (strcmp(argv[1], "..") == 0) {
   234 			if (item->type == FIOS_TYPE_PARENT) {
   234 			if (item->type == FIOS_TYPE_PARENT) {
   235 				// huh we are searching for the parent directory
   235 				// huh we are searching for the parent directory
   236 				char buffer[10];
   236 				char buffer[10];
   237 				sprintf(buffer, "%d", pos);
   237 				sprintf(buffer, "%d", pos);
   238 				IConsoleVarSetString(result, buffer);
   238 				IConsoleVarSetString(result, buffer);
   239 				return result;
   239 				return result;
   240 			}
   240 			}
   241 		} else 
   241 		} else
   242 			// file records ?
   242 			// file records ?
   243 			if (item->type == FIOS_TYPE_FILE) {
   243 			if (item->type == FIOS_TYPE_FILE) {
   244 				if (strcmp(argv[1], item->name) == 0) {
   244 				if (strcmp(argv[1], item->name) == 0) {
   245 					char buffer[10];
   245 					char buffer[10];
   246 					sprintf(buffer, "%d", pos);
   246 					sprintf(buffer, "%d", pos);
   247 					IConsoleVarSetString(result, buffer);
   247 					IConsoleVarSetString(result, buffer);
   248 					return result;
   248 					return result;
   249 				}			
   249 				}
   250 			}
   250 			}
   251 	}
   251 	}
   252 
   252 
   253 	/* Destroy the file list */
   253 	/* Destroy the file list */
   254 	FiosFreeSavegameList();
   254 	FiosFreeSavegameList();