Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
| Comment: | eliminate the need for <tchar.h> |
|---|---|
| Timelines: | family | ancestors | descendants | both | trunk |
| Files: | files | file ages | folders |
| SHA1: |
1bfa3a0bbff5c8cda8c7f74e402a6ad9 |
| User & Date: | jan.nijtmans 2012-09-21 11:24:00.928 |
Context
|
2012-09-21
| ||
| 23:32 | Add an apple-touch-icon.png check-in: fd05645df5 user: drh tags: trunk | |
| 11:24 | eliminate the need for <tchar.h> check-in: 1bfa3a0bbf user: jan.nijtmans tags: trunk | |
|
2012-09-20
| ||
| 20:33 | eliminate all #ifdef UNICODE, assuming everthing is compiled with -DUNICODE -D_UNICODE check-in: ad91647ea7 user: jan.nijtmans tags: trunk | |
Changes
Changes to src/main.c.
| ︙ | ︙ | |||
357 358 359 360 361 362 363 | ** quote + quote not in quoted string -> empty string ** quote -> begin quoted string ** ** Results: ** Fills argcPtr with the number of arguments and argvPtr with the array ** of arguments. */ | < | | | | | | | | | | | | | | | | | | | 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 |
** quote + quote not in quoted string -> empty string
** quote -> begin quoted string
**
** Results:
** Fills argcPtr with the number of arguments and argvPtr with the array
** of arguments.
*/
#define wchar_isspace(X) ((X)==' ' || (X)=='\t')
static void parse_windows_command_line(
int *argcPtr, /* Filled with number of argument strings. */
void *argvPtr /* Filled with argument strings (malloc'd). */
){
WCHAR *cmdLine, *p, *arg, *argSpace;
WCHAR **argv;
int argc, size, inquote, copy, slashes;
cmdLine = GetCommandLine();
/*
** Precompute an overly pessimistic guess at the number of arguments in
** the command line by counting non-space spans.
*/
size = 2;
for(p=cmdLine; *p!='\0'; p++){
if( wchar_isspace(*p) ){
size++;
while( wchar_isspace(*p) ){
p++;
}
if( *p=='\0' ){
break;
}
}
}
argSpace = fossil_malloc(size * sizeof(char*)
+ (wcslen(cmdLine) * sizeof(WCHAR)) + sizeof(WCHAR));
argv = (WCHAR**)argSpace;
argSpace += size*(sizeof(char*)/sizeof(WCHAR));
size--;
p = cmdLine;
for(argc=0; argc<size; argc++){
argv[argc] = arg = argSpace;
while( wchar_isspace(*p) ){
p++;
}
if (*p == '\0') {
break;
}
inquote = 0;
slashes = 0;
while(1){
copy = 1;
while( *p=='\\' ){
slashes++;
p++;
}
if( *p=='"' ){
if( (slashes&1)==0 ){
copy = 0;
if( inquote && p[1]=='"' ){
p++;
copy = 1;
}else{
inquote = !inquote;
}
}
slashes >>= 1;
}
while( slashes ){
*arg = '\\';
arg++;
slashes--;
}
if( *p=='\0' || (!inquote && wchar_isspace(*p)) ){
break;
}
if( copy!=0 ){
*arg = *p;
arg++;
}
p++;
}
*arg = '\0';
argSpace = arg + 1;
}
argv[argc] = NULL;
*argcPtr = argc;
*((WCHAR ***)argvPtr) = argv;
}
#endif /* defined(_WIN32) */
/*
** Convert all arguments from mbcs (or unicode) to UTF-8. Then
** search g.argv for arguments "--args FILENAME". If found, then
|
| ︙ | ︙ |
Changes to src/winhttp.c.
| ︙ | ︙ | |||
144 145 146 147 148 149 150 |
){
WSADATA wd;
SOCKET s = INVALID_SOCKET;
SOCKADDR_IN addr;
int idCnt = 0;
int iPort = mnPort;
Blob options;
| | | 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 |
){
WSADATA wd;
SOCKET s = INVALID_SOCKET;
SOCKADDR_IN addr;
int idCnt = 0;
int iPort = mnPort;
Blob options;
WCHAR zTmpPath[MAX_PATH];
if( zStopper ) file_delete(zStopper);
blob_zero(&options);
if( zNotFound ){
blob_appendf(&options, " --notfound %s", zNotFound);
}
if( g.useLocalauth ){
|
| ︙ | ︙ | |||
247 248 249 250 251 252 253 |
*/
typedef struct HttpService HttpService;
struct HttpService {
int port; /* Port on which the http server should run */
const char *zNotFound; /* The --notfound option, or NULL */
int flags; /* One or more HTTP_SERVER_ flags */
int isRunningAsService; /* Are we running as a service ? */
| | | 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 |
*/
typedef struct HttpService HttpService;
struct HttpService {
int port; /* Port on which the http server should run */
const char *zNotFound; /* The --notfound option, or NULL */
int flags; /* One or more HTTP_SERVER_ flags */
int isRunningAsService; /* Are we running as a service ? */
const WCHAR *zServiceName;/* Name of the service */
SOCKET s; /* Socket on which the http server listens */
};
/*
** Variables used for running as windows service.
*/
static HttpService hsData = {8080, NULL, 0, 0, NULL, INVALID_SOCKET};
|
| ︙ | ︙ | |||
382 383 384 385 386 387 388 |
/* Update the service information. */
hsData.isRunningAsService = 1;
if( argc>0 ){
hsData.zServiceName = argv[0];
}
/* Register the service control handler function */
| | | 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 |
/* Update the service information. */
hsData.isRunningAsService = 1;
if( argc>0 ){
hsData.zServiceName = argv[0];
}
/* Register the service control handler function */
sshStatusHandle = RegisterServiceCtrlHandler(L"", win32_http_service_ctrl);
if( !sshStatusHandle ){
win32_report_service_status(SERVICE_STOPPED, NO_ERROR, 0);
return;
}
/* Set service specific data and report that the service is starting. */
ssStatus.dwServiceType = SERVICE_WIN32_OWN_PROCESS;
|
| ︙ | ︙ | |||
427 428 429 430 431 432 433 |
int win32_http_service(
int nPort, /* TCP port number */
const char *zNotFound, /* The --notfound option, or NULL */
int flags /* One or more HTTP_SERVER_ flags */
){
/* Define the service table. */
SERVICE_TABLE_ENTRY ServiceTable[] =
| | | 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 |
int win32_http_service(
int nPort, /* TCP port number */
const char *zNotFound, /* The --notfound option, or NULL */
int flags /* One or more HTTP_SERVER_ flags */
){
/* Define the service table. */
SERVICE_TABLE_ENTRY ServiceTable[] =
{{L"", (LPSERVICE_MAIN_FUNCTION)win32_http_service_main}, {NULL, NULL}};
/* Initialize the HttpService structure. */
hsData.port = nPort;
hsData.zNotFound = zNotFound;
hsData.flags = flags;
/* Try to start the control dispatcher thread for the service. */
|
| ︙ | ︙ | |||
564 565 566 567 568 569 570 |
zMethod = g.argv[2];
n = strlen(zMethod);
if( strncmp(zMethod, "create", n)==0 ){
SC_HANDLE hScm;
SC_HANDLE hSvc;
SERVICE_DESCRIPTION
| | | 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 |
zMethod = g.argv[2];
n = strlen(zMethod);
if( strncmp(zMethod, "create", n)==0 ){
SC_HANDLE hScm;
SC_HANDLE hSvc;
SERVICE_DESCRIPTION
svcDescr = {L"Fossil - Distributed Software Configuration Management"};
char *zErrFmt = "unable to create service '%s': %s";
DWORD dwStartType = SERVICE_DEMAND_START;
const char *zDisplay = find_option("display", "D", 1);
const char *zStart = find_option("start", "S", 1);
const char *zUsername = find_option("username", "U", 1);
const char *zPassword = find_option("password", "W", 1);
const char *zPort = find_option("port", "P", 1);
|
| ︙ | ︙ |