| 1023 | */ |
| 1024 | |
| 1025 | void |
| 1026 | _cupsSetDefaults(void) |
| 1027 | { |
| 1028 | cups_file_t *fp; /* File */ |
| 1029 | char filename[1024]; /* Filename */ |
| 1030 | _cups_client_conf_t cc; /* client.conf values */ |
| 1031 | _cups_globals_t *cg = _cupsGlobals(); /* Pointer to library globals */ |
| 1032 | |
| 1033 | |
| 1034 | DEBUG_puts("_cupsSetDefaults()"); |
| 1035 | |
| 1036 | /* |
| 1037 | * Load initial client.conf values... |
| 1038 | */ |
| 1039 | |
| 1040 | cups_init_client_conf(&cc); |
| 1041 | |
| 1042 | /* |
| 1043 | * Read the /etc/cups/client.conf and ~/.cups/client.conf files, if |
| 1044 | * present. |
| 1045 | */ |
| 1046 | |
| 1047 | snprintf(filename, sizeof(filename), "%s/client.conf", cg->cups_serverroot); |
| 1048 | if ((fp = cupsFileOpen(filename, "r")) != NULL) |
| 1049 | { |
| 1050 | cups_read_client_conf(fp, &cc); |
| 1051 | cupsFileClose(fp); |
| 1052 | } |
| 1053 | |
| 1054 | if (cg->home) |
| 1055 | { |
| 1056 | /* |
| 1057 | * Look for ~/.cups/client.conf... |
| 1058 | */ |
| 1059 | |
| 1060 | #if _WIN32 |
| 1061 | snprintf(filename, sizeof(filename), "%s/AppData/Local/cups/client.conf", cg->home); |
| 1062 | #else |
| 1063 | snprintf(filename, sizeof(filename), "%s/.cups/client.conf", cg->home); |
| 1064 | #endif // _WIN32 |
| 1065 | |
| 1066 | if ((fp = cupsFileOpen(filename, "r")) != NULL) |
| 1067 | { |
| 1068 | cups_read_client_conf(fp, &cc); |
| 1069 | cupsFileClose(fp); |
| 1070 | } |
| 1071 | } |
| 1072 | |
| 1073 | /* |
| 1074 | * Finalize things so every client.conf value is set... |
| 1075 | */ |
| 1076 | |
| 1077 | cups_finalize_client_conf(&cc); |
| 1078 | |
| 1079 | cg->uatokens = cc.uatokens; |
| 1080 | |
| 1081 | if (cg->encryption == (http_encryption_t)-1) |
| 1082 | cg->encryption = cc.encryption; |
no test coverage detected