Check-in [fa4371f3b5]
Not logged in

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
SHA1 Hash:fa4371f3b53de0e3a2ed106b7e0dd4c3c8069e70
Date: 2012-04-06 13:05:15
User: drh
Comment:Cleanup: Move all occurrences of setmode() into fossil_binary_mode.
Tags And Properties
Changes

Changes to src/main.c

710 ** Turn off any NL to CRNL translation on the stream given as an 710 ** Turn off any NL to CRNL translation on the stream given as an 711 ** argument. This is a no-op on unix but is necessary on windows. 711 ** argument. This is a no-op on unix but is necessary on windows. 712 */ 712 */ 713 void fossil_binary_mode(FILE *p){ 713 void fossil_binary_mode(FILE *p){ 714 #if defined(_WIN32) 714 #if defined(_WIN32) 715 _setmode(_fileno(p), _O_BINARY); 715 _setmode(_fileno(p), _O_BINARY); 716 #endif 716 #endif > 717 #ifdef __EMX__ /* OS/2 */ > 718 setmode(fileno(p), O_BINARY); > 719 #endif 717 } 720 } 718 721 719 722 720 723 721 /* 724 /* 722 ** Return a name for an SQLite error code 725 ** Return a name for an SQLite error code 723 */ 726 */ ................................................................................................................................................................................ 1404 if( g.argc==3 && fossil_strcmp(g.argv[1],"cgi")==0 ){ 1407 if( g.argc==3 && fossil_strcmp(g.argv[1],"cgi")==0 ){ 1405 zFile = g.argv[2]; 1408 zFile = g.argv[2]; 1406 }else{ 1409 }else{ 1407 zFile = g.argv[1]; 1410 zFile = g.argv[1]; 1408 } 1411 } 1409 g.httpOut = stdout; 1412 g.httpOut = stdout; 1410 g.httpIn = stdin; 1413 g.httpIn = stdin; 1411 #if defined(_WIN32) | 1414 fossil_binary_mode(g.httpOut); 1412 /* Set binary mode on windows to avoid undesired translations | 1415 fossil_binary_mode(g.httpIn); 1413 ** between \n and \r\n. */ < 1414 setmode(_fileno(g.httpOut), _O_BINARY); < 1415 setmode(_fileno(g.httpIn), _O_BINARY); < 1416 #endif < 1417 #ifdef __EMX__ < 1418 /* Similar hack for OS/2 */ < 1419 setmode(fileno(g.httpOut), O_BINARY); < 1420 setmode(fileno(g.httpIn), O_BINARY); < 1421 #endif < 1422 g.cgiOutput = 1; 1416 g.cgiOutput = 1; 1423 blob_read_from_file(&config, zFile); 1417 blob_read_from_file(&config, zFile); 1424 while( blob_line(&config, &line) ){ 1418 while( blob_line(&config, &line) ){ 1425 if( !blob_token(&line, &key) ) continue; 1419 if( !blob_token(&line, &key) ) continue; 1426 if( blob_buffer(&key)[0]=='#' ) continue; 1420 if( blob_buffer(&key)[0]=='#' ) continue; 1427 if( blob_eq(&key, "debug:") && blob_token(&line, &value) ){ 1421 if( blob_eq(&key, "debug:") && blob_token(&line, &value) ){ 1428 g.fDebug = fopen(blob_str(&value), "a"); 1422 g.fDebug = fopen(blob_str(&value), "a");