119 |
fprintf(stderr, " -a: connection colour depth\n"); |
fprintf(stderr, " -a: connection colour depth\n"); |
120 |
fprintf(stderr, " -r: enable specified device redirection (this flag can be repeated)\n"); |
fprintf(stderr, " -r: enable specified device redirection (this flag can be repeated)\n"); |
121 |
fprintf(stderr, " '-r comport:COM1=/dev/ttyS0': enable serial redirection of /dev/ttyS0 to COM1\n"); |
fprintf(stderr, " '-r comport:COM1=/dev/ttyS0': enable serial redirection of /dev/ttyS0 to COM1\n"); |
122 |
fprintf(stderr, " or :COM1=/dev/ttyS0:9600,0|1|2,0|2,5|6|7|8:dtr \n"); |
fprintf(stderr, " or COM1=/dev/ttyS0,COM2=/dev/ttyS1\n"); |
123 |
fprintf(stderr, " '-r disk:A=/mnt/floppy': enable redirection of /mnt/floppy to A:\n"); |
fprintf(stderr, " '-r disk:A=/mnt/floppy': enable redirection of /mnt/floppy to A:\n"); |
124 |
fprintf(stderr, " or A=/mnt/floppy,D=/mnt/cdrom'\n"); |
fprintf(stderr, " or A=/mnt/floppy,D=/mnt/cdrom'\n"); |
125 |
fprintf(stderr, " '-r lptport:LPT1=/dev/lp0': enable parallel redirection of /dev/lp0 to LPT1\n"); |
fprintf(stderr, " '-r lptport:LPT1=/dev/lp0': enable parallel redirection of /dev/lp0 to LPT1\n"); |
126 |
fprintf(stderr, " or LPT1=/dev/lp0,LPT2=/dev/lp1\n"); |
fprintf(stderr, " or LPT1=/dev/lp0,LPT2=/dev/lp1\n"); |
127 |
fprintf(stderr, " '-r printer:mydeskjet': enable printer redirection\n"); |
fprintf(stderr, " '-r printer:mydeskjet': enable printer redirection\n"); |
128 |
fprintf(stderr, " or mydeskjet:\"HP Laserjet IIIP\" to enter server driver as well\n"); |
fprintf(stderr, " or mydeskjet=\"HP LaserJet IIIP\" to enter server driver as well\n"); |
129 |
fprintf(stderr, " '-r sound': enable sound redirection\n"); |
fprintf(stderr, " '-r sound': enable sound redirection\n"); |
130 |
fprintf(stderr, " -0: attach to console\n"); |
fprintf(stderr, " -0: attach to console\n"); |
131 |
fprintf(stderr, " -4: use RDP version 4\n"); |
fprintf(stderr, " -4: use RDP version 4\n"); |
728 |
} |
} |
729 |
|
|
730 |
/* |
/* |
731 |
input: src is the string we look in for needle |
input: src is the string we look in for needle. |
732 |
|
Needle may be escaped by a backslash, in |
733 |
|
that case we ignore that particular needle. |
734 |
return value: returns next src pointer, for |
return value: returns next src pointer, for |
735 |
succesive executions, like in a while loop |
succesive executions, like in a while loop |
736 |
if retval is 0, then there are no more args. |
if retval is 0, then there are no more args. |
751 |
next_arg(char *src, char needle) |
next_arg(char *src, char needle) |
752 |
{ |
{ |
753 |
char *nextval; |
char *nextval; |
754 |
|
char *p; |
755 |
|
char *mvp = 0; |
756 |
|
|
757 |
// EOS |
/* EOS */ |
758 |
if (*src == (char) 0x00) |
if (*src == (char) 0x00) |
759 |
return 0; |
return 0; |
760 |
|
|
761 |
// more args available. |
p = src; |
762 |
nextval = strchr(src, needle); |
/* skip escaped needles */ |
763 |
|
while ((nextval = strchr(p, needle))) |
764 |
|
{ |
765 |
|
mvp = nextval - 1; |
766 |
|
/* found backslashed needle */ |
767 |
|
if (*mvp == '\\' && (mvp > src)) |
768 |
|
{ |
769 |
|
/* move string one to the left */ |
770 |
|
while (*(mvp + 1) != (char) 0x00) |
771 |
|
{ |
772 |
|
*mvp = *(mvp + 1); |
773 |
|
*mvp++; |
774 |
|
} |
775 |
|
*mvp = (char) 0x00; |
776 |
|
p = nextval; |
777 |
|
} |
778 |
|
else |
779 |
|
{ |
780 |
|
p = nextval + 1; |
781 |
|
break; |
782 |
|
} |
783 |
|
|
784 |
|
} |
785 |
|
|
786 |
|
/* more args available */ |
787 |
if (nextval) |
if (nextval) |
788 |
{ |
{ |
789 |
*nextval = (char) 0x00; |
*nextval = (char) 0x00; |
790 |
return ++nextval; |
return ++nextval; |
791 |
} |
} |
792 |
|
|
793 |
// no more args after this, jump to EOS |
/* no more args after this, jump to EOS */ |
794 |
nextval = src + strlen(src); |
nextval = src + strlen(src); |
795 |
return nextval; |
return nextval; |
796 |
} |
} |
797 |
|
|
798 |
|
|
799 |
void |
void |
800 |
toupper_str(char* p) |
toupper_str(char *p) |
801 |
{ |
{ |
802 |
while( *p ){ |
while (*p) |
803 |
if( (*p >= 'a') && (*p <= 'z') ) |
{ |
804 |
|
if ((*p >= 'a') && (*p <= 'z')) |
805 |
*p = toupper((int) *p); |
*p = toupper((int) *p); |
806 |
p++; |
p++; |
807 |
} |
} |
816 |
{ |
{ |
817 |
static char ret[LTOA_BUFSIZE]; |
static char ret[LTOA_BUFSIZE]; |
818 |
|
|
819 |
register int i = 2; |
char *head = ret, buf[LTOA_BUFSIZE], *tail = buf + sizeof(buf); |
|
long uarg; |
|
|
char *tail, *head = ret, buf[LTOA_BUFSIZE]; |
|
820 |
|
|
821 |
if (36 < base || 2 > base) |
register int divrem; |
|
base = 10; |
|
822 |
|
|
823 |
tail = &buf[LTOA_BUFSIZE - 1]; |
if (base < 36 || 2 > base) |
824 |
*tail-- = '\0'; |
base = 10; |
825 |
|
|
826 |
if (10 == base && N < 0L) |
if (N < 0) |
827 |
{ |
{ |
828 |
*head++ = '-'; |
*head++ = '-'; |
829 |
uarg = -N; |
N = -N; |
830 |
} |
} |
|
else |
|
|
uarg = N; |
|
831 |
|
|
832 |
if (uarg) |
tail = buf + sizeof(buf); |
833 |
{ |
*--tail = 0; |
|
for (i = 1; uarg; ++i) |
|
|
{ |
|
|
register ldiv_t r; |
|
834 |
|
|
835 |
r = ldiv(uarg, base); |
do |
836 |
*tail-- = (char) (r.rem + ((9L < r.rem) ? ('A' - 10L) : '0')); |
{ |
837 |
uarg = r.quot; |
divrem = N % base; |
838 |
} |
*--tail = (divrem <= 9) ? divrem + '0' : divrem + 'a' - 10; |
839 |
|
N /= base; |
840 |
} |
} |
841 |
else |
while (N); |
|
*tail-- = '0'; |
|
842 |
|
|
843 |
memcpy(head, ++tail, i); |
strcpy(head, tail); |
844 |
return ret; |
return ret; |
845 |
} |
} |
846 |
|
|