2
0
Michael VAN CANNEYT 2 жил өмнө
parent
commit
6ffa3d4a89

+ 25 - 25
rtl/unix/bunxh.inc

@@ -29,11 +29,11 @@ Type TGrpArr = Array [0..0] of TGid;            { C style array workarounds}
 {$endif ndef FPC_SYS_SIGTIMEDWAIT_UNAVAILABLE}
 {$endif ndef FPC_SYS_SIGTIMEDWAIT_UNAVAILABLE}
 
 
     Function  FpUmask      (cmask : TMode): TMode;
     Function  FpUmask      (cmask : TMode): TMode;
-    Function  FpLink       (existing : pChar; newone : pChar): cInt;
-    Function  FpMkfifo     (path : pChar; Mode : TMode): cInt;
-    Function  FpChmod      (path : pChar; Mode : TMode): cInt;
-    Function  FpChown      (path : pChar; owner : TUid; group : TGid): cInt;
-    Function  FpUtime      (path : pChar; times : putimbuf): cInt;
+    Function  FpLink       (existing : PAnsiChar; newone : PAnsiChar): cInt;
+    Function  FpMkfifo     (path : PAnsiChar; Mode : TMode): cInt;
+    Function  FpChmod      (path : PAnsiChar; Mode : TMode): cInt;
+    Function  FpChown      (path : PAnsiChar; owner : TUid; group : TGid): cInt;
+    Function  FpUtime      (path : PAnsiChar; times : putimbuf): cInt;
 {$if defined(freebsd)}
 {$if defined(freebsd)}
     Function  FpPipe       (var fildes : tfildes; flags : cInt=0):cInt;
     Function  FpPipe       (var fildes : tfildes; flags : cInt=0):cInt;
 {$else}
 {$else}
@@ -63,34 +63,34 @@ Type TGrpArr = Array [0..0] of TGid;            { C style array workarounds}
     Function  FpFcntl      (fildes : cInt; cmd : cInt; arg : cInt): cInt;
     Function  FpFcntl      (fildes : cInt; cmd : cInt; arg : cInt): cInt;
     Function  FpFcntl      (fildes : cInt; cmd : cInt; var arg : flock): cInt;
     Function  FpFcntl      (fildes : cInt; cmd : cInt; var arg : flock): cInt;
 
 
-    Function  FpGetcwd     (path:pChar; siz:TSize):pChar;  external name 'FPC_SYSC_GETCWD';
+    Function  FpGetcwd     (path:PAnsiChar; siz:TSize):PAnsiChar;  external name 'FPC_SYSC_GETCWD';
     Function  FpFork : TPid; external name 'FPC_SYSC_FORK';
     Function  FpFork : TPid; external name 'FPC_SYSC_FORK';
-    Function  FpExecve     (path : pChar; argv : ppChar; envp: ppChar): cInt;
-    Function  FpExecv      (path : pChar; argv : ppChar): cInt;
+    Function  FpExecve     (path : PAnsiChar; argv : PPAnsiChar; envp: PPAnsiChar): cInt;
+    Function  FpExecv      (path : PAnsiChar; argv : PPAnsiChar): cInt;
     Function  FpWaitpid    (pid : TPid; stat_loc : pcInt; options: cInt): TPid; external name 'FPC_SYSC_WAITPID';
     Function  FpWaitpid    (pid : TPid; stat_loc : pcInt; options: cInt): TPid; external name 'FPC_SYSC_WAITPID';
     Function  FpWait       (var stat_loc : cInt): TPid;
     Function  FpWait       (var stat_loc : cInt): TPid;
     Procedure FpExit       (Status : cInt);  external name 'FPC_SYSC_EXIT';
     Procedure FpExit       (Status : cInt);  external name 'FPC_SYSC_EXIT';
     Function  FpKill       (pid : TPid; sig: cInt): cInt;
     Function  FpKill       (pid : TPid; sig: cInt): cInt;
     Function  FpUname      (var name: utsname): cInt;
     Function  FpUname      (var name: utsname): cInt;
-    Function  FpOpendir    (dirname : pChar): pDir;  external name 'FPC_SYSC_OPENDIR';
+    Function  FpOpendir    (dirname : PAnsiChar): pDir;  external name 'FPC_SYSC_OPENDIR';
     Function  FpReaddir    (var dirp : Dir) : pDirent; external name 'FPC_SYSC_READDIR';
     Function  FpReaddir    (var dirp : Dir) : pDirent; external name 'FPC_SYSC_READDIR';
     Function  FpClosedir   (var dirp : Dir): cInt; external name 'FPC_SYSC_CLOSEDIR';
     Function  FpClosedir   (var dirp : Dir): cInt; external name 'FPC_SYSC_CLOSEDIR';
-    Function  FpChdir      (path : pChar): cInt;  external name 'FPC_SYSC_CHDIR';
-    Function  FpOpen       (path : pChar; flags : cInt; Mode: TMode):cInt; external name 'FPC_SYSC_OPEN';
-    Function  FpMkdir      (path : pChar; Mode: TMode):cInt;  external name 'FPC_SYSC_MKDIR';
-    Function  FpUnlink     (path : pChar): cInt;  external name 'FPC_SYSC_UNLINK';
-    Function  FpRmdir      (path : pChar): cInt; external name 'FPC_SYSC_RMDIR';
-    Function  FpRename     (old  : pChar; newpath: pChar): cInt;   external name 'FPC_SYSC_RENAME';
+    Function  FpChdir      (path : PAnsiChar): cInt;  external name 'FPC_SYSC_CHDIR';
+    Function  FpOpen       (path : PAnsiChar; flags : cInt; Mode: TMode):cInt; external name 'FPC_SYSC_OPEN';
+    Function  FpMkdir      (path : PAnsiChar; Mode: TMode):cInt;  external name 'FPC_SYSC_MKDIR';
+    Function  FpUnlink     (path : PAnsiChar): cInt;  external name 'FPC_SYSC_UNLINK';
+    Function  FpRmdir      (path : PAnsiChar): cInt; external name 'FPC_SYSC_RMDIR';
+    Function  FpRename     (old  : PAnsiChar; newpath: PAnsiChar): cInt;   external name 'FPC_SYSC_RENAME';
     Function  FpFStat      (fd : cInt; var sb : stat): cInt; external name 'FPC_SYSC_FSTAT';
     Function  FpFStat      (fd : cInt; var sb : stat): cInt; external name 'FPC_SYSC_FSTAT';
-    Function  FpStat       (path: pChar; var buf : stat): cInt;  external name 'FPC_SYSC_STAT';
-    Function  FpAccess     (pathname : pChar; aMode : cInt): cInt; external name 'FPC_SYSC_ACCESS';
+    Function  FpStat       (path: PAnsiChar; var buf : stat): cInt;  external name 'FPC_SYSC_STAT';
+    Function  FpAccess     (pathname : PAnsiChar; aMode : cInt): cInt; external name 'FPC_SYSC_ACCESS';
     Function  FpClose      (fd : cInt): cInt;  external name 'FPC_SYSC_CLOSE';
     Function  FpClose      (fd : cInt): cInt;  external name 'FPC_SYSC_CLOSE';
 
 
-    Function  FpRead       (fd : cInt; buf: pChar; nbytes : TSize): TSsize; external name 'FPC_SYSC_READ';
-    Function  FpPRead      (fd : cInt; buf: pChar; nbytes : TSize; offset:Toff): TSsize;
+    Function  FpRead       (fd : cInt; buf: PAnsiChar; nbytes : TSize): TSsize; external name 'FPC_SYSC_READ';
+    Function  FpPRead      (fd : cInt; buf: PAnsiChar; nbytes : TSize; offset:Toff): TSsize;
     function  FpReadV	   (fd: cint; const iov : piovec; iovcnt : cint):TSSize;
     function  FpReadV	   (fd: cint; const iov : piovec; iovcnt : cint):TSSize;
-    Function  FpWrite      (fd : cInt; buf:pChar; nbytes : TSize): TSsize;  external name 'FPC_SYSC_WRITE';
-    Function  FpPWrite     (fd : cInt; buf:pChar; nbytes : TSize; offset:Toff): TSSize;
+    Function  FpWrite      (fd : cInt; buf:PAnsiChar; nbytes : TSize): TSsize;  external name 'FPC_SYSC_WRITE';
+    Function  FpPWrite     (fd : cInt; buf:PAnsiChar; nbytes : TSize; offset:Toff): TSSize;
     function  FpWriteV	   (fd: cint; const iov : piovec; iovcnt : cint):TSSize;
     function  FpWriteV	   (fd: cint; const iov : piovec; iovcnt : cint):TSSize;
 
 
     Function  FpLseek      (fd : cInt; offset : TOff; whence : cInt): TOff; external name 'FPC_SYSC_LSEEK';
     Function  FpLseek      (fd : cInt; offset : TOff; whence : cInt): TOff; external name 'FPC_SYSC_LSEEK';
@@ -101,9 +101,9 @@ Type TGrpArr = Array [0..0] of TGid;            { C style array workarounds}
     Function  FpPoll       (fds: ppollfd; nfds: cuint; timeout: clong): cint;
     Function  FpPoll       (fds: ppollfd; nfds: cuint; timeout: clong): cint;
     Function  FpIOCtl      (Handle:cint;Ndx: TIOCtlRequest; Data: Pointer):cint; external name  'FPC_SYSC_IOCTL';
     Function  FpIOCtl      (Handle:cint;Ndx: TIOCtlRequest; Data: Pointer):cint; external name  'FPC_SYSC_IOCTL';
     Function  FpNanoSleep  (req : ptimespec;rem : ptimespec):cint; external name 'FPC_SYSC_NANOSLEEP';
     Function  FpNanoSleep  (req : ptimespec;rem : ptimespec):cint; external name 'FPC_SYSC_NANOSLEEP';
-    Function  fpLstat(path:pchar;Info:pstat):cint;
-    Function  fpSymlink(oldname,newname:pchar):cint;
-    Function  fpReadLink(name,linkname:pchar;maxlen:size_t):cint; external name  'FPC_SYSC_READLINK';
+    Function  fpLstat(path:PAnsiChar;Info:pstat):cint;
+    Function  fpSymlink(oldname,newname:PAnsiChar):cint;
+    Function  fpReadLink(name,linkname:PAnsiChar;maxlen:size_t):cint; external name  'FPC_SYSC_READLINK';
 
 
     function  fpNice(N:cint):cint;
     function  fpNice(N:cint):cint;
     Function  fpGetPriority(Which,Who:cint):cint;
     Function  fpGetPriority(Which,Who:cint):cint;
@@ -112,7 +112,7 @@ Type TGrpArr = Array [0..0] of TGid;            { C style array workarounds}
     Function  Fpmunmap(start:pointer;len:size_t):cint;  external name 'FPC_SYSC_MUNMAP';
     Function  Fpmunmap(start:pointer;len:size_t):cint;  external name 'FPC_SYSC_MUNMAP';
     Function  Fpmprotect(start:pointer;len:size_t;prot:cint):cint; external name 'FPC_SYSC_MPROTECT';
     Function  Fpmprotect(start:pointer;len:size_t;prot:cint):cint; external name 'FPC_SYSC_MPROTECT';
 
 
-    Function  FpGetEnv (name : pChar): pChar; external name 'FPC_SYSC_FPGETENVPCHAR';
+    Function  FpGetEnv (name : PAnsiChar): PAnsiChar; external name 'FPC_SYSC_FPGETENVPCHAR';
     function  fpsettimeofday(tp:ptimeval;tzp:ptimezone):cint;
     function  fpsettimeofday(tp:ptimeval;tzp:ptimezone):cint;
 
 
     function FpGetRLimit(resource:cint;rlim:PRLimit):cint; external name 'FPC_SYSC_GETRLIMIT';
     function FpGetRLimit(resource:cint;rlim:PRLimit):cint; external name 'FPC_SYSC_GETRLIMIT';

+ 33 - 33
rtl/unix/bunxovl.inc

@@ -19,7 +19,7 @@ var
 Begin
 Begin
   SystemExistingFileName:=ToSingleByteFileSystemEncodedFileName(existing);
   SystemExistingFileName:=ToSingleByteFileSystemEncodedFileName(existing);
   SystemNewOneFileName:=ToSingleByteFileSystemEncodedFileName(newone);
   SystemNewOneFileName:=ToSingleByteFileSystemEncodedFileName(newone);
-  FpLink:=FpLink(pchar(SystemExistingFileName),pchar(SystemNewOneFileName));
+  FpLink:=FpLink(PAnsiChar(SystemExistingFileName),PAnsiChar(SystemNewOneFileName));
 End;
 End;
 
 
 Function  FpMkfifo (const path : RawByteString; Mode : TMode): cInt; {$ifdef VER2_0}inline;{$endif}
 Function  FpMkfifo (const path : RawByteString; Mode : TMode): cInt; {$ifdef VER2_0}inline;{$endif}
@@ -27,7 +27,7 @@ var
   SystemPath: RawByteString;
   SystemPath: RawByteString;
 Begin
 Begin
   SystemPath:=ToSingleByteFileSystemEncodedFileName(path);
   SystemPath:=ToSingleByteFileSystemEncodedFileName(path);
-  FpMkfifo:=FpMkfifo(pchar(SystemPath),mode);
+  FpMkfifo:=FpMkfifo(PAnsiChar(SystemPath),mode);
 End;
 End;
 
 
 Function  FpChmod (const path : RawByteString; Mode : TMode): cInt; {$ifdef VER2_0}inline;{$endif}
 Function  FpChmod (const path : RawByteString; Mode : TMode): cInt; {$ifdef VER2_0}inline;{$endif}
@@ -35,7 +35,7 @@ var
   SystemPath: RawByteString;
   SystemPath: RawByteString;
 Begin
 Begin
   SystemPath:=ToSingleByteFileSystemEncodedFileName(path);
   SystemPath:=ToSingleByteFileSystemEncodedFileName(path);
-  FpChmod:=FpChmod(pchar(SystemPath),mode);
+  FpChmod:=FpChmod(PAnsiChar(SystemPath),mode);
 End;
 End;
 
 
 Function  FpChown (const path : RawByteString; owner : TUid; group : TGid): cInt;{$ifdef VER2_0}inline;{$endif}
 Function  FpChown (const path : RawByteString; owner : TUid; group : TGid): cInt;{$ifdef VER2_0}inline;{$endif}
@@ -43,7 +43,7 @@ var
   SystemPath: RawByteString;
   SystemPath: RawByteString;
 Begin
 Begin
   SystemPath:=ToSingleByteFileSystemEncodedFileName(path);
   SystemPath:=ToSingleByteFileSystemEncodedFileName(path);
-  FpChown:=FpChown(pchar(SystemPath),owner,group);
+  FpChown:=FpChown(PAnsiChar(SystemPath),owner,group);
 End;
 End;
 
 
 Function  FpUtime (const path : RawByteString; times : putimbuf): cInt; {$ifdef VER2_0}inline;{$endif}
 Function  FpUtime (const path : RawByteString; times : putimbuf): cInt; {$ifdef VER2_0}inline;{$endif}
@@ -51,7 +51,7 @@ var
   SystemPath: RawByteString;
   SystemPath: RawByteString;
 Begin
 Begin
   SystemPath:=ToSingleByteFileSystemEncodedFileName(path);
   SystemPath:=ToSingleByteFileSystemEncodedFileName(path);
-  FpUtime:=FpUtime(pchar(SystemPath),times);
+  FpUtime:=FpUtime(PAnsiChar(SystemPath),times);
 End;
 End;
 
 
 {
 {
@@ -60,14 +60,14 @@ var
   SystemPath: RawByteString;
   SystemPath: RawByteString;
 Begin
 Begin
   SystemPath:=ToSingleByteFileSystemEncodedFileName(path);
   SystemPath:=ToSingleByteFileSystemEncodedFileName(path);
-  FpGetcwd:=RawByteString(pchar(FpGetcwd(pchar(SystemPath),siz)));
+  FpGetcwd:=RawByteString(PAnsiChar(FpGetcwd(PAnsiChar(SystemPath),siz)));
   SetCodePage(FpGetcwd,DefaultFileSystemCodePage,false);
   SetCodePage(FpGetcwd,DefaultFileSystemCodePage,false);
 End;
 End;
 }
 }
 Function  FpGetcwd: RawByteString;
 Function  FpGetcwd: RawByteString;
 
 
 Var
 Var
-  Buf : Array[0..PATH_MAX+1]  of char;
+  Buf : Array[0..PATH_MAX+1]  of AnsiChar;
 Begin
 Begin
   Buf[PATH_MAX+1]:=#0;
   Buf[PATH_MAX+1]:=#0;
   If FpGetcwd(@Buf[0],PATH_MAX)=Nil then
   If FpGetcwd(@Buf[0],PATH_MAX)=Nil then
@@ -79,20 +79,20 @@ Begin
     end;
     end;
 End;
 End;
 
 
-Function  FpExecve (const path : RawByteString; argv : ppchar; envp: ppchar): cInt; {$ifdef VER2_0}inline;{$endif}
+Function  FpExecve (const path : RawByteString; argv : PPAnsiChar; envp: PPAnsiChar): cInt; {$ifdef VER2_0}inline;{$endif}
 var
 var
   SystemPath: RawByteString;
   SystemPath: RawByteString;
 Begin
 Begin
   SystemPath:=ToSingleByteFileSystemEncodedFileName(path);
   SystemPath:=ToSingleByteFileSystemEncodedFileName(path);
-  FpExecve:=FpExecve (pchar(SystemPath),argv,envp);
+  FpExecve:=FpExecve (PAnsiChar(SystemPath),argv,envp);
 End;
 End;
 
 
-Function  FpExecv (const path : RawByteString; argv : ppchar): cInt; {$ifdef VER2_0}inline;{$endif}
+Function  FpExecv (const path : RawByteString; argv : PPAnsiChar): cInt; {$ifdef VER2_0}inline;{$endif}
 var
 var
   SystemPath: RawByteString;
   SystemPath: RawByteString;
 Begin
 Begin
   SystemPath:=ToSingleByteFileSystemEncodedFileName(path);
   SystemPath:=ToSingleByteFileSystemEncodedFileName(path);
-  FpExecv:=FpExecve (pchar(SystemPath),argv,envp);
+  FpExecv:=FpExecve (PAnsiChar(SystemPath),argv,envp);
 End;
 End;
 
 
 
 
@@ -101,7 +101,7 @@ var
   SystemPath: RawByteString;
   SystemPath: RawByteString;
 Begin
 Begin
   SystemPath:=ToSingleByteFileSystemEncodedFileName(path);
   SystemPath:=ToSingleByteFileSystemEncodedFileName(path);
