- Timestamp:
- 2010-04-12T00:06:49Z (15 years ago)
- Branches:
- master
- Children:
- 89c11e7
- Parents:
- e21c0f8
- Location:
- lib
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
lib/misc.c
re21c0f8 r24b8bbb 614 614 return ret; 615 615 } 616 617 char **split_command_parts( char *command ) 618 { 619 static char *cmd[IRC_MAX_ARGS+1]; 620 char *s, q = 0; 621 int k; 622 623 memset( cmd, 0, sizeof( cmd ) ); 624 cmd[0] = command; 625 k = 1; 626 for( s = command; *s && k < IRC_MAX_ARGS; s ++ ) 627 if( *s == ' ' && !q ) 628 { 629 *s = 0; 630 while( *++s == ' ' ); 631 if( *s == '"' || *s == '\'' ) 632 { 633 q = *s; 634 s ++; 635 } 636 if( *s ) 637 { 638 cmd[k++] = s; 639 s --; 640 } 641 else 642 { 643 break; 644 } 645 } 646 else if( *s == '\\' && ( ( !q && s[1] ) || ( q && q == s[1] ) ) ) 647 { 648 char *cpy; 649 650 for( cpy = s; *cpy; cpy ++ ) 651 cpy[0] = cpy[1]; 652 } 653 else if( *s == q ) 654 { 655 q = *s = 0; 656 } 657 cmd[k] = NULL; 658 659 return cmd; 660 } -
lib/misc.h
re21c0f8 r24b8bbb 68 68 G_MODULE_EXPORT int md5_verify_password( char *password, char *hash ); 69 69 70 G_MODULE_EXPORT char **split_command_parts( char *command ); 71 70 72 #endif
Note: See TracChangeset
for help on using the changeset viewer.