• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

external/ppp


Commit MetaInfo

Revisión1661f734d42e48458fc62f5c6413c308481b4e5a (tree)
Tiempo2009-12-15 09:33:00
AutorChia-chi Yeh <chiachi@andr...>
CommiterChia-chi Yeh

Log Message

Add support to get information from environment variables.

Bug: 2325838
Change-Id: I2e1df5a71aead40063f82cc0dda222f370ad4043

Cambiar Resumen

Diferencia incremental

--- a/pppd/main.c
+++ b/pppd/main.c
@@ -360,16 +360,39 @@ main(argc, argv)
360360 */
361361 tty_init();
362362
363+ progname = *argv;
364+
363365 #ifdef ANDROID_CHANGES
364366 {
365367 extern void pppox_init();
366368 pppox_init();
367369 privileged = 1;
368370 }
371+ {
372+ char *envargs = getenv("envargs");
373+ if (envargs) {
374+ int i;
375+ /* Decode the arguments in-place and count the number of them.
376+ * They were hex encoded using [A-P] instead of [0-9A-F]. */
377+ for (argc = 0, i = 0; envargs[i] && envargs[i + 1]; i += 2) {
378+ char c = ((envargs[i] - 'A') << 4) + (envargs[i + 1] - 'A');
379+ if (c == 0) {
380+ ++argc;
381+ }
382+ envargs[i / 2 + 1] = c;
383+ }
384+ if (argc == 0 || (argv = malloc(sizeof(char *) * argc)) == NULL) {
385+ fatal("Failed to parse envargs!");
386+ }
387+ for (envargs[0] = 0, i = 0; i < argc; ++envargs) {
388+ if (envargs[0] == 0) {
389+ argv[i++] = &envargs[1];
390+ }
391+ }
392+ }
393+ }
369394 #endif
370395
371- progname = *argv;
372-
373396 /*
374397 * Parse, in order, the system options file, the user's options file,
375398 * and the command line arguments.