diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/emacs.c | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/src/emacs.c b/src/emacs.c index 41c92a46155..c99b007ea78 100644 --- a/src/emacs.c +++ b/src/emacs.c | |||
| @@ -1342,6 +1342,39 @@ main (int argc, char **argv) | |||
| 1342 | init_standard_fds (); | 1342 | init_standard_fds (); |
| 1343 | atexit (close_output_streams); | 1343 | atexit (close_output_streams); |
| 1344 | 1344 | ||
| 1345 | /* Command-line argument processing. | ||
| 1346 | |||
| 1347 | The arguments in the argv[] array are sorted in the descending | ||
| 1348 | order of their priority as defined in the standard_args[] array | ||
| 1349 | below. Then the sorted arguments are processed from the highest | ||
| 1350 | to the lowest priority. Each command-line argument that is | ||
| 1351 | recognized by 'main', if found in argv[], causes skip_args to be | ||
| 1352 | incremented, effectively removing the processed argument from the | ||
| 1353 | command line. | ||
| 1354 | |||
| 1355 | Then init_cmdargs is called, and conses a list of the unprocessed | ||
| 1356 | command-line arguments, as strings, in 'command-line-args'. It | ||
| 1357 | ignores all the arguments up to the one indexed by skip_args, as | ||
| 1358 | those were already processed. | ||
| 1359 | |||
| 1360 | The arguments in 'command-line-args' are further processed by | ||
| 1361 | startup.el, functions 'command-line' and 'command-line-1'. The | ||
| 1362 | first of them handles the arguments which need to be processed | ||
| 1363 | before loading the user init file and initializing the | ||
| 1364 | window-system. The second one processes the arguments that are | ||
| 1365 | related to the GUI system, like -font, -geometry, and -title, and | ||
| 1366 | then processes the rest of arguments whose priority is below | ||
| 1367 | those that are related to the GUI system. The arguments | ||
| 1368 | porcessed by 'command-line' are removed from 'command-line-args'; | ||
| 1369 | the arguments processed by 'command-line-1' aren't, they are only | ||
| 1370 | removed from 'command-line-args-left'. | ||
| 1371 | |||
| 1372 | 'command-line-1' emits an error message for any argument it | ||
| 1373 | doesn't recognize, so any command-line arguments processed in C | ||
| 1374 | below whose priority is below the GUI system related switches | ||
| 1375 | should be explicitly recognized, ignored, and removed from | ||
| 1376 | 'command-line-args-left' in 'command-line-1'. */ | ||
| 1377 | |||
| 1345 | sort_args (argc, argv); | 1378 | sort_args (argc, argv); |
| 1346 | argc = 0; | 1379 | argc = 0; |
| 1347 | while (argv[argc]) argc++; | 1380 | while (argv[argc]) argc++; |