comparison nnchat.c @ 112:c4865ac2386c

Fix right-side trimming of command line.
author Matti Hamalainen <ccr@tnsp.org>
date Sun, 24 Oct 2010 21:38:17 +0300
parents 9db08807018f
children 2a53156e7e12
comparison
equal deleted inserted replaced
111:9db08807018f 112:c4865ac2386c
557 { 557 {
558 char *tmpStr, tmpBuf[4096]; 558 char *tmpStr, tmpBuf[4096];
559 BOOL result; 559 BOOL result;
560 560
561 /* Trim right */ 561 /* Trim right */
562 buf[--bufLen] = 0; 562 bufLen--;
563 buf[bufLen--] = 0;
563 while (bufLen > 0 && (buf[bufLen] == '\n' || buf[bufLen] == '\r' || th_isspace(buf[bufLen]))) 564 while (bufLen > 0 && (buf[bufLen] == '\n' || buf[bufLen] == '\r' || th_isspace(buf[bufLen])))
564 buf[bufLen--] = 0; 565 buf[bufLen--] = 0;
565 566
566 /* Check for special user commands */ 567 /* Check for special user commands */
567 if (*buf == 0) { 568 if (*buf == 0) {
583 pid_t pud; 584 pid_t pud;
584 tmpStr = nn_encode_str1(name); 585 tmpStr = nn_encode_str1(name);
585 snprintf(tmpBuf, sizeof(tmpBuf), "firefox -remote \"openurl(http://www.newbienudes.com/profile/%s/,new-tab)\"", tmpStr); 586 snprintf(tmpBuf, sizeof(tmpBuf), "firefox -remote \"openurl(http://www.newbienudes.com/profile/%s/,new-tab)\"", tmpStr);
586 th_free(tmpStr); 587 th_free(tmpStr);
587 588
588 printMsg("Opening profile for: %s\n", name); 589 printMsg("Opening profile for: '%s'\n", name);
589 printMsg("%s\n", tmpBuf); 590 printMsg("%s\n", tmpBuf);
590 system(tmpBuf); 591 system(tmpBuf);
591 return 0; 592 return 0;
592 } else if (!strncasecmp(buf, "/to ", 4)) { 593 } else if (!strncasecmp(buf, "/to ", 4)) {
593 /* Set private messaging target */ 594 /* Set private messaging target */