-  FpChDir:=FpChdir(pchar(SystemPath));
+  FpChDir:=FpChdir(PAnsiChar(SystemPath));
 End;
 End;
 
 
 Function  FpOpen (const path : RawByteString; flags : cInt; Mode: TMode):cInt; {$ifdef VER2_0}inline;{$endif}
 Function  FpOpen (const path : RawByteString; flags : cInt; Mode: TMode):cInt; {$ifdef VER2_0}inline;{$endif}
@@ -109,7 +109,7 @@ var
   SystemPath: RawByteString;
   SystemPath: RawByteString;
 Begin
 Begin
   SystemPath:=ToSingleByteFileSystemEncodedFileName(path);
   SystemPath:=ToSingleByteFileSystemEncodedFileName(path);
-  FpOpen:=FpOpen(pchar(SystemPath),flags,mode);
+  FpOpen:=FpOpen(PAnsiChar(SystemPath),flags,mode);
 End;
 End;
 
 
 
 
@@ -118,7 +118,7 @@ var
   SystemPath: RawByteString;
   SystemPath: RawByteString;
 Begin
 Begin
   SystemPath:=ToSingleByteFileSystemEncodedFileName(path);
   SystemPath:=ToSingleByteFileSystemEncodedFileName(path);
-  FpMkdir:=FpMkdir(pchar(SystemPath),mode);
+  FpMkdir:=FpMkdir(PAnsiChar(SystemPath),mode);
 End;
 End;
 
 
 Function  FpUnlink (const path : RawByteString): cInt; {$ifdef VER2_0}inline;{$endif}
 Function  FpUnlink (const path : RawByteString): cInt; {$ifdef VER2_0}inline;{$endif}
@@ -126,7 +126,7 @@ var
   SystemPath: RawByteString;
   SystemPath: RawByteString;
 Begin
 Begin
   SystemPath:=ToSingleByteFileSystemEncodedFileName(path);
   SystemPath:=ToSingleByteFileSystemEncodedFileName(path);
-  FpUnlink:=FpUnlink(pchar(SystemPath));
+  FpUnlink:=FpUnlink(PAnsiChar(SystemPath));
 End;
 End;
 
 
 Function  FpRmdir (const path : RawByteString): cInt; {$ifdef VER2_0}inline;{$endif}
 Function  FpRmdir (const path : RawByteString): cInt; {$ifdef VER2_0}inline;{$endif}
@@ -134,7 +134,7 @@ var
   SystemPath: RawByteString;
   SystemPath: RawByteString;
 Begin
 Begin
   SystemPath:=ToSingleByteFileSystemEncodedFileName(path);
   SystemPath:=ToSingleByteFileSystemEncodedFileName(path);
-  FpRmdir:=FpRmdir(pchar(SystemPath));
+  FpRmdir:=FpRmdir(PAnsiChar(SystemPath));
 End;
 End;
 
 
 Function  FpRename (const old  : RawByteString; const newpath: RawByteString): cInt; {$ifdef VER2_0}inline;{$endif}
 Function  FpRename (const old  : RawByteString; const newpath: RawByteString): cInt; {$ifdef VER2_0}inline;{$endif}
@@ -143,7 +143,7 @@ var
 Begin
 Begin
   OldSystemPath:=ToSingleByteFileSystemEncodedFileName(old);
   OldSystemPath:=ToSingleByteFileSystemEncodedFileName(old);
   NewSystemPath:=ToSingleByteFileSystemEncodedFileName(newpath);
   NewSystemPath:=ToSingleByteFileSystemEncodedFileName(newpath);
-  FpRename:=FpRename(pchar(OldSystemPath),pchar(NewSystemPath));
+  FpRename:=FpRename(PAnsiChar(OldSystemPath),PAnsiChar(NewSystemPath));
 End;
 End;
 
 
 Function  FpStat (const path: RawByteString; var buf : stat): cInt; {$ifdef VER2_0}inline;{$endif}
 Function  FpStat (const path: RawByteString; var buf : stat): cInt; {$ifdef VER2_0}inline;{$endif}
@@ -151,7 +151,7 @@ var
   SystemPath: RawByteString;
   SystemPath: RawByteString;
 Begin
 Begin
   SystemPath:=ToSingleByteFileSystemEncodedFileName(path);
   SystemPath:=ToSingleByteFileSystemEncodedFileName(path);
-  FpStat:=FpStat(pchar(SystemPath),buf);
+  FpStat:=FpStat(PAnsiChar(SystemPath),buf);
 End;
 End;
 
 
 Function  fpLstat   (const path: RawByteString; Info: pstat):cint; inline;
 Function  fpLstat   (const path: RawByteString; Info: pstat):cint; inline;
@@ -159,10 +159,10 @@ var
   SystemPath: RawByteString;
   SystemPath: RawByteString;
 Begin
 Begin
   SystemPath:=ToSingleByteFileSystemEncodedFileName(path);
   SystemPath:=ToSingleByteFileSystemEncodedFileName(path);
-  fplstat:=fplstat(pchar(SystemPath), info);
+  fplstat:=fplstat(PAnsiChar(SystemPath), info);
 end;
 end;
 
 
-Function  fpLstat   (path:pchar;var Info:stat):cint; inline;
+Function  fpLstat   (path:PAnsiChar;var Info:stat):cint; inline;
 
 
 begin
 begin
   fpLstat:=fplstat(path,@info);
   fpLstat:=fplstat(path,@info);
@@ -178,7 +178,7 @@ var
   SystemPathName: RawByteString;
   SystemPathName: RawByteString;
 Begin
 Begin
   SystemPathName:=ToSingleByteFileSystemEncodedFileName(pathname);
   SystemPathName:=ToSingleByteFileSystemEncodedFileName(pathname);
-  FpAccess:=FpAccess(pchar(SystemPathName),amode);
+  FpAccess:=FpAccess(PAnsiChar(SystemPathName),amode);
 End;
 End;
 
 
 Function  FPFStat(var F:Text;Var Info:stat):Boolean; {$ifdef VER2_0}inline;{$endif}
 Function  FPFStat(var F:Text;Var Info:stat):Boolean; {$ifdef VER2_0}inline;{$endif}
@@ -218,33 +218,33 @@ begin
 end;
 end;
 
 
 {$ifdef FPC_USE_LIBC} // can't remember why this is the case. Might be legacy.
 {$ifdef FPC_USE_LIBC} // can't remember why this is the case. Might be legacy.
-function xFpread(fd: cint; buf: pchar; nbytes : size_t): ssize_t; cdecl; external clib name 'read';
+function xFpread(fd: cint; buf: PAnsiChar; nbytes : size_t): ssize_t; cdecl; external clib name 'read';
 {$else}
 {$else}
-function xFpread(fd: cint; buf: pchar; nbytes : size_t): ssize_t; external name 'FPC_SYSC_READ';
+function xFpread(fd: cint; buf: PAnsiChar; nbytes : size_t): ssize_t; external name 'FPC_SYSC_READ';
 {$endif}
 {$endif}
 
 
 Function  FpRead           (fd : cInt;var buf; nbytes : TSize): TSsize; {$ifdef VER2_0}inline;{$endif}
 Function  FpRead           (fd : cInt;var buf; nbytes : TSize): TSsize; {$ifdef VER2_0}inline;{$endif}
 
 
 begin
 begin
-  FPRead:=xFpRead(fd,pchar(@buf),nbytes);
+  FPRead:=xFpRead(fd,PAnsiChar(@buf),nbytes);
 end;
 end;
 
 
 Function  FpWrite          (fd : cInt;const buf; nbytes : TSize): TSsize; {$ifdef VER2_0}inline;{$endif}
 Function  FpWrite          (fd : cInt;const buf; nbytes : TSize): TSsize; {$ifdef VER2_0}inline;{$endif}
 begin
 begin
- FpWrite:=FpWrite(fd,pchar(@buf),nbytes);
+ FpWrite:=FpWrite(fd,PAnsiChar(@buf),nbytes);
 end;
 end;
 
 
 {$ifdef linux}
 {$ifdef linux}
 function  FppRead           (fd : cInt;var buf; nbytes : TSize; offset:Toff): TSsize; {$ifdef VER2_0}inline;{$endif}
 function  FppRead           (fd : cInt;var buf; nbytes : TSize; offset:Toff): TSsize; {$ifdef VER2_0}inline;{$endif}
 
 
 begin
 begin
-  FppRead:=FppRead(fd,pchar(@buf),nbytes,offset);
+  FppRead:=FppRead(fd,PAnsiChar(@buf),nbytes,offset);
 end;
 end;
 
 
 function  FppWrite          (fd : cInt;const buf; nbytes : TSize; offset:Toff): TSsize; {$ifdef VER2_0}inline;{$endif}
 function  FppWrite          (fd : cInt;const buf; nbytes : TSize; offset:Toff): TSsize; {$ifdef VER2_0}inline;{$endif}
 
 
 begin
 begin
-  FppWrite:=FppWrite(fd,pchar(@buf),nbytes,offset);
+  FppWrite:=FppWrite(fd,PAnsiChar(@buf),nbytes,offset);
 end;
 end;
 {$endif}
 {$endif}
 
 
@@ -254,7 +254,7 @@ const
                 S_IWGRP OR S_IRGRP OR
                 S_IWGRP OR S_IRGRP OR
                 S_IWOTH OR S_IROTH;
                 S_IWOTH OR S_IROTH;
 
 
-Function  FpOpen    (path : pChar; flags : cInt):cInt; {$ifdef VER2_0}inline;{$endif}
+Function  FpOpen    (path : PAnsiChar; flags : cInt):cInt; {$ifdef VER2_0}inline;{$endif}
 
 
 begin
 begin
  FpOpen:=FpOpen(path,flags,MODE_FPOPEN);
  FpOpen:=FpOpen(path,flags,MODE_FPOPEN);
@@ -265,7 +265,7 @@ var
   SystemPath: RawByteString;
   SystemPath: RawByteString;
 Begin
 Begin
   SystemPath:=ToSingleByteFileSystemEncodedFileName(path);
   SystemPath:=ToSingleByteFileSystemEncodedFileName(path);
-  FpOpen:=FpOpen(pchar(SystemPath),flags,MODE_FPOPEN);
+  FpOpen:=FpOpen(PAnsiChar(SystemPath),flags,MODE_FPOPEN);
 end;
 end;
 
 
 Function  FpOpen    (path : String; flags : cInt):cInt;
 Function  FpOpen    (path : String; flags : cInt):cInt;
@@ -287,14 +287,14 @@ var
   SystemDirName: RawByteString;
   SystemDirName: RawByteString;
 Begin
 Begin
   SystemDirName:=ToSingleByteFileSystemEncodedFileName(dirname);
   SystemDirName:=ToSingleByteFileSystemEncodedFileName(dirname);
-  FpOpenDir:=FpOpenDir(pchar(SystemDirName));
+  FpOpenDir:=FpOpenDir(PAnsiChar(SystemDirName));
 End;
 End;
 
 
 
 
 Function  FpOpendir (dirname : shortString): pDir; {$ifdef VER2_0}inline;{$endif}
 Function  FpOpendir (dirname : shortString): pDir; {$ifdef VER2_0}inline;{$endif}
 Begin
 Begin
   dirname:=dirname+#0;
   dirname:=dirname+#0;
-  FpOpenDir:=FpOpenDir(pchar(@dirname[1]));
+  FpOpenDir:=FpOpenDir(PAnsiChar(@dirname[1]));
 End;
 End;
 
 
 
 
@@ -302,7 +302,7 @@ Function  FpStat (path: String; var buf : stat): cInt;
 
 
 begin
 begin
  path:=path+#0;
  path:=path+#0;
- FpStat:=FpStat(pchar(@path[1]),buf);
+ FpStat:=FpStat(PAnsiChar(@path[1]),buf);
 end;
 end;
 
 
 Function fpDup(var oldfile,newfile:text):cint;
 Function fpDup(var oldfile,newfile:text):cint;
@@ -447,7 +447,7 @@ var
 begin
 begin
   SetLength(fpReadLink,PATH_MAX);
   SetLength(fpReadLink,PATH_MAX);
   SystemFileName:=ToSingleByteFileSystemEncodedFileName(Name);
   SystemFileName:=ToSingleByteFileSystemEncodedFileName(Name);
-  i:=fpReadLink(pchar(SystemFileName),pchar(fpReadLink),PATH_MAX);
+  i:=fpReadLink(PAnsiChar(SystemFileName),PAnsiChar(fpReadLink),PATH_MAX);
   if i>0 then
   if i>0 then
    begin
    begin
      SetLength(fpReadLink,i);
      SetLength(fpReadLink,i);

+ 5 - 5
rtl/unix/bunxovlh.inc

@@ -21,11 +21,11 @@ Function  FpChmod   (const path : RawByteString; Mode : TMode): cInt; inline;
 Function  FpChown   (const path : RawByteString; owner : TUid; group : TGid): cInt; inline;
 Function  FpChown   (const path : RawByteString; owner : TUid; group : TGid): cInt; inline;
 Function  FpUtime   (const path : RawByteString; times : putimbuf): cInt; inline;
 Function  FpUtime   (const path : RawByteString; times : putimbuf): cInt; inline;
 Function  FpGetcwd : RawByteString;
 Function  FpGetcwd : RawByteString;
-Function  FpExecve  (const path : RawByteString; argv : ppchar; envp: ppchar): cInt; inline;
-Function  FpExecv   (const path : RawByteString; argv : ppchar): cInt; inline;
+Function  FpExecve  (const path : RawByteString; argv : ppansichar; envp: ppansichar): cInt; inline;
+Function  FpExecv   (const path : RawByteString; argv : ppansichar): cInt; inline;
 Function  FpOpendir (const dirname : RawByteString): pDir; inline;
 Function  FpOpendir (const dirname : RawByteString): pDir; inline;
 Function  FpOpendir (dirname : ShortString): pDir; inline;
 Function  FpOpendir (dirname : ShortString): pDir; inline;
-Function  FpOpen    (path : pChar; flags : cInt):cInt; inline;
+Function  FpOpen    (path : PAnsiChar; flags : cInt):cInt; inline;
 Function  FpOpen    (const path : RawByteString; flags : cInt):cInt; inline;
 Function  FpOpen    (const path : RawByteString; flags : cInt):cInt; inline;
 Function  FpOpen    (const path : RawByteString; flags : cInt; Mode: TMode):cInt; inline;
 Function  FpOpen    (const path : RawByteString; flags : cInt; Mode: TMode):cInt; inline;
 Function  FpOpen    (path : ShortString; flags : cInt):cInt;
 Function  FpOpen    (path : ShortString; flags : cInt):cInt;
@@ -38,7 +38,7 @@ Function  FpRename  (const old  : RawByteString; const newpath: RawByteString):
 Function  FpStat    (const path: RawByteString; var buf : stat): cInt; inline;
 Function  FpStat    (const path: RawByteString; var buf : stat): cInt; inline;
 Function  FpStat    (path: ShortString; var buf : stat): cInt;
 Function  FpStat    (path: ShortString; var buf : stat): cInt;
 Function  fpLstat   (const path: RawByteString; Info: pstat):cint; inline;
 Function  fpLstat   (const path: RawByteString; Info: pstat):cint; inline;
-Function  fpLstat   (path:pchar;var Info:stat):cint; inline;
+Function  fpLstat   (path: PAnsiChar;var Info:stat):cint; inline;
 Function  fpLstat   (const Filename: RawByteString;var Info:stat):cint; inline;
 Function  fpLstat   (const Filename: RawByteString;var Info:stat):cint; inline;
 Function  FpAccess  (const pathname : RawByteString; aMode : cInt): cInt; inline;
 Function  FpAccess  (const pathname : RawByteString; aMode : cInt): cInt; inline;
 function  FpWaitPid (pid : TPid; Var Status : cInt; Options : cint) : TPid;
 function  FpWaitPid (pid : TPid; Var Status : cInt; Options : cint) : TPid;
@@ -65,7 +65,7 @@ function  fptime    :time_t; inline;
 Function fpSelect   (N:cint;readfds,writefds,exceptfds:pfdset;TimeOut:cint):cint;
 Function fpSelect   (N:cint;readfds,writefds,exceptfds:pfdset;TimeOut:cint):cint;
 Function fpSelect   (var T:Text;TimeOut :PTimeval):cint;
 Function fpSelect   (var T:Text;TimeOut :PTimeval):cint;
 Function fpSelect   (var T:Text;TimeOut :time_t):cint;
 Function fpSelect   (var T:Text;TimeOut :time_t):cint;
-Function FpGetEnv   (name : String): pChar; deprecated; // because shortstring
+Function FpGetEnv   (name : ShortString): PAnsiChar; deprecated; // because shortstring
 
 
 // macro's
 // macro's
 
 

+ 8 - 8
rtl/unix/cwstraix.inc

@@ -13,15 +13,15 @@
 
 
  **********************************************************************}
  **********************************************************************}
 
 
-function Ansi2AnsiMove(source:pchar; fromcp:TSystemCodePage; const tocp: pchar; out dest:rawbytestring; len:SizeInt): boolean;
+function Ansi2AnsiMove(source:PAnsiChar; fromcp:TSystemCodePage; const tocp: PAnsiChar; out dest:rawbytestring; len:SizeInt): boolean;
   var
   var
     outlength,
     outlength,
     outoffset,
     outoffset,
     outleft : size_t;
     outleft : size_t;
     use_iconv: iconv_t;
     use_iconv: iconv_t;
     srcpos,
     srcpos,
-    destpos: pchar;
-    mynil : pchar;
+    destpos: PAnsiChar;
+    mynil : PAnsiChar;
     my0 : size_t;
     my0 : size_t;
     err: cint;
     err: cint;
   begin
   begin
