26 |
#include <sys/stat.h> /* stat */ |
#include <sys/stat.h> /* stat */ |
27 |
#include <sys/time.h> /* gettimeofday */ |
#include <sys/time.h> /* gettimeofday */ |
28 |
#include <sys/times.h> /* times */ |
#include <sys/times.h> /* times */ |
29 |
|
#include <ctype.h> /* toupper */ |
30 |
#include <errno.h> |
#include <errno.h> |
31 |
#include "rdesktop.h" |
#include "rdesktop.h" |
32 |
|
|
749 |
next_arg(char *src, char needle) |
next_arg(char *src, char needle) |
750 |
{ |
{ |
751 |
char *nextval; |
char *nextval; |
752 |
|
char *p; |
753 |
|
char *mvp = 0; |
754 |
|
|
755 |
// EOS |
/* EOS */ |
756 |
if (*src == (char) 0x00) |
if (*src == (char) 0x00) |
757 |
return 0; |
return 0; |
758 |
|
|
759 |
// more args available. |
p = src; |
760 |
nextval = strchr(src, needle); |
/* skip escaped needles */ |
761 |
|
while( (nextval = strchr(p, needle) ) ) |
762 |
|
{ |
763 |
|
mvp = nextval - 1; |
764 |
|
/* found backslashed needle */ |
765 |
|
if( *mvp == '\\' && (mvp > src) ) |
766 |
|
{ |
767 |
|
/* move string one to the left */ |
768 |
|
while( *(mvp+1) != (char)0x00 ) |
769 |
|
{ |
770 |
|
*mvp = *(mvp+1); |
771 |
|
*mvp++; |
772 |
|
} |
773 |
|
*mvp = (char)0x00; |
774 |
|
p = nextval; |
775 |
|
} |
776 |
|
else |
777 |
|
{ |
778 |
|
p = nextval +1; |
779 |
|
break; |
780 |
|
} |
781 |
|
|
782 |
|
} |
783 |
|
|
784 |
|
/* more args available */ |
785 |
if (nextval) |
if (nextval) |
786 |
{ |
{ |
787 |
*nextval = (char) 0x00; |
*nextval = (char) 0x00; |
788 |
return ++nextval; |
return ++nextval; |
789 |
} |
} |
790 |
|
|
791 |
// no more args after this, jump to EOS |
/* no more args after this, jump to EOS */ |
792 |
nextval = src + strlen(src); |
nextval = src + strlen(src); |
793 |
return nextval; |
return nextval; |
794 |
} |
} |
795 |
|
|
796 |
|
|
797 |
char * |
void |
798 |
toupper(char* p) |
toupper_str(char* p) |
799 |
{ |
{ |
800 |
while( *p ){ |
while( *p ){ |
801 |
if( (*p >= 'a') && (*p <= 'z') ) |
if( (*p >= 'a') && (*p <= 'z') ) |
802 |
*p = *p - 32; |
*p = toupper((int) *p); |
803 |
p++; |
p++; |
804 |
} |
} |
805 |
} |
} |