mirror of the now-defunct rocklinux.org
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

101 lines
2.3 KiB

  1. some adaptions for building without dietlibc
  2. (parts of this patch thankfully copied from T2)
  3. diff -Naur fgetty-0.6~/Makefile fgetty-0.6/Makefile
  4. --- fgetty-0.6~/Makefile 2007-07-13 18:31:21.014218873 +0200
  5. +++ fgetty-0.6/Makefile 2007-07-13 18:31:26.784158037 +0200
  6. @@ -9,7 +9,7 @@
  7. STRIP=strip
  8. #CROSS=arm-linux-
  9. CROSS=
  10. -LDFLAGS=-s
  11. +LDFLAGS=-s -lcrypt
  12. %.o: %.c
  13. # gcc -march=i386 -mcpu=i386 -pipe -Os -fomit-frame-pointer -I../dietlibc/include -c $^ -DTEST
  14. @@ -18,11 +18,11 @@
  15. $(CROSS)$(STRIP) -x -R .comment -R .note $@
  16. %: %.o
  17. - $(DIET) $(CROSS)$(CC) -nostdlib -o $@ $^ $(LDFLAGS)
  18. + $(DIET) $(CROSS)$(CC) -o $@ $^ $(LDFLAGS)
  19. fgetty: fgetty.o fmt_ulong.o
  20. -login: login.o
  21. +login: login.o ltostr.o
  22. login2: login2.o
  23. checkpassword: checkpassword.o
  24. diff -Naur fgetty-0.6~/fgetty.c fgetty-0.6/fgetty.c
  25. --- fgetty-0.6~/fgetty.c 2007-07-13 18:31:21.013218883 +0200
  26. +++ fgetty-0.6/fgetty.c 2007-07-13 18:31:26.783158047 +0200
  27. @@ -10,6 +10,7 @@
  28. #include <sys/ioctl.h>
  29. #include <errno.h>
  30. #include <termios.h>
  31. +#include <time.h>
  32. #include "fmt.h"
  33. diff -Naur fgetty-0.6~/login.c fgetty-0.6/login.c
  34. --- fgetty-0.6~/login.c 2007-07-13 18:31:21.013218883 +0200
  35. +++ fgetty-0.6/login.c 2007-07-13 18:32:05.155753351 +0200
  36. @@ -36,6 +36,8 @@
  37. #include <fcntl.h>
  38. #include <signal.h>
  39. +extern char **environ;
  40. +
  41. void die(const char *message) {
  42. write(2,message,strlen(message));
  43. write(2,"\n",1);
  44. @@ -116,7 +118,7 @@
  45. int len;
  46. len=strlen(username)+1;
  47. strcpy(buf,username);
  48. - strlcpy(buf+len,password,512-len);
  49. + strncpy(buf+len,password,512-len);
  50. len+=strlen(password)+1;
  51. /* buf[len++]='Y'; */
  52. len+=__ltostr(buf+len,512-len,time(0),10,0);
  53. diff -Naur fgetty-0.6~/ltostr.c fgetty-0.6/ltostr.c
  54. --- fgetty-0.6~/ltostr.c 1970-01-01 01:00:00.000000000 +0100
  55. +++ fgetty-0.6/ltostr.c 2007-07-13 18:31:26.784158037 +0200
  56. @@ -0,0 +1,36 @@
  57. +#include <string.h>
  58. +#include <stdlib.h>
  59. +
  60. +#ifndef __dietlibc__
  61. +
  62. +int __ltostr(char *s, unsigned int size, unsigned long i, unsigned int base, int UpCase)
  63. +{
  64. + char *tmp;
  65. + unsigned int j=0;
  66. +
  67. + s[--size]=0;
  68. +
  69. + tmp=s+size;
  70. +
  71. + if ((base==0)||(base>36)) base=10;
  72. +
  73. + j=0;
  74. + if (!i)
  75. + {
  76. + *(--tmp)='0';
  77. + j=1;
  78. + }
  79. +
  80. + while((tmp>s)&&(i))
  81. + {
  82. + tmp--;
  83. + if ((*tmp=i%base+'0')>'9') *tmp+=(UpCase?'A':'a')-'9'-1;
  84. + i=i/base;
  85. + j++;
  86. + }
  87. + memmove(s,tmp,j+1);
  88. +
  89. + return j;
  90. +}
  91. +
  92. +#endif