@@ -35,7 +35,7 @@ function Ansi2AnsiMove(source:pchar; fromcp:TSystemCodePage; const tocp: pchar;
     outlength:=len;
     outlength:=len;
     setlength(dest,outlength);
     setlength(dest,outlength);
     srcpos:=source;
     srcpos:=source;
-    destpos:=pchar(dest);
+    destpos:=PAnsiChar(dest);
     outleft:=outlength;
     outleft:=outlength;
     while iconv(use_iconv,@srcpos,psize(@len),@destpos,@outleft)=size_t(-1) do
     while iconv(use_iconv,@srcpos,psize(@len),@destpos,@outleft)=size_t(-1) do
       begin
       begin
@@ -47,7 +47,7 @@ function Ansi2AnsiMove(source:pchar; fromcp:TSystemCodePage; const tocp: pchar;
               { skip and set to '?' }
               { skip and set to '?' }
               inc(srcpos);
               inc(srcpos);
               dec(len);
               dec(len);
-              pchar(destpos)^:='?';
+              PAnsiChar(destpos)^:='?';
               inc(destpos,2);
               inc(destpos,2);
               dec(outleft,2);
               dec(outleft,2);
               { reset }
               { reset }
@@ -57,13 +57,13 @@ function Ansi2AnsiMove(source:pchar; fromcp:TSystemCodePage; const tocp: pchar;
             end;
             end;
           ESysE2BIG:
           ESysE2BIG:
             begin
             begin
-              outoffset:=destpos-pchar(dest);
+              outoffset:=destpos-PAnsiChar(dest);
               { extend }
               { extend }
               setlength(dest,outlength+len);
               setlength(dest,outlength+len);
               inc(outleft,len);
               inc(outleft,len);
               inc(outlength,len);
               inc(outlength,len);
               { string could have been moved }
               { string could have been moved }
-              destpos:=pchar(dest)+outoffset;
+              destpos:=PAnsiChar(dest)+outoffset;
             end;
             end;
           else
           else
             runerror(231);
             runerror(231);
@@ -76,7 +76,7 @@ function Ansi2AnsiMove(source:pchar; fromcp:TSystemCodePage; const tocp: pchar;
   end;
   end;
 
 
 
 
-function handle_aix_intermediate(source: pchar; sourcecp: TSystemCodePage; out newcp: TSystemCodePage; out str: rawbytestring; len: SizeInt): boolean;
+function handle_aix_intermediate(source: PAnsiChar; sourcecp: TSystemCodePage; out newcp: TSystemCodePage; out str: rawbytestring; len: SizeInt): boolean;
   begin
   begin
     result:=false;
     result:=false;
     { for some reason, IBM's iconv only supports converting cp866 to/from
     { for some reason, IBM's iconv only supports converting cp866 to/from

+ 65 - 65
rtl/unix/cwstring.pp

@@ -101,22 +101,22 @@ function towlower(__wc:wint_t):wint_t;cdecl;external clib name 'towlower';
 function towupper(__wc:wint_t):wint_t;cdecl;external clib name 'towupper';
 function towupper(__wc:wint_t):wint_t;cdecl;external clib name 'towupper';
 
 
 function wcscoll (__s1:pwchar_t; __s2:pwchar_t):cint;cdecl;external clib name 'wcscoll';
 function wcscoll (__s1:pwchar_t; __s2:pwchar_t):cint;cdecl;external clib name 'wcscoll';
-function strcoll (__s1:pchar; __s2:pchar):cint;cdecl;external clib name 'strcoll';
+function strcoll (__s1:PAnsiChar; __s2:PAnsiChar):cint;cdecl;external clib name 'strcoll';
 {$ifdef netbsd}
 {$ifdef netbsd}
   { NetBSD has a new setlocale function defined in /usr/include/locale.h
   { NetBSD has a new setlocale function defined in /usr/include/locale.h
     that should be used }
     that should be used }
-function setlocale(category: cint; locale: pchar): pchar; cdecl; external clib name '__setlocale50';
+function setlocale(category: cint; locale: PAnsiChar): PAnsiChar; cdecl; external clib name '__setlocale50';
 {$else}
 {$else}
-function setlocale(category: cint; locale: pchar): pchar; cdecl; external clib name 'setlocale';
+function setlocale(category: cint; locale: PAnsiChar): PAnsiChar; cdecl; external clib name 'setlocale';
 {$endif}
 {$endif}
 {$if not(defined(beos) and not defined(haiku))}
 {$if not(defined(beos) and not defined(haiku))}
-function mbrtowc(pwc: pwchar_t; const s: pchar; n: size_t; ps: pmbstate_t): size_t; cdecl; external clib name 'mbrtowc';
-function wcrtomb(s: pchar; wc: wchar_t; ps: pmbstate_t): size_t; cdecl; external clib name 'wcrtomb';
-function mbrlen(const s: pchar; n: size_t; ps: pmbstate_t): size_t; cdecl; external clib name 'mbrlen';
+function mbrtowc(pwc: pwchar_t; const s: PAnsiChar; n: size_t; ps: pmbstate_t): size_t; cdecl; external clib name 'mbrtowc';
+function wcrtomb(s: PAnsiChar; wc: wchar_t; ps: pmbstate_t): size_t; cdecl; external clib name 'wcrtomb';
+function mbrlen(const s: PAnsiChar; n: size_t; ps: pmbstate_t): size_t; cdecl; external clib name 'mbrlen';
 {$else beos}
 {$else beos}
-function mbtowc(pwc: pwchar_t; const s: pchar; n: size_t): size_t; cdecl; external clib name 'mbtowc';
-function wctomb(s: pchar; wc: wchar_t): size_t; cdecl; external clib name 'wctomb';
-function mblen(const s: pchar; n: size_t): size_t; cdecl; external clib name 'mblen';
+function mbtowc(pwc: pwchar_t; const s: PAnsiChar; n: size_t): size_t; cdecl; external clib name 'mbtowc';
+function wctomb(s: PAnsiChar; wc: wchar_t): size_t; cdecl; external clib name 'wctomb';
+function mblen(const s: PAnsiChar; n: size_t): size_t; cdecl; external clib name 'mblen';
 {$endif beos}
 {$endif beos}
 
 
 
 
@@ -207,22 +207,22 @@ type
   nl_item = cint;
   nl_item = cint;
 
 
 {$ifdef haiku}
 {$ifdef haiku}
-  function nl_langinfo(__item:nl_item):pchar;cdecl;external 'root' name 'nl_langinfo';
+  function nl_langinfo(__item:nl_item):PAnsiChar;cdecl;external 'root' name 'nl_langinfo';
 {$else}
 {$else}
   {$ifndef beos}
   {$ifndef beos}
-  function nl_langinfo(__item:nl_item):pchar;cdecl;external libiconvname name 'nl_langinfo';
+  function nl_langinfo(__item:nl_item):PAnsiChar;cdecl;external libiconvname name 'nl_langinfo';
   {$endif}
   {$endif}
 {$endif}
 {$endif}
 
 
 {$if (not defined(bsd) and not defined(beos)) or defined(iconv_is_in_libc) or (defined(darwin) and not defined(cpupowerpc32))}
 {$if (not defined(bsd) and not defined(beos)) or defined(iconv_is_in_libc) or (defined(darwin) and not defined(cpupowerpc32))}
-function iconv_open(__tocode:pchar; __fromcode:pchar):iconv_t;cdecl;external libiconvname name 'iconv_open';
-function iconv(__cd:iconv_t; __inbuf:ppchar; __inbytesleft:psize_t; __outbuf:ppchar; __outbytesleft:psize_t):size_t;cdecl;external libiconvname name 'iconv';
+function iconv_open(__tocode:PAnsiChar; __fromcode:PAnsiChar):iconv_t;cdecl;external libiconvname name 'iconv_open';
+function iconv(__cd:iconv_t; __inbuf:PPAnsiChar; __inbytesleft:psize_t; __outbuf:PPAnsiChar; __outbytesleft:psize_t):size_t;cdecl;external libiconvname name 'iconv';
 function iconv_close(__cd:iconv_t):cint;cdecl;external libiconvname name 'iconv_close';
 function iconv_close(__cd:iconv_t):cint;cdecl;external libiconvname name 'iconv_close';
 const
 const
   iconvctlname='iconvctl';
   iconvctlname='iconvctl';
 {$else}
 {$else}
-function iconv_open(__tocode:pchar; __fromcode:pchar):iconv_t;cdecl;external libiconvname name 'libiconv_open';
-function iconv(__cd:iconv_t; __inbuf:ppchar; __inbytesleft:psize_t; __outbuf:ppchar; __outbytesleft:psize_t):size_t;cdecl;external libiconvname name 'libiconv';
+function iconv_open(__tocode:PAnsiChar; __fromcode:PAnsiChar):iconv_t;cdecl;external libiconvname name 'libiconv_open';
+function iconv(__cd:iconv_t; __inbuf:PPAnsiChar; __inbytesleft:psize_t; __outbuf:PPAnsiChar; __outbytesleft:psize_t):size_t;cdecl;external libiconvname name 'libiconv';
 function iconv_close(__cd:iconv_t):cint;cdecl;external libiconvname name 'libiconv_close';
 function iconv_close(__cd:iconv_t):cint;cdecl;external libiconvname name 'libiconv_close';
 const
 const
   iconvctlname='libiconvctl';
   iconvctlname='libiconvctl';
@@ -268,8 +268,8 @@ begin
   toencoding:=iconvname;
   toencoding:=iconvname;
   if not assigned(iconvctl) then
   if not assigned(iconvctl) then
     toencoding:=toencoding+'//TRANSLIT';
     toencoding:=toencoding+'//TRANSLIT';
-  iconv_wide2ansi:=iconv_open(pchar(toencoding),unicode_encoding2);
-  iconv_ansi2wide:=iconv_open(unicode_encoding2,pchar(iconvname));
+  iconv_wide2ansi:=iconv_open(PAnsiChar(toencoding),unicode_encoding2);
+  iconv_ansi2wide:=iconv_open(unicode_encoding2,PAnsiChar(iconvname));
   if assigned(iconvctl) and
   if assigned(iconvctl) and
      (iconv_wide2ansi<>iconv_t(-1)) then
      (iconv_wide2ansi<>iconv_t(-1)) then
   begin
   begin
@@ -289,7 +289,7 @@ end;
 
 
 
 
 {$if defined(beos) and not defined(haiku)}
 {$if defined(beos) and not defined(haiku)}
-function nl_langinfo(__item:nl_item):pchar;
+function nl_langinfo(__item:nl_item):PAnsiChar;
 begin
 begin
   {$warning TODO BeOS nl_langinfo or more uptodate port of iconv...}
   {$warning TODO BeOS nl_langinfo or more uptodate port of iconv...}
   // Now implement the minimum required to correctly initialize WideString support
   // Now implement the minimum required to correctly initialize WideString support
@@ -305,7 +305,7 @@ end;
 {$endif}
 {$endif}
 
 
 
 
-function open_iconv_for_cps(cp: TSystemCodePage; const otherencoding: pchar; cp_is_from: boolean): iconv_t;
+function open_iconv_for_cps(cp: TSystemCodePage; const otherencoding: PAnsiChar; cp_is_from: boolean): iconv_t;
   var
   var
     iconvindex: longint;
     iconvindex: longint;
     toencoding: rawbytestring;
     toencoding: rawbytestring;
@@ -314,7 +314,7 @@ function open_iconv_for_cps(cp: TSystemCodePage; const otherencoding: pchar; cp_
     { TODO: add caching (then we also don't need separate code for
     { TODO: add caching (then we also don't need separate code for
       the default system page and other ones)
       the default system page and other ones)
 
 
-      -- typecasting an ansistring function result to pchar is
+      -- typecasting an ansistring function result to PAnsiChar is
         unsafe normally, but these are constant strings -> no
         unsafe normally, but these are constant strings -> no
         problem }
         problem }
     open_iconv_for_cps:=iconv_t(-1);
     open_iconv_for_cps:=iconv_t(-1);
@@ -323,13 +323,13 @@ function open_iconv_for_cps(cp: TSystemCodePage; const otherencoding: pchar; cp_
       exit;
       exit;
     repeat
     repeat
       if cp_is_from then
       if cp_is_from then
-        open_iconv_for_cps:=iconv_open(otherencoding,pchar(UnixCpMap[iconvindex].name))
+        open_iconv_for_cps:=iconv_open(otherencoding,PAnsiChar(UnixCpMap[iconvindex].name))
       else
       else
       begin
       begin
         toencoding:=UnixCpMap[iconvindex].name;
         toencoding:=UnixCpMap[iconvindex].name;
         if not assigned(iconvctl) then
         if not assigned(iconvctl) then
           toencoding:=toencoding+'//TRANSLIT';
           toencoding:=toencoding+'//TRANSLIT';
-        open_iconv_for_cps:=iconv_open(pchar(toencoding),otherencoding);
+        open_iconv_for_cps:=iconv_open(PAnsiChar(toencoding),otherencoding);
       end;
       end;
       inc(iconvindex);
       inc(iconvindex);
     until (open_iconv_for_cps<>iconv_t(-1)) or
     until (open_iconv_for_cps<>iconv_t(-1)) or
@@ -357,8 +357,8 @@ procedure Wide2AnsiMove(source:pwidechar; var dest:RawByteString; cp:TSystemCode
     outleft : size_t;
     outleft : size_t;
     use_iconv: iconv_t;
     use_iconv: iconv_t;
     srcpos : pwidechar;
     srcpos : pwidechar;
-    destpos: pchar;
-    mynil : pchar;
+    destpos: PAnsiChar;
+    mynil : PAnsiChar;
     my0 : size_t;
     my0 : size_t;
     err : longint;
     err : longint;
     transliterate: cint;
     transliterate: cint;
@@ -373,7 +373,7 @@ procedure Wide2AnsiMove(source:pwidechar; var dest:RawByteString; cp:TSystemCode
     if cp=866 then
     if cp=866 then
       begin
       begin
         Wide2AnsiMove(source,intermediate,28595,len);
         Wide2AnsiMove(source,intermediate,28595,len);
-        if handle_aix_intermediate(pchar(intermediate),28595,cp,dest,len) then
+        if handle_aix_intermediate(PAnsiChar(intermediate),28595,cp,dest,len) then
           exit;
           exit;
       end;
       end;
 {$endif aix}
 {$endif aix}
@@ -413,9 +413,9 @@ procedure Wide2AnsiMove(source:pwidechar; var dest:RawByteString; cp:TSystemCode
     outlength:=len*3;
     outlength:=len*3;
     srclen:=len*2;
     srclen:=len*2;
     srcpos:=source;
     srcpos:=source;
-    destpos:=pchar(dest);
+    destpos:=PAnsiChar(dest);
     outleft:=outlength;
     outleft:=outlength;
-    while iconv(use_iconv,ppchar(@srcpos),@srclen,@destpos,@outleft)=size_t(-1) do
+    while iconv(use_iconv,PPAnsiChar(@srcpos),@srclen,@destpos,@outleft)=size_t(-1) do
       begin
       begin
         err:=fpgetCerrno;
         err:=fpgetCerrno;
         case err of
         case err of
@@ -437,13 +437,13 @@ procedure Wide2AnsiMove(source:pwidechar; var dest:RawByteString; cp:TSystemCode
             end;
             end;
           ESysE2BIG:
           ESysE2BIG:
             begin
             begin
-              outoffset:=destpos-pchar(dest);
+              outoffset:=destpos-PAnsiChar(dest);
               { extend }
               { extend }
               setlength(dest,outlength+len*3);
               setlength(dest,outlength+len*3);
               inc(outleft,len*3);
               inc(outleft,len*3);
               inc(outlength,len*3);
               inc(outlength,len*3);
               { string could have been moved }
               { string could have been moved }
-              destpos:=pchar(dest)+outoffset;
+              destpos:=PAnsiChar(dest)+outoffset;
             end;
             end;
           else
           else
             runerror(231);
             runerror(231);
@@ -457,15 +457,15 @@ procedure Wide2AnsiMove(source:pwidechar; var dest:RawByteString; cp:TSystemCode
   end;
   end;
 
 
 
 
-procedure Ansi2WideMove(source:pchar; cp:TSystemCodePage; var dest:widestring; len:SizeInt);
+procedure Ansi2WideMove(source:PAnsiChar; cp:TSystemCodePage; var dest:widestring; len:SizeInt);
   var
   var
     outlength,
     outlength,
     outoffset,
     outoffset,
     outleft : size_t;
     outleft : size_t;
     use_iconv: iconv_t;
     use_iconv: iconv_t;
     srcpos,
     srcpos,
-    destpos: pchar;
-    mynil : pchar;
+    destpos: PAnsiChar;
+    mynil : PAnsiChar;
     my0 : size_t;
     my0 : size_t;
     err: cint;
     err: cint;
     iconvindex: longint;
     iconvindex: longint;
@@ -480,7 +480,7 @@ procedure Ansi2WideMove(source:pchar; cp:TSystemCodePage; var dest:widestring; l
     if cp=866 then
     if cp=866 then
       begin
       begin
         if handle_aix_intermediate(source,cp,cp,intermediate,len) then
         if handle_aix_intermediate(source,cp,cp,intermediate,len) then
-          source:=pchar(intermediate);
+          source:=PAnsiChar(intermediate);
       end;
       end;
 {$endif aix}
 {$endif aix}
     if (cp=DefaultSystemCodePage) then
     if (cp=DefaultSystemCodePage) then
@@ -500,7 +500,7 @@ procedure Ansi2WideMove(source:pchar; cp:TSystemCodePage; var dest:widestring; l
         { TODO: add caching (then we also don't need separate code for
         { TODO: add caching (then we also don't need separate code for
           the default system page and other ones)
           the default system page and other ones)
 
 
-          -- typecasting an ansistring function result to pchar is
+          -- typecasting an ansistring function result to PAnsiChar is
             unsafe normally, but these are constant strings -> no
             unsafe normally, but these are constant strings -> no
             problem }
             problem }
         use_iconv:=open_iconv_for_cps(cp,unicode_encoding2,true);
         use_iconv:=open_iconv_for_cps(cp,unicode_encoding2,true);
@@ -518,7 +518,7 @@ procedure Ansi2WideMove(source:pchar; cp:TSystemCodePage; var dest:widestring; l
     outlength:=len+1;
     outlength:=len+1;
     setlength(dest,outlength);
     setlength(dest,outlength);
     srcpos:=source;
     srcpos:=source;
-    destpos:=pchar(dest);
+    destpos:=PAnsiChar(dest);
     outleft:=outlength*2;
     outleft:=outlength*2;
     while iconv(use_iconv,@srcpos,psize(@len),@destpos,@outleft)=size_t(-1) do
     while iconv(use_iconv,@srcpos,psize(@len),@destpos,@outleft)=size_t(-1) do
       begin
       begin
@@ -540,13 +540,13 @@ procedure Ansi2WideMove(source:pchar; cp:TSystemCodePage; var dest:widestring; l
             end;
             end;
           ESysE2BIG:
           ESysE2BIG:
             begin
             begin
-              outoffset:=destpos-pchar(dest);
+              outoffset:=destpos-PAnsiChar(dest);
               { extend }
               { extend }
               setlength(dest,outlength+len);
               setlength(dest,outlength+len);
               inc(outleft,len*2);
               inc(outleft,len*2);
               inc(outlength,len);
               inc(outlength,len);
               { string could have been moved }
               { string could have been moved }
-              destpos:=pchar(dest)+outoffset;
+              destpos:=PAnsiChar(dest)+outoffset;
             end;
             end;
           else
           else
             runerror(231);
             runerror(231);
@@ -589,28 +589,28 @@ begin
 end;
 end;
 
 
 
 
-procedure ConcatCharToAnsiStr(const c: char; var S: AnsiString; var index: SizeInt);
+procedure ConcatCharToAnsiStr(const c: AnsiChar; var S: AnsiString; var index: SizeInt);
 begin
 begin
   EnsureAnsiLen(s,index);
   EnsureAnsiLen(s,index);
-  pchar(@s[index])^:=c;
+  PAnsiChar(@s[index])^:=c;
   inc(index);
   inc(index);
 end;
 end;
 
 
 
 
-{ concatenates an utf-32 char to a widestring. S *must* be unique when entering. }
+{ concatenates an utf-32 Char to a ansistring. S *must* be unique when entering. }
 {$if not(defined(beos) and not defined(haiku))}
 {$if not(defined(beos) and not defined(haiku))}
 procedure ConcatUTF32ToAnsiStr(const nc: wint_t; var S: AnsiString; var index: SizeInt; var mbstate: mbstate_t);
 procedure ConcatUTF32ToAnsiStr(const nc: wint_t; var S: AnsiString; var index: SizeInt; var mbstate: mbstate_t);
 {$else not beos}
 {$else not beos}
 procedure ConcatUTF32ToAnsiStr(const nc: wint_t; var S: AnsiString; var index: SizeInt);
 procedure ConcatUTF32ToAnsiStr(const nc: wint_t; var S: AnsiString; var index: SizeInt);
 {$endif beos}
 {$endif beos}
 var
 var
-  p     : pchar;
+  p     : PAnsiChar;
   mblen : size_t;
   mblen : size_t;
 begin
 begin
   { we know that s is unique -> avoid uniquestring calls}
   { we know that s is unique -> avoid uniquestring calls}
   p:=@s[index];
   p:=@s[index];
   if (nc<=127) then
   if (nc<=127) then
-    ConcatCharToAnsiStr(char(nc),s,index)
+    ConcatCharToAnsiStr(AnsiChar(nc),s,index)
   else
   else
     begin
     begin
       EnsureAnsiLen(s,index+MB_CUR_MAX);
       EnsureAnsiLen(s,index+MB_CUR_MAX);
@@ -623,7 +623,7 @@ begin
         inc(index,mblen)
         inc(index,mblen)
       else
       else
         begin
         begin
-          { invalid wide char }
+          { invalid wide AnsiChar }
           p^:='?';
           p^:='?';
           inc(index);
           inc(index);
         end;
         end;
@@ -659,9 +659,9 @@ function LowerAnsiString(const s : AnsiString) : AnsiString;
           end
           end
         else
         else
 {$if not(defined(beos) and not defined(haiku))}
 {$if not(defined(beos) and not defined(haiku))}
-          mblen:=mbrtowc(@wc, pchar(@s[i]), slen-i+1, @ombstate);
+          mblen:=mbrtowc(@wc, PAnsiChar(@s[i]), slen-i+1, @ombstate);
 {$else not beos}
 {$else not beos}
-          mblen:=mbtowc(@wc, pchar(@s[i]), slen-i+1);
+          mblen:=mbtowc(@wc, PAnsiChar(@s[i]), slen-i+1);
 {$endif not beos}
 {$endif not beos}
         case mblen of
         case mblen of
           size_t(-2):
           size_t(-2):
@@ -726,9 +726,9 @@ function UpperAnsiString(const s : AnsiString) : AnsiString;
           end
           end
         else
         else
 {$if not(defined(beos) and not defined(haiku))}
 {$if not(defined(beos) and not defined(haiku))}
-          mblen:=mbrtowc(@wc, pchar(@s[i]), slen-i+1, @ombstate);
+          mblen:=mbrtowc(@wc, PAnsiChar(@s[i]), slen-i+1, @ombstate);
 {$else not beos}
 {$else not beos}
-          mblen:=mbtowc(@wc, pchar(@s[i]), slen-i+1);
+          mblen:=mbtowc(@wc, PAnsiChar(@s[i]), slen-i+1);
 {$endif beos}
 {$endif beos}
         case mblen of
         case mblen of
           size_t(-2):
           size_t(-2):
@@ -867,10 +867,10 @@ function CompareWideString(const s1, s2 : WideString; Options : TCompareOptions)
   code point is encountered, all characters part of this invalid code point
   code point is encountered, all characters part of this invalid code point
   are considered to form one "character" and the next character is
   are considered to form one "character" and the next character is
   considered to be the start of a new (possibly also invalid) code point }
   considered to be the start of a new (possibly also invalid) code point }
-function CharLengthPChar(const Str: PChar): PtrInt;
+function CharLengthPChar(const Str: PAnsiChar): PtrInt;
   var
   var
     nextlen: ptrint;
     nextlen: ptrint;
-    s: pchar;
+    s: PAnsiChar;
 {$if not(defined(beos) and not defined(haiku))}
 {$if not(defined(beos) and not defined(haiku))}
     mbstate: mbstate_t;
     mbstate: mbstate_t;
 {$endif not beos}
 {$endif not beos}
@@ -895,7 +895,7 @@ function CharLengthPChar(const Str: PChar): PtrInt;
   end;
   end;
 
 
 
 
-function CodePointLength(const Str: PChar; maxlookahead: ptrint): PtrInt;
+function CodePointLength(const Str: PAnsiChar; maxlookahead: ptrint): PtrInt;
 {$if not(defined(beos) and not defined(haiku))}
 {$if not(defined(beos) and not defined(haiku))}
   var
   var
     mbstate: mbstate_t;
     mbstate: mbstate_t;
@@ -914,9 +914,9 @@ function CodePointLength(const Str: PChar; maxlookahead: ptrint): PtrInt;
   end;
   end;
 
 
 
 
-function StrCompAnsiIntern(s1,s2 : PChar; len1, len2: PtrInt; canmodifys1, canmodifys2: boolean): PtrInt;
+function StrCompAnsiIntern(s1,s2 : PAnsiChar; len1, len2: PtrInt; canmodifys1, canmodifys2: boolean): PtrInt;
   var
   var
-    a,b: pchar;
+    a,b: PAnsiChar;
     i: PtrInt;
     i: PtrInt;
   begin
   begin
     if not(canmodifys1) then
     if not(canmodifys1) then
@@ -950,11 +950,11 @@ function StrCompAnsiIntern(s1,s2 : PChar; len1, len2: PtrInt; canmodifys1, canmo
 
 
 function CompareStrAnsiString(const s1, s2: ansistring): PtrInt;
 function CompareStrAnsiString(const s1, s2: ansistring): PtrInt;
   begin
   begin
-    result:=StrCompAnsiIntern(pchar(s1),pchar(s2),length(s1),length(s2),false,false);
+    result:=StrCompAnsiIntern(PAnsiChar(s1),PAnsiChar(s2),length(s1),length(s2),false,false);
   end;
   end;
 
 
 
 
-function StrCompAnsi(s1,s2 : PChar): PtrInt;
+function StrCompAnsi(s1,s2 : PAnsiChar): PtrInt;
   begin
   begin
     result:=strcoll(s1,s2);
     result:=strcoll(s1,s2);
   end;
   end;
@@ -966,19 +966,19 @@ function AnsiCompareText(const S1, S2: ansistring): PtrInt;
   begin
   begin
     a:=UpperAnsistring(s1);
     a:=UpperAnsistring(s1);
     b:=UpperAnsistring(s2);
     b:=UpperAnsistring(s2);
-    result:=StrCompAnsiIntern(pchar(a),pchar(b),length(a),length(b),true,true);
+    result:=StrCompAnsiIntern(PAnsiChar(a),PAnsiChar(b),length(a),length(b),true,true);
   end;
   end;
 
 
 
 
-function AnsiStrIComp(S1, S2: PChar): PtrInt;
+function AnsiStrIComp(S1, S2: PAnsiChar): PtrInt;
   begin
   begin
     result:=AnsiCompareText(ansistring(s1),ansistring(s2));
     result:=AnsiCompareText(ansistring(s1),ansistring(s2));
   end;
   end;
 
 
 
 
-function AnsiStrLComp(S1, S2: PChar; MaxLen: PtrUInt): PtrInt;
+function AnsiStrLComp(S1, S2: PAnsiChar; MaxLen: PtrUInt): PtrInt;
   var
   var
-    a, b: pchar;
+    a, b: PAnsiChar;
 begin
 begin
   if (maxlen=0) then
   if (maxlen=0) then
     exit(0);
     exit(0);
@@ -1006,7 +1006,7 @@ begin
 end;
 end;
 
 
 
 
-function AnsiStrLIComp(S1, S2: PChar; MaxLen: PtrUInt): PtrInt;
+function AnsiStrLIComp(S1, S2: PAnsiChar; MaxLen: PtrUInt): PtrInt;
   var
   var
     a, b: ansistring;
     a, b: ansistring;
 begin
 begin
@@ -1020,7 +1020,7 @@ begin
 end;
 end;
 
 
 
 
-procedure ansi2pchar(const s: ansistring; const orgp: pchar; out p: pchar);
+procedure ansi2pchar(const s: ansistring; const orgp: PAnsiChar; out p: PAnsiChar);
 var
 var
   newlen: sizeint;
   newlen: sizeint;
 begin
 begin
@@ -1034,7 +1034,7 @@ begin
 end;
 end;
 
 
 
 
-function AnsiStrLower(Str: PChar): PChar;
+function AnsiStrLower(Str: PAnsiChar): PAnsiChar;
 var
 var
   temp: ansistring;
   temp: ansistring;
 begin
 begin
@@ -1043,7 +1043,7 @@ begin
 end;
 end;
 
 
 
 
-function AnsiStrUpper(Str: PChar): PChar;
+function AnsiStrUpper(Str: PAnsiChar): PAnsiChar;
 var
 var
   temp: ansistring;
   temp: ansistring;
 begin
 begin
@@ -1052,9 +1052,9 @@ begin
 end;
 end;
 
 
 
 
-function envvarset(const varname: pchar): boolean;
+function envvarset(const varname: PAnsiChar): boolean;
 var
 var
-  varval: pchar;
+  varval: PAnsiChar;
 begin
 begin
   varval:=fpgetenv(varname);
   varval:=fpgetenv(varname);
   result:=
   result:=
@@ -1065,7 +1065,7 @@ end;
 
 
 function GetStandardCodePage(const stdcp: TStandardCodePageEnum): TSystemCodePage;
 function GetStandardCodePage(const stdcp: TStandardCodePageEnum): TSystemCodePage;
 var
 var
-  langinfo: pchar;
+  langinfo: PAnsiChar;
 begin
 begin
 {$ifdef FPCRTL_FILESYSTEM_UTF8}
 {$ifdef FPCRTL_FILESYSTEM_UTF8}
   if stdcp=scpFileSystemSingleByte then
   if stdcp=scpFileSystemSingleByte then

+ 9 - 9
rtl/unix/dl.pp

@@ -79,22 +79,22 @@ const
 type
 type
   Pdl_info = ^dl_info;
   Pdl_info = ^dl_info;
   dl_info = record
   dl_info = record
-    dli_fname      : Pchar;
+    dli_fname      : PAnsiChar;
     dli_fbase      : pointer;
     dli_fbase      : pointer;
-    dli_sname      : Pchar;
+    dli_sname      : PAnsiChar;
     dli_saddr      : pointer;
     dli_saddr      : pointer;
   end;
   end;
 
 
-function dlopen(Name : PChar; Flags : longint) : Pointer; cdecl; external libdl;
-function dlsym(Lib : Pointer; Name : Pchar) : Pointer; cdecl; external Libdl;
+function dlopen(Name : PAnsiChar; Flags : longint) : Pointer; cdecl; external libdl;
+function dlsym(Lib : Pointer; Name : PAnsiChar) : Pointer; cdecl; external Libdl;
 {$ifdef ELF}
 {$ifdef ELF}
-function dlvsym(Lib : Pointer; Name : Pchar; Version: Pchar) : Pointer; cdecl; external Libdl;
+function dlvsym(Lib : Pointer; Name : PAnsiChar; Version: PAnsiChar) : Pointer; cdecl; external Libdl;
 {$endif}
 {$endif}
 function dlclose(Lib : Pointer) : Longint; cdecl; external libdl;
 function dlclose(Lib : Pointer) : Longint; cdecl; external libdl;
-function dlerror() : Pchar; cdecl; external libdl;
+function dlerror() : PAnsiChar; cdecl; external libdl;
 
 
 { overloaded for compatibility with hmodule }
 { overloaded for compatibility with hmodule }
-function dlsym(Lib : PtrInt; Name : Pchar) : Pointer; cdecl; external Libdl;
+function dlsym(Lib : PtrInt; Name : PAnsiChar) : Pointer; cdecl; external Libdl;
 function dlclose(Lib : PtrInt) : Longint; cdecl; external libdl;
 function dlclose(Lib : PtrInt) : Longint; cdecl; external libdl;
 function dladdr(Lib: pointer; info: Pdl_info): Longint; cdecl; {$if not defined(aix) and not defined(android)} external; {$endif}
 function dladdr(Lib: pointer; info: Pdl_info): Longint; cdecl; {$if not defined(aix) and not defined(android)} external; {$endif}
 
 
@@ -102,7 +102,7 @@ type
   plink_map = ^link_map;
   plink_map = ^link_map;
   link_map = record
   link_map = record
     l_addr:pointer;  { Difference between the address in the ELF file and the address in memory }
     l_addr:pointer;  { Difference between the address in the ELF file and the address in memory }
-    l_name:Pchar;  { Absolute pathname where object was found }
+    l_name:PAnsiChar;  { Absolute pathname where object was found }
     l_ld:pointer;    { Dynamic section of the shared object }
     l_ld:pointer;    { Dynamic section of the shared object }
     l_next, l_prev:^link_map; { Chain of loaded objects }
     l_next, l_prev:^link_map; { Chain of loaded objects }
     {Plus additional fields private to the implementation }
     {Plus additional fields private to the implementation }
@@ -138,7 +138,7 @@ uses
     end;
     end;
 
 
 
 
-  procedure UnixGetModuleByAddr(addr: pointer; var baseaddr: pointer; var filename: openstring);
+  procedure UnixGetModuleByAddr(addr: pointer; var baseaddr: pointer; var filename: ansistring);
     var
     var
       dlinfo: dl_info;
       dlinfo: dl_info;
     begin
     begin

+ 19 - 19
rtl/unix/dos.pp

@@ -65,7 +65,7 @@ Uses
 {$DEFINE HAS_GETMSCOUNT}
 {$DEFINE HAS_GETMSCOUNT}
 
 
 {$DEFINE FPC_FEXPAND_TILDE} { Tilde is expanded to home }
 {$DEFINE FPC_FEXPAND_TILDE} { Tilde is expanded to home }
-{$DEFINE FPC_FEXPAND_GETENVPCHAR} { GetEnv result is a PChar }
+{$DEFINE FPC_FEXPAND_GETENVPCHAR} { GetEnv result is a PAnsiChar }
 
 
 {$I dos.inc}
 {$I dos.inc}
 
 
@@ -91,7 +91,7 @@ type
 
 
 Function DosVersion:Word;
 Function DosVersion:Word;
 Var
 Var
-  Buffer : Array[0..255] of Char;
+  Buffer : Array[0..255] of AnsiChar;
   Tmp2,
   Tmp2,
   TmpStr : String[40];
   TmpStr : String[40];
   TmpPos,
   TmpPos,
@@ -227,7 +227,7 @@ end;
 Procedure Exec (Const Path: PathStr; Const ComLine: ComStr);
 Procedure Exec (Const Path: PathStr; Const ComLine: ComStr);
 var
 var
   pid      : longint; // pid_t?
   pid      : longint; // pid_t?
-  cmdline2 : ppchar;
+  cmdline2 : PPAnsiChar;
   commandline : RawByteString;
   commandline : RawByteString;
   realpath : ansistring;
   realpath : ansistring;
 
 
@@ -248,16 +248,16 @@ Begin
        begin
        begin
          CommandLine:=ToSingleByteFileSystemEncodedFileName(ComLine);  // conversion must live till after fpexec!
          CommandLine:=ToSingleByteFileSystemEncodedFileName(ComLine);  // conversion must live till after fpexec!
          cmdline2:=StringtoPPChar(CommandLine,1);
          cmdline2:=StringtoPPChar(CommandLine,1);
-         cmdline2^:=pchar(realPath);
+         cmdline2^:=PAnsiChar(realPath);
        end
        end
      else
      else
        begin
        begin
-         getmem(cmdline2,2*sizeof(pchar));
-         cmdline2^:=pchar(realPath);
+         getmem(cmdline2,2*sizeof(PAnsiChar));
+         cmdline2^:=PAnsiChar(realPath);
          cmdline2[1]:=nil;
          cmdline2[1]:=nil;
        end;
        end;
      {The child does the actual exec, and then exits}
      {The child does the actual exec, and then exits}
-     fpExecv(pchar(realPath),cmdline2);
+     fpExecv(PAnsiChar(realPath),cmdline2);
      {If the execve fails, we return an exitvalue of 127, to let it be known}
      {If the execve fails, we return an exitvalue of 127, to let it be known}
      fpExit(127);
      fpExit(127);
    end
    end
@@ -293,7 +293,7 @@ End;
   They both return -1 when a failure occurs.
   They both return -1 when a failure occurs.
 }
 }
 Const
 Const
-  FixDriveStr : array[0..3] of pchar=(
+  FixDriveStr : array[0..3] of PAnsiChar=(
     '.',
     '.',
     '/fd0/.',
     '/fd0/.',
     '/fd1/.',
     '/fd1/.',
@@ -302,7 +302,7 @@ Const
 const
 const
   Drives   : byte = 4;
   Drives   : byte = 4;
 var
 var
-  DriveStr : array[4..26] of pchar;
+  DriveStr : array[4..26] of PAnsiChar;
 
 
 Function AddDisk(const path:string) : byte;
 Function AddDisk(const path:string) : byte;
 begin
 begin
@@ -551,7 +551,7 @@ Procedure FindNext(Var f: SearchRec);
 }
 }
 Var
 Var
 
 
-  DirName  : Array[0..256] of Char;
+  DirName  : Array[0..256] of AnsiChar;
   i,
   i,
   ArrayPos : Longint;
   ArrayPos : Longint;
   FName,
   FName,
@@ -699,7 +699,7 @@ Procedure GetFAttr(var f; var attr : word);
 Var
 Var
   info    : baseunix.stat;
   info    : baseunix.stat;
   LinAttr : longint;
   LinAttr : longint;
-  p       : pchar;
+  p       : PAnsiChar;
 {$ifndef FPC_ANSI_TEXTFILEREC}
 {$ifndef FPC_ANSI_TEXTFILEREC}
   r       : RawByteString;
   r       : RawByteString;
 {$endif not FPC_ANSI_TEXTFILEREC}
 {$endif not FPC_ANSI_TEXTFILEREC}
@@ -710,9 +710,9 @@ Begin
   p:=@textrec(f).name;
   p:=@textrec(f).name;
 {$else}
 {$else}
   r:=ToSingleByteFileSystemEncodedFileName(textrec(f).name);
   r:=ToSingleByteFileSystemEncodedFileName(textrec(f).name);
-  p:=pchar(r);
+  p:=PAnsiChar(r);
 {$endif}
 {$endif}
-  { use the pchar rather than the rawbytestring version so that we don't check
+  { use the PAnsiChar rather than the rawbytestring version so that we don't check
     a second time whether the string needs to be converted to the right code
     a second time whether the string needs to be converted to the right code
     page
     page
   }
   }
@@ -756,7 +756,7 @@ Procedure setftime(var f; time : longint);
 Var
 Var
   utim: utimbuf;
   utim: utimbuf;
   DT: DateTime;
   DT: DateTime;
-  p : pchar;
+  p : PAnsiChar;
 {$ifndef FPC_ANSI_TEXTFILEREC}
 {$ifndef FPC_ANSI_TEXTFILEREC}
   r : Rawbytestring;
   r : Rawbytestring;
 {$endif not FPC_ANSI_TEXTFILEREC}
 {$endif not FPC_ANSI_TEXTFILEREC}
@@ -773,9 +773,9 @@ Begin
   p:=@textrec(f).name;
   p:=@textrec(f).name;
 {$else}
 {$else}
   r:=ToSingleByteFileSystemEncodedFileName(textrec(f).name);
   r:=ToSingleByteFileSystemEncodedFileName(textrec(f).name);
-  p:=pchar(r);
+  p:=PAnsiChar(r);
 {$endif}
 {$endif}
-  { use the pchar rather than the rawbytestring version so that we don't check
+  { use the PAnsiChar rather than the rawbytestring version so that we don't check
     a second time whether the string needs to be converted to the right code
     a second time whether the string needs to be converted to the right code
     page
     page
   }
   }
@@ -793,7 +793,7 @@ End;
 Function EnvCount: Longint;
 Function EnvCount: Longint;
 var
 var
   envcnt : longint;
   envcnt : longint;
-  p      : ppchar;
+  p      : PPAnsiChar;
 Begin
 Begin
   envcnt:=0;
   envcnt:=0;
   p:=envp;      {defined in syslinux}
   p:=envp;      {defined in syslinux}
@@ -809,7 +809,7 @@ End;
 Function EnvStr (Index: longint): String;
 Function EnvStr (Index: longint): String;
 Var
 Var
   i : longint;
   i : longint;
-  p : ppchar;
+  p : PPAnsiChar;
 Begin
 Begin
   if Index <= 0 then
   if Index <= 0 then
     envstr:=''
     envstr:=''
@@ -832,7 +832,7 @@ end;
 
 
 Function GetEnv(EnvVar: String): String;
 Function GetEnv(EnvVar: String): String;
 var
 var
-  p     : pchar;
+  p     : PAnsiChar;
 Begin
 Begin
   p:=BaseUnix.fpGetEnv(EnvVar);
   p:=BaseUnix.fpGetEnv(EnvVar);
   if p=nil then
   if p=nil then

+ 2 - 2
rtl/unix/dynlibs.inc

@@ -46,7 +46,7 @@ end;
 Function SysGetProcedureAddress(Lib : TLibHandle; const ProcName : AnsiString) : Pointer;
 Function SysGetProcedureAddress(Lib : TLibHandle; const ProcName : AnsiString) : Pointer;
 
 
 begin
 begin
-  Result:=dlsym(lib,pchar(ProcName));
+  Result:=dlsym(lib,PAnsiChar(ProcName));
 end;
 end;
 
 
 Function SysUnloadLibrary(Lib : TLibHandle) : Boolean;
 Function SysUnloadLibrary(Lib : TLibHandle) : Boolean;
@@ -55,7 +55,7 @@ begin
   Result:=dlClose(Lib)=0;
   Result:=dlClose(Lib)=0;
 end;
 end;
 
 
-Function SysGetLoadErrorStr: string;
+Function SysGetLoadErrorStr: ansistring;
 
 
 begin
 begin
   Result:=dl.dlerror;
   Result:=dl.dlerror;

+ 3 - 3
rtl/unix/genfunch.inc

@@ -14,8 +14,8 @@
 
 
  **********************************************************************}
  **********************************************************************}
 
 
-function CreateShellArgV(const prog:string):ppchar; deprecated;
+function CreateShellArgV(const prog:string):PPAnsiChar; deprecated;
 
 
-function CreateShellArgV(const prog:RawByteString):ppchar; deprecated;
+function CreateShellArgV(const prog:RawByteString):PPAnsiChar; deprecated;
 
 
-procedure FreeShellArgV(p:ppchar); deprecated;
+procedure FreeShellArgV(p:PPAnsiChar); deprecated;

+ 9 - 9
rtl/unix/genfuncs.inc

@@ -14,13 +14,13 @@
 
 
  **********************************************************************}
  **********************************************************************}
 
 
-function InternalCreateShellArgV(cmd:pChar; len:longint):ppchar;
+function InternalCreateShellArgV(cmd:PAnsiChar; len:longint):PPAnsiChar;
 {
 {
   Create an argv which executes a command in a shell using /bin/sh -c
   Create an argv which executes a command in a shell using /bin/sh -c
 }
 }
 const   Shell   = '/bin/sh'#0'-c'#0;
 const   Shell   = '/bin/sh'#0'-c'#0;
 var
 var
-  pp,p : ppchar;
+  pp,p : PPAnsiChar;
 //  temp : string; !! Never pass a local var back!!
 //  temp : string; !! Never pass a local var back!!
 begin
 begin
   getmem(pp,4*sizeof(pointer));
   getmem(pp,4*sizeof(pointer));
@@ -31,18 +31,18 @@ begin
   inc(p);
   inc(p);
   getmem(p^,len+1);
   getmem(p^,len+1);
   move(cmd^,p^^,len);
   move(cmd^,p^^,len);
-  pchar(p^)[len]:=#0;
+  PAnsiChar(p^)[len]:=#0;
   inc(p);
   inc(p);
   p^:=Nil;
   p^:=Nil;
   InternalCreateShellArgV:=pp;
   InternalCreateShellArgV:=pp;
 end;
 end;
 
 
-function CreateShellArgV(const prog:string):ppchar;
+function CreateShellArgV(const prog:string):PPAnsiChar;
 begin
 begin
   CreateShellArgV:=InternalCreateShellArgV(@prog[1],length(prog));
   CreateShellArgV:=InternalCreateShellArgV(@prog[1],length(prog));
 end;
 end;
 
 
-function CreateShellArgV(const prog:RawByteString):ppchar;
+function CreateShellArgV(const prog:RawByteString):PPAnsiChar;
 {
 {
   Create an argv which executes a command in a shell using /bin/sh -c
   Create an argv which executes a command in a shell using /bin/sh -c
   using a AnsiString;
   using a AnsiString;
@@ -52,7 +52,7 @@ begin
 end;
 end;
 
 
 
 
-procedure FreeShellArgV(p:ppchar);
+procedure FreeShellArgV(p:PPAnsiChar);
 begin
 begin
   if (p<>nil) then begin
   if (p<>nil) then begin
     freemem(p[2]);
     freemem(p[2]);
@@ -60,11 +60,11 @@ begin
    end;
    end;
 end;
 end;
 
 
-Function fpgetenv(name:string):Pchar; [public, alias : 'FPC_SYSC_FPGETENV'];
+Function fpgetenv(name:string):PAnsiChar; [public, alias : 'FPC_SYSC_FPGETENV'];
 {
 {
   Searches the environment for a string with name p and
   Searches the environment for a string with name p and
-  returns a pchar to it's value.
-  A pchar is used to accomodate for strings of length > 255
+  returns a PAnsiChar to it's value.
+  A PAnsiChar is used to accomodate for strings of length > 255
 }
 }
 
 
 Begin
 Begin

+ 2 - 2
rtl/unix/oscdecl.inc

@@ -57,9 +57,9 @@ end;
 { fpopen                                                                }
 { fpopen                                                                }
 { ********************************************************************* }
 { ********************************************************************* }
 
 
-function  real_FpOpen(path: pchar; flags : cint):cint; varargs; cdecl; external clib name 'open'{$ifdef aix}+suffix64bit{$endif};
+function  real_FpOpen(path: PAnsiChar; flags : cint):cint; varargs; cdecl; external clib name 'open'{$ifdef aix}+suffix64bit{$endif};
 
 
-function  FpOpen    (path: pchar; flags : cint; mode: TMode):cint;
+function  FpOpen    (path: PAnsiChar; flags : cint; mode: TMode):cint;
 begin
 begin
 {$if defined(linux) and defined(fs32bit)}
 {$if defined(linux) and defined(fs32bit)}
   flags:=flags or O_LARGEFILE;
   flags:=flags or O_LARGEFILE;

+ 28 - 28
rtl/unix/oscdeclh.inc

@@ -50,11 +50,11 @@ const
     Function  FpSigTimedWait (Constref sigset : TSigSet; info : Psiginfo; timeout:Ptimespec): cInt; cdecl; external clib name 'sigtimedwait';
     Function  FpSigTimedWait (Constref sigset : TSigSet; info : Psiginfo; timeout:Ptimespec): cInt; cdecl; external clib name 'sigtimedwait';
 {$endif}
 {$endif}
     Function  FpUmask       (cmask : TMode): TMode; cdecl; external clib name 'umask';
     Function  FpUmask       (cmask : TMode): TMode; cdecl; external clib name 'umask';
-    Function  FpLink       (existing : pChar; newone : pChar): cInt; cdecl; external clib name 'link';
-    Function  FpMkfifo     (path: pchar; mode: tmode): cint; cdecl; external clib name 'mkfifo';
-    Function  FpChmod      (path : pChar; Mode : TMode): cInt; cdecl; external clib name 'chmod';
-    Function  FpChown   (path : pChar; owner : TUid; group : TGid): cInt; cdecl; external clib name 'chown';
-    Function  FPUtime(path:pchar;times:putimbuf):cint; cdecl; external clib name 'utime';
+    Function  FpLink       (existing : PAnsiChar; newone : PAnsiChar): cInt; cdecl; external clib name 'link';
+    Function  FpMkfifo     (path: PAnsiChar; mode: tmode): cint; cdecl; external clib name 'mkfifo';
+    Function  FpChmod      (path : PAnsiChar; Mode : TMode): cInt; cdecl; external clib name 'chmod';
+    Function  FpChown   (path : PAnsiChar; owner : TUid; group : TGid): cInt; cdecl; external clib name 'chown';
+    Function  FPUtime(path:PAnsiChar;times:putimbuf):cint; cdecl; external clib name 'utime';
     Function  FpPipe       (var fildes : tfildes):cInt; cdecl;external clib name 'pipe';
     Function  FpPipe       (var fildes : tfildes):cInt; cdecl;external clib name 'pipe';
     function  FpDup     (oldd:cint):cint; cdecl; external clib name 'dup';
     function  FpDup     (oldd:cint):cint; cdecl; external clib name 'dup';
     function  FpDup2    (oldd:cint;newd:cint):cint; cdecl; external clib name 'dup2';
     function  FpDup2    (oldd:cint;newd:cint):cint; cdecl; external clib name 'dup2';
@@ -83,46 +83,46 @@ const
     Function  FpFcntl      (fildes : cInt; cmd : cInt; arg :cInt): cInt; {$ifdef FPC_IS_SYSTEM}forward;{$endif}
     Function  FpFcntl      (fildes : cInt; cmd : cInt; arg :cInt): cInt; {$ifdef FPC_IS_SYSTEM}forward;{$endif}
     Function  FpFcntl      (fildes : cInt; cmd : cInt; var arg : flock): cInt; {$ifdef FPC_IS_SYSTEM}forward;{$endif}
     Function  FpFcntl      (fildes : cInt; cmd : cInt; var arg : flock): cInt; {$ifdef FPC_IS_SYSTEM}forward;{$endif}
 
 
-    Function  FpGetcwd  (path:pChar; siz:TSize):pChar; cdecl;  external clib name 'getcwd';
+    Function  FpGetcwd  (path:PAnsiChar; siz:TSize):PAnsiChar; cdecl;  external clib name 'getcwd';
     function  FpFork  : TPid; cdecl; external clib name 'fork';
     function  FpFork  : TPid; cdecl; external clib name 'fork';
-    function  FpExecve  (path : pchar; argv : ppchar; envp: ppchar): cint; cdecl; external clib name 'execve';
-    function  FpExecv  (path : pchar; argv : ppchar): cint; cdecl; external clib name 'execv';
+    function  FpExecve  (path : PAnsiChar; argv : PPAnsiChar; envp: PPAnsiChar): cint; cdecl; external clib name 'execve';
+    function  FpExecv  (path : PAnsiChar; argv : PPAnsiChar): cint; cdecl; external clib name 'execv';
     function  FpWaitpid (pid : TPid; stat_loc : pcint; options: cint): TPid; cdecl; external clib name 'waitpid';
     function  FpWaitpid (pid : TPid; stat_loc : pcint; options: cint): TPid; cdecl; external clib name 'waitpid';
     Function  FpWait       (var stat_loc : cInt): TPid; cdecl; external clib name 'wait';
     Function  FpWait       (var stat_loc : cInt): TPid; cdecl; external clib name 'wait';
     procedure FpExit    (status : cint); cdecl; external clib name '_exit';
     procedure FpExit    (status : cint); cdecl; external clib name '_exit';
     Function  FpKill       (pid : TPid; sig: cInt): cInt; cdecl; external clib name 'kill';
     Function  FpKill       (pid : TPid; sig: cInt): cInt; cdecl; external clib name 'kill';
     function  FpUname   (var name: utsname): cint; cdecl; external clib name 'uname';
     function  FpUname   (var name: utsname): cint; cdecl; external clib name 'uname';
-    function  FpOpendir (dirname : pchar): pdir; cdecl; external clib name 'opendir'{$ifdef aix}+suffix64bit{$endif};
+    function  FpOpendir (dirname : PAnsiChar): pdir; cdecl; external clib name 'opendir'{$ifdef aix}+suffix64bit{$endif};
     Function  FpReaddir (var dirp : Dir) : pDirent;cdecl; external clib name 'readdir'+suffix64bit+darwinsuffix64bit;
     Function  FpReaddir (var dirp : Dir) : pDirent;cdecl; external clib name 'readdir'+suffix64bit+darwinsuffix64bit;
     Function  FpClosedir (var dirp : Dir): cInt; cdecl; external clib name 'closedir'{$ifdef aix}+suffix64bit{$endif};
     Function  FpClosedir (var dirp : Dir): cInt; cdecl; external clib name 'closedir'{$ifdef aix}+suffix64bit{$endif};
-    function  FpChdir   (path : pchar): cint; cdecl; external clib name 'chdir';
+    function  FpChdir   (path : PAnsiChar): cint; cdecl; external clib name 'chdir';
     { emulate the bunxovl version that automatically passes
     { emulate the bunxovl version that automatically passes
      638 as mode }
      638 as mode }
-    function  FpOpen    (path: pchar; flags : cint; mode: TMode):cint; {$ifdef FPC_IS_SYSTEM}forward;{$endif}
-    function  FpMkdir   (path : pchar; mode: TMode):cint; cdecl; external clib name 'mkdir';
-    function  FpUnlink  (path: pchar): cint; cdecl; external clib name 'unlink';
-    function  FpRmdir   (path : pchar): cint; cdecl; external clib name 'rmdir';
-    function  FpRename  (old : pchar; newpath: pchar): cint; cdecl;external clib name 'rename';
+    function  FpOpen    (path: PAnsiChar; flags : cint; mode: TMode):cint; {$ifdef FPC_IS_SYSTEM}forward;{$endif}
+    function  FpMkdir   (path : PAnsiChar; mode: TMode):cint; cdecl; external clib name 'mkdir';
+    function  FpUnlink  (path: PAnsiChar): cint; cdecl; external clib name 'unlink';
+    function  FpRmdir   (path : PAnsiChar): cint; cdecl; external clib name 'rmdir';
+    function  FpRename  (old : PAnsiChar; newpath: PAnsiChar): cint; cdecl;external clib name 'rename';
 {$ifdef linux}
 {$ifdef linux}
 {$ifndef FPC_IS_SYSTEM}
 {$ifndef FPC_IS_SYSTEM}
     { those functions are macros on linux }
     { those functions are macros on linux }
     function  FpFstat   (fd : cint; var sb : stat): cint;inline;
     function  FpFstat   (fd : cint; var sb : stat): cint;inline;
-    Function  fpLstat       (path:pchar;Info:pstat):cint;inline;
-    function  FpStat      (path: pchar; var buf : stat): cint;inline;
+    Function  fpLstat       (path:PAnsiChar;Info:pstat):cint;inline;
+    function  FpStat      (path: PAnsiChar; var buf : stat): cint;inline;
 {$endif FPC_IS_SYSTEM}
 {$endif FPC_IS_SYSTEM}
 {$else linux}
 {$else linux}
     function  FpFstat   (fd : cint; var sb : stat): cint; cdecl; external clib name 'fstat'+suffix64bit+darwinsuffix64bit;
     function  FpFstat   (fd : cint; var sb : stat): cint; cdecl; external clib name 'fstat'+suffix64bit+darwinsuffix64bit;
-    Function  fpLstat   (path:pchar;Info:pstat):cint;     cdecl; external clib name 'lstat'+suffix64bit+darwinsuffix64bit;
-    function  FpStat    (path: pchar; var buf : stat): cint; cdecl; external clib name 'stat'+suffix64bit+darwinsuffix64bit;
+    Function  fpLstat   (path:PAnsiChar;Info:pstat):cint;     cdecl; external clib name 'lstat'+suffix64bit+darwinsuffix64bit;
+    function  FpStat    (path: PAnsiChar; var buf : stat): cint; cdecl; external clib name 'stat'+suffix64bit+darwinsuffix64bit;
 {$endif linux}
 {$endif linux}
-    function  FpAccess  (pathname : pchar; amode : cint): cint; cdecl; external clib name 'access';
+    function  FpAccess  (pathname : PAnsiChar; amode : cint): cint; cdecl; external clib name 'access';
     function  FpClose   (fd : cint): cint; cdecl; external clib name 'close';
     function  FpClose   (fd : cint): cint; cdecl; external clib name 'close';
 
 
-    function  FpRead    (fd: cint; buf: pchar; nbytes : TSize): TSSize; cdecl; external clib name 'read';
-    Function  FpPRead      (fd : cInt; buf: pChar; nbytes : TSize; offset:Toff): TSsize;   cdecl; external clib name 'pread'+suffix64bit;
+    function  FpRead    (fd: cint; buf: PAnsiChar; nbytes : TSize): TSSize; cdecl; external clib name 'read';
+    Function  FpPRead      (fd : cInt; buf: PAnsiChar; nbytes : TSize; offset:Toff): TSsize;   cdecl; external clib name 'pread'+suffix64bit;
     function  FpReadV	   (fd: cint; const iov : piovec; iovcnt : cint):TSSize;  cdecl; external clib name 'readv';
     function  FpReadV	   (fd: cint; const iov : piovec; iovcnt : cint):TSSize;  cdecl; external clib name 'readv';
-    function  FpWrite   (fd: cint;buf:pchar; nbytes : TSize): TSSize; cdecl; external clib name 'write';
-    Function  FpPWrite     (fd : cInt; buf:pChar; nbytes : TSize; offset:Toff): TSSize;  cdecl; external clib name 'pwrite'+suffix64bit;
+    function  FpWrite   (fd: cint;buf:PAnsiChar; nbytes : TSize): TSSize; cdecl; external clib name 'write';
+    Function  FpPWrite     (fd : cInt; buf:PAnsiChar; nbytes : TSize; offset:Toff): TSSize;  cdecl; external clib name 'pwrite'+suffix64bit;
     function  FpWriteV	   (fd: cint; const iov : piovec; iovcnt : cint):TSSize;  cdecl; external clib name 'writev';
     function  FpWriteV	   (fd: cint; const iov : piovec; iovcnt : cint):TSSize;  cdecl; external clib name 'writev';
 
 
     function  FpLseek   (fd : cint; offset : TOff; whence : cint): TOff; cdecl; external clib name 'lseek'+suffix64bit;
     function  FpLseek   (fd : cint; offset : TOff; whence : cint): TOff; cdecl; external clib name 'lseek'+suffix64bit;
@@ -153,8 +153,8 @@ const
     Function  FPnanosleep  (const rqtp: ptimespec; rmtp: ptimespec): cint; cdecl; external clib name 'nanosleep';
     Function  FPnanosleep  (const rqtp: ptimespec; rmtp: ptimespec): cint; cdecl; external clib name 'nanosleep';
 {$endif}
 {$endif}
 {$endif solaris}
 {$endif solaris}
-    Function  fpSymlink    (oldname,newname:pchar):cint;   cdecl; external clib name 'symlink';
-    Function  fpReadLink           (name,linkname:pchar;maxlen:size_t):cint;  cdecl; external clib name 'readlink';
+    Function  fpSymlink    (oldname,newname:PAnsiChar):cint;   cdecl; external clib name 'symlink';
+    Function  fpReadLink           (name,linkname:PAnsiChar;maxlen:size_t):cint;  cdecl; external clib name 'readlink';
 
 
     function  fpNice       (N:cint):cint; cdecl; external clib name 'nice';
     function  fpNice       (N:cint):cint; cdecl; external clib name 'nice';
     Function  fpGetPriority (Which,Who:cint):cint;      cdecl; external clib name 'getpriority';
     Function  fpGetPriority (Which,Who:cint):cint;      cdecl; external clib name 'getpriority';
@@ -163,7 +163,7 @@ const
     function  fpmunmap  (addr:pointer;len:size_t):cint; cdecl; external clib name 'munmap';
     function  fpmunmap  (addr:pointer;len:size_t):cint; cdecl; external clib name 'munmap';
     function  fpmprotect(addr:pointer;len:size_t;prot:cint):cint; cdecl; external clib name 'mprotect';
     function  fpmprotect(addr:pointer;len:size_t;prot:cint):cint; cdecl; external clib name 'mprotect';
 
 
-    function  fpgetenv  (name : pchar):pchar; cdecl; external clib name 'getenv';
+    function  fpgetenv  (name : PAnsiChar):PAnsiChar; cdecl; external clib name 'getenv';
 {$ifndef beos}
 {$ifndef beos}
     function  fpsettimeofday(tp:ptimeval;tzp:ptimezone):cint; cdecl; external clib name 'settimeofday';
     function  fpsettimeofday(tp:ptimeval;tzp:ptimezone):cint; cdecl; external clib name 'settimeofday';
 {$else}
 {$else}
@@ -188,5 +188,5 @@ const
 {$if defined(linux)}
 {$if defined(linux)}
     function  FpSchedGetAffinity(pid : pid_t;cpusetsize : size_t;mask : pcpu_set_t) : cint; cdecl; external clib name 'sched_getaffinity';
     function  FpSchedGetAffinity(pid : pid_t;cpusetsize : size_t;mask : pcpu_set_t) : cint; cdecl; external clib name 'sched_getaffinity';
 {$endif}
 {$endif}
-    Function FpPathconf(path : pchar;name : cint) : clong; cdecl; external clib name 'pathconf';
+    Function FpPathconf(path : PAnsiChar;name : cint) : clong; cdecl; external clib name 'pathconf';
 
 

+ 3 - 3
rtl/unix/syscgen.inc

@@ -2,11 +2,11 @@
 // general purpose unix routines for syscall based *nix system unit.
 // general purpose unix routines for syscall based *nix system unit.
 
 
 {$ifndef FPC_USE_LIBC}
 {$ifndef FPC_USE_LIBC}
-Function fpgetenv(name:pchar):pchar;[public, alias : 'FPC_SYSC_FPGETENVPCHAR'];
+Function fpgetenv(name:pansichar):pansichar;[public, alias : 'FPC_SYSC_FPGETENVPCHAR'];
 
 
 var
 var
-  p     : ppchar;
-  np,cp : pchar;
+  p     : ppansichar;
+  np,cp : pansichar;
   len,i : longint;
   len,i : longint;
 Begin
 Begin
   if (name=nil) or (envp=NIL) Then
   if (name=nil) or (envp=NIL) Then

+ 5 - 5
rtl/unix/sysdir.inc

@@ -28,7 +28,7 @@ const
 Procedure Do_MkDir(s: rawbytestring);
 Procedure Do_MkDir(s: rawbytestring);
 
 
 Begin
 Begin
-  If Fpmkdir(pchar(s), MODE_MKDIR)<0 Then
+  If Fpmkdir(PAnsiChar(s), MODE_MKDIR)<0 Then
    Errno2Inoutres
    Errno2Inoutres
 End;
 End;
 
 
@@ -41,7 +41,7 @@ begin
       InOutRes := 16;
       InOutRes := 16;
       exit;
       exit;
     end;
     end;
-  If Fprmdir(pchar(S))<0 Then
+  If Fprmdir(PAnsiChar(S))<0 Then
    Errno2Inoutres
    Errno2Inoutres
 End;
 End;
 
 
@@ -49,7 +49,7 @@ End;
 Procedure do_ChDir(s: rawbytestring);
 Procedure do_ChDir(s: rawbytestring);
 
 
 Begin
 Begin
-  If Fpchdir(pchar(s))<0 Then
+  If Fpchdir(PAnsiChar(s))<0 Then
    Errno2Inoutres;
    Errno2Inoutres;
   { file not exists is path not found under tp7 }
   { file not exists is path not found under tp7 }
   if InOutRes=2 then
   if InOutRes=2 then
@@ -66,7 +66,7 @@ End;
 
 
 procedure do_getdir(drivenr : byte;var dir : rawbytestring);
 procedure do_getdir(drivenr : byte;var dir : rawbytestring);
 var
 var
-  buf          : array[0..2047] of char;
+  buf          : array[0..2047] of AnsiChar;
 {$ifndef FPC_USE_LIBC}
 {$ifndef FPC_USE_LIBC}
   cwdinfo      : stat;
   cwdinfo      : stat;
   rootinfo     : stat;
   rootinfo     : stat;
@@ -121,7 +121,7 @@ begin
             { then do not set the name.               }
             { then do not set the name.               }
             if (not ((d^.d_name[0]='.') and ((d^.d_name[1]=#0) or
             if (not ((d^.d_name[0]='.') and ((d^.d_name[1]=#0) or
                     ((d^.d_name[1]='.') and (d^.d_name[2]=#0))))) then
                     ((d^.d_name[1]='.') and (d^.d_name[2]=#0))))) then
-              { d^.d_name is an array[0..x] of char -> will be assigned the
+              { d^.d_name is an array[0..x] of AnsiChar -> will be assigned the
                 ansi code page on conversion to ansistring -> also typecast
                 ansi code page on conversion to ansistring -> also typecast
                 '/' to ansistring rather than rawbytestring so code pages match
                 '/' to ansistring rather than rawbytestring so code pages match
                 (will be unconditionally set to DefaultFileSystemCodePage at
                 (will be unconditionally set to DefaultFileSystemCodePage at

+ 3 - 3
rtl/unix/sysfile.inc

@@ -24,7 +24,7 @@ Begin
     Errno2Inoutres;
     Errno2Inoutres;
 End;
 End;
 
 
-Procedure Do_Erase(p: pchar; pchangeable: boolean);
+Procedure Do_Erase(p: PAnsiChar; pchangeable: boolean);
 var
 var
  fileinfo : stat;
  fileinfo : stat;
 Begin
 Begin
@@ -60,7 +60,7 @@ end;
 
 
 
 
 
 
-Procedure Do_Rename(p1,p2:pchar; p1changeable, p2changeable: boolean);
+Procedure Do_Rename(p1,p2:PAnsiChar; p1changeable, p2changeable: boolean);
 Begin
 Begin
   If Fprename(p1,p2)<0 Then
   If Fprename(p1,p2)<0 Then
    Errno2Inoutres
    Errno2Inoutres
@@ -147,7 +147,7 @@ Begin
    InOutRes:=0;
    InOutRes:=0;
 End;
 End;
 
 
-Procedure Do_Open(var f; p: pchar; flags: longint; pchangeable: boolean);
+Procedure Do_Open(var f; p: PAnsiChar; flags: longint; pchangeable: boolean);
 {
 {
   FileRec and textrec have both Handle and mode as the first items so
   FileRec and textrec have both Handle and mode as the first items so
   they could use the same routine for opening/creating.
   they could use the same routine for opening/creating.

+ 8 - 7
rtl/unix/sysunixh.inc

@@ -32,8 +32,8 @@ const
  DriveSeparator = '';
  DriveSeparator = '';
  ExtensionSeparator = '.';
  ExtensionSeparator = '.';
  PathSeparator = ':';
  PathSeparator = ':';
- AllowDirectorySeparators : set of char = ['\','/'];
- AllowDriveSeparators : set of char = [];
+ AllowDirectorySeparators : set of AnsiChar = ['\','/'];
+ AllowDriveSeparators : set of AnsiChar = [];
 { FileNameCaseSensitive and FileNameCasePreserving are defined below! }
 { FileNameCaseSensitive and FileNameCasePreserving are defined below! }
  maxExitCode = 255;
  maxExitCode = 255;
  {$ifdef LINUX}
  {$ifdef LINUX}
@@ -59,12 +59,12 @@ const
 {$if not defined(solaris) and not defined(darwin) and not defined(aix)}
 {$if not defined(solaris) and not defined(darwin) and not defined(aix)}
 {$ifdef FPC_HAS_INDIRECT_ENTRY_INFORMATION}
 {$ifdef FPC_HAS_INDIRECT_ENTRY_INFORMATION}
 var argc:longint;
 var argc:longint;
-    argv:PPchar;
-    envp:PPchar;
+    argv:PPAnsiChar;
+    envp:PPAnsiChar;
 {$else FPC_HAS_INDIRECT_ENTRY_INFORMATION}
 {$else FPC_HAS_INDIRECT_ENTRY_INFORMATION}
 var argc:longint;external name 'operatingsystem_parameter_argc';
 var argc:longint;external name 'operatingsystem_parameter_argc';
-    argv:PPchar;external name 'operatingsystem_parameter_argv';
-    envp:PPchar;external name 'operatingsystem_parameter_envp';
+    argv:PPAnsiChar;external name 'operatingsystem_parameter_argv';
+    envp:PPAnsiChar;external name 'operatingsystem_parameter_envp';
 {$endif FPC_HAS_INDIRECT_ENTRY_INFORMATION}
 {$endif FPC_HAS_INDIRECT_ENTRY_INFORMATION}
 {$endif}
 {$endif}
 
 
@@ -73,5 +73,6 @@ const
   { hook for lineinfo, to get the module name from an address,
   { hook for lineinfo, to get the module name from an address,
     unit dl sets it if it is used
     unit dl sets it if it is used
   }
   }
-  UnixGetModuleByAddrHook : procedure (addr: pointer; var baseaddr: pointer; var filename: string) = nil;
+  UnixGetModuleByAddrHook : procedure (addr: pointer; var baseaddr: pointer; var filename:
+  ansistring) = nil;
 {$endif unix}
 {$endif unix}

+ 25 - 25
rtl/unix/sysutils.pp

@@ -297,7 +297,7 @@ procedure UnhookSignal(RtlSigNum: Integer; OnlyIfHooked: Boolean = True);
 {$Define OS_FILEISREADONLY} // Specific implementation for Unix.
 {$Define OS_FILEISREADONLY} // Specific implementation for Unix.
 
 
 {$DEFINE FPC_FEXPAND_TILDE} { Tilde is expanded to home }
 {$DEFINE FPC_FEXPAND_TILDE} { Tilde is expanded to home }
-{$DEFINE FPC_FEXPAND_GETENVPCHAR} { GetEnv result is a PChar }
+{$DEFINE FPC_FEXPAND_GETENVPCHAR} { GetEnv result is a PAnsiChar }
 
 
 { Include platform independent implementation part }
 { Include platform independent implementation part }
 
 
@@ -581,14 +581,14 @@ begin
 {$ifdef USE_STATX}
 {$ifdef USE_STATX}
   { first try statx }
   { first try statx }
   if {$ifdef FPC_USE_LIBC} (@statx<>nil) and {$endif}
   if {$ifdef FPC_USE_LIBC} (@statx<>nil) and {$endif}
-     (statx(AT_FDCWD,pchar(SystemFileName),0,STATX_MTIME or STATX_MODE,Infox)>=0) and not(fpS_ISDIR(Infox.stx_mode)) then
+     (statx(AT_FDCWD,PAnsiChar(SystemFileName),0,STATX_MTIME or STATX_MODE,Infox)>=0) and not(fpS_ISDIR(Infox.stx_mode)) then
     begin
     begin
       Result:=Infox.stx_mtime.tv_sec;
       Result:=Infox.stx_mtime.tv_sec;
       exit;
       exit;
     end;
     end;
 {$endif USE_STATX}
 {$endif USE_STATX}
 
 
-  If  (fpstat(pchar(SystemFileName),Info)<0) or fpS_ISDIR(info.st_mode) then
+  If  (fpstat(PAnsiChar(SystemFileName),Info)<0) or fpS_ISDIR(info.st_mode) then
     exit(-1)
     exit(-1)
   else 
   else 
     Result:=info.st_mtime;
     Result:=info.st_mtime;
@@ -652,7 +652,7 @@ begin
     begin
     begin
       Result:=Result or faSymLink;
       Result:=Result or faSymLink;
       // Windows reports if the link points to a directory.
       // Windows reports if the link points to a directory.
-      if (fpstat(pchar(FN),LinkInfo)>=0) and fpS_ISDIR(LinkInfo.st_mode) then
+      if (fpstat(PAnsiChar(FN),LinkInfo)>=0) and fpS_ISDIR(LinkInfo.st_mode) then
         Result := Result or faDirectory;
         Result := Result or faDirectory;
     end;
     end;
 end;
 end;
@@ -681,7 +681,7 @@ begin
       Result:=Result or faSymLink;
       Result:=Result or faSymLink;
       // Windows reports if the link points to a directory.
       // Windows reports if the link points to a directory.
       { as we are only interested in the st_mode field here, we do not need to use statx }
       { as we are only interested in the st_mode field here, we do not need to use statx }
-      if (fpstat(pchar(FN),LinkInfo)>=0) and fpS_ISDIR(LinkInfo.st_mode) then
+      if (fpstat(PAnsiChar(FN),LinkInfo)>=0) and fpS_ISDIR(LinkInfo.st_mode) then
         Result := Result or faDirectory;
         Result := Result or faDirectory;
     end;
     end;
 end;
 end;
@@ -1061,7 +1061,7 @@ Begin
         DirName:='./'
         DirName:='./'
       Else
       Else
         DirName:=Copy(UnixFindData^.SearchSpec,1,UnixFindData^.NamePos);
         DirName:=Copy(UnixFindData^.SearchSpec,1,UnixFindData^.NamePos);
-      UnixFindData^.DirPtr := fpopendir(Pchar(DirName));
+      UnixFindData^.DirPtr := fpopendir(PAnsiChar(DirName));
     end;
     end;
   SName:=Copy(UnixFindData^.SearchSpec,UnixFindData^.NamePos+1,Length(UnixFindData^.SearchSpec));
   SName:=Copy(UnixFindData^.SearchSpec,UnixFindData^.NamePos+1,Length(UnixFindData^.SearchSpec));
   Found:=False;
   Found:=False;
@@ -1137,7 +1137,7 @@ Var
 {$ifdef USE_STATX}
 {$ifdef USE_STATX}
   Infox : TStatx;
   Infox : TStatx;
 {$endif USE_STATX}
 {$endif USE_STATX}
-  Char0 : char;
+  Char0 : AnsiChar;
 begin
 begin
   Result:=-1;
   Result:=-1;
 {$ifdef USE_STATX}
 {$ifdef USE_STATX}
@@ -1202,7 +1202,7 @@ var
   SystemFileName: RawByteString;
   SystemFileName: RawByteString;
 begin
 begin
   SystemFileName:=ToSingleByteFileSystemEncodedFileName(FileName);
   SystemFileName:=ToSingleByteFileSystemEncodedFileName(FileName);
-  Result:=fpUnLink (pchar(SystemFileName))>=0;
+  Result:=fpUnLink (PAnsiChar(SystemFileName))>=0;
 end;
 end;
 
 
 
 
@@ -1221,7 +1221,7 @@ var
   SystemFileName: RawByteString;
   SystemFileName: RawByteString;
 begin
 begin
   SystemFileName:=ToSingleByteFileSystemEncodedFileName(FileName);
   SystemFileName:=ToSingleByteFileSystemEncodedFileName(FileName);
-  Result:=fpAccess(PChar(SystemFileName),W_OK)<>0;
+  Result:=fpAccess(PAnsiChar(SystemFileName),W_OK)<>0;
 end;
 end;
 
 
 Function FileSetDate (Const FileName : RawByteString; Age : Int64) : Longint;
 Function FileSetDate (Const FileName : RawByteString; Age : Int64) : Longint;
@@ -1239,7 +1239,7 @@ begin
   times[0].tv_nsec:=0;
   times[0].tv_nsec:=0;
   times[1].tv_sec:=Age;
   times[1].tv_sec:=Age;
   times[1].tv_nsec:=0;
   times[1].tv_nsec:=0;
-  if utimensat(AT_FDCWD,PChar(SystemFileName),times,0) = -1 then
+  if utimensat(AT_FDCWD,PAnsiChar(SystemFileName),times,0) = -1 then
     Result:=fpgeterrno;
     Result:=fpgeterrno;
   if fpgeterrno=ESysENOSYS then
   if fpgeterrno=ESysENOSYS then
 {$endif USE_UTIMENSAT}
 {$endif USE_UTIMENSAT}
@@ -1247,7 +1247,7 @@ begin
       Result:=0;
       Result:=0;
       t.actime:= Age;
       t.actime:= Age;
       t.modtime:=Age;
       t.modtime:=Age;
-      if fputime(PChar(SystemFileName), @t) = -1 then
+      if fputime(PAnsiChar(SystemFileName), @t) = -1 then
         Result:=fpgeterrno;
         Result:=fpgeterrno;
     end
     end
 end;
 end;
@@ -1257,7 +1257,7 @@ Function IsFileNameCaseSensitive(Const aFileName : RawByteString) : Boolean;
 var
 var
   res : clong;
   res : clong;
 begin
 begin
-  res:=FpPathconf(PChar(aFileName),11 {_PC_CASE_SENSITIVE });
+  res:=FpPathconf(PAnsiChar(aFileName),11 {_PC_CASE_SENSITIVE });
   { fall back to default if path is not found }
   { fall back to default if path is not found }
   if res<0 then
   if res<0 then
     Result:=FileNameCaseSensitive
     Result:=FileNameCaseSensitive
@@ -1274,7 +1274,7 @@ Function IsFileNameCasePreserving(Const aFileName : RawByteString) : Boolean;
 var
 var
   res : clong;
   res : clong;
 begin
 begin
-  res:=FpPathconf(PChar(aFileName),12 { _PC_CASE_PRESERVING });
+  res:=FpPathconf(PAnsiChar(aFileName),12 { _PC_CASE_PRESERVING });
   if res<0 then
   if res<0 then
     { fall back to default if path is not found }
     { fall back to default if path is not found }
     Result:=FileNameCasePreserving
     Result:=FileNameCasePreserving
@@ -1305,7 +1305,7 @@ end;
   They both return -1 when a failure occurs.
   They both return -1 when a failure occurs.
 }
 }
 Const
 Const
-  FixDriveStr : array[0..3] of pchar=(
+  FixDriveStr : array[0..3] of PAnsiChar=(
     '.',
     '.',
     '/fd0/.',
     '/fd0/.',
     '/fd1/.',
     '/fd1/.',
@@ -1313,9 +1313,9 @@ Const
     );
     );
 var
 var
   Drives   : byte = 4;
   Drives   : byte = 4;
-  DriveStr : array[4..26] of pchar;
+  DriveStr : array[4..26] of PAnsiChar;
 
 
-Function GetDriveStr(Drive : Byte) : Pchar;
+Function GetDriveStr(Drive : Byte) : PAnsiChar;
 
 
 begin
 begin
   case Drive of
   case Drive of
@@ -1330,7 +1330,7 @@ end;
 
 
 Function DiskFree(Drive: Byte): int64;
 Function DiskFree(Drive: Byte): int64;
 var
 var
-  p : PChar;
+  p : PAnsiChar;
   fs : TStatfs;
   fs : TStatfs;
 Begin
 Begin
   p:=GetDriveStr(Drive);
   p:=GetDriveStr(Drive);
@@ -1342,7 +1342,7 @@ End;
 
 
 Function DiskSize(Drive: Byte): int64;
 Function DiskSize(Drive: Byte): int64;
 var
 var
-  p : PChar;
+  p : PAnsiChar;
   fs : TStatfs;
   fs : TStatfs;
 Begin
 Begin
   p:=GetDriveStr(Drive);
   p:=GetDriveStr(Drive);
@@ -1532,7 +1532,7 @@ Function GetEnvironmentVariable(Const EnvVar : String) : String;
 begin
 begin
   { no need to adjust the code page of EnvVar to DefaultSystemCodePage, as only
   { no need to adjust the code page of EnvVar to DefaultSystemCodePage, as only
     ASCII identifiers are supported }
     ASCII identifiers are supported }
-  Result:=BaseUnix.FPGetenv(PChar(pointer(EnvVar)));
+  Result:=BaseUnix.FPGetenv(PAnsiChar(pointer(EnvVar)));
 end;
 end;
 
 
 Function GetEnvironmentVariableCount : Integer;
 Function GetEnvironmentVariableCount : Integer;
@@ -1554,7 +1554,7 @@ var
   e      : EOSError;
   e      : EOSError;
   CommandLine: RawByteString;
   CommandLine: RawByteString;
   LPath  : RawByteString;
   LPath  : RawByteString;
-  cmdline2 : ppchar;
+  cmdline2 : PPAnsiChar;
 
 
 Begin
 Begin
   { always surround the name of the application by quotes
   { always surround the name of the application by quotes
@@ -1576,12 +1576,12 @@ Begin
        UniqueString(CommandLine);
        UniqueString(CommandLine);
        SetCodePage(CommandLine,DefaultFileSystemCodePage,true);
        SetCodePage(CommandLine,DefaultFileSystemCodePage,true);
        cmdline2:=StringtoPPChar(CommandLine,1);
        cmdline2:=StringtoPPChar(CommandLine,1);
-       cmdline2^:=pchar(pointer(LPath));
+       cmdline2^:=PAnsiChar(pointer(LPath));
      end
      end
    else
    else
      begin
      begin
-       getmem(cmdline2,2*sizeof(pchar));
-       cmdline2^:=pchar(LPath);
+       getmem(cmdline2,2*sizeof(PAnsiChar));
+       cmdline2^:=PAnsiChar(LPath);
        cmdline2[1]:=nil;
        cmdline2[1]:=nil;
      end;
      end;
 
 
@@ -1593,7 +1593,7 @@ Begin
   if pid=0 then
   if pid=0 then
    begin
    begin
    {The child does the actual exec, and then exits}
    {The child does the actual exec, and then exits}
-      fpexecve(pchar(pointer(LPath)),Cmdline2,envp);
+      fpexecv(PAnsiChar(pointer(LPath)),Cmdline2);
      { If the execve fails, we return an exitvalue of 127, to let it be known}
      { If the execve fails, we return an exitvalue of 127, to let it be known}
      fpExit(127);
      fpExit(127);
    end
    end
@@ -1701,7 +1701,7 @@ begin
         begin
         begin
           SetLength(Result, MAX_PATH);
           SetLength(Result, MAX_PATH);
           SetLength(Result, FileRead(h, Result[1], Length(Result)));
           SetLength(Result, FileRead(h, Result[1], Length(Result)));
-          SetLength(Result, strlen(PChar(Result)));
+          SetLength(Result, strlen(PAnsiChar(Result)));
           FileClose(h);
           FileClose(h);
           Result:='/data/data/' + Result;
           Result:='/data/data/' + Result;
           _HasPackageDataDir:=DirectoryExists(Result);
           _HasPackageDataDir:=DirectoryExists(Result);

+ 2 - 2
rtl/unix/timezone.inc

@@ -40,7 +40,7 @@ var
   transitions  : PInt64 = nil;
   transitions  : PInt64 = nil;
   type_idxs    : pbyte = Nil;
   type_idxs    : pbyte = Nil;
   types        : pttinfo = Nil;
   types        : pttinfo = Nil;
-  zone_names   : pchar = Nil;
+  zone_names   : PAnsiChar = Nil;
   leaps        : pleap = Nil;
   leaps        : pleap = Nil;
 
 
 function find_transition(timer:int64;timerIsUTC:Boolean;var trans_start,trans_end:int64):pttinfo;
 function find_transition(timer:int64;timerIsUTC:Boolean;var trans_start,trans_end:int64):pttinfo;
@@ -138,7 +138,7 @@ end;
 procedure DoGetLocalTimezoneEx(timer:int64;info:pttinfo;var ATZInfoEx:TTZInfoEx);
 procedure DoGetLocalTimezoneEx(timer:int64;info:pttinfo;var ATZInfoEx:TTZInfoEx);
 var
 var
   i : longint;
   i : longint;
-  names: array[Boolean] of pchar;
+  names: array[Boolean] of PAnsiChar;
 begin
 begin
   names[true]:=nil;
   names[true]:=nil;
   names[false]:=nil;
   names[false]:=nil;

+ 42 - 42
rtl/unix/unix.pp

@@ -105,13 +105,13 @@ Function GregorianToJulian(Year,Month,Day:Longint):LongInt; // use DateUtils.Jul
 
 
 {**  Process Handling  **}
 {**  Process Handling  **}
 
 
-function FpExecLE (Const PathName:RawByteString;const S:Array Of RawByteString;MyEnv:ppchar):cint;
+function FpExecLE (Const PathName:RawByteString;const S:Array Of RawByteString;MyEnv:PPAnsiChar):cint;
 function FpExecL  (Const PathName:RawByteString;const S:Array Of RawByteString):cint;
 function FpExecL  (Const PathName:RawByteString;const S:Array Of RawByteString):cint;
 function FpExecLP (Const PathName:RawByteString;const S:Array Of RawByteString):cint;
 function FpExecLP (Const PathName:RawByteString;const S:Array Of RawByteString):cint;
-function FpExecLPE(Const PathName:RawByteString;const S:Array Of RawByteString;env:ppchar):cint;
-function FpExecV  (Const PathName:RawByteString;args:ppchar):cint;
-function FpExecVP (Const PathName:RawByteString;args:ppchar):cint;
-function FpExecVPE(Const PathName:RawByteString;args,env:ppchar):cint;
+function FpExecLPE(Const PathName:RawByteString;const S:Array Of RawByteString;env:PPAnsiChar):cint;
+function FpExecV  (Const PathName:RawByteString;args:PPAnsiChar):cint;
+function FpExecVP (Const PathName:RawByteString;args:PPAnsiChar):cint;
+function FpExecVPE(Const PathName:RawByteString;args,env:PPAnsiChar):cint;
 
 
 Function fpSystem(const Command:RawByteString):cint;
 Function fpSystem(const Command:RawByteString):cint;
 
 
@@ -135,10 +135,10 @@ function  TellDir(p:pdir):TOff;
 Function AssignPipe  (var pipe_in,pipe_out:cint):cint;
 Function AssignPipe  (var pipe_in,pipe_out:cint):cint;
 Function AssignPipe  (var pipe_in,pipe_out:text):cint;
 Function AssignPipe  (var pipe_in,pipe_out:text):cint;
 Function AssignPipe  (var pipe_in,pipe_out:file):cint;
 Function AssignPipe  (var pipe_in,pipe_out:file):cint;
-Function POpen       (var F:text;const Prog:RawByteString;rw:char):cint;
-Function POpen       (var F:file;const Prog:RawByteString;rw:char):cint;
-Function POpen       (var F:text;const Prog:UnicodeString;rw:char):cint;
-Function POpen       (var F:file;const Prog:UnicodeString;rw:char):cint;
+Function POpen       (var F:text;const Prog:RawByteString;rw:AnsiChar):cint;
+Function POpen       (var F:file;const Prog:RawByteString;rw:AnsiChar):cint;
+Function POpen       (var F:text;const Prog:UnicodeString;rw:AnsiChar):cint;
+Function POpen       (var F:file;const Prog:UnicodeString;rw:AnsiChar):cint;
 Function AssignStream(Var StreamIn,Streamout:text;Const Prog:ansiString;const args : array of ansistring) : cint;
 Function AssignStream(Var StreamIn,Streamout:text;Const Prog:ansiString;const args : array of ansistring) : cint;
 Function AssignStream(Var StreamIn,Streamout,streamerr:text;Const Prog:ansiString;const args : array of ansistring) : cint;
 Function AssignStream(Var StreamIn,Streamout,streamerr:text;Const Prog:ansiString;const args : array of ansistring) : cint;
 Function GetDomainName:String; deprecated; // because linux only.
 Function GetDomainName:String; deprecated; // because linux only.
@@ -185,7 +185,7 @@ Uses
 
 
 {$i unxfunc.inc}   { Platform specific implementations }
 {$i unxfunc.inc}   { Platform specific implementations }
 
 
-Function getenv(name:string):Pchar; external name 'FPC_SYSC_FPGETENV';
+Function getenv(name:string):PAnsiChar; external name 'FPC_SYSC_FPGETENV';
 
 
 {******************************************************************************
 {******************************************************************************
                           timezone support
                           timezone support
@@ -403,7 +403,7 @@ begin
    end;
    end;
 end;
 end;
 
 
-function intFpExecVEMaybeP (Const PathName:RawByteString;Args,MyEnv:ppchar;SearchPath:Boolean):cint;
+function intFpExecVEMaybeP (Const PathName:RawByteString;Args,MyEnv:PPAnsiChar;SearchPath:Boolean):cint;
 // does an ExecVE, but still has to handle P
 // does an ExecVE, but still has to handle P
 // execv variants call this directly, execl variants indirectly via
 // execv variants call this directly, execl variants indirectly via
 //     intfpexecl
 //     intfpexecl
@@ -432,11 +432,11 @@ Begin
       // Stevens says "try each path prefix"
       // Stevens says "try each path prefix"
 
 
       // execp puts newcmd here.
       // execp puts newcmd here.
-        args^:=pchar(newcmd);
+        args^:=PAnsiChar(newcmd);
    End else
    End else
       newcmd:=ToSingleByteFileSystemEncodedFileName(pathname);
       newcmd:=ToSingleByteFileSystemEncodedFileName(pathname);
  // repeat
  // repeat
-//      if searchpath then args^:=pchar(commandtorun)
+//      if searchpath then args^:=PAnsiChar(commandtorun)
 
 
   IntFpExecVEMaybeP:=fpExecVE(newcmd,Args,MyEnv);
   IntFpExecVEMaybeP:=fpExecVE(newcmd,Args,MyEnv);
 {
 {
@@ -459,11 +459,11 @@ Begin
 }
 }
 end;
 end;
 
 
-function intFpExecl (Const PathName:RawByteString;const s:array of RawByteString;MyEnv:ppchar;SearchPath:Boolean):cint;
-{ Handles the array of ansistring -> ppchar conversion.
+function intFpExecl (Const PathName:RawByteString;const s:array of RawByteString;MyEnv:PPAnsiChar;SearchPath:Boolean):cint;
+{ Handles the array of ansistring -> PPAnsiChar conversion.
   Base for the the "l" variants.
   Base for the the "l" variants.
 }
 }
-var p:ppchar;
+var p:PPAnsiChar;
     i:integer;
     i:integer;
     s2:array of Rawbytestring;
     s2:array of Rawbytestring;
 begin
 begin
@@ -478,7 +478,7 @@ begin
   p:=ArrayStringToPPchar(s2,1);
   p:=ArrayStringToPPchar(s2,1);
   if p=NIL Then
   if p=NIL Then
     Begin
     Begin
-      GetMem(p,2*sizeof(pchar));
+      GetMem(p,2*sizeof(PAnsiChar));
       if p=nil then
       if p=nil then
        begin
        begin
         {$ifdef xunix}
         {$ifdef xunix}
@@ -489,13 +489,13 @@ begin
        end;
        end;
       p[1]:=nil;
       p[1]:=nil;
     End;
     End;
-  p^:=pchar(PathName);
+  p^:=PAnsiChar(PathName);
   IntFPExecL:=intFpExecVEMaybeP(PathName,p,MyEnv,SearchPath);
   IntFPExecL:=intFpExecVEMaybeP(PathName,p,MyEnv,SearchPath);
   // If we come here, no attempts were executed successfully.
   // If we come here, no attempts were executed successfully.
   Freemem(p);
   Freemem(p);
 end;
 end;
 
 
-function FpExecLE (Const PathName:RawByteString;const S:Array Of RawByteString;MyEnv:ppchar):cint;
+function FpExecLE (Const PathName:RawByteString;const S:Array Of RawByteString;MyEnv:PPAnsiChar):cint;
 
 
 Begin
 Begin
   FpExecLE:=intFPExecl(PathName,s,MyEnv,false);
   FpExecLE:=intFPExecl(PathName,s,MyEnv,false);
@@ -514,25 +514,25 @@ Begin
   FpExecLP:=intFPExecl(PathName,S,EnvP,True);
   FpExecLP:=intFPExecl(PathName,S,EnvP,True);
 End;
 End;
 
 
-function FpExecLPE(Const PathName:RawByteString;const S:Array Of RawByteString;env:ppchar):cint;
+function FpExecLPE(Const PathName:RawByteString;const S:Array Of RawByteString;env:PPAnsiChar):cint;
 
 
 Begin
 Begin
   FpExecLPE:=intFPExecl(PathName,S,Env,True);
   FpExecLPE:=intFPExecl(PathName,S,Env,True);
 End;
 End;
 
 
-function FpExecV(Const PathName:RawByteString;args:ppchar):cint;
+function FpExecV(Const PathName:RawByteString;args:PPAnsiChar):cint;
 
 
 Begin
 Begin
  fpexecV:=intFpExecVEMaybeP (PathName,args,envp,false);
  fpexecV:=intFpExecVEMaybeP (PathName,args,envp,false);
 End;
 End;
 
 
-function FpExecVP(Const PathName:RawByteString;args:ppchar):cint;
+function FpExecVP(Const PathName:RawByteString;args:PPAnsiChar):cint;
 
 
 Begin
 Begin
  fpexecVP:=intFpExecVEMaybeP (PathName,args,envp,true);
  fpexecVP:=intFpExecVEMaybeP (PathName,args,envp,true);
 End;
 End;
 
 
-function FpExecVPE(Const PathName:RawByteString;args,env:ppchar):cint;
+function FpExecVPE(Const PathName:RawByteString;args,env:PPAnsiChar):cint;
 
 
 Begin
 Begin
  fpexecVPE:=intFpExecVEMaybeP (PathName,args,env,true);
  fpexecVPE:=intFpExecVEMaybeP (PathName,args,env,true);
@@ -541,7 +541,7 @@ End;
 // exect and execvP (ExecCapitalP) are not implement
 // exect and execvP (ExecCapitalP) are not implement
 // Non POSIX anyway.
 // Non POSIX anyway.
 // Exect turns on tracing for the process
 // Exect turns on tracing for the process
-// execvP has the searchpath as array of ansistring ( const char *search_path)
+// execvP has the searchpath as array of ansistring ( const AnsiChar *search_path)
 
 
 {$define FPC_USE_FPEXEC}
 {$define FPC_USE_FPEXEC}
 {$if defined(FPC_USE_FPEXEC) and not defined(USE_VFORK)}
 {$if defined(FPC_USE_FPEXEC) and not defined(USE_VFORK)}
@@ -549,14 +549,14 @@ End;
 {$endif}
 {$endif}
 
 
 {$ifdef FPC_USE_LIBC}
 {$ifdef FPC_USE_LIBC}
-function xfpsystem(p:pchar):cint; cdecl; external clib name 'system';
+function xfpsystem(p:PAnsiChar):cint; cdecl; external clib name 'system';
 
 
 Function fpSystem(const Command:RawByteString):cint;
 Function fpSystem(const Command:RawByteString):cint;
 var
 var
   cmd: RawByteString;
   cmd: RawByteString;
 begin
 begin
   cmd:=ToSingleByteFileSystemEncodedFileName(Command);
   cmd:=ToSingleByteFileSystemEncodedFileName(Command);
-  fpsystem:=xfpsystem(pchar(cmd));
+  fpsystem:=xfpsystem(PAnsiChar(cmd));
 end;
 end;
 
 
 {$else}
 {$else}
@@ -569,7 +569,7 @@ var
   newsigblock,
   newsigblock,
   oldsigblock    : tsigset;
   oldsigblock    : tsigset;
  {$ifndef SHELL_USE_FPEXEC}
  {$ifndef SHELL_USE_FPEXEC}
-   p      : ppchar;
+   p      : PPAnsiChar;
  {$endif}
  {$endif}
   cmd     : RawByteString;
   cmd     : RawByteString;
 
 
@@ -765,10 +765,10 @@ begin
         { first check if we need something to write, else we may
         { first check if we need something to write, else we may
           get a SigPipe when Close() is called (PFV) }
           get a SigPipe when Close() is called (PFV) }
         if textrec(f).bufpos>0 then
         if textrec(f).bufpos>0 then
-          IOPipe:=fpwrite(textrec(f).handle,pchar(textrec(f).bufptr),textrec(f).bufpos);
+          IOPipe:=fpwrite(textrec(f).handle,PAnsiChar(textrec(f).bufptr),textrec(f).bufpos);
       end;
       end;
     fminput : Begin
     fminput : Begin
-                textrec(f).bufend:=fpread(textrec(f).handle,pchar(textrec(f).bufptr),textrec(f).bufsize);
+                textrec(f).bufend:=fpread(textrec(f).handle,PAnsiChar(textrec(f).bufptr),textrec(f).bufsize);
                 IOPipe:=textrec(f).bufend;
                 IOPipe:=textrec(f).bufend;
               End;
               End;
   end;
   end;
@@ -857,7 +857,7 @@ begin
 end;
 end;
 
 
 
 
-Function POpen_internal(var F:text;const Prog:RawByteString;rw:char):cint;
+Function POpen_internal(var F:text;const Prog:RawByteString;rw:AnsiChar):cint;
 {
 {
   Starts the program in 'Prog' and makes it's input or out put the
   Starts the program in 'Prog' and makes it's input or out put the
   other end of a pipe. If rw is 'w' or 'W', then whatever is written to
   other end of a pipe. If rw is 'w' or 'W', then whatever is written to
@@ -871,7 +871,7 @@ var
   pid  : cint;
   pid  : cint;
   pl   : ^cint;
   pl   : ^cint;
 {$if not defined(FPC_USE_FPEXEC) or defined(USE_VFORK)}
 {$if not defined(FPC_USE_FPEXEC) or defined(USE_VFORK)}
-  pp : array[0..3] of pchar;
+  pp : array[0..3] of PAnsiChar;
   temp : string[255];
   temp : string[255];
 {$endif not FPC_USE_FPEXEC or USE_VFORK}
 {$endif not FPC_USE_FPEXEC or USE_VFORK}
   ret  : cint;
   ret  : cint;
@@ -938,7 +938,7 @@ begin
          fpexit(127);
          fpexit(127);
       end;
       end;
      {$if defined(FPC_USE_FPEXEC) and not defined(USE_VFORK)}
      {$if defined(FPC_USE_FPEXEC) and not defined(USE_VFORK)}
-     fpexecl(pchar('/bin/sh'),['-c',Prog]);
+     fpexecl(PAnsiChar('/bin/sh'),['-c',Prog]);
      {$else}
      {$else}
      temp:='/bin/sh'#0'-c'#0;
      temp:='/bin/sh'#0'-c'#0;
      pp[0]:=@temp[1];
      pp[0]:=@temp[1];
@@ -972,7 +972,7 @@ begin
  POpen_internal:=0;
  POpen_internal:=0;
 end;
 end;
 
 
-Function POpen_internal(var F:file;const Prog:RawByteString;rw:char):cint;
+Function POpen_internal(var F:file;const Prog:RawByteString;rw:AnsiChar):cint;
 {
 {
   Starts the program in 'Prog' and makes it's input or out put the
   Starts the program in 'Prog' and makes it's input or out put the
   other end of a pipe. If rw is 'w' or 'W', then whatever is written to
   other end of a pipe. If rw is 'w' or 'W', then whatever is written to
@@ -986,7 +986,7 @@ var
   pid  : cint;
   pid  : cint;
   pl   : ^cint;
   pl   : ^cint;
 {$if not defined(FPC_USE_FPEXEC) or defined(USE_VFORK)}
 {$if not defined(FPC_USE_FPEXEC) or defined(USE_VFORK)}
-  pp : array[0..3] of pchar;
+  pp : array[0..3] of PAnsiChar;
   temp : string[255];
   temp : string[255];
 {$endif not FPC_USE_FPEXEC or USE_VFORK}
 {$endif not FPC_USE_FPEXEC or USE_VFORK}
   ret  : cint;
   ret  : cint;
@@ -1053,7 +1053,7 @@ begin
          fpexit(127);
          fpexit(127);
       end;
       end;
      {$if defined(FPC_USE_FPEXEC) and not defined(USE_VFORK)}
      {$if defined(FPC_USE_FPEXEC) and not defined(USE_VFORK)}
-     fpexecl(pchar('/bin/sh'),['-c',Prog]);
+     fpexecl(PAnsiChar('/bin/sh'),['-c',Prog]);
      {$else}
      {$else}
      temp:='/bin/sh'#0'-c'#0;
      temp:='/bin/sh'#0'-c'#0;
      pp[0]:=@temp[1];
      pp[0]:=@temp[1];
@@ -1085,7 +1085,7 @@ begin
  POpen_internal:=0;
  POpen_internal:=0;
 end;
 end;
 
 
-Function POpen(var F:text;const Prog:RawByteString;rw:char):cint;
+Function POpen(var F:text;const Prog:RawByteString;rw:AnsiChar):cint;
 begin
 begin
   { can't do the ToSingleByteFileSystemEncodedFileName() conversion inside
   { can't do the ToSingleByteFileSystemEncodedFileName() conversion inside
     POpen_internal, because this may destroy the temp rawbytestring result
     POpen_internal, because this may destroy the temp rawbytestring result
@@ -1093,7 +1093,7 @@ begin
   POpen:=POpen_internal(F,ToSingleByteFileSystemEncodedFileName(Prog),rw);
   POpen:=POpen_internal(F,ToSingleByteFileSystemEncodedFileName(Prog),rw);
 end;
 end;
 
 
-Function POpen(var F:file;const Prog:RawByteString;rw:char):cint;
+Function POpen(var F:file;const Prog:RawByteString;rw:AnsiChar):cint;
 begin
 begin
   { can't do the ToSingleByteFileSystemEncodedFileName() conversion inside
   { can't do the ToSingleByteFileSystemEncodedFileName() conversion inside
     POpen_internal, because this may destroy the temp rawbytestring result
     POpen_internal, because this may destroy the temp rawbytestring result
@@ -1101,13 +1101,13 @@ begin
   POpen:=POpen_internal(F,ToSingleByteFileSystemEncodedFileName(Prog),rw);
   POpen:=POpen_internal(F,ToSingleByteFileSystemEncodedFileName(Prog),rw);
 end;
 end;
 
 
-function POpen(var F: text; const Prog: UnicodeString; rw: char): cint;
+function POpen(var F: text; const Prog: UnicodeString; rw: AnsiChar): cint;
 begin
 begin
   POpen:=POpen_internal(F,ToSingleByteFileSystemEncodedFileName(Prog),rw);
   POpen:=POpen_internal(F,ToSingleByteFileSystemEncodedFileName(Prog),rw);
 end;
 end;
 
 
 
 
-function POpen(var F: file; const Prog: UnicodeString; rw: char): cint;
+function POpen(var F: file; const Prog: UnicodeString; rw: AnsiChar): cint;
 begin
 begin
   POpen:=POpen_internal(F,ToSingleByteFileSystemEncodedFileName(Prog),rw);
   POpen:=POpen_internal(F,ToSingleByteFileSystemEncodedFileName(Prog),rw);
 end;
 end;
@@ -1325,7 +1325,7 @@ Function GetDomainName:String;
 
 
 {$if defined(BSD) or defined(aix)}
 {$if defined(BSD) or defined(aix)}
 
 
-function intGetDomainName(Name:PChar; NameLen:Cint):cint;
+function intGetDomainName(Name:PAnsiChar; NameLen:Cint):cint;
 {$ifndef FPC_USE_LIBC}
 {$ifndef FPC_USE_LIBC}
  external name 'FPC_SYSC_GETDOMAINNAME';
  external name 'FPC_SYSC_GETDOMAINNAME';
 {$else FPC_USE_LIBC}
 {$else FPC_USE_LIBC}
@@ -1380,7 +1380,7 @@ Var
   p1     : cint;
   p1     : cint;
   Info   : Stat;
   Info   : Stat;
   i,j      : cint;
   i,j      : cint;
-  p      : pchar;
+  p      : PAnsiChar;
 Begin
 Begin
  SetCodePage(dirlist,DefaultFileSystemCodePage);
  SetCodePage(dirlist,DefaultFileSystemCodePage);
  if CurrentDirStrategy=CurrentDirectoryFirst Then
  if CurrentDirStrategy=CurrentDirectoryFirst Then
@@ -1400,7 +1400,7 @@ Begin
   Else
   Else
    Begin
    Begin
      mypath:=ToSingleByteFileSystemEncodedFileName(path);
      mypath:=ToSingleByteFileSystemEncodedFileName(path);
-     p:=pchar(dirlist);
+     p:=PAnsiChar(dirlist);
      i:=length(dirlist);
      i:=length(dirlist);
      j:=1;
      j:=1;
      Repeat
      Repeat

+ 15 - 15
rtl/unix/unixutil.pp

@@ -27,22 +27,22 @@ unit unixutil;
 
 
 interface
 interface
 
 
-Function StringToPPChar(S: PChar;ReserveEntries:integer):ppchar;
-Function StringToPPChar(Var S:RawByteString;ReserveEntries:integer):ppchar;
-function ArrayStringToPPchar(const S:Array of RawByteString;reserveentries:Longint):ppchar; // const ?
+Function StringToPPChar(S: PAnsiChar;ReserveEntries:integer):PPAnsiChar;
+Function StringToPPChar(Var S:RawByteString;ReserveEntries:integer):PPAnsiChar;
+function ArrayStringToPPchar(const S:Array of RawByteString;reserveentries:Longint):PPAnsiChar; // const ?
 
 
 implementation
 implementation
 
 
-function ArrayStringToPPchar(const S:Array of RawByteString;reserveentries:Longint):ppchar; // const ?
-// Extra allocate reserveentries pchar's at the beginning (default param=0 after 1.0.x ?)
+function ArrayStringToPPchar(const S:Array of RawByteString;reserveentries:Longint):PPAnsiChar; // const ?
+// Extra allocate reserveentries PAnsiChar's at the beginning (default param=0 after 1.0.x ?)
 // Note: for internal use by skilled programmers only
 // Note: for internal use by skilled programmers only
 // if "s" goes out of scope in the parent procedure, the pointer is dangling.
 // if "s" goes out of scope in the parent procedure, the pointer is dangling.
 
 
-var p   : ppchar;
+var p   : PPAnsiChar;
     i   : LongInt;
     i   : LongInt;
 begin
 begin
   if High(s)<Low(s) Then Exit(NIL);
   if High(s)<Low(s) Then Exit(NIL);
-  Getmem(p,sizeof(pchar)*(high(s)-low(s)+ReserveEntries+2));  // one more for NIL, one more
+  Getmem(p,sizeof(PAnsiChar)*(high(s)-low(s)+ReserveEntries+2));  // one more for NIL, one more
                                               // for cmd
                                               // for cmd
   if p=nil then
   if p=nil then
     begin
     begin
@@ -52,27 +52,27 @@ begin
       exit(NIL);
       exit(NIL);
     end;
     end;
   for i:=low(s) to high(s) do
   for i:=low(s) to high(s) do
-     p[i+Reserveentries]:=pchar(s[i]);
+     p[i+Reserveentries]:=PAnsiChar(s[i]);
   p[high(s)+1+Reserveentries]:=nil;
   p[high(s)+1+Reserveentries]:=nil;
   ArrayStringToPPchar:=p;
   ArrayStringToPPchar:=p;
 end;
 end;
 
 
-Function StringToPPChar(Var S:RawByteString;ReserveEntries:integer):ppchar;
+Function StringToPPChar(Var S:RawByteString;ReserveEntries:integer):PPAnsiChar;
 {
 {
-  Create a PPChar to structure of pchars which are the arguments specified
+  Create a PPAnsiChar to structure of pchars which are the arguments specified
   in the string S. Especially useful for creating an ArgV for Exec-calls
   in the string S. Especially useful for creating an ArgV for Exec-calls
 }
 }
 
 
 begin
 begin
-  StringToPPChar:=StringToPPChar(PChar(S),ReserveEntries);
+  StringToPPChar:=StringToPPChar(PAnsiChar(S),ReserveEntries);
 end;
 end;
 
 
-Function StringToPPChar(S: PChar;ReserveEntries:integer):ppchar;
+Function StringToPPChar(S: PAnsiChar;ReserveEntries:integer):PPAnsiChar;
 
 
 var
 var
   i,nr  : longint;
   i,nr  : longint;
-  Buf : ^char;
-  p   : ppchar;
+  Buf : ^AnsiChar;
+  p   : PPAnsiChar;
 
 
 begin
 begin
   buf:=s;
   buf:=s;
@@ -96,7 +96,7 @@ begin
            inc(buf);
            inc(buf);
        end;
        end;
    end;
    end;
-  getmem(p,(ReserveEntries+nr)*sizeof(pchar));
+  getmem(p,(ReserveEntries+nr)*sizeof(PAnsiChar));
   StringToPPChar:=p;
   StringToPPChar:=p;
   if p=nil then
   if p=nil then
    begin
    begin

+ 2 - 2
rtl/unix/unxdeclh.inc

@@ -39,9 +39,9 @@ Function fpfStatFS(Fd:Longint; Info:pstatfs):cint; cdecl; external clib name 'fs
 Function fpfsync (fd : cint) : cint; cdecl; external clib name 'fsync';
 Function fpfsync (fd : cint) : cint; cdecl; external clib name 'fsync';
 
 
 {$if defined(beos) or defined(solaris) }
 {$if defined(beos) or defined(solaris) }
-Function fpStatFS  (Path:pchar; Info:pstatfs):cint; cdecl; external clib name 'statvfs';
+Function fpStatFS  (Path:PAnsiChar; Info:pstatfs):cint; cdecl; external clib name 'statvfs';
 {$else beos or solaris }
 {$else beos or solaris }
-Function fpStatFS  (Path:pchar; Info:pstatfs):cint; cdecl; external clib name 'statfs'{$ifdef darin_new_iostructs_suffix}+'$INODE64'{$endif};
+Function fpStatFS  (Path:PAnsiChar; Info:pstatfs):cint; cdecl; external clib name 'statfs'{$ifdef darin_new_iostructs_suffix}+'$INODE64'{$endif};
 {$endif beos or solaris }
 {$endif beos or solaris }
 
 
 function pipe (var fildes: filedesarray):cint;  cdecl; external clib name 'pipe';
 function pipe (var fildes: filedesarray):cint;  cdecl; external clib name 'pipe';

+ 1 - 1
rtl/unix/unxovl.inc

@@ -16,6 +16,6 @@
 Function fpStatFS(Path:ansistring;Info:PStatfs):cint;
 Function fpStatFS(Path:ansistring;Info:PStatfs):cint;
 
 
 begin
 begin
-  fpstatfs:=fpstatfs(pchar(path),info);
+  fpstatfs:=fpstatfs(PAnsiChar(path),info);
 end;
 end;
 
 

+ 2 - 2
rtl/unix/x86.pp

@@ -412,12 +412,12 @@ type
 
 
     i386_vm86_args = record
     i386_vm86_args = record
         sub_op   : cint;             { sub-operation to perform }
         sub_op   : cint;             { sub-operation to perform }
-        sub_args : pchar;               { args }
+        sub_args : PAnsiChar;               { args }
         end;
         end;
 
 
    sysarch_args     = record
    sysarch_args     = record
                         op    : longint;
                         op    : longint;
-                        parms : pchar;
+                        parms : PAnsiChar;
                        end;
                        end;
 
 
 Function fpIOPerm(From,Num:CARDINAL;Value:cint):cint;
 Function fpIOPerm(From,Num:CARDINAL;Value:cint):cint;