/[rdesktop]/sourceforge.net/trunk/rdesktop/rdesktop.c
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /sourceforge.net/trunk/rdesktop/rdesktop.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 578 by n-ki, Fri Jan 23 06:56:42 2004 UTC revision 608 by astrand, Sun Feb 15 21:19:28 2004 UTC
# Line 118  usage(char *program) Line 118  usage(char *program)
118          fprintf(stderr, "   -N: enable numlock syncronization\n");          fprintf(stderr, "   -N: enable numlock syncronization\n");
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,
122                    "         '-r comport:COM1=/dev/ttyS0': enable serial redirection of /dev/ttyS0 to COM1\n");
123          fprintf(stderr, "             or      COM1=/dev/ttyS0,COM2=/dev/ttyS1\n");          fprintf(stderr, "             or      COM1=/dev/ttyS0,COM2=/dev/ttyS1\n");
124          fprintf(stderr, "         '-r disk:A=/mnt/floppy': enable redirection of /mnt/floppy to A:\n");          fprintf(stderr,
125                    "         '-r disk:A=/mnt/floppy': enable redirection of /mnt/floppy to A:\n");
126          fprintf(stderr, "             or   A=/mnt/floppy,D=/mnt/cdrom'\n");          fprintf(stderr, "             or   A=/mnt/floppy,D=/mnt/cdrom'\n");
127          fprintf(stderr, "         '-r lptport:LPT1=/dev/lp0': enable parallel redirection of /dev/lp0 to LPT1\n");          fprintf(stderr,
128                    "         '-r lptport:LPT1=/dev/lp0': enable parallel redirection of /dev/lp0 to LPT1\n");
129          fprintf(stderr, "             or      LPT1=/dev/lp0,LPT2=/dev/lp1\n");          fprintf(stderr, "             or      LPT1=/dev/lp0,LPT2=/dev/lp1\n");
130          fprintf(stderr, "         '-r printer:mydeskjet': enable printer redirection\n");          fprintf(stderr, "         '-r printer:mydeskjet': enable printer redirection\n");
131          fprintf(stderr, "             or       mydeskjet:\"HP Laserjet IIIP\" to enter server driver as well\n");          fprintf(stderr,
132                    "             or       mydeskjet=\"HP LaserJet IIIP\" to enter server driver as well\n");
133          fprintf(stderr, "         '-r sound': enable sound redirection\n");          fprintf(stderr, "         '-r sound': enable sound redirection\n");
134          fprintf(stderr, "   -0: attach to console\n");          fprintf(stderr, "   -0: attach to console\n");
135          fprintf(stderr, "   -4: use RDP version 4\n");          fprintf(stderr, "   -4: use RDP version 4\n");
# Line 728  hexdump(unsigned char *p, unsigned int l Line 732  hexdump(unsigned char *p, unsigned int l
732  }  }
733    
734  /*  /*
735    input: src is the string we look in for needle    input: src is the string we look in for needle.
736             Needle may be escaped by a backslash, in
737             that case we ignore that particular needle.
738    return value: returns next src pointer, for    return value: returns next src pointer, for
739          succesive executions, like in a while loop          succesive executions, like in a while loop
740          if retval is 0, then there are no more args.          if retval is 0, then there are no more args.
# Line 758  next_arg(char *src, char needle) Line 764  next_arg(char *src, char needle)
764    
765          p = src;          p = src;
766          /*  skip escaped needles */          /*  skip escaped needles */
767          while( (nextval = strchr(p, needle) ) )          while ((nextval = strchr(p, needle)))
768          {          {
769                  mvp = nextval - 1;                  mvp = nextval - 1;
770                  /* found backslashed needle */                  /* found backslashed needle */
771                  if( *mvp == '\\' && (mvp > src) )                  if (*mvp == '\\' && (mvp > src))
772                  {                  {
773                          /* move string one to the left */                          /* move string one to the left */
774                          while( *(mvp+1) != (char)0x00 )                          while (*(mvp + 1) != (char) 0x00)
775                          {                          {
776                                  *mvp = *(mvp+1);                                  *mvp = *(mvp + 1);
777                                  *mvp++;                                  *mvp++;
778                          }                          }
779                          *mvp = (char)0x00;                          *mvp = (char) 0x00;
780                          p = nextval;                          p = nextval;
781                  }                  }
782                  else                  else
783                  {                  {
784                          p = nextval +1;                          p = nextval + 1;
785                          break;                          break;
786                  }                  }
787    
# Line 795  next_arg(char *src, char needle) Line 801  next_arg(char *src, char needle)
801    
802    
803  void  void
804  toupper_str(char* p)  toupper_str(char *p)
805  {  {
806          while( *p ){          while (*p)
807                  if( (*p >= 'a') && (*p <= 'z') )          {
808                    if ((*p >= 'a') && (*p <= 'z'))
809                          *p = toupper((int) *p);                          *p = toupper((int) *p);
810                  p++;                  p++;
811          }          }
# Line 809  toupper_str(char* p) Line 816  toupper_str(char* p)
816  #define LTOA_BUFSIZE (sizeof(long) * 8 + 1)  #define LTOA_BUFSIZE (sizeof(long) * 8 + 1)
817    
818  char *  char *
819  ltoa(long N, int base)  l_to_a(long N, int base)
820  {  {
821          static char ret[LTOA_BUFSIZE];          static char ret[LTOA_BUFSIZE];
822    
823          register int i = 2;          char *head = ret, buf[LTOA_BUFSIZE], *tail = buf + sizeof(buf);
         long uarg;  
         char *tail, *head = ret, buf[LTOA_BUFSIZE];  
824    
825          if (36 < base || 2 > base)          register int divrem;
                 base = 10;  
826    
827          tail = &buf[LTOA_BUFSIZE - 1];          if (base < 36 || 2 > base)
828          *tail-- = '\0';                  base = 10;
829    
830          if (10 == base && N < 0L)          if (N < 0)
831          {          {
832                  *head++ = '-';                  *head++ = '-';
833                  uarg = -N;                  N = -N;
834          }          }
         else  
                 uarg = N;  
835    
836          if (uarg)          tail = buf + sizeof(buf);
837          {          *--tail = 0;
                 for (i = 1; uarg; ++i)  
                 {  
                         register ldiv_t r;  
838    
839                          r = ldiv(uarg, base);          do
840                          *tail-- = (char) (r.rem + ((9L < r.rem) ? ('A' - 10L) : '0'));          {
841                          uarg = r.quot;                  divrem = N % base;
842                  }                  *--tail = (divrem <= 9) ? divrem + '0' : divrem + 'a' - 10;
843                    N /= base;
844          }          }
845          else          while (N);
                 *tail-- = '0';  
846    
847          memcpy(head, ++tail, i);          strcpy(head, tail);
848          return ret;          return ret;
849  }  }
850    

Legend:
Removed from v.578  
changed lines
  Added in v.608

  ViewVC Help
Powered by ViewVC 1.1.26