This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
update t/porting/filenames.t to check for path components contaning two
[perl5.git] / symbian / symbian_stubs.c
CommitLineData
27da23d5
JH
1/*
2 * symbian_stubs.c
3 *
4 * Copyright (c) Nokia 2004-2005. All rights reserved.
5 * This code is licensed under the same terms as Perl itself.
6 *
7 */
8
9#include "EXTERN.h"
10#include "perl.h"
11#include "symbian_stubs.h"
12
13static int setENOSYS(void) { errno = ENOSYS; return -1; }
14
15uid_t getuid(void) { return setENOSYS(); }
16gid_t getgid(void) { return setENOSYS(); }
17uid_t geteuid(void) { return setENOSYS(); }
18gid_t getegid(void) { return setENOSYS(); }
19
20int setuid(uid_t uid) { return setENOSYS(); }
21int setgid(gid_t gid) { return setENOSYS(); }
22int seteuid(uid_t uid) { return setENOSYS(); }
23int setegid(gid_t gid) { return setENOSYS(); }
24
25int execv(const char* path, char* const argv []) { return setENOSYS(); }
26int execvp(const char* path, char* const argv []) { return setENOSYS(); }
27
28#ifndef USE_PERLIO
29FILE *popen(const char *command, const char *mode) { return 0; }
30int pclose(FILE *stream) { return setENOSYS(); }
31#endif
32int pipe(int fd[2]) { return setENOSYS(); }
33
34int setmode(int fd, long flags) { return -1; }
35
36_sig_func_ptr signal(int signum, _sig_func_ptr handler) { return (_sig_func_ptr)setENOSYS(); }
37int kill(pid_t pid, int signum) { return setENOSYS(); }
38pid_t wait(int *status) { return setENOSYS(); }
39
40#if PERL_VERSION <= 8
41void Perl_my_setenv(pTHX_ char *var, char *val) { }
42#else
43void Perl_my_setenv(pTHX_ const char *var, const char *val) { }
44#endif
45
c042ae3a
JH
46bool Perl_do_exec(pTHX_ const char *cmd) { return FALSE; }
47bool Perl_do_exec3(pTHX_ const char *cmd, int fd, int flag) { return FALSE; }
27da23d5
JH
48
49int Perl_do_spawn(pTHX_ char *cmd) { return symbian_do_spawn(cmd); }
50int Perl_do_aspawn(pTHX_ SV *really, SV** mark, SV **sp) { return symbian_do_aspawn(really, mark, sp); }
51
52static const struct protoent protocols[] = {
53 { "tcp", 0, 6 },
54 { "udp", 0, 17 }
55};
56
57/* The protocol field (the last) is left empty to save both space
58 * and time because practically all services have both tcp and udp
59 * allocations in IANA. */
60static const struct servent services[] = {
61 { "http", 0, 80, 0 }, /* Optimization. */
62 { "https", 0, 443, 0 },
63 { "imap", 0, 143, 0 },
64 { "imaps", 0, 993, 0 },
65 { "smtp", 0, 25, 0 },
66 { "irc", 0, 194, 0 },
67
68 { "ftp", 0, 21, 0 },
69 { "ssh", 0, 22, 0 },
70 { "tftp", 0, 69, 0 },
71 { "pop3", 0, 110, 0 },
72 { "sftp", 0, 115, 0 },
73 { "nntp", 0, 119, 0 },
74 { "ntp", 0, 123, 0 },
75 { "snmp", 0, 161, 0 },
76 { "ldap", 0, 389, 0 },
77 { "rsync", 0, 873, 0 },
78 { "socks", 0, 1080, 0 }
79};
80
81struct protoent* getprotobynumber(int number) {
82 int i;
83 for (i = 0; i < sizeof(protocols)/sizeof(struct protoent); i++)
84 if (protocols[i].p_proto == number)
85 return (struct protoent*)(&(protocols[i]));
86 return 0;
87}
88
89struct protoent* getprotobyname(const char* name) {
90 int i;
91 for (i = 0; i < sizeof(protocols)/sizeof(struct protoent); i++)
92 if (strcmp(name, protocols[i].p_name) == 0)
93 return (struct protoent*)(&(protocols[i]));
94 return 0;
95}
96
97struct servent* getservbyname(const char* name, const char* proto) {
98 int i;
99 for (i = 0; i < sizeof(services)/sizeof(struct servent); i++)
100 if (strcmp(name, services[i].s_name) == 0)
101 return (struct servent*)(&(services[i]));
102 return 0;
103}
104
105struct servent* getservbyport(int port, const char* proto) {
106 int i;
107 for (i = 0; i < sizeof(services)/sizeof(struct servent); i++)
108 if (services[i].s_port == port)
109 return (struct servent*)(&(services[i]));
110 return 0;
111}
112