MCPcopy Create free account
hub / github.com/NetHack/NetHack / main

Function main

util/dlb_main.c:148–476  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

146#endif
147
148DISABLE_WARNING_UNREACHABLE_CODE
149
150int
151main(int argc UNUSED_if_no_DLB, char **argv UNUSED_if_no_DLB)
152{
153#ifdef DLB
154#ifdef DLBLIB
155 int i, r;
156 int ap = 2; /* argument pointer */
157 int cp; /* command pointer */
158 int iseen = 0, fseen = 0, verbose = 0; /* flags */
159 char action = ' ';
160 library lib;
161
162 if (argc > 0)
163 progname = argv[0];
164 if (!progname || !*progname)
165 progname = default_progname;
166#ifdef VMS
167 progname = vms_basename(progname, FALSE);
168#endif
169
170 if (argc < 2) {
171 usage();
172 /* doesn't return */
173 }
174
175 for (cp = 0; argv[1][cp]; cp++) {
176 switch (argv[1][cp]) {
177 default:
178 usage(); /* doesn't return */
179 /*NOTREACHED*/
180 break;
181 case '-': /* silently ignore */
182 break;
183 case '?':
184 case 'h':
185 verbose_help();
186 /*NOTREACHED*/
187 break;
188 case 'I':
189 if (ap == argc)
190 usage();
191 list_file = argv[ap++];
192 if (iseen)
193 printf("Warning: multiple I options. Previous ignored.\n");
194 iseen = 1;
195 break;
196 case 'f':
197 if (ap == argc)
198 usage();
199 library_file = argv[ap++];
200#ifdef VERSION_IN_DLB_FILENAME
201 library_file = build_dlb_filename(library_file);
202#endif
203 if (fseen)
204 printf("Warning: multiple f options. Previous ignored.\n");
205 fseen = 1;

Callers

nothing calls this directly

Calls 15

verbose_helpFunction · 0.85
printfFunction · 0.85
build_dlb_filenameFunction · 0.85
getcwdFunction · 0.85
xexitFunction · 0.85
open_libraryFunction · 0.85
close_libraryFunction · 0.85
fseekFunction · 0.85
openFunction · 0.85
freadFunction · 0.85
writeFunction · 0.85
closeFunction · 0.85

Tested by

no test coverage detected