MCPcopy Index your code
hub / github.com/NetHack/NetHack / main

Function main

util/sfctool.c:166–289  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

164 *********/
165
166int
167main(int argc, char *argv[])
168{
169 int arg;
170 char folderbuf[5000];
171 const char *suffix = (convertstyle == exportascii) ? ".exportascii" : "";
172 boolean add_folder = TRUE, add_extension = FALSE;
173
174#ifdef WIN32
175 const char *default_extension = ".NetHack-saved-game";
176 size_t sz;
177#else
178 const char *default_extension = "";
179#endif
180
181 runtime_info_init(); /* mdlib.c */
182#ifdef UNIX
183 folderbuf[0] = '.';
184 folderbuf[1] = '/';
185 folderbuf[2] = '\0';
186#ifdef CHDIR
187 chdirx(HACKDIR, FALSE);
188#endif
189#endif
190#ifdef UNIX
191 Strcpy(folderbuf, "save/");
192#endif
193#ifdef WIN32
194 if (!get_user_home_folder(folderbuf, sizeof folderbuf))
195 exit(EXIT_FAILURE);
196 sz = strlen(folderbuf);
197 (void) snprintf(eos(folderbuf), sizeof folderbuf - sz,
198 "\\AppData\\Local\\NetHack\\5.0\\");
199 // initoptions_init(); // This allows OPTIONS in syscf on Windows.
200 set_default_prefix_locations(argv[0]);
201#endif
202
203 read_sysconf();
204 thisdatamodel = datamodel(0);
205 if (argc < 3 && !(argc == 2 && !strcmp(argv[1], "-d"))) {
206 usage(argc, argv);
207 exit(EXIT_FAILURE);
208 }
209 for (arg = 1; arg < argc; ++arg) {
210 if (arg == 1 && !strcmp(argv[arg], "-d")) {
211 fprintf(
212 stdout,
213 "\nThe historical savefile datamodel supported by this utility is %s (%s).\n",
214 thisdatamodel, datamodel(1));
215 exit(EXIT_SUCCESS);
216 }
217
218 if (arg == 1 && !strcmp(argv[arg], "-u")) {
219 explicit_option = TRUE;
220 chosen_unconvert = TRUE;
221 continue;
222 }
223 if (arg == 1 && !strcmp(argv[arg], "-c")) {

Callers

nothing calls this directly

Calls 12

runtime_info_initFunction · 0.85
get_user_home_folderFunction · 0.85
eosFunction · 0.85
read_sysconfFunction · 0.85
datamodelFunction · 0.85
fprintfFunction · 0.85
contains_directoryFunction · 0.85
my_sf_initFunction · 0.85
process_savefileFunction · 0.85
chdirxFunction · 0.70
usageFunction · 0.70
allocFunction · 0.50

Tested by

no test coverage detected