Skip to content

Commit 47ecea9

Browse files
committed
Move afp_util.c module from afpd to libatalk
The afp_util.c module contains AFP utility methods that are useful for applications that link with libatalk beyond afpd, notably the testsuite
1 parent fe544d0 commit 47ecea9

File tree

12 files changed

+30
-14
lines changed

12 files changed

+30
-14
lines changed

etc/afpd/afp_asp.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
#include <sys/time.h>
2121
#include <sys/stat.h>
2222

23+
#include <atalk/afp_util.h>
2324
#include <atalk/atp.h>
2425
#include <atalk/asp.h>
2526
#include <atalk/compat.h>

etc/afpd/afp_dsi.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
#include <time.h>
3030
#include <unistd.h>
3131

32+
#include <atalk/afp_util.h>
3233
#include <atalk/compat.h>
3334
#include <atalk/dsi.h>
3435
#include <atalk/fce_api.h>

etc/afpd/meson.build

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ afpd_sources = [
22
'afp_config.c',
33
'afp_dsi.c',
44
'afp_options.c',
5-
'afp_util.c',
65
'afprun.c',
76
'appl.c',
87
'auth.c',

include/atalk/afp_util.h

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
/*
2+
* Copyright (c) 1990,1993 Regents of The University of Michigan.
3+
* All Rights Reserved. See COPYRIGHT.
4+
*/
5+
6+
#ifndef AFPD_AFP_UTIL_H
7+
#define AFPD_AFP_UTIL_H 1
8+
9+
/* afp_util.c */
10+
extern const char *AfpNum2name(int);
11+
extern const char *AfpErr2name(int err);
12+
13+
#endif

include/atalk/directory.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,4 +119,7 @@ static inline int path_isadir(struct path *o_path)
119119
#endif
120120
}
121121

122+
/* directory.c */
123+
extern struct dir rootParent;
124+
122125
#endif /* ATALK_DIRECTORY_H */

include/atalk/globals.h

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -231,13 +231,6 @@ extern void afp_options_parse_cmdline(AFPObj *obj, int ac, char **av);
231231
extern int setmessage(const char *);
232232
extern void readmessage(AFPObj *);
233233

234-
/* afp_util.c */
235-
extern const char *AfpNum2name(int);
236-
extern const char *AfpErr2name(int err);
237-
238-
/* directory.c */
239-
extern struct dir rootParent;
240-
241234
#ifndef NO_DDP
242235
extern void afp_over_asp(AFPObj *);
243236
#endif /* NO_DDP */

include/atalk/meson.build

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ headers = [
33
'adouble.h',
44
'aep.h',
55
'afp.h',
6+
'afp_util.h',
67
'asp.h',
78
'atp.h',
89
'cnid.h',

etc/afpd/afp_util.c renamed to libatalk/util/afp_util.c

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
#endif /* HAVE_CONFIG_H */
1111

1212
#include <atalk/afp.h>
13-
#include <atalk/globals.h>
13+
#include <atalk/afp_util.h>
1414

1515
const char *AfpNum2name(int num)
1616
{
@@ -233,9 +233,10 @@ const char *AfpNum2name(int num)
233233

234234
case AFP_SYNCFORK :
235235
return "AFP_SYNCFORK"; /* 79 */
236-
}
237236

238-
return "not yet defined";
237+
default:
238+
return "not yet defined";
239+
}
239240
}
240241

241242
#define AFPERR2NAME(err) case err : return #err
@@ -293,7 +294,8 @@ const char *AfpErr2name(int err)
293294
AFPERR2NAME(AFPERR_PWDCHNG);
294295
AFPERR2NAME(AFPERR_PWDPOLCY);
295296
AFPERR2NAME(AFPERR_USRLOGIN);
296-
}
297297

298-
return "not yet defined";
298+
default:
299+
return "not yet defined";
300+
}
299301
}

libatalk/util/meson.build

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
util_sources = [
2+
'afp_util.c',
23
'atalk_addr.c',
34
'bprint.c',
45
'cnid.c',

test/afpd/meson.build

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ test_sources = [
55
meson.project_source_root() / 'etc/afpd/afp_config.c',
66
meson.project_source_root() / 'etc/afpd/afp_dsi.c',
77
meson.project_source_root() / 'etc/afpd/afp_options.c',
8-
meson.project_source_root() / 'etc/afpd/afp_util.c',
98
meson.project_source_root() / 'etc/afpd/afprun.c',
109
meson.project_source_root() / 'etc/afpd/appl.c',
1110
meson.project_source_root() / 'etc/afpd/auth.c',

0 commit comments

Comments
 (0)