Commit e9871d0f e9871d0f003889c8fff79ee24cb23ae0c1103d5c by Sergey Poznyakoff

Remove dependency on getline.

* gnulib.modules: Remove getline.
* pop3d/apop.c [!ENABLE_DBM] Use mu_stream API instead of FILE.
1 parent 044c35cd
...@@ -6,7 +6,6 @@ ...@@ -6,7 +6,6 @@
6 autobuild 6 autobuild
7 argp 7 argp
8 crypto/des 8 crypto/des
9 getline
10 gettext 9 gettext
11 gitlog-to-changelog 10 gitlog-to-changelog
12 intprops 11 intprops
......
...@@ -114,9 +114,9 @@ pop3d_apopuser (const char *user) ...@@ -114,9 +114,9 @@ pop3d_apopuser (const char *user)
114 #else /* !ENABLE_DBM */ 114 #else /* !ENABLE_DBM */
115 { 115 {
116 char *buf = NULL; 116 char *buf = NULL;
117 size_t size = 0; 117 size_t size = 0, n;
118 size_t ulen; 118 size_t ulen;
119 FILE *apop_file; 119 mu_stream_t apop_stream;
120 120
121 rc = mu_file_safety_check (apop_database_name, apop_database_safety, 121 rc = mu_file_safety_check (apop_database_name, apop_database_safety,
122 apop_database_owner, NULL); 122 apop_database_owner, NULL);
...@@ -127,17 +127,19 @@ pop3d_apopuser (const char *user) ...@@ -127,17 +127,19 @@ pop3d_apopuser (const char *user)
127 apop_database_name, mu_strerror (rc)); 127 apop_database_name, mu_strerror (rc));
128 return NULL; 128 return NULL;
129 } 129 }
130 apop_file = fopen (apop_database_name, "r"); 130
131 if (apop_file == NULL) 131 rc = mu_file_stream_create (&apop_stream, apop_database_name,
132 MU_STREAM_READ);
133 if (rc)
132 { 134 {
133 mu_diag_output (MU_DIAG_INFO, 135 mu_diag_output (MU_DIAG_INFO,
134 _("unable to open APOP password file %s: %s"), 136 _("unable to open APOP password file %s: %s"),
135 apop_database_name, mu_strerror (errno)); 137 apop_database_name, mu_strerror (rc));
136 return NULL; 138 return NULL;
137 } 139 }
138 140
139 ulen = strlen (user); 141 ulen = strlen (user);
140 while (getline (&buf, &size, apop_file) > 0) 142 while (mu_stream_getline (apop_stream, &buf, &size, &n) == 0 && n > 0)
141 { 143 {
142 char *p, *start = mu_str_stripws (buf); 144 char *p, *start = mu_str_stripws (buf);
143 145
...@@ -154,8 +156,8 @@ pop3d_apopuser (const char *user) ...@@ -154,8 +156,8 @@ pop3d_apopuser (const char *user)
154 break; 156 break;
155 } 157 }
156 } 158 }
157 159 free (buf);
158 fclose (apop_file); 160 mu_stream_unref (apop_stream);
159 return password; 161 return password;
160 } 162 }
161 #endif 163 #endif
......