Changeset 265 for trunk/launch/launch/main.c
- Timestamp:
- 07/20/06 11:16:20 (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/launch/launch/main.c
r214 r265 33 33 const char *APP_NAME; 34 34 35 #define VERSION "1.1d 1"35 #define VERSION "1.1d2" 36 36 37 37 #define STRBUF_LEN 1024 … … 92 92 93 93 void usage() { 94 fprintf(stderr, "usage: %s [-npswbmhCX U] [-c creator] [-i bundleID] [-u URL] [-a name] [-o argument] [item ...] [-]\n"95 " or: %s [-npflswbmhCX U] [-o argument] item ...\n", APP_NAME, APP_NAME);94 fprintf(stderr, "usage: %s [-npswbmhCXLU] [-c creator] [-i bundleID] [-u URL] [-a name] [-o argument] [item ...] [-]\n" 95 " or: %s [-npflswbmhCXLU] [-o argument] item ...\n", APP_NAME, APP_NAME); 96 96 fprintf(stderr, 97 97 " -n print matching paths/URLs instead of opening them\n" … … 108 108 " -C force CFM/PEF Carbon application to launch in Classic\n" 109 109 " -X don't start Classic for this app if Classic isn't running\n" 110 " -L suppress normal opening behavior (e.g. untitled window)\n" 110 111 " -U interpret items as URLs, even if same-named files exist\n" 111 112 " -c creator match application by four-character creator code ('ToyS')\n" … … 331 332 if (argc == 1) usage(); 332 333 333 while ( (ch = getopt(argc, argv, "npflswbmhCX Uc:i:u:a:o:")) != -1) {334 while ( (ch = getopt(argc, argv, "npflswbmhCXLUc:i:u:a:o:")) != -1) { 334 335 switch (ch) { 335 336 case 'n': … … 374 375 case 'C': LPARAMS.flags |= kLSLaunchInClassic; break; // force Classic 375 376 case 'X': LPARAMS.flags ^= kLSLaunchStartClassic; break;// don't start Classic for app 377 case 'L': 378 { 379 OSStatus err; 380 LPARAMS.initialEvent = malloc(sizeof(AppleEvent)); 381 err = AECreateAppleEvent(kASAppleScriptSuite, kASLaunchEvent, NULL, kAutoGenerateReturnID, kAnyTransactionID, LPARAMS.initialEvent); 382 if (err != noErr) osstatusexit(err, "unable to construct launch Apple Event", argv[0]); 383 } 376 384 case 'U': OPTS.forceURLs = true; break; 377 385 case 'c': … … 531 539 532 540 void printDateTime(const char *label, UTCDateTime *utcTime, const char *postLabel, Boolean printIfEmpty) { 533 static Str255 dateStr, timeStr; 534 LocalDateTime localTime; 535 LongDateTime longTime; 541 static CFDateFormatterRef formatter = NULL; 542 static char strBuffer[STRBUF_LEN]; 543 if (formatter == NULL) { 544 formatter = CFDateFormatterCreate(NULL, CFLocaleCopyCurrent(), kCFDateFormatterShortStyle, kCFDateFormatterMediumStyle); 545 } 546 CFAbsoluteTime absoluteTime; 536 547 OSStatus err; 537 548 538 err = ConvertUTCToLocalDateTime(utcTime, &localTime);549 err = UCConvertUTCDateTimeToCFAbsoluteTime(utcTime, &absoluteTime); 539 550 if (err == kUTCUnderflowErr) { 540 551 if (printIfEmpty) printf("\t%s: (not set)\n", label); 541 552 return; 542 553 } 543 if (err != noErr) osstatusexit(err, "unable to convert UTC %s date to local", label); 544 545 longTime = localTime.highSeconds; 546 longTime <<= 32; 547 longTime |= localTime.lowSeconds; 548 549 // strings include trailing newlines; strip them. 550 LongDateString(&longTime, shortDate, dateStr, nil); dateStr[dateStr[0] + 1] = '\0'; 551 LongTimeString(&longTime, true, timeStr, nil); timeStr[timeStr[0] + 1] = '\0'; 552 printf("\t%s: %s %s%s\n", label, dateStr + 1, timeStr + 1, postLabel); 554 if (err != noErr) osstatusexit(err, "unable to convert UTC %s time", label); 555 556 CFStringRef dateTimeString = CFDateFormatterCreateStringWithAbsoluteTime(NULL, formatter, absoluteTime); 557 CFStringGetCString(dateTimeString, strBuffer, STRBUF_LEN, kCFStringEncodingUTF8); 558 559 printf("\t%s: %s%s\n", label, strBuffer, postLabel); 553 560 } 554 561
Note:
See TracChangeset
for help on using the changeset viewer.