CONTENT
  • CHANGES
Szukaj
counter

#top Filesystem

[<<]|[<]|[^]|[v]|[>]|[>>]|[Zwiń]|[#top]|[X]

code / ansic / sysfile

#top Makefile


Dla ułatwienia korzystania z przykładów został utworzony jeden zbiorczy plik Makefile kompilujący przykłady użycia poniżej wymienionych funkcji związanych z operacjami na systemie plików (funkcja dotyczące operacji na plikach).

Poniższe pliki Makefile zakładają obecność wszystkich plików przykładów, w przypadku chęci kompilacji za pomocą Makefile tylko wybranego przykładu należy zakomentować w pliku Makefile ostatnią pozycję zawierającą listę wszystkich targetów do wykonania make: $(ACCESS) ..., a następnie odkomentować powyżej komendę make zawierającą nazwę targetu dla bieżącego przykładu, np: w przypadku chęci kompilacji tylko przykładu access należy zakomentować ostatnią pozycję rozpoczynającą się od make: $(ACCESS) ... (wstawić na początku przed make znak #), a następnie odkomentować pozycję: #make: $(ACCESS) (usunąć znak #).

#top Makefile (linux)


SELECT ALL
# Project: Project
# Makefile created

GCC         = gcc
INCS        = -DHAVE_SYS_STATFS_H=1 -DHAVE_DIRENT_TYPEOFF=1 -DHAVE_FCNTL=1 -DHAVE_FDATASYNC=1 -DHAVE_FLOCK=1 -DHAVE_FMEMOPEN=1 -DHAVE_FNMATCH=1 -DHAVE_FSYNC=1 -DHAVE_FUTIMES=1 -DHAVE_LCHMOD=1 -DHAVE_LOCKF=1 -DHAVE_LUTIMES=1 -DHAVE_PREAD=1 -DHAVE_PWRITE=1 -DHAVE_SETBUFFER=1 -DHAVE_SETLINEBUF=1 -DHAVE_UTIMES=1
CFLAGS      = $(INCS) -W -O2 -Wall -pedantic -Wstrict-aliasing -Wno-long-long -D_FILE_OFFSET_BITS=64 -D_LINUX -D_REENTRANT
CFLAGS      = $(INCS) -W -O2 -Wall -pedantic -Wstrict-aliasing -Wno-long-long
LIBS        =
LIBDIRS     =
LDFLAGS     = $(LIBDIRS) $(LIBS)
RM          = rm -f
MKDCMD      = mkdir -p

ACCESS      = access
CHGRP       = chgrp
CHMOD       = chmod
CHOWN       = chown
CLOSE       = close
DUP2        = dup2
DUP         = dup
FCHMOD      = fchmod
FCHOWN      = fchown
FCLOSE      = fclose
FCNTL       = fcntl
FDATASYNC   = fdatasync
FDOPEN      = fdopen
FEOF        = feof
FERROR      = ferror
FFLUSH      = fflush
FGETC       = fgetc
FGETPOS     = fgetpos
FGETS       = fgets
FILENO      = fileno
FLOCK       = flock
FMEMOPEN    = fmemopen
FNMATCH     = fnmatch
FOPEN       = fopen
FPRINTF     = fprintf
FPUTC       = fputc
FPUTS       = fputs
FREAD       = fread
FREOPEN     = freopen
FSEEK       = fseek
FSETPOS     = fsetpos
FSTAT       = fstat
FSYNC       = fsync
FTELL       = ftell
FTRUNCATE   = ftruncate
FUTIMES     = futimes
FWRITE      = fwrite
GETC        = getc
GETDELIM    = getdelim
GETDTABLESIZE= getdtablesize
GETLINE     = getline
GETW        = getw
LCHMOD      = lchmod
LCHOWN      = lchown
LINK        = link
LOCKF       = lockf
LSEEK       = lseek
LSTAT       = lstat
LUTIMES     = lutimes
MKDTEMP     = mkdtemp
MKFIFO      = mkfifo
MKNOD       = mknod
MKSTEMP     = mkstemp
MKTEMP      = mktemp
OPEN        = open
OPEN_MEMSTREAM= open_memstream
PREAD       = pread
PUTC        = putc
PUTW        = putw
PWRITE      = pwrite
READ        = read
READ_LINES  = read-lines
READLINK    = readlink
REALPATH    = realpath
REMOVE      = remove
RENAME      = rename
REWIND      = rewind
SETBUF      = setbuf
SETBUFFER   = setbuffer
SETLINEBUF  = setlinebuf
SETVBUF     = setvbuf
STAT        = stat
STATFS      = statfs
STATVFS     = statvfs
STDERR      = stderr
STDIN       = stdin
STDOUT      = stdout
SYMLINK     = symlink
SYNC        = sync
TEMPNAM     = tempnam
TMPFILE     = tmpfile
TMPNAM      = tmpnam
TRUNCATE    = truncate
UNGETC      = ungetc
UNLINK      = unlink
UTIMES      = utimes
VFPRINTF    = vfprintf
WRITE       = write



all: objdir make

objdir:
	$(MKDCMD) obj/

clean: objdir
	$(RM) obj/*.o *.o *~

#make: $(ACCESS)
#make: $(CHGRP)
#make: $(CHMOD)
#make: $(CHOWN)
#make: $(CLOSE)
#make: $(DUP2)
#make: $(DUP)
#make: $(FCHMOD)
#make: $(FCHOWN)
#make: $(FCLOSE)
#make: $(FCNTL)
#make: $(FDATASYNC)
#make: $(FDOPEN)
#make: $(FEOF)
#make: $(FERROR)
#make: $(FFLUSH)
#make: $(FGETC)
#make: $(FGETPOS)
#make: $(FGETS)
#make: $(FILENO)
#make: $(FLOCK)
#make: $(FMEMOPEN)
#make: $(FNMATCH)
#make: $(FOPEN)
#make: $(FPRINTF)
#make: $(FPUTC)
#make: $(FPUTS)
#make: $(FREAD)
#make: $(FREOPEN)
#make: $(FSEEK)
#make: $(FSETPOS)
#make: $(FSTAT)
#make: $(FSYNC)
#make: $(FTELL)
#make: $(FTRUNCATE)
#make: $(FUTIMES)
#make: $(FWRITE)
#make: $(GETC)
#make: $(GETDELIM)
#make: $(GETDTABLESIZE)
#make: $(GETLINE)
#make: $(GETW)
#make: $(LCHMOD)
#make: $(LCHOWN)
#make: $(LINK)
#make: $(LOCKF)
#make: $(LSEEK)
#make: $(LSTAT)
#make: $(LUTIMES)
#make: $(MKDTEMP)
#make: $(MKFIFO)
#make: $(MKNOD)
#make: $(MKSTEMP)
#make: $(MKTEMP)
#make: $(OPEN)
#make: $(OPEN_MEMSTREAM)
#make: $(PREAD)
#make: $(PUTC)
#make: $(PUTW)
#make: $(PWRITE)
#make: $(READ)
#make: $(READ_LINES)
#make: $(READLINK)
#make: $(REALPATH)
#make: $(REMOVE)
#make: $(RENAME)
#make: $(REWIND)
#make: $(SETBUF)
#make: $(SETBUFFER)
#make: $(SETLINEBUF)
#make: $(SETVBUF)
#make: $(STAT)
#make: $(STATFS)
#make: $(STATVFS)
#make: $(STDERR)
#make: $(STDIN)
#make: $(STDOUT)
#make: $(SYMLINK)
#make: $(SYNC)
#make: $(TEMPNAM)
#make: $(TMPFILE)
#make: $(TMPNAM)
#make: $(TRUNCATE)
#make: $(UNGETC)
#make: $(UNLINK)
#make: $(UTIMES)
#make: $(VFPRINTF)
#make: $(WRITE)
make: $(ACCESS) $(CHGRP) $(CHMOD) $(CHOWN) $(CLOSE) $(DUP2) $(DUP) $(FCHMOD) $(FCHOWN) $(FCLOSE) $(FCNTL) $(FDATASYNC) $(FDOPEN) $(FEOF) $(FERROR) $(FFLUSH) $(FGETC) $(FGETPOS) $(FGETS) $(FILENO) $(FLOCK) $(FMEMOPEN) $(FNMATCH) $(FOPEN) $(FPRINTF) $(FPUTC) $(FPUTS) $(FREAD) $(FREOPEN) $(FSEEK) $(FSETPOS) $(FSTAT) $(FSYNC) $(FTELL) $(FTRUNCATE) $(FUTIMES) $(FWRITE) $(GETC) $(GETDELIM) $(GETDTABLESIZE) $(GETLINE) $(GETW) $(LCHMOD) $(LCHOWN) $(LINK) $(LOCKF) $(LSEEK) $(LSTAT) $(LUTIMES) $(MKDTEMP) $(MKFIFO) $(MKNOD) $(MKSTEMP) $(MKTEMP) $(OPEN) $(OPEN_MEMSTREAM) $(PREAD) $(PUTC) $(PUTW) $(PWRITE) $(READ) $(READ_LINES) $(READLINK) $(REALPATH) $(REMOVE) $(RENAME) $(REWIND) $(SETBUF) $(SETBUFFER) $(SETLINEBUF) $(SETVBUF) $(STAT) $(STATFS) $(STATVFS) $(STDERR) $(STDIN) $(STDOUT) $(SYMLINK) $(SYNC) $(TEMPNAM) $(TMPFILE) $(TMPNAM) $(TRUNCATE) $(UNGETC) $(UNLINK) $(UTIMES) $(VFPRINTF) $(WRITE)



$(ACCESS): $(ACCESS).o
	$(GCC) -o $(ACCESS) obj/$(ACCESS).o $(LDFLAGS)
$(ACCESS).o:
	$(GCC) -o obj/$(ACCESS).o -c $(ACCESS).c $(CFLAGS)

$(CHGRP): $(CHGRP).o
	$(GCC) -o $(CHGRP) obj/$(CHGRP).o $(LDFLAGS)
$(CHGRP).o:
	$(GCC) -o obj/$(CHGRP).o -c $(CHGRP).c $(CFLAGS)

$(CHMOD): $(CHMOD).o
	$(GCC) -o $(CHMOD) obj/$(CHMOD).o $(LDFLAGS)
$(CHMOD).o:
	$(GCC) -o obj/$(CHMOD).o -c $(CHMOD).c $(CFLAGS)

$(CHOWN): $(CHOWN).o
	$(GCC) -o $(CHOWN) obj/$(CHOWN).o $(LDFLAGS)
$(CHOWN).o:
	$(GCC) -o obj/$(CHOWN).o -c $(CHOWN).c $(CFLAGS)

$(CLOSE): $(CLOSE).o
	$(GCC) -o $(CLOSE) obj/$(CLOSE).o $(LDFLAGS)
$(CLOSE).o:
	$(GCC) -o obj/$(CLOSE).o -c $(CLOSE).c $(CFLAGS)

$(DUP2): $(DUP2).o
	$(GCC) -o $(DUP2) obj/$(DUP2).o $(LDFLAGS)
$(DUP2).o:
	$(GCC) -o obj/$(DUP2).o -c $(DUP2).c $(CFLAGS)

$(DUP): $(DUP).o
	$(GCC) -o $(DUP) obj/$(DUP).o $(LDFLAGS)
$(DUP).o:
	$(GCC) -o obj/$(DUP).o -c $(DUP).c $(CFLAGS)

$(FCHMOD): $(FCHMOD).o
	$(GCC) -o $(FCHMOD) obj/$(FCHMOD).o $(LDFLAGS)
$(FCHMOD).o:
	$(GCC) -o obj/$(FCHMOD).o -c $(FCHMOD).c $(CFLAGS)

$(FCHOWN): $(FCHOWN).o
	$(GCC) -o $(FCHOWN) obj/$(FCHOWN).o $(LDFLAGS)
$(FCHOWN).o:
	$(GCC) -o obj/$(FCHOWN).o -c $(FCHOWN).c $(CFLAGS)

$(FCLOSE): $(FCLOSE).o
	$(GCC) -o $(FCLOSE) obj/$(FCLOSE).o $(LDFLAGS)
$(FCLOSE).o:
	$(GCC) -o obj/$(FCLOSE).o -c $(FCLOSE).c $(CFLAGS)

$(FCNTL): $(FCNTL).o
	$(GCC) -o $(FCNTL) obj/$(FCNTL).o $(LDFLAGS)
$(FCNTL).o:
	$(GCC) -o obj/$(FCNTL).o -c $(FCNTL).c $(CFLAGS)

$(FDATASYNC): $(FDATASYNC).o
	$(GCC) -o $(FDATASYNC) obj/$(FDATASYNC).o $(LDFLAGS)
$(FDATASYNC).o:
	$(GCC) -o obj/$(FDATASYNC).o -c $(FDATASYNC).c $(CFLAGS)

$(FDOPEN): $(FDOPEN).o
	$(GCC) -o $(FDOPEN) obj/$(FDOPEN).o $(LDFLAGS)
$(FDOPEN).o:
	$(GCC) -o obj/$(FDOPEN).o -c $(FDOPEN).c $(CFLAGS)

$(FEOF): $(FEOF).o
	$(GCC) -o $(FEOF) obj/$(FEOF).o $(LDFLAGS)
$(FEOF).o:
	$(GCC) -o obj/$(FEOF).o -c $(FEOF).c $(CFLAGS)

$(FERROR): $(FERROR).o
	$(GCC) -o $(FERROR) obj/$(FERROR).o $(LDFLAGS)
$(FERROR).o:
	$(GCC) -o obj/$(FERROR).o -c $(FERROR).c $(CFLAGS)

$(FFLUSH): $(FFLUSH).o
	$(GCC) -o $(FFLUSH) obj/$(FFLUSH).o $(LDFLAGS)
$(FFLUSH).o:
	$(GCC) -o obj/$(FFLUSH).o -c $(FFLUSH).c $(CFLAGS)

$(FGETC): $(FGETC).o
	$(GCC) -o $(FGETC) obj/$(FGETC).o $(LDFLAGS)
$(FGETC).o:
	$(GCC) -o obj/$(FGETC).o -c $(FGETC).c $(CFLAGS)

$(FGETPOS): $(FGETPOS).o
	$(GCC) -o $(FGETPOS) obj/$(FGETPOS).o $(LDFLAGS)
$(FGETPOS).o:
	$(GCC) -o obj/$(FGETPOS).o -c $(FGETPOS).c $(CFLAGS)

$(FGETS): $(FGETS).o
	$(GCC) -o $(FGETS) obj/$(FGETS).o $(LDFLAGS)
$(FGETS).o:
	$(GCC) -o obj/$(FGETS).o -c $(FGETS).c $(CFLAGS)

$(FILENO): $(FILENO).o
	$(GCC) -o $(FILENO) obj/$(FILENO).o $(LDFLAGS)
$(FILENO).o:
	$(GCC) -o obj/$(FILENO).o -c $(FILENO).c $(CFLAGS)

$(FLOCK): $(FLOCK).o
	$(GCC) -o $(FLOCK) obj/$(FLOCK).o $(LDFLAGS)
$(FLOCK).o:
	$(GCC) -o obj/$(FLOCK).o -c $(FLOCK).c $(CFLAGS)

$(FMEMOPEN): $(FMEMOPEN).o
	$(GCC) -o $(FMEMOPEN) obj/$(FMEMOPEN).o $(LDFLAGS)
$(FMEMOPEN).o:
	$(GCC) -o obj/$(FMEMOPEN).o -c $(FMEMOPEN).c $(CFLAGS)

$(FNMATCH): $(FNMATCH).o
	$(GCC) -o $(FNMATCH) obj/$(FNMATCH).o $(LDFLAGS)
$(FNMATCH).o:
	$(GCC) -o obj/$(FNMATCH).o -c $(FNMATCH).c $(CFLAGS)

$(FOPEN): $(FOPEN).o
	$(GCC) -o $(FOPEN) obj/$(FOPEN).o $(LDFLAGS)
$(FOPEN).o:
	$(GCC) -o obj/$(FOPEN).o -c $(FOPEN).c $(CFLAGS)

$(FPRINTF): $(FPRINTF).o
	$(GCC) -o $(FPRINTF) obj/$(FPRINTF).o $(LDFLAGS)
$(FPRINTF).o:
	$(GCC) -o obj/$(FPRINTF).o -c $(FPRINTF).c $(CFLAGS)

$(FPUTC): $(FPUTC).o
	$(GCC) -o $(FPUTC) obj/$(FPUTC).o $(LDFLAGS)
$(FPUTC).o:
	$(GCC) -o obj/$(FPUTC).o -c $(FPUTC).c $(CFLAGS)

$(FPUTS): $(FPUTS).o
	$(GCC) -o $(FPUTS) obj/$(FPUTS).o $(LDFLAGS)
$(FPUTS).o:
	$(GCC) -o obj/$(FPUTS).o -c $(FPUTS).c $(CFLAGS)

$(FREAD): $(FREAD).o
	$(GCC) -o $(FREAD) obj/$(FREAD).o $(LDFLAGS)
$(FREAD).o:
	$(GCC) -o obj/$(FREAD).o -c $(FREAD).c $(CFLAGS)

$(FREOPEN): $(FREOPEN).o
	$(GCC) -o $(FREOPEN) obj/$(FREOPEN).o $(LDFLAGS)
$(FREOPEN).o:
	$(GCC) -o obj/$(FREOPEN).o -c $(FREOPEN).c $(CFLAGS)

$(FSEEK): $(FSEEK).o
	$(GCC) -o $(FSEEK) obj/$(FSEEK).o $(LDFLAGS)
$(FSEEK).o:
	$(GCC) -o obj/$(FSEEK).o -c $(FSEEK).c $(CFLAGS)

$(FSETPOS): $(FSETPOS).o
	$(GCC) -o $(FSETPOS) obj/$(FSETPOS).o $(LDFLAGS)
$(FSETPOS).o:
	$(GCC) -o obj/$(FSETPOS).o -c $(FSETPOS).c $(CFLAGS)

$(FSTAT): $(FSTAT).o
	$(GCC) -o $(FSTAT) obj/$(FSTAT).o $(LDFLAGS)
$(FSTAT).o:
	$(GCC) -o obj/$(FSTAT).o -c $(FSTAT).c $(CFLAGS)

$(FSYNC): $(FSYNC).o
	$(GCC) -o $(FSYNC) obj/$(FSYNC).o $(LDFLAGS)
$(FSYNC).o:
	$(GCC) -o obj/$(FSYNC).o -c $(FSYNC).c $(CFLAGS)

$(FTELL): $(FTELL).o
	$(GCC) -o $(FTELL) obj/$(FTELL).o $(LDFLAGS)
$(FTELL).o:
	$(GCC) -o obj/$(FTELL).o -c $(FTELL).c $(CFLAGS)

$(FTRUNCATE): $(FTRUNCATE).o
	$(GCC) -o $(FTRUNCATE) obj/$(FTRUNCATE).o $(LDFLAGS)
$(FTRUNCATE).o:
	$(GCC) -o obj/$(FTRUNCATE).o -c $(FTRUNCATE).c $(CFLAGS)

$(FUTIMES): $(FUTIMES).o
	$(GCC) -o $(FUTIMES) obj/$(FUTIMES).o $(LDFLAGS)
$(FUTIMES).o:
	$(GCC) -o obj/$(FUTIMES).o -c $(FUTIMES).c $(CFLAGS)

$(FWRITE): $(FWRITE).o
	$(GCC) -o $(FWRITE) obj/$(FWRITE).o $(LDFLAGS)
$(FWRITE).o:
	$(GCC) -o obj/$(FWRITE).o -c $(FWRITE).c $(CFLAGS)

$(GETC): $(GETC).o
	$(GCC) -o $(GETC) obj/$(GETC).o $(LDFLAGS)
$(GETC).o:
	$(GCC) -o obj/$(GETC).o -c $(GETC).c $(CFLAGS)

$(GETDELIM): $(GETDELIM).o
	$(GCC) -o $(GETDELIM) obj/$(GETDELIM).o $(LDFLAGS)
$(GETDELIM).o:
	$(GCC) -o obj/$(GETDELIM).o -c $(GETDELIM).c $(CFLAGS)

$(GETDTABLESIZE): $(GETDTABLESIZE).o
	$(GCC) -o $(GETDTABLESIZE) obj/$(GETDTABLESIZE).o $(LDFLAGS)
$(GETDTABLESIZE).o:
	$(GCC) -o obj/$(GETDTABLESIZE).o -c $(GETDTABLESIZE).c $(CFLAGS)

$(GETLINE): $(GETLINE).o
	$(GCC) -o $(GETLINE) obj/$(GETLINE).o $(LDFLAGS)
$(GETLINE).o:
	$(GCC) -o obj/$(GETLINE).o -c $(GETLINE).c $(CFLAGS)

$(GETW): $(GETW).o
	$(GCC) -o $(GETW) obj/$(GETW).o $(LDFLAGS)
$(GETW).o:
	$(GCC) -o obj/$(GETW).o -c $(GETW).c $(CFLAGS)

$(LCHMOD): $(LCHMOD).o
	$(GCC) -o $(LCHMOD) obj/$(LCHMOD).o $(LDFLAGS)
$(LCHMOD).o:
	$(GCC) -o obj/$(LCHMOD).o -c $(LCHMOD).c $(CFLAGS)

$(LCHOWN): $(LCHOWN).o
	$(GCC) -o $(LCHOWN) obj/$(LCHOWN).o $(LDFLAGS)
$(LCHOWN).o:
	$(GCC) -o obj/$(LCHOWN).o -c $(LCHOWN).c $(CFLAGS)

$(LINK): $(LINK).o
	$(GCC) -o $(LINK) obj/$(LINK).o $(LDFLAGS)
$(LINK).o:
	$(GCC) -o obj/$(LINK).o -c $(LINK).c $(CFLAGS)

$(LOCKF): $(LOCKF).o
	$(GCC) -o $(LOCKF) obj/$(LOCKF).o $(LDFLAGS)
$(LOCKF).o:
	$(GCC) -o obj/$(LOCKF).o -c $(LOCKF).c $(CFLAGS)

$(LSEEK): $(LSEEK).o
	$(GCC) -o $(LSEEK) obj/$(LSEEK).o $(LDFLAGS)
$(LSEEK).o:
	$(GCC) -o obj/$(LSEEK).o -c $(LSEEK).c $(CFLAGS)

$(LSTAT): $(LSTAT).o
	$(GCC) -o $(LSTAT) obj/$(LSTAT).o $(LDFLAGS)
$(LSTAT).o:
	$(GCC) -o obj/$(LSTAT).o -c $(LSTAT).c $(CFLAGS)

$(LUTIMES): $(LUTIMES).o
	$(GCC) -o $(LUTIMES) obj/$(LUTIMES).o $(LDFLAGS)
$(LUTIMES).o:
	$(GCC) -o obj/$(LUTIMES).o -c $(LUTIMES).c $(CFLAGS)

$(MKDTEMP): $(MKDTEMP).o
	$(GCC) -o $(MKDTEMP) obj/$(MKDTEMP).o $(LDFLAGS)
$(MKDTEMP).o:
	$(GCC) -o obj/$(MKDTEMP).o -c $(MKDTEMP).c $(CFLAGS)

$(MKFIFO): $(MKFIFO).o
	$(GCC) -o $(MKFIFO) obj/$(MKFIFO).o $(LDFLAGS)
$(MKFIFO).o:
	$(GCC) -o obj/$(MKFIFO).o -c $(MKFIFO).c $(CFLAGS)

$(MKNOD): $(MKNOD).o
	$(GCC) -o $(MKNOD) obj/$(MKNOD).o $(LDFLAGS)
$(MKNOD).o:
	$(GCC) -o obj/$(MKNOD).o -c $(MKNOD).c $(CFLAGS)

$(MKSTEMP): $(MKSTEMP).o
	$(GCC) -o $(MKSTEMP) obj/$(MKSTEMP).o $(LDFLAGS)
$(MKSTEMP).o:
	$(GCC) -o obj/$(MKSTEMP).o -c $(MKSTEMP).c $(CFLAGS)

$(MKTEMP): $(MKTEMP).o
	$(GCC) -o $(MKTEMP) obj/$(MKTEMP).o $(LDFLAGS)
$(MKTEMP).o:
	$(GCC) -o obj/$(MKTEMP).o -c $(MKTEMP).c $(CFLAGS)

$(OPEN): $(OPEN).o
	$(GCC) -o $(OPEN) obj/$(OPEN).o $(LDFLAGS)
$(OPEN).o:
	$(GCC) -o obj/$(OPEN).o -c $(OPEN).c $(CFLAGS)

$(OPEN_MEMSTREAM): $(OPEN_MEMSTREAM).o
	$(GCC) -o $(OPEN_MEMSTREAM) obj/$(OPEN_MEMSTREAM).o $(LDFLAGS)
$(OPEN_MEMSTREAM).o:
	$(GCC) -o obj/$(OPEN_MEMSTREAM).o -c $(OPEN_MEMSTREAM).c $(CFLAGS)

$(PREAD): $(PREAD).o
	$(GCC) -o $(PREAD) obj/$(PREAD).o $(LDFLAGS)
$(PREAD).o:
	$(GCC) -o obj/$(PREAD).o -c $(PREAD).c $(CFLAGS)

$(PUTC): $(PUTC).o
	$(GCC) -o $(PUTC) obj/$(PUTC).o $(LDFLAGS)
$(PUTC).o:
	$(GCC) -o obj/$(PUTC).o -c $(PUTC).c $(CFLAGS)

$(PUTW): $(PUTW).o
	$(GCC) -o $(PUTW) obj/$(PUTW).o $(LDFLAGS)
$(PUTW).o:
	$(GCC) -o obj/$(PUTW).o -c $(PUTW).c $(CFLAGS)

$(PWRITE): $(PWRITE).o
	$(GCC) -o $(PWRITE) obj/$(PWRITE).o $(LDFLAGS)
$(PWRITE).o:
	$(GCC) -o obj/$(PWRITE).o -c $(PWRITE).c $(CFLAGS)

$(READ): $(READ).o
	$(GCC) -o $(READ) obj/$(READ).o $(LDFLAGS)
$(READ).o:
	$(GCC) -o obj/$(READ).o -c $(READ).c $(CFLAGS)

$(READ_LINES): $(READ_LINES).o
	$(GCC) -o $(READ_LINES) obj/$(READ_LINES).o $(LDFLAGS)
$(READ_LINES).o:
	$(GCC) -o obj/$(READ_LINES).o -c $(READ_LINES).c $(CFLAGS)

$(READLINK): $(READLINK).o
	$(GCC) -o $(READLINK) obj/$(READLINK).o $(LDFLAGS)
$(READLINK).o:
	$(GCC) -o obj/$(READLINK).o -c $(READLINK).c $(CFLAGS)

$(REALPATH): $(REALPATH).o
	$(GCC) -o $(REALPATH) obj/$(REALPATH).o $(LDFLAGS)
$(REALPATH).o:
	$(GCC) -o obj/$(REALPATH).o -c $(REALPATH).c $(CFLAGS)

$(REMOVE): $(REMOVE).o
	$(GCC) -o $(REMOVE) obj/$(REMOVE).o $(LDFLAGS)
$(REMOVE).o:
	$(GCC) -o obj/$(REMOVE).o -c $(REMOVE).c $(CFLAGS)

$(RENAME): $(RENAME).o
	$(GCC) -o $(RENAME) obj/$(RENAME).o $(LDFLAGS)
$(RENAME).o:
	$(GCC) -o obj/$(RENAME).o -c $(RENAME).c $(CFLAGS)

$(REWIND): $(REWIND).o
	$(GCC) -o $(REWIND) obj/$(REWIND).o $(LDFLAGS)
$(REWIND).o:
	$(GCC) -o obj/$(REWIND).o -c $(REWIND).c $(CFLAGS)

$(SETBUF): $(SETBUF).o
	$(GCC) -o $(SETBUF) obj/$(SETBUF).o $(LDFLAGS)
$(SETBUF).o:
	$(GCC) -o obj/$(SETBUF).o -c $(SETBUF).c $(CFLAGS)

$(SETBUFFER): $(SETBUFFER).o
	$(GCC) -o $(SETBUFFER) obj/$(SETBUFFER).o $(LDFLAGS)
$(SETBUFFER).o:
	$(GCC) -o obj/$(SETBUFFER).o -c $(SETBUFFER).c $(CFLAGS)

$(SETLINEBUF): $(SETLINEBUF).o
	$(GCC) -o $(SETLINEBUF) obj/$(SETLINEBUF).o $(LDFLAGS)
$(SETLINEBUF).o:
	$(GCC) -o obj/$(SETLINEBUF).o -c $(SETLINEBUF).c $(CFLAGS)

$(SETVBUF): $(SETVBUF).o
	$(GCC) -o $(SETVBUF) obj/$(SETVBUF).o $(LDFLAGS)
$(SETVBUF).o:
	$(GCC) -o obj/$(SETVBUF).o -c $(SETVBUF).c $(CFLAGS)

$(STAT): $(STAT).o
	$(GCC) -o $(STAT) obj/$(STAT).o $(LDFLAGS)
$(STAT).o:
	$(GCC) -o obj/$(STAT).o -c $(STAT).c $(CFLAGS)

$(STATFS): $(STATFS).o
	$(GCC) -o $(STATFS) obj/$(STATFS).o $(LDFLAGS)
$(STATFS).o:
	$(GCC) -o obj/$(STATFS).o -c $(STATFS).c $(CFLAGS)

$(STATVFS): $(STATVFS).o
	$(GCC) -o $(STATVFS) obj/$(STATVFS).o $(LDFLAGS)
$(STATVFS).o:
	$(GCC) -o obj/$(STATVFS).o -c $(STATVFS).c $(CFLAGS)

$(STDERR): $(STDERR).o
	$(GCC) -o $(STDERR) obj/$(STDERR).o $(LDFLAGS)
$(STDERR).o:
	$(GCC) -o obj/$(STDERR).o -c $(STDERR).c $(CFLAGS)

$(STDIN): $(STDIN).o
	$(GCC) -o $(STDIN) obj/$(STDIN).o $(LDFLAGS)
$(STDIN).o:
	$(GCC) -o obj/$(STDIN).o -c $(STDIN).c $(CFLAGS)

$(STDOUT): $(STDOUT).o
	$(GCC) -o $(STDOUT) obj/$(STDOUT).o $(LDFLAGS)
$(STDOUT).o:
	$(GCC) -o obj/$(STDOUT).o -c $(STDOUT).c $(CFLAGS)

$(SYMLINK): $(SYMLINK).o
	$(GCC) -o $(SYMLINK) obj/$(SYMLINK).o $(LDFLAGS)
$(SYMLINK).o:
	$(GCC) -o obj/$(SYMLINK).o -c $(SYMLINK).c $(CFLAGS)

$(SYNC): $(SYNC).o
	$(GCC) -o $(SYNC) obj/$(SYNC).o $(LDFLAGS)
$(SYNC).o:
	$(GCC) -o obj/$(SYNC).o -c $(SYNC).c $(CFLAGS)

$(TEMPNAM): $(TEMPNAM).o
	$(GCC) -o $(TEMPNAM) obj/$(TEMPNAM).o $(LDFLAGS)
$(TEMPNAM).o:
	$(GCC) -o obj/$(TEMPNAM).o -c $(TEMPNAM).c $(CFLAGS)

$(TMPFILE): $(TMPFILE).o
	$(GCC) -o $(TMPFILE) obj/$(TMPFILE).o $(LDFLAGS)
$(TMPFILE).o:
	$(GCC) -o obj/$(TMPFILE).o -c $(TMPFILE).c $(CFLAGS)

$(TMPNAM): $(TMPNAM).o
	$(GCC) -o $(TMPNAM) obj/$(TMPNAM).o $(LDFLAGS)
$(TMPNAM).o:
	$(GCC) -o obj/$(TMPNAM).o -c $(TMPNAM).c $(CFLAGS)

$(TRUNCATE): $(TRUNCATE).o
	$(GCC) -o $(TRUNCATE) obj/$(TRUNCATE).o $(LDFLAGS)
$(TRUNCATE).o:
	$(GCC) -o obj/$(TRUNCATE).o -c $(TRUNCATE).c $(CFLAGS)

$(UNGETC): $(UNGETC).o
	$(GCC) -o $(UNGETC) obj/$(UNGETC).o $(LDFLAGS)
$(UNGETC).o:
	$(GCC) -o obj/$(UNGETC).o -c $(UNGETC).c $(CFLAGS)

$(UNLINK): $(UNLINK).o
	$(GCC) -o $(UNLINK) obj/$(UNLINK).o $(LDFLAGS)
$(UNLINK).o:
	$(GCC) -o obj/$(UNLINK).o -c $(UNLINK).c $(CFLAGS)

$(UTIMES): $(UTIMES).o
	$(GCC) -o $(UTIMES) obj/$(UTIMES).o $(LDFLAGS)
$(UTIMES).o:
	$(GCC) -o obj/$(UTIMES).o -c $(UTIMES).c $(CFLAGS)

$(VFPRINTF): $(VFPRINTF).o
	$(GCC) -o $(VFPRINTF) obj/$(VFPRINTF).o $(LDFLAGS)
$(VFPRINTF).o:
	$(GCC) -o obj/$(VFPRINTF).o -c $(VFPRINTF).c $(CFLAGS)

$(WRITE): $(WRITE).o
	$(GCC) -o $(WRITE) obj/$(WRITE).o $(LDFLAGS)
$(WRITE).o:
	$(GCC) -o obj/$(WRITE).o -c $(WRITE).c $(CFLAGS)



#top Makefile.obsd


SELECT ALL
# Project: Project
# Makefile created

GCC         = gcc
INCS        = -DHAVE_SYS_PARAM_H=1 -DHAVE_SYS_MOUNT_H=1 -DHAVE_FCNTL=1 -DHAVE_FLOCK=1 -DHAVE_FNMATCH=1 -DHAVE_FSYNC=1 -DHAVE_FUTIMES=1 -DHAVE_LOCKF=1 -DHAVE_PREAD=1 -DHAVE_PWRITE=1 -DHAVE_SETBUFFER=1 -DHAVE_SETLINEBUF=1 -DHAVE_UTIMES=1
CFLAGS      = $(INCS) -W -O2 -Wall -pedantic -Wstrict-aliasing -Wno-long-long -D_FILE_OFFSET_BITS=64 -D_LINUX -D_REENTRANT
CFLAGS      = $(INCS) -W -O2 -Wall -pedantic -Wstrict-aliasing -Wno-long-long
LIBS        =
LIBDIRS     =
LDFLAGS     = $(LIBDIRS) $(LIBS)
RM          = rm -f
MKDCMD      = mkdir -p

ACCESS      = access
CHGRP       = chgrp
CHMOD       = chmod
CHOWN       = chown
CLOSE       = close
DUP2        = dup2
DUP         = dup
FCHMOD      = fchmod
FCHOWN      = fchown
FCLOSE      = fclose
FCNTL       = fcntl
FDATASYNC   = fdatasync
FDOPEN      = fdopen
FEOF        = feof
FERROR      = ferror
FFLUSH      = fflush
FGETC       = fgetc
FGETPOS     = fgetpos
FGETS       = fgets
FILENO      = fileno
FLOCK       = flock
FMEMOPEN    = fmemopen
FNMATCH     = fnmatch
FOPEN       = fopen
FPRINTF     = fprintf
FPUTC       = fputc
FPUTS       = fputs
FREAD       = fread
FREOPEN     = freopen
FSEEK       = fseek
FSETPOS     = fsetpos
FSTAT       = fstat
FSYNC       = fsync
FTELL       = ftell
FTRUNCATE   = ftruncate
FUTIMES     = futimes
FWRITE      = fwrite
GETC        = getc
GETDELIM    = getdelim
GETDTABLESIZE= getdtablesize
GETLINE     = getline
GETW        = getw
LCHMOD      = lchmod
LCHOWN      = lchown
LINK        = link
LOCKF       = lockf
LSEEK       = lseek
LSTAT       = lstat
LUTIMES     = lutimes
MKDTEMP     = mkdtemp
MKFIFO      = mkfifo
MKNOD       = mknod
MKSTEMP     = mkstemp
MKTEMP      = mktemp
OPEN        = open
OPEN_MEMSTREAM= open_memstream
PREAD       = pread
PUTC        = putc
PUTW        = putw
PWRITE      = pwrite
READ        = read
READ_LINES  = read-lines
READLINK    = readlink
REALPATH    = realpath
REMOVE      = remove
RENAME      = rename
REWIND      = rewind
SETBUF      = setbuf
SETBUFFER   = setbuffer
SETLINEBUF  = setlinebuf
SETVBUF     = setvbuf
STAT        = stat
STATFS      = statfs
STATVFS     = statvfs
STDERR      = stderr
STDIN       = stdin
STDOUT      = stdout
SYMLINK     = symlink
SYNC        = sync
TEMPNAM     = tempnam
TMPFILE     = tmpfile
TMPNAM      = tmpnam
TRUNCATE    = truncate
UNGETC      = ungetc
UNLINK      = unlink
UTIMES      = utimes
VFPRINTF    = vfprintf
WRITE       = write



all: objdir make

objdir:
	$(MKDCMD) obj/

clean: objdir
	$(RM) obj/*.o *.o *~

#make: $(ACCESS)
#make: $(CHGRP)
#make: $(CHMOD)
#make: $(CHOWN)
#make: $(CLOSE)
#make: $(DUP2)
#make: $(DUP)
#make: $(FCHMOD)
#make: $(FCHOWN)
#make: $(FCLOSE)
#make: $(FCNTL)
#make: $(FDATASYNC)
#make: $(FDOPEN)
#make: $(FEOF)
#make: $(FERROR)
#make: $(FFLUSH)
#make: $(FGETC)
#make: $(FGETPOS)
#make: $(FGETS)
#make: $(FILENO)
#make: $(FLOCK)
#make: $(FMEMOPEN)
#make: $(FNMATCH)
#make: $(FOPEN)
#make: $(FPRINTF)
#make: $(FPUTC)
#make: $(FPUTS)
#make: $(FREAD)
#make: $(FREOPEN)
#make: $(FSEEK)
#make: $(FSETPOS)
#make: $(FSTAT)
#make: $(FSYNC)
#make: $(FTELL)
#make: $(FTRUNCATE)
#make: $(FUTIMES)
#make: $(FWRITE)
#make: $(GETC)
#make: $(GETDELIM)
#make: $(GETDTABLESIZE)
#make: $(GETLINE)
#make: $(GETW)
#make: $(LCHMOD)
#make: $(LCHOWN)
#make: $(LINK)
#make: $(LOCKF)
#make: $(LSEEK)
#make: $(LSTAT)
#make: $(LUTIMES)
#make: $(MKDTEMP)
#make: $(MKFIFO)
#make: $(MKNOD)
#make: $(MKSTEMP)
#make: $(MKTEMP)
#make: $(OPEN)
#make: $(OPEN_MEMSTREAM)
#make: $(PREAD)
#make: $(PUTC)
#make: $(PUTW)
#make: $(PWRITE)
#make: $(READ)
#make: $(READ_LINES)
#make: $(READLINK)
#make: $(REALPATH)
#make: $(REMOVE)
#make: $(RENAME)
#make: $(REWIND)
#make: $(SETBUF)
#make: $(SETBUFFER)
#make: $(SETLINEBUF)
#make: $(SETVBUF)
#make: $(STAT)
#make: $(STATFS)
#make: $(STATVFS)
#make: $(STDERR)
#make: $(STDIN)
#make: $(STDOUT)
#make: $(SYMLINK)
#make: $(SYNC)
#make: $(TEMPNAM)
#make: $(TMPFILE)
#make: $(TMPNAM)
#make: $(TRUNCATE)
#make: $(UNGETC)
#make: $(UNLINK)
#make: $(UTIMES)
#make: $(VFPRINTF)
#make: $(WRITE)
make: $(ACCESS) $(CHGRP) $(CHMOD) $(CHOWN) $(CLOSE) $(DUP2) $(DUP) $(FCHMOD) $(FCHOWN) $(FCLOSE) $(FCNTL) $(FDATASYNC) $(FDOPEN) $(FEOF) $(FERROR) $(FFLUSH) $(FGETC) $(FGETPOS) $(FGETS) $(FILENO) $(FLOCK) $(FMEMOPEN) $(FNMATCH) $(FOPEN) $(FPRINTF) $(FPUTC) $(FPUTS) $(FREAD) $(FREOPEN) $(FSEEK) $(FSETPOS) $(FSTAT) $(FSYNC) $(FTELL) $(FTRUNCATE) $(FUTIMES) $(FWRITE) $(GETC) $(GETDELIM) $(GETDTABLESIZE) $(GETLINE) $(GETW) $(LCHMOD) $(LCHOWN) $(LINK) $(LOCKF) $(LSEEK) $(LSTAT) $(LUTIMES) $(MKDTEMP) $(MKFIFO) $(MKNOD) $(MKSTEMP) $(MKTEMP) $(OPEN) $(OPEN_MEMSTREAM) $(PREAD) $(PUTC) $(PUTW) $(PWRITE) $(READ) $(READ_LINES) $(READLINK) $(REALPATH) $(REMOVE) $(RENAME) $(REWIND) $(SETBUF) $(SETBUFFER) $(SETLINEBUF) $(SETVBUF) $(STAT) $(STATFS) $(STATVFS) $(STDERR) $(STDIN) $(STDOUT) $(SYMLINK) $(SYNC) $(TEMPNAM) $(TMPFILE) $(TMPNAM) $(TRUNCATE) $(UNGETC) $(UNLINK) $(UTIMES) $(VFPRINTF) $(WRITE)



$(ACCESS): $(ACCESS).o
	$(GCC) -o $(ACCESS) obj/$(ACCESS).o $(LDFLAGS)
$(ACCESS).o:
	$(GCC) -o obj/$(ACCESS).o -c $(ACCESS).c $(CFLAGS)

$(CHGRP): $(CHGRP).o
	$(GCC) -o $(CHGRP) obj/$(CHGRP).o $(LDFLAGS)
$(CHGRP).o:
	$(GCC) -o obj/$(CHGRP).o -c $(CHGRP).c $(CFLAGS)

$(CHMOD): $(CHMOD).o
	$(GCC) -o $(CHMOD) obj/$(CHMOD).o $(LDFLAGS)
$(CHMOD).o:
	$(GCC) -o obj/$(CHMOD).o -c $(CHMOD).c $(CFLAGS)

$(CHOWN): $(CHOWN).o
	$(GCC) -o $(CHOWN) obj/$(CHOWN).o $(LDFLAGS)
$(CHOWN).o:
	$(GCC) -o obj/$(CHOWN).o -c $(CHOWN).c $(CFLAGS)

$(CLOSE): $(CLOSE).o
	$(GCC) -o $(CLOSE) obj/$(CLOSE).o $(LDFLAGS)
$(CLOSE).o:
	$(GCC) -o obj/$(CLOSE).o -c $(CLOSE).c $(CFLAGS)

$(DUP2): $(DUP2).o
	$(GCC) -o $(DUP2) obj/$(DUP2).o $(LDFLAGS)
$(DUP2).o:
	$(GCC) -o obj/$(DUP2).o -c $(DUP2).c $(CFLAGS)

$(DUP): $(DUP).o
	$(GCC) -o $(DUP) obj/$(DUP).o $(LDFLAGS)
$(DUP).o:
	$(GCC) -o obj/$(DUP).o -c $(DUP).c $(CFLAGS)

$(FCHMOD): $(FCHMOD).o
	$(GCC) -o $(FCHMOD) obj/$(FCHMOD).o $(LDFLAGS)
$(FCHMOD).o:
	$(GCC) -o obj/$(FCHMOD).o -c $(FCHMOD).c $(CFLAGS)

$(FCHOWN): $(FCHOWN).o
	$(GCC) -o $(FCHOWN) obj/$(FCHOWN).o $(LDFLAGS)
$(FCHOWN).o:
	$(GCC) -o obj/$(FCHOWN).o -c $(FCHOWN).c $(CFLAGS)

$(FCLOSE): $(FCLOSE).o
	$(GCC) -o $(FCLOSE) obj/$(FCLOSE).o $(LDFLAGS)
$(FCLOSE).o:
	$(GCC) -o obj/$(FCLOSE).o -c $(FCLOSE).c $(CFLAGS)

$(FCNTL): $(FCNTL).o
	$(GCC) -o $(FCNTL) obj/$(FCNTL).o $(LDFLAGS)
$(FCNTL).o:
	$(GCC) -o obj/$(FCNTL).o -c $(FCNTL).c $(CFLAGS)

$(FDATASYNC): $(FDATASYNC).o
	$(GCC) -o $(FDATASYNC) obj/$(FDATASYNC).o $(LDFLAGS)
$(FDATASYNC).o:
	$(GCC) -o obj/$(FDATASYNC).o -c $(FDATASYNC).c $(CFLAGS)

$(FDOPEN): $(FDOPEN).o
	$(GCC) -o $(FDOPEN) obj/$(FDOPEN).o $(LDFLAGS)
$(FDOPEN).o:
	$(GCC) -o obj/$(FDOPEN).o -c $(FDOPEN).c $(CFLAGS)

$(FEOF): $(FEOF).o
	$(GCC) -o $(FEOF) obj/$(FEOF).o $(LDFLAGS)
$(FEOF).o:
	$(GCC) -o obj/$(FEOF).o -c $(FEOF).c $(CFLAGS)

$(FERROR): $(FERROR).o
	$(GCC) -o $(FERROR) obj/$(FERROR).o $(LDFLAGS)
$(FERROR).o:
	$(GCC) -o obj/$(FERROR).o -c $(FERROR).c $(CFLAGS)

$(FFLUSH): $(FFLUSH).o
	$(GCC) -o $(FFLUSH) obj/$(FFLUSH).o $(LDFLAGS)
$(FFLUSH).o:
	$(GCC) -o obj/$(FFLUSH).o -c $(FFLUSH).c $(CFLAGS)

$(FGETC): $(FGETC).o
	$(GCC) -o $(FGETC) obj/$(FGETC).o $(LDFLAGS)
$(FGETC).o:
	$(GCC) -o obj/$(FGETC).o -c $(FGETC).c $(CFLAGS)

$(FGETPOS): $(FGETPOS).o
	$(GCC) -o $(FGETPOS) obj/$(FGETPOS).o $(LDFLAGS)
$(FGETPOS).o:
	$(GCC) -o obj/$(FGETPOS).o -c $(FGETPOS).c $(CFLAGS)

$(FGETS): $(FGETS).o
	$(GCC) -o $(FGETS) obj/$(FGETS).o $(LDFLAGS)
$(FGETS).o:
	$(GCC) -o obj/$(FGETS).o -c $(FGETS).c $(CFLAGS)

$(FILENO): $(FILENO).o
	$(GCC) -o $(FILENO) obj/$(FILENO).o $(LDFLAGS)
$(FILENO).o:
	$(GCC) -o obj/$(FILENO).o -c $(FILENO).c $(CFLAGS)

$(FLOCK): $(FLOCK).o
	$(GCC) -o $(FLOCK) obj/$(FLOCK).o $(LDFLAGS)
$(FLOCK).o:
	$(GCC) -o obj/$(FLOCK).o -c $(FLOCK).c $(CFLAGS)

$(FMEMOPEN): $(FMEMOPEN).o
	$(GCC) -o $(FMEMOPEN) obj/$(FMEMOPEN).o $(LDFLAGS)
$(FMEMOPEN).o:
	$(GCC) -o obj/$(FMEMOPEN).o -c $(FMEMOPEN).c $(CFLAGS)

$(FNMATCH): $(FNMATCH).o
	$(GCC) -o $(FNMATCH) obj/$(FNMATCH).o $(LDFLAGS)
$(FNMATCH).o:
	$(GCC) -o obj/$(FNMATCH).o -c $(FNMATCH).c $(CFLAGS)

$(FOPEN): $(FOPEN).o
	$(GCC) -o $(FOPEN) obj/$(FOPEN).o $(LDFLAGS)
$(FOPEN).o:
	$(GCC) -o obj/$(FOPEN).o -c $(FOPEN).c $(CFLAGS)

$(FPRINTF): $(FPRINTF).o
	$(GCC) -o $(FPRINTF) obj/$(FPRINTF).o $(LDFLAGS)
$(FPRINTF).o:
	$(GCC) -o obj/$(FPRINTF).o -c $(FPRINTF).c $(CFLAGS)

$(FPUTC): $(FPUTC).o
	$(GCC) -o $(FPUTC) obj/$(FPUTC).o $(LDFLAGS)
$(FPUTC).o:
	$(GCC) -o obj/$(FPUTC).o -c $(FPUTC).c $(CFLAGS)

$(FPUTS): $(FPUTS).o
	$(GCC) -o $(FPUTS) obj/$(FPUTS).o $(LDFLAGS)
$(FPUTS).o:
	$(GCC) -o obj/$(FPUTS).o -c $(FPUTS).c $(CFLAGS)

$(FREAD): $(FREAD).o
	$(GCC) -o $(FREAD) obj/$(FREAD).o $(LDFLAGS)
$(FREAD).o:
	$(GCC) -o obj/$(FREAD).o -c $(FREAD).c $(CFLAGS)

$(FREOPEN): $(FREOPEN).o
	$(GCC) -o $(FREOPEN) obj/$(FREOPEN).o $(LDFLAGS)
$(FREOPEN).o:
	$(GCC) -o obj/$(FREOPEN).o -c $(FREOPEN).c $(CFLAGS)

$(FSEEK): $(FSEEK).o
	$(GCC) -o $(FSEEK) obj/$(FSEEK).o $(LDFLAGS)
$(FSEEK).o:
	$(GCC) -o obj/$(FSEEK).o -c $(FSEEK).c $(CFLAGS)

$(FSETPOS): $(FSETPOS).o
	$(GCC) -o $(FSETPOS) obj/$(FSETPOS).o $(LDFLAGS)
$(FSETPOS).o:
	$(GCC) -o obj/$(FSETPOS).o -c $(FSETPOS).c $(CFLAGS)

$(FSTAT): $(FSTAT).o
	$(GCC) -o $(FSTAT) obj/$(FSTAT).o $(LDFLAGS)
$(FSTAT).o:
	$(GCC) -o obj/$(FSTAT).o -c $(FSTAT).c $(CFLAGS)

$(FSYNC): $(FSYNC).o
	$(GCC) -o $(FSYNC) obj/$(FSYNC).o $(LDFLAGS)
$(FSYNC).o:
	$(GCC) -o obj/$(FSYNC).o -c $(FSYNC).c $(CFLAGS)

$(FTELL): $(FTELL).o
	$(GCC) -o $(FTELL) obj/$(FTELL).o $(LDFLAGS)
$(FTELL).o:
	$(GCC) -o obj/$(FTELL).o -c $(FTELL).c $(CFLAGS)

$(FTRUNCATE): $(FTRUNCATE).o
	$(GCC) -o $(FTRUNCATE) obj/$(FTRUNCATE).o $(LDFLAGS)
$(FTRUNCATE).o:
	$(GCC) -o obj/$(FTRUNCATE).o -c $(FTRUNCATE).c $(CFLAGS)

$(FUTIMES): $(FUTIMES).o
	$(GCC) -o $(FUTIMES) obj/$(FUTIMES).o $(LDFLAGS)
$(FUTIMES).o:
	$(GCC) -o obj/$(FUTIMES).o -c $(FUTIMES).c $(CFLAGS)

$(FWRITE): $(FWRITE).o
	$(GCC) -o $(FWRITE) obj/$(FWRITE).o $(LDFLAGS)
$(FWRITE).o:
	$(GCC) -o obj/$(FWRITE).o -c $(FWRITE).c $(CFLAGS)

$(GETC): $(GETC).o
	$(GCC) -o $(GETC) obj/$(GETC).o $(LDFLAGS)
$(GETC).o:
	$(GCC) -o obj/$(GETC).o -c $(GETC).c $(CFLAGS)

$(GETDELIM): $(GETDELIM).o
	$(GCC) -o $(GETDELIM) obj/$(GETDELIM).o $(LDFLAGS)
$(GETDELIM).o:
	$(GCC) -o obj/$(GETDELIM).o -c $(GETDELIM).c $(CFLAGS)

$(GETDTABLESIZE): $(GETDTABLESIZE).o
	$(GCC) -o $(GETDTABLESIZE) obj/$(GETDTABLESIZE).o $(LDFLAGS)
$(GETDTABLESIZE).o:
	$(GCC) -o obj/$(GETDTABLESIZE).o -c $(GETDTABLESIZE).c $(CFLAGS)

$(GETLINE): $(GETLINE).o
	$(GCC) -o $(GETLINE) obj/$(GETLINE).o $(LDFLAGS)
$(GETLINE).o:
	$(GCC) -o obj/$(GETLINE).o -c $(GETLINE).c $(CFLAGS)

$(GETW): $(GETW).o
	$(GCC) -o $(GETW) obj/$(GETW).o $(LDFLAGS)
$(GETW).o:
	$(GCC) -o obj/$(GETW).o -c $(GETW).c $(CFLAGS)

$(LCHMOD): $(LCHMOD).o
	$(GCC) -o $(LCHMOD) obj/$(LCHMOD).o $(LDFLAGS)
$(LCHMOD).o:
	$(GCC) -o obj/$(LCHMOD).o -c $(LCHMOD).c $(CFLAGS)

$(LCHOWN): $(LCHOWN).o
	$(GCC) -o $(LCHOWN) obj/$(LCHOWN).o $(LDFLAGS)
$(LCHOWN).o:
	$(GCC) -o obj/$(LCHOWN).o -c $(LCHOWN).c $(CFLAGS)

$(LINK): $(LINK).o
	$(GCC) -o $(LINK) obj/$(LINK).o $(LDFLAGS)
$(LINK).o:
	$(GCC) -o obj/$(LINK).o -c $(LINK).c $(CFLAGS)

$(LOCKF): $(LOCKF).o
	$(GCC) -o $(LOCKF) obj/$(LOCKF).o $(LDFLAGS)
$(LOCKF).o:
	$(GCC) -o obj/$(LOCKF).o -c $(LOCKF).c $(CFLAGS)

$(LSEEK): $(LSEEK).o
	$(GCC) -o $(LSEEK) obj/$(LSEEK).o $(LDFLAGS)
$(LSEEK).o:
	$(GCC) -o obj/$(LSEEK).o -c $(LSEEK).c $(CFLAGS)

$(LSTAT): $(LSTAT).o
	$(GCC) -o $(LSTAT) obj/$(LSTAT).o $(LDFLAGS)
$(LSTAT).o:
	$(GCC) -o obj/$(LSTAT).o -c $(LSTAT).c $(CFLAGS)

$(LUTIMES): $(LUTIMES).o
	$(GCC) -o $(LUTIMES) obj/$(LUTIMES).o $(LDFLAGS)
$(LUTIMES).o:
	$(GCC) -o obj/$(LUTIMES).o -c $(LUTIMES).c $(CFLAGS)

$(MKDTEMP): $(MKDTEMP).o
	$(GCC) -o $(MKDTEMP) obj/$(MKDTEMP).o $(LDFLAGS)
$(MKDTEMP).o:
	$(GCC) -o obj/$(MKDTEMP).o -c $(MKDTEMP).c $(CFLAGS)

$(MKFIFO): $(MKFIFO).o
	$(GCC) -o $(MKFIFO) obj/$(MKFIFO).o $(LDFLAGS)
$(MKFIFO).o:
	$(GCC) -o obj/$(MKFIFO).o -c $(MKFIFO).c $(CFLAGS)

$(MKNOD): $(MKNOD).o
	$(GCC) -o $(MKNOD) obj/$(MKNOD).o $(LDFLAGS)
$(MKNOD).o:
	$(GCC) -o obj/$(MKNOD).o -c $(MKNOD).c $(CFLAGS)

$(MKSTEMP): $(MKSTEMP).o
	$(GCC) -o $(MKSTEMP) obj/$(MKSTEMP).o $(LDFLAGS)
$(MKSTEMP).o:
	$(GCC) -o obj/$(MKSTEMP).o -c $(MKSTEMP).c $(CFLAGS)

$(MKTEMP): $(MKTEMP).o
	$(GCC) -o $(MKTEMP) obj/$(MKTEMP).o $(LDFLAGS)
$(MKTEMP).o:
	$(GCC) -o obj/$(MKTEMP).o -c $(MKTEMP).c $(CFLAGS)

$(OPEN): $(OPEN).o
	$(GCC) -o $(OPEN) obj/$(OPEN).o $(LDFLAGS)
$(OPEN).o:
	$(GCC) -o obj/$(OPEN).o -c $(OPEN).c $(CFLAGS)

$(OPEN_MEMSTREAM): $(OPEN_MEMSTREAM).o
	$(GCC) -o $(OPEN_MEMSTREAM) obj/$(OPEN_MEMSTREAM).o $(LDFLAGS)
$(OPEN_MEMSTREAM).o:
	$(GCC) -o obj/$(OPEN_MEMSTREAM).o -c $(OPEN_MEMSTREAM).c $(CFLAGS)

$(PREAD): $(PREAD).o
	$(GCC) -o $(PREAD) obj/$(PREAD).o $(LDFLAGS)
$(PREAD).o:
	$(GCC) -o obj/$(PREAD).o -c $(PREAD).c $(CFLAGS)

$(PUTC): $(PUTC).o
	$(GCC) -o $(PUTC) obj/$(PUTC).o $(LDFLAGS)
$(PUTC).o:
	$(GCC) -o obj/$(PUTC).o -c $(PUTC).c $(CFLAGS)

$(PUTW): $(PUTW).o
	$(GCC) -o $(PUTW) obj/$(PUTW).o $(LDFLAGS)
$(PUTW).o:
	$(GCC) -o obj/$(PUTW).o -c $(PUTW).c $(CFLAGS)

$(PWRITE): $(PWRITE).o
	$(GCC) -o $(PWRITE) obj/$(PWRITE).o $(LDFLAGS)
$(PWRITE).o:
	$(GCC) -o obj/$(PWRITE).o -c $(PWRITE).c $(CFLAGS)

$(READ): $(READ).o
	$(GCC) -o $(READ) obj/$(READ).o $(LDFLAGS)
$(READ).o:
	$(GCC) -o obj/$(READ).o -c $(READ).c $(CFLAGS)

$(READ_LINES): $(READ_LINES).o
	$(GCC) -o $(READ_LINES) obj/$(READ_LINES).o $(LDFLAGS)
$(READ_LINES).o:
	$(GCC) -o obj/$(READ_LINES).o -c $(READ_LINES).c $(CFLAGS)

$(READLINK): $(READLINK).o
	$(GCC) -o $(READLINK) obj/$(READLINK).o $(LDFLAGS)
$(READLINK).o:
	$(GCC) -o obj/$(READLINK).o -c $(READLINK).c $(CFLAGS)

$(REALPATH): $(REALPATH).o
	$(GCC) -o $(REALPATH) obj/$(REALPATH).o $(LDFLAGS)
$(REALPATH).o:
	$(GCC) -o obj/$(REALPATH).o -c $(REALPATH).c $(CFLAGS)

$(REMOVE): $(REMOVE).o
	$(GCC) -o $(REMOVE) obj/$(REMOVE).o $(LDFLAGS)
$(REMOVE).o:
	$(GCC) -o obj/$(REMOVE).o -c $(REMOVE).c $(CFLAGS)

$(RENAME): $(RENAME).o
	$(GCC) -o $(RENAME) obj/$(RENAME).o $(LDFLAGS)
$(RENAME).o:
	$(GCC) -o obj/$(RENAME).o -c $(RENAME).c $(CFLAGS)

$(REWIND): $(REWIND).o
	$(GCC) -o $(REWIND) obj/$(REWIND).o $(LDFLAGS)
$(REWIND).o:
	$(GCC) -o obj/$(REWIND).o -c $(REWIND).c $(CFLAGS)

$(SETBUF): $(SETBUF).o
	$(GCC) -o $(SETBUF) obj/$(SETBUF).o $(LDFLAGS)
$(SETBUF).o:
	$(GCC) -o obj/$(SETBUF).o -c $(SETBUF).c $(CFLAGS)

$(SETBUFFER): $(SETBUFFER).o
	$(GCC) -o $(SETBUFFER) obj/$(SETBUFFER).o $(LDFLAGS)
$(SETBUFFER).o:
	$(GCC) -o obj/$(SETBUFFER).o -c $(SETBUFFER).c $(CFLAGS)

$(SETLINEBUF): $(SETLINEBUF).o
	$(GCC) -o $(SETLINEBUF) obj/$(SETLINEBUF).o $(LDFLAGS)
$(SETLINEBUF).o:
	$(GCC) -o obj/$(SETLINEBUF).o -c $(SETLINEBUF).c $(CFLAGS)

$(SETVBUF): $(SETVBUF).o
	$(GCC) -o $(SETVBUF) obj/$(SETVBUF).o $(LDFLAGS)
$(SETVBUF).o:
	$(GCC) -o obj/$(SETVBUF).o -c $(SETVBUF).c $(CFLAGS)

$(STAT): $(STAT).o
	$(GCC) -o $(STAT) obj/$(STAT).o $(LDFLAGS)
$(STAT).o:
	$(GCC) -o obj/$(STAT).o -c $(STAT).c $(CFLAGS)

$(STATFS): $(STATFS).o
	$(GCC) -o $(STATFS) obj/$(STATFS).o $(LDFLAGS)
$(STATFS).o:
	$(GCC) -o obj/$(STATFS).o -c $(STATFS).c $(CFLAGS)

$(STATVFS): $(STATVFS).o
	$(GCC) -o $(STATVFS) obj/$(STATVFS).o $(LDFLAGS)
$(STATVFS).o:
	$(GCC) -o obj/$(STATVFS).o -c $(STATVFS).c $(CFLAGS)

$(STDERR): $(STDERR).o
	$(GCC) -o $(STDERR) obj/$(STDERR).o $(LDFLAGS)
$(STDERR).o:
	$(GCC) -o obj/$(STDERR).o -c $(STDERR).c $(CFLAGS)

$(STDIN): $(STDIN).o
	$(GCC) -o $(STDIN) obj/$(STDIN).o $(LDFLAGS)
$(STDIN).o:
	$(GCC) -o obj/$(STDIN).o -c $(STDIN).c $(CFLAGS)

$(STDOUT): $(STDOUT).o
	$(GCC) -o $(STDOUT) obj/$(STDOUT).o $(LDFLAGS)
$(STDOUT).o:
	$(GCC) -o obj/$(STDOUT).o -c $(STDOUT).c $(CFLAGS)

$(SYMLINK): $(SYMLINK).o
	$(GCC) -o $(SYMLINK) obj/$(SYMLINK).o $(LDFLAGS)
$(SYMLINK).o:
	$(GCC) -o obj/$(SYMLINK).o -c $(SYMLINK).c $(CFLAGS)

$(SYNC): $(SYNC).o
	$(GCC) -o $(SYNC) obj/$(SYNC).o $(LDFLAGS)
$(SYNC).o:
	$(GCC) -o obj/$(SYNC).o -c $(SYNC).c $(CFLAGS)

$(TEMPNAM): $(TEMPNAM).o
	$(GCC) -o $(TEMPNAM) obj/$(TEMPNAM).o $(LDFLAGS)
$(TEMPNAM).o:
	$(GCC) -o obj/$(TEMPNAM).o -c $(TEMPNAM).c $(CFLAGS)

$(TMPFILE): $(TMPFILE).o
	$(GCC) -o $(TMPFILE) obj/$(TMPFILE).o $(LDFLAGS)
$(TMPFILE).o:
	$(GCC) -o obj/$(TMPFILE).o -c $(TMPFILE).c $(CFLAGS)

$(TMPNAM): $(TMPNAM).o
	$(GCC) -o $(TMPNAM) obj/$(TMPNAM).o $(LDFLAGS)
$(TMPNAM).o:
	$(GCC) -o obj/$(TMPNAM).o -c $(TMPNAM).c $(CFLAGS)

$(TRUNCATE): $(TRUNCATE).o
	$(GCC) -o $(TRUNCATE) obj/$(TRUNCATE).o $(LDFLAGS)
$(TRUNCATE).o:
	$(GCC) -o obj/$(TRUNCATE).o -c $(TRUNCATE).c $(CFLAGS)

$(UNGETC): $(UNGETC).o
	$(GCC) -o $(UNGETC) obj/$(UNGETC).o $(LDFLAGS)
$(UNGETC).o:
	$(GCC) -o obj/$(UNGETC).o -c $(UNGETC).c $(CFLAGS)

$(UNLINK): $(UNLINK).o
	$(GCC) -o $(UNLINK) obj/$(UNLINK).o $(LDFLAGS)
$(UNLINK).o:
	$(GCC) -o obj/$(UNLINK).o -c $(UNLINK).c $(CFLAGS)

$(UTIMES): $(UTIMES).o
	$(GCC) -o $(UTIMES) obj/$(UTIMES).o $(LDFLAGS)
$(UTIMES).o:
	$(GCC) -o obj/$(UTIMES).o -c $(UTIMES).c $(CFLAGS)

$(VFPRINTF): $(VFPRINTF).o
	$(GCC) -o $(VFPRINTF) obj/$(VFPRINTF).o $(LDFLAGS)
$(VFPRINTF).o:
	$(GCC) -o obj/$(VFPRINTF).o -c $(VFPRINTF).c $(CFLAGS)

$(WRITE): $(WRITE).o
	$(GCC) -o $(WRITE) obj/$(WRITE).o $(LDFLAGS)
$(WRITE).o:
	$(GCC) -o obj/$(WRITE).o -c $(WRITE).c $(CFLAGS)



#top Makefile.fbsd


SELECT ALL
# Project: Project
# Makefile created

GCC         = gcc
INCS        = -DHAVE_SYS_STATVFS_H=1 -DHAVE_FCNTL=1 -DHAVE_FLOCK=1 -DHAVE_FNMATCH=1 -DHAVE_FSYNC=1 -DHAVE_FUTIMES=1 -DHAVE_LOCKF=1 -DHAVE_LCHMOD=1 -DHAVE_LUTIMES=1 -DHAVE_PREAD=1 -DHAVE_PWRITE=1 -DHAVE_SETBUFFER=1 -DHAVE_SETLINEBUF=1 -DHAVE_UTIMES=1
CFLAGS      = $(INCS) -W -O2 -Wall -pedantic -Wstrict-aliasing -Wno-long-long -D_FILE_OFFSET_BITS=64 -D_LINUX -D_REENTRANT
CFLAGS      = $(INCS) -W -O2 -Wall -pedantic -Wstrict-aliasing -Wno-long-long
LIBS        =
LIBDIRS     =
LDFLAGS     = $(LIBDIRS) $(LIBS)
RM          = rm -f
MKDCMD      = mkdir -p

ACCESS      = access
CHGRP       = chgrp
CHMOD       = chmod
CHOWN       = chown
CLOSE       = close
DUP2        = dup2
DUP         = dup
FCHMOD      = fchmod
FCHOWN      = fchown
FCLOSE      = fclose
FCNTL       = fcntl
FDATASYNC   = fdatasync
FDOPEN      = fdopen
FEOF        = feof
FERROR      = ferror
FFLUSH      = fflush
FGETC       = fgetc
FGETPOS     = fgetpos
FGETS       = fgets
FILENO      = fileno
FLOCK       = flock
FMEMOPEN    = fmemopen
FNMATCH     = fnmatch
FOPEN       = fopen
FPRINTF     = fprintf
FPUTC       = fputc
FPUTS       = fputs
FREAD       = fread
FREOPEN     = freopen
FSEEK       = fseek
FSETPOS     = fsetpos
FSTAT       = fstat
FSYNC       = fsync
FTELL       = ftell
FTRUNCATE   = ftruncate
FUTIMES     = futimes
FWRITE      = fwrite
GETC        = getc
GETDELIM    = getdelim
GETDTABLESIZE= getdtablesize
GETLINE     = getline
GETW        = getw
LCHMOD      = lchmod
LCHOWN      = lchown
LINK        = link
LOCKF       = lockf
LSEEK       = lseek
LSTAT       = lstat
LUTIMES     = lutimes
MKDTEMP     = mkdtemp
MKFIFO      = mkfifo
MKNOD       = mknod
MKSTEMP     = mkstemp
MKTEMP      = mktemp
OPEN        = open
OPEN_MEMSTREAM= open_memstream
PREAD       = pread
PUTC        = putc
PUTW        = putw
PWRITE      = pwrite
READ        = read
READ_LINES  = read-lines
READLINK    = readlink
REALPATH    = realpath
REMOVE      = remove
RENAME      = rename
REWIND      = rewind
SETBUF      = setbuf
SETBUFFER   = setbuffer
SETLINEBUF  = setlinebuf
SETVBUF     = setvbuf
STAT        = stat
STATFS      = statfs
STATVFS     = statvfs
STDERR      = stderr
STDIN       = stdin
STDOUT      = stdout
SYMLINK     = symlink
SYNC        = sync
TEMPNAM     = tempnam
TMPFILE     = tmpfile
TMPNAM      = tmpnam
TRUNCATE    = truncate
UNGETC      = ungetc
UNLINK      = unlink
UTIMES      = utimes
VFPRINTF    = vfprintf
WRITE       = write



all: objdir make

objdir:
	$(MKDCMD) obj/

clean: objdir
	$(RM) obj/*.o *.o *~

#make: $(ACCESS)
#make: $(CHGRP)
#make: $(CHMOD)
#make: $(CHOWN)
#make: $(CLOSE)
#make: $(DUP2)
#make: $(DUP)
#make: $(FCHMOD)
#make: $(FCHOWN)
#make: $(FCLOSE)
#make: $(FCNTL)
#make: $(FDATASYNC)
#make: $(FDOPEN)
#make: $(FEOF)
#make: $(FERROR)
#make: $(FFLUSH)
#make: $(FGETC)
#make: $(FGETPOS)
#make: $(FGETS)
#make: $(FILENO)
#make: $(FLOCK)
#make: $(FMEMOPEN)
#make: $(FNMATCH)
#make: $(FOPEN)
#make: $(FPRINTF)
#make: $(FPUTC)
#make: $(FPUTS)
#make: $(FREAD)
#make: $(FREOPEN)
#make: $(FSEEK)
#make: $(FSETPOS)
#make: $(FSTAT)
#make: $(FSYNC)
#make: $(FTELL)
#make: $(FTRUNCATE)
#make: $(FUTIMES)
#make: $(FWRITE)
#make: $(GETC)
#make: $(GETDELIM)
#make: $(GETDTABLESIZE)
#make: $(GETLINE)
#make: $(GETW)
#make: $(LCHMOD)
#make: $(LCHOWN)
#make: $(LINK)
#make: $(LOCKF)
#make: $(LSEEK)
#make: $(LSTAT)
#make: $(LUTIMES)
#make: $(MKDTEMP)
#make: $(MKFIFO)
#make: $(MKNOD)
#make: $(MKSTEMP)
#make: $(MKTEMP)
#make: $(OPEN)
#make: $(OPEN_MEMSTREAM)
#make: $(PREAD)
#make: $(PUTC)
#make: $(PUTW)
#make: $(PWRITE)
#make: $(READ)
#make: $(READ_LINES)
#make: $(READLINK)
#make: $(REALPATH)
#make: $(REMOVE)
#make: $(RENAME)
#make: $(REWIND)
#make: $(SETBUF)
#make: $(SETBUFFER)
#make: $(SETLINEBUF)
#make: $(SETVBUF)
#make: $(STAT)
#make: $(STATFS)
#make: $(STATVFS)
#make: $(STDERR)
#make: $(STDIN)
#make: $(STDOUT)
#make: $(SYMLINK)
#make: $(SYNC)
#make: $(TEMPNAM)
#make: $(TMPFILE)
#make: $(TMPNAM)
#make: $(TRUNCATE)
#make: $(UNGETC)
#make: $(UNLINK)
#make: $(UTIMES)
#make: $(VFPRINTF)
#make: $(WRITE)
make: $(ACCESS) $(CHGRP) $(CHMOD) $(CHOWN) $(CLOSE) $(DUP2) $(DUP) $(FCHMOD) $(FCHOWN) $(FCLOSE) $(FCNTL) $(FDATASYNC) $(FDOPEN) $(FEOF) $(FERROR) $(FFLUSH) $(FGETC) $(FGETPOS) $(FGETS) $(FILENO) $(FLOCK) $(FMEMOPEN) $(FNMATCH) $(FOPEN) $(FPRINTF) $(FPUTC) $(FPUTS) $(FREAD) $(FREOPEN) $(FSEEK) $(FSETPOS) $(FSTAT) $(FSYNC) $(FTELL) $(FTRUNCATE) $(FUTIMES) $(FWRITE) $(GETC) $(GETDELIM) $(GETDTABLESIZE) $(GETLINE) $(GETW) $(LCHMOD) $(LCHOWN) $(LINK) $(LOCKF) $(LSEEK) $(LSTAT) $(LUTIMES) $(MKDTEMP) $(MKFIFO) $(MKNOD) $(MKSTEMP) $(MKTEMP) $(OPEN) $(OPEN_MEMSTREAM) $(PREAD) $(PUTC) $(PUTW) $(PWRITE) $(READ) $(READ_LINES) $(READLINK) $(REALPATH) $(REMOVE) $(RENAME) $(REWIND) $(SETBUF) $(SETBUFFER) $(SETLINEBUF) $(SETVBUF) $(STAT) $(STATFS) $(STATVFS) $(STDERR) $(STDIN) $(STDOUT) $(SYMLINK) $(SYNC) $(TEMPNAM) $(TMPFILE) $(TMPNAM) $(TRUNCATE) $(UNGETC) $(UNLINK) $(UTIMES) $(VFPRINTF) $(WRITE)



$(ACCESS): $(ACCESS).o
	$(GCC) -o $(ACCESS) obj/$(ACCESS).o $(LDFLAGS)
$(ACCESS).o:
	$(GCC) -o obj/$(ACCESS).o -c $(ACCESS).c $(CFLAGS)

$(CHGRP): $(CHGRP).o
	$(GCC) -o $(CHGRP) obj/$(CHGRP).o $(LDFLAGS)
$(CHGRP).o:
	$(GCC) -o obj/$(CHGRP).o -c $(CHGRP).c $(CFLAGS)

$(CHMOD): $(CHMOD).o
	$(GCC) -o $(CHMOD) obj/$(CHMOD).o $(LDFLAGS)
$(CHMOD).o:
	$(GCC) -o obj/$(CHMOD).o -c $(CHMOD).c $(CFLAGS)

$(CHOWN): $(CHOWN).o
	$(GCC) -o $(CHOWN) obj/$(CHOWN).o $(LDFLAGS)
$(CHOWN).o:
	$(GCC) -o obj/$(CHOWN).o -c $(CHOWN).c $(CFLAGS)

$(CLOSE): $(CLOSE).o
	$(GCC) -o $(CLOSE) obj/$(CLOSE).o $(LDFLAGS)
$(CLOSE).o:
	$(GCC) -o obj/$(CLOSE).o -c $(CLOSE).c $(CFLAGS)

$(DUP2): $(DUP2).o
	$(GCC) -o $(DUP2) obj/$(DUP2).o $(LDFLAGS)
$(DUP2).o:
	$(GCC) -o obj/$(DUP2).o -c $(DUP2).c $(CFLAGS)

$(DUP): $(DUP).o
	$(GCC) -o $(DUP) obj/$(DUP).o $(LDFLAGS)
$(DUP).o:
	$(GCC) -o obj/$(DUP).o -c $(DUP).c $(CFLAGS)

$(FCHMOD): $(FCHMOD).o
	$(GCC) -o $(FCHMOD) obj/$(FCHMOD).o $(LDFLAGS)
$(FCHMOD).o:
	$(GCC) -o obj/$(FCHMOD).o -c $(FCHMOD).c $(CFLAGS)

$(FCHOWN): $(FCHOWN).o
	$(GCC) -o $(FCHOWN) obj/$(FCHOWN).o $(LDFLAGS)
$(FCHOWN).o:
	$(GCC) -o obj/$(FCHOWN).o -c $(FCHOWN).c $(CFLAGS)

$(FCLOSE): $(FCLOSE).o
	$(GCC) -o $(FCLOSE) obj/$(FCLOSE).o $(LDFLAGS)
$(FCLOSE).o:
	$(GCC) -o obj/$(FCLOSE).o -c $(FCLOSE).c $(CFLAGS)

$(FCNTL): $(FCNTL).o
	$(GCC) -o $(FCNTL) obj/$(FCNTL).o $(LDFLAGS)
$(FCNTL).o:
	$(GCC) -o obj/$(FCNTL).o -c $(FCNTL).c $(CFLAGS)

$(FDATASYNC): $(FDATASYNC).o
	$(GCC) -o $(FDATASYNC) obj/$(FDATASYNC).o $(LDFLAGS)
$(FDATASYNC).o:
	$(GCC) -o obj/$(FDATASYNC).o -c $(FDATASYNC).c $(CFLAGS)

$(FDOPEN): $(FDOPEN).o
	$(GCC) -o $(FDOPEN) obj/$(FDOPEN).o $(LDFLAGS)
$(FDOPEN).o:
	$(GCC) -o obj/$(FDOPEN).o -c $(FDOPEN).c $(CFLAGS)

$(FEOF): $(FEOF).o
	$(GCC) -o $(FEOF) obj/$(FEOF).o $(LDFLAGS)
$(FEOF).o:
	$(GCC) -o obj/$(FEOF).o -c $(FEOF).c $(CFLAGS)

$(FERROR): $(FERROR).o
	$(GCC) -o $(FERROR) obj/$(FERROR).o $(LDFLAGS)
$(FERROR).o:
	$(GCC) -o obj/$(FERROR).o -c $(FERROR).c $(CFLAGS)

$(FFLUSH): $(FFLUSH).o
	$(GCC) -o $(FFLUSH) obj/$(FFLUSH).o $(LDFLAGS)
$(FFLUSH).o:
	$(GCC) -o obj/$(FFLUSH).o -c $(FFLUSH).c $(CFLAGS)

$(FGETC): $(FGETC).o
	$(GCC) -o $(FGETC) obj/$(FGETC).o $(LDFLAGS)
$(FGETC).o:
	$(GCC) -o obj/$(FGETC).o -c $(FGETC).c $(CFLAGS)

$(FGETPOS): $(FGETPOS).o
	$(GCC) -o $(FGETPOS) obj/$(FGETPOS).o $(LDFLAGS)
$(FGETPOS).o:
	$(GCC) -o obj/$(FGETPOS).o -c $(FGETPOS).c $(CFLAGS)

$(FGETS): $(FGETS).o
	$(GCC) -o $(FGETS) obj/$(FGETS).o $(LDFLAGS)
$(FGETS).o:
	$(GCC) -o obj/$(FGETS).o -c $(FGETS).c $(CFLAGS)

$(FILENO): $(FILENO).o
	$(GCC) -o $(FILENO) obj/$(FILENO).o $(LDFLAGS)
$(FILENO).o:
	$(GCC) -o obj/$(FILENO).o -c $(FILENO).c $(CFLAGS)

$(FLOCK): $(FLOCK).o
	$(GCC) -o $(FLOCK) obj/$(FLOCK).o $(LDFLAGS)
$(FLOCK).o:
	$(GCC) -o obj/$(FLOCK).o -c $(FLOCK).c $(CFLAGS)

$(FMEMOPEN): $(FMEMOPEN).o
	$(GCC) -o $(FMEMOPEN) obj/$(FMEMOPEN).o $(LDFLAGS)
$(FMEMOPEN).o:
	$(GCC) -o obj/$(FMEMOPEN).o -c $(FMEMOPEN).c $(CFLAGS)

$(FNMATCH): $(FNMATCH).o
	$(GCC) -o $(FNMATCH) obj/$(FNMATCH).o $(LDFLAGS)
$(FNMATCH).o:
	$(GCC) -o obj/$(FNMATCH).o -c $(FNMATCH).c $(CFLAGS)

$(FOPEN): $(FOPEN).o
	$(GCC) -o $(FOPEN) obj/$(FOPEN).o $(LDFLAGS)
$(FOPEN).o:
	$(GCC) -o obj/$(FOPEN).o -c $(FOPEN).c $(CFLAGS)

$(FPRINTF): $(FPRINTF).o
	$(GCC) -o $(FPRINTF) obj/$(FPRINTF).o $(LDFLAGS)
$(FPRINTF).o:
	$(GCC) -o obj/$(FPRINTF).o -c $(FPRINTF).c $(CFLAGS)

$(FPUTC): $(FPUTC).o
	$(GCC) -o $(FPUTC) obj/$(FPUTC).o $(LDFLAGS)
$(FPUTC).o:
	$(GCC) -o obj/$(FPUTC).o -c $(FPUTC).c $(CFLAGS)

$(FPUTS): $(FPUTS).o
	$(GCC) -o $(FPUTS) obj/$(FPUTS).o $(LDFLAGS)
$(FPUTS).o:
	$(GCC) -o obj/$(FPUTS).o -c $(FPUTS).c $(CFLAGS)

$(FREAD): $(FREAD).o
	$(GCC) -o $(FREAD) obj/$(FREAD).o $(LDFLAGS)
$(FREAD).o:
	$(GCC) -o obj/$(FREAD).o -c $(FREAD).c $(CFLAGS)

$(FREOPEN): $(FREOPEN).o
	$(GCC) -o $(FREOPEN) obj/$(FREOPEN).o $(LDFLAGS)
$(FREOPEN).o:
	$(GCC) -o obj/$(FREOPEN).o -c $(FREOPEN).c $(CFLAGS)

$(FSEEK): $(FSEEK).o
	$(GCC) -o $(FSEEK) obj/$(FSEEK).o $(LDFLAGS)
$(FSEEK).o:
	$(GCC) -o obj/$(FSEEK).o -c $(FSEEK).c $(CFLAGS)

$(FSETPOS): $(FSETPOS).o
	$(GCC) -o $(FSETPOS) obj/$(FSETPOS).o $(LDFLAGS)
$(FSETPOS).o:
	$(GCC) -o obj/$(FSETPOS).o -c $(FSETPOS).c $(CFLAGS)

$(FSTAT): $(FSTAT).o
	$(GCC) -o $(FSTAT) obj/$(FSTAT).o $(LDFLAGS)
$(FSTAT).o:
	$(GCC) -o obj/$(FSTAT).o -c $(FSTAT).c $(CFLAGS)

$(FSYNC): $(FSYNC).o
	$(GCC) -o $(FSYNC) obj/$(FSYNC).o $(LDFLAGS)
$(FSYNC).o:
	$(GCC) -o obj/$(FSYNC).o -c $(FSYNC).c $(CFLAGS)

$(FTELL): $(FTELL).o
	$(GCC) -o $(FTELL) obj/$(FTELL).o $(LDFLAGS)
$(FTELL).o:
	$(GCC) -o obj/$(FTELL).o -c $(FTELL).c $(CFLAGS)

$(FTRUNCATE): $(FTRUNCATE).o
	$(GCC) -o $(FTRUNCATE) obj/$(FTRUNCATE).o $(LDFLAGS)
$(FTRUNCATE).o:
	$(GCC) -o obj/$(FTRUNCATE).o -c $(FTRUNCATE).c $(CFLAGS)

$(FUTIMES): $(FUTIMES).o
	$(GCC) -o $(FUTIMES) obj/$(FUTIMES).o $(LDFLAGS)
$(FUTIMES).o:
	$(GCC) -o obj/$(FUTIMES).o -c $(FUTIMES).c $(CFLAGS)

$(FWRITE): $(FWRITE).o
	$(GCC) -o $(FWRITE) obj/$(FWRITE).o $(LDFLAGS)
$(FWRITE).o:
	$(GCC) -o obj/$(FWRITE).o -c $(FWRITE).c $(CFLAGS)

$(GETC): $(GETC).o
	$(GCC) -o $(GETC) obj/$(GETC).o $(LDFLAGS)
$(GETC).o:
	$(GCC) -o obj/$(GETC).o -c $(GETC).c $(CFLAGS)

$(GETDELIM): $(GETDELIM).o
	$(GCC) -o $(GETDELIM) obj/$(GETDELIM).o $(LDFLAGS)
$(GETDELIM).o:
	$(GCC) -o obj/$(GETDELIM).o -c $(GETDELIM).c $(CFLAGS)

$(GETDTABLESIZE): $(GETDTABLESIZE).o
	$(GCC) -o $(GETDTABLESIZE) obj/$(GETDTABLESIZE).o $(LDFLAGS)
$(GETDTABLESIZE).o:
	$(GCC) -o obj/$(GETDTABLESIZE).o -c $(GETDTABLESIZE).c $(CFLAGS)

$(GETLINE): $(GETLINE).o
	$(GCC) -o $(GETLINE) obj/$(GETLINE).o $(LDFLAGS)
$(GETLINE).o:
	$(GCC) -o obj/$(GETLINE).o -c $(GETLINE).c $(CFLAGS)

$(GETW): $(GETW).o
	$(GCC) -o $(GETW) obj/$(GETW).o $(LDFLAGS)
$(GETW).o:
	$(GCC) -o obj/$(GETW).o -c $(GETW).c $(CFLAGS)

$(LCHMOD): $(LCHMOD).o
	$(GCC) -o $(LCHMOD) obj/$(LCHMOD).o $(LDFLAGS)
$(LCHMOD).o:
	$(GCC) -o obj/$(LCHMOD).o -c $(LCHMOD).c $(CFLAGS)

$(LCHOWN): $(LCHOWN).o
	$(GCC) -o $(LCHOWN) obj/$(LCHOWN).o $(LDFLAGS)
$(LCHOWN).o:
	$(GCC) -o obj/$(LCHOWN).o -c $(LCHOWN).c $(CFLAGS)

$(LINK): $(LINK).o
	$(GCC) -o $(LINK) obj/$(LINK).o $(LDFLAGS)
$(LINK).o:
	$(GCC) -o obj/$(LINK).o -c $(LINK).c $(CFLAGS)

$(LOCKF): $(LOCKF).o
	$(GCC) -o $(LOCKF) obj/$(LOCKF).o $(LDFLAGS)
$(LOCKF).o:
	$(GCC) -o obj/$(LOCKF).o -c $(LOCKF).c $(CFLAGS)

$(LSEEK): $(LSEEK).o
	$(GCC) -o $(LSEEK) obj/$(LSEEK).o $(LDFLAGS)
$(LSEEK).o:
	$(GCC) -o obj/$(LSEEK).o -c $(LSEEK).c $(CFLAGS)

$(LSTAT): $(LSTAT).o
	$(GCC) -o $(LSTAT) obj/$(LSTAT).o $(LDFLAGS)
$(LSTAT).o:
	$(GCC) -o obj/$(LSTAT).o -c $(LSTAT).c $(CFLAGS)

$(LUTIMES): $(LUTIMES).o
	$(GCC) -o $(LUTIMES) obj/$(LUTIMES).o $(LDFLAGS)
$(LUTIMES).o:
	$(GCC) -o obj/$(LUTIMES).o -c $(LUTIMES).c $(CFLAGS)

$(MKDTEMP): $(MKDTEMP).o
	$(GCC) -o $(MKDTEMP) obj/$(MKDTEMP).o $(LDFLAGS)
$(MKDTEMP).o:
	$(GCC) -o obj/$(MKDTEMP).o -c $(MKDTEMP).c $(CFLAGS)

$(MKFIFO): $(MKFIFO).o
	$(GCC) -o $(MKFIFO) obj/$(MKFIFO).o $(LDFLAGS)
$(MKFIFO).o:
	$(GCC) -o obj/$(MKFIFO).o -c $(MKFIFO).c $(CFLAGS)

$(MKNOD): $(MKNOD).o
	$(GCC) -o $(MKNOD) obj/$(MKNOD).o $(LDFLAGS)
$(MKNOD).o:
	$(GCC) -o obj/$(MKNOD).o -c $(MKNOD).c $(CFLAGS)

$(MKSTEMP): $(MKSTEMP).o
	$(GCC) -o $(MKSTEMP) obj/$(MKSTEMP).o $(LDFLAGS)
$(MKSTEMP).o:
	$(GCC) -o obj/$(MKSTEMP).o -c $(MKSTEMP).c $(CFLAGS)

$(MKTEMP): $(MKTEMP).o
	$(GCC) -o $(MKTEMP) obj/$(MKTEMP).o $(LDFLAGS)
$(MKTEMP).o:
	$(GCC) -o obj/$(MKTEMP).o -c $(MKTEMP).c $(CFLAGS)

$(OPEN): $(OPEN).o
	$(GCC) -o $(OPEN) obj/$(OPEN).o $(LDFLAGS)
$(OPEN).o:
	$(GCC) -o obj/$(OPEN).o -c $(OPEN).c $(CFLAGS)

$(OPEN_MEMSTREAM): $(OPEN_MEMSTREAM).o
	$(GCC) -o $(OPEN_MEMSTREAM) obj/$(OPEN_MEMSTREAM).o $(LDFLAGS)
$(OPEN_MEMSTREAM).o:
	$(GCC) -o obj/$(OPEN_MEMSTREAM).o -c $(OPEN_MEMSTREAM).c $(CFLAGS)

$(PREAD): $(PREAD).o
	$(GCC) -o $(PREAD) obj/$(PREAD).o $(LDFLAGS)
$(PREAD).o:
	$(GCC) -o obj/$(PREAD).o -c $(PREAD).c $(CFLAGS)

$(PUTC): $(PUTC).o
	$(GCC) -o $(PUTC) obj/$(PUTC).o $(LDFLAGS)
$(PUTC).o:
	$(GCC) -o obj/$(PUTC).o -c $(PUTC).c $(CFLAGS)

$(PUTW): $(PUTW).o
	$(GCC) -o $(PUTW) obj/$(PUTW).o $(LDFLAGS)
$(PUTW).o:
	$(GCC) -o obj/$(PUTW).o -c $(PUTW).c $(CFLAGS)

$(PWRITE): $(PWRITE).o
	$(GCC) -o $(PWRITE) obj/$(PWRITE).o $(LDFLAGS)
$(PWRITE).o:
	$(GCC) -o obj/$(PWRITE).o -c $(PWRITE).c $(CFLAGS)

$(READ): $(READ).o
	$(GCC) -o $(READ) obj/$(READ).o $(LDFLAGS)
$(READ).o:
	$(GCC) -o obj/$(READ).o -c $(READ).c $(CFLAGS)

$(READ_LINES): $(READ_LINES).o
	$(GCC) -o $(READ_LINES) obj/$(READ_LINES).o $(LDFLAGS)
$(READ_LINES).o:
	$(GCC) -o obj/$(READ_LINES).o -c $(READ_LINES).c $(CFLAGS)

$(READLINK): $(READLINK).o
	$(GCC) -o $(READLINK) obj/$(READLINK).o $(LDFLAGS)
$(READLINK).o:
	$(GCC) -o obj/$(READLINK).o -c $(READLINK).c $(CFLAGS)

$(REALPATH): $(REALPATH).o
	$(GCC) -o $(REALPATH) obj/$(REALPATH).o $(LDFLAGS)
$(REALPATH).o:
	$(GCC) -o obj/$(REALPATH).o -c $(REALPATH).c $(CFLAGS)

$(REMOVE): $(REMOVE).o
	$(GCC) -o $(REMOVE) obj/$(REMOVE).o $(LDFLAGS)
$(REMOVE).o:
	$(GCC) -o obj/$(REMOVE).o -c $(REMOVE).c $(CFLAGS)

$(RENAME): $(RENAME).o
	$(GCC) -o $(RENAME) obj/$(RENAME).o $(LDFLAGS)
$(RENAME).o:
	$(GCC) -o obj/$(RENAME).o -c $(RENAME).c $(CFLAGS)

$(REWIND): $(REWIND).o
	$(GCC) -o $(REWIND) obj/$(REWIND).o $(LDFLAGS)
$(REWIND).o:
	$(GCC) -o obj/$(REWIND).o -c $(REWIND).c $(CFLAGS)

$(SETBUF): $(SETBUF).o
	$(GCC) -o $(SETBUF) obj/$(SETBUF).o $(LDFLAGS)
$(SETBUF).o:
	$(GCC) -o obj/$(SETBUF).o -c $(SETBUF).c $(CFLAGS)

$(SETBUFFER): $(SETBUFFER).o
	$(GCC) -o $(SETBUFFER) obj/$(SETBUFFER).o $(LDFLAGS)
$(SETBUFFER).o:
	$(GCC) -o obj/$(SETBUFFER).o -c $(SETBUFFER).c $(CFLAGS)

$(SETLINEBUF): $(SETLINEBUF).o
	$(GCC) -o $(SETLINEBUF) obj/$(SETLINEBUF).o $(LDFLAGS)
$(SETLINEBUF).o:
	$(GCC) -o obj/$(SETLINEBUF).o -c $(SETLINEBUF).c $(CFLAGS)

$(SETVBUF): $(SETVBUF).o
	$(GCC) -o $(SETVBUF) obj/$(SETVBUF).o $(LDFLAGS)
$(SETVBUF).o:
	$(GCC) -o obj/$(SETVBUF).o -c $(SETVBUF).c $(CFLAGS)

$(STAT): $(STAT).o
	$(GCC) -o $(STAT) obj/$(STAT).o $(LDFLAGS)
$(STAT).o:
	$(GCC) -o obj/$(STAT).o -c $(STAT).c $(CFLAGS)

$(STATFS): $(STATFS).o
	$(GCC) -o $(STATFS) obj/$(STATFS).o $(LDFLAGS)
$(STATFS).o:
	$(GCC) -o obj/$(STATFS).o -c $(STATFS).c $(CFLAGS)

$(STATVFS): $(STATVFS).o
	$(GCC) -o $(STATVFS) obj/$(STATVFS).o $(LDFLAGS)
$(STATVFS).o:
	$(GCC) -o obj/$(STATVFS).o -c $(STATVFS).c $(CFLAGS)

$(STDERR): $(STDERR).o
	$(GCC) -o $(STDERR) obj/$(STDERR).o $(LDFLAGS)
$(STDERR).o:
	$(GCC) -o obj/$(STDERR).o -c $(STDERR).c $(CFLAGS)

$(STDIN): $(STDIN).o
	$(GCC) -o $(STDIN) obj/$(STDIN).o $(LDFLAGS)
$(STDIN).o:
	$(GCC) -o obj/$(STDIN).o -c $(STDIN).c $(CFLAGS)

$(STDOUT): $(STDOUT).o
	$(GCC) -o $(STDOUT) obj/$(STDOUT).o $(LDFLAGS)
$(STDOUT).o:
	$(GCC) -o obj/$(STDOUT).o -c $(STDOUT).c $(CFLAGS)

$(SYMLINK): $(SYMLINK).o
	$(GCC) -o $(SYMLINK) obj/$(SYMLINK).o $(LDFLAGS)
$(SYMLINK).o:
	$(GCC) -o obj/$(SYMLINK).o -c $(SYMLINK).c $(CFLAGS)

$(SYNC): $(SYNC).o
	$(GCC) -o $(SYNC) obj/$(SYNC).o $(LDFLAGS)
$(SYNC).o:
	$(GCC) -o obj/$(SYNC).o -c $(SYNC).c $(CFLAGS)

$(TEMPNAM): $(TEMPNAM).o
	$(GCC) -o $(TEMPNAM) obj/$(TEMPNAM).o $(LDFLAGS)
$(TEMPNAM).o:
	$(GCC) -o obj/$(TEMPNAM).o -c $(TEMPNAM).c $(CFLAGS)

$(TMPFILE): $(TMPFILE).o
	$(GCC) -o $(TMPFILE) obj/$(TMPFILE).o $(LDFLAGS)
$(TMPFILE).o:
	$(GCC) -o obj/$(TMPFILE).o -c $(TMPFILE).c $(CFLAGS)

$(TMPNAM): $(TMPNAM).o
	$(GCC) -o $(TMPNAM) obj/$(TMPNAM).o $(LDFLAGS)
$(TMPNAM).o:
	$(GCC) -o obj/$(TMPNAM).o -c $(TMPNAM).c $(CFLAGS)

$(TRUNCATE): $(TRUNCATE).o
	$(GCC) -o $(TRUNCATE) obj/$(TRUNCATE).o $(LDFLAGS)
$(TRUNCATE).o:
	$(GCC) -o obj/$(TRUNCATE).o -c $(TRUNCATE).c $(CFLAGS)

$(UNGETC): $(UNGETC).o
	$(GCC) -o $(UNGETC) obj/$(UNGETC).o $(LDFLAGS)
$(UNGETC).o:
	$(GCC) -o obj/$(UNGETC).o -c $(UNGETC).c $(CFLAGS)

$(UNLINK): $(UNLINK).o
	$(GCC) -o $(UNLINK) obj/$(UNLINK).o $(LDFLAGS)
$(UNLINK).o:
	$(GCC) -o obj/$(UNLINK).o -c $(UNLINK).c $(CFLAGS)

$(UTIMES): $(UTIMES).o
	$(GCC) -o $(UTIMES) obj/$(UTIMES).o $(LDFLAGS)
$(UTIMES).o:
	$(GCC) -o obj/$(UTIMES).o -c $(UTIMES).c $(CFLAGS)

$(VFPRINTF): $(VFPRINTF).o
	$(GCC) -o $(VFPRINTF) obj/$(VFPRINTF).o $(LDFLAGS)
$(VFPRINTF).o:
	$(GCC) -o obj/$(VFPRINTF).o -c $(VFPRINTF).c $(CFLAGS)

$(WRITE): $(WRITE).o
	$(GCC) -o $(WRITE) obj/$(WRITE).o $(LDFLAGS)
$(WRITE).o:
	$(GCC) -o obj/$(WRITE).o -c $(WRITE).c $(CFLAGS)



#top Makefile.sol


SELECT ALL
# Project: Project
# Makefile created

GCC         = gcc
INCS        = -DHAVE_SYS_STATVFS_H=1 -DHAVE_FCNTL=1 -DHAVE_FDATASYNC=1 -DHAVE_FSYNC=1 -DHAVE_LOCKF=1 -DHAVE_PREAD=1 -DHAVE_PWRITE=1 -DHAVE_SETBUFFER=1 -DHAVE_SETLINEBUF=1 -DHAVE_UTIMES=1
CFLAGS      = $(INCS) -W -O2 -Wall -pedantic -Wstrict-aliasing -Wno-long-long -D_FILE_OFFSET_BITS=64 -D_LINUX -D_REENTRANT
CFLAGS      = $(INCS) -W -O2 -Wall -pedantic -Wstrict-aliasing -Wno-long-long
LIBS        =
LIBDIRS     =
LDFLAGS     = $(LIBDIRS) $(LIBS)
RM          = rm -f
MKDCMD      = mkdir -p

ACCESS      = access
CHGRP       = chgrp
CHMOD       = chmod
CHOWN       = chown
CLOSE       = close
DUP2        = dup2
DUP         = dup
FCHMOD      = fchmod
FCHOWN      = fchown
FCLOSE      = fclose
FCNTL       = fcntl
FDATASYNC   = fdatasync
FDOPEN      = fdopen
FEOF        = feof
FERROR      = ferror
FFLUSH      = fflush
FGETC       = fgetc
FGETPOS     = fgetpos
FGETS       = fgets
FILENO      = fileno
FLOCK       = flock
FMEMOPEN    = fmemopen
FNMATCH     = fnmatch
FOPEN       = fopen
FPRINTF     = fprintf
FPUTC       = fputc
FPUTS       = fputs
FREAD       = fread
FREOPEN     = freopen
FSEEK       = fseek
FSETPOS     = fsetpos
FSTAT       = fstat
FSYNC       = fsync
FTELL       = ftell
FTRUNCATE   = ftruncate
FUTIMES     = futimes
FWRITE      = fwrite
GETC        = getc
GETDELIM    = getdelim
GETDTABLESIZE= getdtablesize
GETLINE     = getline
GETW        = getw
LCHMOD      = lchmod
LCHOWN      = lchown
LINK        = link
LOCKF       = lockf
LSEEK       = lseek
LSTAT       = lstat
LUTIMES     = lutimes
MKDTEMP     = mkdtemp
MKFIFO      = mkfifo
MKNOD       = mknod
MKSTEMP     = mkstemp
MKTEMP      = mktemp
OPEN        = open
OPEN_MEMSTREAM= open_memstream
PREAD       = pread
PUTC        = putc
PUTW        = putw
PWRITE      = pwrite
READ        = read
READ_LINES  = read-lines
READLINK    = readlink
REALPATH    = realpath
REMOVE      = remove
RENAME      = rename
REWIND      = rewind
SETBUF      = setbuf
SETBUFFER   = setbuffer
SETLINEBUF  = setlinebuf
SETVBUF     = setvbuf
STAT        = stat
STATFS      = statfs
STATVFS     = statvfs
STDERR      = stderr
STDIN       = stdin
STDOUT      = stdout
SYMLINK     = symlink
SYNC        = sync
TEMPNAM     = tempnam
TMPFILE     = tmpfile
TMPNAM      = tmpnam
TRUNCATE    = truncate
UNGETC      = ungetc
UNLINK      = unlink
UTIMES      = utimes
VFPRINTF    = vfprintf
WRITE       = write



all: objdir make

objdir:
	$(MKDCMD) obj/

clean: objdir
	$(RM) obj/*.o *.o *~

#make: $(ACCESS)
#make: $(CHGRP)
#make: $(CHMOD)
#make: $(CHOWN)
#make: $(CLOSE)
#make: $(DUP2)
#make: $(DUP)
#make: $(FCHMOD)
#make: $(FCHOWN)
#make: $(FCLOSE)
#make: $(FCNTL)
#make: $(FDATASYNC)
#make: $(FDOPEN)
#make: $(FEOF)
#make: $(FERROR)
#make: $(FFLUSH)
#make: $(FGETC)
#make: $(FGETPOS)
#make: $(FGETS)
#make: $(FILENO)
#make: $(FLOCK)
#make: $(FMEMOPEN)
#make: $(FNMATCH)
#make: $(FOPEN)
#make: $(FPRINTF)
#make: $(FPUTC)
#make: $(FPUTS)
#make: $(FREAD)
#make: $(FREOPEN)
#make: $(FSEEK)
#make: $(FSETPOS)
#make: $(FSTAT)
#make: $(FSYNC)
#make: $(FTELL)
#make: $(FTRUNCATE)
#make: $(FUTIMES)
#make: $(FWRITE)
#make: $(GETC)
#make: $(GETDELIM)
#make: $(GETDTABLESIZE)
#make: $(GETLINE)
#make: $(GETW)
#make: $(LCHMOD)
#make: $(LCHOWN)
#make: $(LINK)
#make: $(LOCKF)
#make: $(LSEEK)
#make: $(LSTAT)
#make: $(LUTIMES)
#make: $(MKDTEMP)
#make: $(MKFIFO)
#make: $(MKNOD)
#make: $(MKSTEMP)
#make: $(MKTEMP)
#make: $(OPEN)
#make: $(OPEN_MEMSTREAM)
#make: $(PREAD)
#make: $(PUTC)
#make: $(PUTW)
#make: $(PWRITE)
#make: $(READ)
#make: $(READ_LINES)
#make: $(READLINK)
#make: $(REALPATH)
#make: $(REMOVE)
#make: $(RENAME)
#make: $(REWIND)
#make: $(SETBUF)
#make: $(SETBUFFER)
#make: $(SETLINEBUF)
#make: $(SETVBUF)
#make: $(STAT)
#make: $(STATFS)
#make: $(STATVFS)
#make: $(STDERR)
#make: $(STDIN)
#make: $(STDOUT)
#make: $(SYMLINK)
#make: $(SYNC)
#make: $(TEMPNAM)
#make: $(TMPFILE)
#make: $(TMPNAM)
#make: $(TRUNCATE)
#make: $(UNGETC)
#make: $(UNLINK)
#make: $(UTIMES)
#make: $(VFPRINTF)
#make: $(WRITE)
make: $(ACCESS) $(CHGRP) $(CHMOD) $(CHOWN) $(CLOSE) $(DUP2) $(DUP) $(FCHMOD) $(FCHOWN) $(FCLOSE) $(FCNTL) $(FDATASYNC) $(FDOPEN) $(FEOF) $(FERROR) $(FFLUSH) $(FGETC) $(FGETPOS) $(FGETS) $(FILENO) $(FLOCK) $(FMEMOPEN) $(FNMATCH) $(FOPEN) $(FPRINTF) $(FPUTC) $(FPUTS) $(FREAD) $(FREOPEN) $(FSEEK) $(FSETPOS) $(FSTAT) $(FSYNC) $(FTELL) $(FTRUNCATE) $(FUTIMES) $(FWRITE) $(GETC) $(GETDELIM) $(GETDTABLESIZE) $(GETLINE) $(GETW) $(LCHMOD) $(LCHOWN) $(LINK) $(LOCKF) $(LSEEK) $(LSTAT) $(LUTIMES) $(MKDTEMP) $(MKFIFO) $(MKNOD) $(MKSTEMP) $(MKTEMP) $(OPEN) $(OPEN_MEMSTREAM) $(PREAD) $(PUTC) $(PUTW) $(PWRITE) $(READ) $(READ_LINES) $(READLINK) $(REALPATH) $(REMOVE) $(RENAME) $(REWIND) $(SETBUF) $(SETBUFFER) $(SETLINEBUF) $(SETVBUF) $(STAT) $(STATFS) $(STATVFS) $(STDERR) $(STDIN) $(STDOUT) $(SYMLINK) $(SYNC) $(TEMPNAM) $(TMPFILE) $(TMPNAM) $(TRUNCATE) $(UNGETC) $(UNLINK) $(UTIMES) $(VFPRINTF) $(WRITE)



$(ACCESS): $(ACCESS).o
	$(GCC) -o $(ACCESS) obj/$(ACCESS).o $(LDFLAGS)
$(ACCESS).o:
	$(GCC) -o obj/$(ACCESS).o -c $(ACCESS).c $(CFLAGS)

$(CHGRP): $(CHGRP).o
	$(GCC) -o $(CHGRP) obj/$(CHGRP).o $(LDFLAGS)
$(CHGRP).o:
	$(GCC) -o obj/$(CHGRP).o -c $(CHGRP).c $(CFLAGS)

$(CHMOD): $(CHMOD).o
	$(GCC) -o $(CHMOD) obj/$(CHMOD).o $(LDFLAGS)
$(CHMOD).o:
	$(GCC) -o obj/$(CHMOD).o -c $(CHMOD).c $(CFLAGS)

$(CHOWN): $(CHOWN).o
	$(GCC) -o $(CHOWN) obj/$(CHOWN).o $(LDFLAGS)
$(CHOWN).o:
	$(GCC) -o obj/$(CHOWN).o -c $(CHOWN).c $(CFLAGS)

$(CLOSE): $(CLOSE).o
	$(GCC) -o $(CLOSE) obj/$(CLOSE).o $(LDFLAGS)
$(CLOSE).o:
	$(GCC) -o obj/$(CLOSE).o -c $(CLOSE).c $(CFLAGS)

$(DUP2): $(DUP2).o
	$(GCC) -o $(DUP2) obj/$(DUP2).o $(LDFLAGS)
$(DUP2).o:
	$(GCC) -o obj/$(DUP2).o -c $(DUP2).c $(CFLAGS)

$(DUP): $(DUP).o
	$(GCC) -o $(DUP) obj/$(DUP).o $(LDFLAGS)
$(DUP).o:
	$(GCC) -o obj/$(DUP).o -c $(DUP).c $(CFLAGS)

$(FCHMOD): $(FCHMOD).o
	$(GCC) -o $(FCHMOD) obj/$(FCHMOD).o $(LDFLAGS)
$(FCHMOD).o:
	$(GCC) -o obj/$(FCHMOD).o -c $(FCHMOD).c $(CFLAGS)

$(FCHOWN): $(FCHOWN).o
	$(GCC) -o $(FCHOWN) obj/$(FCHOWN).o $(LDFLAGS)
$(FCHOWN).o:
	$(GCC) -o obj/$(FCHOWN).o -c $(FCHOWN).c $(CFLAGS)

$(FCLOSE): $(FCLOSE).o
	$(GCC) -o $(FCLOSE) obj/$(FCLOSE).o $(LDFLAGS)
$(FCLOSE).o:
	$(GCC) -o obj/$(FCLOSE).o -c $(FCLOSE).c $(CFLAGS)

$(FCNTL): $(FCNTL).o
	$(GCC) -o $(FCNTL) obj/$(FCNTL).o $(LDFLAGS)
$(FCNTL).o:
	$(GCC) -o obj/$(FCNTL).o -c $(FCNTL).c $(CFLAGS)

$(FDATASYNC): $(FDATASYNC).o
	$(GCC) -o $(FDATASYNC) obj/$(FDATASYNC).o $(LDFLAGS)
$(FDATASYNC).o:
	$(GCC) -o obj/$(FDATASYNC).o -c $(FDATASYNC).c $(CFLAGS)

$(FDOPEN): $(FDOPEN).o
	$(GCC) -o $(FDOPEN) obj/$(FDOPEN).o $(LDFLAGS)
$(FDOPEN).o:
	$(GCC) -o obj/$(FDOPEN).o -c $(FDOPEN).c $(CFLAGS)

$(FEOF): $(FEOF).o
	$(GCC) -o $(FEOF) obj/$(FEOF).o $(LDFLAGS)
$(FEOF).o:
	$(GCC) -o obj/$(FEOF).o -c $(FEOF).c $(CFLAGS)

$(FERROR): $(FERROR).o
	$(GCC) -o $(FERROR) obj/$(FERROR).o $(LDFLAGS)
$(FERROR).o:
	$(GCC) -o obj/$(FERROR).o -c $(FERROR).c $(CFLAGS)

$(FFLUSH): $(FFLUSH).o
	$(GCC) -o $(FFLUSH) obj/$(FFLUSH).o $(LDFLAGS)
$(FFLUSH).o:
	$(GCC) -o obj/$(FFLUSH).o -c $(FFLUSH).c $(CFLAGS)

$(FGETC): $(FGETC).o
	$(GCC) -o $(FGETC) obj/$(FGETC).o $(LDFLAGS)
$(FGETC).o:
	$(GCC) -o obj/$(FGETC).o -c $(FGETC).c $(CFLAGS)

$(FGETPOS): $(FGETPOS).o
	$(GCC) -o $(FGETPOS) obj/$(FGETPOS).o $(LDFLAGS)
$(FGETPOS).o:
	$(GCC) -o obj/$(FGETPOS).o -c $(FGETPOS).c $(CFLAGS)

$(FGETS): $(FGETS).o
	$(GCC) -o $(FGETS) obj/$(FGETS).o $(LDFLAGS)
$(FGETS).o:
	$(GCC) -o obj/$(FGETS).o -c $(FGETS).c $(CFLAGS)

$(FILENO): $(FILENO).o
	$(GCC) -o $(FILENO) obj/$(FILENO).o $(LDFLAGS)
$(FILENO).o:
	$(GCC) -o obj/$(FILENO).o -c $(FILENO).c $(CFLAGS)

$(FLOCK): $(FLOCK).o
	$(GCC) -o $(FLOCK) obj/$(FLOCK).o $(LDFLAGS)
$(FLOCK).o:
	$(GCC) -o obj/$(FLOCK).o -c $(FLOCK).c $(CFLAGS)

$(FMEMOPEN): $(FMEMOPEN).o
	$(GCC) -o $(FMEMOPEN) obj/$(FMEMOPEN).o $(LDFLAGS)
$(FMEMOPEN).o:
	$(GCC) -o obj/$(FMEMOPEN).o -c $(FMEMOPEN).c $(CFLAGS)

$(FNMATCH): $(FNMATCH).o
	$(GCC) -o $(FNMATCH) obj/$(FNMATCH).o $(LDFLAGS)
$(FNMATCH).o:
	$(GCC) -o obj/$(FNMATCH).o -c $(FNMATCH).c $(CFLAGS)

$(FOPEN): $(FOPEN).o
	$(GCC) -o $(FOPEN) obj/$(FOPEN).o $(LDFLAGS)
$(FOPEN).o:
	$(GCC) -o obj/$(FOPEN).o -c $(FOPEN).c $(CFLAGS)

$(FPRINTF): $(FPRINTF).o
	$(GCC) -o $(FPRINTF) obj/$(FPRINTF).o $(LDFLAGS)
$(FPRINTF).o:
	$(GCC) -o obj/$(FPRINTF).o -c $(FPRINTF).c $(CFLAGS)

$(FPUTC): $(FPUTC).o
	$(GCC) -o $(FPUTC) obj/$(FPUTC).o $(LDFLAGS)
$(FPUTC).o:
	$(GCC) -o obj/$(FPUTC).o -c $(FPUTC).c $(CFLAGS)

$(FPUTS): $(FPUTS).o
	$(GCC) -o $(FPUTS) obj/$(FPUTS).o $(LDFLAGS)
$(FPUTS).o:
	$(GCC) -o obj/$(FPUTS).o -c $(FPUTS).c $(CFLAGS)

$(FREAD): $(FREAD).o
	$(GCC) -o $(FREAD) obj/$(FREAD).o $(LDFLAGS)
$(FREAD).o:
	$(GCC) -o obj/$(FREAD).o -c $(FREAD).c $(CFLAGS)

$(FREOPEN): $(FREOPEN).o
	$(GCC) -o $(FREOPEN) obj/$(FREOPEN).o $(LDFLAGS)
$(FREOPEN).o:
	$(GCC) -o obj/$(FREOPEN).o -c $(FREOPEN).c $(CFLAGS)

$(FSEEK): $(FSEEK).o
	$(GCC) -o $(FSEEK) obj/$(FSEEK).o $(LDFLAGS)
$(FSEEK).o:
	$(GCC) -o obj/$(FSEEK).o -c $(FSEEK).c $(CFLAGS)

$(FSETPOS): $(FSETPOS).o
	$(GCC) -o $(FSETPOS) obj/$(FSETPOS).o $(LDFLAGS)
$(FSETPOS).o:
	$(GCC) -o obj/$(FSETPOS).o -c $(FSETPOS).c $(CFLAGS)

$(FSTAT): $(FSTAT).o
	$(GCC) -o $(FSTAT) obj/$(FSTAT).o $(LDFLAGS)
$(FSTAT).o:
	$(GCC) -o obj/$(FSTAT).o -c $(FSTAT).c $(CFLAGS)

$(FSYNC): $(FSYNC).o
	$(GCC) -o $(FSYNC) obj/$(FSYNC).o $(LDFLAGS)
$(FSYNC).o:
	$(GCC) -o obj/$(FSYNC).o -c $(FSYNC).c $(CFLAGS)

$(FTELL): $(FTELL).o
	$(GCC) -o $(FTELL) obj/$(FTELL).o $(LDFLAGS)
$(FTELL).o:
	$(GCC) -o obj/$(FTELL).o -c $(FTELL).c $(CFLAGS)

$(FTRUNCATE): $(FTRUNCATE).o
	$(GCC) -o $(FTRUNCATE) obj/$(FTRUNCATE).o $(LDFLAGS)
$(FTRUNCATE).o:
	$(GCC) -o obj/$(FTRUNCATE).o -c $(FTRUNCATE).c $(CFLAGS)

$(FUTIMES): $(FUTIMES).o
	$(GCC) -o $(FUTIMES) obj/$(FUTIMES).o $(LDFLAGS)
$(FUTIMES).o:
	$(GCC) -o obj/$(FUTIMES).o -c $(FUTIMES).c $(CFLAGS)

$(FWRITE): $(FWRITE).o
	$(GCC) -o $(FWRITE) obj/$(FWRITE).o $(LDFLAGS)
$(FWRITE).o:
	$(GCC) -o obj/$(FWRITE).o -c $(FWRITE).c $(CFLAGS)

$(GETC): $(GETC).o
	$(GCC) -o $(GETC) obj/$(GETC).o $(LDFLAGS)
$(GETC).o:
	$(GCC) -o obj/$(GETC).o -c $(GETC).c $(CFLAGS)

$(GETDELIM): $(GETDELIM).o
	$(GCC) -o $(GETDELIM) obj/$(GETDELIM).o $(LDFLAGS)
$(GETDELIM).o:
	$(GCC) -o obj/$(GETDELIM).o -c $(GETDELIM).c $(CFLAGS)

$(GETDTABLESIZE): $(GETDTABLESIZE).o
	$(GCC) -o $(GETDTABLESIZE) obj/$(GETDTABLESIZE).o $(LDFLAGS)
$(GETDTABLESIZE).o:
	$(GCC) -o obj/$(GETDTABLESIZE).o -c $(GETDTABLESIZE).c $(CFLAGS)

$(GETLINE): $(GETLINE).o
	$(GCC) -o $(GETLINE) obj/$(GETLINE).o $(LDFLAGS)
$(GETLINE).o:
	$(GCC) -o obj/$(GETLINE).o -c $(GETLINE).c $(CFLAGS)

$(GETW): $(GETW).o
	$(GCC) -o $(GETW) obj/$(GETW).o $(LDFLAGS)
$(GETW).o:
	$(GCC) -o obj/$(GETW).o -c $(GETW).c $(CFLAGS)

$(LCHMOD): $(LCHMOD).o
	$(GCC) -o $(LCHMOD) obj/$(LCHMOD).o $(LDFLAGS)
$(LCHMOD).o:
	$(GCC) -o obj/$(LCHMOD).o -c $(LCHMOD).c $(CFLAGS)

$(LCHOWN): $(LCHOWN).o
	$(GCC) -o $(LCHOWN) obj/$(LCHOWN).o $(LDFLAGS)
$(LCHOWN).o:
	$(GCC) -o obj/$(LCHOWN).o -c $(LCHOWN).c $(CFLAGS)

$(LINK): $(LINK).o
	$(GCC) -o $(LINK) obj/$(LINK).o $(LDFLAGS)
$(LINK).o:
	$(GCC) -o obj/$(LINK).o -c $(LINK).c $(CFLAGS)

$(LOCKF): $(LOCKF).o
	$(GCC) -o $(LOCKF) obj/$(LOCKF).o $(LDFLAGS)
$(LOCKF).o:
	$(GCC) -o obj/$(LOCKF).o -c $(LOCKF).c $(CFLAGS)

$(LSEEK): $(LSEEK).o
	$(GCC) -o $(LSEEK) obj/$(LSEEK).o $(LDFLAGS)
$(LSEEK).o:
	$(GCC) -o obj/$(LSEEK).o -c $(LSEEK).c $(CFLAGS)

$(LSTAT): $(LSTAT).o
	$(GCC) -o $(LSTAT) obj/$(LSTAT).o $(LDFLAGS)
$(LSTAT).o:
	$(GCC) -o obj/$(LSTAT).o -c $(LSTAT).c $(CFLAGS)

$(LUTIMES): $(LUTIMES).o
	$(GCC) -o $(LUTIMES) obj/$(LUTIMES).o $(LDFLAGS)
$(LUTIMES).o:
	$(GCC) -o obj/$(LUTIMES).o -c $(LUTIMES).c $(CFLAGS)

$(MKDTEMP): $(MKDTEMP).o
	$(GCC) -o $(MKDTEMP) obj/$(MKDTEMP).o $(LDFLAGS)
$(MKDTEMP).o:
	$(GCC) -o obj/$(MKDTEMP).o -c $(MKDTEMP).c $(CFLAGS)

$(MKFIFO): $(MKFIFO).o
	$(GCC) -o $(MKFIFO) obj/$(MKFIFO).o $(LDFLAGS)
$(MKFIFO).o:
	$(GCC) -o obj/$(MKFIFO).o -c $(MKFIFO).c $(CFLAGS)

$(MKNOD): $(MKNOD).o
	$(GCC) -o $(MKNOD) obj/$(MKNOD).o $(LDFLAGS)
$(MKNOD).o:
	$(GCC) -o obj/$(MKNOD).o -c $(MKNOD).c $(CFLAGS)

$(MKSTEMP): $(MKSTEMP).o
	$(GCC) -o $(MKSTEMP) obj/$(MKSTEMP).o $(LDFLAGS)
$(MKSTEMP).o:
	$(GCC) -o obj/$(MKSTEMP).o -c $(MKSTEMP).c $(CFLAGS)

$(MKTEMP): $(MKTEMP).o
	$(GCC) -o $(MKTEMP) obj/$(MKTEMP).o $(LDFLAGS)
$(MKTEMP).o:
	$(GCC) -o obj/$(MKTEMP).o -c $(MKTEMP).c $(CFLAGS)

$(OPEN): $(OPEN).o
	$(GCC) -o $(OPEN) obj/$(OPEN).o $(LDFLAGS)
$(OPEN).o:
	$(GCC) -o obj/$(OPEN).o -c $(OPEN).c $(CFLAGS)

$(OPEN_MEMSTREAM): $(OPEN_MEMSTREAM).o
	$(GCC) -o $(OPEN_MEMSTREAM) obj/$(OPEN_MEMSTREAM).o $(LDFLAGS)
$(OPEN_MEMSTREAM).o:
	$(GCC) -o obj/$(OPEN_MEMSTREAM).o -c $(OPEN_MEMSTREAM).c $(CFLAGS)

$(PREAD): $(PREAD).o
	$(GCC) -o $(PREAD) obj/$(PREAD).o $(LDFLAGS)
$(PREAD).o:
	$(GCC) -o obj/$(PREAD).o -c $(PREAD).c $(CFLAGS)

$(PUTC): $(PUTC).o
	$(GCC) -o $(PUTC) obj/$(PUTC).o $(LDFLAGS)
$(PUTC).o:
	$(GCC) -o obj/$(PUTC).o -c $(PUTC).c $(CFLAGS)

$(PUTW): $(PUTW).o
	$(GCC) -o $(PUTW) obj/$(PUTW).o $(LDFLAGS)
$(PUTW).o:
	$(GCC) -o obj/$(PUTW).o -c $(PUTW).c $(CFLAGS)

$(PWRITE): $(PWRITE).o
	$(GCC) -o $(PWRITE) obj/$(PWRITE).o $(LDFLAGS)
$(PWRITE).o:
	$(GCC) -o obj/$(PWRITE).o -c $(PWRITE).c $(CFLAGS)

$(READ): $(READ).o
	$(GCC) -o $(READ) obj/$(READ).o $(LDFLAGS)
$(READ).o:
	$(GCC) -o obj/$(READ).o -c $(READ).c $(CFLAGS)

$(READ_LINES): $(READ_LINES).o
	$(GCC) -o $(READ_LINES) obj/$(READ_LINES).o $(LDFLAGS)
$(READ_LINES).o:
	$(GCC) -o obj/$(READ_LINES).o -c $(READ_LINES).c $(CFLAGS)

$(READLINK): $(READLINK).o
	$(GCC) -o $(READLINK) obj/$(READLINK).o $(LDFLAGS)
$(READLINK).o:
	$(GCC) -o obj/$(READLINK).o -c $(READLINK).c $(CFLAGS)

$(REALPATH): $(REALPATH).o
	$(GCC) -o $(REALPATH) obj/$(REALPATH).o $(LDFLAGS)
$(REALPATH).o:
	$(GCC) -o obj/$(REALPATH).o -c $(REALPATH).c $(CFLAGS)

$(REMOVE): $(REMOVE).o
	$(GCC) -o $(REMOVE) obj/$(REMOVE).o $(LDFLAGS)
$(REMOVE).o:
	$(GCC) -o obj/$(REMOVE).o -c $(REMOVE).c $(CFLAGS)

$(RENAME): $(RENAME).o
	$(GCC) -o $(RENAME) obj/$(RENAME).o $(LDFLAGS)
$(RENAME).o:
	$(GCC) -o obj/$(RENAME).o -c $(RENAME).c $(CFLAGS)

$(REWIND): $(REWIND).o
	$(GCC) -o $(REWIND) obj/$(REWIND).o $(LDFLAGS)
$(REWIND).o:
	$(GCC) -o obj/$(REWIND).o -c $(REWIND).c $(CFLAGS)

$(SETBUF): $(SETBUF).o
	$(GCC) -o $(SETBUF) obj/$(SETBUF).o $(LDFLAGS)
$(SETBUF).o:
	$(GCC) -o obj/$(SETBUF).o -c $(SETBUF).c $(CFLAGS)

$(SETBUFFER): $(SETBUFFER).o
	$(GCC) -o $(SETBUFFER) obj/$(SETBUFFER).o $(LDFLAGS)
$(SETBUFFER).o:
	$(GCC) -o obj/$(SETBUFFER).o -c $(SETBUFFER).c $(CFLAGS)

$(SETLINEBUF): $(SETLINEBUF).o
	$(GCC) -o $(SETLINEBUF) obj/$(SETLINEBUF).o $(LDFLAGS)
$(SETLINEBUF).o:
	$(GCC) -o obj/$(SETLINEBUF).o -c $(SETLINEBUF).c $(CFLAGS)

$(SETVBUF): $(SETVBUF).o
	$(GCC) -o $(SETVBUF) obj/$(SETVBUF).o $(LDFLAGS)
$(SETVBUF).o:
	$(GCC) -o obj/$(SETVBUF).o -c $(SETVBUF).c $(CFLAGS)

$(STAT): $(STAT).o
	$(GCC) -o $(STAT) obj/$(STAT).o $(LDFLAGS)
$(STAT).o:
	$(GCC) -o obj/$(STAT).o -c $(STAT).c $(CFLAGS)

$(STATFS): $(STATFS).o
	$(GCC) -o $(STATFS) obj/$(STATFS).o $(LDFLAGS)
$(STATFS).o:
	$(GCC) -o obj/$(STATFS).o -c $(STATFS).c $(CFLAGS)

$(STATVFS): $(STATVFS).o
	$(GCC) -o $(STATVFS) obj/$(STATVFS).o $(LDFLAGS)
$(STATVFS).o:
	$(GCC) -o obj/$(STATVFS).o -c $(STATVFS).c $(CFLAGS)

$(STDERR): $(STDERR).o
	$(GCC) -o $(STDERR) obj/$(STDERR).o $(LDFLAGS)
$(STDERR).o:
	$(GCC) -o obj/$(STDERR).o -c $(STDERR).c $(CFLAGS)

$(STDIN): $(STDIN).o
	$(GCC) -o $(STDIN) obj/$(STDIN).o $(LDFLAGS)
$(STDIN).o:
	$(GCC) -o obj/$(STDIN).o -c $(STDIN).c $(CFLAGS)

$(STDOUT): $(STDOUT).o
	$(GCC) -o $(STDOUT) obj/$(STDOUT).o $(LDFLAGS)
$(STDOUT).o:
	$(GCC) -o obj/$(STDOUT).o -c $(STDOUT).c $(CFLAGS)

$(SYMLINK): $(SYMLINK).o
	$(GCC) -o $(SYMLINK) obj/$(SYMLINK).o $(LDFLAGS)
$(SYMLINK).o:
	$(GCC) -o obj/$(SYMLINK).o -c $(SYMLINK).c $(CFLAGS)

$(SYNC): $(SYNC).o
	$(GCC) -o $(SYNC) obj/$(SYNC).o $(LDFLAGS)
$(SYNC).o:
	$(GCC) -o obj/$(SYNC).o -c $(SYNC).c $(CFLAGS)

$(TEMPNAM): $(TEMPNAM).o
	$(GCC) -o $(TEMPNAM) obj/$(TEMPNAM).o $(LDFLAGS)
$(TEMPNAM).o:
	$(GCC) -o obj/$(TEMPNAM).o -c $(TEMPNAM).c $(CFLAGS)

$(TMPFILE): $(TMPFILE).o
	$(GCC) -o $(TMPFILE) obj/$(TMPFILE).o $(LDFLAGS)
$(TMPFILE).o:
	$(GCC) -o obj/$(TMPFILE).o -c $(TMPFILE).c $(CFLAGS)

$(TMPNAM): $(TMPNAM).o
	$(GCC) -o $(TMPNAM) obj/$(TMPNAM).o $(LDFLAGS)
$(TMPNAM).o:
	$(GCC) -o obj/$(TMPNAM).o -c $(TMPNAM).c $(CFLAGS)

$(TRUNCATE): $(TRUNCATE).o
	$(GCC) -o $(TRUNCATE) obj/$(TRUNCATE).o $(LDFLAGS)
$(TRUNCATE).o:
	$(GCC) -o obj/$(TRUNCATE).o -c $(TRUNCATE).c $(CFLAGS)

$(UNGETC): $(UNGETC).o
	$(GCC) -o $(UNGETC) obj/$(UNGETC).o $(LDFLAGS)
$(UNGETC).o:
	$(GCC) -o obj/$(UNGETC).o -c $(UNGETC).c $(CFLAGS)

$(UNLINK): $(UNLINK).o
	$(GCC) -o $(UNLINK) obj/$(UNLINK).o $(LDFLAGS)
$(UNLINK).o:
	$(GCC) -o obj/$(UNLINK).o -c $(UNLINK).c $(CFLAGS)

$(UTIMES): $(UTIMES).o
	$(GCC) -o $(UTIMES) obj/$(UTIMES).o $(LDFLAGS)
$(UTIMES).o:
	$(GCC) -o obj/$(UTIMES).o -c $(UTIMES).c $(CFLAGS)

$(VFPRINTF): $(VFPRINTF).o
	$(GCC) -o $(VFPRINTF) obj/$(VFPRINTF).o $(LDFLAGS)
$(VFPRINTF).o:
	$(GCC) -o obj/$(VFPRINTF).o -c $(VFPRINTF).c $(CFLAGS)

$(WRITE): $(WRITE).o
	$(GCC) -o $(WRITE) obj/$(WRITE).o $(LDFLAGS)
$(WRITE).o:
	$(GCC) -o obj/$(WRITE).o -c $(WRITE).c $(CFLAGS)



#top Makefile.beos


SELECT ALL
# Project: Project
# Makefile created

GCC         = gcc
INCS        = -DHAVE_FCNTL=1 -DHAVE_FNMATCH=1 -DHAVE_FSYNC=1 -DHAVE_LOCKF=1 -DHAVE_PREAD=1 -DHAVE_PWRITE=1 -DHAVE_SETBUFFER=1 -DHAVE_SETLINEBUF=1
CFLAGS      = $(INCS) -W -O2 -Wall -pedantic -Wstrict-aliasing -Wno-long-long -D_FILE_OFFSET_BITS=64 -D_LINUX -D_REENTRANT
CFLAGS      = $(INCS) -W -O2 -Wall -pedantic
LIBS        =
LIBDIRS     =
LDFLAGS     = $(LIBDIRS) $(LIBS)
RM          = rm -f
MKDCMD      = mkdir -p

ACCESS      = access
CHGRP       = chgrp
CHMOD       = chmod
CHOWN       = chown
CLOSE       = close
DUP2        = dup2
DUP         = dup
FCHMOD      = fchmod
FCHOWN      = fchown
FCLOSE      = fclose
FCNTL       = fcntl
FDATASYNC   = fdatasync
FDOPEN      = fdopen
FEOF        = feof
FERROR      = ferror
FFLUSH      = fflush
FGETC       = fgetc
FGETPOS     = fgetpos
FGETS       = fgets
FILENO      = fileno
FLOCK       = flock
FMEMOPEN    = fmemopen
FNMATCH     = fnmatch
FOPEN       = fopen
FPRINTF     = fprintf
FPUTC       = fputc
FPUTS       = fputs
FREAD       = fread
FREOPEN     = freopen
FSEEK       = fseek
FSETPOS     = fsetpos
FSTAT       = fstat
FSYNC       = fsync
FTELL       = ftell
FTRUNCATE   = ftruncate
FUTIMES     = futimes
FWRITE      = fwrite
GETC        = getc
GETDELIM    = getdelim
GETDTABLESIZE= getdtablesize
GETLINE     = getline
GETW        = getw
LCHMOD      = lchmod
LCHOWN      = lchown
LINK        = link
LOCKF       = lockf
LSEEK       = lseek
LSTAT       = lstat
LUTIMES     = lutimes
MKDTEMP     = mkdtemp
MKFIFO      = mkfifo
MKNOD       = mknod
MKSTEMP     = mkstemp
MKTEMP      = mktemp
OPEN        = open
OPEN_MEMSTREAM= open_memstream
PREAD       = pread
PUTC        = putc
PUTW        = putw
PWRITE      = pwrite
READ        = read
READ_LINES  = read-lines
READLINK    = readlink
REALPATH    = realpath
REMOVE      = remove
RENAME      = rename
REWIND      = rewind
SETBUF      = setbuf
SETBUFFER   = setbuffer
SETLINEBUF  = setlinebuf
SETVBUF     = setvbuf
STAT        = stat
STATFS      = statfs
STATVFS     = statvfs
STDERR      = stderr
STDIN       = stdin
STDOUT      = stdout
SYMLINK     = symlink
SYNC        = sync
TEMPNAM     = tempnam
TMPFILE     = tmpfile
TMPNAM      = tmpnam
TRUNCATE    = truncate
UNGETC      = ungetc
UNLINK      = unlink
UTIMES      = utimes
VFPRINTF    = vfprintf
WRITE       = write



all: objdir make

objdir:
	$(MKDCMD) obj/

clean: objdir
	$(RM) obj/*.o *.o *~

#make: $(ACCESS)
#make: $(CHGRP)
#make: $(CHMOD)
#make: $(CHOWN)
#make: $(CLOSE)
#make: $(DUP2)
#make: $(DUP)
#make: $(FCHMOD)
#make: $(FCHOWN)
#make: $(FCLOSE)
#make: $(FCNTL)
#make: $(FDATASYNC)
#make: $(FDOPEN)
#make: $(FEOF)
#make: $(FERROR)
#make: $(FFLUSH)
#make: $(FGETC)
#make: $(FGETPOS)
#make: $(FGETS)
#make: $(FILENO)
#make: $(FLOCK)
#make: $(FMEMOPEN)
#make: $(FNMATCH)
#make: $(FOPEN)
#make: $(FPRINTF)
#make: $(FPUTC)
#make: $(FPUTS)
#make: $(FREAD)
#make: $(FREOPEN)
#make: $(FSEEK)
#make: $(FSETPOS)
#make: $(FSTAT)
#make: $(FSYNC)
#make: $(FTELL)
#make: $(FTRUNCATE)
#make: $(FUTIMES)
#make: $(FWRITE)
#make: $(GETC)
#make: $(GETDELIM)
#make: $(GETDTABLESIZE)
#make: $(GETLINE)
#make: $(GETW)
#make: $(LCHMOD)
#make: $(LCHOWN)
#make: $(LINK)
#make: $(LOCKF)
#make: $(LSEEK)
#make: $(LSTAT)
#make: $(LUTIMES)
#make: $(MKDTEMP)
#make: $(MKFIFO)
#make: $(MKNOD)
#make: $(MKSTEMP)
#make: $(MKTEMP)
#make: $(OPEN)
#make: $(OPEN_MEMSTREAM)
#make: $(PREAD)
#make: $(PUTC)
#make: $(PUTW)
#make: $(PWRITE)
#make: $(READ)
#make: $(READ_LINES)
#make: $(READLINK)
#make: $(REALPATH)
#make: $(REMOVE)
#make: $(RENAME)
#make: $(REWIND)
#make: $(SETBUF)
#make: $(SETBUFFER)
#make: $(SETLINEBUF)
#make: $(SETVBUF)
#make: $(STAT)
#make: $(STATFS)
#make: $(STATVFS)
#make: $(STDERR)
#make: $(STDIN)
#make: $(STDOUT)
#make: $(SYMLINK)
#make: $(SYNC)
#make: $(TEMPNAM)
#make: $(TMPFILE)
#make: $(TMPNAM)
#make: $(TRUNCATE)
#make: $(UNGETC)
#make: $(UNLINK)
#make: $(UTIMES)
#make: $(VFPRINTF)
#make: $(WRITE)
make: $(ACCESS) $(CHGRP) $(CHMOD) $(CHOWN) $(CLOSE) $(DUP2) $(DUP) $(FCHMOD) $(FCHOWN) $(FCLOSE) $(FCNTL) $(FDATASYNC) $(FDOPEN) $(FEOF) $(FERROR) $(FFLUSH) $(FGETC) $(FGETPOS) $(FGETS) $(FILENO) $(FLOCK) $(FMEMOPEN) $(FNMATCH) $(FOPEN) $(FPRINTF) $(FPUTC) $(FPUTS) $(FREAD) $(FREOPEN) $(FSEEK) $(FSETPOS) $(FSTAT) $(FSYNC) $(FTELL) $(FTRUNCATE) $(FUTIMES) $(FWRITE) $(GETC) $(GETDELIM) $(GETDTABLESIZE) $(GETLINE) $(GETW) $(LCHMOD) $(LCHOWN) $(LINK) $(LOCKF) $(LSEEK) $(LSTAT) $(LUTIMES) $(MKDTEMP) $(MKFIFO) $(MKNOD) $(MKSTEMP) $(MKTEMP) $(OPEN) $(OPEN_MEMSTREAM) $(PREAD) $(PUTC) $(PUTW) $(PWRITE) $(READ) $(READ_LINES) $(READLINK) $(REALPATH) $(REMOVE) $(RENAME) $(REWIND) $(SETBUF) $(SETBUFFER) $(SETLINEBUF) $(SETVBUF) $(STAT) $(STATFS) $(STATVFS) $(STDERR) $(STDIN) $(STDOUT) $(SYMLINK) $(SYNC) $(TEMPNAM) $(TMPFILE) $(TMPNAM) $(TRUNCATE) $(UNGETC) $(UNLINK) $(UTIMES) $(VFPRINTF) $(WRITE)



$(ACCESS): $(ACCESS).o
	$(GCC) -o $(ACCESS) obj/$(ACCESS).o $(LDFLAGS)
$(ACCESS).o:
	$(GCC) -o obj/$(ACCESS).o -c $(ACCESS).c $(CFLAGS)

$(CHGRP): $(CHGRP).o
	$(GCC) -o $(CHGRP) obj/$(CHGRP).o $(LDFLAGS)
$(CHGRP).o:
	$(GCC) -o obj/$(CHGRP).o -c $(CHGRP).c $(CFLAGS)

$(CHMOD): $(CHMOD).o
	$(GCC) -o $(CHMOD) obj/$(CHMOD).o $(LDFLAGS)
$(CHMOD).o:
	$(GCC) -o obj/$(CHMOD).o -c $(CHMOD).c $(CFLAGS)

$(CHOWN): $(CHOWN).o
	$(GCC) -o $(CHOWN) obj/$(CHOWN).o $(LDFLAGS)
$(CHOWN).o:
	$(GCC) -o obj/$(CHOWN).o -c $(CHOWN).c $(CFLAGS)

$(CLOSE): $(CLOSE).o
	$(GCC) -o $(CLOSE) obj/$(CLOSE).o $(LDFLAGS)
$(CLOSE).o:
	$(GCC) -o obj/$(CLOSE).o -c $(CLOSE).c $(CFLAGS)

$(DUP2): $(DUP2).o
	$(GCC) -o $(DUP2) obj/$(DUP2).o $(LDFLAGS)
$(DUP2).o:
	$(GCC) -o obj/$(DUP2).o -c $(DUP2).c $(CFLAGS)

$(DUP): $(DUP).o
	$(GCC) -o $(DUP) obj/$(DUP).o $(LDFLAGS)
$(DUP).o:
	$(GCC) -o obj/$(DUP).o -c $(DUP).c $(CFLAGS)

$(FCHMOD): $(FCHMOD).o
	$(GCC) -o $(FCHMOD) obj/$(FCHMOD).o $(LDFLAGS)
$(FCHMOD).o:
	$(GCC) -o obj/$(FCHMOD).o -c $(FCHMOD).c $(CFLAGS)

$(FCHOWN): $(FCHOWN).o
	$(GCC) -o $(FCHOWN) obj/$(FCHOWN).o $(LDFLAGS)
$(FCHOWN).o:
	$(GCC) -o obj/$(FCHOWN).o -c $(FCHOWN).c $(CFLAGS)

$(FCLOSE): $(FCLOSE).o
	$(GCC) -o $(FCLOSE) obj/$(FCLOSE).o $(LDFLAGS)
$(FCLOSE).o:
	$(GCC) -o obj/$(FCLOSE).o -c $(FCLOSE).c $(CFLAGS)

$(FCNTL): $(FCNTL).o
	$(GCC) -o $(FCNTL) obj/$(FCNTL).o $(LDFLAGS)
$(FCNTL).o:
	$(GCC) -o obj/$(FCNTL).o -c $(FCNTL).c $(CFLAGS)

$(FDATASYNC): $(FDATASYNC).o
	$(GCC) -o $(FDATASYNC) obj/$(FDATASYNC).o $(LDFLAGS)
$(FDATASYNC).o:
	$(GCC) -o obj/$(FDATASYNC).o -c $(FDATASYNC).c $(CFLAGS)

$(FDOPEN): $(FDOPEN).o
	$(GCC) -o $(FDOPEN) obj/$(FDOPEN).o $(LDFLAGS)
$(FDOPEN).o:
	$(GCC) -o obj/$(FDOPEN).o -c $(FDOPEN).c $(CFLAGS)

$(FEOF): $(FEOF).o
	$(GCC) -o $(FEOF) obj/$(FEOF).o $(LDFLAGS)
$(FEOF).o:
	$(GCC) -o obj/$(FEOF).o -c $(FEOF).c $(CFLAGS)

$(FERROR): $(FERROR).o
	$(GCC) -o $(FERROR) obj/$(FERROR).o $(LDFLAGS)
$(FERROR).o:
	$(GCC) -o obj/$(FERROR).o -c $(FERROR).c $(CFLAGS)

$(FFLUSH): $(FFLUSH).o
	$(GCC) -o $(FFLUSH) obj/$(FFLUSH).o $(LDFLAGS)
$(FFLUSH).o:
	$(GCC) -o obj/$(FFLUSH).o -c $(FFLUSH).c $(CFLAGS)

$(FGETC): $(FGETC).o
	$(GCC) -o $(FGETC) obj/$(FGETC).o $(LDFLAGS)
$(FGETC).o:
	$(GCC) -o obj/$(FGETC).o -c $(FGETC).c $(CFLAGS)

$(FGETPOS): $(FGETPOS).o
	$(GCC) -o $(FGETPOS) obj/$(FGETPOS).o $(LDFLAGS)
$(FGETPOS).o:
	$(GCC) -o obj/$(FGETPOS).o -c $(FGETPOS).c $(CFLAGS)

$(FGETS): $(FGETS).o
	$(GCC) -o $(FGETS) obj/$(FGETS).o $(LDFLAGS)
$(FGETS).o:
	$(GCC) -o obj/$(FGETS).o -c $(FGETS).c $(CFLAGS)

$(FILENO): $(FILENO).o
	$(GCC) -o $(FILENO) obj/$(FILENO).o $(LDFLAGS)
$(FILENO).o:
	$(GCC) -o obj/$(FILENO).o -c $(FILENO).c $(CFLAGS)

$(FLOCK): $(FLOCK).o
	$(GCC) -o $(FLOCK) obj/$(FLOCK).o $(LDFLAGS)
$(FLOCK).o:
	$(GCC) -o obj/$(FLOCK).o -c $(FLOCK).c $(CFLAGS)

$(FMEMOPEN): $(FMEMOPEN).o
	$(GCC) -o $(FMEMOPEN) obj/$(FMEMOPEN).o $(LDFLAGS)
$(FMEMOPEN).o:
	$(GCC) -o obj/$(FMEMOPEN).o -c $(FMEMOPEN).c $(CFLAGS)

$(FNMATCH): $(FNMATCH).o
	$(GCC) -o $(FNMATCH) obj/$(FNMATCH).o $(LDFLAGS)
$(FNMATCH).o:
	$(GCC) -o obj/$(FNMATCH).o -c $(FNMATCH).c $(CFLAGS)

$(FOPEN): $(FOPEN).o
	$(GCC) -o $(FOPEN) obj/$(FOPEN).o $(LDFLAGS)
$(FOPEN).o:
	$(GCC) -o obj/$(FOPEN).o -c $(FOPEN).c $(CFLAGS)

$(FPRINTF): $(FPRINTF).o
	$(GCC) -o $(FPRINTF) obj/$(FPRINTF).o $(LDFLAGS)
$(FPRINTF).o:
	$(GCC) -o obj/$(FPRINTF).o -c $(FPRINTF).c $(CFLAGS)

$(FPUTC): $(FPUTC).o
	$(GCC) -o $(FPUTC) obj/$(FPUTC).o $(LDFLAGS)
$(FPUTC).o:
	$(GCC) -o obj/$(FPUTC).o -c $(FPUTC).c $(CFLAGS)

$(FPUTS): $(FPUTS).o
	$(GCC) -o $(FPUTS) obj/$(FPUTS).o $(LDFLAGS)
$(FPUTS).o:
	$(GCC) -o obj/$(FPUTS).o -c $(FPUTS).c $(CFLAGS)

$(FREAD): $(FREAD).o
	$(GCC) -o $(FREAD) obj/$(FREAD).o $(LDFLAGS)
$(FREAD).o:
	$(GCC) -o obj/$(FREAD).o -c $(FREAD).c $(CFLAGS)

$(FREOPEN): $(FREOPEN).o
	$(GCC) -o $(FREOPEN) obj/$(FREOPEN).o $(LDFLAGS)
$(FREOPEN).o:
	$(GCC) -o obj/$(FREOPEN).o -c $(FREOPEN).c $(CFLAGS)

$(FSEEK): $(FSEEK).o
	$(GCC) -o $(FSEEK) obj/$(FSEEK).o $(LDFLAGS)
$(FSEEK).o:
	$(GCC) -o obj/$(FSEEK).o -c $(FSEEK).c $(CFLAGS)

$(FSETPOS): $(FSETPOS).o
	$(GCC) -o $(FSETPOS) obj/$(FSETPOS).o $(LDFLAGS)
$(FSETPOS).o:
	$(GCC) -o obj/$(FSETPOS).o -c $(FSETPOS).c $(CFLAGS)

$(FSTAT): $(FSTAT).o
	$(GCC) -o $(FSTAT) obj/$(FSTAT).o $(LDFLAGS)
$(FSTAT).o:
	$(GCC) -o obj/$(FSTAT).o -c $(FSTAT).c $(CFLAGS)

$(FSYNC): $(FSYNC).o
	$(GCC) -o $(FSYNC) obj/$(FSYNC).o $(LDFLAGS)
$(FSYNC).o:
	$(GCC) -o obj/$(FSYNC).o -c $(FSYNC).c $(CFLAGS)

$(FTELL): $(FTELL).o
	$(GCC) -o $(FTELL) obj/$(FTELL).o $(LDFLAGS)
$(FTELL).o:
	$(GCC) -o obj/$(FTELL).o -c $(FTELL).c $(CFLAGS)

$(FTRUNCATE): $(FTRUNCATE).o
	$(GCC) -o $(FTRUNCATE) obj/$(FTRUNCATE).o $(LDFLAGS)
$(FTRUNCATE).o:
	$(GCC) -o obj/$(FTRUNCATE).o -c $(FTRUNCATE).c $(CFLAGS)

$(FUTIMES): $(FUTIMES).o
	$(GCC) -o $(FUTIMES) obj/$(FUTIMES).o $(LDFLAGS)
$(FUTIMES).o:
	$(GCC) -o obj/$(FUTIMES).o -c $(FUTIMES).c $(CFLAGS)

$(FWRITE): $(FWRITE).o
	$(GCC) -o $(FWRITE) obj/$(FWRITE).o $(LDFLAGS)
$(FWRITE).o:
	$(GCC) -o obj/$(FWRITE).o -c $(FWRITE).c $(CFLAGS)

$(GETC): $(GETC).o
	$(GCC) -o $(GETC) obj/$(GETC).o $(LDFLAGS)
$(GETC).o:
	$(GCC) -o obj/$(GETC).o -c $(GETC).c $(CFLAGS)

$(GETDELIM): $(GETDELIM).o
	$(GCC) -o $(GETDELIM) obj/$(GETDELIM).o $(LDFLAGS)
$(GETDELIM).o:
	$(GCC) -o obj/$(GETDELIM).o -c $(GETDELIM).c $(CFLAGS)

$(GETDTABLESIZE): $(GETDTABLESIZE).o
	$(GCC) -o $(GETDTABLESIZE) obj/$(GETDTABLESIZE).o $(LDFLAGS)
$(GETDTABLESIZE).o:
	$(GCC) -o obj/$(GETDTABLESIZE).o -c $(GETDTABLESIZE).c $(CFLAGS)

$(GETLINE): $(GETLINE).o
	$(GCC) -o $(GETLINE) obj/$(GETLINE).o $(LDFLAGS)
$(GETLINE).o:
	$(GCC) -o obj/$(GETLINE).o -c $(GETLINE).c $(CFLAGS)

$(GETW): $(GETW).o
	$(GCC) -o $(GETW) obj/$(GETW).o $(LDFLAGS)
$(GETW).o:
	$(GCC) -o obj/$(GETW).o -c $(GETW).c $(CFLAGS)

$(LCHMOD): $(LCHMOD).o
	$(GCC) -o $(LCHMOD) obj/$(LCHMOD).o $(LDFLAGS)
$(LCHMOD).o:
	$(GCC) -o obj/$(LCHMOD).o -c $(LCHMOD).c $(CFLAGS)

$(LCHOWN): $(LCHOWN).o
	$(GCC) -o $(LCHOWN) obj/$(LCHOWN).o $(LDFLAGS)
$(LCHOWN).o:
	$(GCC) -o obj/$(LCHOWN).o -c $(LCHOWN).c $(CFLAGS)

$(LINK): $(LINK).o
	$(GCC) -o $(LINK) obj/$(LINK).o $(LDFLAGS)
$(LINK).o:
	$(GCC) -o obj/$(LINK).o -c $(LINK).c $(CFLAGS)

$(LOCKF): $(LOCKF).o
	$(GCC) -o $(LOCKF) obj/$(LOCKF).o $(LDFLAGS)
$(LOCKF).o:
	$(GCC) -o obj/$(LOCKF).o -c $(LOCKF).c $(CFLAGS)

$(LSEEK): $(LSEEK).o
	$(GCC) -o $(LSEEK) obj/$(LSEEK).o $(LDFLAGS)
$(LSEEK).o:
	$(GCC) -o obj/$(LSEEK).o -c $(LSEEK).c $(CFLAGS)

$(LSTAT): $(LSTAT).o
	$(GCC) -o $(LSTAT) obj/$(LSTAT).o $(LDFLAGS)
$(LSTAT).o:
	$(GCC) -o obj/$(LSTAT).o -c $(LSTAT).c $(CFLAGS)

$(LUTIMES): $(LUTIMES).o
	$(GCC) -o $(LUTIMES) obj/$(LUTIMES).o $(LDFLAGS)
$(LUTIMES).o:
	$(GCC) -o obj/$(LUTIMES).o -c $(LUTIMES).c $(CFLAGS)

$(MKDTEMP): $(MKDTEMP).o
	$(GCC) -o $(MKDTEMP) obj/$(MKDTEMP).o $(LDFLAGS)
$(MKDTEMP).o:
	$(GCC) -o obj/$(MKDTEMP).o -c $(MKDTEMP).c $(CFLAGS)

$(MKFIFO): $(MKFIFO).o
	$(GCC) -o $(MKFIFO) obj/$(MKFIFO).o $(LDFLAGS)
$(MKFIFO).o:
	$(GCC) -o obj/$(MKFIFO).o -c $(MKFIFO).c $(CFLAGS)

$(MKNOD): $(MKNOD).o
	$(GCC) -o $(MKNOD) obj/$(MKNOD).o $(LDFLAGS)
$(MKNOD).o:
	$(GCC) -o obj/$(MKNOD).o -c $(MKNOD).c $(CFLAGS)

$(MKSTEMP): $(MKSTEMP).o
	$(GCC) -o $(MKSTEMP) obj/$(MKSTEMP).o $(LDFLAGS)
$(MKSTEMP).o:
	$(GCC) -o obj/$(MKSTEMP).o -c $(MKSTEMP).c $(CFLAGS)

$(MKTEMP): $(MKTEMP).o
	$(GCC) -o $(MKTEMP) obj/$(MKTEMP).o $(LDFLAGS)
$(MKTEMP).o:
	$(GCC) -o obj/$(MKTEMP).o -c $(MKTEMP).c $(CFLAGS)

$(OPEN): $(OPEN).o
	$(GCC) -o $(OPEN) obj/$(OPEN).o $(LDFLAGS)
$(OPEN).o:
	$(GCC) -o obj/$(OPEN).o -c $(OPEN).c $(CFLAGS)

$(OPEN_MEMSTREAM): $(OPEN_MEMSTREAM).o
	$(GCC) -o $(OPEN_MEMSTREAM) obj/$(OPEN_MEMSTREAM).o $(LDFLAGS)
$(OPEN_MEMSTREAM).o:
	$(GCC) -o obj/$(OPEN_MEMSTREAM).o -c $(OPEN_MEMSTREAM).c $(CFLAGS)

$(PREAD): $(PREAD).o
	$(GCC) -o $(PREAD) obj/$(PREAD).o $(LDFLAGS)
$(PREAD).o:
	$(GCC) -o obj/$(PREAD).o -c $(PREAD).c $(CFLAGS)

$(PUTC): $(PUTC).o
	$(GCC) -o $(PUTC) obj/$(PUTC).o $(LDFLAGS)
$(PUTC).o:
	$(GCC) -o obj/$(PUTC).o -c $(PUTC).c $(CFLAGS)

$(PUTW): $(PUTW).o
	$(GCC) -o $(PUTW) obj/$(PUTW).o $(LDFLAGS)
$(PUTW).o:
	$(GCC) -o obj/$(PUTW).o -c $(PUTW).c $(CFLAGS)

$(PWRITE): $(PWRITE).o
	$(GCC) -o $(PWRITE) obj/$(PWRITE).o $(LDFLAGS)
$(PWRITE).o:
	$(GCC) -o obj/$(PWRITE).o -c $(PWRITE).c $(CFLAGS)

$(READ): $(READ).o
	$(GCC) -o $(READ) obj/$(READ).o $(LDFLAGS)
$(READ).o:
	$(GCC) -o obj/$(READ).o -c $(READ).c $(CFLAGS)

$(READ_LINES): $(READ_LINES).o
	$(GCC) -o $(READ_LINES) obj/$(READ_LINES).o $(LDFLAGS)
$(READ_LINES).o:
	$(GCC) -o obj/$(READ_LINES).o -c $(READ_LINES).c $(CFLAGS)

$(READLINK): $(READLINK).o
	$(GCC) -o $(READLINK) obj/$(READLINK).o $(LDFLAGS)
$(READLINK).o:
	$(GCC) -o obj/$(READLINK).o -c $(READLINK).c $(CFLAGS)

$(REALPATH): $(REALPATH).o
	$(GCC) -o $(REALPATH) obj/$(REALPATH).o $(LDFLAGS)
$(REALPATH).o:
	$(GCC) -o obj/$(REALPATH).o -c $(REALPATH).c $(CFLAGS)

$(REMOVE): $(REMOVE).o
	$(GCC) -o $(REMOVE) obj/$(REMOVE).o $(LDFLAGS)
$(REMOVE).o:
	$(GCC) -o obj/$(REMOVE).o -c $(REMOVE).c $(CFLAGS)

$(RENAME): $(RENAME).o
	$(GCC) -o $(RENAME) obj/$(RENAME).o $(LDFLAGS)
$(RENAME).o:
	$(GCC) -o obj/$(RENAME).o -c $(RENAME).c $(CFLAGS)

$(REWIND): $(REWIND).o
	$(GCC) -o $(REWIND) obj/$(REWIND).o $(LDFLAGS)
$(REWIND).o:
	$(GCC) -o obj/$(REWIND).o -c $(REWIND).c $(CFLAGS)

$(SETBUF): $(SETBUF).o
	$(GCC) -o $(SETBUF) obj/$(SETBUF).o $(LDFLAGS)
$(SETBUF).o:
	$(GCC) -o obj/$(SETBUF).o -c $(SETBUF).c $(CFLAGS)

$(SETBUFFER): $(SETBUFFER).o
	$(GCC) -o $(SETBUFFER) obj/$(SETBUFFER).o $(LDFLAGS)
$(SETBUFFER).o:
	$(GCC) -o obj/$(SETBUFFER).o -c $(SETBUFFER).c $(CFLAGS)

$(SETLINEBUF): $(SETLINEBUF).o
	$(GCC) -o $(SETLINEBUF) obj/$(SETLINEBUF).o $(LDFLAGS)
$(SETLINEBUF).o:
	$(GCC) -o obj/$(SETLINEBUF).o -c $(SETLINEBUF).c $(CFLAGS)

$(SETVBUF): $(SETVBUF).o
	$(GCC) -o $(SETVBUF) obj/$(SETVBUF).o $(LDFLAGS)
$(SETVBUF).o:
	$(GCC) -o obj/$(SETVBUF).o -c $(SETVBUF).c $(CFLAGS)

$(STAT): $(STAT).o
	$(GCC) -o $(STAT) obj/$(STAT).o $(LDFLAGS)
$(STAT).o:
	$(GCC) -o obj/$(STAT).o -c $(STAT).c $(CFLAGS)

$(STATFS): $(STATFS).o
	$(GCC) -o $(STATFS) obj/$(STATFS).o $(LDFLAGS)
$(STATFS).o:
	$(GCC) -o obj/$(STATFS).o -c $(STATFS).c $(CFLAGS)

$(STATVFS): $(STATVFS).o
	$(GCC) -o $(STATVFS) obj/$(STATVFS).o $(LDFLAGS)
$(STATVFS).o:
	$(GCC) -o obj/$(STATVFS).o -c $(STATVFS).c $(CFLAGS)

$(STDERR): $(STDERR).o
	$(GCC) -o $(STDERR) obj/$(STDERR).o $(LDFLAGS)
$(STDERR).o:
	$(GCC) -o obj/$(STDERR).o -c $(STDERR).c $(CFLAGS)

$(STDIN): $(STDIN).o
	$(GCC) -o $(STDIN) obj/$(STDIN).o $(LDFLAGS)
$(STDIN).o:
	$(GCC) -o obj/$(STDIN).o -c $(STDIN).c $(CFLAGS)

$(STDOUT): $(STDOUT).o
	$(GCC) -o $(STDOUT) obj/$(STDOUT).o $(LDFLAGS)
$(STDOUT).o:
	$(GCC) -o obj/$(STDOUT).o -c $(STDOUT).c $(CFLAGS)

$(SYMLINK): $(SYMLINK).o
	$(GCC) -o $(SYMLINK) obj/$(SYMLINK).o $(LDFLAGS)
$(SYMLINK).o:
	$(GCC) -o obj/$(SYMLINK).o -c $(SYMLINK).c $(CFLAGS)

$(SYNC): $(SYNC).o
	$(GCC) -o $(SYNC) obj/$(SYNC).o $(LDFLAGS)
$(SYNC).o:
	$(GCC) -o obj/$(SYNC).o -c $(SYNC).c $(CFLAGS)

$(TEMPNAM): $(TEMPNAM).o
	$(GCC) -o $(TEMPNAM) obj/$(TEMPNAM).o $(LDFLAGS)
$(TEMPNAM).o:
	$(GCC) -o obj/$(TEMPNAM).o -c $(TEMPNAM).c $(CFLAGS)

$(TMPFILE): $(TMPFILE).o
	$(GCC) -o $(TMPFILE) obj/$(TMPFILE).o $(LDFLAGS)
$(TMPFILE).o:
	$(GCC) -o obj/$(TMPFILE).o -c $(TMPFILE).c $(CFLAGS)

$(TMPNAM): $(TMPNAM).o
	$(GCC) -o $(TMPNAM) obj/$(TMPNAM).o $(LDFLAGS)
$(TMPNAM).o:
	$(GCC) -o obj/$(TMPNAM).o -c $(TMPNAM).c $(CFLAGS)

$(TRUNCATE): $(TRUNCATE).o
	$(GCC) -o $(TRUNCATE) obj/$(TRUNCATE).o $(LDFLAGS)
$(TRUNCATE).o:
	$(GCC) -o obj/$(TRUNCATE).o -c $(TRUNCATE).c $(CFLAGS)

$(UNGETC): $(UNGETC).o
	$(GCC) -o $(UNGETC) obj/$(UNGETC).o $(LDFLAGS)
$(UNGETC).o:
	$(GCC) -o obj/$(UNGETC).o -c $(UNGETC).c $(CFLAGS)

$(UNLINK): $(UNLINK).o
	$(GCC) -o $(UNLINK) obj/$(UNLINK).o $(LDFLAGS)
$(UNLINK).o:
	$(GCC) -o obj/$(UNLINK).o -c $(UNLINK).c $(CFLAGS)

$(UTIMES): $(UTIMES).o
	$(GCC) -o $(UTIMES) obj/$(UTIMES).o $(LDFLAGS)
$(UTIMES).o:
	$(GCC) -o obj/$(UTIMES).o -c $(UTIMES).c $(CFLAGS)

$(VFPRINTF): $(VFPRINTF).o
	$(GCC) -o $(VFPRINTF) obj/$(VFPRINTF).o $(LDFLAGS)
$(VFPRINTF).o:
	$(GCC) -o obj/$(VFPRINTF).o -c $(VFPRINTF).c $(CFLAGS)

$(WRITE): $(WRITE).o
	$(GCC) -o $(WRITE) obj/$(WRITE).o $(LDFLAGS)
$(WRITE).o:
	$(GCC) -o obj/$(WRITE).o -c $(WRITE).c $(CFLAGS)



#top Makefile.win


SELECT ALL
# Project: Project
# Makefile created

GCC         = gcc
INCS        =
CFLAGS      = $(INCS) -W -O2 -Wall -pedantic -Wstrict-aliasing -Wno-long-long -D_FILE_OFFSET_BITS=64 -D_LINUX -D_REENTRANT
CFLAGS      = $(INCS) -W -O2 -Wall -pedantic -Wstrict-aliasing -Wno-long-long
LIBS        = -lm
LIBDIRS     =
LDFLAGS     = $(LIBDIRS) $(LIBS)
RM          = del /q /s
MKDCMD      = mkdir

ACCESS      = access
CHGRP       = chgrp
CHMOD       = chmod
CHOWN       = chown
CLOSE       = close
DUP2        = dup2
DUP         = dup
FCHMOD      = fchmod
FCHOWN      = fchown
FCLOSE      = fclose
FCNTL       = fcntl
FDATASYNC   = fdatasync
FDOPEN      = fdopen
FEOF        = feof
FERROR      = ferror
FFLUSH      = fflush
FGETC       = fgetc
FGETPOS     = fgetpos
FGETS       = fgets
FILENO      = fileno
FLOCK       = flock
FMEMOPEN    = fmemopen
FNMATCH     = fnmatch
FOPEN       = fopen
FPRINTF     = fprintf
FPUTC       = fputc
FPUTS       = fputs
FREAD       = fread
FREOPEN     = freopen
FSEEK       = fseek
FSETPOS     = fsetpos
FSTAT       = fstat
FSYNC       = fsync
FTELL       = ftell
FTRUNCATE   = ftruncate
FUTIMES     = futimes
FWRITE      = fwrite
GETC        = getc
GETDELIM    = getdelim
GETDTABLESIZE= getdtablesize
GETLINE     = getline
GETW        = getw
LCHMOD      = lchmod
LCHOWN      = lchown
LINK        = link
LOCKF       = lockf
LSEEK       = lseek
LSTAT       = lstat
LUTIMES     = lutimes
MKDTEMP     = mkdtemp
MKFIFO      = mkfifo
MKNOD       = mknod
MKSTEMP     = mkstemp
MKTEMP      = mktemp
OPEN        = open
OPEN_MEMSTREAM= open_memstream
PREAD       = pread
PUTC        = putc
PUTW        = putw
PWRITE      = pwrite
READ        = read
READ_LINES  = read-lines
READLINK    = readlink
REALPATH    = realpath
REMOVE      = remove
RENAME      = rename
REWIND      = rewind
SETBUF      = setbuf
SETBUFFER   = setbuffer
SETLINEBUF  = setlinebuf
SETVBUF     = setvbuf
STAT        = stat
STATFS      = statfs
STATVFS     = statvfs
STDERR      = stderr
STDIN       = stdin
STDOUT      = stdout
SYMLINK     = symlink
SYNC        = sync
TEMPNAM     = tempnam
TMPFILE     = tmpfile
TMPNAM      = tmpnam
TRUNCATE    = truncate
UNGETC      = ungetc
UNLINK      = unlink
UTIMES      = utimes
VFPRINTF    = vfprintf
WRITE       = write



all: make

objdir:
	$(MKDCMD) obj\

clean:
	$(RM) obj\*.o *.o *~

#make: $(ACCESS)
#make: $(CHGRP)
#make: $(CHMOD)
#make: $(CHOWN)
#make: $(CLOSE)
#make: $(DUP2)
#make: $(DUP)
#make: $(FCHMOD)
#make: $(FCHOWN)
#make: $(FCLOSE)
#make: $(FCNTL)
#make: $(FDATASYNC)
#make: $(FDOPEN)
#make: $(FEOF)
#make: $(FERROR)
#make: $(FFLUSH)
#make: $(FGETC)
#make: $(FGETPOS)
#make: $(FGETS)
#make: $(FILENO)
#make: $(FLOCK)
#make: $(FMEMOPEN)
#make: $(FNMATCH)
#make: $(FOPEN)
#make: $(FPRINTF)
#make: $(FPUTC)
#make: $(FPUTS)
#make: $(FREAD)
#make: $(FREOPEN)
#make: $(FSEEK)
#make: $(FSETPOS)
#make: $(FSTAT)
#make: $(FSYNC)
#make: $(FTELL)
#make: $(FTRUNCATE)
#make: $(FUTIMES)
#make: $(FWRITE)
#make: $(GETC)
#make: $(GETDELIM)
#make: $(GETDTABLESIZE)
#make: $(GETLINE)
#make: $(GETW)
#make: $(LCHMOD)
#make: $(LCHOWN)
#make: $(LINK)
#make: $(LOCKF)
#make: $(LSEEK)
#make: $(LSTAT)
#make: $(LUTIMES)
#make: $(MKDTEMP)
#make: $(MKFIFO)
#make: $(MKNOD)
#make: $(MKSTEMP)
#make: $(MKTEMP)
#make: $(OPEN)
#make: $(OPEN_MEMSTREAM)
#make: $(PREAD)
#make: $(PUTC)
#make: $(PUTW)
#make: $(PWRITE)
#make: $(READ)
#make: $(READ_LINES)
#make: $(READLINK)
#make: $(REALPATH)
#make: $(REMOVE)
#make: $(RENAME)
#make: $(REWIND)
#make: $(SETBUF)
#make: $(SETBUFFER)
#make: $(SETLINEBUF)
#make: $(SETVBUF)
#make: $(STAT)
#make: $(STATFS)
#make: $(STATVFS)
#make: $(STDERR)
#make: $(STDIN)
#make: $(STDOUT)
#make: $(SYMLINK)
#make: $(SYNC)
#make: $(TEMPNAM)
#make: $(TMPFILE)
#make: $(TMPNAM)
#make: $(TRUNCATE)
#make: $(UNGETC)
#make: $(UNLINK)
#make: $(UTIMES)
#make: $(VFPRINTF)
#make: $(WRITE)
make: $(ACCESS) $(CHGRP) $(CHMOD) $(CHOWN) $(CLOSE) $(DUP2) $(DUP) $(FCHMOD) $(FCHOWN) $(FCLOSE) $(FCNTL) $(FDATASYNC) $(FDOPEN) $(FEOF) $(FERROR) $(FFLUSH) $(FGETC) $(FGETPOS) $(FGETS) $(FILENO) $(FLOCK) $(FMEMOPEN) $(FNMATCH) $(FOPEN) $(FPRINTF) $(FPUTC) $(FPUTS) $(FREAD) $(FREOPEN) $(FSEEK) $(FSETPOS) $(FSTAT) $(FSYNC) $(FTELL) $(FTRUNCATE) $(FUTIMES) $(FWRITE) $(GETC) $(GETDELIM) $(GETDTABLESIZE) $(GETLINE) $(GETW) $(LCHMOD) $(LCHOWN) $(LINK) $(LOCKF) $(LSEEK) $(LSTAT) $(LUTIMES) $(MKDTEMP) $(MKFIFO) $(MKNOD) $(MKSTEMP) $(MKTEMP) $(OPEN) $(OPEN_MEMSTREAM) $(PREAD) $(PUTC) $(PUTW) $(PWRITE) $(READ) $(READ_LINES) $(READLINK) $(REALPATH) $(REMOVE) $(RENAME) $(REWIND) $(SETBUF) $(SETBUFFER) $(SETLINEBUF) $(SETVBUF) $(STAT) $(STATFS) $(STATVFS) $(STDERR) $(STDIN) $(STDOUT) $(SYMLINK) $(SYNC) $(TEMPNAM) $(TMPFILE) $(TMPNAM) $(TRUNCATE) $(UNGETC) $(UNLINK) $(UTIMES) $(VFPRINTF) $(WRITE)



$(ACCESS): $(ACCESS).o
	$(GCC) -o $(ACCESS) obj/$(ACCESS).o $(LDFLAGS)
$(ACCESS).o:
	$(GCC) -o obj/$(ACCESS).o -c $(ACCESS).c $(CFLAGS)

$(CHGRP): $(CHGRP).o
	$(GCC) -o $(CHGRP) obj/$(CHGRP).o $(LDFLAGS)
$(CHGRP).o:
	$(GCC) -o obj/$(CHGRP).o -c $(CHGRP).c $(CFLAGS)

$(CHMOD): $(CHMOD).o
	$(GCC) -o $(CHMOD) obj/$(CHMOD).o $(LDFLAGS)
$(CHMOD).o:
	$(GCC) -o obj/$(CHMOD).o -c $(CHMOD).c $(CFLAGS)

$(CHOWN): $(CHOWN).o
	$(GCC) -o $(CHOWN) obj/$(CHOWN).o $(LDFLAGS)
$(CHOWN).o:
	$(GCC) -o obj/$(CHOWN).o -c $(CHOWN).c $(CFLAGS)

$(CLOSE): $(CLOSE).o
	$(GCC) -o $(CLOSE) obj/$(CLOSE).o $(LDFLAGS)
$(CLOSE).o:
	$(GCC) -o obj/$(CLOSE).o -c $(CLOSE).c $(CFLAGS)

$(DUP2): $(DUP2).o
	$(GCC) -o $(DUP2) obj/$(DUP2).o $(LDFLAGS)
$(DUP2).o:
	$(GCC) -o obj/$(DUP2).o -c $(DUP2).c $(CFLAGS)

$(DUP): $(DUP).o
	$(GCC) -o $(DUP) obj/$(DUP).o $(LDFLAGS)
$(DUP).o:
	$(GCC) -o obj/$(DUP).o -c $(DUP).c $(CFLAGS)

$(FCHMOD): $(FCHMOD).o
	$(GCC) -o $(FCHMOD) obj/$(FCHMOD).o $(LDFLAGS)
$(FCHMOD).o:
	$(GCC) -o obj/$(FCHMOD).o -c $(FCHMOD).c $(CFLAGS)

$(FCHOWN): $(FCHOWN).o
	$(GCC) -o $(FCHOWN) obj/$(FCHOWN).o $(LDFLAGS)
$(FCHOWN).o:
	$(GCC) -o obj/$(FCHOWN).o -c $(FCHOWN).c $(CFLAGS)

$(FCLOSE): $(FCLOSE).o
	$(GCC) -o $(FCLOSE) obj/$(FCLOSE).o $(LDFLAGS)
$(FCLOSE).o:
	$(GCC) -o obj/$(FCLOSE).o -c $(FCLOSE).c $(CFLAGS)

$(FCNTL): $(FCNTL).o
	$(GCC) -o $(FCNTL) obj/$(FCNTL).o $(LDFLAGS)
$(FCNTL).o:
	$(GCC) -o obj/$(FCNTL).o -c $(FCNTL).c $(CFLAGS)

$(FDATASYNC): $(FDATASYNC).o
	$(GCC) -o $(FDATASYNC) obj/$(FDATASYNC).o $(LDFLAGS)
$(FDATASYNC).o:
	$(GCC) -o obj/$(FDATASYNC).o -c $(FDATASYNC).c $(CFLAGS)

$(FDOPEN): $(FDOPEN).o
	$(GCC) -o $(FDOPEN) obj/$(FDOPEN).o $(LDFLAGS)
$(FDOPEN).o:
	$(GCC) -o obj/$(FDOPEN).o -c $(FDOPEN).c $(CFLAGS)

$(FEOF): $(FEOF).o
	$(GCC) -o $(FEOF) obj/$(FEOF).o $(LDFLAGS)
$(FEOF).o:
	$(GCC) -o obj/$(FEOF).o -c $(FEOF).c $(CFLAGS)

$(FERROR): $(FERROR).o
	$(GCC) -o $(FERROR) obj/$(FERROR).o $(LDFLAGS)
$(FERROR).o:
	$(GCC) -o obj/$(FERROR).o -c $(FERROR).c $(CFLAGS)

$(FFLUSH): $(FFLUSH).o
	$(GCC) -o $(FFLUSH) obj/$(FFLUSH).o $(LDFLAGS)
$(FFLUSH).o:
	$(GCC) -o obj/$(FFLUSH).o -c $(FFLUSH).c $(CFLAGS)

$(FGETC): $(FGETC).o
	$(GCC) -o $(FGETC) obj/$(FGETC).o $(LDFLAGS)
$(FGETC).o:
	$(GCC) -o obj/$(FGETC).o -c $(FGETC).c $(CFLAGS)

$(FGETPOS): $(FGETPOS).o
	$(GCC) -o $(FGETPOS) obj/$(FGETPOS).o $(LDFLAGS)
$(FGETPOS).o:
	$(GCC) -o obj/$(FGETPOS).o -c $(FGETPOS).c $(CFLAGS)

$(FGETS): $(FGETS).o
	$(GCC) -o $(FGETS) obj/$(FGETS).o $(LDFLAGS)
$(FGETS).o:
	$(GCC) -o obj/$(FGETS).o -c $(FGETS).c $(CFLAGS)

$(FILENO): $(FILENO).o
	$(GCC) -o $(FILENO) obj/$(FILENO).o $(LDFLAGS)
$(FILENO).o:
	$(GCC) -o obj/$(FILENO).o -c $(FILENO).c $(CFLAGS)

$(FLOCK): $(FLOCK).o
	$(GCC) -o $(FLOCK) obj/$(FLOCK).o $(LDFLAGS)
$(FLOCK).o:
	$(GCC) -o obj/$(FLOCK).o -c $(FLOCK).c $(CFLAGS)

$(FMEMOPEN): $(FMEMOPEN).o
	$(GCC) -o $(FMEMOPEN) obj/$(FMEMOPEN).o $(LDFLAGS)
$(FMEMOPEN).o:
	$(GCC) -o obj/$(FMEMOPEN).o -c $(FMEMOPEN).c $(CFLAGS)

$(FNMATCH): $(FNMATCH).o
	$(GCC) -o $(FNMATCH) obj/$(FNMATCH).o $(LDFLAGS)
$(FNMATCH).o:
	$(GCC) -o obj/$(FNMATCH).o -c $(FNMATCH).c $(CFLAGS)

$(FOPEN): $(FOPEN).o
	$(GCC) -o $(FOPEN) obj/$(FOPEN).o $(LDFLAGS)
$(FOPEN).o:
	$(GCC) -o obj/$(FOPEN).o -c $(FOPEN).c $(CFLAGS)

$(FPRINTF): $(FPRINTF).o
	$(GCC) -o $(FPRINTF) obj/$(FPRINTF).o $(LDFLAGS)
$(FPRINTF).o:
	$(GCC) -o obj/$(FPRINTF).o -c $(FPRINTF).c $(CFLAGS)

$(FPUTC): $(FPUTC).o
	$(GCC) -o $(FPUTC) obj/$(FPUTC).o $(LDFLAGS)
$(FPUTC).o:
	$(GCC) -o obj/$(FPUTC).o -c $(FPUTC).c $(CFLAGS)

$(FPUTS): $(FPUTS).o
	$(GCC) -o $(FPUTS) obj/$(FPUTS).o $(LDFLAGS)
$(FPUTS).o:
	$(GCC) -o obj/$(FPUTS).o -c $(FPUTS).c $(CFLAGS)

$(FREAD): $(FREAD).o
	$(GCC) -o $(FREAD) obj/$(FREAD).o $(LDFLAGS)
$(FREAD).o:
	$(GCC) -o obj/$(FREAD).o -c $(FREAD).c $(CFLAGS)

$(FREOPEN): $(FREOPEN).o
	$(GCC) -o $(FREOPEN) obj/$(FREOPEN).o $(LDFLAGS)
$(FREOPEN).o:
	$(GCC) -o obj/$(FREOPEN).o -c $(FREOPEN).c $(CFLAGS)

$(FSEEK): $(FSEEK).o
	$(GCC) -o $(FSEEK) obj/$(FSEEK).o $(LDFLAGS)
$(FSEEK).o:
	$(GCC) -o obj/$(FSEEK).o -c $(FSEEK).c $(CFLAGS)

$(FSETPOS): $(FSETPOS).o
	$(GCC) -o $(FSETPOS) obj/$(FSETPOS).o $(LDFLAGS)
$(FSETPOS).o:
	$(GCC) -o obj/$(FSETPOS).o -c $(FSETPOS).c $(CFLAGS)

$(FSTAT): $(FSTAT).o
	$(GCC) -o $(FSTAT) obj/$(FSTAT).o $(LDFLAGS)
$(FSTAT).o:
	$(GCC) -o obj/$(FSTAT).o -c $(FSTAT).c $(CFLAGS)

$(FSYNC): $(FSYNC).o
	$(GCC) -o $(FSYNC) obj/$(FSYNC).o $(LDFLAGS)
$(FSYNC).o:
	$(GCC) -o obj/$(FSYNC).o -c $(FSYNC).c $(CFLAGS)

$(FTELL): $(FTELL).o
	$(GCC) -o $(FTELL) obj/$(FTELL).o $(LDFLAGS)
$(FTELL).o:
	$(GCC) -o obj/$(FTELL).o -c $(FTELL).c $(CFLAGS)

$(FTRUNCATE): $(FTRUNCATE).o
	$(GCC) -o $(FTRUNCATE) obj/$(FTRUNCATE).o $(LDFLAGS)
$(FTRUNCATE).o:
	$(GCC) -o obj/$(FTRUNCATE).o -c $(FTRUNCATE).c $(CFLAGS)

$(FUTIMES): $(FUTIMES).o
	$(GCC) -o $(FUTIMES) obj/$(FUTIMES).o $(LDFLAGS)
$(FUTIMES).o:
	$(GCC) -o obj/$(FUTIMES).o -c $(FUTIMES).c $(CFLAGS)

$(FWRITE): $(FWRITE).o
	$(GCC) -o $(FWRITE) obj/$(FWRITE).o $(LDFLAGS)
$(FWRITE).o:
	$(GCC) -o obj/$(FWRITE).o -c $(FWRITE).c $(CFLAGS)

$(GETC): $(GETC).o
	$(GCC) -o $(GETC) obj/$(GETC).o $(LDFLAGS)
$(GETC).o:
	$(GCC) -o obj/$(GETC).o -c $(GETC).c $(CFLAGS)

$(GETDELIM): $(GETDELIM).o
	$(GCC) -o $(GETDELIM) obj/$(GETDELIM).o $(LDFLAGS)
$(GETDELIM).o:
	$(GCC) -o obj/$(GETDELIM).o -c $(GETDELIM).c $(CFLAGS)

$(GETDTABLESIZE): $(GETDTABLESIZE).o
	$(GCC) -o $(GETDTABLESIZE) obj/$(GETDTABLESIZE).o $(LDFLAGS)
$(GETDTABLESIZE).o:
	$(GCC) -o obj/$(GETDTABLESIZE).o -c $(GETDTABLESIZE).c $(CFLAGS)

$(GETLINE): $(GETLINE).o
	$(GCC) -o $(GETLINE) obj/$(GETLINE).o $(LDFLAGS)
$(GETLINE).o:
	$(GCC) -o obj/$(GETLINE).o -c $(GETLINE).c $(CFLAGS)

$(GETW): $(GETW).o
	$(GCC) -o $(GETW) obj/$(GETW).o $(LDFLAGS)
$(GETW).o:
	$(GCC) -o obj/$(GETW).o -c $(GETW).c $(CFLAGS)

$(LCHMOD): $(LCHMOD).o
	$(GCC) -o $(LCHMOD) obj/$(LCHMOD).o $(LDFLAGS)
$(LCHMOD).o:
	$(GCC) -o obj/$(LCHMOD).o -c $(LCHMOD).c $(CFLAGS)

$(LCHOWN): $(LCHOWN).o
	$(GCC) -o $(LCHOWN) obj/$(LCHOWN).o $(LDFLAGS)
$(LCHOWN).o:
	$(GCC) -o obj/$(LCHOWN).o -c $(LCHOWN).c $(CFLAGS)

$(LINK): $(LINK).o
	$(GCC) -o $(LINK) obj/$(LINK).o $(LDFLAGS)
$(LINK).o:
	$(GCC) -o obj/$(LINK).o -c $(LINK).c $(CFLAGS)

$(LOCKF): $(LOCKF).o
	$(GCC) -o $(LOCKF) obj/$(LOCKF).o $(LDFLAGS)
$(LOCKF).o:
	$(GCC) -o obj/$(LOCKF).o -c $(LOCKF).c $(CFLAGS)

$(LSEEK): $(LSEEK).o
	$(GCC) -o $(LSEEK) obj/$(LSEEK).o $(LDFLAGS)
$(LSEEK).o:
	$(GCC) -o obj/$(LSEEK).o -c $(LSEEK).c $(CFLAGS)

$(LSTAT): $(LSTAT).o
	$(GCC) -o $(LSTAT) obj/$(LSTAT).o $(LDFLAGS)
$(LSTAT).o:
	$(GCC) -o obj/$(LSTAT).o -c $(LSTAT).c $(CFLAGS)

$(LUTIMES): $(LUTIMES).o
	$(GCC) -o $(LUTIMES) obj/$(LUTIMES).o $(LDFLAGS)
$(LUTIMES).o:
	$(GCC) -o obj/$(LUTIMES).o -c $(LUTIMES).c $(CFLAGS)

$(MKDTEMP): $(MKDTEMP).o
	$(GCC) -o $(MKDTEMP) obj/$(MKDTEMP).o $(LDFLAGS)
$(MKDTEMP).o:
	$(GCC) -o obj/$(MKDTEMP).o -c $(MKDTEMP).c $(CFLAGS)

$(MKFIFO): $(MKFIFO).o
	$(GCC) -o $(MKFIFO) obj/$(MKFIFO).o $(LDFLAGS)
$(MKFIFO).o:
	$(GCC) -o obj/$(MKFIFO).o -c $(MKFIFO).c $(CFLAGS)

$(MKNOD): $(MKNOD).o
	$(GCC) -o $(MKNOD) obj/$(MKNOD).o $(LDFLAGS)
$(MKNOD).o:
	$(GCC) -o obj/$(MKNOD).o -c $(MKNOD).c $(CFLAGS)

$(MKSTEMP): $(MKSTEMP).o
	$(GCC) -o $(MKSTEMP) obj/$(MKSTEMP).o $(LDFLAGS)
$(MKSTEMP).o:
	$(GCC) -o obj/$(MKSTEMP).o -c $(MKSTEMP).c $(CFLAGS)

$(MKTEMP): $(MKTEMP).o
	$(GCC) -o $(MKTEMP) obj/$(MKTEMP).o $(LDFLAGS)
$(MKTEMP).o:
	$(GCC) -o obj/$(MKTEMP).o -c $(MKTEMP).c $(CFLAGS)

$(OPEN): $(OPEN).o
	$(GCC) -o $(OPEN) obj/$(OPEN).o $(LDFLAGS)
$(OPEN).o:
	$(GCC) -o obj/$(OPEN).o -c $(OPEN).c $(CFLAGS)

$(OPEN_MEMSTREAM): $(OPEN_MEMSTREAM).o
	$(GCC) -o $(OPEN_MEMSTREAM) obj/$(OPEN_MEMSTREAM).o $(LDFLAGS)
$(OPEN_MEMSTREAM).o:
	$(GCC) -o obj/$(OPEN_MEMSTREAM).o -c $(OPEN_MEMSTREAM).c $(CFLAGS)

$(PREAD): $(PREAD).o
	$(GCC) -o $(PREAD) obj/$(PREAD).o $(LDFLAGS)
$(PREAD).o:
	$(GCC) -o obj/$(PREAD).o -c $(PREAD).c $(CFLAGS)

$(PUTC): $(PUTC).o
	$(GCC) -o $(PUTC) obj/$(PUTC).o $(LDFLAGS)
$(PUTC).o:
	$(GCC) -o obj/$(PUTC).o -c $(PUTC).c $(CFLAGS)

$(PUTW): $(PUTW).o
	$(GCC) -o $(PUTW) obj/$(PUTW).o $(LDFLAGS)
$(PUTW).o:
	$(GCC) -o obj/$(PUTW).o -c $(PUTW).c $(CFLAGS)

$(PWRITE): $(PWRITE).o
	$(GCC) -o $(PWRITE) obj/$(PWRITE).o $(LDFLAGS)
$(PWRITE).o:
	$(GCC) -o obj/$(PWRITE).o -c $(PWRITE).c $(CFLAGS)

$(READ): $(READ).o
	$(GCC) -o $(READ) obj/$(READ).o $(LDFLAGS)
$(READ).o:
	$(GCC) -o obj/$(READ).o -c $(READ).c $(CFLAGS)

$(READ_LINES): $(READ_LINES).o
	$(GCC) -o $(READ_LINES) obj/$(READ_LINES).o $(LDFLAGS)
$(READ_LINES).o:
	$(GCC) -o obj/$(READ_LINES).o -c $(READ_LINES).c $(CFLAGS)

$(READLINK): $(READLINK).o
	$(GCC) -o $(READLINK) obj/$(READLINK).o $(LDFLAGS)
$(READLINK).o:
	$(GCC) -o obj/$(READLINK).o -c $(READLINK).c $(CFLAGS)

$(REALPATH): $(REALPATH).o
	$(GCC) -o $(REALPATH) obj/$(REALPATH).o $(LDFLAGS)
$(REALPATH).o:
	$(GCC) -o obj/$(REALPATH).o -c $(REALPATH).c $(CFLAGS)

$(REMOVE): $(REMOVE).o
	$(GCC) -o $(REMOVE) obj/$(REMOVE).o $(LDFLAGS)
$(REMOVE).o:
	$(GCC) -o obj/$(REMOVE).o -c $(REMOVE).c $(CFLAGS)

$(RENAME): $(RENAME).o
	$(GCC) -o $(RENAME) obj/$(RENAME).o $(LDFLAGS)
$(RENAME).o:
	$(GCC) -o obj/$(RENAME).o -c $(RENAME).c $(CFLAGS)

$(REWIND): $(REWIND).o
	$(GCC) -o $(REWIND) obj/$(REWIND).o $(LDFLAGS)
$(REWIND).o:
	$(GCC) -o obj/$(REWIND).o -c $(REWIND).c $(CFLAGS)

$(SETBUF): $(SETBUF).o
	$(GCC) -o $(SETBUF) obj/$(SETBUF).o $(LDFLAGS)
$(SETBUF).o:
	$(GCC) -o obj/$(SETBUF).o -c $(SETBUF).c $(CFLAGS)

$(SETBUFFER): $(SETBUFFER).o
	$(GCC) -o $(SETBUFFER) obj/$(SETBUFFER).o $(LDFLAGS)
$(SETBUFFER).o:
	$(GCC) -o obj/$(SETBUFFER).o -c $(SETBUFFER).c $(CFLAGS)

$(SETLINEBUF): $(SETLINEBUF).o
	$(GCC) -o $(SETLINEBUF) obj/$(SETLINEBUF).o $(LDFLAGS)
$(SETLINEBUF).o:
	$(GCC) -o obj/$(SETLINEBUF).o -c $(SETLINEBUF).c $(CFLAGS)

$(SETVBUF): $(SETVBUF).o
	$(GCC) -o $(SETVBUF) obj/$(SETVBUF).o $(LDFLAGS)
$(SETVBUF).o:
	$(GCC) -o obj/$(SETVBUF).o -c $(SETVBUF).c $(CFLAGS)

$(STAT): $(STAT).o
	$(GCC) -o $(STAT) obj/$(STAT).o $(LDFLAGS)
$(STAT).o:
	$(GCC) -o obj/$(STAT).o -c $(STAT).c $(CFLAGS)

$(STATFS): $(STATFS).o
	$(GCC) -o $(STATFS) obj/$(STATFS).o $(LDFLAGS)
$(STATFS).o:
	$(GCC) -o obj/$(STATFS).o -c $(STATFS).c $(CFLAGS)

$(STATVFS): $(STATVFS).o
	$(GCC) -o $(STATVFS) obj/$(STATVFS).o $(LDFLAGS)
$(STATVFS).o:
	$(GCC) -o obj/$(STATVFS).o -c $(STATVFS).c $(CFLAGS)

$(STDERR): $(STDERR).o
	$(GCC) -o $(STDERR) obj/$(STDERR).o $(LDFLAGS)
$(STDERR).o:
	$(GCC) -o obj/$(STDERR).o -c $(STDERR).c $(CFLAGS)

$(STDIN): $(STDIN).o
	$(GCC) -o $(STDIN) obj/$(STDIN).o $(LDFLAGS)
$(STDIN).o:
	$(GCC) -o obj/$(STDIN).o -c $(STDIN).c $(CFLAGS)

$(STDOUT): $(STDOUT).o
	$(GCC) -o $(STDOUT) obj/$(STDOUT).o $(LDFLAGS)
$(STDOUT).o:
	$(GCC) -o obj/$(STDOUT).o -c $(STDOUT).c $(CFLAGS)

$(SYMLINK): $(SYMLINK).o
	$(GCC) -o $(SYMLINK) obj/$(SYMLINK).o $(LDFLAGS)
$(SYMLINK).o:
	$(GCC) -o obj/$(SYMLINK).o -c $(SYMLINK).c $(CFLAGS)

$(SYNC): $(SYNC).o
	$(GCC) -o $(SYNC) obj/$(SYNC).o $(LDFLAGS)
$(SYNC).o:
	$(GCC) -o obj/$(SYNC).o -c $(SYNC).c $(CFLAGS)

$(TEMPNAM): $(TEMPNAM).o
	$(GCC) -o $(TEMPNAM) obj/$(TEMPNAM).o $(LDFLAGS)
$(TEMPNAM).o:
	$(GCC) -o obj/$(TEMPNAM).o -c $(TEMPNAM).c $(CFLAGS)

$(TMPFILE): $(TMPFILE).o
	$(GCC) -o $(TMPFILE) obj/$(TMPFILE).o $(LDFLAGS)
$(TMPFILE).o:
	$(GCC) -o obj/$(TMPFILE).o -c $(TMPFILE).c $(CFLAGS)

$(TMPNAM): $(TMPNAM).o
	$(GCC) -o $(TMPNAM) obj/$(TMPNAM).o $(LDFLAGS)
$(TMPNAM).o:
	$(GCC) -o obj/$(TMPNAM).o -c $(TMPNAM).c $(CFLAGS)

$(TRUNCATE): $(TRUNCATE).o
	$(GCC) -o $(TRUNCATE) obj/$(TRUNCATE).o $(LDFLAGS)
$(TRUNCATE).o:
	$(GCC) -o obj/$(TRUNCATE).o -c $(TRUNCATE).c $(CFLAGS)

$(UNGETC): $(UNGETC).o
	$(GCC) -o $(UNGETC) obj/$(UNGETC).o $(LDFLAGS)
$(UNGETC).o:
	$(GCC) -o obj/$(UNGETC).o -c $(UNGETC).c $(CFLAGS)

$(UNLINK): $(UNLINK).o
	$(GCC) -o $(UNLINK) obj/$(UNLINK).o $(LDFLAGS)
$(UNLINK).o:
	$(GCC) -o obj/$(UNLINK).o -c $(UNLINK).c $(CFLAGS)

$(UTIMES): $(UTIMES).o
	$(GCC) -o $(UTIMES) obj/$(UTIMES).o $(LDFLAGS)
$(UTIMES).o:
	$(GCC) -o obj/$(UTIMES).o -c $(UTIMES).c $(CFLAGS)

$(VFPRINTF): $(VFPRINTF).o
	$(GCC) -o $(VFPRINTF) obj/$(VFPRINTF).o $(LDFLAGS)
$(VFPRINTF).o:
	$(GCC) -o obj/$(VFPRINTF).o -c $(VFPRINTF).c $(CFLAGS)

$(WRITE): $(WRITE).o
	$(GCC) -o $(WRITE) obj/$(WRITE).o $(LDFLAGS)
$(WRITE).o:
	$(GCC) -o obj/$(WRITE).o -c $(WRITE).c $(CFLAGS)





#top Predefined Constants


#top _G_BUFSIZ


Deklaracja stałej _G_BUFSIZ znajduje się w pliku nagłówkowym _G_config.h.
Deklaracja stałej _G_BUFSIZ jest następująca:
#define _G_BUFSIZ 8192



#top _IO_BUFSIZ


Deklaracja stałej _IO_BUFSIZ znajduje się w pliku nagłówkowym libio.h.
Deklaracja stałej _IO_BUFSIZ jest następująca:
/* ALL of these should be defined in _G_config.h */
#define _IO_BUFSIZ _G_BUFSIZ



#top _IOFBF


Deklaracja stałej _IOFBF znajduje się w pliku nagłówkowym libio.h.
Deklaracja stałej _IOFBF jest następująca:
/* The possibilities for the third argument to `setvbuf'.  */
#define _IOFBF 0        /* Fully buffered.  */



#top _IOLBF


Deklaracja stałej _IOLBF znajduje się w pliku nagłówkowym libio.h.
Deklaracja stałej _IOLBF jest następująca:
/* The possibilities for the third argument to `setvbuf'.  */
#define _IOLBF 1        /* Line buffered.  */



#top _IONBF


Deklaracja stałej _IONBF znajduje się w pliku nagłówkowym libio.h.
Deklaracja stałej _IONBF jest następująca:
/* The possibilities for the third argument to `setvbuf'.  */
#define _IONBF 2        /* No buffering.  */



#top BUFSIZ


Deklaracja stałej BUFSIZ znajduje się w pliku nagłówkowym stdio.h.
Deklaracja stałej BUFSIZ jest następująca:
/* Default buffer size.  */
#ifndef BUFSIZ
# define BUFSIZ _IO_BUFSIZ
#endif



#top EOF


Deklaracja stałej EOF znajduje się w pliku nagłówkowym unistd.h.
Deklaracja stałej EOF jest następująca:
/* End of file character.
   Some things throughout the library rely on this being -1.  */
#ifndef EOF
# define EOF (-1)
#endif



#top F_OK


Deklaracja stałej F_OK znajduje się w pliku nagłówkowym unistd.h.
Deklaracja stałej F_OK jest następująca:
/* Values for the second argument to access.
   These may be OR'd together.  */
#define F_OK    0       /* Test for existence.  */



#top F_DUPFD


Deklaracja stałej F_DUPFD znajduje się w pliku nagłówkowym bits/fcntl.h.
Deklaracja stałej F_DUPFD jest następująca:
/* Values for the second argument to `fcntl'.  */
#define F_DUPFD     0   /* Duplicate file descriptor.  */



#top F_GETFD


Deklaracja stałej F_GETFD znajduje się w pliku nagłówkowym bits/fcntl.h.
Deklaracja stałej F_GETFD jest następująca:
/* Values for the second argument to `fcntl'.  */
#define F_GETFD     1   /* Get file descriptor flags.  */



#top F_GETFL


Deklaracja stałej F_GETFL znajduje się w pliku nagłówkowym bits/fcntl.h.
Deklaracja stałej F_GETFL jest następująca:
/* Values for the second argument to `fcntl'.  */
#define F_GETFL     3   /* Get file status flags.  */



#top F_SETFD


Deklaracja stałej F_SETFD znajduje się w pliku nagłówkowym bits/fcntl.h.
Deklaracja stałej F_SETFD jest następująca:
/* Values for the second argument to `fcntl'.  */
#define F_SETFD     2   /* Set file descriptor flags.  */



#top F_SETFL


Deklaracja stałej F_SETFL znajduje się w pliku nagłówkowym bits/fcntl.h.
Deklaracja stałej F_SETFL jest następująca:
/* Values for the second argument to `fcntl'.  */
#define F_SETFL     4   /* Set file status flags.  */



#top F_GETLK


Deklaracja stałej F_GETLK znajduje się w pliku nagłówkowym bits/fcntl.h.
Deklaracja stałej F_GETLK jest następująca:
/* Values for the second argument to `fcntl'.  */
#ifndef __USE_FILE_OFFSET64
# define F_GETLK    5   /* Get record locking info.  */
#else
# define F_GETLK    F_GETLK64  /* Get record locking info.  */
#endif
#define F_GETLK64   12  /* Get record locking info.  */



#top F_SETLK


Deklaracja stałej F_SETLK znajduje się w pliku nagłówkowym bits/fcntl.h.
Deklaracja stałej F_SETLK jest następująca:
/* Values for the second argument to `fcntl'.  */
#ifndef __USE_FILE_OFFSET64
# define F_SETLK    6   /* Set record locking info (non-blocking).  */
#else
# define F_SETLK    F_SETLK64  /* Set record locking info (non-blocking).*/
#endif
#define F_SETLK64   13  /* Set record locking info (non-blocking).  */



#top F_SETLKW


Deklaracja stałej F_SETLKW znajduje się w pliku nagłówkowym bits/fcntl.h.
Deklaracja stałej F_SETLKW jest następująca:
/* Values for the second argument to `fcntl'.  */
#ifndef __USE_FILE_OFFSET64
# define F_SETLKW   7   /* Set record locking info (blocking).  */
#else
# define F_SETLKW   F_SETLKW64 /* Set record locking info (blocking).  */
#endif
#define F_SETLKW64  14  /* Set record locking info (blocking).  */



#top FASYNC


Deklaracja stałej FASYNC znajduje się w pliku nagłówkowym bits/fcntl.h.
Deklaracja stałej FASYNC jest następująca:
# define FASYNC     O_ASYNC



#top FD_CLOEXEC


Deklaracja stałej FD_CLOEXEC znajduje się w pliku nagłówkowym bits/fcntl.h.
Deklaracja stałej FD_CLOEXEC jest następująca:
/* For F_[GET|SET]FD.  */
#define FD_CLOEXEC  1   /* actually anything with low bit set goes */



#top LOCK_EX


Deklaracja stałej LOCK_EX znajduje się w pliku nagłówkowym bits/fcntl.h.
Deklaracja stałej LOCK_EX jest następująca:
/* For old implementation of bsd flock().  */
#ifdef __USE_BSD
/* Operations for bsd flock(), also used by the kernel implementation.  */
#define LOCK_EX     2   /* exclusive lock */
#endif



#top LOCK_MAND


Deklaracja stałej LOCK_MAND znajduje się w pliku nagłówkowym bits/fcntl.h.
Deklaracja stałej LOCK_MAND jest następująca:
/* For old implementation of bsd flock().  */
#ifdef __USE_GNU
# define LOCK_MAND  32  /* This is a mandatory flock:   */
#endif



#top LOCK_NB


Deklaracja stałej LOCK_NB znajduje się w pliku nagłówkowym bits/fcntl.h.
Deklaracja stałej LOCK_NB jest następująca:
/* For old implementation of bsd flock().  */
#ifdef __USE_BSD
/* Operations for bsd flock(), also used by the kernel implementation.  */
#define LOCK_NB     4   /* or'd with one of the above to prevent
                   blocking */
#endif



#top LOCK_READ


Deklaracja stałej LOCK_READ znajduje się w pliku nagłówkowym bits/fcntl.h.
Deklaracja stałej LOCK_READ jest następująca:
/* For old implementation of bsd flock().  */
#ifdef __USE_GNU
# define LOCK_READ  64  /* ... which allows concurrent read operations.  */
#endif



#top LOCK_RW


Deklaracja stałej LOCK_RW znajduje się w pliku nagłówkowym bits/fcntl.h.
Deklaracja stałej LOCK_RW jest następująca:
/* For old implementation of bsd flock().  */
#ifdef __USE_GNU
# define LOCK_RW    192 /* ... Which allows concurrent read & write operations.  */
#endif



#top LOCK_SH


Deklaracja stałej LOCK_SH znajduje się w pliku nagłówkowym bits/fcntl.h.
Deklaracja stałej LOCK_SH jest następująca:
/* For old implementation of bsd flock().  */
#ifdef __USE_BSD
/* Operations for bsd flock(), also used by the kernel implementation.  */
#define LOCK_SH     1   /* shared lock */
#endif



#top LOCK_UN


Deklaracja stałej LOCK_UN znajduje się w pliku nagłówkowym bits/fcntl.h.
Deklaracja stałej LOCK_UN jest następująca:
/* For old implementation of bsd flock().  */
#define LOCK_UN     8   /* remove lock */



#top LOCK_WRITE


Deklaracja stałej LOCK_WRITE znajduje się w pliku nagłówkowym bits/fcntl.h.
Deklaracja stałej LOCK_WRITE jest następująca:
/* For old implementation of bsd flock().  */
#ifdef __USE_GNU
# define LOCK_WRITE 128 /* ... which allows concurrent write operations.  */
#endif



#top O_ACCMODE


Deklaracja stałej O_ACCMODE znajduje się w pliku nagłówkowym bits/fcntl.h.
Deklaracja stałej O_ACCMODE jest następująca:
/* open/fcntl - O_SYNC is only implemented on blocks devices and on files
   located on an ext2 file system */
#define O_ACCMODE      0003



#top O_APPEND


Deklaracja stałej O_APPEND znajduje się w pliku nagłówkowym bits/fcntl.h.
Deklaracja stałej O_APPEND jest następująca:
/* open/fcntl - O_SYNC is only implemented on blocks devices and on files
   located on an ext2 file system */
#define O_APPEND      02000



#top O_CLOEXEC


Deklaracja stałej O_CLOEXEC znajduje się w pliku nagłówkowym bits/fcntl.h.
Deklaracja stałej O_CLOEXEC jest następująca:
#ifdef __USE_XOPEN2K8
# define O_CLOEXEC     02000000 /* Set close_on_exec.  */
#endif



#top O_CREAT


Deklaracja stałej O_CREAT znajduje się w pliku nagłówkowym bits/fcntl.h.
Deklaracja stałej O_CREAT jest następująca:
/* open/fcntl - O_SYNC is only implemented on blocks devices and on files
   located on an ext2 file system */
#define O_CREAT        0100 /* not fcntl */



#top O_DIRECT


Deklaracja stałej O_DIRECT znajduje się w pliku nagłówkowym bits/fcntl.h.
Deklaracja stałej O_DIRECT jest następująca:
/* open/fcntl - O_SYNC is only implemented on blocks devices and on files
   located on an ext2 file system */
# define O_DIRECT    040000 /* Direct disk access.  */



#top O_DIRECTORY


Deklaracja stałej O_DIRECTORY znajduje się w pliku nagłówkowym bits/fcntl.h.
Deklaracja stałej O_DIRECTORY jest następująca:
/* open/fcntl - O_SYNC is only implemented on blocks devices and on files
   located on an ext2 file system */
# define O_DIRECTORY    0200000 /* Must be a directory.  */



#top O_LARGEFILE


Deklaracja stałej O_LARGEFILE znajduje się w pliku nagłówkowym bits/fcntl.h.
Deklaracja stałej O_LARGEFILE jest następująca:
#ifdef __USE_LARGEFILE64
# define O_LARGEFILE    0100000
#endif



#top O_NDELAY


Deklaracja stałej O_NDELAY znajduje się w pliku nagłówkowym bits/fcntl.h.
Deklaracja stałej O_NDELAY jest następująca:
/* open/fcntl - O_SYNC is only implemented on blocks devices and on files
   located on an ext2 file system */
#define O_NDELAY    O_NONBLOCK



#top O_NOATIME


Deklaracja stałej O_NOATIME znajduje się w pliku nagłówkowym bits/fcntl.h.
Deklaracja stałej O_NOATIME jest następująca:
/* open/fcntl - O_SYNC is only implemented on blocks devices and on files
   located on an ext2 file system */
# define O_NOATIME     01000000 /* Do not set atime.  */



#top O_NOFOLLOW


Deklaracja stałej O_NOFOLLOW znajduje się w pliku nagłówkowym bits/fcntl.h.
Deklaracja stałej O_NOFOLLOW jest następująca:
/* open/fcntl - O_SYNC is only implemented on blocks devices and on files
   located on an ext2 file system */
# define O_NOFOLLOW 0400000 /* Do not follow links.  */



#top O_NONBLOCK


Deklaracja stałej O_NONBLOCK znajduje się w pliku nagłówkowym bits/fcntl.h.
Deklaracja stałej O_NONBLOCK jest następująca:
/* open/fcntl - O_SYNC is only implemented on blocks devices and on files
   located on an ext2 file system */
#define O_NONBLOCK    04000



#top O_RDONLY


Deklaracja stałej O_RDONLY znajduje się w pliku nagłówkowym bits/fcntl.h.
Deklaracja stałej O_RDONLY jest następująca:
/* open/fcntl - O_SYNC is only implemented on blocks devices and on files
   located on an ext2 file system */
#define O_RDONLY         00




#top O_RDWR


Deklaracja stałej O_RDWR znajduje się w pliku nagłówkowym bits/fcntl.h.
Deklaracja stałej O_RDWR jest następująca:
/* open/fcntl - O_SYNC is only implemented on blocks devices and on files
   located on an ext2 file system */
#define O_RDWR           02




#top O_SYNC


Deklaracja stałej O_SYNC znajduje się w pliku nagłówkowym bits/fcntl.h.
Deklaracja stałej O_SYNC jest następująca:
/* open/fcntl - O_SYNC is only implemented on blocks devices and on files
   located on an ext2 file system */
#define O_SYNC       010000



#top O_TRUNC


Deklaracja stałej O_TRUNC znajduje się w pliku nagłówkowym bits/fcntl.h.
Deklaracja stałej O_TRUNC jest następująca:
/* open/fcntl - O_SYNC is only implemented on blocks devices and on files
   located on an ext2 file system */
#define O_TRUNC       01000 /* not fcntl */



#top O_WRONLY


Deklaracja stałej O_WRONLY znajduje się w pliku nagłówkowym bits/fcntl.h.
Deklaracja stałej O_WRONLY jest następująca:
/* open/fcntl - O_SYNC is only implemented on blocks devices and on files
   located on an ext2 file system */
#define O_WRONLY         01




#top R_OK


Deklaracja stałej R_OK znajduje się w pliku nagłówkowym unistd.h.
Deklaracja stałej R_OK jest następująca:
/* Values for the second argument to access.
   These may be OR'd together.  */
#define R_OK    4       /* Test for read permission.  */



#top W_OK


Deklaracja stałej W_OK znajduje się w pliku nagłówkowym unistd.h.
Deklaracja stałej W_OK jest następująca:
/* Values for the second argument to access.
   These may be OR'd together.  */
#define W_OK    2       /* Test for write permission.  */



#top X_OK


Deklaracja stałej X_OK znajduje się w pliku nagłówkowym unistd.h.
Deklaracja stałej X_OK jest następująca:
/* Values for the second argument to access.
   These may be OR'd together.  */
#define X_OK    1       /* Test for execute permission.  */



#top SEEK_CUR


Deklaracja stałej SEEK_CUR znajduje się w pliku nagłówkowym stdio.h.
Deklaracja stałej SEEK_CUR jest następująca:
/* The possibilities for the third argument to 'fseek'.
   These values should not be changed.  */
#define SEEK_CUR    1   /* Seek from current position.  */



#top SEEK_END


Deklaracja stałej SEEK_END znajduje się w pliku nagłówkowym stdio.h.
Deklaracja stałej SEEK_END jest następująca:
/* The possibilities for the third argument to 'fseek'.
   These values should not be changed.  */
#define SEEK_END    2   /* Seek from end of file.  */



#top SEEK_SET


Deklaracja stałej SEEK_SET znajduje się w pliku nagłówkowym stdio.h.
Deklaracja stałej SEEK_SET jest następująca:
/* The possibilities for the third argument to 'fseek'.
   These values should not be changed.  */
#define SEEK_SET    0   /* Seek from beginning of file.  */



#top STDIN_FILENO


Deklaracja stałej STDIN_FILENO znajduje się w pliku nagłówkowym unistd.h.
Deklaracja stałej STDIN_FILENO jest następująca:
/* Standard file descriptors.  */
#define STDIN_FILENO    0   /* Standard input.  */



#top STDOUT_FILENO


Deklaracja stałej STDOUT_FILENO znajduje się w pliku nagłówkowym unistd.h.
Deklaracja stałej STDOUT_FILENO jest następująca:
/* Standard file descriptors.  */
#define STDOUT_FILENO   1   /* Standard output.  */



#top STDERR_FILENO


Deklaracja stałej STDERR_FILENO znajduje się w pliku nagłówkowym unistd.h.
Deklaracja stałej STDERR_FILENO jest następująca:
/* Standard file descriptors.  */
#define STDERR_FILENO   2   /* Standard error output.  */





#top Datatypes / MACROS


#top __blkcnt_t


Definicja typu __blkcnt_t znajduje się w pliku nagłówkowym bits/types.h.
Definicja typu __blkcnt_t jest następująca:
/* Type to count number of disk blocks.  */
__STD_TYPE __BLKCNT_T_TYPE __blkcnt_t;
__STD_TYPE __BLKCNT64_T_TYPE __blkcnt64_t;



#top __blksize_t


Definicja typu __blksize_t znajduje się w pliku nagłówkowym bits/types.h.
Definicja typu __blksize_t jest następująca:
/* Type to represent block size.  */
__STD_TYPE __BLKSIZE_T_TYPE __blksize_t;



#top __dev_t


Definicja typu __dev_t znajduje się w pliku nagłówkowym bits/types.h.
Definicja typu __dev_t jest następująca:
__STD_TYPE __DEV_T_TYPE __dev_t;    /* Type of device numbers.  */



#top __fsblkcnt_t


Definicja typu __fsblkcnt_t znajduje się w pliku nagłówkowym bits/types.h.
Definicja typu __fsblkcnt_t jest następująca:
/* Type to count file system blocks.  */
__STD_TYPE __FSBLKCNT_T_TYPE __fsblkcnt_t;
__STD_TYPE __FSBLKCNT64_T_TYPE __fsblkcnt64_t;



#top __fsid_t


Definicja typu __fsid_t znajduje się w pliku nagłówkowym bits/types.h.
Definicja typu __fsid_t jest następująca:
__STD_TYPE __FSID_T_TYPE __fsid_t;  /* Type of file system IDs.  */



#top __gid_t


Definicja typu __gid_t znajduje się w pliku nagłówkowym bits/types.h.
Definicja typu __gid_t jest następująca:
__STD_TYPE __GID_T_TYPE __gid_t;    /* Type of group identifications.  */



#top __gnuc_va_list


Definicja typu __gnuc_va_list znajduje się w pliku nagłówkowym .h.
Definicja typu __gnuc_va_list jest następująca:
__gnuc_va_list



#top __ino_t


Definicja typu __ino_t znajduje się w pliku nagłówkowym bits/types.h.
Definicja typu __ino_t jest następująca:
__STD_TYPE __INO_T_TYPE __ino_t;    /* Type of file serial numbers.  */



#top __mode_t


Definicja typu __mode_t znajduje się w pliku nagłówkowym bits/types.h.
Definicja typu __mode_t jest następująca:
__STD_TYPE __MODE_T_TYPE __mode_t;  /* Type of file attribute bitmasks.  */




Definicja typu __nlink_t znajduje się w pliku nagłówkowym bits/types.h.
Definicja typu __nlink_t jest następująca:
__STD_TYPE __NLINK_T_TYPE __nlink_t;    /* Type of file link counts.  */



#top __off_t


Definicja typu __off_t znajduje się w pliku nagłówkowym bits/types.h.
Definicja typu __off_t jest następująca:
__STD_TYPE __OFF_T_TYPE __off_t;    /* Type of file sizes and offsets.  */



#top __pid_t


Definicja typu __pid_t znajduje się w pliku nagłówkowym bits/types.h.
Definicja typu __pid_t jest następująca:
__STD_TYPE __PID_T_TYPE __pid_t;    /* Type of process identifications.  */



#top __ssize_t


Definicja typu __ssize_t znajduje się w pliku nagłówkowym bits/types.h.
Definicja typu __ssize_t jest następująca:
__STD_TYPE __SSIZE_T_TYPE __ssize_t; /* Type of a byte count, or error.  */



#top __suseconds_t


Definicja typu __suseconds_t znajduje się w pliku nagłówkowym bits/types.h.
Definicja typu __suseconds_t jest następująca:
__STD_TYPE __SUSECONDS_T_TYPE __suseconds_t; /* Signed count of microseconds.  */



#top __time_t


Definicja typu __time_t znajduje się w pliku nagłówkowym bits/types.h.
Definicja typu __time_t jest następująca:
__STD_TYPE __TIME_T_TYPE __time_t;  /* Seconds since the Epoch.  */



#top __uid_t


Definicja typu __uid_t znajduje się w pliku nagłówkowym bits/types.h.
Definicja typu __uid_t jest następująca:
__STD_TYPE __UID_T_TYPE __uid_t;    /* Type of user identifications.  */



#top _G_off_t


Definicja struktury _G_off_t znajduje się w pliku nagłówkowym _G_config.h.
Definicja struktury _G_off_t jest następująca:
#define _G_off_t    __off_t



#top _G_va_list


Definicja typu _G_va_list znajduje się w pliku nagłówkowym _G_config.h.
Definicja typu _G_va_list jest następująca:
#define _G_va_list __gnuc_va_list



#top _IO_lock_t


Definicja struktury _IO_lock_t znajduje się w pliku nagłówkowym stdio.h.
Definicja struktury _IO_lock_t jest następująca:
/* Handle lock.  */
#ifdef _IO_MTSAFE_IO
# if defined __GLIBC__ && __GLIBC__ >= 2
#  include <bits/stdio-lock.h>
# else
/*# include <comthread.h>*/
# endif
#else
typedef void _IO_lock_t;
#endif



#top _IO_off_t


Definicja struktury _IO_off_t znajduje się w pliku nagłówkowym stdio.h.
Definicja struktury _IO_off_t jest następująca:
#define _IO_off_t _G_off_t



#top FILE


Definicja struktury FILE znajduje się w pliku nagłówkowym stdio.h.
Definicja struktury FILE jest następująca:
/* The opaque type of streams.  This is the definition used elsewhere.  */
typedef struct _IO_FILE FILE;



#top gid_t


Definicja typu gid_t znajduje się w pliku nagłówkowym unistd.h.
Definicja typu gid_t jest następująca:
# ifndef __gid_t_defined
typedef __gid_t gid_t;
#  define __gid_t_defined
# endif



#top pid_t


Definicja typu pid_t znajduje się w pliku nagłówkowym unistd.h.
Definicja typu pid_t jest następująca:
# ifndef __pid_t_defined
typedef __pid_t pid_t;
#  define __pid_t_defined
# endif



#top size_t


Definicja typu size_t znajduje się w pliku nagłówkowym /usr/lib/gcc/i386-redhat-linux/4.1.1/include/stddef.h.
Definicja typu size_t jest następująca:
/* Unsigned type of `sizeof' something.  */

/* Define this type if we are doing the whole job,
   or if we want this type in particular.  */
#if defined (_STDDEF_H) || defined (__need_size_t)
#ifndef __size_t__  /* BeOS */
#ifndef __SIZE_T__  /* Cray Unicos/Mk */
#ifndef _SIZE_T /* in case <sys/types.h> has defined it. */
#ifndef _SYS_SIZE_T_H
#ifndef _T_SIZE_
#ifndef _T_SIZE
#ifndef __SIZE_T
#ifndef _SIZE_T_
#ifndef _BSD_SIZE_T_
#ifndef _SIZE_T_DEFINED_
#ifndef _SIZE_T_DEFINED
#ifndef _BSD_SIZE_T_DEFINED_    /* Darwin */
#ifndef _SIZE_T_DECLARED    /* FreeBSD 5 */
#ifndef ___int_size_t_h
#ifndef _GCC_SIZE_T
#ifndef _SIZET_
#ifndef __size_t
#define __size_t__  /* BeOS */
#define __SIZE_T__  /* Cray Unicos/Mk */
#define _SIZE_T
#define _SYS_SIZE_T_H
#define _T_SIZE_
#define _T_SIZE
#define __SIZE_T
#define _SIZE_T_
#define _BSD_SIZE_T_
#define _SIZE_T_DEFINED_
#define _SIZE_T_DEFINED
#define _BSD_SIZE_T_DEFINED_    /* Darwin */
#define _SIZE_T_DECLARED    /* FreeBSD 5 */
#define ___int_size_t_h
#define _GCC_SIZE_T
#define _SIZET_
#if defined (__FreeBSD__) && (__FreeBSD__ >= 5)
/* __size_t is a typedef on FreeBSD 5!, must not trash it. */
#else
#define __size_t
#endif
#ifndef __SIZE_TYPE__
#define __SIZE_TYPE__ long unsigned int
#endif
#if !(defined (__GNUG__) && defined (size_t))
typedef __SIZE_TYPE__ size_t;
#ifdef __BEOS__
typedef long ssize_t;
#endif /* __BEOS__ */
#endif /* !(defined (__GNUG__) && defined (size_t)) */
#endif /* __size_t */
#endif /* _SIZET_ */
#endif /* _GCC_SIZE_T */
#endif /* ___int_size_t_h */
#endif /* _SIZE_T_DECLARED */
#endif /* _BSD_SIZE_T_DEFINED_ */
#endif /* _SIZE_T_DEFINED */
#endif /* _SIZE_T_DEFINED_ */
#endif /* _BSD_SIZE_T_ */
#endif /* _SIZE_T_ */
#endif /* __SIZE_T */
#endif /* _T_SIZE */
#endif /* _T_SIZE_ */
#endif /* _SYS_SIZE_T_H */
#endif /* _SIZE_T */
#endif /* __SIZE_T__ */
#endif /* __size_t__ */
#undef  __need_size_t
#endif /* _STDDEF_H or __need_size_t.  */



#top ssize_t


Definicja typu ssize_t znajduje się w pliku nagłówkowym unistd.h.
Definicja typu ssize_t jest następująca:
#ifndef __ssize_t_defined
typedef __ssize_t ssize_t;
# define __ssize_t_defined
#endif



#top stderr


Definicja struktury stderr znajduje się w pliku nagłówkowym stdio.h.
Definicja struktury stderr jest następująca:
/* Standard streams.  */
extern struct _IO_FILE *stderr;     :* Standard error output stream.  */
/* C89/C99 say they're macros.  Make them happy.  */
#define stderr stderr

Powiązane:
stderr, stdin, stdout,

Opis:
Globalna zmienna stderr jest makrem

Argumenty:

Zwracana wartość:

Example:
zawartość pliku stderr.c
SELECT ALL
#define  _GNU_SOURCE  1    /* for environ defined in unistd.h, to avoid warning implicit declaration of function basename, which defined in string.h */
#include <stdio.h>         /* for FILE, va_list, EOF, SEEK_SET, SEEK_CUR, SEEK_END, stdin, stdout, stderr, remove(), rename(), tmpfile(), tmpnam(), tempnam(), fclose(), */
                           /* fflush(), fopen(), freopen(), fprintf(), printf(), snprintf(), scanf(), sscanf(), fgetc(), getc(), getchar(), fputc(), putc(), putchar(), */
                           /* fgets(), gets(), fputs(), puts(), fread(), fwrite(), fseek(), ftell(), rewind(), feof(), ferror(), fileno(), popen(), pclose(), */
#include <string.h>        /* for memcpy(), memmove(), memset(), memcmp(), memchr(), memrchr(), str[n]cpy(), str[n]cat(), str[n]cmp(), strcoll(), str[n]dup(), strchr(), strrchr(), strstr(), */
                           /* strtok(), strcasestr(), memmem(), mempcpy(), str[n]len(), strerror(), bcopy(), bzero(), strcasecmp(), strsep(), basename(), */



int main(int argc, char **argv) {
	char *self;
	
	if (argc<1) {
		printf("Usage: %s\n", argv[0]);
		return 0;
	}
	
	self=strrchr(argv[0], '/');
	if (self!=NULL) self++;
	else self=argv[0];
	
	if (argc>=2 && strncmp(argv[1],"-h",strlen("-h"))==0) {
		printf("Usage: %s\n", argv[0]);
		printf("Examples:\n");
		printf("       %s >/dev/null # stdout is redirected to trash, but message is printed on stderr, so we se message\n", argv[0]);
		printf("       %s 2>/dev/null # stderr is redirected to trash, but message is printed on stderr, now we do not seen message\n", argv[0]);
		return 0;
	}
	
	fprintf(stderr, "%s: argc=%d argv[0]=%s\n", self, argc, argv[0]);
	fputs("fputs:stderr:text\n", stderr);
	
	return 0;
}

program należy skompilować komendą make (jako argument należy podać plik Makefile zależny od systemu operacyjnego, domyślnie make próbuje użyć pliku Makefile):
make clean all # system Linux
make -f Makefile clean all # system Linux
make -f Makefile.obsd clean all # system OpenBSD
make -f Makefile.fbsd clean all # system FreeBSD
make -f Makefile.sol clean all # system Solaris
make -f Makefile.beos clean all # system BeOS
make -f Makefile.win clean all # system Windows

a następnie uruchomić z następującym argumentem:
/home/local/code/ansiccode/sysfile/stderr -h
program wyświetli informacje o sposobie uruchamiania programu:
Usage: /home/local/code/ansiccode/sysfile/stderr
Examples:
       /home/local/code/ansiccode/sysfile/stderr >/dev/null # stdout is redirected to trash, but message is printed on stderr, so we se message
       /home/local/code/ansiccode/sysfile/stderr 2>/dev/null # stderr is redirected to trash, but message is printed on stderr, now we do not seen message

jako argument wywołania programu można podać analogiczne jak poniżej argumenty:
/home/local/code/ansiccode/sysfile/stderr >/dev/null # stdout is redirected to trash, but message is printed on stderr, so we se message
/home/local/code/ansiccode/sysfile/stderr 2>/dev/null # stderr is redirected to trash and message is printed on stderr, so we do not seen message
rezultat będzie zależny od podanych argumentów wywołania programu:
stderr: argc=1 argv[0]=/home/local/code/ansiccode/sysfile/stderr
fputs:stderr:text


Jak widać na powyższym przykładzie uruchomienie program z przekierowanym standardowym wyjściowym strumieniem błędów 2>/dev/null program nie wyświetla nic (wiadomość wyświetlana jest na standardowym wyjściowym strumieniu błędów).



#top stdin


Definicja struktury stdin znajduje się w pliku nagłówkowym stdio.h.
Definicja struktury stdin jest następująca:
/* Standard streams.  */
extern struct _IO_FILE *stdin;      :* Standard input stream.  */
/* C89/C99 say they're macros.  Make them happy.  */
#define stdin stdin

Powiązane:
stderr, stdin, stdout,

Opis:
Globalna zmienna stdin jest makrem

Argumenty:

Zwracana wartość:

Example:
zawartość pliku stdin.c
SELECT ALL
#define  _GNU_SOURCE  1    /* for environ defined in unistd.h, to avoid warning implicit declaration of function basename, which defined in string.h */
#include <stdio.h>         /* for FILE, va_list, EOF, SEEK_SET, SEEK_CUR, SEEK_END, stdin, stdout, stderr, remove(), rename(), tmpfile(), tmpnam(), tempnam(), fclose(), */
                           /* fflush(), fopen(), freopen(), fprintf(), printf(), snprintf(), scanf(), sscanf(), fgetc(), getc(), getchar(), fputc(), putc(), putchar(), */
                           /* fgets(), gets(), fputs(), puts(), fread(), fwrite(), fseek(), ftell(), rewind(), feof(), ferror(), fileno(), popen(), pclose(), */
#include <string.h>        /* for memcpy(), memmove(), memset(), memcmp(), memchr(), memrchr(), str[n]cpy(), str[n]cat(), str[n]cmp(), strcoll(), str[n]dup(), strchr(), strrchr(), strstr(), */
                           /* strtok(), strcasestr(), memmem(), mempcpy(), str[n]len(), strerror(), bcopy(), bzero(), strcasecmp(), strsep(), basename(), */



int main(int argc, char **argv) {
	char *self;
	char bufftext[1024];
	char *ptrstext;
	
	self=strrchr(argv[0], '/');
	if (self!=NULL) self++;
	else self=argv[0];
	
	if (argc<1) {
		printf("Usage: %s\n", argv[0]);
		return 0;
	}
	
	printf("%s: Enter the text: ", self);
	fflush(stdout);
	memset(bufftext, 0x00, sizeof(bufftext));
	ptrstext=fgets(bufftext, sizeof(bufftext), stdin);
	printf("%s: ptrstext=fgets(bufftext, sizeof(bufftext), stdin): bufftext=|%s| ptrstext=|%s|\n", self, bufftext, ptrstext);
	
	return 0;
}

program należy skompilować komendą make (jako argument należy podać plik Makefile zależny od systemu operacyjnego, domyślnie make próbuje użyć pliku Makefile):
make clean all # system Linux
make -f Makefile clean all # system Linux
make -f Makefile.obsd clean all # system OpenBSD
make -f Makefile.fbsd clean all # system FreeBSD
make -f Makefile.sol clean all # system Solaris
make -f Makefile.beos clean all # system BeOS
make -f Makefile.win clean all # system Windows

a następnie uruchomić bez z argumentów:
/home/local/code/ansiccode/sysfile/stdin
w oczekiwaniu programu na stosowne argumenty należy wpisać (oraz nacisnąć klawisz Enter dla zatwierdzenia wprowadzonych danych):
some text
rezultat będzie zależny od wprowadzonych argumentów:
stdin: Enter the text: some text
stdin: ptrstext=fgets(bufftext, sizeof(bufftext), stdin): bufftext=|some text
| ptrstext=|some text
|



#top stdout


Definicja struktury stdout znajduje się w pliku nagłówkowym stdio.h.
Definicja struktury stdout jest następująca:
/* Standard streams.  */
extern struct _IO_FILE *stdout;     :* Standard output stream.  */
/* C89/C99 say they're macros.  Make them happy.  */
#define stdout stdout

Powiązane:
stderr, stdin, stdout,

Opis:
Globalna zmienna stdout jest makrem

Argumenty:

Zwracana wartość:

Example:
zawartość pliku stdout.c
SELECT ALL
#define  _GNU_SOURCE  1    /* for environ defined in unistd.h, to avoid warning implicit declaration of function basename, which defined in string.h */
#include <stdio.h>         /* for FILE, va_list, EOF, SEEK_SET, SEEK_CUR, SEEK_END, stdin, stdout, stderr, remove(), rename(), tmpfile(), tmpnam(), tempnam(), fclose(), */
                           /* fflush(), fopen(), freopen(), fprintf(), printf(), snprintf(), scanf(), sscanf(), fgetc(), getc(), getchar(), fputc(), putc(), putchar(), */
                           /* fgets(), gets(), fputs(), puts(), fread(), fwrite(), fseek(), ftell(), rewind(), feof(), ferror(), fileno(), popen(), pclose(), */
#include <string.h>        /* for memcpy(), memmove(), memset(), memcmp(), memchr(), memrchr(), str[n]cpy(), str[n]cat(), str[n]cmp(), strcoll(), str[n]dup(), strchr(), strrchr(), strstr(), */
                           /* strtok(), strcasestr(), memmem(), mempcpy(), str[n]len(), strerror(), bcopy(), bzero(), strcasecmp(), strsep(), basename(), */



int main(int argc, char **argv) {
	char *self;
	
	self=strrchr(argv[0], '/');
	if (self!=NULL) self++;
	else self=argv[0];
	
	if (argc<1) {
		printf("Usage: %s\n", argv[0]);
		return 0;
	}
	
	if (argc>=2 && strncmp(argv[1],"-h",strlen("-h"))==0) {
		printf("Usage: %s\n", argv[0]);
		printf("Examples:\n");
		printf("       %s >/dev/null # stdout is redirected to trash, but message is printed on stdout, so we do not seen message\n", argv[0]);
		printf("       %s 2>/dev/null # stderr is redirected to trash, but message is printed on stdout, now we se message\n", argv[0]);
		return 0;
	}
	
	fprintf(stdout, "%s: argc=%d argv[0]=%s\n", self, argc, argv[0]);
	fputs("fputs:stdout:text\n", stdout);
	
	return 0;
}

program należy skompilować komendą make (jako argument należy podać plik Makefile zależny od systemu operacyjnego, domyślnie make próbuje użyć pliku Makefile):
make clean all # system Linux
make -f Makefile clean all # system Linux
make -f Makefile.obsd clean all # system OpenBSD
make -f Makefile.fbsd clean all # system FreeBSD
make -f Makefile.sol clean all # system Solaris
make -f Makefile.beos clean all # system BeOS
make -f Makefile.win clean all # system Windows

a następnie uruchomić z następującym argumentem:
/home/local/code/ansiccode/sysfile/stdout -h
program wyświetli informacje o sposobie uruchamiania programu:
Usage: /home/local/code/ansiccode/sysfile/stdout
Examples:
       /home/local/code/ansiccode/sysfile/stdout >/dev/null # stdout is redirected to trash, but message is printed on stdout, so we do not seen message
       /home/local/code/ansiccode/sysfile/stdout 2>/dev/null # stderr is redirected to trash, but message is printed on stdout, now we se message

jako argument wywołania programu można podać analogiczne jak poniżej argumenty:
/home/local/code/ansiccode/sysfile/stdout >/dev/null # stdout is redirected to trash and message is printed on stdout, so we do not seen message
/home/local/code/ansiccode/sysfile/stdout 2>/dev/null # stderr is redirected to trash, but message is printed on stdout, so we se message
rezultat będzie zależny od podanych argumentów wywołania programu:


stdout: argc=1 argv[0]=/home/local/code/ansiccode/sysfile/stdout
fputs:stdout:text
Jak widać na powyższym przykładzie uruchomienie program z przekierowanym standardowym wyjściowym strumieniem 2>/dev/null program nie wyświetla nic (wiadomość wyświetlana jest na standardowym wyjściowym strumieniu).



#top struct _IO_FILE


Definicja struktury struct _IO_FILE znajduje się w pliku nagłówkowym libio.h.
Definicja struktury struct _IO_FILE jest następująca:
struct _IO_FILE {
  int _flags;           /* High-order word is _IO_MAGIC; rest is flags. */
#define _IO_file_flags _flags

  /* The following pointers correspond to the C++ streambuf protocol. */
  /* Note:  Tk uses the _IO_read_ptr and _IO_read_end fields directly. */
  char* _IO_read_ptr;   /* Current read pointer */
  char* _IO_read_end;   /* End of get area. */
  char* _IO_read_base;  /* Start of putback+get area. */
  char* _IO_write_base; /* Start of put area. */
  char* _IO_write_ptr;  /* Current put pointer. */
  char* _IO_write_end;  /* End of put area. */
  char* _IO_buf_base;   /* Start of reserve area. */
  char* _IO_buf_end;    /* End of reserve area. */
  /* The following fields are used to support backing up and undo. */
  char *_IO_save_base; /* Pointer to start of non-current get area. */
  char *_IO_backup_base;  /* Pointer to first valid character of backup area */
  char *_IO_save_end; /* Pointer to end of non-current get area. */

  struct _IO_marker *_markers;

  struct _IO_FILE *_chain;

  int _fileno;
#if 0
  int _blksize;
#else
  int _flags2;
#endif
  _IO_off_t _old_offset; :* This used to be _offset but it's too small.  */

#define __HAVE_COLUMN /* temporary */
  /* 1+column number of pbase(); 0 is unknown. */
  unsigned short _cur_column;
  signed char _vtable_offset;
  char _shortbuf[1];

  /*  char* _save_gptr;  char* _save_egptr; */

  _IO_lock_t *_lock;
#ifdef _IO_USE_OLD_IO_FILE
};



#top struct _IO_marker


Definicja struktury struct _IO_marker znajduje się w pliku nagłówkowym libio.h.
Definicja struktury struct _IO_marker jest następująca:
/* A streammarker remembers a position in a buffer. */

struct _IO_marker {
  struct _IO_marker *_next;
  struct _IO_FILE *_sbuf;
  /* If _pos >= 0
 it points to _buf->Gbase()+_pos. FIXME comment */
  /* if _pos < 0, it points to _buf->eBptr()+_pos. FIXME comment */
  int _pos;
#if 0
    void set_streampos(streampos sp) { _spos = sp; }
    void set_offset(int offset) { _pos = offset; _spos = (streampos)(-2); }
  public:
    streammarker(streambuf *sb);
    ~streammarker();
    int saving() { return  _spos == -2; }
    int delta(streammarker&);
    int delta();
#endif
};



#top struct flock


Definicja struktury struct flock znajduje się w pliku nagłówkowym bits/fcntl.h.
Definicja struktury struct flock jest następująca:
struct flock
  {
    short int l_type;   /* Type of lock: F_RDLCK, F_WRLCK, or F_UNLCK.  */
    short int l_whence; /* Where `l_start' is relative to (like `lseek').  */
#ifndef __USE_FILE_OFFSET64
    __off_t l_start;    :* Offset where the lock begins.  */
    __off_t l_len;  :* Size of the locked area; zero means until EOF.  */
#else
    __off64_t l_start;  /* Offset where the lock begins.  */
    __off64_t l_len;    /* Size of the locked area; zero means until EOF.  */
#endif
    __pid_t l_pid;  :* Process holding the lock.  */
  };



#top struct stat


Definicja struktury struct stat znajduje się w pliku nagłówkowym bits/stat.h.
Definicja struktury struct stat jest następująca:
struct stat
  {
    __dev_t st_dev;                     :* Device.  */
    unsigned short int __pad1;
#ifndef __USE_FILE_OFFSET64
    __ino_t st_ino;                     :* File serial number.  */
#else
    __ino_t __st_ino;                   :* 32bit file serial number.    */
#endif
    __mode_t st_mode;                   :* File mode.  */
    __nlink_t st_nlink;                 :* Link count.  */
    __uid_t st_uid;                     :* User ID of the file's owner. */
    __gid_t st_gid;                     :* Group ID of the file's group.*/
    __dev_t st_rdev;                    :* Device number, if device.  */
    unsigned short int __pad2;
#ifndef __USE_FILE_OFFSET64
    __off_t st_size;                    :* Size of file, in bytes.  */
#else
    __off64_t st_size;                  /* Size of file, in bytes.  */
#endif
    __blksize_t st_blksize;             :* Optimal block size for I/O.  */

#ifndef __USE_FILE_OFFSET64
    __blkcnt_t st_blocks;               :* Number 512-byte blocks allocated. */
#else
    __blkcnt64_t st_blocks;             /* Number 512-byte blocks allocated. */
#endif
#ifdef __USE_MISC
    /* Nanosecond resolution timestamps are stored in a format
       equivalent to 'struct timespec'.  This is the type used
       whenever possible but the Unix namespace rules do not allow the
       identifier 'timespec' to appear in the <sys/stat.h> header.
       Therefore we have to handle the use of this header in strictly
       standard-compliant sources special.  */
    struct timespec st_atim;            :* Time of last access.  */
    struct timespec st_mtim;            :* Time of last modification.  */
    struct timespec st_ctim;            :* Time of last status change.  */
# define st_atime st_atim.tv_sec        /* Backward compatibility.  */
# define st_mtime st_mtim.tv_sec
# define st_ctime st_ctim.tv_sec
#else
    __time_t st_atime;                  :* Time of last access.  */
    unsigned long int st_atimensec;     /* Nscecs of last access.  */
    __time_t st_mtime;                  :* Time of last modification.  */
    unsigned long int st_mtimensec;     /* Nsecs of last modification.  */
    __time_t st_ctime;                  :* Time of last status change.  */
    unsigned long int st_ctimensec;     /* Nsecs of last status change.  */
#endif
#ifndef __USE_FILE_OFFSET64
    unsigned long int __unused4;
    unsigned long int __unused5;
#else
    __ino64_t st_ino;                   /* File serial number.  */
#endif
  };



#top struct statfs


Definicja struktury struct statfs znajduje się w pliku nagłówkowym bits/statfs.h.
Definicja struktury struct statfs jest następująca:
struct statfs
  {
    __SWORD_TYPE f_type;
    __SWORD_TYPE f_bsize;
#ifndef __USE_FILE_OFFSET64
    __fsblkcnt_t f_blocks;
    __fsblkcnt_t f_bfree;
    __fsblkcnt_t f_bavail;
    __fsfilcnt_t f_files;
    __fsfilcnt_t f_ffree;
#else
    __fsblkcnt64_t f_blocks;
    __fsblkcnt64_t f_bfree;
    __fsblkcnt64_t f_bavail;
    __fsfilcnt64_t f_files;
    __fsfilcnt64_t f_ffree;
#endif
    __fsid_t f_fsid;
    __SWORD_TYPE f_namelen;
    __SWORD_TYPE f_frsize;
    __SWORD_TYPE f_spare[5];
  };



#top struct statvfs


Definicja struktury struct statvfs znajduje się w pliku nagłówkowym bits/statvfs.h.
Definicja struktury struct statvfs jest następująca:
struct statvfs
  {
    unsigned long int f_bsize;
    unsigned long int f_frsize;
#ifndef __USE_FILE_OFFSET64
    __fsblkcnt_t f_blocks;
    __fsblkcnt_t f_bfree;
    __fsblkcnt_t f_bavail;
    __fsfilcnt_t f_files;
    __fsfilcnt_t f_ffree;
    __fsfilcnt_t f_favail;
#else
    __fsblkcnt64_t f_blocks;
    __fsblkcnt64_t f_bfree;
    __fsblkcnt64_t f_bavail;
    __fsfilcnt64_t f_files;
    __fsfilcnt64_t f_ffree;
    __fsfilcnt64_t f_favail;
#endif
    unsigned long int f_fsid;
#ifdef _STATVFSBUF_F_UNUSED
    int __f_unused;
#endif
    unsigned long int f_flag;
    unsigned long int f_namemax;
    int __f_spare[6];
  };



#top struct timespec


Definicja struktury struct timespec znajduje się w pliku nagłówkowym time.h.
Definicja struktury struct timespec jest następująca:
/* POSIX.1b structure for a time value.  This is like a `struct timeval' but
   has nanoseconds instead of microseconds.  */
struct timespec
  {
    __time_t tv_sec;        :* Seconds.  */
    long int tv_nsec;       /* Nanoseconds.  */
  };



#top struct timeval


Definicja struktury struct timeval znajduje się w pliku nagłówkowym bits/time.h.
Definicja struktury struct timeval jest następująca:
/* A time value that is accurate to the nearest
   microsecond but also has a range of years.  */
struct timeval
  {
    __time_t tv_sec;        :* Seconds.  */
    __suseconds_t tv_usec;  :* Microseconds.  */
  };



#top struct utimbuf


Definicja struktury struct utimbuf znajduje się w pliku nagłówkowym utime.h.
Definicja struktury struct utimbuf jest następująca:
/* Structure describing file times.  */
struct utimbuf
  {
    __time_t actime;       :* Access time.  */
    __time_t modtime;      :* Modification time.  */
  };



#top uid_t


Definicja typu uid_t znajduje się w pliku nagłówkowym unistd.h.
Definicja typu uid_t jest następująca:
# ifndef __uid_t_defined
typedef __uid_t uid_t;
#  define __uid_t_defined
# endif





#top Filesystem Functions


#top access


Documentacja online: pubs.opengroup.org | www.cplusplus.com | pl.wikibooks.org

Deklaracja funkcji access() znajduje się w pliku nagłówkowym unistd.h.
Deklaracja funkcji access() jest następująca:
/* Test for access to NAME using the real UID and real GID.  */
extern int access (__const char *__name, int __type) __THROW __nonnull ((1));

Powiązane:
access(), faccessat(), fstat(), fstatat(), lstat(), stat(), statfs(), statvfs(),

Opis:
Funkcja access()

Argumenty:
const char *__name -
int __type -

Zwracana wartość:
int -

Example:
zawartość pliku access.c
SELECT ALL
#define  _GNU_SOURCE  1    /* for environ defined in unistd.h, to avoid warning implicit declaration of function basename, which defined in string.h */
#include <stdio.h>         /* for FILE, va_list, EOF, SEEK_SET, SEEK_CUR, SEEK_END, stdin, stdout, stderr, remove(), rename(), tmpfile(), tmpnam(), tempnam(), fclose(), */
                           /* fflush(), fopen(), freopen(), fprintf(), printf(), snprintf(), scanf(), sscanf(), fgetc(), getc(), getchar(), fputc(), putc(), putchar(), */
                           /* fgets(), gets(), fputs(), puts(), fread(), fwrite(), fseek(), ftell(), rewind(), feof(), ferror(), fileno(), popen(), pclose(), */
#include <string.h>        /* for memcpy(), memmove(), memset(), memcmp(), memchr(), memrchr(), str[n]cpy(), str[n]cat(), str[n]cmp(), strcoll(), str[n]dup(), strchr(), strrchr(), strstr(), */
                           /* strtok(), strcasestr(), memmem(), mempcpy(), str[n]len(), strerror(), bcopy(), bzero(), strcasecmp(), strsep(), basename(), */
#include <unistd.h>        /* for R_OK, W_OK, X_OK, F_OK, environ, access(), lseek(), close(), read(), write(), pipe(), alarm(), sleep(), ualarm(), usleep(), pause(), chown(), chdir(), getcwd(), */
                           /* for exec[...](), nice(), getpid(), getppid(), setpgid(), setsid(), getsid(), getuid(), geteuid(). getgid(), getegid(), setuid(), seteuid(), setgid(), setegid(), fork(), */
                           /* for link(), symlink(), readlink(), unlink(), rmdir(), getlogin(), setlogin(), gethostname(), sethostname(), daemon(), chroot(), getpass(), [f]sync(), [f]truncate(), syscall(), */



int main(int argc, char **argv) {
	char *self;
	
	self=strrchr(argv[0], '/');
	if (self!=NULL) self++;
	else self=argv[0];
	
	if (argc<2) {
		printf("Usage: %s </path/to/filename>\n", argv[0]);
		return 0;
	}
	
	if (access(argv[1],F_OK)==0) {
		printf("%s: if (access(argv[1]=%s,F_OK=%d)==0): OK: file '%s' exists\n", self, argv[1], F_OK, argv[1]);
	} else {
		printf("%s: if (access(argv[1]=%s,F_OK=%d)==0): else: NOK: file '%s' does not exists\n", self, argv[1], F_OK, argv[1]);
	}
	
	if (access(argv[1],R_OK)==0) {
		printf("%s: if (access(argv[1]=%s,R_OK=%d)==0): OK: file '%s' is readable\n", self, argv[1], R_OK, argv[1]);
	} else {
		printf("%s: if (access(argv[1]=%s,R_OK=%d)==0): else: NOK: file '%s' is not readable\n", self, argv[1], R_OK, argv[1]);
	}
	
	if (access(argv[1],W_OK)==0) {
		printf("%s: if (access(argv[1]=%s,W_OK=%d)==0): OK: file '%s' is writable\n", self, argv[1], W_OK, argv[1]);
	} else {
		printf("%s: if (access(argv[1]=%s,W_OK=%d)==0): else: NOK: file '%s' is not writable\n", self, argv[1], W_OK, argv[1]);
	}
	
	if (access(argv[1],X_OK)==0) {
		printf("%s: if (access(argv[1]=%s,X_OK=%d)==0): OK: file '%s' is executable\n", self, argv[1], X_OK, argv[1]);
	} else {
		printf("%s: if (access(argv[1]=%s,X_OK=%d)==0): else: NOK: file '%s' is not executable\n", self, argv[1], X_OK, argv[1]);
	}
	
	return 0;
}

program należy skompilować komendą make (jako argument należy podać plik Makefile zależny od systemu operacyjnego, domyślnie make próbuje użyć pliku Makefile):
make clean all # system Linux
make -f Makefile clean all # system Linux
make -f Makefile.obsd clean all # system OpenBSD
make -f Makefile.fbsd clean all # system FreeBSD
make -f Makefile.sol clean all # system Solaris
make -f Makefile.beos clean all # system BeOS
make -f Makefile.win clean all # system Windows

a następnie uruchomić bez argumentów:
/home/local/code/ansiccode/sysfile/access
program wyświetli informacje o sposobie uruchamiania programu:
Usage: /home/local/code/ansiccode/sysfile/access </path/to/filename>

jako argument wywołania programu można podać analogiczne jak poniżej argumenty:
/home/local/code/ansiccode/sysfile/access /path/to/not/existed/file
/home/local/code/ansiccode/sysfile/access /tmp/not-existed-file
/home/local/code/ansiccode/sysfile/access /root
/home/local/code/ansiccode/sysfile/access /tmp
/home/local/code/ansiccode/sysfile/access /dev
/home/local/code/ansiccode/sysfile/access /dev/null
/home/local/code/ansiccode/sysfile/access /dev/zero
/home/local/code/ansiccode/sysfile/access /dev/sda
/home/local/code/ansiccode/sysfile/access /home/local/code/ansiccode/sysfile/R_OK
rezultat będzie zależny od podanych argumentów wywołania programu:
access: if (access(argv[1]=/path/to/not/existed/file,F_OK=0)==0): else: NOK: file '/path/to/not/existed/file' does not exists
access: if (access(argv[1]=/path/to/not/existed/file,R_OK=4)==0): else: NOK: file '/path/to/not/existed/file' is not readable
access: if (access(argv[1]=/path/to/not/existed/file,W_OK=2)==0): else: NOK: file '/path/to/not/existed/file' is not writable
access: if (access(argv[1]=/path/to/not/existed/file,X_OK=1)==0): else: NOK: file '/path/to/not/existed/file' is not executable

access: if (access(argv[1]=/tmp/not-existed-file,F_OK=0)==0): else: NOK: file '/tmp/not-existed-file' does not exists
access: if (access(argv[1]=/tmp/not-existed-file,R_OK=4)==0): else: NOK: file '/tmp/not-existed-file' is not readable
access: if (access(argv[1]=/tmp/not-existed-file,W_OK=2)==0): else: NOK: file '/tmp/not-existed-file' is not writable
access: if (access(argv[1]=/tmp/not-existed-file,X_OK=1)==0): else: NOK: file '/tmp/not-existed-file' is not executable

access: if (access(argv[1]=/root,F_OK=0)==0): OK: file '/root' exists
access: if (access(argv[1]=/root,R_OK=4)==0): else: NOK: file '/root' is not readable
access: if (access(argv[1]=/root,W_OK=2)==0): else: NOK: file '/root' is not writable
access: if (access(argv[1]=/root,X_OK=1)==0): else: NOK: file '/root' is not executable

access: if (access(argv[1]=/tmp,F_OK=0)==0): OK: file '/tmp' exists
access: if (access(argv[1]=/tmp,R_OK=4)==0): OK: file '/tmp' is readable
access: if (access(argv[1]=/tmp,W_OK=2)==0): OK: file '/tmp' is writable
access: if (access(argv[1]=/tmp,X_OK=1)==0): OK: file '/tmp' is executable

access: if (access(argv[1]=/dev,F_OK=0)==0): OK: file '/dev' exists
access: if (access(argv[1]=/dev,R_OK=4)==0): OK: file '/dev' is readable
access: if (access(argv[1]=/dev,W_OK=2)==0): else: NOK: file '/dev' is not writable
access: if (access(argv[1]=/dev,X_OK=1)==0): OK: file '/dev' is executable

access: if (access(argv[1]=/dev/null,F_OK=0)==0): OK: file '/dev/null' exists
access: if (access(argv[1]=/dev/null,R_OK=4)==0): OK: file '/dev/null' is readable
access: if (access(argv[1]=/dev/null,W_OK=2)==0): OK: file '/dev/null' is writable
access: if (access(argv[1]=/dev/null,X_OK=1)==0): else: NOK: file '/dev/null' is not executable

access: if (access(argv[1]=/dev/zero,F_OK=0)==0): OK: file '/dev/zero' exists
access: if (access(argv[1]=/dev/zero,R_OK=4)==0): OK: file '/dev/zero' is readable
access: if (access(argv[1]=/dev/zero,W_OK=2)==0): OK: file '/dev/zero' is writable
access: if (access(argv[1]=/dev/zero,X_OK=1)==0): else: NOK: file '/dev/zero' is not executable

access: if (access(argv[1]=/dev/sda,F_OK=0)==0): OK: file '/dev/sda' exists
access: if (access(argv[1]=/dev/sda,R_OK=4)==0): else: NOK: file '/dev/sda' is not readable
access: if (access(argv[1]=/dev/sda,W_OK=2)==0): else: NOK: file '/dev/sda' is not writable
access: if (access(argv[1]=/dev/sda,X_OK=1)==0): else: NOK: file '/dev/sda' is not executable

access: if (access(argv[1]=/home/local/code/ansiccode/sysfile/R_OK,F_OK=0)==0): else: NOK: file '/home/local/code/ansiccode/sysfile/R_OK' does not exists
access: if (access(argv[1]=/home/local/code/ansiccode/sysfile/R_OK,R_OK=4)==0): else: NOK: file '/home/local/code/ansiccode/sysfile/R_OK' is not readable
access: if (access(argv[1]=/home/local/code/ansiccode/sysfile/R_OK,W_OK=2)==0): else: NOK: file '/home/local/code/ansiccode/sysfile/R_OK' is not writable
access: if (access(argv[1]=/home/local/code/ansiccode/sysfile/R_OK,X_OK=1)==0): else: NOK: file '/home/local/code/ansiccode/sysfile/R_OK' is not executable



#top chmod


Documentacja online: pubs.opengroup.org | www.cplusplus.com | pl.wikibooks.org

Deklaracja funkcji chmod() znajduje się w pliku nagłówkowym unistd.h.
Deklaracja funkcji chmod() jest następująca:
/* Set file access permissions for FILE to MODE.
   If FILE is a symbolic link, this affects its target instead.  */
extern int chmod (__const char *__file, __mode_t __mode)
     __THROW __nonnull ((1));

Powiązane:
chmod(), fchmod(), fchmodat(), lchmod(),

Opis:
Funkcja chmod()

Argumenty:
const char *__file -
__mode_t __mode -

Zwracana wartość:
int -

Example:
zawartość pliku chmod.c
SELECT ALL


program należy skompilować komendą make (jako argument należy podać plik Makefile zależny od systemu operacyjnego, domyślnie make próbuje użyć pliku Makefile):
make clean all # system Linux
make -f Makefile clean all # system Linux
make -f Makefile.obsd clean all # system OpenBSD
make -f Makefile.fbsd clean all # system FreeBSD
make -f Makefile.sol clean all # system Solaris
make -f Makefile.beos clean all # system BeOS
make -f Makefile.win clean all # system Windows

a następnie uruchomić bez argumentów:

program wyświetli informacje o sposobie uruchamiania programu:


jako argument wywołania programu można podać analogiczne jak poniżej argumenty:

rezultat będzie zależny od podanych argumentów wywołania programu:




#top chown


Documentacja online: pubs.opengroup.org | www.cplusplus.com | pl.wikibooks.org

Deklaracja funkcji chown() znajduje się w pliku nagłówkowym unistd.h.
Deklaracja funkcji chown() jest następująca:
/* Change the owner and group of FILE.  *:
extern int chown (__const char *__file, __uid_t __owner, __gid_t __group)
     __THROW __nonnull ((1)) __wur;

Powiązane:
chown(), fchown(), fchownat(), lchown(),

Opis:
Funkcja chown()

Argumenty:
const char *__file -
__uid_t __owner -
__gid_t __group -

Zwracana wartość:
int -

Example:
zawartość pliku chown.c
SELECT ALL
#define  _GNU_SOURCE  1    /* for environ defined in unistd.h, to avoid warning implicit declaration of function basename, which defined in string.h */
#include <stdio.h>         /* for FILE, va_list, EOF, SEEK_SET, SEEK_CUR, SEEK_END, stdin, stdout, stderr, remove(), rename(), tmpfile(), tmpnam(), tempnam(), fclose(), */
                           /* fflush(), fopen(), freopen(), fprintf(), printf(), snprintf(), scanf(), sscanf(), fgetc(), getc(), getchar(), fputc(), putc(), putchar(), */
                           /* fgets(), gets(), fputs(), puts(), fread(), fwrite(), fseek(), ftell(), rewind(), feof(), ferror(), fileno(), popen(), pclose(), */
#include <stdlib.h>        /* for RAND_MAX, EXIT_FAILURE, EXIT_SUCCESS, MB_CUR_MAX, atoi(), atol(), atoll(), atof(), strtod(), strtof(), strtold(), strtol(), strtoul(), strtoq(), strtouq(), strtoll(), strtoull(), */
                           /* for sys/types.h, malloc.h replaced by stdlib.h, random(), srandom(), rand(), srand(), abort(), atexit(), on_exit(), exit(), getenv(), */
                           /* for putenv(), setenv(), clearenv(), mktemp(), mkstemp(), mkdtemp(), system(), realpath(), abs(), labs(), llabs(), getloadavg(), */
#include <string.h>        /* for memcpy(), memmove(), memset(), memcmp(), memchr(), memrchr(), str[n]cpy(), str[n]cat(), str[n]cmp(), strcoll(), str[n]dup(), strchr(), strrchr(), strstr(), */
                           /* strtok(), strcasestr(), memmem(), mempcpy(), str[n]len(), strerror(), bcopy(), bzero(), strcasecmp(), strsep(), basename(), */
#include <unistd.h>        /* for R_OK, W_OK, X_OK, F_OK, environ, access(), lseek(), close(), read(), write(), pipe(), alarm(), sleep(), ualarm(), usleep(), pause(), chown(), chdir(), getcwd(), */
                           /* for exec[...](), nice(), getpid(), getppid(), setpgid(), setsid(), getsid(), getuid(), geteuid(). getgid(), getegid(), setuid(), seteuid(), setgid(), setegid(), fork(), */
                           /* for link(), symlink(), readlink(), unlink(), rmdir(), getlogin(), setlogin(), gethostname(), sethostname(), daemon(), chroot(), getpass(), [f]sync(), [f]truncate(), syscall(), */
#include <errno.h>         /* for errno constant, error constants, */



int main(int argc, char **argv) {
	char *self;
#if defined(__WIN32__) || defined(WIN32) || defined(_WIN32)
#else
	int result;
	uid_t owner;
	gid_t group;
#endif
	
	self=strrchr(argv[0], '/');
	if (self!=NULL) self++;
	else self=argv[0];
	
	if (argc<4) {
		printf("Usage: %s </path/to/filename> <uid> <gid>\n", argv[0]);
		return 0;
	}
	
#if defined(__WIN32__) || defined(WIN32) || defined(_WIN32)
	/* chown() is not available on this OS platform !!! */
	printf("%s: chown() is not available on this OS platform !!!\n", self);
#else
	owner=atoi(argv[2]);
	group=atoi(argv[3]);
	
	printf("%s: result=chown(argv[1]=%s, owner=%d, group=%d):\n", self, argv[1], owner, group);
	result=chown(argv[1], owner, group);
	if (result>=0) printf("%s: result=chown(argv[1]=%s, owner=%d, group=%d): result=%d if (result>=0): Successful chown() file.\n", self, argv[1], owner, group, result);
	else           printf("%s: result=chown(argv[1]=%s, owner=%d, group=%d): result=%d if (result>=0): else: Unable to chown() file, Reason: %d:%s\n", self, argv[1], owner, group, result, errno, strerror(errno));
#endif
	return 0;
}

program należy skompilować komendą make (jako argument należy podać plik Makefile zależny od systemu operacyjnego, domyślnie make próbuje użyć pliku Makefile):
make clean all # system Linux
make -f Makefile clean all # system Linux
make -f Makefile.obsd clean all # system OpenBSD
make -f Makefile.fbsd clean all # system FreeBSD
make -f Makefile.sol clean all # system Solaris
make -f Makefile.beos clean all # system BeOS
make -f Makefile.win clean all # system Windows

a następnie uruchomić bez argumentów:
/home/local/code/ansiccode/sysfile/chown
program wyświetli informacje o sposobie uruchamiania programu:
Usage: /home/local/code/ansiccode/sysfile/chown </path/to/filename> <uid> <gid>

jako argument wywołania programu można podać analogiczne jak poniżej argumenty:
/home/local/code/ansiccode/sysfile/chown /home/local/code/ansiccode/sysfile/chown 501 100
/home/local/code/ansiccode/sysfile/chown /home/local/code/ansiccode/sysfile/chown 501 95
/home/local/code/ansiccode/sysfile/chown /home/local/code/ansiccode/sysfile/chown 501 48
/home/local/code/ansiccode/sysfile/chown /home/local/code/ansiccode/sysfile/chown 501 98
/home/local/code/ansiccode/sysfile/chown /home/local/code/ansiccode/sysfile/chown 501 0
/home/local/code/ansiccode/sysfile/chown /home/local/code/ansiccode/sysfile/chown 501 100
/home/local/code/ansiccode/sysfile/chown /home/local/code/ansiccode/sysfile/chown 502 100
/home/local/code/ansiccode/sysfile/chown /home/local/code/ansiccode/sysfile/chown 503 100
/home/local/code/ansiccode/sysfile/chown /home/local/code/ansiccode/sysfile/chown 0 100
/home/local/code/ansiccode/sysfile/chown /home/local/code/ansiccode/sysfile/chown 0 100

/home/local/code/ansiccode/sysfile/chown /path/to/not/existed/file 501 100
/home/local/code/ansiccode/sysfile/chown /tmp/not-existed-file 501 100
/home/local/code/ansiccode/sysfile/chown /root 501 100
/home/local/code/ansiccode/sysfile/chown /tmp 501 100
/home/local/code/ansiccode/sysfile/chown /dev 501 100
/home/local/code/ansiccode/sysfile/chown /dev/null 501 100
/home/local/code/ansiccode/sysfile/chown /dev/zero 501 100
/home/local/code/ansiccode/sysfile/chown /dev/sda 501 100
/home/local/code/ansiccode/sysfile/chown /home/local/code/ansiccode/sysfile/chown 501 100
rezultat będzie zależny od podanych argumentów wywołania programu:
chown: result=chown(argv[1]=/home/local/code/ansiccode/sysfile/chown, owner=501, group=100):
chown: result=chown(argv[1]=/home/local/code/ansiccode/sysfile/chown, owner=501, group=100): result=0 if (result>=0): Successful chown file.

chown: result=chown(argv[1]=/home/local/code/ansiccode/sysfile/chown, owner=501, group=95):
chown: result=chown(argv[1]=/home/local/code/ansiccode/sysfile/chown, owner=501, group=95): result=0 if (result>=0): Successful chown file.

chown: result=chown(argv[1]=/home/local/code/ansiccode/sysfile/chown, owner=501, group=48):
chown: result=chown(argv[1]=/home/local/code/ansiccode/sysfile/chown, owner=501, group=48): result=0 if (result>=0): Successful chown file.

chown: result=chown(argv[1]=/home/local/code/ansiccode/sysfile/chown, owner=501, group=98):
chown: result=chown(argv[1]=/home/local/code/ansiccode/sysfile/chown, owner=501, group=98): result=-1 if (result>=0): else: Unable to chown file, Reason: 1:Operation not permitted

chown: result=chown(argv[1]=/home/local/code/ansiccode/sysfile/chown, owner=501, group=0):
chown: result=chown(argv[1]=/home/local/code/ansiccode/sysfile/chown, owner=501, group=0): result=-1 if (result>=0): else: Unable to chown file, Reason: 1:Operation not permitted

chown: result=chown(argv[1]=/home/local/code/ansiccode/sysfile/chown, owner=501, group=100):
chown: result=chown(argv[1]=/home/local/code/ansiccode/sysfile/chown, owner=501, group=100): result=0 if (result>=0): Successful chown file.

chown: result=chown(argv[1]=/home/local/code/ansiccode/sysfile/chown, owner=502, group=100):
chown: result=chown(argv[1]=/home/local/code/ansiccode/sysfile/chown, owner=502, group=100): result=-1 if (result>=0): else: Unable to chown file, Reason: 1:Operation not permitted

chown: result=chown(argv[1]=/home/local/code/ansiccode/sysfile/chown, owner=503, group=100):
chown: result=chown(argv[1]=/home/local/code/ansiccode/sysfile/chown, owner=503, group=100): result=-1 if (result>=0): else: Unable to chown file, Reason: 1:Operation not permitted

chown: result=chown(argv[1]=/home/local/code/ansiccode/sysfile/chown, owner=0, group=100):
chown: result=chown(argv[1]=/home/local/code/ansiccode/sysfile/chown, owner=0, group=100): result=-1 if (result>=0): else: Unable to chown file, Reason: 1:Operation not permitted



chown: result=chown(argv[1]=/path/to/not/existed/file, owner=501, group=100):
chown: result=chown(argv[1]=/path/to/not/existed/file, owner=501, group=100): result=-1 if (result>=0): else: Unable to chown() file, Reason: 2:No such file or directory

chown: result=chown(argv[1]=/tmp/not-existed-file, owner=501, group=100):
chown: result=chown(argv[1]=/tmp/not-existed-file, owner=501, group=100): result=-1 if (result>=0): else: Unable to chown() file, Reason: 2:No such file or directory

chown: result=chown(argv[1]=/root, owner=501, group=100):
chown: result=chown(argv[1]=/root, owner=501, group=100): result=-1 if (result>=0): else: Unable to chown() file, Reason: 1:Operation not permitted

chown: result=chown(argv[1]=/tmp, owner=501, group=100):
chown: result=chown(argv[1]=/tmp, owner=501, group=100): result=-1 if (result>=0): else: Unable to chown() file, Reason: 1:Operation not permitted

chown: result=chown(argv[1]=/dev, owner=501, group=100):
chown: result=chown(argv[1]=/dev, owner=501, group=100): result=-1 if (result>=0): else: Unable to chown() file, Reason: 1:Operation not permitted

chown: result=chown(argv[1]=/dev/null, owner=501, group=100):
chown: result=chown(argv[1]=/dev/null, owner=501, group=100): result=-1 if (result>=0): else: Unable to chown() file, Reason: 1:Operation not permitted

chown: result=chown(argv[1]=/dev/zero, owner=501, group=100):
chown: result=chown(argv[1]=/dev/zero, owner=501, group=100): result=-1 if (result>=0): else: Unable to chown() file, Reason: 1:Operation not permitted

chown: result=chown(argv[1]=/dev/sda, owner=501, group=100):
chown: result=chown(argv[1]=/dev/sda, owner=501, group=100): result=-1 if (result>=0): else: Unable to chown() file, Reason: 1:Operation not permitted

chown: result=chown(argv[1]=/home/local/code/ansiccode/sysfile/chown, owner=501, group=100):
chown: result=chown(argv[1]=/home/local/code/ansiccode/sysfile/chown, owner=501, group=100): result=0 if (result>=0): Successful chown() file.

Example:
Funkcja chgrp() nie istnieje, jednakże nie oznacza to, że aby zmienić grupę pliku, należy odczytać najpierw właściciela pliku poprzez np: wywołanie funkcji stat(), a następnie ustawić za pomocą chown() bieżącego własciciela pliku (czyli bez zmiany) oraz ustawić żądaną grupę pliku. Korzystając z pewnego triku za pomocą funkcji chown() można zmienić grupę pliki nie znając właściciela, wystarczy jako argument określający właściciela pliku podać wartość -1 (niedowzolony identyfikator numeryczny właściciela pliku), wtedy wywołanie chown() spowoduje zmianę tylko grupy pliku.
zawartość pliku chgrp.c
SELECT ALL
#define  _GNU_SOURCE  1    /* for environ defined in unistd.h, to avoid warning implicit declaration of function basename, which defined in string.h */
#include <stdio.h>         /* for FILE, va_list, EOF, SEEK_SET, SEEK_CUR, SEEK_END, stdin, stdout, stderr, remove(), rename(), tmpfile(), tmpnam(), tempnam(), fclose(), */
                           /* fflush(), fopen(), freopen(), fprintf(), printf(), snprintf(), scanf(), sscanf(), fgetc(), getc(), getchar(), fputc(), putc(), putchar(), */
                           /* fgets(), gets(), fputs(), puts(), fread(), fwrite(), fseek(), ftell(), rewind(), feof(), ferror(), fileno(), popen(), pclose(), */
#include <stdlib.h>        /* for RAND_MAX, EXIT_FAILURE, EXIT_SUCCESS, MB_CUR_MAX, atoi(), atol(), atoll(), atof(), strtod(), strtof(), strtold(), strtol(), strtoul(), strtoq(), strtouq(), strtoll(), strtoull(), */
                           /* for sys/types.h, malloc.h replaced by stdlib.h, random(), srandom(), rand(), srand(), abort(), atexit(), on_exit(), exit(), getenv(), */
                           /* for putenv(), setenv(), clearenv(), mktemp(), mkstemp(), mkdtemp(), system(), realpath(), abs(), labs(), llabs(), getloadavg(), */
#include <string.h>        /* for memcpy(), memmove(), memset(), memcmp(), memchr(), memrchr(), str[n]cpy(), str[n]cat(), str[n]cmp(), strcoll(), str[n]dup(), strchr(), strrchr(), strstr(), */
                           /* strtok(), strcasestr(), memmem(), mempcpy(), str[n]len(), strerror(), bcopy(), bzero(), strcasecmp(), strsep(), basename(), */
#include <unistd.h>        /* for R_OK, W_OK, X_OK, F_OK, environ, access(), lseek(), close(), read(), write(), pipe(), alarm(), sleep(), ualarm(), usleep(), pause(), chown(), chdir(), getcwd(), */
                           /* for exec[...](), nice(), getpid(), getppid(), setpgid(), setsid(), getsid(), getuid(), geteuid(). getgid(), getegid(), setuid(), seteuid(), setgid(), setegid(), fork(), */
                           /* for link(), symlink(), readlink(), unlink(), rmdir(), getlogin(), setlogin(), gethostname(), sethostname(), daemon(), chroot(), getpass(), [f]sync(), [f]truncate(), syscall(), */
#include <errno.h>         /* for errno constant, error constants, */



int main(int argc, char **argv) {
	char *self;
#if defined(__WIN32__) || defined(WIN32) || defined(_WIN32)
#else
	int result;
	uid_t owner;
	gid_t group;
#endif
	
	self=strrchr(argv[0], '/');
	if (self!=NULL) self++;
	else self=argv[0];
	
	if (argc<3) {
		printf("Usage: %s </path/to/filename> <gid>\n", argv[0]);
		return 0;
	}
	
#if defined(__WIN32__) || defined(WIN32) || defined(_WIN32)
	/* chown() is not available on this OS platform !!! */
#else
	owner=-1;
	group=atoi(argv[2]);
	
	printf("%s: result=chown(argv[1]=%s, owner=%d, group=%d):\n", self, argv[1], owner, group);
	result=chown(argv[1], owner, group);
	if (result>=0) printf("%s: result=chown(argv[1]=%s, owner=%d, group=%d): result=%d if (result>=0): Successful chown() file.\n", self, argv[1], owner, group, result);
	else           printf("%s: result=chown(argv[1]=%s, owner=%d, group=%d): result=%d if (result>=0): else: Unable to chown() file, Reason: %d:%s\n", self, argv[1], owner, group, result, errno, strerror(errno));
#endif
	return 0;
}

program należy skompilować komendą make (jako argument należy podać plik Makefile zależny od systemu operacyjnego, domyślnie make próbuje użyć pliku Makefile):
make clean all # system Linux
make -f Makefile clean all # system Linux
make -f Makefile.obsd clean all # system OpenBSD
make -f Makefile.fbsd clean all # system FreeBSD
make -f Makefile.sol clean all # system Solaris
make -f Makefile.beos clean all # system BeOS
make -f Makefile.win clean all # system Windows

a następnie uruchomić bez argumentów:
/home/local/code/ansiccode/sysfile/chgrp
program wyświetli informacje o sposobie uruchamiania programu:
Usage: /home/local/code/ansiccode/sysfile/chgrp </path/to/filename> <gid>

jako argument wywołania programu można podać analogiczne jak poniżej argumenty:
/home/local/code/ansiccode/sysfile/chgrp /home/local/code/ansiccode/sysfile/chgrp 100
/home/local/code/ansiccode/sysfile/chgrp /home/local/code/ansiccode/sysfile/chgrp 95
/home/local/code/ansiccode/sysfile/chgrp /home/local/code/ansiccode/sysfile/chgrp 48
/home/local/code/ansiccode/sysfile/chgrp /home/local/code/ansiccode/sysfile/chgrp 98
/home/local/code/ansiccode/sysfile/chgrp /home/local/code/ansiccode/sysfile/chgrp 0
/home/local/code/ansiccode/sysfile/chgrp /home/local/code/ansiccode/sysfile/chgrp 100

/home/local/code/ansiccode/sysfile/chgrp /path/to/not/existed/file 100
/home/local/code/ansiccode/sysfile/chgrp /tmp/not-existed-file 100
/home/local/code/ansiccode/sysfile/chgrp /root 100
/home/local/code/ansiccode/sysfile/chgrp /tmp 100
/home/local/code/ansiccode/sysfile/chgrp /dev 100
/home/local/code/ansiccode/sysfile/chgrp /dev/null 100
/home/local/code/ansiccode/sysfile/chgrp /dev/zero 100
/home/local/code/ansiccode/sysfile/chgrp /dev/sda 100
/home/local/code/ansiccode/sysfile/chgrp /home/local/code/ansiccode/sysfile/chgrp 100
rezultat będzie zależny od podanych argumentów wywołania programu:
chgrp: result=chown(argv[1]=/home/local/code/ansiccode/sysfile/chgrp, owner=-1, group=100):
chgrp: result=chown(argv[1]=/home/local/code/ansiccode/sysfile/chgrp, owner=-1, group=100): result=0 if (result>=0): Successful chown() file.

chgrp: result=chown(argv[1]=/home/local/code/ansiccode/sysfile/chgrp, owner=-1, group=95):
chgrp: result=chown(argv[1]=/home/local/code/ansiccode/sysfile/chgrp, owner=-1, group=95): result=0 if (result>=0): Successful chown() file.

chgrp: result=chown(argv[1]=/home/local/code/ansiccode/sysfile/chgrp, owner=-1, group=48):
chgrp: result=chown(argv[1]=/home/local/code/ansiccode/sysfile/chgrp, owner=-1, group=48): result=0 if (result>=0): Successful chown() file.

chgrp: result=chown(argv[1]=/home/local/code/ansiccode/sysfile/chgrp, owner=-1, group=98):
chgrp: result=chown(argv[1]=/home/local/code/ansiccode/sysfile/chgrp, owner=-1, group=98): result=-1 if (result>=0): else: Unable to chown() file, Reason: 1:Operation not permitted

chgrp: result=chown(argv[1]=/home/local/code/ansiccode/sysfile/chgrp, owner=-1, group=0):
chgrp: result=chown(argv[1]=/home/local/code/ansiccode/sysfile/chgrp, owner=-1, group=0): result=-1 if (result>=0): else: Unable to chown() file, Reason: 1:Operation not permitted

chgrp: result=chown(argv[1]=/home/local/code/ansiccode/sysfile/chgrp, owner=-1, group=100):
chgrp: result=chown(argv[1]=/home/local/code/ansiccode/sysfile/chgrp, owner=-1, group=100): result=0 if (result>=0): Successful chown() file.



chgrp: result=chown(argv[1]=/path/to/not/existed/file, owner=-1, group=100):
chgrp: result=chown(argv[1]=/path/to/not/existed/file, owner=-1, group=100): result=-1 if (result>=0): else: Unable to chown() file, Reason: 2:No such file or directory

chgrp: result=chown(argv[1]=/tmp/not-existed-file, owner=-1, group=100):
chgrp: result=chown(argv[1]=/tmp/not-existed-file, owner=-1, group=100): result=-1 if (result>=0): else: Unable to chown() file, Reason: 2:No such file or directory

chgrp: result=chown(argv[1]=/root, owner=-1, group=100):
chgrp: result=chown(argv[1]=/root, owner=-1, group=100): result=-1 if (result>=0): else: Unable to chown() file, Reason: 1:Operation not permitted

chgrp: result=chown(argv[1]=/tmp, owner=-1, group=100):
chgrp: result=chown(argv[1]=/tmp, owner=-1, group=100): result=-1 if (result>=0): else: Unable to chown() file, Reason: 1:Operation not permitted

chgrp: result=chown(argv[1]=/dev, owner=-1, group=100):
chgrp: result=chown(argv[1]=/dev, owner=-1, group=100): result=-1 if (result>=0): else: Unable to chown() file, Reason: 1:Operation not permitted

chgrp: result=chown(argv[1]=/dev/null, owner=-1, group=100):
chgrp: result=chown(argv[1]=/dev/null, owner=-1, group=100): result=-1 if (result>=0): else: Unable to chown() file, Reason: 1:Operation not permitted

chgrp: result=chown(argv[1]=/dev/zero, owner=-1, group=100):
chgrp: result=chown(argv[1]=/dev/zero, owner=-1, group=100): result=-1 if (result>=0): else: Unable to chown() file, Reason: 1:Operation not permitted

chgrp: result=chown(argv[1]=/dev/sda, owner=-1, group=100):
chgrp: result=chown(argv[1]=/dev/sda, owner=-1, group=100): result=-1 if (result>=0): else: Unable to chown() file, Reason: 1:Operation not permitted

chgrp: result=chown(argv[1]=/home/local/code/ansiccode/sysfile/chgrp, owner=-1, group=100):
chgrp: result=chown(argv[1]=/home/local/code/ansiccode/sysfile/chgrp, owner=-1, group=100): result=0 if (result>=0): Successful chown() file.



#top close


Documentacja online: pubs.opengroup.org | www.cplusplus.com | pl.wikibooks.org

Deklaracja funkcji close() znajduje się w pliku nagłówkowym unistd.h.
Deklaracja funkcji close() jest następująca:
/* Close the file descriptor FD.

   This function is a cancellation point and therefore not marked with
   __THROW.  */
extern int close (int __fd);

Powiązane:
close(), fclose(), fopen(), freopen(), open(), openat(),

Opis:
Funkcja close()

Argumenty:
int __fd -

Zwracana wartość:
int -



#top dprintf


Documentacja online: pubs.opengroup.org | www.cplusplus.com | pl.wikibooks.org

Deklaracja funkcji dprintf() znajduje się w pliku nagłówkowym stdio.h.
Deklaracja funkcji dprintf() jest następująca:
/* Write formatted output to a file descriptor.

   These functions are not part of POSIX and therefore no official
   cancellation point.  But due to similarity with an POSIX interface
   or due to the implementation they are cancellation points and
   therefore not marked with __THROW.  */
extern int dprintf (int __fd, __const char *__restrict __fmt, ...)
     __attribute__ ((__format__ (__printf__, 2, 3)));

Powiązane:
dprintf(), fprintf(), vdprintf(), vfprintf(),

Opis:
Funkcja dprintf()

Argumenty:
int __fd -
const char *__restrict __format -
... -

Zwracana wartość:
int -

Example:
zawartość pliku dprintf.c
SELECT ALL


program należy skompilować komendą make (jako argument należy podać plik Makefile zależny od systemu operacyjnego, domyślnie make próbuje użyć pliku Makefile):
make clean all # system Linux
make -f Makefile clean all # system Linux
make -f Makefile.obsd clean all # system OpenBSD
make -f Makefile.fbsd clean all # system FreeBSD
make -f Makefile.sol clean all # system Solaris
make -f Makefile.beos clean all # system BeOS
make -f Makefile.win clean all # system Windows

a następnie uruchomić bez argumentów:

program wyświetli informacje o sposobie uruchamiania programu:


a następnie uruchomić w następujący sposób:

w rezultacie program wyświetli następujące informacje:

oraz zostanie utworzony plik ls -l /home/local/code/ansiccode/sysfile/dprintf-test:

zawierający następującą zawartość cat /home/local/code/ansiccode/sysfile/dprintf-test:





#top dup


Documentacja online: pubs.opengroup.org | www.cplusplus.com | pl.wikibooks.org

Deklaracja funkcji dup() znajduje się w pliku nagłówkowym unistd.h.
Deklaracja funkcji dup() jest następująca:
/* Duplicate FD, returning a new file descriptor on the same file.  */
extern int dup (int __fd) __THROW __wur;

Powiązane:
dup(), dup2(),

Opis:
Funkcja dup()

Argumenty:
int __fd -

Zwracana wartość:
int -

Example:
zawartość pliku dup.c
SELECT ALL
#define  _GNU_SOURCE  1    /* for environ defined in unistd.h, to avoid warning implicit declaration of function basename, which defined in string.h */
#include <stdio.h>         /* for FILE, va_list, EOF, SEEK_SET, SEEK_CUR, SEEK_END, stdin, stdout, stderr, remove(), rename(), tmpfile(), tmpnam(), tempnam(), fclose(), */
                           /* fflush(), fopen(), freopen(), fprintf(), printf(), snprintf(), scanf(), sscanf(), fgetc(), getc(), getchar(), fputc(), putc(), putchar(), */
                           /* fgets(), gets(), fputs(), puts(), fread(), fwrite(), fseek(), ftell(), rewind(), feof(), ferror(), fileno(), popen(), pclose(), */
#include <string.h>        /* for memcpy(), memmove(), memset(), memcmp(), memchr(), memrchr(), str[n]cpy(), str[n]cat(), str[n]cmp(), strcoll(), str[n]dup(), strchr(), strrchr(), strstr(), */
                           /* strtok(), strcasestr(), memmem(), mempcpy(), str[n]len(), strerror(), bcopy(), bzero(), strcasecmp(), strsep(), basename(), */
#include <unistd.h>        /* for R_OK, W_OK, X_OK, F_OK, environ, access(), lseek(), close(), read(), write(), pipe(), alarm(), sleep(), ualarm(), usleep(), pause(), chown(), chdir(), getcwd(), */
                           /* for exec[...](), nice(), getpid(), getppid(), setpgid(), setsid(), getsid(), getuid(), geteuid(). getgid(), getegid(), setuid(), seteuid(), setgid(), setegid(), fork(), */
                           /* for link(), symlink(), readlink(), unlink(), rmdir(), getlogin(), setlogin(), gethostname(), sethostname(), daemon(), chroot(), getpass(), fsync(), sync(), [f]truncate(), syscall(), */
#include <errno.h>         /* for errno variable, error constants, */

#if defined(__WIN32__) || defined(WIN32) || defined(_WIN32)
  #define WIN32_LEAN_AND_MEAN
  #include <fcntl.h>       /* for io.h, O_RDONLY, O_WRONLY, O_RDWR, O_CREAT, O_TRUNC, O_APPEND, */
#else
  #include <fcntl.h>       /* for O_RDONLY, O_WRONLY, O_RDWR, O_CREAT, O_TRUNC, O_APPEND, F_GETFL, F_SETFL, O_NONBLOCK, O_SYNC, FASYNC, O_DIRECT, O_LARGEFILE, O_DIRECTORY, O_NOFOLLOW, O_NOATIME, O_NDELAY, */
                           /* for LOCK_SH, LOCK_EX, LOCK_NB, LOCK_UN, LOCK_MAND, LOCK_READ, LOCK_WRITE, LOCK_RW, fcntl(), open(), creat(), */
#endif



int main(int argc, char **argv) {
	char *self;
	int fprd, fpd2;
	int result;
	int seekpos;
	
	self=strrchr(argv[0], '/');
	if (self!=NULL) self++;
	else self=argv[0];
	
	if (argc<2) {
		printf("Usage: %s </path/to/filename>\n", argv[0]);
		return 0;
	}
	
	fprd=open(argv[1], O_RDONLY, 0644);
	if (fprd>=0) {
		printf("%s: fprd=open(argv[1]=%s, O_RDONLY=%d, 0644); fprd=%d if (fprd>=0): Successful open() file.\n", self, argv[1], O_RDONLY, fprd);
		
		fpd2=dup(fprd);
		
		result=lseek(fprd, 12, SEEK_SET);
		if (result>=0) printf("%s: result=lseek(fprd=%d, 12, SEEK_SET=%d); result=%d if (result>=0): Successful SEEK_CUR\n", self, fprd, SEEK_SET, result);
		else           printf("%s: result=lseek(fprd=%d, 12, SEEK_SET=%d); result=%d if (result>=0): else: Unable to lseek(SEEK_CUR), Reason=%d:%s\n", self, fprd, SEEK_SET, result, errno, strerror(errno));
		
		seekpos=lseek(fprd, 0, SEEK_CUR);
		printf("%s: seekpos=lseek(fprd=%d, 0, SEEK_CUR=%d): seekpos=%d\n", self, fprd, SEEK_CUR, seekpos);
		seekpos=lseek(fpd2, 0, SEEK_CUR);
		printf("%s: seekpos=lseek(fpd2=%d, 0, SEEK_CUR=%d): seekpos=%d\n", self, fpd2, SEEK_CUR, seekpos);
		
		result=lseek(fpd2, 24, SEEK_SET);
		if (result>=0) printf("%s: result=lseek(fpd2=%d, 24, SEEK_SET=%d); result=%d if (result>=0): Successful SEEK_CUR\n", self, fpd2, SEEK_SET, result);
		else           printf("%s: result=lseek(fpd2=%d, 24, SEEK_SET=%d); result=%d if (result>=0): else: Unable to lseek(SEEK_CUR), Reason=%d:%s\n", self, fpd2, SEEK_SET, result, errno, strerror(errno));
		
		seekpos=lseek(fprd, 0, SEEK_CUR);
		printf("%s: seekpos=lseek(fprd=%d, 0, SEEK_CUR=%d): seekpos=%d\n", self, fprd, SEEK_CUR, seekpos);
		seekpos=lseek(fpd2, 0, SEEK_CUR);
		printf("%s: seekpos=lseek(fpd2=%d, 0, SEEK_CUR=%d): seekpos=%d\n", self, fpd2, SEEK_CUR, seekpos);
		
		close(fprd);
		close(fpd2);
	} else {
		printf("%s: fprd=open(argv[1]=%s, O_RDONLY=%d, 0644); fprd=%d if (fprd>=0): else: Unable to open() file, Reason: %d:%s\n", self, argv[1], O_RDONLY, fprd, errno, strerror(errno));
	}
	return 0;
}

program należy skompilować komendą make (jako argument należy podać plik Makefile zależny od systemu operacyjnego, domyślnie make próbuje użyć pliku Makefile):
make clean all # system Linux
make -f Makefile clean all # system Linux
make -f Makefile.obsd clean all # system OpenBSD
make -f Makefile.fbsd clean all # system FreeBSD
make -f Makefile.sol clean all # system Solaris
make -f Makefile.beos clean all # system BeOS
make -f Makefile.win clean all # system Windows

a następnie uruchomić bez argumentów:
/home/local/code/ansiccode/sysfile/dup
program wyświetli informacje o sposobie uruchamiania programu:
Usage: /home/local/code/ansiccode/sysfile/dup </path/to/filename>

jako argument wywołania programu można podać analogiczne jak poniżej argumenty:
/home/local/code/ansiccode/sysfile/dup /home/local/code/ansiccode/sysfile/dup.c
rezultat będzie zależny od podanych argumentów wywołania programu:
dup: fprd=open(argv[1]=/home/local/code/ansiccode/sysfile/dup.c, O_RDONLY=0, 0644); fprd=3 if (fprd>=0): Successful opened file '/home/local/code/ansiccode/sysfile/dup.c'.
dup: result=lseek(fprd=3, 12, SEEK_SET=0); result=12 if (result>=0): Successful SEEK_CUR
dup: seekpos=lseek(fprd=3, 0, SEEK_CUR=1): seekpos=12
dup: seekpos=lseek(fpd2=4, 0, SEEK_CUR=1): seekpos=12
dup: result=lseek(fpd2=4, 24, SEEK_SET=0); result=24 if (result>=0): Successful SEEK_CUR
dup: seekpos=lseek(fprd=3, 0, SEEK_CUR=1): seekpos=24
dup: seekpos=lseek(fpd2=4, 0, SEEK_CUR=1): seekpos=24



#top dup2


Documentacja online: pubs.opengroup.org | www.cplusplus.com | pl.wikibooks.org

Deklaracja funkcji dup2() znajduje się w pliku nagłówkowym unistd.h.
Deklaracja funkcji dup2() jest następująca:
/* Duplicate FD to FD2, closing FD2 and making it open on the same file.  */
extern int dup2 (int __fd, int __fd2) __THROW;

Powiązane:
dup(), dup2(),

Opis:
Funkcja dup2()

Argumenty:
int __fd -
int __fd2 -

Zwracana wartość:
int -

Example:
zawartość pliku dup2.c
SELECT ALL
#define  _GNU_SOURCE  1    /* for environ defined in unistd.h, to avoid warning implicit declaration of function basename, which defined in string.h */
#include <stdio.h>         /* for FILE, va_list, EOF, SEEK_SET, SEEK_CUR, SEEK_END, stdin, stdout, stderr, remove(), rename(), tmpfile(), tmpnam(), tempnam(), fclose(), */
                           /* fflush(), fopen(), freopen(), fprintf(), printf(), snprintf(), scanf(), sscanf(), fgetc(), getc(), getchar(), fputc(), putc(), putchar(), */
                           /* fgets(), gets(), fputs(), puts(), fread(), fwrite(), fseek(), ftell(), rewind(), feof(), ferror(), fileno(), popen(), pclose(), */
#include <string.h>        /* for memcpy(), memmove(), memset(), memcmp(), memchr(), memrchr(), str[n]cpy(), str[n]cat(), str[n]cmp(), strcoll(), str[n]dup(), strchr(), strrchr(), strstr(), */
                           /* strtok(), strcasestr(), memmem(), mempcpy(), str[n]len(), strerror(), bcopy(), bzero(), strcasecmp(), strsep(), basename(), */
#include <unistd.h>        /* for R_OK, W_OK, X_OK, F_OK, environ, access(), lseek(), close(), read(), write(), pipe(), alarm(), sleep(), ualarm(), usleep(), pause(), chown(), chdir(), getcwd(), */
                           /* for exec[...](), nice(), getpid(), getppid(), setpgid(), setsid(), getsid(), getuid(), geteuid(). getgid(), getegid(), setuid(), seteuid(), setgid(), setegid(), fork(), */
                           /* for link(), symlink(), readlink(), unlink(), rmdir(), getlogin(), setlogin(), gethostname(), sethostname(), daemon(), chroot(), getpass(), fsync(), sync(), [f]truncate(), syscall(), */
#include <errno.h>         /* for errno variable, error constants, */

#if defined(__WIN32__) || defined(WIN32) || defined(_WIN32)
  #define WIN32_LEAN_AND_MEAN
  #include <fcntl.h>       /* for io.h, O_RDONLY, O_WRONLY, O_RDWR, O_CREAT, O_TRUNC, O_APPEND, */
#else
  #include <fcntl.h>       /* for O_RDONLY, O_WRONLY, O_RDWR, O_CREAT, O_TRUNC, O_APPEND, F_GETFL, F_SETFL, O_NONBLOCK, O_SYNC, FASYNC, O_DIRECT, O_LARGEFILE, O_DIRECTORY, O_NOFOLLOW, O_NOATIME, O_NDELAY, */
                           /* for LOCK_SH, LOCK_EX, LOCK_NB, LOCK_UN, LOCK_MAND, LOCK_READ, LOCK_WRITE, LOCK_RW, fcntl(), open(), creat(), */
#endif



int main(int argc, char **argv) {
	char *self;
	int fprd, fpd2;
	int result;
	int seekpos;
	
	self=strrchr(argv[0], '/');
	if (self!=NULL) self++;
	else self=argv[0];
	
	if (argc<2) {
		printf("Usage: %s </path/to/filename>\n", argv[0]);
		return 0;
	}
	
	fprd=open(argv[1], O_RDONLY, 0644);
	fpd2=open(argv[1], O_RDONLY, 0644);
	if (fprd>=0 && fpd2>=0) {
		printf("%s: fprd=open(argv[1]=%s, O_RDONLY=%d, 0644); fprd=%d if (fprd>=0): Successful open() file.\n", self, argv[1], O_RDONLY, fprd);
		
		result=dup2(fprd, fpd2);
		if (result>=0) printf("%s: result=dup2(fprd=%d, fpd2=%d); result=%d if (result>=0): Successful SEEK_CUR\n", self, fprd, fpd2, result);
		else           printf("%s: result=dup2(fprd=%d, fpd2=%d); result=%d if (result>=0): else: Unable to fpd2(), Reason=%d:%s\n", self, fprd, fpd2, result, errno, strerror(errno));
		
		result=lseek(fprd, 12, SEEK_SET);
		if (result>=0) printf("%s: result=lseek(fprd=%d, 12, SEEK_SET=%d); result=%d if (result>=0): Successful SEEK_CUR\n", self, fprd, SEEK_SET, result);
		else           printf("%s: result=lseek(fprd=%d, 12, SEEK_SET=%d); result=%d if (result>=0): else: Unable to lseek(SEEK_CUR), Reason=%d:%s\n", self, fprd, SEEK_SET, result, errno, strerror(errno));
		
		seekpos=lseek(fprd, 0, SEEK_CUR);
		printf("%s: seekpos=lseek(fprd=%d, 0, SEEK_CUR=%d): seekpos=%d\n", self, fprd, SEEK_CUR, seekpos);
		seekpos=lseek(fpd2, 0, SEEK_CUR);
		printf("%s: seekpos=lseek(fpd2=%d, 0, SEEK_CUR=%d): seekpos=%d\n", self, fpd2, SEEK_CUR, seekpos);
		
		result=lseek(fpd2, 24, SEEK_SET);
		if (result>=0) printf("%s: result=lseek(fpd2=%d, 24, SEEK_SET=%d); result=%d if (result>=0): Successful SEEK_CUR\n", self, fpd2, SEEK_SET, result);
		else           printf("%s: result=lseek(fpd2=%d, 24, SEEK_SET=%d); result=%d if (result>=0): else: Unable to lseek(SEEK_CUR), Reason=%d:%s\n", self, fpd2, SEEK_SET, result, errno, strerror(errno));
		
		seekpos=lseek(fprd, 0, SEEK_CUR);
		printf("%s: seekpos=lseek(fprd=%d, 0, SEEK_CUR=%d): seekpos=%d\n", self, fprd, SEEK_CUR, seekpos);
		seekpos=lseek(fpd2, 0, SEEK_CUR);
		printf("%s: seekpos=lseek(fpd2=%d, 0, SEEK_CUR=%d): seekpos=%d\n", self, fpd2, SEEK_CUR, seekpos);
		
		close(fprd);
		close(fpd2);
	} else {
		if (!fprd>=0) printf("%s: fprd=open(argv[1]=%s, O_RDONLY=%d, 0644); fprd=%d if (fprd>=0): else: Unable to open() file, Reason: %d:%s\n", self, argv[1], O_RDONLY, fprd, errno, strerror(errno));
		if (!fpd2>=0) printf("%s: fpd2=open(argv[1]=%s, O_RDONLY=%d, 0644); fpr2=%d if (fpr2>=0): else: Unable to open() file, Reason: %d:%s\n", self, argv[1], O_RDONLY, fpd2, errno, strerror(errno));
	}
	return 0;
}

program należy skompilować komendą make (jako argument należy podać plik Makefile zależny od systemu operacyjnego, domyślnie make próbuje użyć pliku Makefile):
make clean all # system Linux
make -f Makefile clean all # system Linux
make -f Makefile.obsd clean all # system OpenBSD
make -f Makefile.fbsd clean all # system FreeBSD
make -f Makefile.sol clean all # system Solaris
make -f Makefile.beos clean all # system BeOS
make -f Makefile.win clean all # system Windows

a następnie uruchomić bez argumentów:
/home/local/code/ansiccode/sysfile/dup2
program wyświetli informacje o sposobie uruchamiania programu:
Usage: /home/local/code/ansiccode/sysfile/dup2 </path/to/filename>

jako argument wywołania programu można podać analogiczne jak poniżej argumenty:
/home/local/code/ansiccode/sysfile/dup2 /home/local/code/ansiccode/sysfile/dup2.c
rezultat będzie zależny od podanych argumentów wywołania programu:
dup2: fprd=open(argv[1]=/home/local/code/ansiccode/sysfile/dup2.c, O_RDONLY=0, 0644); fprd=3 if (fprd>=0): Successful opened file '/home/local/code/ansiccode/sysfile/dup2.c'.
dup2: result=dup2(fprd=3, fpd2=4); result=4 if (result>=0): Successful SEEK_CUR
dup2: result=lseek(fprd=3, 12, SEEK_SET=0); result=12 if (result>=0): Successful SEEK_CUR
dup2: seekpos=lseek(fprd=3, 0, SEEK_CUR=1): seekpos=12
dup2: seekpos=lseek(fpd2=4, 0, SEEK_CUR=1): seekpos=12
dup2: result=lseek(fpd2=4, 24, SEEK_SET=0); result=24 if (result>=0): Successful SEEK_CUR
dup2: seekpos=lseek(fprd=3, 0, SEEK_CUR=1): seekpos=24
dup2: seekpos=lseek(fpd2=4, 0, SEEK_CUR=1): seekpos=24



#top faccessat


Documentacja online: pubs.opengroup.org | www.cplusplus.com | pl.wikibooks.org

Deklaracja funkcji faccessat() znajduje się w pliku nagłówkowym unistd.h.
Deklaracja funkcji faccessat() jest następująca:
#ifdef __USE_ATFILE
/* Test for access to FILE relative to the directory FD is open on.
   If AT_EACCESS is set in FLAG, then use effective IDs like `eaccess',
   otherwise use real IDs like `access'.  */
extern int faccessat (int __fd, __const char *__file, int __type, int __flag)
     __THROW __nonnull ((2)) __wur;
#endif /* Use GNU.  */

Powiązane:
access(), faccessat(), fstat(), fstatat(), lstat(), stat(), statfs(), statvfs(),

Opis:
Funkcja faccessat()

Argumenty:
int __fd -
const char *__file -
int __type -
int __flag -

Zwracana wartość:
int -





#top fchmod


Documentacja online: pubs.opengroup.org | www.cplusplus.com | pl.wikibooks.org

Deklaracja funkcji fchmod() znajduje się w pliku nagłówkowym unistd.h.
Deklaracja funkcji fchmod() jest następująca:
/* Set file access permissions of the file FD is open on to MODE.  */
#if defined __USE_BSD || defined __USE_XOPEN_EXTENDED
extern int fchmod (int __fd, __mode_t __mode) __THROW;
#endif

Powiązane:
chmod(), fchmod(), fchmodat(), lchmod(),

Opis:
Funkcja fchmod()

Argumenty:
int __fd -
__mode_t __mode -

Zwracana wartość:
int -



#top fchmodat


Documentacja online: pubs.opengroup.org | www.cplusplus.com | pl.wikibooks.org

Deklaracja funkcji fchmodat() znajduje się w pliku nagłówkowym sys/stat.h.
Deklaracja funkcji fchmodat() jest następująca:
#ifdef __USE_ATFILE
/* Set file access permissions of FILE relative to
   the directory FD is open on.  */
extern int fchmodat (int __fd, __const char *__file, __mode_t mode, int __flag)
     __THROW __nonnull ((2)) __wur;
#endif /* Use ATFILE.  */

Powiązane:
chmod(), fchmod(), fchmodat(), lchmod(),

Opis:
Funkcja fchmodat()

Argumenty:
int __fd -
const char *__file -
__mode_t __mode -
int __flag -

Zwracana wartość:
int -



#top fchown


Documentacja online: pubs.opengroup.org | www.cplusplus.com | pl.wikibooks.org

Deklaracja funkcji fchown() znajduje się w pliku nagłówkowym unistd.h.
Deklaracja funkcji fchown() jest następująca:
/* Change the owner and group of the file that FD is open on.  */
extern int fchown (int __fd, __uid_t __owner, __gid_t __group) __THROW __wur;

Powiązane:
chown(), fchown(), fchownat(), lchown(),

Opis:
Funkcja fchown()

Argumenty:
int __fd -
__uid_t __owner -
__gid_t __group -

Zwracana wartość:
int -



#top fchownat


Documentacja online: pubs.opengroup.org | www.cplusplus.com | pl.wikibooks.org

Deklaracja funkcji fchownat() znajduje się w pliku nagłówkowym unistd.h.
Deklaracja funkcji fchownat() jest następująca:
#ifdef __USE_ATFILE
/* Change the owner and group of FILE relative to the directory FD is open
   on.  */
extern int fchownat (int __fd, __const char *__file, __uid_t __owner,
             __gid_t __group, int __flag)
     __THROW __nonnull ((2)) __wur;
#endif /* Use GNU.  */

Powiązane:
chown(), fchown(), fchownat(), lchown(),

Opis:
Funkcja fchown()

Argumenty:
int __fd -
__uid_t __owner -
__gid_t __group -

Zwracana wartość:
int -



#top fclose


Documentacja online: pubs.opengroup.org | www.cplusplus.com | pl.wikibooks.org

Deklaracja funkcji fclose() znajduje się w pliku nagłówkowym stdio.h.
Deklaracja funkcji fclose() jest następująca:
/* Close STREAM.

   This function is a possible cancellation point and therefore not
   marked with __THROW.  */
extern int fclose (FILE *__stream);

Powiązane:
close(), fclose(), fopen(), freopen(), open(), openat(),

Opis:
Funkcja fclose()

Argumenty:
FILE *__stream -

Zwracana wartość:
int -



#top fcntl


Documentacja online: pubs.opengroup.org | www.cplusplus.com | pl.wikibooks.org

Deklaracja funkcji fcntl() znajduje się w pliku nagłówkowym fcntl.h.
Deklaracja funkcji fcntl() jest następująca:
/* Do the file control operation described by CMD on FD.
   The remaining arguments are interpreted depending on CMD.

   This function is a cancellation point and therefore not marked with
   __THROW.  */
extern int fcntl (int __fd, int __cmd, ...);

Powiązane:
fcntl(), flock(), lockf(),

Opis:
Funkcja fcntl()

Argumenty:
int __fd -
int __cmd -
The available values for cmd are defined in the header <fcntl.h>, which include:
F_DUPFD Return a new file descriptor which is the lowest numbered available (that is, not already open) file descriptor greater than or equal to the third argument, arg, taken as an integer of type int. The new file descriptor refers to the same open file description as the original file descriptor, and shares any locks. The FD_CLOEXEC flag associated with the new file descriptor is cleared to keep the file open across calls to one of the exec functions.
F_GETFD Get the file descriptor flags defined in <fcntl.h> that are associated with the file descriptor fildes. File descriptor flags are associated with a single file descriptor and do not affect other file descriptors that refer to the same file.
F_SETFD Set the file descriptor flags defined in <fcntl.h>, that are associated with fildes, to the third argument, arg, taken as type int. If the FD_CLOEXEC flag in the third argument is 0, the file will remain open across the exec functions; otherwise the file will be closed upon successful execution of one of the exec functions.
F_GETFL Get the file status flags and file access modes, defined in <fcntl.h>, for the file description associated with fildes. The file access modes can be extracted from the return value using the mask O_ACCMODE, which is defined in <fcntl.h>. File status flags and file access modes are associated with the file description and do not affect other file descriptors that refer to the same file with different open file descriptions.
F_SETFL Set the file status flags, defined in <fcntl.h>, for the file description associated with fildes from the corresponding bits in the third argument, arg, taken as type int. Bits corresponding to the file access mode and the oflag values that are set in arg are ignored. If any bits in arg other than those mentioned here are changed by the application, the result is unspecified.

The following values for cmd are available for advisory record locking. Record locking is supported for regular files, and may be supported for other files.
F_GETLK Get the first lock which blocks the lock description pointed to by the third argument, arg, taken as a pointer to type struct flock, defined in <fcntl.h>. The information retrieved overwrites the information passed to fcntl() in the structure flock. If no lock is found that would prevent this lock from being created, then the structure will be left unchanged except for the lock type which will be set to F_UNLCK.
F_SETLK Set or clear a file segment lock according to the lock description pointed to by the third argument, arg, taken as a pointer to type struct flock, defined in <fcntl.h>. F_SETLK is used to establish shared (or read) locks (F_RDLCK) or exclusive (or write) locks (F_WRLCK), as well as to remove either type of lock (F_UNLCK). F_RDLCK, F_WRLCK and F_UNLCK are defined in <fcntl.h>. If a shared or exclusive lock cannot be set, fcntl() will return immediately with a return value of -1.
F_SETLKW This command is the same as F_SETLK except that if a shared or exclusive lock is blocked by other locks, the thread will wait until the request can be satisfied. If a signal that is to be caught is received while fcntl() is waiting for a region, fcntl() will be interrupted. Upon return from the signal handler, fcntl() will return -1 with errno set to [EINTR], and the lock operation will not be done.
... - Additional implementation-dependent values for cmd may be defined in <fcntl.h>. Their names will start with F_.
for __cmd F_SETFL following values are defined:

Zwracana wartość:
int -

Example:
zawartość pliku fcntl.c
SELECT ALL


program należy skompilować komendą make (jako argument należy podać plik Makefile zależny od systemu operacyjnego, domyślnie make próbuje użyć pliku Makefile):
make clean all # system Linux
make -f Makefile clean all # system Linux
make -f Makefile.obsd clean all # system OpenBSD
make -f Makefile.fbsd clean all # system FreeBSD
make -f Makefile.sol clean all # system Solaris
make -f Makefile.beos clean all # system BeOS
make -f Makefile.win clean all # system Windows

a następnie uruchomić bez argumentów:

program wyświetli informacje o sposobie uruchamiania programu:


jako argument wywołania programu można podać analogiczne jak poniżej argumenty:

rezultat będzie zależny od podanych argumentów wywołania programu:




#top fdatasync


Documentacja online: pubs.opengroup.org | www.cplusplus.com | pl.wikibooks.org

Deklaracja funkcji fdatasync() znajduje się w pliku nagłówkowym unistd.h.
Deklaracja funkcji fdatasync() jest następująca:
/* Synchronize at least the data part of a file with the underlying
   media.  */
extern int fdatasync (int __fildes);

Powiązane:
fdatasync(), fflush(), fsync(), sync(),

Opis:
Funkcja fdatasync()

Argumenty:
int __fildes -

Zwracana wartość:
int -

Example:
zawartość pliku fdatasync.c
SELECT ALL


program należy skompilować komendą make (jako argument należy podać plik Makefile zależny od systemu operacyjnego, domyślnie make próbuje użyć pliku Makefile):
make clean all # system Linux
make -f Makefile clean all # system Linux
make -f Makefile.obsd clean all # system OpenBSD
make -f Makefile.fbsd clean all # system FreeBSD
make -f Makefile.sol clean all # system Solaris
make -f Makefile.beos clean all # system BeOS
make -f Makefile.win clean all # system Windows

a następnie uruchomić bez argumentów:

program wyświetli informacje o sposobie uruchamiania programu:


jako argument wywołania programu można podać analogiczne jak poniżej argumenty:

rezultat będzie zależny od podanych argumentów wywołania programu:




#top fdopen


Documentacja online: pubs.opengroup.org | www.cplusplus.com | pl.wikibooks.org

Deklaracja funkcji fdopen() znajduje się w pliku nagłówkowym unistd.h.
Deklaracja funkcji fdopen() jest następująca:
/* Create a new stream that refers to an existing system file descriptor.  */
extern FILE *fdopen (int __fd, __const char *__modes) __THROW;

Powiązane:
fdopen, fileno,

Opis:
Funkcja fdopen()

Argumenty:
int __fd -
const char *__modes -

Zwracana wartość:
FILE * -

Example:
zawartość pliku fdopen.c
SELECT ALL


program należy skompilować komendą make (jako argument należy podać plik Makefile zależny od systemu operacyjnego, domyślnie make próbuje użyć pliku Makefile):
make clean all # system Linux
make -f Makefile clean all # system Linux
make -f Makefile.obsd clean all # system OpenBSD
make -f Makefile.fbsd clean all # system FreeBSD
make -f Makefile.sol clean all # system Solaris
make -f Makefile.beos clean all # system BeOS
make -f Makefile.win clean all # system Windows

a następnie uruchomić bez argumentów:

program wyświetli informacje o sposobie uruchamiania programu:


jako argument wywołania programu można podać analogiczne jak poniżej argumenty:

rezultat będzie zależny od podanych argumentów wywołania programu:




#top feof


Documentacja online: pubs.opengroup.org | www.cplusplus.com | pl.wikibooks.org

Deklaracja funkcji feof() znajduje się w pliku nagłówkowym stdio.h.
Deklaracja funkcji feof() jest następująca:
/* Return the EOF indicator for STREAM.  */
extern int feof (FILE *__stream) __THROW __wur;

Powiązane:
feof(), fgetc(), fgets(), fputc(), fputs(),

Opis:
Funkcja feof()

Argumenty:
FILE *__stream -

Zwracana wartość:
int -



#top ferror


Documentacja online: pubs.opengroup.org | www.cplusplus.com | pl.wikibooks.org

Deklaracja funkcji ferror() znajduje się w pliku nagłówkowym stdio.h.
Deklaracja funkcji ferror() jest następująca:
/* Return the error indicator for STREAM.  */
extern int ferror (FILE *__stream) __THROW __wur;

Powiązane:

Opis:
Funkcja ferror()

Argumenty:
FILE *__stream -

Zwracana wartość:
int -

Example:
zawartość pliku ferror.c
SELECT ALL
#define  _GNU_SOURCE  1    /* for environ defined in unistd.h, to avoid warning implicit declaration of function basename, which defined in string.h */
#include <stdio.h>         /* for FILE, va_list, EOF, SEEK_SET, SEEK_CUR, SEEK_END, stdin, stdout, stderr, remove(), rename(), tmpfile(), tmpnam(), tempnam(), fclose(), */
                           /* fflush(), fopen(), freopen(), fprintf(), printf(), snprintf(), scanf(), sscanf(), fgetc(), getc(), getchar(), fputc(), putc(), putchar(), */
                           /* fgets(), gets(), fputs(), puts(), fread(), fwrite(), fseek(), ftell(), rewind(), feof(), ferror(), fileno(), popen(), pclose(), */
#include <string.h>        /* for memcpy(), memmove(), memset(), memcmp(), memchr(), memrchr(), str[n]cpy(), str[n]cat(), str[n]cmp(), strcoll(), str[n]dup(), strchr(), strrchr(), strstr(), */
                           /* strtok(), strcasestr(), memmem(), mempcpy(), str[n]len(), strerror(), bcopy(), bzero(), strcasecmp(), strsep(), basename(), */
#include <errno.h>         /* for errno constant, error constants, */



int main(int argc, char **argv) {
	char *self;
	FILE *file;
	char buffdata[1024];
	int result;
	
	self=strrchr(argv[0], '/');
	if (self!=NULL) self++;
	else self=argv[0];
	
	if (argc<2) {
		printf("Usage: %s </path/to/filename>\n", argv[0]);
		return 0;
	}
	
	file=fopen(argv[1], "w+");
	if (file!=NULL) {
		printf("%s: file=fopen(argv[1]=%s, \"w+\"); if (file!=NULL): Successful open() file.\n", self, argv[1]);
		fputs("ferror:line1\n", file);
		result=ferror(file);
		printf("%s: fputs(\"test1\\n\", file); result=ferror(file): result=%d\n", self, result);
		fputs("ferror:line2\n", file);
		result=ferror(file);
		printf("%s: fputs(\"test1\\n\", file); result=ferror(file): result=%d\n", self, result);
		fputs("ferror:line3\n", file);
		result=ferror(file);
		printf("%s: fputs(\"test1\\n\", file); result=ferror(file): result=%d\n", self, result);
		rewind(file);
		while (!feof(file)) {
			if (fgets(buffdata,sizeof(buffdata),file)!=NULL) {
				result=ferror(file);
				printf("%s: if (fgets(buffdata,sizeof(buffdata),file)!=NULL): result=ferror(file): result=%d\n", self, result);
			} else break;
		}
		fclose(file);
	} else {
		printf("%s: file=fopen(argv[1]=%s, \"w+\"); if (file!=NULL): else: Unable to open() file, Reason: %d:%s\n", self, argv[1], errno, strerror(errno));
	}
	
	return 0;
}

program należy skompilować komendą make (jako argument należy podać plik Makefile zależny od systemu operacyjnego, domyślnie make próbuje użyć pliku Makefile):
make clean all # system Linux
make -f Makefile clean all # system Linux
make -f Makefile.obsd clean all # system OpenBSD
make -f Makefile.fbsd clean all # system FreeBSD
make -f Makefile.sol clean all # system Solaris
make -f Makefile.beos clean all # system BeOS
make -f Makefile.win clean all # system Windows

a następnie uruchomić bez argumentów:
/home/local/code/ansiccode/sysfile/ferror
program wyświetli informacje o sposobie uruchamiania programu:
Usage: /home/local/code/ansiccode/sysfile/ferror </path/to/filename>

jako argument wywołania programu można podać analogiczne jak poniżej argumenty:
/home/local/code/ansiccode/sysfile/ferror /home/local/code/ansiccode/sysfile/ferror
rezultat będzie zależny od podanych argumentów wywołania programu:
ferror: file=fopen(argv[1]=/home/local/code/ansiccode/sysfile/ferror, "w+"); if (file!=NULL): else: Unable to open file '/home/local/code/ansiccode/sysfile/ferror', Reason: 26:Text file busy

jako argument wywołania programu można podać analogiczne jak poniżej argumenty:
/home/local/code/ansiccode/sysfile/ferror /home/local/code/ansiccode/sysfile/ferror-test
rezultat będzie zależny od podanych argumentów wywołania programu:
ferror: file=fopen(argv[1]=/home/local/code/ansiccode/sysfile/ferror-test, "w+"); if (file!=NULL): Successful open() file.
ferror: fputs("test1\n", file); result=ferror(file): result=0
ferror: fputs("test1\n", file); result=ferror(file): result=0
ferror: fputs("test1\n", file); result=ferror(file): result=0
ferror: if (fgets(buffdata,sizeof(buffdata),file)!=NULL): result=ferror(file): result=0
ferror: if (fgets(buffdata,sizeof(buffdata),file)!=NULL): result=ferror(file): result=0
ferror: if (fgets(buffdata,sizeof(buffdata),file)!=NULL): result=ferror(file): result=0



#top fflush


Documentacja online: pubs.opengroup.org | www.cplusplus.com | pl.wikibooks.org

Deklaracja funkcji fflush() znajduje się w pliku nagłówkowym stdio.h.
Deklaracja funkcji fflush() jest następująca:
/* Flush STREAM, or all streams if STREAM is NULL.

   This function is a possible cancellation point and therefore not
   marked with __THROW.  */
extern int fflush (FILE *__stream);

Powiązane:
fdatasync(), fflush(), fsync(), sync(),

Opis:
Funkcja fflush()

Argumenty:
FILE *__stream -

Zwracana wartość:
int -

Example:
zawartość pliku fflush.c
SELECT ALL
#define  _GNU_SOURCE  1    /* for environ defined in unistd.h, to avoid warning implicit declaration of function basename, which defined in string.h */
#include <stdio.h>         /* for FILE, va_list, EOF, SEEK_SET, SEEK_CUR, SEEK_END, stdin, stdout, stderr, remove(), rename(), tmpfile(), tmpnam(), tempnam(), fclose(), */
                           /* fflush(), fopen(), freopen(), fprintf(), printf(), snprintf(), scanf(), sscanf(), fgetc(), getc(), getchar(), fputc(), putc(), putchar(), */
                           /* fgets(), gets(), fputs(), puts(), fread(), fwrite(), fseek(), ftell(), rewind(), feof(), ferror(), fileno(), popen(), pclose(), */
#include <string.h>        /* for memcpy(), memmove(), memset(), memcmp(), memchr(), memrchr(), str[n]cpy(), str[n]cat(), str[n]cmp(), strcoll(), str[n]dup(), strchr(), strrchr(), strstr(), */
                           /* strtok(), strcasestr(), memmem(), mempcpy(), str[n]len(), strerror(), bcopy(), bzero(), strcasecmp(), strsep(), basename(), */
#include <errno.h>         /* for errno constant, error constants, */



int main(int argc, char **argv) {
	char *self;
	int result;
	FILE *file;
	char buffer[1024];
	
	self=strrchr(argv[0], '/');
	if (self!=NULL) self++;
	else self=argv[0];
	
	if (argc<2) {
		printf("Usage: %s</path/to/filename>\n", argv[0]);
		return 0;
	}
	
	file=fopen(argv[1], "w+");
	if (file!=NULL) {
		printf("%s: file=fopen(argv[1]=%s, \"w+\"); if (file!=NULL): Successful opened file '%s'.\n", self, argv[1], argv[1]);
		fputs("fflush:line1\n", file);
		fputs("fflush:line2\n", file);
		fputs("fflush:line3\n", file);
		result=fflush(file);
		if (result>=0) printf("%s: result=fflush(file): result=%d, Successful fflush file '%s'\n", self, result, argv[1]);
		else printf("%s: result=fflush(file): result=%d, Unable to fflush file '%s', Reason: %d:%s.\n", self, result, argv[1], errno, strerror(errno));
		rewind(file);
		while (!feof(file)) {
			if (fgets(buffer,256,file)!=NULL) fputs(buffer, stdout);
			else break;
		}
		fclose(file);
	} else {
		printf("%s: file=fopen(argv[1]=%s, \"w+\"); if (file!=NULL): else: Unable to open file '%s', Reason: %d:%s\n", self, argv[1], argv[1], errno, strerror(errno));
	}
	
	return 0;
}

program należy skompilować komendą make (jako argument należy podać plik Makefile zależny od systemu operacyjnego, domyślnie make próbuje użyć pliku Makefile):
make clean all # system Linux
make -f Makefile clean all # system Linux
make -f Makefile.obsd clean all # system OpenBSD
make -f Makefile.fbsd clean all # system FreeBSD
make -f Makefile.sol clean all # system Solaris
make -f Makefile.beos clean all # system BeOS
make -f Makefile.win clean all # system Windows

a następnie uruchomić bez argumentów:
/home/local/code/ansiccode/sysfile/fflush
program wyświetli informacje o sposobie uruchamiania programu:
Usage: /home/local/code/ansiccode/sysfile/fflush</path/to/filename>

jako argument wywołania programu można podać analogiczne jak poniżej argumenty:
/home/local/code/ansiccode/sysfile/fflush /home/local/code/ansiccode/sysfile/fflush-test
rezultat będzie zależny od podanych argumentów wywołania programu:
fflush: file=fopen(argv[1]=/home/local/code/ansiccode/sysfile/fflush-test, "w+"); if (file!=NULL): Successful opened file '/home/local/code/ansiccode/sysfile/fflush-test'.
fflush: result=fflush(file): result=0, Successful fflush file '/home/local/code/ansiccode/sysfile/fflush-test'
fflush:line1
fflush:line2
fflush:line3



#top fgetc


Documentacja online: pubs.opengroup.org | www.cplusplus.com | pl.wikibooks.org

Deklaracja funkcji fgetc() znajduje się w pliku nagłówkowym stdio.h.
Deklaracja funkcji fgetc() jest następująca:
/* Read a character from STREAM.

   These functions are possible cancellation points and therefore not
   marked with __THROW.  */
extern int fgetc (FILE *__stream);

Powiązane:
feof(), fgetc(), fgets(), fputc(), fputs(),

Opis:
Funkcja fgetc()

Argumenty:
FILE *__stream -

Zwracana wartość:
int -

Example:
zawartość pliku fgetc.c
SELECT ALL
#define  _GNU_SOURCE  1    /* for environ defined in unistd.h, to avoid warning implicit declaration of function basename, which defined in string.h */
#include <stdio.h>         /* for FILE, va_list, EOF, SEEK_SET, SEEK_CUR, SEEK_END, stdin, stdout, stderr, remove(), rename(), tmpfile(), tmpnam(), tempnam(), fclose(), */
                           /* fflush(), fopen(), freopen(), fprintf(), printf(), snprintf(), scanf(), sscanf(), fgetc(), getc(), getchar(), fputc(), putc(), putchar(), */
                           /* fgets(), gets(), fputs(), puts(), fread(), fwrite(), fseek(), ftell(), rewind(), feof(), ferror(), fileno(), popen(), pclose(), */
#include <string.h>        /* for memcpy(), memmove(), memset(), memcmp(), memchr(), memrchr(), str[n]cpy(), str[n]cat(), str[n]cmp(), strcoll(), str[n]dup(), strchr(), strrchr(), strstr(), */
                           /* strtok(), strcasestr(), memmem(), mempcpy(), str[n]len(), strerror(), bcopy(), bzero(), strcasecmp(), strsep(), basename(), */
#include <errno.h>         /* for errno constant, error constants, */



int main(int argc, char **argv) {
	char *self;
	FILE *file;
	int result;
	
	self=strrchr(argv[0], '/');
	if (self!=NULL) self++;
	else self=argv[0];
	
	if (argc<2) {
		printf("Usage: %s </path/to/filename>\n", argv[0]);
		return 0;
	}
	
	file=fopen(argv[1], "r");
	if (file!=NULL) {
		printf("%s: file=fopen(argv[1]=%s, \"r\"): if (file!=NULL): Successful open() file.\n", self, argv[1]);
		while (!feof(file)) {
			printf("%s: fgetc(file): ", self);
			result=fgetc(file);
			printf("%s: fgetc(file): result(%%03d)=%03d result(0x%%02X)=0x%02X result(%%c)=|%c|\n", self, result, result, result);
		}
		fclose(file);
	} else {
		printf("%s: file=fopen(argv[1]=%s, \"r\"): if (file!=NULL): else: Unable to open() file, Reason: %d:%s\n", self, argv[1], errno, strerror(errno));
	}
	
	return 0;
}

program należy skompilować komendą make (jako argument należy podać plik Makefile zależny od systemu operacyjnego, domyślnie make próbuje użyć pliku Makefile):
make clean all # system Linux
make -f Makefile clean all # system Linux
make -f Makefile.obsd clean all # system OpenBSD
make -f Makefile.fbsd clean all # system FreeBSD
make -f Makefile.sol clean all # system Solaris
make -f Makefile.beos clean all # system BeOS
make -f Makefile.win clean all # system Windows

a następnie uruchomić bez argumentów:
/home/local/code/ansiccode/sysfile/fgetc
program wyświetli informacje o sposobie uruchamiania programu:
Usage: /home/local/code/ansiccode/sysfile/fgetc </path/to/filename>

następnie należy utworzyć przykładowy plik: echo -en "/home/local/code/ansiccode/sysfile/fgetc-test" > /home/local/code/ansiccode/sysfile/fgetc-test
oraz uruchomić w następujący sposób:
/home/local/code/ansiccode/sysfile/fgetc /home/local/code/ansiccode/sysfile/fgetc-test
rezultat będzie zależny od podanych argumentów wywołania programu:
fgetc: file=fopen(argv[1]=/home/local/code/ansiccode/sysfile/fgetc-test, "r"): if (file!=NULL): Successful open() file.
fgetc: fgetc(file): fgetc: fgetc(file): result(%03d)=047 result(0x%02X)=0x2F result(%c)=|/|
fgetc: fgetc(file): fgetc: fgetc(file): result(%03d)=104 result(0x%02X)=0x68 result(%c)=|h|
fgetc: fgetc(file): fgetc: fgetc(file): result(%03d)=111 result(0x%02X)=0x6F result(%c)=|o|
fgetc: fgetc(file): fgetc: fgetc(file): result(%03d)=109 result(0x%02X)=0x6D result(%c)=|m|
fgetc: fgetc(file): fgetc: fgetc(file): result(%03d)=101 result(0x%02X)=0x65 result(%c)=|e|
fgetc: fgetc(file): fgetc: fgetc(file): result(%03d)=047 result(0x%02X)=0x2F result(%c)=|/|
fgetc: fgetc(file): fgetc: fgetc(file): result(%03d)=108 result(0x%02X)=0x6C result(%c)=|l|
fgetc: fgetc(file): fgetc: fgetc(file): result(%03d)=111 result(0x%02X)=0x6F result(%c)=|o|
fgetc: fgetc(file): fgetc: fgetc(file): result(%03d)=099 result(0x%02X)=0x63 result(%c)=|c|
fgetc: fgetc(file): fgetc: fgetc(file): result(%03d)=097 result(0x%02X)=0x61 result(%c)=|a|
fgetc: fgetc(file): fgetc: fgetc(file): result(%03d)=108 result(0x%02X)=0x6C result(%c)=|l|
fgetc: fgetc(file): fgetc: fgetc(file): result(%03d)=047 result(0x%02X)=0x2F result(%c)=|/|
fgetc: fgetc(file): fgetc: fgetc(file): result(%03d)=099 result(0x%02X)=0x63 result(%c)=|c|
fgetc: fgetc(file): fgetc: fgetc(file): result(%03d)=111 result(0x%02X)=0x6F result(%c)=|o|
fgetc: fgetc(file): fgetc: fgetc(file): result(%03d)=100 result(0x%02X)=0x64 result(%c)=|d|
fgetc: fgetc(file): fgetc: fgetc(file): result(%03d)=101 result(0x%02X)=0x65 result(%c)=|e|
fgetc: fgetc(file): fgetc: fgetc(file): result(%03d)=047 result(0x%02X)=0x2F result(%c)=|/|
fgetc: fgetc(file): fgetc: fgetc(file): result(%03d)=097 result(0x%02X)=0x61 result(%c)=|a|
fgetc: fgetc(file): fgetc: fgetc(file): result(%03d)=110 result(0x%02X)=0x6E result(%c)=|n|
fgetc: fgetc(file): fgetc: fgetc(file): result(%03d)=115 result(0x%02X)=0x73 result(%c)=|s|
fgetc: fgetc(file): fgetc: fgetc(file): result(%03d)=105 result(0x%02X)=0x69 result(%c)=|i|
fgetc: fgetc(file): fgetc: fgetc(file): result(%03d)=099 result(0x%02X)=0x63 result(%c)=|c|
fgetc: fgetc(file): fgetc: fgetc(file): result(%03d)=099 result(0x%02X)=0x63 result(%c)=|c|
fgetc: fgetc(file): fgetc: fgetc(file): result(%03d)=111 result(0x%02X)=0x6F result(%c)=|o|
fgetc: fgetc(file): fgetc: fgetc(file): result(%03d)=100 result(0x%02X)=0x64 result(%c)=|d|
fgetc: fgetc(file): fgetc: fgetc(file): result(%03d)=101 result(0x%02X)=0x65 result(%c)=|e|
fgetc: fgetc(file): fgetc: fgetc(file): result(%03d)=047 result(0x%02X)=0x2F result(%c)=|/|
fgetc: fgetc(file): fgetc: fgetc(file): result(%03d)=115 result(0x%02X)=0x73 result(%c)=|s|
fgetc: fgetc(file): fgetc: fgetc(file): result(%03d)=121 result(0x%02X)=0x79 result(%c)=|y|
fgetc: fgetc(file): fgetc: fgetc(file): result(%03d)=115 result(0x%02X)=0x73 result(%c)=|s|
fgetc: fgetc(file): fgetc: fgetc(file): result(%03d)=102 result(0x%02X)=0x66 result(%c)=|f|
fgetc: fgetc(file): fgetc: fgetc(file): result(%03d)=105 result(0x%02X)=0x69 result(%c)=|i|
fgetc: fgetc(file): fgetc: fgetc(file): result(%03d)=108 result(0x%02X)=0x6C result(%c)=|l|
fgetc: fgetc(file): fgetc: fgetc(file): result(%03d)=101 result(0x%02X)=0x65 result(%c)=|e|
fgetc: fgetc(file): fgetc: fgetc(file): result(%03d)=047 result(0x%02X)=0x2F result(%c)=|/|
fgetc: fgetc(file): fgetc: fgetc(file): result(%03d)=102 result(0x%02X)=0x66 result(%c)=|f|
fgetc: fgetc(file): fgetc: fgetc(file): result(%03d)=103 result(0x%02X)=0x67 result(%c)=|g|
fgetc: fgetc(file): fgetc: fgetc(file): result(%03d)=101 result(0x%02X)=0x65 result(%c)=|e|
fgetc: fgetc(file): fgetc: fgetc(file): result(%03d)=116 result(0x%02X)=0x74 result(%c)=|t|
fgetc: fgetc(file): fgetc: fgetc(file): result(%03d)=099 result(0x%02X)=0x63 result(%c)=|c|
fgetc: fgetc(file): fgetc: fgetc(file): result(%03d)=045 result(0x%02X)=0x2D result(%c)=|-|
fgetc: fgetc(file): fgetc: fgetc(file): result(%03d)=116 result(0x%02X)=0x74 result(%c)=|t|
fgetc: fgetc(file): fgetc: fgetc(file): result(%03d)=101 result(0x%02X)=0x65 result(%c)=|e|
fgetc: fgetc(file): fgetc: fgetc(file): result(%03d)=115 result(0x%02X)=0x73 result(%c)=|s|
fgetc: fgetc(file): fgetc: fgetc(file): result(%03d)=116 result(0x%02X)=0x74 result(%c)=|t|
fgetc: fgetc(file): fgetc: fgetc(file): result(%03d)=-01 result(0x%02X)=0xFFFFFFFF result(%c)=|?|



#top fgetpos


Documentacja online: pubs.opengroup.org | www.cplusplus.com | pl.wikibooks.org

Deklaracja funkcji fgetpos() znajduje się w pliku nagłówkowym unistd.h.
Deklaracja funkcji fgetpos() jest następująca:
/* Get STREAM's position.

   This function is a possible cancellation point and therefore not
   marked with __THROW.  */
extern int fgetpos (FILE *__restrict __stream, fpos_t *__restrict __pos);

Powiązane:
fgetpos(), fseek(), fsetpos(), ftell(), lseek(), rewind(),

Opis:
Funkcja fgetpos()

Argumenty:
FILE *__restrict __stream -
fpos_t *__restrict __pos -

Zwracana wartość:
int -

Example:
zawartość pliku fgetpos.c
SELECT ALL


program należy skompilować komendą make (jako argument należy podać plik Makefile zależny od systemu operacyjnego, domyślnie make próbuje użyć pliku Makefile):
make clean all # system Linux
make -f Makefile clean all # system Linux
make -f Makefile.obsd clean all # system OpenBSD
make -f Makefile.fbsd clean all # system FreeBSD
make -f Makefile.sol clean all # system Solaris
make -f Makefile.beos clean all # system BeOS
make -f Makefile.win clean all # system Windows

a następnie uruchomić bez argumentów:

program wyświetli informacje o sposobie uruchamiania programu:


jako argument wywołania programu można podać analogiczne jak poniżej argumenty:

rezultat będzie zależny od podanych argumentów wywołania programu:




#top fgets


Documentacja online: pubs.opengroup.org | www.cplusplus.com | pl.wikibooks.org

Deklaracja funkcji fgets() znajduje się w pliku nagłówkowym stdio.h.
Deklaracja funkcji fgets() jest następująca:
/* Get a newline-terminated string of finite length from STREAM.

   This function is a possible cancellation point and therefore not
   marked with __THROW.  */
extern char *fgets (char *__restrict __s, int __n, FILE *__restrict __stream)
     __wur;

Powiązane:
feof(), fgetc(), fgets(), fputc(), fputs(),

Opis:
Funkcja fgets()

Argumenty:
char *__restrict __s -
int __n -
FILE *__restrict __stream -

Zwracana wartość:
char * -

Example:
zawartość pliku fgets.c
SELECT ALL
#define  _GNU_SOURCE  1    /* for environ defined in unistd.h, to avoid warning implicit declaration of function basename, which defined in string.h */
#include <stdio.h>         /* for FILE, va_list, EOF, SEEK_SET, SEEK_CUR, SEEK_END, stdin, stdout, stderr, remove(), rename(), tmpfile(), tmpnam(), tempnam(), fclose(), */
                           /* fflush(), fopen(), freopen(), fprintf(), printf(), snprintf(), scanf(), sscanf(), fgetc(), getc(), getchar(), fputc(), putc(), putchar(), */
                           /* fgets(), gets(), fputs(), puts(), fread(), fwrite(), fseek(), ftell(), rewind(), feof(), ferror(), fileno(), popen(), pclose(), */
#include <string.h>        /* for memcpy(), memmove(), memset(), memcmp(), memchr(), memrchr(), str[n]cpy(), str[n]cat(), str[n]cmp(), strcoll(), str[n]dup(), strchr(), strrchr(), strstr(), */
                           /* strtok(), strcasestr(), memmem(), mempcpy(), str[n]len(), strerror(), bcopy(), bzero(), strcasecmp(), strsep(), basename(), */
#include <errno.h>         /* for errno constant, error constants, */



int main(int argc, char **argv) {
	char *self;
	FILE *file;
	char buffdata[1024];
	char *ptrsdata;
	
	self=strrchr(argv[0], '/');
	if (self!=NULL) self++;
	else self=argv[0];
	
	if (argc<2) {
		printf("Usage: %s </path/to/filename>\n", argv[0]);
		return 0;
	}
	
	file=fopen(argv[1], "r");
	if (file!=NULL) {
		printf("%s: file=fopen(argv[1]=%s, \"r\"): if (file!=NULL): Successful opened file '%s'.\n", self, argv[1], argv[1]);
		while (!feof(file)) {
			memset(buffdata, 0x00, sizeof(buffdata));
			ptrsdata=fgets(buffdata, sizeof(buffdata), file);
			if (ptrsdata!=NULL) printf("%s: ptrsdata=fgets(buffdata, sizeof(buffdata), file): ptrsdata=|%s| buffer=|%s|\n", self, ptrsdata, buffdata);
			else break;
		}
		fclose(file);
	} else {
		printf("%s: file=fopen(argv[1]=%s, \"r\"): if (file!=NULL): else: Unable to open file '%s', Reason: %d:%s\n", self, argv[1], argv[1], errno, strerror(errno));
	}
	
	return 0;
}

program należy skompilować komendą make (jako argument należy podać plik Makefile zależny od systemu operacyjnego, domyślnie make próbuje użyć pliku Makefile):
make clean all # system Linux
make -f Makefile clean all # system Linux
make -f Makefile.obsd clean all # system OpenBSD
make -f Makefile.fbsd clean all # system FreeBSD
make -f Makefile.sol clean all # system Solaris
make -f Makefile.beos clean all # system BeOS
make -f Makefile.win clean all # system Windows

a następnie uruchomić bez argumentów:
/home/local/code/ansiccode/sysfile/fgets
program wyświetli informacje o sposobie uruchamiania programu:
Usage: /home/local/code/ansiccode/sysfile/fgets </path/to/filename>

jako argument wywołania programu można podać analogiczne jak poniżej argumenty:
/home/local/code/ansiccode/sysfile/fgets /home/local/code/ansiccode/sysfile/fgets.c
rezultat będzie zależny od podanych argumentów wywołania programu:
fgets: file=fopen(argv[1]=/home/local/code/ansiccode/sysfile/fgets.c, "r"): if (file!=NULL): Successful opened file '/home/local/code/ansiccode/sysfile/fgets.c'.
fgets: ptrsdata=fgets(buffdata, sizeof(buffdata), file): ptrsdata=|
| buffer=|
|
fgets: ptrsdata=fgets(buffdata, sizeof(buffdata), file): ptrsdata=|#define  _GNU_SOURCE  1    /* for environ defined in unistd.h, to avoid warning implicit declaration of function basename, which defined in string.h */
| buffer=|#define  _GNU_SOURCE  1    /* for environ defined in unistd.h, to avoid warning implicit declaration of function basename, which defined in string.h */
|
fgets: ptrsdata=fgets(buffdata, sizeof(buffdata), file): ptrsdata=|#include <stdio.h>         /* for FILE, va_list, EOF, SEEK_SET, SEEK_CUR, SEEK_END, stdin, stdout, stderr, remove(), rename(), tmpfile(), tmpnam(), tempnam(), fclose(), */
| buffer=|#include <stdio.h>         /* for FILE, va_list, EOF, SEEK_SET, SEEK_CUR, SEEK_END, stdin, stdout, stderr, remove(), rename(), tmpfile(), tmpnam(), tempnam(), fclose(), */
|
fgets: ptrsdata=fgets(buffdata, sizeof(buffdata), file): ptrsdata=|                           /* fflush(), fopen(), freopen(), fprintf(), printf(), snprintf(), scanf(), sscanf(), fgetc(), getc(), getchar(), fputc(), putc(), putchar(), */
| buffer=|                           /* fflush(), fopen(), freopen(), fprintf(), printf(), snprintf(), scanf(), sscanf(), fgetc(), getc(), getchar(), fputc(), putc(), putchar(), */
|
fgets: ptrsdata=fgets(buffdata, sizeof(buffdata), file): ptrsdata=|                           /* fgets(), gets(), fputs(), puts(), fread(), fwrite(), fseek(), ftell(), rewind(), feof(), ferror(), fileno(), popen(), pclose(), */
| buffer=|                           /* fgets(), gets(), fputs(), puts(), fread(), fwrite(), fseek(), ftell(), rewind(), feof(), ferror(), fileno(), popen(), pclose(), */
|
fgets: ptrsdata=fgets(buffdata, sizeof(buffdata), file): ptrsdata=|#include <string.h>        /* for memcpy(), memmove(), memset(), memcmp(), memchr(), memrchr(), str[n]cpy(), str[n]cat(), str[n]cmp(), strcoll(), str[n]dup(), strchr(), strrchr(), strstr(), */
| buffer=|#include <string.h>        /* for memcpy(), memmove(), memset(), memcmp(), memchr(), memrchr(), str[n]cpy(), str[n]cat(), str[n]cmp(), strcoll(), str[n]dup(), strchr(), strrchr(), strstr(), */
|
fgets: ptrsdata=fgets(buffdata, sizeof(buffdata), file): ptrsdata=|                           /* strtok(), strcasestr(), memmem(), mempcpy(), str[n]len(), strerror(), bcopy(), bzero(), strcasecmp(), strsep(), basename(), */
| buffer=|                           /* strtok(), strcasestr(), memmem(), mempcpy(), str[n]len(), strerror(), bcopy(), bzero(), strcasecmp(), strsep(), basename(), */
|
fgets: ptrsdata=fgets(buffdata, sizeof(buffdata), file): ptrsdata=|#include <errno.h>         /* for errno constant, error constants, */
| buffer=|#include <errno.h>         /* for errno constant, error constants, */
|
fgets: ptrsdata=fgets(buffdata, sizeof(buffdata), file): ptrsdata=|
| buffer=|
|
fgets: ptrsdata=fgets(buffdata, sizeof(buffdata), file): ptrsdata=|
| buffer=|
|
fgets: ptrsdata=fgets(buffdata, sizeof(buffdata), file): ptrsdata=|
| buffer=|
|
fgets: ptrsdata=fgets(buffdata, sizeof(buffdata), file): ptrsdata=|int main(int argc, char **argv) {
| buffer=|int main(int argc, char **argv) {
|
fgets: ptrsdata=fgets(buffdata, sizeof(buffdata), file): ptrsdata=|     char *self;
| buffer=|      char *self;
|
fgets: ptrsdata=fgets(buffdata, sizeof(buffdata), file): ptrsdata=|     FILE *file;
| buffer=|      FILE *file;
|
fgets: ptrsdata=fgets(buffdata, sizeof(buffdata), file): ptrsdata=|     char buffdata[1024];
| buffer=|      char buffdata[1024];
|
fgets: ptrsdata=fgets(buffdata, sizeof(buffdata), file): ptrsdata=|     char *ptrsdata;
| buffer=|      char *ptrsdata;
|
fgets: ptrsdata=fgets(buffdata, sizeof(buffdata), file): ptrsdata=|
| buffer=|
|
fgets: ptrsdata=fgets(buffdata, sizeof(buffdata), file): ptrsdata=|     self=strrchr(argv[0], '/');
| buffer=|      self=strrchr(argv[0], '/');
|
fgets: ptrsdata=fgets(buffdata, sizeof(buffdata), file): ptrsdata=|     if (self!=NULL) self++;
| buffer=|      if (self!=NULL) self++;
|
fgets: ptrsdata=fgets(buffdata, sizeof(buffdata), file): ptrsdata=|     else self=argv[0];
| buffer=|      else self=argv[0];
|
fgets: ptrsdata=fgets(buffdata, sizeof(buffdata), file): ptrsdata=|
| buffer=|
|
fgets: ptrsdata=fgets(buffdata, sizeof(buffdata), file): ptrsdata=|     if (argc<2) {
| buffer=|      if (argc<2) {
|
fgets: ptrsdata=fgets(buffdata, sizeof(buffdata), file): ptrsdata=|             printf("Usage: %s </path/to/filename>\n", argv[0]);
| buffer=|              printf("Usage: %s </path/to/filename>\n", argv[0]);
|
fgets: ptrsdata=fgets(buffdata, sizeof(buffdata), file): ptrsdata=|             return 0;
| buffer=|              return 0;
|
fgets: ptrsdata=fgets(buffdata, sizeof(buffdata), file): ptrsdata=|     }
| buffer=|      }
|
fgets: ptrsdata=fgets(buffdata, sizeof(buffdata), file): ptrsdata=|
| buffer=|
|
fgets: ptrsdata=fgets(buffdata, sizeof(buffdata), file): ptrsdata=|     file=fopen(argv[1], "r");
| buffer=|      file=fopen(argv[1], "r");
|
fgets: ptrsdata=fgets(buffdata, sizeof(buffdata), file): ptrsdata=|     if (file!=NULL) {
| buffer=|      if (file!=NULL) {
|
fgets: ptrsdata=fgets(buffdata, sizeof(buffdata), file): ptrsdata=|             printf("%s: file=fopen(argv[1]=%s, \"r\"): if (file!=NULL): Successful opened file '%s'.\n", self, argv[1], argv[1]);
| buffer=|              printf("%s: file=fopen(argv[1]=%s, \"r\"): if (file!=NULL): Successful opened file '%s'.\n", self, argv[1], argv[1]);
|
fgets: ptrsdata=fgets(buffdata, sizeof(buffdata), file): ptrsdata=|             while (!feof(file)) {
| buffer=|              while (!feof(file)) {
|
fgets: ptrsdata=fgets(buffdata, sizeof(buffdata), file): ptrsdata=|                     memset(buffdata, 0x00, sizeof(buffdata));
| buffer=|                      memset(buffdata, 0x00, sizeof(buffdata));
|
fgets: ptrsdata=fgets(buffdata, sizeof(buffdata), file): ptrsdata=|                     ptrsdata=fgets(buffdata, sizeof(buffdata), file);
| buffer=|                      ptrsdata=fgets(buffdata, sizeof(buffdata), file);
|
fgets: ptrsdata=fgets(buffdata, sizeof(buffdata), file): ptrsdata=|                     if (ptrsdata!=NULL) printf("%s: ptrsdata=fgets(buffdata, sizeof(buffdata), file): ptrsdata=|%s| buffer=|%s|\n", self, ptrsdata, buffdata);
| buffer=|                      if (ptrsdata!=NULL) printf("%s: ptrsdata=fgets(buffdata, sizeof(buffdata), file): ptrsdata=|%s| buffer=|%s|\n", self, ptrsdata, buffdata);
|
fgets: ptrsdata=fgets(buffdata, sizeof(buffdata), file): ptrsdata=|                     else break;
| buffer=|                      else break;
|
fgets: ptrsdata=fgets(buffdata, sizeof(buffdata), file): ptrsdata=|             }
| buffer=|              }
|
fgets: ptrsdata=fgets(buffdata, sizeof(buffdata), file): ptrsdata=|             fclose(file);
| buffer=|              fclose(file);
|
fgets: ptrsdata=fgets(buffdata, sizeof(buffdata), file): ptrsdata=|     } else {
| buffer=|      } else {
|
fgets: ptrsdata=fgets(buffdata, sizeof(buffdata), file): ptrsdata=|             printf("%s: file=fopen(argv[1]=%s, \"r\"): if (file!=NULL): else: Unable to open file '%s', Reason: %d:%s\n", self, argv[1], argv[1], errno, strerror(errno));
| buffer=|              printf("%s: file=fopen(argv[1]=%s, \"r\"): if (file!=NULL): else: Unable to open file '%s', Reason: %d:%s\n", self, argv[1], argv[1], errno, strerror(errno));
|
fgets: ptrsdata=fgets(buffdata, sizeof(buffdata), file): ptrsdata=|     }
| buffer=|      }
|
fgets: ptrsdata=fgets(buffdata, sizeof(buffdata), file): ptrsdata=|
| buffer=|
|
fgets: ptrsdata=fgets(buffdata, sizeof(buffdata), file): ptrsdata=|     return 0;
| buffer=|      return 0;
|
fgets: ptrsdata=fgets(buffdata, sizeof(buffdata), file): ptrsdata=|}
| buffer=|}
|
fgets: ptrsdata=fgets(buffdata, sizeof(buffdata), file): ptrsdata=|
| buffer=|
|
fgets: ptrsdata=fgets(buffdata, sizeof(buffdata), file): ptrsdata=|
| buffer=|
|



#top fileno


Documentacja online: pubs.opengroup.org | www.cplusplus.com | pl.wikibooks.org

Deklaracja funkcji fileno() znajduje się w pliku nagłówkowym stdio.h.
Deklaracja funkcji fileno() jest następująca:
/* Return the system file descriptor for STREAM.  */
extern int fileno (FILE *__stream) __THROW __wur;

Powiązane:
fdopen, fileno(),

Opis:
Funkcja fileno()

Argumenty:
FILE *__stream -

Zwracana wartość:
int -

Example:
zawartość pliku fileno.c
SELECT ALL
#define  _GNU_SOURCE  1    /* for environ defined in unistd.h, to avoid warning implicit declaration of function basename, which defined in string.h */
#include <stdio.h>         /* for FILE, va_list, EOF, SEEK_SET, SEEK_CUR, SEEK_END, stdin, stdout, stderr, remove(), rename(), tmpfile(), tmpnam(), tempnam(), fclose(), */
                           /* fflush(), fopen(), freopen(), fprintf(), printf(), snprintf(), scanf(), sscanf(), fgetc(), getc(), getchar(), fputc(), putc(), putchar(), */
                           /* fgets(), gets(), fputs(), puts(), fread(), fwrite(), fseek(), ftell(), rewind(), feof(), ferror(), fileno(), popen(), pclose(), */
#include <string.h>        /* for memcpy(), memmove(), memset(), memcmp(), memchr(), memrchr(), str[n]cpy(), str[n]cat(), str[n]cmp(), strcoll(), str[n]dup(), strchr(), strrchr(), strstr(), */
                           /* strtok(), strcasestr(), memmem(), mempcpy(), str[n]len(), strerror(), bcopy(), bzero(), strcasecmp(), strsep(), basename(), */
#include <errno.h>         /* for errno constant, error constants, */



int main(int argc, char **argv) {
	char *self;
	FILE *file;
	int fprd;
	
	self=strrchr(argv[0], '/');
	if (self!=NULL) self++;
	else self=argv[0];
	
	if (argc<2) {
		printf("Usage: %s </path/to/filename>\n", argv[0]);
		return 0;
	}
	
	file=fopen(argv[1], "r");
	if (file!=NULL) {
		printf("%s: file=fopen(argv[1]=%s, \"r\"); if (file!=NULL): Successful open() file.\n", self, argv[1]);
		fprd=fileno(file);
		printf("%s: fprd=fileno(file): fprd=%d\n", self, fprd);
		fclose(file);
	} else {
		printf("%s: file=fopen(argv[1]=%s, \"r\"); if (file!=NULL): else: Unable to open() file, Reason: %d:%s\n", self, argv[1], errno, strerror(errno));
	}
	
	return 0;
}

program należy skompilować komendą make (jako argument należy podać plik Makefile zależny od systemu operacyjnego, domyślnie make próbuje użyć pliku Makefile):
make clean all # system Linux
make -f Makefile clean all # system Linux
make -f Makefile.obsd clean all # system OpenBSD
make -f Makefile.fbsd clean all # system FreeBSD
make -f Makefile.sol clean all # system Solaris
make -f Makefile.beos clean all # system BeOS
make -f Makefile.win clean all # system Windows

a następnie uruchomić bez argumentów:
/home/local/code/ansiccode/sysfile/fileno
program wyświetli informacje o sposobie uruchamiania programu:
Usage: /home/local/code/ansiccode/sysfile/fileno </path/to/filename>

jako argument wywołania programu można podać analogiczne jak poniżej argumenty:
/home/local/code/ansiccode/sysfile/fileno /home/local/code/ansiccode/sysfile/fileno
rezultat będzie zależny od podanych argumentów wywołania programu:
fileno: file=fopen(argv[1]=/home/local/code/ansiccode/sysfile/fileno, "r"); if (file!=NULL): Successful open() file.
fileno: fprd=fileno(file): fprd=3



#top flock


Documentacja online: pubs.opengroup.org | www.cplusplus.com | pl.wikibooks.org

Deklaracja funkcji flock() znajduje się w pliku nagłówkowym sys/file.h.
Deklaracja funkcji flock() jest następująca:
/* Apply or remove an advisory lock, according to OPERATION,
   on the file FD refers to.  */
extern int flock (int __fd, int __operation) __THROW;

Powiązane:
fcntl(), flock(), lockf(),

Opis:
Funkcja flock()

Argumenty:
int __fd -
int __operation -

Zwracana wartość:
int -

Example:
zawartość pliku flock.c
SELECT ALL


program należy skompilować komendą make (jako argument należy podać plik Makefile zależny od systemu operacyjnego, domyślnie make próbuje użyć pliku Makefile):
make clean all # system Linux
make -f Makefile clean all # system Linux
make -f Makefile.obsd clean all # system OpenBSD
make -f Makefile.fbsd clean all # system FreeBSD
make -f Makefile.sol clean all # system Solaris
make -f Makefile.beos clean all # system BeOS
make -f Makefile.win clean all # system Windows

a następnie uruchomić bez argumentów:

program wyświetli informacje o sposobie uruchamiania programu:


jako argument wywołania programu można podać analogiczne jak poniżej argumenty:

rezultat będzie zależny od podanych argumentów wywołania programu:




#top fmemopen


Documentacja online: pubs.opengroup.org | www.cplusplus.com | pl.wikibooks.org

Deklaracja funkcji fmemopen() znajduje się w pliku nagłówkowym unistd.h.
Deklaracja funkcji fmemopen() jest następująca:
/* Create a new stream that refers to a memory buffer.  */
extern FILE *fmemopen (void *__s, size_t __len, __const char *__modes) __THROW;

Powiązane:

Opis:
Funkcja fmemopen()

Argumenty:
void *__s -
size_t __len -
const char *__modes -

Zwracana wartość:
FILE * -

Example:
zawartość pliku fmemopen.c
SELECT ALL


program należy skompilować komendą make (jako argument należy podać plik Makefile zależny od systemu operacyjnego, domyślnie make próbuje użyć pliku Makefile):
make clean all # system Linux
make -f Makefile clean all # system Linux
make -f Makefile.obsd clean all # system OpenBSD
make -f Makefile.fbsd clean all # system FreeBSD
make -f Makefile.sol clean all # system Solaris
make -f Makefile.beos clean all # system BeOS
make -f Makefile.win clean all # system Windows

a następnie uruchomić bez argumentów:

program wyświetli informacje o sposobie uruchamiania programu:


jako argument wywołania programu można podać analogiczne jak poniżej argumenty:

rezultat będzie zależny od podanych argumentów wywołania programu:




#top fnmatch


Documentacja online: pubs.opengroup.org | www.cplusplus.com | pl.wikibooks.org

Deklaracja funkcji fnmatch() znajduje się w pliku nagłówkowym fnmatch.h.
Deklaracja funkcji fnmatch() jest następująca:
/* Match NAME against the filename pattern PATTERN,
   returning zero if it matches, FNM_NOMATCH if not.  */
extern int fnmatch (__const char *__pattern, __const char *__name,
            int __flags);

Powiązane:

Opis:
Funkcja fnmatch()

Argumenty:
const char *__pattern -
const char *__name -
int __flags -

Zwracana wartość:
int -

Example:
zawartość pliku fnmatch.c
SELECT ALL
#define  _GNU_SOURCE  1    /* for environ defined in unistd.h, to avoid warning implicit declaration of function basename, which defined in string.h */
#include <stdio.h>         /* for FILE, va_list, EOF, SEEK_SET, SEEK_CUR, SEEK_END, stdin, stdout, stderr, remove(), rename(), tmpfile(), tmpnam(), tempnam(), fclose(), */
                           /* fflush(), fopen(), freopen(), fprintf(), printf(), snprintf(), scanf(), sscanf(), fgetc(), getc(), getchar(), fputc(), putc(), putchar(), */
                           /* fgets(), gets(), fputs(), puts(), fread(), fwrite(), fseek(), ftell(), rewind(), feof(), ferror(), fileno(), popen(), pclose(), */
#include <stdint.h>        /* for INT(8|16|32|64)_MIN, INT(8|16|32|64)_MAX, UINT(8|16|32|64)_MAX, int8_t, int16_t, int32_t, int64_t, uint8_t, uint16_t, uint32_t, uint64_t, */
#include <string.h>        /* for memcpy(), memmove(), memset(), memcmp(), memchr(), memrchr(), str[n]cpy(), str[n]cat(), str[n]cmp(), strcoll(), str[n]dup(), strchr(), strrchr(), strstr(), */
                           /* strtok(), strcasestr(), memmem(), mempcpy(), str[n]len(), strerror(), bcopy(), bzero(), strcasecmp(), strsep(), basename(), */
#include <unistd.h>        /* for R_OK, W_OK, X_OK, F_OK, environ, access(), lseek(), close(), read(), write(), pipe(), alarm(), sleep(), ualarm(), usleep(), pause(), chown(), chdir(), getcwd(), */
                           /* for exec[...](), nice(), getpid(), getppid(), setpgid(), setsid(), getsid(), getuid(), geteuid(). getgid(), getegid(), setuid(), seteuid(), setgid(), setegid(), fork(), */
                           /* for link(), symlink(), readlink(), unlink(), rmdir(), getlogin(), setlogin(), gethostname(), sethostname(), daemon(), chroot(), getpass(), [f]sync(), [f]truncate(), syscall(), */
#include <errno.h>         /* for errno constant, error constants, */

#include <fnmatch.h>       /* for FNM_PATHNAME, FNM_NOESCAPE, FNM_PERIOD, FNM_LEADING_DIR, FNM_CASEFOLD, FNM_EXTMATCH, FNM_NOMATCH fnmatch(), */


int main(int argc, char **argv) {
	char *self;
	
	self=strrchr(argv[0], '/');
	if (self!=NULL) self++;
	else self=argv[0];
	
	if (argc<3) {
		printf("Usage: %s filename \"pattern\"\n", argv[0]);
		printf("Examples:\n");
		printf("       %s fnmatch.c \"*.c\"\n", argv[0]);
		printf("       %s fnmatch.c \"*.cpp\"\n", argv[0]);
		printf("       %s fnmatch.c \"*.h\"\n", argv[0]);
		return 0;
	}
	
	if (fnmatch(argv[2],argv[1],FNM_PATHNAME)==0) printf("%s if (fnmatch(argv[2]=%s,argv[1]=%s,FNM_PATHNAME|FNM_NOCASE)==0): FILENAME match PATTERN\n", argv[0], argv[1], argv[2]);
	else                                                     printf("%s if (fnmatch(argv[2]=%s,argv[1]=%s,FNM_PATHNAME|FNM_NOCASE)==0): else: FILENAME does not match PATTERN\n", argv[0], argv[1], argv[2]);
	
	return 0;
}

program należy skompilować komendą make (jako argument należy podać plik Makefile zależny od systemu operacyjnego, domyślnie make próbuje użyć pliku Makefile):
make clean all # system Linux
make -f Makefile clean all # system Linux
make -f Makefile.obsd clean all # system OpenBSD
make -f Makefile.fbsd clean all # system FreeBSD
make -f Makefile.sol clean all # system Solaris
make -f Makefile.beos clean all # system BeOS
make -f Makefile.win clean all # system Windows

a następnie uruchomić bez argumentów:
/home/local/code/ansiccode/sysfile/fnmatch
program wyświetli informacje o sposobie uruchamiania programu:
Usage: /home/local/code/ansiccode/sysfile/fnmatch filename "pattern"
Examples:
       /home/local/code/ansiccode/sysfile/fnmatch fnmatch.c "*.c"
       /home/local/code/ansiccode/sysfile/fnmatch fnmatch.c "*.cpp"
       /home/local/code/ansiccode/sysfile/fnmatch fnmatch.c "*.h"

jako argument wywołania programu można podać analogiczne jak poniżej argumenty:
/home/local/code/ansiccode/sysfile/fnmatch fnmatch.c "*.c"
/home/local/code/ansiccode/sysfile/fnmatch fnmatch.c "*.cpp"
/home/local/code/ansiccode/sysfile/fnmatch fnmatch.c "*.h"
rezultat będzie zależny od podanych argumentów wywołania programu:
/home/local/code/ansiccode/sysfile/fnmatch if (fnmatch(argv[2]=fnmatch.c,argv[1]=*.c,FNM_PATHNAME|FNM_NOCASE)==0): FILENAME match PATTERN

/home/local/code/ansiccode/sysfile/fnmatch if (fnmatch(argv[2]=fnmatch.c,argv[1]=*.cpp,FNM_PATHNAME|FNM_NOCASE)==0): else: FILENAME does not match PATTERN

/home/local/code/ansiccode/sysfile/fnmatch if (fnmatch(argv[2]=fnmatch.c,argv[1]=*.h,FNM_PATHNAME|FNM_NOCASE)==0): else: FILENAME does not match PATTERN



#top fopen


Documentacja online: pubs.opengroup.org | www.cplusplus.com | pl.wikibooks.org

Deklaracja funkcji fopen() znajduje się w pliku nagłówkowym stdio.h.
Deklaracja funkcji fopen() jest następująca:
/* Open a file and create a new stream for it.

   This function is a possible cancellation point and therefore not
   marked with __THROW.  */
extern FILE *fopen (__const char *__restrict __filename,
            __const char *__restrict __modes);

Powiązane:
close(), fclose(), fopen(), freopen(), open(), openat(),

Opis:
Funkcja fopen()

Argumenty:
const char *__restrict __filename -
const char *__restrict __modes -

Zwracana wartość:
FILE * -

Example:
zawartość pliku fopen.c
SELECT ALL
#define  _GNU_SOURCE  1    /* for environ defined in unistd.h, to avoid warning implicit declaration of function basename, which defined in string.h */
#include <stdio.h>         /* for FILE, va_list, EOF, SEEK_SET, SEEK_CUR, SEEK_END, stdin, stdout, stderr, remove(), rename(), tmpfile(), tmpnam(), tempnam(), fclose(), */
                           /* fflush(), fopen(), freopen(), fprintf(), printf(), snprintf(), scanf(), sscanf(), fgetc(), getc(), getchar(), fputc(), putc(), putchar(), */
                           /* fgets(), gets(), fputs(), puts(), fread(), fwrite(), fseek(), ftell(), rewind(), feof(), ferror(), fileno(), popen(), pclose(), */
#include <string.h>        /* for memcpy(), memmove(), memset(), memcmp(), memchr(), memrchr(), str[n]cpy(), str[n]cat(), str[n]cmp(), strcoll(), str[n]dup(), strchr(), strrchr(), strstr(), */
                           /* strtok(), strcasestr(), memmem(), mempcpy(), str[n]len(), strerror(), bcopy(), bzero(), strcasecmp(), strsep(), basename(), */
#include <errno.h>         /* for errno constant, error constants, */



int main(int argc, char **argv) {
	char *self;
	int result;
	FILE *file;
	
	self=strrchr(argv[0], '/');
	if (self!=NULL) self++;
	else self=argv[0];
	
	if (argc<2) {
		printf("Usage: %s </path/to/filename>\n", argv[0]);
		return 0;
	}
	
	file=fopen(argv[1], "r");
	if (file!=NULL) {
		printf("%s: file=fopen(argv[1]=%s, \"r\"); if (file!=NULL): Successful fopen() file.\n", self, argv[1]);
		result=fclose(file);
		if (result>=0) printf("%s: result=fclose(file): result=%d, if (result>=0): Successful fclose() file.\n", self, result);
		else printf("%s: result=fclose(file): result=%d, if (result>=0): else: Unable to fclose() file, Reason: %d:%s.\n", self, result, 	errno, strerror(errno));
	} else {
		printf("%s: file=fopen(argv[1]=%s, \"r\"); if (file!=NULL): else: Unable to fopen() file, Reason: %d:%s\n", self, argv[1], errno, strerror(errno));
	}
	
	return 0;
}

program należy skompilować komendą make (jako argument należy podać plik Makefile zależny od systemu operacyjnego, domyślnie make próbuje użyć pliku Makefile):
make clean all # system Linux
make -f Makefile clean all # system Linux
make -f Makefile.obsd clean all # system OpenBSD
make -f Makefile.fbsd clean all # system FreeBSD
make -f Makefile.sol clean all # system Solaris
make -f Makefile.beos clean all # system BeOS
make -f Makefile.win clean all # system Windows

a następnie uruchomić bez argumentów:
/home/local/code/ansiccode/sysfile/fopen
program wyświetli informacje o sposobie uruchamiania programu:
Usage: /home/local/code/ansiccode/sysfile/fopen </path/to/filename>

jako argument wywołania programu można podać analogiczne jak poniżej argumenty:
/home/local/code/ansiccode/sysfile/fopen /home/local/code/ansiccode/sysfile/fopen
rezultat będzie zależny od podanych argumentów wywołania programu:
fopen: file=fopen(argv[1]=/home/local/code/ansiccode/sysfile/fopen, "r"); if (file!=NULL): Successful fopen() file.
fopen: result=fclose(file): result=0, if (result>=0): Successful fclose() file.



#top fprintf


Documentacja online: pubs.opengroup.org | www.cplusplus.com | pl.wikibooks.org

Deklaracja funkcji fprintf() znajduje się w pliku nagłówkowym stdio.h.
Deklaracja funkcji fprintf() jest następująca:
/* Write formatted output to STREAM.

   This function is a possible cancellation point and therefore not
   marked with __THROW.  */
extern int fprintf (FILE *__restrict __stream,
            __const char *__restrict __format, ...);

Powiązane:
dprintf(), fprintf(), vdprintf(), vfprintf(),

Opis:
Funkcja fprintf()

Argumenty:
FILE *__restrict __stream -
const char *__restrict __format -
... -

Zwracana wartość:
int -

Example:
zawartość pliku fprintf.c
SELECT ALL
#define  _GNU_SOURCE  1    /* for environ defined in unistd.h, to avoid warning implicit declaration of function basename, which defined in string.h */
#include <stdio.h>         /* for FILE, va_list, EOF, SEEK_SET, SEEK_CUR, SEEK_END, stdin, stdout, stderr, remove(), rename(), tmpfile(), tmpnam(), tempnam(), fclose(), */
                           /* fflush(), fopen(), freopen(), fprintf(), printf(), snprintf(), scanf(), sscanf(), fgetc(), getc(), getchar(), fputc(), putc(), putchar(), */
                           /* fgets(), gets(), fputs(), puts(), fread(), fwrite(), fseek(), ftell(), rewind(), feof(), ferror(), fileno(), popen(), pclose(), */
#include <string.h>        /* for memcpy(), memmove(), memset(), memcmp(), memchr(), memrchr(), str[n]cpy(), str[n]cat(), str[n]cmp(), strcoll(), str[n]dup(), strchr(), strrchr(), strstr(), */
                           /* strtok(), strcasestr(), memmem(), mempcpy(), str[n]len(), strerror(), bcopy(), bzero(), strcasecmp(), strsep(), basename(), */
#include <errno.h>         /* for errno constant, error constants, */



int main(int argc, char **argv) {
	char *self;
	FILE *file;
	
	self=strrchr(argv[0], '/');
	if (self!=NULL) self++;
	else self=argv[0];
	
	if (argc<2) {
		printf("Usage: %s </path/to/filename>\n", argv[0]);
		return 0;
	}
	
	file=fopen(argv[1], "w");
	if (file!=NULL) {
		printf("%s: file=fopen(argv[1]=%s, \"w\"); if (file!=NULL): Successful fopen() file.\n", self, argv[1]);
		fprintf(file, "%s: file=fopen(argv[1]=%s, \"w\"); if (file!=NULL): Successful fopen() file.\n", self, argv[1]);
		fprintf(file, "%s: printf formatted string into file '%s', main(int argc, char **argv): argc=%d argv[0]=%s, argv[1]=%s\n", self, argv[1], argc, argv[0], argv[1]);
		fclose(file);
	} else {
		printf("%s: file=fopen(argv[1]=%s, \"w\"); if (file!=NULL): else: Unable to fopen() file, Reason: %d:%s\n", self, argv[1], errno, strerror(errno));
	}
	
	return 0;
}

program należy skompilować komendą make (jako argument należy podać plik Makefile zależny od systemu operacyjnego, domyślnie make próbuje użyć pliku Makefile):
make clean all # system Linux
make -f Makefile clean all # system Linux
make -f Makefile.obsd clean all # system OpenBSD
make -f Makefile.fbsd clean all # system FreeBSD
make -f Makefile.sol clean all # system Solaris
make -f Makefile.beos clean all # system BeOS
make -f Makefile.win clean all # system Windows

a następnie uruchomić bez argumentów:
/home/local/code/ansiccode/sysfile/fprintf
program wyświetli informacje o sposobie uruchamiania programu:
Usage: /home/local/code/ansiccode/sysfile/fprintf </path/to/filename>

a następnie uruchomić w następujący sposób:
/home/local/code/ansiccode/sysfile/fprintf /home/local/code/ansiccode/sysfile/fprintf-test
w rezultacie program wyświetli następujące informacje:
fprintf: file=fopen(argv[1], "w"); if (file!=NULL): Successful opened file '/home/local/code/ansiccode/sysfile/fprintf-test'.
oraz zostanie utworzony plik ls -l /home/local/code/ansiccode/sysfile/fprintf-test:
-rw-r--r-- 1 user users 321 Oct 30 21:52 /home/local/code/ansiccode/sysfile/fprintf-test
zawierający następującą zawartość cat /home/local/code/ansiccode/sysfile/fprintf-test:
fprintf: Successful opened file '/home/local/code/ansiccode/sysfile/fprintf-test'
fprintf: printf formatted string into file '/home/local/code/ansiccode/sysfile/fprintf-test', main(int argc, char **argv): argc=2 argv[0]=/home/local/code/ansiccode/sysfile/fprintf, argv[1]=/home/local/code/ansiccode/sysfile/fprintf-test



#top fputc


Documentacja online: pubs.opengroup.org | www.cplusplus.com | pl.wikibooks.org

Deklaracja funkcji fputc() znajduje się w pliku nagłówkowym stdio.h.
Deklaracja funkcji fputc() jest następująca:
/* Write a character to STREAM.

   These functions are possible cancellation points and therefore not
   marked with __THROW.

   These functions is a possible cancellation point and therefore not
   marked with __THROW.  */
extern int fputc (int __c, FILE *__stream);

Powiązane:
feof(), fgetc(), fgets(), fputc(), fputs(),

Opis:
Funkcja fputc()

Argumenty:
int __c -
FILE *__stream -

Zwracana wartość:
int -

Example:
zawartość pliku fputc.c
SELECT ALL
#define  _GNU_SOURCE  1    /* for environ defined in unistd.h, to avoid warning implicit declaration of function basename, which defined in string.h */
#include <stdio.h>         /* for FILE, va_list, EOF, SEEK_SET, SEEK_CUR, SEEK_END, stdin, stdout, stderr, remove(), rename(), tmpfile(), tmpnam(), tempnam(), fclose(), */
                           /* fflush(), fopen(), freopen(), fprintf(), printf(), snprintf(), scanf(), sscanf(), fgetc(), getc(), getchar(), fputc(), putc(), putchar(), */
                           /* fgets(), gets(), fputs(), puts(), fread(), fwrite(), fseek(), ftell(), rewind(), feof(), ferror(), fileno(), popen(), pclose(), */
#include <string.h>        /* for memcpy(), memmove(), memset(), memcmp(), memchr(), memrchr(), str[n]cpy(), str[n]cat(), str[n]cmp(), strcoll(), str[n]dup(), strchr(), strrchr(), strstr(), */
                           /* strtok(), strcasestr(), memmem(), mempcpy(), str[n]len(), strerror(), bcopy(), bzero(), strcasecmp(), strsep(), basename(), */
#include <errno.h>         /* for errno constant, error constants, */



int main(int argc, char **argv) {
	char *self;
	FILE *file;
	int result;
	int onechar;
	
	self=strrchr(argv[0], '/');
	if (self!=NULL) self++;
	else self=argv[0];
	
	if (argc<2) {
		printf("Usage: %s </path/to/filename>\n", argv[0]);
		return 0;
	}
	
	file=fopen(argv[1], "w");
	if (file!=NULL) {
		printf("%s: file=fopen(argv[1]=%s, \"w\"); if (file!=NULL): Successful fopen() file.\n", self, argv[1]);
		onechar='A';
		printf("%s: fputc(onechar,file):\n", self);
		result=fputc(onechar, file);
		fputc('\n', file);
		printf("%s: fputc(onechar,file): result=%d (result=0x%02X) (result=%c)\n", self, result, result, result);
		fclose(file);
	} else {
		printf("%s: file=fopen(argv[1]=%s, \"w\"): if (file!=NULL): else: Unable to fopen() file, Reason: %d:%s\n", self, argv[1], errno, strerror(errno));
	}
	
	return 0;
}

program należy skompilować komendą make (jako argument należy podać plik Makefile zależny od systemu operacyjnego, domyślnie make próbuje użyć pliku Makefile):
make clean all # system Linux
make -f Makefile clean all # system Linux
make -f Makefile.obsd clean all # system OpenBSD
make -f Makefile.fbsd clean all # system FreeBSD
make -f Makefile.sol clean all # system Solaris
make -f Makefile.beos clean all # system BeOS
make -f Makefile.win clean all # system Windows

a następnie uruchomić bez argumentów:
/home/local/code/ansiccode/sysfile/fputc
program wyświetli informacje o sposobie uruchamiania programu:
Usage: /home/local/code/ansiccode/sysfile/fputc </path/to/filename>

jako argument wywołania programu można podać analogiczne jak poniżej argumenty:
/home/local/code/ansiccode/sysfile/fputc /home/local/code/ansiccode/sysfile/fputc-test
rezultat będzie zależny od podanych argumentów wywołania programu:
fputc: file=fopen(argv[1]=/home/local/code/ansiccode/sysfile/fputc-test, "w"); if (file!=NULL): Successful fopen() file.
fputc: fputc(onechar,file):
fputc: fputc(onechar,file): result=65 (result=0x41) (result=A)



#top fputs


Documentacja online: pubs.opengroup.org | www.cplusplus.com | pl.wikibooks.org

Deklaracja funkcji fputs() znajduje się w pliku nagłówkowym stdio.h.
Deklaracja funkcji fputs() jest następująca:
/* Write a character to STREAM.

   These functions are possible cancellation points and therefore not
   marked with __THROW.

   These functions is a possible cancellation point and therefore not
   marked with __THROW.  */
extern int fputc (int __c, FILE *__stream);

Powiązane:
feof(), fgetc(), fgets(), fputc(), fputs(),

Opis:
Funkcja fputs()

Argumenty:
int __c -
FILE *__stream -

Zwracana wartość:
int -

Example:
zawartość pliku fputs.c
SELECT ALL
#define  _GNU_SOURCE  1    /* for environ defined in unistd.h, to avoid warning implicit declaration of function basename, which defined in string.h */
#include <stdio.h>         /* for FILE, va_list, EOF, SEEK_SET, SEEK_CUR, SEEK_END, stdin, stdout, stderr, remove(), rename(), tmpfile(), tmpnam(), tempnam(), fclose(), */
                           /* fflush(), fopen(), freopen(), fprintf(), printf(), snprintf(), scanf(), sscanf(), fgetc(), getc(), getchar(), fputc(), putc(), putchar(), */
                           /* fgets(), gets(), fputs(), puts(), fread(), fwrite(), fseek(), ftell(), rewind(), feof(), ferror(), fileno(), popen(), pclose(), */
#include <string.h>        /* for memcpy(), memmove(), memset(), memcmp(), memchr(), memrchr(), str[n]cpy(), str[n]cat(), str[n]cmp(), strcoll(), str[n]dup(), strchr(), strrchr(), strstr(), */
                           /* strtok(), strcasestr(), memmem(), mempcpy(), str[n]len(), strerror(), bcopy(), bzero(), strcasecmp(), strsep(), basename(), */
#include <errno.h>         /* for errno constant, error constants, */



int main(int argc, char **argv) {
	char *self;
	FILE *file;
	
	self=strrchr(argv[0], '/');
	if (self!=NULL) self++;
	else self=argv[0];
	
	if (argc<2) {
		printf("Usage: %s </path/to/filename>\n", argv[0]);
		return 0;
	}
	
	file=fopen(argv[1], "w");
	if (file!=NULL) {
		printf("%s: file=fopen(argv[1]=%s, \"w\"): if (file!=NULL): Successful fopen() file.\n", self, argv[1]);
		fputs("fputs:line1\n", file);
		fputs("fputs:line2\n", file);
		fputs("fputs:line3\n", file);
		fclose(file);
	} else {
		printf("%s: file=fopen(argv[1]=%s, \"w\"): if (file!=NULL): else: Unable to fopen() file, Reason: %d:%s\n", self, argv[1], errno, strerror(errno));
	}
	
	return 0;
}

program należy skompilować komendą make (jako argument należy podać plik Makefile zależny od systemu operacyjnego, domyślnie make próbuje użyć pliku Makefile):
make clean all # system Linux
make -f Makefile clean all # system Linux
make -f Makefile.obsd clean all # system OpenBSD
make -f Makefile.fbsd clean all # system FreeBSD
make -f Makefile.sol clean all # system Solaris
make -f Makefile.beos clean all # system BeOS
make -f Makefile.win clean all # system Windows

a następnie uruchomić bez argumentów:
/home/local/code/ansiccode/sysfile/fputs
program wyświetli informacje o sposobie uruchamiania programu:
Usage: /home/local/code/ansiccode/sysfile/fputs </path/to/filename>

a następnie uruchomić w następujący sposób:
/home/local/code/ansiccode/sysfile/fputs /home/local/code/ansiccode/sysfile/fputs-test
w rezultacie program wyświetli następujące informacje:
/home/local/code/ansiccode/sysfile/fputs: file=fopen(argv[1]=/home/local/code/ansiccode/sysfile/fputs-test, "w"): if (file!=NULL): successful opened file '/home/local/code/ansiccode/sysfile/fputs-test'.
oraz zostanie utworzony plik ls -l /tmp/ola:
-rw-r--r-- 1 user users 36 Sep 15 23:27 /home/local/code/ansiccode/sysfile/fputs-test
zawierający następującą zawartość cat /home/local/code/ansiccode/sysfile/fputs-test:
fputs:line1
fputs:line2
fputs:line3



#top fread


Documentacja online: pubs.opengroup.org | www.cplusplus.com | pl.wikibooks.org

Deklaracja funkcji fread() znajduje się w pliku nagłówkowym stdio.h.
Deklaracja funkcji fread() jest następująca:
/* Read chunks of generic data from STREAM.

   This function is a possible cancellation points and therefore not
   marked with __THROW.  */
extern size_t fread (void *__restrict __ptr, size_t __size,
             size_t __n, FILE *__restrict __stream) __wur;

Powiązane:
fread(), fwrite(), pread(), pwrite(), read(), write(),

Opis:
Funkcja fread()

Argumenty:
void *__restrict __ptr -
size_t __size -
size_t __n -
FILE *__restrict __stream -

Zwracana wartość:
size_t -

Example:
zawartość pliku fread.c
SELECT ALL
#define  _GNU_SOURCE  1    /* for environ defined in unistd.h, to avoid warning implicit declaration of function basename, which defined in string.h */
#include <stdio.h>         /* for FILE, va_list, EOF, SEEK_SET, SEEK_CUR, SEEK_END, stdin, stdout, stderr, remove(), rename(), tmpfile(), tmpnam(), tempnam(), fclose(), */
                           /* fflush(), fopen(), freopen(), fprintf(), printf(), snprintf(), scanf(), sscanf(), fgetc(), getc(), getchar(), fputc(), putc(), putchar(), */
                           /* fgets(), gets(), fputs(), puts(), fread(), fwrite(), fseek(), ftell(), rewind(), feof(), ferror(), fileno(), popen(), pclose(), */
#include <string.h>        /* for memcpy(), memmove(), memset(), memcmp(), memchr(), memrchr(), str[n]cpy(), str[n]cat(), str[n]cmp(), strcoll(), str[n]dup(), strchr(), strrchr(), strstr(), */
                           /* strtok(), strcasestr(), memmem(), mempcpy(), str[n]len(), strerror(), bcopy(), bzero(), strcasecmp(), strsep(), basename(), */
#include <errno.h>         /* for errno constant, error constants, */



int main(int argc, char **argv) {
	char *self;
	FILE *file;
	char buffdata[1024];
	int result;
	
	self=strrchr(argv[0], '/');
	if (self!=NULL) self++;
	else self=argv[0];
	
	if (argc<2) {
		printf("Usage: %s </path/to/filename>\n", argv[0]);
		return 0;
	}
	
	file=fopen(argv[1], "r");
	if (file!=NULL) {
		printf("%s: file=fopen(argv[1]=%s, \"r\"); if (file!=NULL): Successful fopen() file.\n", self, argv[1]);
		memset(buffdata, 0x00, sizeof(buffdata));
		result=fread(buffdata, 1, sizeof(buffdata), file);
		printf("%s: result=fread(buffdata, 1, sizeof(buffdata)=%lu, file): result=%d\n", self, (long unsigned int)sizeof(buffdata), result);
		printf("%s: buffdata=|%s|\n", self, buffdata);
		fclose(file);
	} else {
		printf("%s: file=fopen(argv[1]=%s, \"r\"); if (file!=NULL): else: Unable to fopen() file, Reason: %d:%s\n", self, argv[1], errno, strerror(errno));
	}
	
	return 0;
}

program należy skompilować komendą make (jako argument należy podać plik Makefile zależny od systemu operacyjnego, domyślnie make próbuje użyć pliku Makefile):
make clean all # system Linux
make -f Makefile clean all # system Linux
make -f Makefile.obsd clean all # system OpenBSD
make -f Makefile.fbsd clean all # system FreeBSD
make -f Makefile.sol clean all # system Solaris
make -f Makefile.beos clean all # system BeOS
make -f Makefile.win clean all # system Windows

a następnie uruchomić bez argumentów:
/home/local/code/ansiccode/sysfile/fread
program wyświetli informacje o sposobie uruchamiania programu:
Usage: /home/local/code/ansiccode/sysfile/fread </path/to/filename>

następnie należy utworzyć przykładowy plik: echo -en "fread:line1\nfread:line2\nfread:line3\n" > /home/local/code/ansiccode/sysfile/fread-test
oraz uruchomić w następujący sposób:
/home/local/code/ansiccode/sysfile/fread /home/local/code/ansiccode/sysfile/fread-test
w rezultacie program wyświetli następujące informacje:
fread: file=fopen(argv[1]=/home/local/code/ansiccode/sysfile/fread-test, "r"); if (file!=NULL): Successful opened file '/home/local/code/ansiccode/sysfile/fread-test'.
fread: result=fread(buffdata, 1, sizeof(buffdata)=1024, file): result=36
fread: buffdata=|fread:line1
fread:line2
fread:line3
|
|



#top freopen


Documentacja online: pubs.opengroup.org | www.cplusplus.com | pl.wikibooks.org

Deklaracja funkcji freopen() znajduje się w pliku nagłówkowym stdio.h.
Deklaracja funkcji freopen() jest następująca:
/* Open a file, replacing an existing stream with it.

   This function is a possible cancellation point and therefore not
   marked with __THROW.  */
extern FILE *freopen (__const char *__restrict __filename,
              __const char *__restrict __modes,
              FILE *__restrict __stream);

Powiązane:
close(), fclose(), fopen(), freopen(), open(), openat(),

Opis:
Funkcja freopen()

Argumenty:
const char *__restrict __filename -
const char *__restrict __modes -
FILE *__restrict __stream -

Zwracana wartość:
FILE * -

Example:
zawartość pliku freopen.c
SELECT ALL
#define  _GNU_SOURCE  1    /* for environ defined in unistd.h, to avoid warning implicit declaration of function basename, which defined in string.h */
#include <stdio.h>         /* for FILE, va_list, EOF, SEEK_SET, SEEK_CUR, SEEK_END, stdin, stdout, stderr, remove(), rename(), tmpfile(), tmpnam(), tempnam(), fclose(), */
                           /* fflush(), fopen(), freopen(), fprintf(), printf(), snprintf(), scanf(), sscanf(), fgetc(), getc(), getchar(), fputc(), putc(), putchar(), */
                           /* fgets(), gets(), fputs(), puts(), fread(), fwrite(), fseek(), ftell(), rewind(), feof(), ferror(), fileno(), popen(), pclose(), */
#include <string.h>        /* for memcpy(), memmove(), memset(), memcmp(), memchr(), memrchr(), str[n]cpy(), str[n]cat(), str[n]cmp(), strcoll(), str[n]dup(), strchr(), strrchr(), strstr(), */
                           /* strtok(), strcasestr(), memmem(), mempcpy(), str[n]len(), strerror(), bcopy(), bzero(), strcasecmp(), strsep(), basename(), */
#include <errno.h>         /* for errno constant, error constants, */



int main(int argc, char **argv) {
	char *self;
	
	self=strrchr(argv[0], '/');
	if (self!=NULL) self++;
	else self=argv[0];
	
	if (argc<2) {
		printf("Usage: %s </path/to/filename>\n", argv[0]);
		return 0;
	}
	
	printf("%s: next printf will be print into file '%s', not on stdout\n", self, argv[1]);
	freopen(argv[1], "a", stdout);
	printf("%s: now printf print into file '%s', not on stdout\n", self, argv[1]);
	
	return 0;
}

program należy skompilować komendą make (jako argument należy podać plik Makefile zależny od systemu operacyjnego, domyślnie make próbuje użyć pliku Makefile):
make clean all # system Linux
make -f Makefile clean all # system Linux
make -f Makefile.obsd clean all # system OpenBSD
make -f Makefile.fbsd clean all # system FreeBSD
make -f Makefile.sol clean all # system Solaris
make -f Makefile.beos clean all # system BeOS
make -f Makefile.win clean all # system Windows

a następnie uruchomić bez argumentów:
/home/local/code/ansiccode/sysfile/freopen
program wyświetli informacje o sposobie uruchamiania programu:
Usage: /home/local/code/ansiccode/sysfile/freopen </path/to/filename>

jako argument wywołania programu można podać analogiczne jak poniżej argumenty:
/home/local/code/ansiccode/sysfile/freopen /home/local/code/ansiccode/sysfile/freopen-test
w rezultacie program wyświetli następujące informacje:
/home/local/code/ansiccode/sysfile/freopen: next printf will be print into file '/home/local/code/ansiccode/sysfile/freopen-test', not on stdout
oraz zostanie utworzony plik ls -l /home/local/code/ansiccode/sysfile/freopen-test:
-rw-r--r-- 1 user users 101 Oct 30 22:04 /home/local/code/ansiccode/sysfile/freopen-test
zawierający następującą zawartość cat /home/local/code/ansiccode/sysfile/freopen-test:
freopen: now printf print into file '/home/local/code/ansiccode/sysfile/freopen-test', not on stdout



#top fseek


Documentacja online: pubs.opengroup.org | www.cplusplus.com | pl.wikibooks.org

Deklaracja funkcji fseek() znajduje się w pliku nagłówkowym stdio.h.
Deklaracja funkcji fseek() jest następująca:
/* Seek to a certain position on STREAM.

   This function is a possible cancellation point and therefore not
   marked with __THROW.  */
extern int fseek (FILE *__stream, long int __off, int __whence);

Powiązane:
fgetpos(), fseek(), fsetpos(), ftell(), lseek(), rewind(),

Opis:
Funkcja fseek()

Argumenty:
FILE *__stream -
long int __off -
int __whence -

Zwracana wartość:
int -

Example:
zawartość pliku fseek.c
SELECT ALL
#define  _GNU_SOURCE  1    /* for environ defined in unistd.h, to avoid warning implicit declaration of function basename, which defined in string.h */
#include <stdio.h>         /* for FILE, va_list, EOF, SEEK_SET, SEEK_CUR, SEEK_END, stdin, stdout, stderr, remove(), rename(), tmpfile(), tmpnam(), tempnam(), fclose(), */
                           /* fflush(), fopen(), freopen(), fprintf(), printf(), snprintf(), scanf(), sscanf(), fgetc(), getc(), getchar(), fputc(), putc(), putchar(), */
                           /* fgets(), gets(), fputs(), puts(), fread(), fwrite(), fseek(), ftell(), rewind(), feof(), ferror(), fileno(), popen(), pclose(), */
#include <string.h>        /* for memcpy(), memmove(), memset(), memcmp(), memchr(), memrchr(), str[n]cpy(), str[n]cat(), str[n]cmp(), strcoll(), str[n]dup(), strchr(), strrchr(), strstr(), */
                           /* strtok(), strcasestr(), memmem(), mempcpy(), str[n]len(), strerror(), bcopy(), bzero(), strcasecmp(), strsep(), basename(), */
#include <errno.h>         /* for errno constant, error constants, */



int main(int argc, char **argv) {
	char *self;
	FILE *file;
	int result;
	
	self=strrchr(argv[0], '/');
	if (self!=NULL) self++;
	else self=argv[0];
	
	if (argc<2) {
		printf("Usage: %s </path/to/filename>\n", argv[0]);
		return 0;
	}
	
	file=fopen(argv[1], "r");
	if (file!=NULL) {
		printf("%s: file=fopen(argv[1]=%s, \"r\"); if (file!=NULL): Successful open() file.\n", self, argv[1]);
		
		result=fseek(file, 0, SEEK_SET);
		if (result>=0) printf("%s: result=fseek(file, 0, SEEK_SET=%d); result=%d if (result>=0): Successful fseek(SEEK_SET)\n", self, SEEK_SET, result);
		else           printf("%s: result=fseek(file, 0, SEEK_SET=%d); result=%d if (result>=0): else: Unable to fseek(SEEK_SET), Reason=%d:%s\n", self, SEEK_SET, result, errno, strerror(errno));
		result=ftell(file);
		printf("%s: result=ftell(file): result=%d\n", self, result);
		
		result=fseek(file, 12, SEEK_SET);
		if (result>=0) printf("%s: result=fseek(file, 12, SEEK_SET=%d); result=%d if (result>=0): Successful fseek(SEEK_SET)\n", self, SEEK_SET, result);
		else           printf("%s: result=fseek(file, 12, SEEK_SET=%d); result=%d if (result>=0): else: Unable to fseek(SEEK_SET), Reason=%d:%s\n", self, SEEK_SET, result, errno, strerror(errno));
		result=ftell(file);
		printf("%s: result=ftell(file): result=%d\n", self, result);
		
		result=fseek(file, 8, SEEK_SET);
		if (result>=0) printf("%s: result=fseek(file, 8, SEEK_SET=%d); result=%d if (result>=0): Successful fseek(SEEK_SET)\n", self, SEEK_SET, result);
		else           printf("%s: result=fseek(file, 8, SEEK_SET=%d); result=%d if (result>=0): else: Unable to fseek(SEEK_SET), Reason=%d:%s\n", self, SEEK_SET, result, errno, strerror(errno));
		result=ftell(file);
		printf("%s: result=ftell(file): result=%d\n", self, result);
		
		result=fseek(file, -4, SEEK_SET);
		if (result>=0) printf("%s: result=fseek(file, -4, SEEK_SET=%d); result=%d if (result>=0): Successful fseek(SEEK_SET)\n", self, SEEK_SET, result);
		else           printf("%s: result=fseek(file, -4, SEEK_SET=%d); result=%d if (result>=0): else: Unable to fseek(SEEK_SET), Reason=%d:%s\n", self, SEEK_SET, result, errno, strerror(errno));
		result=ftell(file);
		printf("%s: result=ftell(file): result=%d\n", self, result);
		
		result=fseek(file, 10000, SEEK_SET);
		if (result>=0) printf("%s: result=fseek(file, 10000, SEEK_SET=%d); result=%d if (result>=0): Successful fseek(SEEK_SET)\n", self, SEEK_SET, result);
		else           printf("%s: result=fseek(file, 10000, SEEK_SET=%d); result=%d if (result>=0): else: Unable to fseek(SEEK_SET), Reason=%d:%s\n", self, SEEK_SET, result, errno, strerror(errno));
		result=ftell(file);
		printf("%s: result=ftell(file): result=%d\n", self, result);
		
		result=fseek(file, -20000, SEEK_SET);
		if (result>=0) printf("%s: result=fseek(file, -20000, SEEK_SET=%d); result=%d if (result>=0): Successful fseek(SEEK_SET)\n", self, SEEK_SET, result);
		else           printf("%s: result=fseek(file, -20000, SEEK_SET=%d); result=%d if (result>=0): else: Unable to fseek(SEEK_SET), Reason=%d:%s\n", self, SEEK_SET, result, errno, strerror(errno));
		result=ftell(file);
		printf("%s: result=ftell(file): result=%d\n", self, result);
		
		
		
		result=fseek(file, 0, SEEK_SET);
		if (result>=0) printf("%s: result=fseek(file, 0, SEEK_SET=%d); result=%d if (result>=0): Successful fseek(SEEK_SET)\n", self, SEEK_SET, result);
		else           printf("%s: result=fseek(file, 0, SEEK_SET=%d); result=%d if (result>=0): else: Unable to fseek(SEEK_SET), Reason=%d:%s\n", self, SEEK_SET, result, errno, strerror(errno));
		result=ftell(file);
		printf("%s: result=ftell(file): result=%d\n", self, result);
		
		
		
		result=fseek(file, 0, SEEK_CUR);
		if (result>=0) printf("%s: result=fseek(file, 0, SEEK_CUR=%d); result=%d if (result>=0): Successful fseek(SEEK_CUR)\n", self, SEEK_CUR, result);
		else           printf("%s: result=fseek(file, 0, SEEK_CUR=%d); result=%d if (result>=0): else: Unable to fseek(SEEK_CUR), Reason=%d:%s\n", self, SEEK_CUR, result, errno, strerror(errno));
		result=ftell(file);
		printf("%s: result=ftell(file): result=%d\n", self, result);
		
		result=fseek(file, 12, SEEK_CUR);
		if (result>=0) printf("%s: result=fseek(file, 12, SEEK_CUR=%d); result=%d if (result>=0): Successful fseek(SEEK_CUR)\n", self, SEEK_CUR, result);
		else           printf("%s: result=fseek(file, 12, SEEK_CUR=%d); result=%d if (result>=0): else: Unable to fseek(SEEK_CUR), Reason=%d:%s\n", self, SEEK_CUR, result, errno, strerror(errno));
		result=ftell(file);
		printf("%s: result=ftell(file): result=%d\n", self, result);
		
		result=fseek(file, 8, SEEK_CUR);
		if (result>=0) printf("%s: result=fseek(file, 8, SEEK_CUR=%d); result=%d if (result>=0): Successful fseek(SEEK_CUR)\n", self, SEEK_CUR, result);
		else           printf("%s: result=fseek(file, 8, SEEK_CUR=%d); result=%d if (result>=0): else: Unable to fseek(SEEK_CUR), Reason=%d:%s\n", self, SEEK_CUR, result, errno, strerror(errno));
		result=ftell(file);
		printf("%s: result=ftell(file): result=%d\n", self, result);
		
		result=fseek(file, -4, SEEK_CUR);
		if (result>=0) printf("%s: result=fseek(file, -4, SEEK_CUR=%d); result=%d if (result>=0): Successful fseek(SEEK_CUR)\n", self, SEEK_CUR, result);
		else           printf("%s: result=fseek(file, -4, SEEK_CUR=%d); result=%d if (result>=0): else: Unable to fseek(SEEK_CUR), Reason=%d:%s\n", self, SEEK_CUR, result, errno, strerror(errno));
		result=ftell(file);
		printf("%s: result=ftell(file): result=%d\n", self, result);
		
		result=fseek(file, 10000, SEEK_CUR);
		if (result>=0) printf("%s: result=fseek(file, 10000, SEEK_CUR=%d); result=%d if (result>=0): Successful fseek(SEEK_CUR)\n", self, SEEK_CUR, result);
		else           printf("%s: result=fseek(file, 10000, SEEK_CUR=%d); result=%d if (result>=0): else: Unable to fseek(SEEK_CUR), Reason=%d:%s\n", self, SEEK_CUR, result, errno, strerror(errno));
		result=ftell(file);
		printf("%s: result=ftell(file): result=%d\n", self, result);
		
		result=fseek(file, -20000, SEEK_CUR);
		if (result>=0) printf("%s: result=fseek(file, -20000, SEEK_CUR=%d); result=%d if (result>=0): Successful fseek(SEEK_CUR)\n", self, SEEK_CUR, result);
		else           printf("%s: result=fseek(file, -20000, SEEK_CUR=%d); result=%d if (result>=0): else: Unable to fseek(SEEK_CUR), Reason=%d:%s\n", self, SEEK_CUR, result, errno, strerror(errno));
		result=ftell(file);
		printf("%s: result=ftell(file): result=%d\n", self, result);
		
		
		
		result=fseek(file, 0, SEEK_SET);
		if (result>=0) printf("%s: result=fseek(file, 0, SEEK_SET=%d); result=%d if (result>=0): Successful fseek(SEEK_SET)\n", self, SEEK_SET, result);
		else           printf("%s: result=fseek(file, 0, SEEK_SET=%d); result=%d if (result>=0): else: Unable to fseek(SEEK_SET), Reason=%d:%s\n", self, SEEK_SET, result, errno, strerror(errno));
		result=ftell(file);
		printf("%s: result=ftell(file): result=%d\n", self, result);
		
		
		
		result=fseek(file, 0, SEEK_END);
		if (result>=0) printf("%s: result=fseek(file, 0, SEEK_END=%d); result=%d if (result>=0): Successful fseek(SEEK_END)\n", self, SEEK_END, result);
		else           printf("%s: result=fseek(file, 0, SEEK_END=%d); result=%d if (result>=0): else: Unable to fseek(SEEK_END), Reason=%d:%s\n", self, SEEK_END, result, errno, strerror(errno));
		result=ftell(file);
		printf("%s: result=ftell(file): result=%d\n", self, result);
		
		result=fseek(file, 12, SEEK_END);
		if (result>=0) printf("%s: result=fseek(file, 12, SEEK_END=%d); result=%d if (result>=0): Successful fseek(SEEK_END)\n", self, SEEK_END, result);
		else           printf("%s: result=fseek(file, 12, SEEK_END=%d); result=%d if (result>=0): else: Unable to fseek(SEEK_END), Reason=%d:%s\n", self, SEEK_END, result, errno, strerror(errno));
		result=ftell(file);
		printf("%s: result=ftell(file): result=%d\n", self, result);
		
		result=fseek(file, 8, SEEK_END);
		if (result>=0) printf("%s: result=fseek(file, 8, SEEK_END=%d); result=%d if (result>=0): Successful fseek(SEEK_END)\n", self, SEEK_END, result);
		else           printf("%s: result=fseek(file, 8, SEEK_END=%d); result=%d if (result>=0): else: Unable to fseek(SEEK_END), Reason=%d:%s\n", self, SEEK_END, result, errno, strerror(errno));
		result=ftell(file);
		printf("%s: result=ftell(file): result=%d\n", self, result);
		
		result=fseek(file, -4, SEEK_END);
		if (result>=0) printf("%s: result=fseek(file, -4, SEEK_END=%d); result=%d if (result>=0): Successful fseek(SEEK_END)\n", self, SEEK_END, result);
		else           printf("%s: result=fseek(file, -4, SEEK_END=%d); result=%d if (result>=0): else: Unable to fseek(SEEK_END), Reason=%d:%s\n", self, SEEK_END, result, errno, strerror(errno));
		result=ftell(file);
		printf("%s: result=ftell(file): result=%d\n", self, result);
		
		result=fseek(file, 10000, SEEK_END);
		if (result>=0) printf("%s: result=fseek(file, 10000, SEEK_END=%d); result=%d if (result>=0): Successful fseek(SEEK_END)\n", self, SEEK_END, result);
		else           printf("%s: result=fseek(file, 10000, SEEK_END=%d); result=%d if (result>=0): else: Unable to fseek(SEEK_END), Reason=%d:%s\n", self, SEEK_END, result, errno, strerror(errno));
		result=ftell(file);
		printf("%s: result=ftell(file): result=%d\n", self, result);
		
		result=fseek(file, -20000, SEEK_END);
		if (result>=0) printf("%s: result=fseek(file, -20000, SEEK_END=%d); result=%d if (result>=0): Successful fseek(SEEK_END)\n", self, SEEK_END, result);
		else           printf("%s: result=fseek(file, -20000, SEEK_END=%d); result=%d if (result>=0): else: Unable to fseek(SEEK_END), Reason=%d:%s\n", self, SEEK_END, result, errno, strerror(errno));
		result=ftell(file);
		printf("%s: result=ftell(file): result=%d\n", self, result);
		
		
		
		fclose(file);
	} else {
		printf("%s: file=fopen(argv[1]=%s, \"r\"); if (file!=NULL): else: Unable to open() file, Reason: %d:%s\n", self, argv[1], errno, strerror(errno));
	}
	
	return 0;
}

program należy skompilować komendą make (jako argument należy podać plik Makefile zależny od systemu operacyjnego, domyślnie make próbuje użyć pliku Makefile):
make clean all # system Linux
make -f Makefile clean all # system Linux
make -f Makefile.obsd clean all # system OpenBSD
make -f Makefile.fbsd clean all # system FreeBSD
make -f Makefile.sol clean all # system Solaris
make -f Makefile.beos clean all # system BeOS
make -f Makefile.win clean all # system Windows

a następnie uruchomić bez argumentów:
/home/local/code/ansiccode/sysfile/fseek
program wyświetli informacje o sposobie uruchamiania programu:
Usage: /home/local/code/ansiccode/sysfile/fseek </path/to/filename>

a następnie utworzyć przykładowy plik touch /home/local/code/ansiccode/sysfile/fseek-test oraz uruchomić w następujący sposób:
/home/local/code/ansiccode/sysfile/fseek /home/local/code/ansiccode/sysfile/fseek-test
w rezultacie program wyświetli następujące informacje:
fseek: file=fopen(argv[1]=/home/local/code/ansiccode/sysfile/fseek-test, "r"); if (file!=NULL): Successful opened file '/home/local/code/ansiccode/sysfile/fseek-test'.
fseek: result=fseek(file, 0, SEEK_SET=0); result=0 if (result>=0): Successful fseek(SEEK_SET)
fseek: result=ftell(file): result=0
fseek: result=fseek(file, 12, SEEK_SET=0); result=0 if (result>=0): Successful fseek(SEEK_SET)
fseek: result=ftell(file): result=12
fseek: result=fseek(file, 8, SEEK_SET=0); result=0 if (result>=0): Successful fseek(SEEK_SET)
fseek: result=ftell(file): result=8
fseek: result=fseek(file, -4, SEEK_SET=0); result=-1 if (result>=0): else: Unable to fseek(SEEK_SET), Reason=22:Invalid argument
fseek: result=ftell(file): result=8
fseek: result=fseek(file, 10000, SEEK_SET=0); result=0 if (result>=0): Successful fseek(SEEK_SET)
fseek: result=ftell(file): result=10000
fseek: result=fseek(file, -20000, SEEK_SET=0); result=-1 if (result>=0): else: Unable to fseek(SEEK_SET), Reason=22:Invalid argument
fseek: result=ftell(file): result=10000
fseek: result=fseek(file, 0, SEEK_SET=0); result=0 if (result>=0): Successful fseek(SEEK_SET)
fseek: result=ftell(file): result=0
fseek: result=fseek(file, 0, SEEK_CUR=1); result=0 if (result>=0): Successful fseek(SEEK_CUR)
fseek: result=ftell(file): result=0
fseek: result=fseek(file, 12, SEEK_CUR=1); result=0 if (result>=0): Successful fseek(SEEK_CUR)
fseek: result=ftell(file): result=12
fseek: result=fseek(file, 8, SEEK_CUR=1); result=0 if (result>=0): Successful fseek(SEEK_CUR)
fseek: result=ftell(file): result=20
fseek: result=fseek(file, -4, SEEK_CUR=1); result=0 if (result>=0): Successful fseek(SEEK_CUR)
fseek: result=ftell(file): result=16
fseek: result=fseek(file, 10000, SEEK_CUR=1); result=0 if (result>=0): Successful fseek(SEEK_CUR)
fseek: result=ftell(file): result=10016
fseek: result=fseek(file, -20000, SEEK_CUR=1); result=-1 if (result>=0): else: Unable to fseek(SEEK_CUR), Reason=22:Invalid argument
fseek: result=ftell(file): result=10016
fseek: result=fseek(file, 0, SEEK_SET=0); result=0 if (result>=0): Successful fseek(SEEK_SET)
fseek: result=ftell(file): result=0
fseek: result=fseek(file, 0, SEEK_END=2); result=0 if (result>=0): Successful fseek(SEEK_END)
fseek: result=ftell(file): result=0
fseek: result=fseek(file, 12, SEEK_END=2); result=0 if (result>=0): Successful fseek(SEEK_END)
fseek: result=ftell(file): result=12
fseek: result=fseek(file, 8, SEEK_END=2); result=0 if (result>=0): Successful fseek(SEEK_END)
fseek: result=ftell(file): result=8
fseek: result=fseek(file, -4, SEEK_END=2); result=-1 if (result>=0): else: Unable to fseek(SEEK_END), Reason=22:Invalid argument
fseek: result=ftell(file): result=8
fseek: result=fseek(file, 10000, SEEK_END=2); result=0 if (result>=0): Successful fseek(SEEK_END)
fseek: result=ftell(file): result=10000
fseek: result=fseek(file, -20000, SEEK_END=2); result=-1 if (result>=0): else: Unable to fseek(SEEK_END), Reason=22:Invalid argument
fseek: result=ftell(file): result=10000



#top fsetpos


Documentacja online: pubs.opengroup.org | www.cplusplus.com | pl.wikibooks.org

Deklaracja funkcji fsetpos() znajduje się w pliku nagłówkowym unistd.h.
Deklaracja funkcji fsetpos() jest następująca:
/* Set STREAM's position.

   This function is a possible cancellation point and therefore not
   marked with __THROW.  */
extern int fsetpos (FILE *__stream, __const fpos_t *__pos);

Powiązane:
fgetpos(), fseek(), fsetpos(), ftell(), lseek(), rewind(),

Opis:
Funkcja fsetpos()

Argumenty:
FILE *__stream -
const fpos_t *__pos -

Zwracana wartość:
int -

Example:
zawartość pliku fsetpos.c
SELECT ALL


program należy skompilować komendą make (jako argument należy podać plik Makefile zależny od systemu operacyjnego, domyślnie make próbuje użyć pliku Makefile):
make clean all # system Linux
make -f Makefile clean all # system Linux
make -f Makefile.obsd clean all # system OpenBSD
make -f Makefile.fbsd clean all # system FreeBSD
make -f Makefile.sol clean all # system Solaris
make -f Makefile.beos clean all # system BeOS
make -f Makefile.win clean all # system Windows

a następnie uruchomić bez argumentów:

program wyświetli informacje o sposobie uruchamiania programu:


jako argument wywołania programu można podać analogiczne jak poniżej argumenty:

rezultat będzie zależny od podanych argumentów wywołania programu:




#top fstat


Documentacja online: pubs.opengroup.org | www.cplusplus.com | pl.wikibooks.org

Deklaracja funkcji fstat() znajduje się w pliku nagłówkowym unistd.h.
Deklaracja funkcji fstat() jest następująca:
/* Get file attributes for the file, device, pipe, or socket
   that file descriptor FD is open on and put them in BUF.  */
extern int fstat (int __fd, struct stat *__buf) __THROW __nonnull ((2));

Powiązane:
access(), faccessat(), fstat(), fstatat(), lstat(), stat(), statfs(), statvfs(),

Opis:
Funkcja fstat()

Argumenty:
int __fd -
struct stat *__buf -

Zwracana wartość:
int -



#top fstatat


Documentacja online: pubs.opengroup.org | www.cplusplus.com | pl.wikibooks.org

Deklaracja funkcji fstat() znajduje się w pliku nagłówkowym sys/stat.h.
Deklaracja funkcji fstat() jest następująca:
#ifdef __USE_ATFILE
/* Similar to stat, get the attributes for FILE and put them in BUF.
   Relative path names are interpreted relative to FD unless FD is
   AT_FDCWD.  */
extern int fstatat (int __fd, __const char *__restrict __file,
            struct stat *__restrict __buf, int __flag)
     __THROW __nonnull ((2, 3));
# endif

Powiązane:
access(), faccessat(), fstat(), fstatat(), lstat(), stat(), statfs(), statvfs(),

Opis:
Funkcja fstatat()

Argumenty:
int __fd -
const char *__restrict __file -
struct stat *__buf -
int __flag -

Zwracana wartość:
int -



#top fsync


Documentacja online: pubs.opengroup.org | www.cplusplus.com | pl.wikibooks.org

Deklaracja funkcji fsync() znajduje się w pliku nagłówkowym unistd.h.
Deklaracja funkcji fsync() jest następująca:
/* Make all changes done to FD actually appear on disk.

   This function is a cancellation point and therefore not marked with
   __THROW.  */
extern int fsync (int __fd);

Powiązane:
fdatasync(), fflush(), fsync(), sync(),

Opis:
Funkcja fsync()

Argumenty:
int __fd -

Zwracana wartość:
int -



#top ftell


Documentacja online: pubs.opengroup.org | www.cplusplus.com | pl.wikibooks.org

Deklaracja funkcji ftell() znajduje się w pliku nagłówkowym stdio.h.
Deklaracja funkcji ftell() jest następująca:
/* Return the current position of STREAM.

   This function is a possible cancellation point and therefore not
   marked with __THROW.  */
extern long int ftell (FILE *__stream) __wur;

Powiązane:
fgetpos(), fseek(), fsetpos(), ftell(), lseek(), rewind(),

Opis:
Funkcja ftell()

Argumenty:
FILE *__strea -

Zwracana wartość:
long int -



#top ftruncate


Documentacja online: pubs.opengroup.org | www.cplusplus.com | pl.wikibooks.org

Deklaracja funkcji ftruncate() znajduje się w pliku nagłówkowym unistd.h.
Deklaracja funkcji ftruncate() jest następująca:
/* Truncate the file FD is open on to LENGTH bytes.  */
extern int ftruncate (int __fd, __off_t __length) __THROW __wur;

Powiązane:
ftruncate(), truncate(),

Opis:
Funkcja ftruncate()

Argumenty:
int __fd -
__off_t __length -

Zwracana wartość:
int -

Example:
zawartość pliku ftruncate.c
SELECT ALL
#define  _GNU_SOURCE  1    /* for environ defined in unistd.h, to avoid warning implicit declaration of function basename, which defined in string.h */
#include <stdio.h>         /* for FILE, va_list, EOF, SEEK_SET, SEEK_CUR, SEEK_END, stdin, stdout, stderr, remove(), rename(), tmpfile(), tmpnam(), tempnam(), fclose(), */
                           /* fflush(), fopen(), freopen(), fprintf(), printf(), snprintf(), scanf(), sscanf(), fgetc(), getc(), getchar(), fputc(), putc(), putchar(), */
                           /* fgets(), gets(), fputs(), puts(), fread(), fwrite(), fseek(), ftell(), rewind(), feof(), ferror(), fileno(), popen(), pclose(), */
#include <stdlib.h>        /* for RAND_MAX, EXIT_FAILURE, EXIT_SUCCESS, MB_CUR_MAX, atoi(), atol(), atoll(), atof(), strtod(), strtof(), strtold(), strtol(), strtoul(), strtoq(), strtouq(), strtoll(), strtoull(), */
                           /* for sys/types.h, malloc.h replaced by stdlib.h, random(), srandom(), rand(), srand(), abort(), atexit(), on_exit(), exit(), getenv(), */
                           /* for putenv(), setenv(), clearenv(), mktemp(), mkstemp(), mkdtemp(), system(), realpath(), abs(), labs(), llabs(), getloadavg(), */
#include <string.h>        /* for memcpy(), memmove(), memset(), memcmp(), memchr(), memrchr(), str[n]cpy(), str[n]cat(), str[n]cmp(), strcoll(), str[n]dup(), strchr(), strrchr(), strstr(), */
                           /* strtok(), strcasestr(), memmem(), mempcpy(), str[n]len(), strerror(), bcopy(), bzero(), strcasecmp(), strsep(), basename(), */
#include <unistd.h>        /* for R_OK, W_OK, X_OK, F_OK, environ, access(), lseek(), close(), read(), write(), pipe(), alarm(), sleep(), ualarm(), usleep(), pause(), chown(), chdir(), getcwd(), */
                           /* for exec[...](), nice(), getpid(), getppid(), setpgid(), setsid(), getsid(), getuid(), geteuid(). getgid(), getegid(), setuid(), seteuid(), setgid(), setegid(), fork(), */
                           /* for link(), symlink(), readlink(), unlink(), rmdir(), getlogin(), setlogin(), gethostname(), sethostname(), daemon(), chroot(), getpass(), [f]sync(), [f]truncate(), syscall(), */
#include <errno.h>         /* for errno constant, error constants, */

#if defined(__WIN32__) || defined(WIN32) || defined(_WIN32)
  #define WIN32_LEAN_AND_MEAN
  #include <fcntl.h>       /* for io.h, O_RDONLY, O_WRONLY, O_RDWR, O_CREAT, O_TRUNC, O_APPEND, */
#else
  #include <fcntl.h>       /* for O_RDONLY, O_WRONLY, O_RDWR, O_CREAT, O_TRUNC, O_APPEND, F_GETFL, F_SETFL, O_NONBLOCK, O_SYNC, FASYNC, O_DIRECT, O_LARGEFILE, O_DIRECTORY, O_NOFOLLOW, O_NOATIME, O_NDELAY, */
                           /* for LOCK_SH, LOCK_EX, LOCK_NB, LOCK_UN, LOCK_MAND, LOCK_READ, LOCK_WRITE, LOCK_RW, fcntl(), open(), creat(), */
#endif



int main(int argc, char **argv) {
	char *self;
	int fprd;
	int truncsize;
#if defined(__WIN32__) || defined(WIN32) || defined(_WIN32)
#else
	int result;
#endif
	
	self=strrchr(argv[0], '/');
	if (self!=NULL) self++;
	else self=argv[0];
	
	if (argc<3) {
		printf("Usage: %s </path/to/filename> <truncate-size>\n", argv[0]);
		return 0;
	}
	
	truncsize=atoi(argv[2]);
	fprd=open(argv[1], O_RDWR, 0644);
	if (fprd>=0) {
		printf("%s: fprd=open(argv[1]=%s, O_RDWR=%d, 0644); fprd=%d if (fprd>=0): Successful open() file.\n", self, argv[1], O_RDWR, fprd);
		
#if defined(__WIN32__) || defined(WIN32) || defined(_WIN32)
		/* ftruncate() is not available on this OS platform !!! */
		printf("%s: ftruncate() is not available on this OS platform !!!\n", self);
#else
		result=ftruncate(fprd, truncsize);
		if (result>=0) printf("%s: result=ftruncate(fprd=%d, truncsize=%d): result=%d if (result>=0): Successful truncate file.\n", self, fprd, truncsize, result);
		else           printf("%s: result=ftruncate(fprd=%d, truncsize=%d): result=%d if (result>=0): else: Unable to truncate file, Reason: %d:%s\n", self, fprd, truncsize, result, errno, strerror(errno));
#endif
		
		close(fprd);
	} else {
		printf("%s: fprd=open(argv[1]=%s, O_RDWR=%d, 0644); fprd=%d if (fprd>=0): else: Unable to open() file, Reason: %d:%s\n", self, argv[1], O_RDWR, fprd, errno, strerror(errno));
	}
	
	return 0;
}

program należy skompilować komendą make (jako argument należy podać plik Makefile zależny od systemu operacyjnego, domyślnie make próbuje użyć pliku Makefile):
make clean all # system Linux
make -f Makefile clean all # system Linux
make -f Makefile.obsd clean all # system OpenBSD
make -f Makefile.fbsd clean all # system FreeBSD
make -f Makefile.sol clean all # system Solaris
make -f Makefile.beos clean all # system BeOS
make -f Makefile.win clean all # system Windows

a następnie uruchomić bez argumentów:
/home/local/code/ansiccode/sysfile/ftruncate
program wyświetli informacje o sposobie uruchamiania programu:
Usage: /home/local/code/ansiccode/sysfile/ftruncate </path/to/filename> <truncate-size>

jako argument wywołania programu można podać analogiczne jak poniżej argumenty:
/home/local/code/ansiccode/sysfile/ftruncate /home/local/code/ansiccode/sysfile/ftruncate-test 10
rezultat będzie zależny od podanych argumentów wywołania programu:
ftruncate: fprd=open(argv[1]=/home/local/code/ansiccode/sysfile/ftruncate-test, O_RDWR=2, 0644); fprd=-1 if (fprd>=0): else: Unable to open file '/home/local/code/ansiccode/sysfile/ftruncate-test', Reason: 2:No such file or directory

następnie należy utworzyć przykładowy plik poleceniem echo -en "/home/local/code/ansiccode/sysfile/ftruncate-test" > /home/local/code/ansiccode/sysfile/ftruncate-test:
oraz wyświetlić informacje o utworzonym pliku poleceniem ls -l /home/local/code/ansiccode/sysfile/ftruncate-test:
-rw-r--r-- 1 user users 49 Oct 30 22:24 /home/local/code/ansiccode/sysfile/ftruncate-test
po czym ponownie uruchomić program z tymi samymi argumentami jak poprzednim przypadku:
/home/local/code/ansiccode/sysfile/ftruncate /home/local/code/ansiccode/sysfile/ftruncate-test 10
rezultat będzie zależny od podanych argumentów wywołania programu:
ftruncate: fprd=open(argv[1]=/home/local/code/ansiccode/sysfile/ftruncate-test, O_RDWR=2, 0644); fprd=3 if (fprd>=0): Successful open() file.
ftruncate: result=ftruncate(fprd=3, truncsize=10): result=0 if (result>=0): Successful truncate file.
oraz ponownie wyświetlić informacje o pliku poleceniem ls -l /home/local/code/ansiccode/sysfile/ftruncate-test:
-rw-r--r-- 1 user users 10 Oct 30 22:28 /home/local/code/ansiccode/sysfile/ftruncate-test



#top futimes


Documentacja online: pubs.opengroup.org | www.cplusplus.com | pl.wikibooks.org

Deklaracja funkcji futimes() znajduje się w pliku nagłówkowym sys/time.h.
Deklaracja funkcji futimes() jest następująca:
/* Same as `utimes', but takes an open file descriptor instead of a name.  */
extern int futimes (int __fd, __const struct timeval __tvp[2]) __THROW;

Powiązane:
futimes(), lutimes(), utime(), utimensat(), utimes(),

Opis:
Funkcja futimes()

Argumenty:
int __fd -
const struct timeval __tvp[2] -

Zwracana wartość:
int -



#top fwrite


Documentacja online: pubs.opengroup.org | www.cplusplus.com | pl.wikibooks.org

Deklaracja funkcji fwrite() znajduje się w pliku nagłówkowym stdio.h.
Deklaracja funkcji fwrite() jest następująca:
/* Write chunks of generic data to STREAM.

   This function is a possible cancellation points and therefore not
   marked with __THROW.  */
extern size_t fwrite (__const void *__restrict __ptr, size_t __size,
              size_t __n, FILE *__restrict __s) __wur;

Powiązane:
fread(), fwrite(), pread(), pwrite(), read(), write(),

Opis:
Funkcja fwrite()

Argumenty:
const void *__restrict __ptr -
size_t __size -
size_t __n -
FILE *__restrict __s -

Zwracana wartość:
size_t -

Example:
zawartość pliku fwrite.c
SELECT ALL
#define  _GNU_SOURCE  1    /* for environ defined in unistd.h, to avoid warning implicit declaration of function basename, which defined in string.h */
#include <stdio.h>         /* for FILE, va_list, EOF, SEEK_SET, SEEK_CUR, SEEK_END, stdin, stdout, stderr, remove(), rename(), tmpfile(), tmpnam(), tempnam(), fclose(), */
                           /* fflush(), fopen(), freopen(), fprintf(), printf(), snprintf(), scanf(), sscanf(), fgetc(), getc(), getchar(), fputc(), putc(), putchar(), */
                           /* fgets(), gets(), fputs(), puts(), fread(), fwrite(), fseek(), ftell(), rewind(), feof(), ferror(), fileno(), popen(), pclose(), */
#include <string.h>        /* for memcpy(), memmove(), memset(), memcmp(), memchr(), memrchr(), str[n]cpy(), str[n]cat(), str[n]cmp(), strcoll(), str[n]dup(), strchr(), strrchr(), strstr(), */
                           /* strtok(), strcasestr(), memmem(), mempcpy(), str[n]len(), strerror(), bcopy(), bzero(), strcasecmp(), strsep(), basename(), */
#include <unistd.h>        /* for R_OK, W_OK, X_OK, F_OK, environ, access(), lseek(), close(), read(), write(), pipe(), alarm(), sleep(), ualarm(), usleep(), pause(), chown(), chdir(), getcwd(), */
                           /* for exec[...](), nice(), getpid(), getppid(), setpgid(), setsid(), getsid(), getuid(), geteuid(). getgid(), getegid(), setuid(), seteuid(), setgid(), setegid(), fork(), */
                           /* for link(), symlink(), readlink(), unlink(), rmdir(), getlogin(), setlogin(), gethostname(), sethostname(), daemon(), chroot(), getpass(), [f]sync(), [f]truncate(), syscall(), */
#include <errno.h>         /* for errno constant, error constants, */

#if defined(__WIN32__) || defined(WIN32) || defined(_WIN32)
  #define WIN32_LEAN_AND_MEAN
  #include <fcntl.h>       /* for io.h, O_RDONLY, O_WRONLY, O_RDWR, O_CREAT, O_TRUNC, O_APPEND, */
#else
  #include <fcntl.h>       /* for O_RDONLY, O_WRONLY, O_RDWR, O_CREAT, O_TRUNC, O_APPEND, F_GETFL, F_SETFL, O_NONBLOCK, O_SYNC, FASYNC, O_DIRECT, O_LARGEFILE, O_DIRECTORY, O_NOFOLLOW, O_NOATIME, O_NDELAY, */
                           /* for LOCK_SH, LOCK_EX, LOCK_NB, LOCK_UN, LOCK_MAND, LOCK_READ, LOCK_WRITE, LOCK_RW, fcntl(), open(), creat(), */
#endif



int main(int argc, char **argv) {
	char *self;
	FILE *file;
	char buffdata[1024];
	int result;
	
	self=strrchr(argv[0], '/');
	if (self!=NULL) self++;
	else self=argv[0];
	
	if (argc<2) {
		printf("Usage: %s </path/to/filename>\n", argv[0]);
		return 0;
	}
	
	file=fopen(argv[1], "w");
	if (file!=NULL) {
		printf("%s: file=fopen(argv[1]=%s, \"w\"); if (file!=NULL): Successful open() file.\n", self, argv[1], argv[1]);
		
		
#if defined(HAVE_FLOCK)
		result=flock(fileno(file), LOCK_SH);
		if (result>=0) printf("%s: result=flock(file, LOCK_SH=%d): result=%d if (result>=0): Successful flock() file '%s'\n", self, F_LOCK, result, argv[1]);
		else           printf("%s: result=flock(file, LOCK_SH=%d): result=%d if (result>=0): else: Unable to flock() file '%s', Reason: %d:%s\n", self, F_LOCK, result, argv[1], errno, strerror(errno));
#endif
		
		strncpy(buffdata, "fwrite:line1\nfwrite:line2\nfwrite:line3\n", sizeof(buffdata));
		result=fwrite(buffdata, 1, strlen(buffdata), file);
		printf("%s: result=fwrite(buffdata, 1, strlen(buffdata), file): result=%d\n", self, result);
		
#if defined(HAVE_FLOCK)
		result=flock(fileno(file), LOCK_UN);
		if (result>=0) printf("%s: result=flock(file, LOCK_UN=%d): result=%d if (result>=0): Successful flock() file '%s'\n", self, F_LOCK, result, argv[1]);
		else           printf("%s: result=flock(file, LOCK_UN=%d): result=%d if (result>=0): else: Unable to flock() file '%s', Reason: %d:%s\n", self, F_LOCK, result, argv[1], errno, strerror(errno));
#endif
		
		fclose(file);
	} else {
		printf("%s: file=fopen(argv[1]=%s, \"w\"); if (file!=NULL): else: Unable to open() file, Reason: %d:%s\n", self, argv[1], argv[1], errno, strerror(errno));
	}
	
	return 0;
}

program należy skompilować komendą make (jako argument należy podać plik Makefile zależny od systemu operacyjnego, domyślnie make próbuje użyć pliku Makefile):
make clean all # system Linux
make -f Makefile clean all # system Linux
make -f Makefile.obsd clean all # system OpenBSD
make -f Makefile.fbsd clean all # system FreeBSD
make -f Makefile.sol clean all # system Solaris
make -f Makefile.beos clean all # system BeOS
make -f Makefile.win clean all # system Windows

a następnie uruchomić bez argumentów:
/home/local/code/ansiccode/sysfile/fwrite
program wyświetli informacje o sposobie uruchamiania programu:
Usage: /home/local/code/ansiccode/sysfile/fwrite </path/to/filename>

a następnie uruchomić w następujący sposób:
/home/local/code/ansiccode/sysfile/fwrite /home/local/code/ansiccode/sysfile/fwrite-test
w rezultacie program wyświetli następujące informacje:
fwrite: file=fopen(argv[1]=/home/local/code/ansiccode/sysfile/fwrite-test, "w"); if (file!=NULL): Successful open() file.
fwrite: result=flock(file, LOCK_SH=1): result=0 if (result>=0): Successful flock() file '/home/local/code/ansiccode/sysfile/fwrite-test'
fwrite: result=fwrite(buffdata, 1, strlen(buffdata), file): result=39
fwrite: result=flock(file, LOCK_UN=1): result=0 if (result>=0): Successful flock() file '/home/local/code/ansiccode/sysfile/fwrite-test'
oraz zostanie utworzony plik ls -l /home/local/code/ansiccode/sysfile/fwrite-test:
-rw-r--r-- 1 user users 39 Oct 30 22:30 /home/local/code/ansiccode/sysfile/fwrite-test
zawierający następującą zawartość cat /home/local/code/ansiccode/sysfile/fwrite-test:
fwrite:line1
fwrite:line2
fwrite:line3



#top getc


Documentacja online: pubs.opengroup.org | www.cplusplus.com | pl.wikibooks.org

Deklaracja funkcji getc() znajduje się w pliku nagłówkowym stdio.h.
Deklaracja funkcji getc() jest następująca:
/* Read a character from STREAM.

   These functions are possible cancellation points and therefore not
   marked with __THROW.  */
extern int getc (FILE *__stream);

Powiązane:
getc(), getw(), putc(), putw(), ungetc(),

Opis:
Funkcja getc()

Argumenty:
FILE *__stream -

Zwracana wartość:
int -

Example:
zawartość pliku getc.c
SELECT ALL
#define  _GNU_SOURCE  1    /* for environ defined in unistd.h, to avoid warning implicit declaration of function basename, which defined in string.h */
#include <stdio.h>         /* for FILE, va_list, EOF, SEEK_SET, SEEK_CUR, SEEK_END, stdin, stdout, stderr, remove(), rename(), tmpfile(), tmpnam(), tempnam(), fclose(), */
                           /* fflush(), fopen(), freopen(), fprintf(), printf(), snprintf(), scanf(), sscanf(), fgetc(), getc(), getchar(), fputc(), putc(), putchar(), */
                           /* fgets(), gets(), fputs(), puts(), fread(), fwrite(), fseek(), ftell(), rewind(), feof(), ferror(), fileno(), popen(), pclose(), */
#include <string.h>        /* for memcpy(), memmove(), memset(), memcmp(), memchr(), memrchr(), str[n]cpy(), str[n]cat(), str[n]cmp(), strcoll(), str[n]dup(), strchr(), strrchr(), strstr(), */
                           /* strtok(), strcasestr(), memmem(), mempcpy(), str[n]len(), strerror(), bcopy(), bzero(), strcasecmp(), strsep(), basename(), */



int main(int argc, char **argv) {
	char *self;
	int result;
	
	self=strrchr(argv[0], '/');
	if (self!=NULL) self++;
	else self=argv[0];
	
	if (argc<1) {
		printf("Usage: %s\n", argv[0]);
		return 0;
	}
	
	printf("%s: getc(stdin): ", self);
	fflush(stdout);
	result=getc(stdin);
	printf("%s: getc(stdin): result(%%d)=%d result(0x%%02X)=0x%02X result(%%c)=|%c|\n", self, result, result, result);
	
	return 0;
}

program należy skompilować komendą:
make clean all # system Linux
make -f Makefile clean all # system Linux
make -f Makefile.obsd clean all # system OpenBSD
make -f Makefile.fbsd clean all # system FreeBSD
make -f Makefile.sol clean all # system Solaris
make -f Makefile.beos clean all # system BeOS
make -f Makefile.win clean all # system Windows

a następnie uruchomić w następujący sposób:
/home/local/code/ansiccode/sysfile/getc
w oczekiwaniu programu na stosowne argumenty należy wpisać (oraz nacisnąć klawisz Enter aby zatwierdzenia wprowadzonych danych):
a
w rezultacie program wyświetli następujące informacje:
getc: getc(stdin): a
getc: getc(stdin): result(%d)=97 result(0x%02X)=0x61 result(%c)=|a|



#top getdelim


Documentacja online: pubs.opengroup.org | www.cplusplus.com | pl.wikibooks.org

Deklaracja funkcji getdelim() znajduje się w pliku nagłówkowym stdio.h.
Deklaracja funkcji getdelim() jest następująca:
extern _IO_ssize_t getdelim (char **__restrict __lineptr,
                 size_t *__restrict __n, int __delimiter,
                 FILE *__restrict __stream) __wur;

Powiązane:
getdelim(), getline(),

Opis:
Funkcja getdelim()

Argumenty:
char **__restrict __lineptr -
size_t *__restrict __n -
int __delimiter -
FILE *__restrict __stream -

Zwracana wartość:
_IO_ssize_t -

Example:
zawartość pliku getdelim.c
SELECT ALL


program należy skompilować komendą make (jako argument należy podać plik Makefile zależny od systemu operacyjnego, domyślnie make próbuje użyć pliku Makefile):
make clean all # system Linux
make -f Makefile clean all # system Linux
make -f Makefile.obsd clean all # system OpenBSD
make -f Makefile.fbsd clean all # system FreeBSD
make -f Makefile.sol clean all # system Solaris
make -f Makefile.beos clean all # system BeOS
make -f Makefile.win clean all # system Windows

a następnie uruchomić bez argumentów:

program wyświetli informacje o sposobie uruchamiania programu:


jako argument wywołania programu można podać analogiczne jak poniżej argumenty:

rezultat będzie zależny od podanych argumentów wywołania programu:




#top getdtablesize


Documentacja online: pubs.opengroup.org | www.cplusplus.com | pl.wikibooks.org

Deklaracja funkcji getdtablesize() znajduje się w pliku nagłówkowym unistd.h.
Deklaracja funkcji getdtablesize() jest następująca:
/* Return the maximum number of file descriptors
   the current process could possibly have.  */
extern int getdtablesize (void) __THROW;

Powiązane:

Opis:
Funkcja getdtablesize()

Argumenty:
Funkcja nie przyjmuje żadnych argumentów.

Zwracana wartość:
int -

Example:
zawartość pliku getdtablesize.c
SELECT ALL


program należy skompilować komendą make (jako argument należy podać plik Makefile zależny od systemu operacyjnego, domyślnie make próbuje użyć pliku Makefile):
make clean all # system Linux
make -f Makefile clean all # system Linux
make -f Makefile.obsd clean all # system OpenBSD
make -f Makefile.fbsd clean all # system FreeBSD
make -f Makefile.sol clean all # system Solaris
make -f Makefile.beos clean all # system BeOS
make -f Makefile.win clean all # system Windows

a następnie uruchomić bez argumentów:

program wyświetli informacje o sposobie uruchamiania programu:


jako argument wywołania programu można podać analogiczne jak poniżej argumenty:

rezultat będzie zależny od podanych argumentów wywołania programu:




#top getline


Documentacja online: pubs.opengroup.org | www.cplusplus.com | pl.wikibooks.org

Deklaracja funkcji getline() znajduje się w pliku nagłówkowym unistd.h.
Deklaracja funkcji getline() jest następująca:
/* Like `getdelim</strong>', but reads up to a newline.

   This function is not part of POSIX and therefore no official
   cancellation point.  But due to similarity with an POSIX interface
   or due to the implementation it is a cancellation point and
   therefore not marked with __THROW.  */
extern _IO_ssize_t getline (char **__restrict __lineptr,
                size_t *__restrict __n,
                FILE *__restrict __stream) __wur;

Powiązane:
getdelim(), getline(),

Opis:
Funkcja getline()

Argumenty:
char **__restrict __lineptr -
size_t *__restrict __n -
FILE *__restrict __stream -

Zwracana wartość:
_IO_ssize_t -

Example:
zawartość pliku getline.c
SELECT ALL


program należy skompilować komendą make (jako argument należy podać plik Makefile zależny od systemu operacyjnego, domyślnie make próbuje użyć pliku Makefile):
make clean all # system Linux
make -f Makefile clean all # system Linux
make -f Makefile.obsd clean all # system OpenBSD
make -f Makefile.fbsd clean all # system FreeBSD
make -f Makefile.sol clean all # system Solaris
make -f Makefile.beos clean all # system BeOS
make -f Makefile.win clean all # system Windows

a następnie uruchomić bez argumentów:

program wyświetli informacje o sposobie uruchamiania programu:


jako argument wywołania programu można podać analogiczne jak poniżej argumenty:

rezultat będzie zależny od podanych argumentów wywołania programu:




#top getumask


Documentacja online: pubs.opengroup.org | www.cplusplus.com | pl.wikibooks.org

Deklaracja funkcji getumask() znajduje się w pliku nagłówkowym sys/stat.h.
Deklaracja funkcji getumask() jest następująca:
#ifdef  __USE_GNU
/* Get the current `umask' value without changing it.
   This function is only available under the GNU Hurd.  */
extern __mode_t getumask (void) __THROW;
#endif

Powiązane:
getumask(), umask(),

Opis:
Funkcja getumask()

Argumenty:

Zwracana wartość:
__mode_t -



#top getw


Documentacja online: pubs.opengroup.org | www.cplusplus.com | pl.wikibooks.org

Deklaracja funkcji getw() znajduje się w pliku nagłówkowym stdio.h.
Deklaracja funkcji getw() jest następująca:
/* Get a word (int) from STREAM.  */
extern int getw (FILE *__stream);

Powiązane:
getc(), getw(), putc(), putw(), ungetc(),

Opis:
Funkcja getw()

Argumenty:
FILE *__stream -

Zwracana wartość:
int -

Example:
zawartość pliku getw.c
SELECT ALL
#define  _GNU_SOURCE  1    /* for environ defined in unistd.h, to avoid warning implicit declaration of function basename, which defined in string.h */
#include <stdio.h>         /* for FILE, va_list, EOF, SEEK_SET, SEEK_CUR, SEEK_END, stdin, stdout, stderr, remove(), rename(), tmpfile(), tmpnam(), tempnam(), fclose(), */
                           /* fflush(), fopen(), freopen(), fprintf(), printf(), snprintf(), scanf(), sscanf(), fgetc(), getc(), getchar(), fputc(), putc(), putchar(), */
                           /* fgets(), gets(), fputs(), puts(), fread(), fwrite(), fseek(), ftell(), rewind(), feof(), ferror(), fileno(), popen(), pclose(), */
#include <string.h>        /* for memcpy(), memmove(), memset(), memcmp(), memchr(), memrchr(), str[n]cpy(), str[n]cat(), str[n]cmp(), strcoll(), str[n]dup(), strchr(), strrchr(), strstr(), */
                           /* strtok(), strcasestr(), memmem(), mempcpy(), str[n]len(), strerror(), bcopy(), bzero(), strcasecmp(), strsep(), basename(), */
#include <errno.h>         /* for errno constant, error constants, */



int main(int argc, char **argv) {
	char *self;
	FILE *file;
	int value;
	
	self=strrchr(argv[0], '/');
	if (self!=NULL) self++;
	else self=argv[0];
	
	if (argc<2) {
		printf("Usage: %s </path/to/filename>\n", argv[0]);
		printf("Examples:\n");
		printf("       %s /home/local/code/ansiccode/sysfile/getw-read\n", argv[0]);
		return 0;
	}
	
	file=fopen(argv[1], "r");
	if (file!=NULL) {
		printf("%s: file=fopen(argv[1]=%s, \"r\"); if (file!=NULL): Successful fopen() file.\n", self, argv[1]);
		
		value=getw(file);
		printf("%s: value=getw(file): value=%d (%08X)\n", self, value, value);
		value=getw(file);
		printf("%s: value=getw(file): value=%d (%08X)\n", self, value, value);
		value=getw(file);
		printf("%s: value=getw(file): value=%d (%08X)\n", self, value, value);
		value=getw(file);
		printf("%s: value=getw(file): value=%d (%08X)\n", self, value, value);
		value=getw(file);
		printf("%s: value=getw(file): value=%d (%08X)\n", self, value, value);
		
		fclose(file);
	} else {
		printf("%s: file=fopen(argv[1]=%s, \"w\"); if (file!=NULL): else: Unable to fopen() file, Reason: %d:%s\n", self, argv[1], errno, strerror(errno));
	}
	
	return 0;
}

program należy skompilować komendą:
make clean all # system Linux
make -f Makefile clean all # system Linux
make -f Makefile.obsd clean all # system OpenBSD
make -f Makefile.fbsd clean all # system FreeBSD
make -f Makefile.sol clean all # system Solaris
make -f Makefile.beos clean all # system BeOS
make -f Makefile.win clean all # system Windows

a następnie uruchomić bez argumentów:
/home/local/code/ansiccode/sysfile/getw
program wyświetli informacje o sposobie uruchamiania programu:
Usage: /home/local/code/ansiccode/sysfile/getw </path/to/filename>
Examples:
       /home/local/code/ansiccode/sysfile/getw /home/local/code/ansiccode/sysfile/getw-read

przed uruchomieniem programu należy utworzyć przykładowy plik w następujący sposób:
echo -en "\x05\x0\x0\x00\x30\x00\x00\x00\xFF\xFF\x00\x00" > /home/local/code/ansiccode/sysfile/getw-read
jako argument wywołania programu można podać analogiczne jak poniżej argumenty:
/home/local/code/ansiccode/sysfile/getw /home/local/code/ansiccode/sysfile/getw-read
rezultat będzie zależny od podanych argumentów wywołania programu:
getw: file=fopen(argv[1]=/home/local/code/ansiccode/sysfile/getw-read, "r"); if (file!=NULL): Successful fopen() file.
getw: value=getw(file): value=5 (00000005)
getw: value=getw(file): value=48 (00000030)
getw: value=getw(file): value=65535 (0000FFFF)
getw: value=getw(file): value=-1 (FFFFFFFF)
getw: value=getw(file): value=-1 (FFFFFFFF)



#top lchmod


Documentacja online: pubs.opengroup.org | www.cplusplus.com | pl.wikibooks.org

Deklaracja funkcji lchmod() znajduje się w pliku nagłówkowym unistd.h.
Deklaracja funkcji lchmod() jest następująca:
/* Set file access permissions for FILE to MODE.
   If FILE is a symbolic link, this affects the link itself
   rather than its target.  */
extern int lchmod (__const char *__file, __mode_t __mode)
     __THROW __nonnull ((1));

Powiązane:
chmod(), fchmod(), fchmodat(), lchmod(),

Opis:
Funkcja lchmod()

Argumenty:
const char *__file -
__mode_t __mode -

Zwracana wartość:
int -



#top lchown


Documentacja online: pubs.opengroup.org | www.cplusplus.com | pl.wikibooks.org

Deklaracja funkcji lchown() znajduje się w pliku nagłówkowym unistd.h.
Deklaracja funkcji lchown() jest następująca:
/* Change owner and group of FILE, if it is a symbolic
   link the ownership of the symbolic link is changed.  */
extern int lchown (__const char *__file, __uid_t __owner, __gid_t __group)
     __THROW __nonnull ((1)) __wur;

Powiązane:
chown(), fchown(), fchownat(), lchown(),

Opis:
Funkcja lchown()

Argumenty:
const char *__file -
__uid_t __owner -
__gid_t __group -

Zwracana wartość:
int -




Documentacja online: pubs.opengroup.org | www.cplusplus.com | pl.wikibooks.org

Deklaracja funkcji link() znajduje się w pliku nagłówkowym unistd.h.
Deklaracja funkcji link() jest następująca:
/* Make a link to FROM named TO.  */
extern int link (__const char *__from, __const char *__to)
     __THROW __nonnull ((1, 2)) __wur;

Powiązane:
link(), linkat(), readlink(), readlinkat(), symlink(), symlinkat(),

Opis:
Funkcja link()

Argumenty:
const char *__from -
const char *__to -

Zwracana wartość:
int -

Example:
zawartość pliku link.c
SELECT ALL
#define  _GNU_SOURCE  1    /* for environ defined in unistd.h, to avoid warning implicit declaration of function basename, which defined in string.h */
#include <stdio.h>         /* for FILE, va_list, EOF, SEEK_SET, SEEK_CUR, SEEK_END, stdin, stdout, stderr, remove(), rename(), tmpfile(), tmpnam(), tempnam(), fclose(), */
                           /* fflush(), fopen(), freopen(), fprintf(), printf(), snprintf(), scanf(), sscanf(), fgetc(), getc(), getchar(), fputc(), putc(), putchar(), */
                           /* fgets(), gets(), fputs(), puts(), fread(), fwrite(), fseek(), ftell(), rewind(), feof(), ferror(), fileno(), popen(), pclose(), */
#include <string.h>        /* for memcpy(), memmove(), memset(), memcmp(), memchr(), memrchr(), str[n]cpy(), str[n]cat(), str[n]cmp(), strcoll(), str[n]dup(), strchr(), strrchr(), strstr(), */
                           /* strtok(), strcasestr(), memmem(), mempcpy(), str[n]len(), strerror(), bcopy(), bzero(), strcasecmp(), strsep(), basename(), */
#include <unistd.h>        /* for R_OK, W_OK, X_OK, F_OK, environ, access(), lseek(), close(), read(), write(), pipe(), alarm(), sleep(), ualarm(), usleep(), pause(), chown(), chdir(), getcwd(), */
                           /* for exec[...](), nice(), getpid(), getppid(), setpgid(), setsid(), getsid(), getuid(), geteuid(). getgid(), getegid(), setuid(), seteuid(), setgid(), setegid(), fork(), */
                           /* for link(), symlink(), readlink(), unlink(), rmdir(), getlogin(), setlogin(), gethostname(), sethostname(), daemon(), chroot(), getpass(), [f]sync(), [f]truncate(), syscall(), */
#include <errno.h>         /* for errno constant, error constants, */



int main(int argc, char **argv) {
	char *self;
#if defined(__WIN32__) || defined(WIN32) || defined(_WIN32)
#else
	int result;
#endif
	
	self=strrchr(argv[0], '/');
	if (self!=NULL) self++;
	else self=argv[0];
	
	if (argc<3) {
		printf("Usage: %s </path/to/filename> </path/to/(new-hard)link>\n", argv[0]);
		return 0;
	}
	
#if defined(__WIN32__) || defined(WIN32) || defined(_WIN32)
	/* link() is not available on this OS platform !!! */
	printf("%s: link() is not available on this OS platform !!!\n", self);
#else
	result=link(argv[1], argv[2]);
	if (result>=0) printf("%s: result=link(argv[1]=%s, argv[2]=%s): result=%d if (result>=0): Successful link() file '%s' to '%s'.\n", self, argv[1], argv[2], result, argv[1], argv[2]);
	else           printf("%s: result=link(argv[1]=%s, argv[2]=%s): result=%d if (result>=0): else: Unable to link() file '%s' to '%s', Reason: %d:%s\n", self, argv[1], argv[2], result, argv[1], argv[2], errno, strerror(errno));
#endif
	return 0;
}

program należy skompilować komendą make (jako argument należy podać plik Makefile zależny od systemu operacyjnego, domyślnie make próbuje użyć pliku Makefile):
make clean all # system Linux
make -f Makefile clean all # system Linux
make -f Makefile.obsd clean all # system OpenBSD
make -f Makefile.fbsd clean all # system FreeBSD
make -f Makefile.sol clean all # system Solaris
make -f Makefile.beos clean all # system BeOS
make -f Makefile.win clean all # system Windows

a następnie uruchomić bez argumentów:
/home/local/code/ansiccode/sysfile/link
program wyświetli informacje o sposobie uruchamiania programu:
Usage: /home/local/code/ansiccode/sysfile/link </path/to/filename> </path/to/(new-hard)link>

jako argument wywołania programu można podać analogiczne jak poniżej argumenty:
/home/local/code/ansiccode/sysfile/link /home/local/code/ansiccode/sysfile/link /home/local/code/ansiccode/sysfile/link-test
/home/local/code/ansiccode/sysfile/link /home/local/code/ansiccode/sysfile/link /tmp/link-test
/home/local/code/ansiccode/sysfile/link /dev/null /dev/null-link
rezultat będzie zależny od podanych argumentów wywołania programu:
link: result=link(argv[1]=/home/local/code/ansiccode/sysfile/link, argv[2]=/home/local/code/ansiccode/sysfile/link-test): result=-1 if (result>=0): else: Unable to link() file '/home/local/code/ansiccode/sysfile/link' to '/home/local/code/ansiccode/sysfile/link-test', Reason: 17:File exists

link: result=link(argv[1]=/home/local/code/ansiccode/sysfile/link, argv[2]=/tmp/link-test): result=-1 if (result>=0): else: Unable to link() file '/home/local/code/ansiccode/sysfile/link' to '/tmp/link-test', Reason: 18:Invalid cross-device link

link: result=link(argv[1]=/dev/null, argv[2]=/dev/null-link): result=-1 if (result>=0): else: Unable to link() file '/dev/null' to '/dev/null-link', Reason: 13:Permission denied



#top linkat


Documentacja online: pubs.opengroup.org | www.cplusplus.com | pl.wikibooks.org

Deklaracja funkcji linkat() znajduje się w pliku nagłówkowym unistd.h.
Deklaracja funkcji linkat() jest następująca:
#ifdef __USE_ATFILE
/* Like link but relative paths in TO and FROM are interpreted relative
   to FROMFD and TOFD respectively.  */
extern int linkat (int __fromfd, __const char *__from, int __tofd,
           __const char *__to, int __flags)
     __THROW __nonnull ((2, 4)) __wur;
#endif

Powiązane:
link(), linkat(), readlink(), readlinkat(), symlink(), symlinkat(),

Opis:
Funkcja linkat()

Argumenty:
int __fromfd -
const char *__from -
int __tofd -
const char *__to -
int __flags -

Zwracana wartość:
int -



#top lockf


Documentacja online: pubs.opengroup.org | www.cplusplus.com | pl.wikibooks.org

Deklaracja funkcji lockf() znajduje się w pliku nagłówkowym unistd.h.
Deklaracja funkcji lockf() jest następująca:
extern int lockf (int __fd, int __cmd, __off_t __len) __wur;

Powiązane:
fcntl(), flock(), lockf(),

Opis:
Funkcja lockf()

Argumenty:
int __fd -
int __cmd -
__off_t __len -

Zwracana wartość:
int -

Example:
zawartość pliku lockf.c
SELECT ALL


program należy skompilować komendą make (jako argument należy podać plik Makefile zależny od systemu operacyjnego, domyślnie make próbuje użyć pliku Makefile):
make clean all # system Linux
make -f Makefile clean all # system Linux
make -f Makefile.obsd clean all # system OpenBSD
make -f Makefile.fbsd clean all # system FreeBSD
make -f Makefile.sol clean all # system Solaris
make -f Makefile.beos clean all # system BeOS
make -f Makefile.win clean all # system Windows

a następnie uruchomić bez argumentów:

program wyświetli informacje o sposobie uruchamiania programu:


jako argument wywołania programu można podać analogiczne jak poniżej argumenty:

rezultat będzie zależny od podanych argumentów wywołania programu:




#top lseek


Documentacja online: pubs.opengroup.org | www.cplusplus.com | pl.wikibooks.org

Deklaracja funkcji lseek() znajduje się w pliku nagłówkowym unistd.h.
Deklaracja funkcji lseek() jest następująca:
/* Move FD's file position to OFFSET bytes from the
   beginning of the file (if WHENCE is SEEK_SET),
   the current position (if WHENCE is SEEK_CUR),
   or the end of the file (if WHENCE is SEEK_END).
   Return the new file position.  */
extern __off_t lseek (int __fd, __off_t __offset, int __whence) __THROW;

Powiązane:
fgetpos(), fseek(), fsetpos(), ftell(), lseek(), rewind(),

Opis:
Funkcja lseek()

Argumenty:
int __fd -
__off_t __offset -
int __whence -

Zwracana wartość:
__off_t -

Example:
zawartość pliku lseek.c
SELECT ALL
#define  _GNU_SOURCE  1    /* for environ defined in unistd.h, to avoid warning implicit declaration of function basename, which defined in string.h */
#include <stdio.h>         /* for FILE, va_list, EOF, SEEK_SET, SEEK_CUR, SEEK_END, stdin, stdout, stderr, remove(), rename(), tmpfile(), tmpnam(), tempnam(), fclose(), */
                           /* fflush(), fopen(), freopen(), fprintf(), printf(), snprintf(), scanf(), sscanf(), fgetc(), getc(), getchar(), fputc(), putc(), putchar(), */
                           /* fgets(), gets(), fputs(), puts(), fread(), fwrite(), fseek(), ftell(), rewind(), feof(), ferror(), fileno(), popen(), pclose(), */
#include <string.h>        /* for memcpy(), memmove(), memset(), memcmp(), memchr(), memrchr(), str[n]cpy(), str[n]cat(), str[n]cmp(), strcoll(), str[n]dup(), strchr(), strrchr(), strstr(), */
                           /* strtok(), strcasestr(), memmem(), mempcpy(), str[n]len(), strerror(), bcopy(), bzero(), strcasecmp(), strsep(), basename(), */
#include <unistd.h>        /* for R_OK, W_OK, X_OK, F_OK, environ, access(), lseek(), close(), read(), write(), pipe(), alarm(), sleep(), ualarm(), usleep(), pause(), chown(), chdir(), getcwd(), */
                           /* for exec[...](), nice(), getpid(), getppid(), setpgid(), setsid(), getsid(), getuid(), geteuid(). getgid(), getegid(), setuid(), seteuid(), setgid(), setegid(), fork(), */
                           /* for link(), symlink(), readlink(), unlink(), rmdir(), getlogin(), setlogin(), gethostname(), sethostname(), daemon(), chroot(), getpass(), [f]sync(), [f]truncate(), syscall(), */
#include <errno.h>         /* for errno constant, error constants, */

#if defined(__WIN32__) || defined(WIN32) || defined(_WIN32)
  #define WIN32_LEAN_AND_MEAN
  #include <fcntl.h>       /* for io.h, O_RDONLY, O_WRONLY, O_RDWR, O_CREAT, O_TRUNC, O_APPEND, */
#else
  #include <fcntl.h>       /* for O_RDONLY, O_WRONLY, O_RDWR, O_CREAT, O_TRUNC, O_APPEND, F_GETFL, F_SETFL, O_NONBLOCK, O_SYNC, FASYNC, O_DIRECT, O_LARGEFILE, O_DIRECTORY, O_NOFOLLOW, O_NOATIME, O_NDELAY, */
                           /* for LOCK_SH, LOCK_EX, LOCK_NB, LOCK_UN, LOCK_MAND, LOCK_READ, LOCK_WRITE, LOCK_RW, fcntl(), open(), creat(), */
#endif



int main(int argc, char **argv) {
	char *self;
	int fprd;
	int result;
	
	self=strrchr(argv[0], '/');
	if (self!=NULL) self++;
	else self=argv[0];
	
	if (argc<2) {
		printf("Usage: %s </path/to/filename>\n", argv[0]);
		return 0;
	}
	
	fprd=open(argv[1], O_RDONLY, 0644);
	if (fprd>=0) {
		printf("%s: fprd=open(argv[1]=%s, O_RDONLY=%d, 0644); fprd=%d if (fprd>=0): Successful opened file '%s'.\n", self, argv[1], O_RDONLY, fprd, argv[1]);
		
		result=lseek(fprd, 0, SEEK_SET);
		if (result>=0) printf("%s: result=lseek(fprd=%d, 0, SEEK_SET=%d); result=%d if (result>=0): Successful lseek(SEEK_SET)\n", self, fprd, SEEK_SET, result);
		else           printf("%s: result=lseek(fprd=%d, 0, SEEK_SET=%d); result=%d if (result>=0): else: Unable to lseek(SEEK_SET), Reason=%d:%s\n", self, fprd, SEEK_SET, result, errno, strerror(errno));
		
		result=lseek(fprd, 12, SEEK_SET);
		if (result>=0) printf("%s: result=lseek(fprd=%d, 12, SEEK_SET=%d); result=%d if (result>=0): Successful lseek(SEEK_SET)\n", self, fprd, SEEK_SET, result);
		else           printf("%s: result=lseek(fprd=%d, 12, SEEK_SET=%d); result=%d if (result>=0): else: Unable to lseek(SEEK_SET), Reason=%d:%s\n", self, fprd, SEEK_SET, result, errno, strerror(errno));
		
		result=lseek(fprd, 8, SEEK_SET);
		if (result>=0) printf("%s: result=lseek(fprd=%d, 8, SEEK_SET=%d); result=%d if (result>=0): Successful lseek(SEEK_SET)\n", self, fprd, SEEK_SET, result);
		else           printf("%s: result=lseek(fprd=%d, 8, SEEK_SET=%d); result=%d if (result>=0): else: Unable to lseek(SEEK_SET), Reason=%d:%s\n", self, fprd, SEEK_SET, result, errno, strerror(errno));
		
		result=lseek(fprd, -4, SEEK_SET);
		if (result>=0) printf("%s: result=lseek(fprd=%d, -4, SEEK_SET=%d); result=%d if (result>=0): Successful lseek(SEEK_SET)\n", self, fprd, SEEK_SET, result);
		else           printf("%s: result=lseek(fprd=%d, -4, SEEK_SET=%d); result=%d if (result>=0): else: Unable to lseek(SEEK_SET), Reason=%d:%s\n", self, fprd, SEEK_SET, result, errno, strerror(errno));
		
		result=lseek(fprd, 10000, SEEK_SET);
		if (result>=0) printf("%s: result=lseek(fprd=%d, 10000, SEEK_SET=%d); result=%d if (result>=0): Successful lseek(SEEK_SET)\n", self, fprd, SEEK_SET, result);
		else           printf("%s: result=lseek(fprd=%d, 10000, SEEK_SET=%d); result=%d if (result>=0): else: Unable to lseek(SEEK_SET), Reason=%d:%s\n", self, fprd, SEEK_SET, result, errno, strerror(errno));
		
		result=lseek(fprd, -20000, SEEK_SET);
		if (result>=0) printf("%s: result=lseek(fprd=%d, -20000, SEEK_SET=%d); result=%d if (result>=0): Successful lseek(SEEK_SET)\n", self, fprd, SEEK_SET, result);
		else           printf("%s: result=lseek(fprd=%d, -20000, SEEK_SET=%d); result=%d if (result>=0): else: Unable to lseek(SEEK_SET), Reason=%d:%s\n", self, fprd, SEEK_SET, result, errno, strerror(errno));
		
		
		
		result=lseek(fprd, 0, SEEK_SET);
		if (result>=0) printf("%s: result=lseek(fprd=%d, 0, SEEK_SET=%d); result=%d if (result>=0): Successful lseek(SEEK_SET)\n", self, fprd, SEEK_SET, result);
		else           printf("%s: result=lseek(fprd=%d, 0, SEEK_SET=%d); result=%d if (result>=0): else: Unable to lseek(SEEK_SET), Reason=%d:%s\n", self, fprd, SEEK_SET, result, errno, strerror(errno));
		
		
		
		result=lseek(fprd, 0, SEEK_CUR);
		if (result>=0) printf("%s: result=lseek(fprd=%d, 0, SEEK_CUR=%d); result=%d if (result>=0): Successful lseek(SEEK_CUR)\n", self, fprd, SEEK_CUR, result);
		else           printf("%s: result=lseek(fprd=%d, 0, SEEK_CUR=%d); result=%d if (result>=0): else: Unable to lseek(SEEK_CUR), Reason=%d:%s\n", self, fprd, SEEK_CUR, result, errno, strerror(errno));
		
		result=lseek(fprd, 12, SEEK_CUR);
		if (result>=0) printf("%s: result=lseek(fprd=%d, 12, SEEK_CUR=%d); result=%d if (result>=0): Successful lseek(SEEK_CUR)\n", self, fprd, SEEK_CUR, result);
		else           printf("%s: result=lseek(fprd=%d, 12, SEEK_CUR=%d); result=%d if (result>=0): else: Unable to lseek(SEEK_CUR), Reason=%d:%s\n", self, fprd, SEEK_CUR, result, errno, strerror(errno));
		
		result=lseek(fprd, 8, SEEK_CUR);
		if (result>=0) printf("%s: result=lseek(fprd=%d, 8, SEEK_CUR=%d); result=%d if (result>=0): Successful lseek(SEEK_CUR)\n", self, fprd, SEEK_CUR, result);
		else           printf("%s: result=lseek(fprd=%d, 8, SEEK_CUR=%d); result=%d if (result>=0): else: Unable to lseek(SEEK_CUR), Reason=%d:%s\n", self, fprd, SEEK_CUR, result, errno, strerror(errno));
		
		result=lseek(fprd, -4, SEEK_CUR);
		if (result>=0) printf("%s: result=lseek(fprd=%d, -4, SEEK_CUR=%d); result=%d if (result>=0): Successful lseek(SEEK_CUR)\n", self, fprd, SEEK_CUR, result);
		else           printf("%s: result=lseek(fprd=%d, -4, SEEK_CUR=%d); result=%d if (result>=0): else: Unable to lseek(SEEK_CUR), Reason=%d:%s\n", self, fprd, SEEK_CUR, result, errno, strerror(errno));
		
		result=lseek(fprd, 10000, SEEK_CUR);
		if (result>=0) printf("%s: result=lseek(fprd=%d, 10000, SEEK_CUR=%d); result=%d if (result>=0): Successful lseek(SEEK_CUR)\n", self, fprd, SEEK_CUR, result);
		else           printf("%s: result=lseek(fprd=%d, 10000, SEEK_CUR=%d); result=%d if (result>=0): else: Unable to lseek(SEEK_CUR), Reason=%d:%s\n", self, fprd, SEEK_CUR, result, errno, strerror(errno));
		
		result=lseek(fprd, -20000, SEEK_CUR);
		if (result>=0) printf("%s: result=lseek(fprd=%d, -20000, SEEK_CUR=%d); result=%d if (result>=0): Successful lseek(SEEK_CUR)\n", self, fprd, SEEK_CUR, result);
		else           printf("%s: result=lseek(fprd=%d, -20000, SEEK_CUR=%d); result=%d if (result>=0): else: Unable to lseek(SEEK_CUR), Reason=%d:%s\n", self, fprd, SEEK_CUR, result, errno, strerror(errno));
		
		
		
		result=lseek(fprd, 0, SEEK_SET);
		if (result>=0) printf("%s: result=lseek(fprd=%d, 0, SEEK_SET=%d); result=%d if (result>=0): Successful lseek(SEEK_SET)\n", self, fprd, SEEK_SET, result);
		else           printf("%s: result=lseek(fprd=%d, 0, SEEK_SET=%d); result=%d if (result>=0): else: Unable to lseek(SEEK_SET), Reason=%d:%s\n", self, fprd, SEEK_SET, result, errno, strerror(errno));
		
		
		
		result=lseek(fprd, 0, SEEK_END);
		if (result>=0) printf("%s: result=lseek(fprd=%d, 0, SEEK_END=%d); result=%d if (result>=0): Successful lseek(SEEK_END)\n", self, fprd, SEEK_END, result);
		else           printf("%s: result=lseek(fprd=%d, 0, SEEK_END=%d); result=%d if (result>=0): else: Unable to lseek(SEEK_END), Reason=%d:%s\n", self, fprd, SEEK_END, result, errno, strerror(errno));
		
		result=lseek(fprd, 12, SEEK_END);
		if (result>=0) printf("%s: result=lseek(fprd=%d, 12, SEEK_END=%d); result=%d if (result>=0): Successful lseek(SEEK_END)\n", self, fprd, SEEK_END, result);
		else           printf("%s: result=lseek(fprd=%d, 12, SEEK_END=%d); result=%d if (result>=0): else: Unable to lseek(SEEK_END), Reason=%d:%s\n", self, fprd, SEEK_END, result, errno, strerror(errno));
		
		result=lseek(fprd, 8, SEEK_END);
		if (result>=0) printf("%s: result=lseek(fprd=%d, 8, SEEK_END=%d); result=%d if (result>=0): Successful lseek(SEEK_END)\n", self, fprd, SEEK_END, result);
		else           printf("%s: result=lseek(fprd=%d, 8, SEEK_END=%d); result=%d if (result>=0): else: Unable to lseek(SEEK_END), Reason=%d:%s\n", self, fprd, SEEK_END, result, errno, strerror(errno));
		
		result=lseek(fprd, -4, SEEK_END);
		if (result>=0) printf("%s: result=lseek(fprd=%d, -4, SEEK_END=%d); result=%d if (result>=0): Successful lseek(SEEK_END)\n", self, fprd, SEEK_END, result);
		else           printf("%s: result=lseek(fprd=%d, -4, SEEK_END=%d); result=%d if (result>=0): else: Unable to lseek(SEEK_END), Reason=%d:%s\n", self, fprd, SEEK_END, result, errno, strerror(errno));
		
		result=lseek(fprd, 10000, SEEK_END);
		if (result>=0) printf("%s: result=lseek(fprd=%d, 10000, SEEK_END=%d); result=%d if (result>=0): Successful lseek(SEEK_END)\n", self, fprd, SEEK_END, result);
		else           printf("%s: result=lseek(fprd=%d, 10000, SEEK_END=%d); result=%d if (result>=0): else: Unable to lseek(SEEK_END), Reason=%d:%s\n", self, fprd, SEEK_END, result, errno, strerror(errno));
		
		result=lseek(fprd, -20000, SEEK_END);
		if (result>=0) printf("%s: result=lseek(fprd=%d, -20000, SEEK_END=%d); result=%d if (result>=0): Successful lseek(SEEK_END)\n", self, fprd, SEEK_END, result);
		else           printf("%s: result=lseek(fprd=%d, -20000, SEEK_END=%d); result=%d if (result>=0): else: Unable to lseek(SEEK_END), Reason=%d:%s\n", self, fprd, SEEK_END, result, errno, strerror(errno));
		
		
		
		close(fprd);
	} else {
		printf("%s: fprd=open(argv[1]=%s, O_RDONLY=%d, 0644); fprd=%d if (fprd>=0): else: Unable to open file '%s', Reason: %d:%s\n", self, argv[1], O_RDONLY, fprd, argv[1], errno, strerror(errno));
	}
	return 0;
}

program należy skompilować komendą make (jako argument należy podać plik Makefile zależny od systemu operacyjnego, domyślnie make próbuje użyć pliku Makefile):
make clean all # system Linux
make -f Makefile clean all # system Linux
make -f Makefile.obsd clean all # system OpenBSD
make -f Makefile.fbsd clean all # system FreeBSD
make -f Makefile.sol clean all # system Solaris
make -f Makefile.beos clean all # system BeOS
make -f Makefile.win clean all # system Windows

a następnie uruchomić bez argumentów:
/home/local/code/ansiccode/sysfile/lseek
program wyświetli informacje o sposobie uruchamiania programu:
Usage: /home/local/code/ansiccode/sysfile/lseek </path/to/filename>

jako argument wywołania programu można podać analogiczne jak poniżej argumenty:
/home/local/code/ansiccode/sysfile/lseek /home/local/code/ansiccode/sysfile/lseek
rezultat będzie zależny od podanych argumentów wywołania programu:
lseek: fprd=open(argv[1]=/home/local/code/ansiccode/sysfile/lseek, O_RDONLY=0, 0644); fprd=3 if (fprd>=0): Successful opened file '/home/local/code/ansiccode/sysfile/lseek'.
lseek: result=lseek(fprd=3, 0, SEEK_SET=0); result=0 if (result>=0): Successful lseek(SEEK_SET)
lseek: result=lseek(fprd=3, 12, SEEK_SET=0); result=12 if (result>=0): Successful lseek(SEEK_SET)
lseek: result=lseek(fprd=3, 8, SEEK_SET=0); result=8 if (result>=0): Successful lseek(SEEK_SET)
lseek: result=lseek(fprd=3, -4, SEEK_SET=0); result=-1 if (result>=0): else: Unable to lseek(SEEK_SET), Reason=22:Invalid argument
lseek: result=lseek(fprd=3, 10000, SEEK_SET=0); result=10000 if (result>=0): Successful lseek(SEEK_SET)
lseek: result=lseek(fprd=3, -20000, SEEK_SET=0); result=-1 if (result>=0): else: Unable to lseek(SEEK_SET), Reason=22:Invalid argument
lseek: result=lseek(fprd=3, 0, SEEK_SET=0); result=0 if (result>=0): Successful lseek(SEEK_SET)
lseek: result=lseek(fprd=3, 0, SEEK_CUR=1); result=0 if (result>=0): Successful lseek(SEEK_CUR)
lseek: result=lseek(fprd=3, 12, SEEK_CUR=1); result=12 if (result>=0): Successful lseek(SEEK_CUR)
lseek: result=lseek(fprd=3, 8, SEEK_CUR=1); result=20 if (result>=0): Successful lseek(SEEK_CUR)
lseek: result=lseek(fprd=3, -4, SEEK_CUR=1); result=16 if (result>=0): Successful lseek(SEEK_CUR)
lseek: result=lseek(fprd=3, 10000, SEEK_CUR=1); result=10016 if (result>=0): Successful lseek(SEEK_CUR)
lseek: result=lseek(fprd=3, -20000, SEEK_CUR=1); result=-1 if (result>=0): else: Unable to lseek(SEEK_CUR), Reason=22:Invalid argument
lseek: result=lseek(fprd=3, 0, SEEK_SET=0); result=0 if (result>=0): Successful lseek(SEEK_SET)
lseek: result=lseek(fprd=3, 0, SEEK_END=2); result=12500 if (result>=0): Successful lseek(SEEK_END)
lseek: result=lseek(fprd=3, 12, SEEK_END=2); result=12512 if (result>=0): Successful lseek(SEEK_END)
lseek: result=lseek(fprd=3, 8, SEEK_END=2); result=12508 if (result>=0): Successful lseek(SEEK_END)
lseek: result=lseek(fprd=3, -4, SEEK_END=2); result=12496 if (result>=0): Successful lseek(SEEK_END)
lseek: result=lseek(fprd=3, 10000, SEEK_END=2); result=22500 if (result>=0): Successful lseek(SEEK_END)
lseek: result=lseek(fprd=3, -20000, SEEK_END=2); result=-1 if (result>=0): else: Unable to lseek(SEEK_END), Reason=22:Invalid argument



#top lstat


Documentacja online: pubs.opengroup.org | www.cplusplus.com | pl.wikibooks.org

Deklaracja funkcji lstat() znajduje się w pliku nagłówkowym unistd.h.
Deklaracja funkcji lstat() jest następująca:
/* Get file attributes about FILE and put them in BUF.
   If FILE is a symbolic link, do not follow it.  */
extern int lstat (__const char *__restrict __file,
          struct stat *__restrict __buf) __THROW __nonnull ((1, 2));

Powiązane:
access(), faccessat(), fstat(), fstatat(), lstat(), stat(), statfs(), statvfs(),

Opis:
Funkcja lstat()

Argumenty:
const char *__restrict __file -
struct stat *__restrict __buf -

Zwracana wartość:
int -

Example:
zawartość pliku lstat.c
SELECT ALL


program należy skompilować komendą make (jako argument należy podać plik Makefile zależny od systemu operacyjnego, domyślnie make próbuje użyć pliku Makefile):
make clean all # system Linux
make -f Makefile clean all # system Linux
make -f Makefile.obsd clean all # system OpenBSD
make -f Makefile.fbsd clean all # system FreeBSD
make -f Makefile.sol clean all # system Solaris
make -f Makefile.beos clean all # system BeOS
make -f Makefile.win clean all # system Windows

a następnie uruchomić bez argumentów:

program wyświetli informacje o sposobie uruchamiania programu:


jako argument wywołania programu można podać analogiczne jak poniżej argumenty:

rezultat będzie zależny od podanych argumentów wywołania programu:




#top lutimes


Documentacja online: pubs.opengroup.org | www.cplusplus.com | pl.wikibooks.org

Deklaracja funkcji lutimes() znajduje się w pliku nagłówkowym sys/time.h.
Deklaracja funkcji lutimes() jest następująca:
/* Same as `utimes', but does not follow symbolic links.  */
extern int lutimes (__const char *__file, __const struct timeval __tvp[2])
     __THROW __nonnull ((1));

Powiązane:
futimes(), lutimes(), utime(), utimensat(), utimes(),

Opis:
Funkcja lutimes()

Argumenty:
const char *__file -
const struct timeval __tvp[2] -

Zwracana wartość:
int -



#top mkdtemp


Documentacja online: pubs.opengroup.org | www.cplusplus.com | pl.wikibooks.org

Deklaracja funkcji mkdtemp() znajduje się w pliku nagłówkowym stdlib.h.
Deklaracja funkcji mkdtemp() jest następująca:
/* Create a unique temporary directory from TEMPLATE.
   The last six characters of TEMPLATE must be "XXXXXX";
   they are replaced with a string that makes the directory name unique.
   Returns TEMPLATE, or a null pointer if it cannot get a unique name.
   The directory is created mode 700.  */
extern char *mkdtemp (char *__template) __THROW __nonnull ((1)) __wur;

Powiązane:
mkdtemp(), mkstemp(), mktemp(), tempnam(), tmpfile(), tmpnam(),

Opis:
Funkcja mkdtemp()

Argumenty:
char *__template -

Zwracana wartość:
char * -

Example:
zawartość pliku mkdtemp.c
SELECT ALL
#define  _GNU_SOURCE  1    /* for environ defined in unistd.h, to avoid warning implicit declaration of function basename, which defined in string.h */
#include <stdio.h>         /* for FILE, va_list, EOF, SEEK_SET, SEEK_CUR, SEEK_END, stdin, stdout, stderr, remove(), rename(), tmpfile(), tmpnam(), tempnam(), fclose(), */
                           /* fflush(), fopen(), freopen(), fprintf(), printf(), snprintf(), scanf(), sscanf(), fgetc(), getc(), getchar(), fputc(), putc(), putchar(), */
                           /* fgets(), gets(), fputs(), puts(), fread(), fwrite(), fseek(), ftell(), rewind(), feof(), ferror(), fileno(), popen(), pclose(), */
#include <stdlib.h>        /* for RAND_MAX, EXIT_FAILURE, EXIT_SUCCESS, MB_CUR_MAX, atoi(), atol(), atoll(), atof(), strtod(), strtof(), strtold(), strtol(), strtoul(), strtoq(), strtouq(), strtoll(), strtoull(), */
                           /* for sys/types.h, malloc.h replaced by stdlib.h, random(), srandom(), rand(), srand(), abort(), atexit(), on_exit(), exit(), getenv(), */
                           /* for putenv(), setenv(), clearenv(), mktemp(), mkdtemp(), system(), realpath(), abs(), llabs(), getloadavg() */
#include <string.h>        /* for memcpy(), memmove(), memset(), memcmp(), memchr(), memrchr(), str[n]cpy(), str[n]cat(), str[n]cmp(), strcoll(), str[n]dup(), strchr(), strrchr(), strstr(), */
                           /* strtok(), strcasestr(), memmem(), mempcpy(), str[n]len(), strerror(), bcopy(), bzero(), strcasecmp(), strsep(), basename(), */

#if defined(__WIN32__) || defined(WIN32) || defined(_WIN32)
  #include <io.h>          /* for mktemp(), */
#else
#endif



int main(int argc, char **argv) {
	char *self;
#if defined(__WIN32__) || defined(WIN32) || defined(_WIN32)
#else
	char *temppath;
#endif
	
	self=strrchr(argv[0], '/');
	if (self!=NULL) self++;
	else self=argv[0];
	
	if (argc<2) {
		printf("Usage:   %s </path/to/destination/prefixXXXXXX>\n", argv[0]);
		printf("Examples:\n");
		printf("         %s /tmp/aaaXXXXXX\n", argv[0]);
		return 0;
	}
	
#if defined(__WIN32__) || defined(WIN32) || defined(_WIN32)
	/* mkdtemp() is not available on this OS platform !!! */
	printf("%s: mkdtemp() is not available on this OS platform !!!\n", self);
#else
	temppath=mkdtemp(argv[1]);
	printf("%s: temppath=mkdtemp(argv[1]=%s): temppath=%s\n", self, argv[1], temppath);
#endif
	
	return 0;
}

program należy skompilować komendą make (jako argument należy podać plik Makefile zależny od systemu operacyjnego, domyślnie make próbuje użyć pliku Makefile):
make clean all # system Linux
make -f Makefile clean all # system Linux
make -f Makefile.obsd clean all # system OpenBSD
make -f Makefile.fbsd clean all # system FreeBSD
make -f Makefile.sol clean all # system Solaris
make -f Makefile.beos clean all # system BeOS
make -f Makefile.win clean all # system Windows

a następnie uruchomić bez argumentów:
/home/local/code/ansiccode/sysfile/mkdtemp
program wyświetli informacje o sposobie uruchamiania programu:
Usage:   /home/local/code/ansiccode/sysfile/mkdtemp </path/to/destination/prefixXXXXXX>
Examples:
         /home/local/code/ansiccode/sysfile/mkdtemp /tmp/aaaXXXXXX

jako argument wywołania programu można podać analogiczne jak poniżej argumenty:
/home/local/code/ansiccode/sysfile/mkdtemp /tmp/aaaXXXXXX
rezultat będzie zależny od podanych argumentów wywołania programu:
mkdtemp: temppath=mkdtemp(argv[1]=/tmp/aaaOpw1R3): temppath=/tmp/aaaOpw1R3
oraz zostanie utworzony katalog ls -ld /tmp/aaaOpw1R3:
drwx------ 2 user users 4096 Oct 31 00:17 /tmp/aaaOpw1R3/



#top mkfifo


Documentacja online: pubs.opengroup.org | www.cplusplus.com | pl.wikibooks.org

Deklaracja funkcji mkfifo() znajduje się w pliku nagłówkowym stdlib.h.
Deklaracja funkcji mkfifo() jest następująca:
/* Create a new FIFO named PATH, with permission bits MODE.  */
extern int mkfifo (__const char *__path, __mode_t __mode)
     __THROW __nonnull ((1));

Powiązane:
mkfifo(), mkfifoat(), mknod(), mknodat(),

Opis:
Funkcja mkfifo()
/* Create a new FIFO named PATH, with permission bits MODE. */

Argumenty:
__const char *__path -
__mode_t __mode -

Zwracana wartość:
/* Create a new FIFO named PATH, with permission bits MODE. */
int -

Example:
zawartość pliku mkfifo.c
SELECT ALL


program należy skompilować komendą make (jako argument należy podać plik Makefile zależny od systemu operacyjnego, domyślnie make próbuje użyć pliku Makefile):
make clean all # system Linux
make -f Makefile clean all # system Linux
make -f Makefile.obsd clean all # system OpenBSD
make -f Makefile.fbsd clean all # system FreeBSD
make -f Makefile.sol clean all # system Solaris
make -f Makefile.beos clean all # system BeOS
make -f Makefile.win clean all # system Windows

a następnie uruchomić bez argumentów:

program wyświetli informacje o sposobie uruchamiania programu:


jako argument wywołania programu można podać analogiczne jak poniżej argumenty:

rezultat będzie zależny od podanych argumentów wywołania programu:




#top mkfifoat


Documentacja online: pubs.opengroup.org | www.cplusplus.com | pl.wikibooks.org

Deklaracja funkcji mkfifoat() znajduje się w pliku nagłówkowym sys/stat.h.
Deklaracja funkcji mkfifoat() jest następująca:
#ifdef __USE_ATFILE
/* Like mkfifo, create a new FIFO with permission bits MODE.  But
   interpret relative PATH names relative to the directory associated
   with FD.  */
extern int mkfifoat (int __fd, __const char *__path, __mode_t __mode)
     __THROW __nonnull ((2));
#endif

Powiązane:
mkfifo(), mkfifoat(), mknod(), mknodat(),

Opis:
Funkcja mkfifoat()
/* Create a new FIFO named PATH, with permission bits MODE. */

Argumenty:
int __fd -
__const char *__path -
__mode_t __mode -

Zwracana wartość:
int -



#top mknod


Documentacja online: pubs.opengroup.org | www.cplusplus.com | pl.wikibooks.org

Deklaracja funkcji mknod() znajduje się w pliku nagłówkowym sys/stat.h.
Deklaracja funkcji mknod() jest następująca:
/* Create a device file named PATH, with permission and special bits MODE
   and device number DEV (which can be constructed from major and minor
   device numbers with the `makedev' macro above).  */
#if defined __USE_MISC || defined __USE_BSD || defined __USE_XOPEN_EXTENDED
extern int mknod (__const char *__path, __mode_t __mode, __dev_t __dev)
     __THROW __nonnull ((1));
#endif

Powiązane:
mkfifo(), mkfifoat(), mknod(), mknodat(),

Opis:
Funkcja mknod()

Argumenty:
const char *__path -
__mode_t __mode -
__dev_t __dev -

Zwracana wartość:
int -

Example:
zawartość pliku mknod.c
SELECT ALL
#define  _GNU_SOURCE  1    /* for environ defined in unistd.h, to avoid warning implicit declaration of function basename, which defined in string.h */
#include <stdio.h>         /* for FILE, va_list, EOF, SEEK_SET, SEEK_CUR, SEEK_END, stdin, stdout, stderr, remove(), rename(), tmpfile(), tmpnam(), tempnam(), fclose(), */
                           /* fflush(), fopen(), freopen(), fprintf(), printf(), snprintf(), scanf(), sscanf(), fgetc(), getc(), getchar(), fputc(), putc(), putchar(), */
                           /* fgets(), gets(), fputs(), puts(), fread(), fwrite(), fseek(), ftell(), rewind(), feof(), ferror(), fileno(), popen(), pclose(), */
#include <stdlib.h>        /* for RAND_MAX, EXIT_FAILURE, EXIT_SUCCESS, MB_CUR_MAX, atoi(), atol(), atoll(), atof(), strtod(), strtof(), strtold(), strtol(), strtoul(), strtoq(), strtouq(), strtoll(), strtoull(), */
                           /* for sys/types.h, malloc.h replaced by stdlib.h, random(), srandom(), rand(), srand(), abort(), atexit(), on_exit(), exit(), getenv(), */
                           /* for putenv(), setenv(), clearenv(), mktemp(), mkdtemp(), system(), realpath(), abs(), llabs(), getloadavg() */
#include <string.h>        /* for memcpy(), memmove(), memset(), memcmp(), memchr(), memrchr(), str[n]cpy(), str[n]cat(), str[n]cmp(), strcoll(), str[n]dup(), strchr(), strrchr(), strstr(), */
                           /* strtok(), strcasestr(), memmem(), mempcpy(), str[n]len(), strerror(), bcopy(), bzero(), strcasecmp(), strsep(), basename(), */
#include <errno.h>         /* for errno constant, error constants, */

#if defined(__WIN32__) || defined(WIN32) || defined(_WIN32)
  #define WIN32_LEAN_AND_MEAN
  #include <sys/stat.h>    /* for _dev_t, _gid_t, _ino_t, _mode_t, _off_t, stat(), */
#else
  #include <sys/stat.h>    /* for dev_t, gid_t, ino_t, mode_t, off_t, uid_t, blkcnt_t, blksize_t, struct stat, stat(), fstat(), lstat(), chmod(), lchmod(), umask(), getumask(), mkdir(), mknod(), mkfifo(), */
#endif



int main(int argc, char **argv) {
	char *self;
#if defined(__WIN32__) || defined(WIN32) || defined(_WIN32)
#else
	mode_t operm;
	dev_t dev;
	int result;
#endif
	
	self=strrchr(argv[0], '/');
	if (self!=NULL) self++;
	else self=argv[0];
	
	if (argc<4) {
		printf("Usage:   %s </path/to/device> <mode> <dev>\n", argv[0]);
		printf("Note:\n");
		printf("         %s S_IFIFO =%06o\n", argv[0], S_IFIFO);
		printf("         %s S_IFCHR =%06o\n", argv[0], S_IFCHR);
		printf("         %s S_IFBLK =%06o\n", argv[0], S_IFBLK);
		printf("         %s S_IFSOCK=%06o\n", argv[0], S_IFSOCK);
		printf("Examples:\n");
		printf("         %s fifo-dev-initctl 010666 0\n", argv[0]);
		printf("         %s char-dev-null    020666 259\n", argv[0]);
		printf("         %s blk-dev-loop     060666 1792\n", argv[0]);
		printf("         %s sock-dev-log     140666 0\n", argv[0]);
		return 0;
	}
	
	if (strlen(argv[2])!=6) {
		printf("%s: Bad format mode='%s', mode should be in format XXXXXX, i.e. 000666, 010666, 020000, 060000, 140666,\n", argv[0], argv[2]);
		return 0;
	}
	
	operm=0;
	
	operm=(argv[2][0]-0x30)*8*8*8*8*8;
	operm=(argv[2][1]-0x30)*8*8*8*8;
	operm=(argv[2][2]-0x30)*8*8*8;
	operm=(argv[2][3]-0x30)*8*8;
	operm=(argv[2][4]-0x30)*8;
	operm=(argv[2][5]-0x30)*1;
	
	operm=(argv[2][0]-0x30)*8*8*8*8*8 + (argv[2][1]-0x30)*8*8*8*8 + (argv[2][2]-0x30)*8*8*8 + (argv[2][3]-0x30)*8*8 + (argv[2][4]-0x30)*8 + (argv[2][5]-0x30)*1;
	
	dev =atoi(argv[3]);
#if defined(__WIN32__) || defined(WIN32) || defined(_WIN32)
	/* mknod() is not available on this OS platform !!! */
	printf("%s: mknod() is not available on this OS platform !!!\n", self);
#else
	printf("%s: result=mknod(argv[1]=%s, operm=%o, dev=(%u,%u)):\n", self, argv[1], operm, (unsigned int)dev>>8&0xFF, (unsigned int)dev>>0&0xFF);
	result=mknod(argv[1], operm, dev);
	
	if (result>=0) printf("%s: result=mknod(argv[1]=%s, operm=%o, dev=(%u,%u)): result=%d, Successful created file node.\n", self, argv[1], operm, (unsigned int)dev>>8&0xFF, (unsigned int)dev>>0&0xFF, result);
	else           printf("%s: result=mknod(argv[1]=%s, operm=%o, dev=(%u,%u)): result=%d, Unable to create file node, Reason: %d:%s\n", self, argv[1], operm, (unsigned int)dev>>8&0xFF, (unsigned int)dev>>0&0xFF, result, errno, strerror(errno));
#endif
	
	return 0;
}

program należy skompilować komendą make (jako argument należy podać plik Makefile zależny od systemu operacyjnego, domyślnie make próbuje użyć pliku Makefile):
make clean all # system Linux
make -f Makefile clean all # system Linux
make -f Makefile.obsd clean all # system OpenBSD
make -f Makefile.fbsd clean all # system FreeBSD
make -f Makefile.sol clean all # system Solaris
make -f Makefile.beos clean all # system BeOS
make -f Makefile.win clean all # system Windows

a następnie uruchomić bez argumentów:
/home/local/code/ansiccode/sysfile/mknod
program wyświetli informacje o sposobie uruchamiania programu:
Usage:   /home/local/code/ansiccode/sysfile/mknod </path/to/device> <mode> <dev>
Note:
         /home/local/code/ansiccode/sysfile/mknod S_IFIFO =010000
         /home/local/code/ansiccode/sysfile/mknod S_IFCHR =020000
         /home/local/code/ansiccode/sysfile/mknod S_IFBLK =060000
         /home/local/code/ansiccode/sysfile/mknod S_IFSOCK=140000
Examples:
         /home/local/code/ansiccode/sysfile/mknod fifo-dev-initctl 010666 0
         /home/local/code/ansiccode/sysfile/mknod char-dev-null    020666 259
         /home/local/code/ansiccode/sysfile/mknod blk-dev-loop     060666 1792
         /home/local/code/ansiccode/sysfile/mknod sock-dev-log     140666 0

jako argument wywołania programu można podać analogiczne jak poniżej argumenty:
Usage:   /home/local/code/ansiccode/sysfile/mknod </path/to/device> <mode> <dev>
/home/local/code/ansiccode/sysfile/mknod fifo-dev-initctl 010666 0
/home/local/code/ansiccode/sysfile/mknod char-dev-null    020666 259
/home/local/code/ansiccode/sysfile/mknod blk-dev-loop     060666 1792
/home/local/code/ansiccode/sysfile/mknod sock-dev-log     140666 0
rezultat będzie zależny od podanych argumentów wywołania programu:
mknod: result=mknod(argv[1]=fifo-dev-initctl, operm=10666, dev=(0,0)):
mknod: result=mknod(argv[1]=fifo-dev-initctl, operm=10666, dev=(0,0)): result=0, Successful created file node.

mknod: result=mknod(argv[1]=char-dev-null, operm=20666, dev=(1,3)):
mknod: result=mknod(argv[1]=char-dev-null, operm=20666, dev=(1,3)): result=-1, Unable to create file node, Reason: 1:Operation not permitted

mknod: result=mknod(argv[1]=blk-dev-loop, operm=60666, dev=(7,0)):
mknod: result=mknod(argv[1]=blk-dev-loop, operm=60666, dev=(7,0)): result=-1, Unable to create file node, Reason: 1:Operation not permitted

mknod: result=mknod(argv[1]=sock-dev-log, operm=140666, dev=(0,0)):
mknod: result=mknod(argv[1]=sock-dev-log, operm=140666, dev=(0,0)): result=0, Successful created file node.
Jak widać na powyższym rezultacie wywołania funkcji mknod() tworzenie urządzeń znakowych (c - char) lub blokowych (b - block) wymaga uprawnień.



#top mknodat


Documentacja online: pubs.opengroup.org | www.cplusplus.com | pl.wikibooks.org

Deklaracja funkcji mknodat() znajduje się w pliku nagłówkowym sys/stat.h.
Deklaracja funkcji mknodat() jest następująca:
#ifdef __USE_ATFILE
/* Like mknod, create a new device file with permission bits MODE and
   device number DEV.  But interpret relative PATH names relative to
   the directory associated with FD.  */
extern int mknodat (int __fd, __const char *__path, __mode_t __mode,
            __dev_t __dev) __THROW __nonnull ((2));
#endif

Powiązane:
mkfifo(), mkfifoat(), mknod(), mknodat(),

Opis:
Funkcja mknodat()

Argumenty:
int __fd -
const char *__path -
__mode_t __mode -
__dev_t __dev -

Zwracana wartość:
int -



#top mkstemp


Documentacja online: pubs.opengroup.org | www.cplusplus.com | pl.wikibooks.org

Deklaracja funkcji mkstemp() znajduje się w pliku nagłówkowym stdlib.h.
Deklaracja funkcji mkstemp() jest następująca:
/* Generate a unique temporary file name from TEMPLATE.
   The last six characters of TEMPLATE must be "XXXXXX";
   they are replaced with a string that makes the filename unique.
   Returns a file descriptor open on the file for reading and writing,
   or -1 if it cannot create a uniquely-named file.

   This function is a possible cancellation points and therefore not
   marked with __THROW.  */
extern int mkstemp (char *__template) __nonnull ((1)) __wur;

Powiązane:
mkdtemp(), mkstemp(), mktemp(), tempnam(), tmpfile(), tmpnam(),

Opis:
Funkcja mkstemp()

Argumenty:
char *__template -

Zwracana wartość:
int -

Example:
zawartość pliku mkstemp.c
SELECT ALL
#define  _GNU_SOURCE  1    /* for environ defined in unistd.h, to avoid warning implicit declaration of function basename, which defined in string.h */
#include <stdio.h>         /* for FILE, va_list, EOF, SEEK_SET, SEEK_CUR, SEEK_END, stdin, stdout, stderr, remove(), rename(), tmpfile(), tmpnam(), tempnam(), fclose(), */
                           /* fflush(), fopen(), freopen(), fprintf(), printf(), snprintf(), scanf(), sscanf(), fgetc(), getc(), getchar(), fputc(), putc(), putchar(), */
                           /* fgets(), gets(), fputs(), puts(), fread(), fwrite(), fseek(), ftell(), rewind(), feof(), ferror(), fileno(), popen(), pclose(), */
#include <stdlib.h>        /* for RAND_MAX, EXIT_FAILURE, EXIT_SUCCESS, MB_CUR_MAX, atoi(), atol(), atoll(), atof(), strtod(), strtof(), strtold(), strtol(), strtoul(), strtoq(), strtouq(), strtoll(), strtoull(), */
                           /* for sys/types.h, malloc.h replaced by stdlib.h, random(), srandom(), rand(), srand(), abort(), atexit(), on_exit(), exit(), getenv(), */
                           /* for putenv(), setenv(), clearenv(), mktemp(), mkdtemp(), system(), realpath(), abs(), llabs(), getloadavg() */
#include <string.h>        /* for memcpy(), memmove(), memset(), memcmp(), memchr(), memrchr(), str[n]cpy(), str[n]cat(), str[n]cmp(), strcoll(), str[n]dup(), strchr(), strrchr(), strstr(), */
                           /* strtok(), strcasestr(), memmem(), mempcpy(), str[n]len(), strerror(), bcopy(), bzero(), strcasecmp(), strsep(), basename(), */
#include <unistd.h>        /* for R_OK, W_OK, X_OK, F_OK, environ, access(), lseek(), close(), read(), write(), pipe(), alarm(), sleep(), ualarm(), usleep(), pause(), chown(), chdir(), getcwd(), */
                           /* for exec[...](), nice(), getpid(), getppid(), setpgid(), setsid(), getsid(), getuid(), geteuid(). getgid(), getegid(), setuid(), seteuid(), setgid(), setegid(), fork(), */
                           /* for link(), symlink(), readlink(), unlink(), rmdir(), getlogin(), setlogin(), gethostname(), sethostname(), daemon(), chroot(), getpass(), [f]sync(), [f]truncate(), syscall(), */
#include <errno.h>         /* for errno constant, error constants, */



int main(int argc, char **argv) {
	char *self;
#if defined(__WIN32__) || defined(WIN32) || defined(_WIN32)
#else
	int fpfd;
#endif
	
	self=strrchr(argv[0], '/');
	if (self!=NULL) self++;
	else self=argv[0];
	
	if (argc<2) {
		printf("Usage:   %s </path/to/destination/prefixXXXXXX>\n", argv[0]);
		printf("Examples:\n");
		printf("         %s /tmp/aaaXXXXXX\n", argv[0]);
		return 0;
	}
	
#if defined(__WIN32__) || defined(WIN32) || defined(_WIN32)
	/* mkstemp() is not available on this OS platform !!! */
	printf("%s: mkstemp() is not available on this OS platform !!!\n", self);
#else
	fpfd=mkstemp(argv[1]);
	if (fpfd>=0) printf("%s: result=mkstemp(argv[1]=%s): fpfd=%d if (fpfd>=0): Successful mkstemp().\n", self, argv[1], fpfd);
	else         printf("%s: result=mkstemp(argv[1]=%s): fpfd=%d if (fpfd>=0): else: Unable to mkstemp(), Reason: %d:%s\n", self, argv[1], fpfd, errno, strerror(errno));
	close(fpfd);
#endif
	
	return 0;
}

program należy skompilować komendą make (jako argument należy podać plik Makefile zależny od systemu operacyjnego, domyślnie make próbuje użyć pliku Makefile):
make clean all # system Linux
make -f Makefile clean all # system Linux
make -f Makefile.obsd clean all # system OpenBSD
make -f Makefile.fbsd clean all # system FreeBSD
make -f Makefile.sol clean all # system Solaris
make -f Makefile.beos clean all # system BeOS
make -f Makefile.win clean all # system Windows

a następnie uruchomić bez argumentów:
/home/local/code/ansiccode/sysfile/mkstemp
program wyświetli informacje o sposobie uruchamiania programu:
Usage:   /home/local/code/ansiccode/sysfile/mkstemp </path/to/destination/prefixXXXXXX>
Examples:
         /home/local/code/ansiccode/sysfile/mkstemp /tmp/aaaXXXXXX

jako argument wywołania programu można podać analogiczne jak poniżej argumenty:
/home/local/code/ansiccode/sysfile/mkstemp /tmp/aaaXXXXXX
rezultat będzie zależny od podanych argumentów wywołania programu:
mkstemp: result=mkstemp(argv[1]=/tmp/aaa8Lpaip): fpfd=3 if (fpfd>=0): Successful mkstemp().
oraz zostanie utworzony pusty plik ls -l /tmp/aaa8Lpaip:
-rw------- 1 user users 0 Oct 31 00:18 /tmp/aaa8Lpaip



#top mktemp


Documentacja online: pubs.opengroup.org | www.cplusplus.com | pl.wikibooks.org

Deklaracja funkcji mktemp() znajduje się w pliku nagłówkowym stdlib.h.
Deklaracja funkcji mktemp() jest następująca:
/* Generate a unique temporary file name from TEMPLATE.
   The last six characters of TEMPLATE must be "XXXXXX";
   they are replaced with a string that makes the file name unique.
   Returns TEMPLATE, or a null pointer if it cannot get a unique file name.  */
extern char *mktemp (char *__template) __THROW __nonnull ((1)) __wur;

Powiązane:
mkdtemp(), mkstemp(), mktemp(), tempnam(), tmpfile(), tmpnam(),

Opis:
Funkcja mktemp()

Argumenty:
char *__template -

Zwracana wartość:
char * -

Example:
zawartość pliku mktemp.c
SELECT ALL
#define  _GNU_SOURCE  1    /* for environ defined in unistd.h, to avoid warning implicit declaration of function basename, which defined in string.h */
#include <stdio.h>         /* for FILE, va_list, EOF, SEEK_SET, SEEK_CUR, SEEK_END, stdin, stdout, stderr, remove(), rename(), tmpfile(), tmpnam(), tempnam(), fclose(), */
                           /* fflush(), fopen(), freopen(), fprintf(), printf(), snprintf(), scanf(), sscanf(), fgetc(), getc(), getchar(), fputc(), putc(), putchar(), */
                           /* fgets(), gets(), fputs(), puts(), fread(), fwrite(), fseek(), ftell(), rewind(), feof(), ferror(), fileno(), popen(), pclose(), */
#include <stdlib.h>        /* for RAND_MAX, EXIT_FAILURE, EXIT_SUCCESS, MB_CUR_MAX, atoi(), atol(), atoll(), atof(), strtod(), strtof(), strtold(), strtol(), strtoul(), strtoq(), strtouq(), strtoll(), strtoull(), */
                           /* for sys/types.h, malloc.h replaced by stdlib.h, random(), srandom(), rand(), srand(), abort(), atexit(), on_exit(), exit(), getenv(), */
                           /* for putenv(), setenv(), clearenv(), mktemp(), mkdtemp(), system(), realpath(), abs(), llabs(), getloadavg() */
#include <string.h>        /* for memcpy(), memmove(), memset(), memcmp(), memchr(), memrchr(), str[n]cpy(), str[n]cat(), str[n]cmp(), strcoll(), str[n]dup(), strchr(), strrchr(), strstr(), */
                           /* strtok(), strcasestr(), memmem(), mempcpy(), str[n]len(), strerror(), bcopy(), bzero(), strcasecmp(), strsep(), basename(), */

#if defined(__WIN32__) || defined(WIN32) || defined(_WIN32)
  #include <io.h>          /* for mktemp(), */
#else
#endif



int main(int argc, char **argv) {
	char *self;
	char *temppath;
	
	self=strrchr(argv[0], '/');
	if (self!=NULL) self++;
	else self=argv[0];
	
	if (argc<2) {
		printf("Usage:   %s </path/to/destination/prefixXXXXXX>\n", argv[0]);
		printf("Examples:\n");
		printf("         %s /tmp/aaaXXXXXX\n", argv[0]);
		return 0;
	}
	
	temppath=mktemp(argv[1]);
	printf("%s: temppath=mktemp(argv[1]=%s): temppath=%s\n", self, argv[1], temppath);
	
	return 0;
}

program należy skompilować komendą make (jako argument należy podać plik Makefile zależny od systemu operacyjnego, domyślnie make próbuje użyć pliku Makefile):
make clean all # system Linux
make -f Makefile clean all # system Linux
make -f Makefile.obsd clean all # system OpenBSD
make -f Makefile.fbsd clean all # system FreeBSD
make -f Makefile.sol clean all # system Solaris
make -f Makefile.beos clean all # system BeOS
make -f Makefile.win clean all # system Windows

a następnie uruchomić bez argumentów:
/home/local/code/ansiccode/sysfile/mktemp
program wyświetli informacje o sposobie uruchamiania programu:
Usage:   /home/local/code/ansiccode/sysfile/mktemp </path/to/destination/prefixXXXXXX>
Examples:
         /home/local/code/ansiccode/sysfile/mktemp /tmp/aaaXXXXXX

jako argument wywołania programu można podać analogiczne jak poniżej argumenty:
/home/local/code/ansiccode/sysfile/mktemp /tmp/aaaXXXXXX
rezultat będzie zależny od podanych argumentów wywołania programu:
mktemp: temppath=mktemp(argv[1]=/tmp/aaayhqL2j): temppath=/tmp/aaayhqL2j



#top open


Documentacja online: pubs.opengroup.org | www.cplusplus.com | pl.wikibooks.org

Deklaracja funkcji open() znajduje się w pliku nagłówkowym fcntl.h.
Deklaracja funkcji open() jest następująca:
/* Open FILE and return a new file descriptor for it, or -1 on error.
   OFLAG determines the type of access used.  If O_CREAT is on OFLAG,
   the third argument is taken as a `mode_t', the mode of the created file.

   This function is a cancellation point and therefore not marked with
   __THROW.  */
#ifndef __USE_FILE_OFFSET64
extern int open (__const char *__file, int __oflag, ...) __nonnull ((1));
#else
# ifdef __REDIRECT
extern int __REDIRECT (open, (__const char *__file, int __oflag, ...), open64)
     __nonnull ((1));
# else
#  define open open64
# endif
#endif

Powiązane:
close(), fclose(), fopen(), freopen(), open(), openat(),

Opis:
Funkcja open()

Argumenty:
const char *__file -
int __oflag - for __oflag following values are defined:
... -

Zwracana wartość:
int -

Example:
zawartość pliku open.c
SELECT ALL
#define  _GNU_SOURCE  1    /* for environ defined in unistd.h, to avoid warning implicit declaration of function basename, which defined in string.h */
#include <stdio.h>         /* for FILE, va_list, EOF, SEEK_SET, SEEK_CUR, SEEK_END, stdin, stdout, stderr, remove(), rename(), tmpfile(), tmpnam(), tempnam(), fclose(), */
                           /* fflush(), fopen(), freopen(), fprintf(), printf(), snprintf(), scanf(), sscanf(), fgetc(), getc(), getchar(), fputc(), putc(), putchar(), */
                           /* fgets(), gets(), fputs(), puts(), fread(), fwrite(), fseek(), ftell(), rewind(), feof(), ferror(), fileno(), popen(), pclose(), */
#include <string.h>        /* for memcpy(), memmove(), memset(), memcmp(), memchr(), memrchr(), str[n]cpy(), str[n]cat(), str[n]cmp(), strcoll(), str[n]dup(), strchr(), strrchr(), strstr(), */
                           /* strtok(), strcasestr(), memmem(), mempcpy(), str[n]len(), strerror(), bcopy(), bzero(), strcasecmp(), strsep(), basename(), */
#include <unistd.h>        /* for R_OK, W_OK, X_OK, F_OK, environ, access(), lseek(), close(), read(), write(), pipe(), alarm(), sleep(), ualarm(), usleep(), pause(), chown(), chdir(), getcwd(), */
                           /* for exec[...](), nice(), getpid(), getppid(), setpgid(), setsid(), getsid(), getuid(), geteuid(). getgid(), getegid(), setuid(), seteuid(), setgid(), setegid(), fork(), */
                           /* for link(), symlink(), readlink(), unlink(), rmdir(), getlogin(), setlogin(), gethostname(), sethostname(), daemon(), chroot(), getpass(), fsync(), sync(), [f]truncate(), syscall(), */
#include <errno.h>         /* for errno variable, error constants, */

#if defined(__WIN32__) || defined(WIN32) || defined(_WIN32)
  #define WIN32_LEAN_AND_MEAN
  #include <fcntl.h>       /* for io.h, O_RDONLY, O_WRONLY, O_RDWR, O_CREAT, O_TRUNC, O_APPEND, */
#else
  #include <fcntl.h>       /* for O_RDONLY, O_WRONLY, O_RDWR, O_CREAT, O_TRUNC, O_APPEND, F_GETFL, F_SETFL, O_NONBLOCK, O_SYNC, FASYNC, O_DIRECT, O_LARGEFILE, O_DIRECTORY, O_NOFOLLOW, O_NOATIME, O_NDELAY, */
                           /* for LOCK_SH, LOCK_EX, LOCK_NB, LOCK_UN, LOCK_MAND, LOCK_READ, LOCK_WRITE, LOCK_RW, fcntl(), open(), creat(), */
#endif



int main(int argc, char **argv) {
	char *self;
	int fprd;
	int result;
	
	self=strrchr(argv[0], '/');
	if (self!=NULL) self++;
	else self=argv[0];
	
	if (argc<2) {
		printf("Usage: %s </path/to/filename>\n", argv[0]);
		return 0;
	}
	
	fprd=open(argv[1], O_RDONLY, 0644);
	if (fprd>=0) {
		printf("%s: fprd=open(argv[1]=%s, O_RDONLY=%d, 0644); fprd=%d if (fprd>=0): Successful open() file.\n", self, argv[1], O_RDONLY, fprd);
		
		result=close(fprd);
		if (result>=0) printf("%s: result=close(fprd=%d); result=%d if (result>=0): Successful close() file.\n", self, fprd, result);
		else           printf("%s: result=close(fprd=%d); result=%d if (result>=0): else: Unable to close() file, Reason=%d:%s\n", self, fprd, result, errno, strerror(errno));
	} else {
		printf("%s: fprd=open(argv[1]=%s, O_RDONLY=%d, 0644); fprd=%d if (fprd>=0): else: Unable to open() file, Reason: %d:%s\n", self, argv[1], O_RDONLY, fprd, errno, strerror(errno));
	}
	return 0;
}

program należy skompilować komendą make (jako argument należy podać plik Makefile zależny od systemu operacyjnego, domyślnie make próbuje użyć pliku Makefile):
make clean all # system Linux
make -f Makefile clean all # system Linux
make -f Makefile.obsd clean all # system OpenBSD
make -f Makefile.fbsd clean all # system FreeBSD
make -f Makefile.sol clean all # system Solaris
make -f Makefile.beos clean all # system BeOS
make -f Makefile.win clean all # system Windows

a następnie uruchomić bez argumentów:
/home/local/code/ansiccode/sysfile/open
program wyświetli informacje o sposobie uruchamiania programu:


jako argument wywołania programu można podać analogiczne jak poniżej argumenty:
/home/local/code/ansiccode/sysfile/open /home/local/code/ansiccode/sysfile/open.c
rezultat będzie zależny od podanych argumentów wywołania programu:
open: fprd=open(argv[1]=/home/local/code/ansiccode/sysfile/open.c, O_RDONLY=0, 0644); fprd=3 if (fprd>=0): Successful open() file.
open: result=close(fprd=3); result=0 if (result>=0): Successful close() file.



#top openat


Documentacja online: pubs.opengroup.org | www.cplusplus.com | pl.wikibooks.org

Deklaracja funkcji openat() znajduje się w pliku nagłówkowym fcntl.h.
Deklaracja funkcji openat() jest następująca:
#ifdef __USE_ATFILE
/* Similar to `open' but a relative path name is interpreted relative to
   the directory for which FD is a descriptor.

   NOTE: some other `openat' implementation support additional functionality
   through this interface, especially using the O_XATTR flag.  This is not
   yet supported here.

   This function is a cancellation point and therefore not marked with
   __THROW.  */
# ifndef __USE_FILE_OFFSET64
extern int openat (int __fd, __const char *__file, int __oflag, ...)
     __nonnull ((2));
# else
#  ifdef __REDIRECT
extern int __REDIRECT (openat, (int __fd, __const char *__file, int __oflag,
                ...), openat64) __nonnull ((2));
#  else
#   define openat openat64
#  endif
# endif

Powiązane:
close(), fclose(), fopen(), freopen(), open(), openat(),

Opis:
Funkcja open()

Argumenty:
const char *__file -
int __oflag -
... -

Zwracana wartość:
int -



#top open_memstream


Documentacja online: pubs.opengroup.org | www.cplusplus.com | pl.wikibooks.org

Deklaracja funkcji open_memstream() znajduje się w pliku nagłówkowym unistd.h.
Deklaracja funkcji open_memstream() jest następująca:
/* Open a stream that writes into a malloc'd buffer that is expanded as
   necessary.  *BUFLOC and *SIZELOC are updated with the buffer's location
   and the number of characters written on fflush or fclose.  */
extern FILE *open_memstream (char **__bufloc, size_t *__sizeloc) __THROW;

Powiązane:

Opis:
Funkcja open_memstream()

Argumenty:
char **__bufloc -
size_t *__sizeloc -

Zwracana wartość:
FILE * -

Example:
zawartość pliku open_memstream.c
SELECT ALL


program należy skompilować komendą make (jako argument należy podać plik Makefile zależny od systemu operacyjnego, domyślnie make próbuje użyć pliku Makefile):
make clean all # system Linux
make -f Makefile clean all # system Linux
make -f Makefile.obsd clean all # system OpenBSD
make -f Makefile.fbsd clean all # system FreeBSD
make -f Makefile.sol clean all # system Solaris
make -f Makefile.beos clean all # system BeOS
make -f Makefile.win clean all # system Windows

a następnie uruchomić bez argumentów:

program wyświetli informacje o sposobie uruchamiania programu:


jako argument wywołania programu można podać analogiczne jak poniżej argumenty:

rezultat będzie zależny od podanych argumentów wywołania programu:




#top pread


Documentacja online: pubs.opengroup.org | www.cplusplus.com | pl.wikibooks.org

Deklaracja funkcji pread() znajduje się w pliku nagłówkowym unistd.h.
Deklaracja funkcji pread() jest następująca:
/* Read NBYTES into BUF from FD at the given position OFFSET without
   changing the file pointer.  Return the number read, -1 for errors
   or 0 for EOF.

   This function is a cancellation point and therefore not marked with
   __THROW.  */
extern ssize_t pread (int __fd, void *__buf, size_t __nbytes,
              __off_t __offset) __wur;

Powiązane:
fread(), fwrite(), pread(), pwrite(), read(), write(),

Opis:
Funkcja pread()

Argumenty:
int __fd -
void *__buf -
size_t __nbytes -
__off_t __offset -

Zwracana wartość:
ssize_t -

Example:
zawartość pliku pread.c
SELECT ALL


program należy skompilować komendą make (jako argument należy podać plik Makefile zależny od systemu operacyjnego, domyślnie make próbuje użyć pliku Makefile):
make clean all # system Linux
make -f Makefile clean all # system Linux
make -f Makefile.obsd clean all # system OpenBSD
make -f Makefile.fbsd clean all # system FreeBSD
make -f Makefile.sol clean all # system Solaris
make -f Makefile.beos clean all # system BeOS
make -f Makefile.win clean all # system Windows

a następnie uruchomić bez argumentów:

program wyświetli informacje o sposobie uruchamiania programu:


jako argument wywołania programu można podać analogiczne jak poniżej argumenty:

rezultat będzie zależny od podanych argumentów wywołania programu:




#top putc


Documentacja online: pubs.opengroup.org | www.cplusplus.com | pl.wikibooks.org

Deklaracja funkcji putc() znajduje się w pliku nagłówkowym stdio.h.
Deklaracja funkcji putc() jest następująca:
/* Write a character to STREAM.

   These functions are possible cancellation points and therefore not
   marked with __THROW.

   These functions is a possible cancellation point and therefore not
   marked with __THROW.  */
extern int putc (int __c, FILE *__stream);

Powiązane:
getc(), getw(), putc(), putw(), ungetc(),

Opis:
Funkcja putc()

Argumenty:
int __c -
FILE *__stream -

Zwracana wartość:
int -

Example:
zawartość pliku putc.c
SELECT ALL
#define  _GNU_SOURCE  1    /* for environ defined in unistd.h, to avoid warning implicit declaration of function basename, which defined in string.h */
#include <stdio.h>         /* for FILE, va_list, EOF, SEEK_SET, SEEK_CUR, SEEK_END, stdin, stdout, stderr, remove(), rename(), tmpfile(), tmpnam(), tempnam(), fclose(), */
                           /* fflush(), fopen(), freopen(), fprintf(), printf(), snprintf(), scanf(), sscanf(), fgetc(), getc(), getchar(), fputc(), putc(), putchar(), */
                           /* fgets(), gets(), fputs(), puts(), fread(), fwrite(), fseek(), ftell(), rewind(), feof(), ferror(), fileno(), popen(), pclose(), */
#include <string.h>        /* for memcpy(), memmove(), memset(), memcmp(), memchr(), memrchr(), str[n]cpy(), str[n]cat(), str[n]cmp(), strcoll(), str[n]dup(), strchr(), strrchr(), strstr(), */
                           /* strtok(), strcasestr(), memmem(), mempcpy(), str[n]len(), strerror(), bcopy(), bzero(), strcasecmp(), strsep(), basename(), */



int main(int argc, char **argv) {
	char *self;
	int result;
	int onechar;
	
	self=strrchr(argv[0], '/');
	if (self!=NULL) self++;
	else self=argv[0];
	
	if (argc<1) {
		printf("Usage: %s\n", argv[0]);
		return 0;
	}
	
	onechar='A';
	printf("%s: putc(onechar,stdout): ", self);
	fflush(stdout);
	result=putc(onechar, stdout);
	putc('\n', stdout);
	printf("%s: putc(onechar,stdout): result=%d (result=0x%02X) (result=%c)\n", self, result, result, result);
	
	return 0;
}

program należy skompilować komendą:
make clean all # system Linux
make -f Makefile clean all # system Linux
make -f Makefile.obsd clean all # system OpenBSD
make -f Makefile.fbsd clean all # system FreeBSD
make -f Makefile.sol clean all # system Solaris
make -f Makefile.beos clean all # system BeOS
make -f Makefile.win clean all # system Windows

a następnie uruchomić w następujący sposób:
/home/local/code/ansiccode/sysfile/putc

w rezultacie program wyświetli następujące informacje:
putc: putc(onechar,stdout): A
putc: putc(onechar,stdout): result=65 (result=0x41) (result=A)



#top putw


Documentacja online: pubs.opengroup.org | www.cplusplus.com | pl.wikibooks.org

Deklaracja funkcji putw() znajduje się w pliku nagłówkowym stdio.h.
Deklaracja funkcji putw() jest następująca:
/* Write a word (int) to STREAM.  */
extern int putw (int __w, FILE *__stream);

Powiązane:
getc(), getw(), putc(), putw(), ungetc(),

Opis:
Funkcja putw()

Argumenty:
int __w -
FILE *__stream -

Zwracana wartość:
int -

Example:
zawartość pliku getw.c
SELECT ALL


program należy skompilować komendą:
make clean all # system Linux
make -f Makefile clean all # system Linux
make -f Makefile.obsd clean all # system OpenBSD
make -f Makefile.fbsd clean all # system FreeBSD
make -f Makefile.sol clean all # system Solaris
make -f Makefile.beos clean all # system BeOS
make -f Makefile.win clean all # system Windows

a następnie uruchomić bez argumentów:
/home/local/code/ansiccode/sysfile/putw
program wyświetli informacje o sposobie uruchamiania programu:


jako argument wywołania programu można podać analogiczne jak poniżej argumenty:

rezultat będzie zależny od podanych argumentów wywołania programu:




#top pwrite


Documentacja online: pubs.opengroup.org | www.cplusplus.com | pl.wikibooks.org

Deklaracja funkcji pwrite() znajduje się w pliku nagłówkowym unistd.h.
Deklaracja funkcji pwrite() jest następująca:
/* Write N bytes of BUF to FD at the given position OFFSET without
   changing the file pointer.  Return the number written, or -1.

   This function is a cancellation point and therefore not marked with
   __THROW.  */
extern ssize_t pwrite (int __fd, __const void *__buf, size_t __n,
               __off_t __offset) __wur;

Powiązane:
fread(), fwrite(), pread(), pwrite(), read(), write(),

Opis:
Funkcja pwrite()

Argumenty:
int __fd -
const void *__buf -
size_t __n -
__off_t __offset -

Zwracana wartość:
ssize_t -

Example:
zawartość pliku pwrite.c
SELECT ALL


program należy skompilować komendą make (jako argument należy podać plik Makefile zależny od systemu operacyjnego, domyślnie make próbuje użyć pliku Makefile):
make clean all # system Linux
make -f Makefile clean all # system Linux
make -f Makefile.obsd clean all # system OpenBSD
make -f Makefile.fbsd clean all # system FreeBSD
make -f Makefile.sol clean all # system Solaris
make -f Makefile.beos clean all # system BeOS
make -f Makefile.win clean all # system Windows

a następnie uruchomić bez argumentów:

program wyświetli informacje o sposobie uruchamiania programu:


jako argument wywołania programu można podać analogiczne jak poniżej argumenty:

rezultat będzie zależny od podanych argumentów wywołania programu:




#top read


Documentacja online: pubs.opengroup.org | www.cplusplus.com | pl.wikibooks.org

Deklaracja funkcji read() znajduje się w pliku nagłówkowym unistd.h.
Deklaracja funkcji read() jest następująca:
/* Read NBYTES into BUF from FD.  Return the
   number read, -1 for errors or 0 for EOF.

   This function is a cancellation point and therefore not marked with
   __THROW.  */
extern ssize_t read (int __fd, void *__buf, size_t __nbytes) __wur;

Powiązane:
fread(), fwrite(), pread(), pwrite(), read(), write(),

Opis:
Funkcja read()

Argumenty:
int __fd -
void *__buf -
size_t __nbytes -

Zwracana wartość:
ssize_t -

Example:
zawartość pliku read.c
SELECT ALL
#define  _GNU_SOURCE  1    /* for environ defined in unistd.h, to avoid warning implicit declaration of function basename, which defined in string.h */
#include <stdio.h>         /* for FILE, va_list, EOF, SEEK_SET, SEEK_CUR, SEEK_END, stdin, stdout, stderr, remove(), rename(), tmpfile(), tmpnam(), tempnam(), fclose(), */
                           /* fflush(), fopen(), freopen(), fprintf(), printf(), snprintf(), scanf(), sscanf(), fgetc(), getc(), getchar(), fputc(), putc(), putchar(), */
                           /* fgets(), gets(), fputs(), puts(), fread(), fwrite(), fseek(), ftell(), rewind(), feof(), ferror(), fileno(), popen(), pclose(), */
#include <string.h>        /* for memcpy(), memmove(), memset(), memcmp(), memchr(), memrchr(), str[n]cpy(), str[n]cat(), str[n]cmp(), strcoll(), str[n]dup(), strchr(), strrchr(), strstr(), */
                           /* strtok(), strcasestr(), memmem(), mempcpy(), str[n]len(), strerror(), bcopy(), bzero(), strcasecmp(), strsep(), basename(), */
#include <unistd.h>        /* for R_OK, W_OK, X_OK, F_OK, environ, access(), lseek(), close(), read(), write(), pipe(), alarm(), sleep(), ualarm(), usleep(), pause(), chown(), chdir(), getcwd(), */
                           /* for exec[...](), nice(), getpid(), getppid(), setpgid(), setsid(), getsid(), getuid(), geteuid(). getgid(), getegid(), setuid(), seteuid(), setgid(), setegid(), fork(), */
                           /* for link(), symlink(), readlink(), unlink(), rmdir(), getlogin(), setlogin(), gethostname(), sethostname(), daemon(), chroot(), getpass(), [f]sync(), [f]truncate(), syscall(), */
#include <errno.h>         /* for errno constant, error constants, */

#if defined(__WIN32__) || defined(WIN32) || defined(_WIN32)
  #define WIN32_LEAN_AND_MEAN
  #include <fcntl.h>       /* for io.h, O_RDONLY, O_WRONLY, O_RDWR, O_CREAT, O_TRUNC, O_APPEND, */
#else
  #include <fcntl.h>       /* for O_RDONLY, O_WRONLY, O_RDWR, O_CREAT, O_TRUNC, O_APPEND, F_GETFL, F_SETFL, O_NONBLOCK, O_SYNC, FASYNC, O_DIRECT, O_LARGEFILE, O_DIRECTORY, O_NOFOLLOW, O_NOATIME, O_NDELAY, */
                           /* for LOCK_SH, LOCK_EX, LOCK_NB, LOCK_UN, LOCK_MAND, LOCK_READ, LOCK_WRITE, LOCK_RW, fcntl(), open(), creat(), */
#endif



int main(int argc, char **argv) {
	char *self;
	int fprd;
	char buffdata[1024];
	int result;
	
	self=strrchr(argv[0], '/');
	if (self!=NULL) self++;
	else self=argv[0];
	
	if (argc<2) {
		printf("Usage: %s </path/to/filename>\n", argv[0]);
		return 0;
	}
	
	fprd=open(argv[1], O_RDONLY, 0644);
	if (fprd>=0) {
		printf("%s: fprd=open(argv[1]=%s, O_RDONLY=%d, 0644); fprd=%d if (fprd>=0): Successful opened file '%s'.\n", self, argv[1], O_RDONLY, fprd, argv[1]);
		
		memset(buffdata, 0x00, sizeof(buffdata));
		result=read(fprd, buffdata, sizeof(buffdata)-1);
		if (result>=0) {
			printf("%s: result=read(fprd=%d, buffdata, sizeof(buffdata)=%lu): result=%d if (result>=0): Successful read data from file '%s'\n", self, fprd, (long unsigned int)sizeof(buffdata), result, argv[1]);
			printf("%s: buffdata=|%s|\n", self, buffdata);
		} else {
			printf("%s: result=read(fprd=%d, buffdata, sizeof(buffdata)=%lu): result=%d if (result>=0): else: Unable to read data from file '%s', Reason: %d:%s\n", self, fprd, (long unsigned int)sizeof(buffdata), result, argv[1], errno, strerror(errno));
		}
		
		close(fprd);
	} else {
		printf("%s: fprd=open(argv[1]=%s, O_RDONLY=%d, 0644); fprd=%d if (fprd>=0): else: Unable to open file '%s', Reason: %d:%s\n", self, argv[1], O_RDONLY, fprd, argv[1], errno, strerror(errno));
	}
	return 0;
}

program należy skompilować komendą make (jako argument należy podać plik Makefile zależny od systemu operacyjnego, domyślnie make próbuje użyć pliku Makefile):
make clean all # system Linux
make -f Makefile clean all # system Linux
make -f Makefile.obsd clean all # system OpenBSD
make -f Makefile.fbsd clean all # system FreeBSD
make -f Makefile.sol clean all # system Solaris
make -f Makefile.beos clean all # system BeOS
make -f Makefile.win clean all # system Windows

a następnie uruchomić bez argumentów:
/home/local/code/ansiccode/sysfile/read
program wyświetli informacje o sposobie uruchamiania programu:
Usage: /home/local/code/ansiccode/sysfile/read </path/to/filename>

jako argument wywołania programu można podać analogiczne jak poniżej argumenty:
/home/local/code/ansiccode/sysfile/read /home/local/code/ansiccode/sysfile/read.c
rezultat będzie zależny od podanych argumentów wywołania programu:
read: fprd=open(argv[1]=/home/local/code/ansiccode/sysfile/read.c, O_RDONLY=0, 0644); fprd=3 if (fprd>=0): Successful opened file '/home/local/code/ansiccode/sysfile/read.c'.
read: result=read(fprd=3, buffdata, sizeof(buffdata)=1024): result=1023 if (result>=0): Successful read data from file '/home/local/code/ansiccode/sysfile/read.c'
read: buffdata=|
#define  _GNU_SOURCE  1    /* for environ defined in unistd.h, to avoid warning implicit declaration of function basename, which defined in string.h */
#include <stdio.h>         /* for FILE, va_list, EOF, SEEK_SET, SEEK_CUR, SEEK_END, stdin, stdout, stderr, remove(), rename(), tmpfile(), tmpnam(), tempnam(), fclose(), */
                           /* fflush(), fopen(), freopen(), fprintf(), printf(), snprintf(), scanf(), sscanf(), fgetc(), getc(), getchar(), fputc(), putc(), putchar(), */
                           /* fgets(), gets(), fputs(), puts(), fread(), fwrite(), fseek(), ftell(), rewind(), feof(), ferror(), fileno(), popen(), pclose(), */
#include <string.h>        /* for memcpy(), memmove(), memset(), memcmp(), memchr(), memrchr(), str[n]cpy(), str[n]cat(), str[n]cmp(), strcoll(), str[n]dup(), strchr(), strrchr(), strstr(), */
                           /* strtok(), strcasestr(), memmem(), mempcpy(), str[n]len(), strerror(), bcopy(), bzero(), strcasecmp(), strsep(), basename(), */
#include <unistd|




Documentacja online: pubs.opengroup.org | www.cplusplus.com | pl.wikibooks.org

Deklaracja funkcji readlink() znajduje się w pliku nagłówkowym unistd.h.
Deklaracja funkcji readlink() jest następująca:
/* Read the contents of the symbolic link PATH into no more than
   LEN bytes of BUF.  The contents are not null-terminated.
   Returns the number of characters read, or -1 for errors.  */
extern ssize_t readlink (__const char *__restrict __path,
             char *__restrict __buf, size_t __len)
     __THROW __nonnull ((1, 2)) __wur;

Powiązane:
link(), linkat(), readlink(), readlinkat(), symlink(), symlinkat(),

Opis:
Funkcja readlink()

Argumenty:
const char *__restrict __path -
char *__restrict __buf -
size_t __len -

Zwracana wartość:
ssize_t -

Example:
zawartość pliku readlink.c
SELECT ALL
#define  _GNU_SOURCE  1    /* for environ defined in unistd.h, to avoid warning implicit declaration of function basename, which defined in string.h */
#include <stdio.h>         /* for FILE, va_list, EOF, SEEK_SET, SEEK_CUR, SEEK_END, stdin, stdout, stderr, remove(), rename(), tmpfile(), tmpnam(), tempnam(), fclose(), */
                           /* fflush(), fopen(), freopen(), fprintf(), printf(), snprintf(), scanf(), sscanf(), fgetc(), getc(), getchar(), fputc(), putc(), putchar(), */
                           /* fgets(), gets(), fputs(), puts(), fread(), fwrite(), fseek(), ftell(), rewind(), feof(), ferror(), fileno(), popen(), pclose(), */
#include <string.h>        /* for memcpy(), memmove(), memset(), memcmp(), memchr(), memrchr(), str[n]cpy(), str[n]cat(), str[n]cmp(), strcoll(), str[n]dup(), strchr(), strrchr(), strstr(), */
                           /* strtok(), strcasestr(), memmem(), mempcpy(), str[n]len(), strerror(), bcopy(), bzero(), strcasecmp(), strsep(), basename(), */
#include <unistd.h>        /* for R_OK, W_OK, X_OK, F_OK, environ, access(), lseek(), close(), read(), write(), pipe(), alarm(), sleep(), ualarm(), usleep(), pause(), chown(), chdir(), getcwd(), */
                           /* for exec[...](), nice(), getpid(), getppid(), setpgid(), setsid(), getsid(), getuid(), geteuid(). getgid(), getegid(), setuid(), seteuid(), setgid(), setegid(), fork(), */
                           /* for link(), symlink(), readlink(), unlink(), rmdir(), getlogin(), setlogin(), gethostname(), sethostname(), daemon(), chroot(), getpass(), [f]sync(), [f]truncate(), syscall(), */
#include <errno.h>         /* for errno constant, error constants, */



int main(int argc, char **argv) {
	char *self;
#if defined(__WIN32__) || defined(WIN32) || defined(_WIN32)
#else
	ssize_t result;
#endif
	char buffdata[1024];
	
	self=strrchr(argv[0], '/');
	if (self!=NULL) self++;
	else self=argv[0];
	
	if (argc<2) {
		printf("Usage: %s </path/to/symlink>\n", argv[0]);
		return 0;
	}
	
	memset(buffdata, 0x00, sizeof(buffdata));
#if defined(__WIN32__) || defined(WIN32) || defined(_WIN32)
	/* readlink() is not available on this OS platform !!! */
	printf("%s: readlink() is not available on this OS platform !!!\n", self);
#else
	result=readlink(argv[1], buffdata, sizeof(buffdata));
	if (result>=0) printf("%s: result=readlink(argv[1]=%s, buffdata, sizeof(buffdata)=%lu): result=%lu if (result>=0): Successful readlink '%s', buffdata=|%s|\n", self, argv[1], (long unsigned int)sizeof(buffdata), (unsigned long int)result, argv[1], buffdata);
	else           printf("%s: result=readlink(argv[1]=%s, buffdata, sizeof(buffdata)=%lu): result=%lu if (result>=0): else: Unable to readlink '%s', Reason: %d:%s\n", self, argv[1], (long unsigned int)sizeof(buffdata), (unsigned long int)result, argv[1], errno, strerror(errno));
#endif
	
	return 0;
}

program należy skompilować komendą make (jako argument należy podać plik Makefile zależny od systemu operacyjnego, domyślnie make próbuje użyć pliku Makefile):
make clean all # system Linux
make -f Makefile clean all # system Linux
make -f Makefile.obsd clean all # system OpenBSD
make -f Makefile.fbsd clean all # system FreeBSD
make -f Makefile.sol clean all # system Solaris
make -f Makefile.beos clean all # system BeOS
make -f Makefile.win clean all # system Windows

a następnie uruchomić bez argumentów:
/home/local/code/ansiccode/sysfile/readlink
program wyświetli informacje o sposobie uruchamiania programu:
Usage: /home/local/code/ansiccode/sysfile/readlink </path/to/symlink>

następnie przed wywołaniem programu należy utworzyć link symboliczny poleceniem ln -s /home/local/code/ansiccode/sysfile/readlink /home/local/code/ansiccode/sysfile/readlink-symlink:
jako argument wywołania programu można podać analogiczne jak poniżej argumenty:
/home/local/code/ansiccode/sysfile/readlink /home/local/code/ansiccode/sysfile/readlink-symlink
rezultat będzie zależny od podanych argumentów wywołania programu:
readlink: result=readlink(argv[1]=/home/local/code/ansiccode/sysfile/readlink-symlink, buffdata, sizeof(buffdata)=1024): result=43 if (result>=0): Successful readlink '/home/local/code/ansiccode/sysfile/readlink-symlink', buffdata=|/home/local/code/ansiccode/sysfile/readlink|



#top readlinkat


Documentacja online: pubs.opengroup.org | www.cplusplus.com | pl.wikibooks.org

Deklaracja funkcji readlinkat() znajduje się w pliku nagłówkowym unistd.h.
Deklaracja funkcji readlinkat() jest następująca:
#ifdef __USE_ATFILE
/* Like readlink but a relative PATH is interpreted relative to FD.  */
extern ssize_t readlinkat (int __fd, __const char *__restrict __path,
               char *__restrict __buf, size_t __len)
     __THROW __nonnull ((2, 3)) __wur;
#endif

Powiązane:
link(), linkat(), readlink(), readlinkat(), symlink(), symlinkat(),

Opis:
Funkcja readlinkat()

Argumenty:
int __fd -
const char *__restrict __path -
char *__restrict __buf -
size_t __len -

Zwracana wartość:
ssize_t -



#top realpath


Documentacja online: pubs.opengroup.org | www.cplusplus.com | pl.wikibooks.org

Deklaracja funkcji realpath() znajduje się w pliku nagłówkowym stdlib.h.
Deklaracja funkcji realpath() jest następująca:
/* Return the canonical absolute name of file NAME.  If RESOLVED is
   null, the result is malloc'd; otherwise, if the canonical name is
   PATH_MAX chars or more, returns null with 'errno' set to
   ENAMETOOLONG; if the name fits in fewer than PATH_MAX chars,
   returns the name in RESOLVED.  */
extern char *realpath (__const char *__restrict __name,
               char *__restrict __resolved) __THROW __wur;

Powiązane:
realpath(),

Opis:
Funkcja realpath()

Argumenty:
const char *__restrict __name -
char *__restrict __resolved -

Zwracana wartość:
char * -

Example:
zawartość pliku realpath.c
SELECT ALL
#define  _GNU_SOURCE  1    /* for environ defined in unistd.h, to avoid warning implicit declaration of function basename, which defined in string.h */
#include <stdio.h>         /* for FILE, va_list, EOF, SEEK_SET, SEEK_CUR, SEEK_END, stdin, stdout, stderr, remove(), rename(), tmpfile(), tmpnam(), tempnam(), fclose(), */
                           /* fflush(), fopen(), freopen(), fprintf(), printf(), snprintf(), scanf(), sscanf(), fgetc(), getc(), getchar(), fputc(), putc(), putchar(), */
                           /* fgets(), gets(), fputs(), puts(), fread(), fwrite(), fseek(), ftell(), rewind(), feof(), ferror(), fileno(), popen(), pclose(), */
#include <stdlib.h>        /* for RAND_MAX, EXIT_FAILURE, EXIT_SUCCESS, MB_CUR_MAX, atoi(), atol(), atoll(), atof(), strtod(), strtof(), strtold(), strtol(), strtoul(), strtoq(), strtouq(), strtoll(), strtoull(), */
                           /* for sys/types.h, malloc.h replaced by stdlib.h, random(), srandom(), rand(), srand(), abort(), atexit(), on_exit(), exit(), getenv(), */
                           /* for putenv(), setenv(), clearenv(), mktemp(), mkdtemp(), system(), realpath(), abs(), llabs(), getloadavg() */
#include <string.h>        /* for memcpy(), memmove(), memset(), memcmp(), memchr(), memrchr(), str[n]cpy(), str[n]cat(), str[n]cmp(), strcoll(), str[n]dup(), strchr(), strrchr(), strstr(), */
                           /* strtok(), strcasestr(), memmem(), mempcpy(), str[n]len(), strerror(), bcopy(), bzero(), strcasecmp(), strsep(), basename(), */



int main(int argc, char **argv) {
	char *self;
#if defined(__WIN32__) || defined(WIN32) || defined(_WIN32)
#else
	char strpathfile[1024], *ptrpathfile;
#endif
	
	self=strrchr(argv[0], '/');
	if (self!=NULL) self++;
	else self=argv[0];
	
	if (argc<2) {
		printf("Usage: %s </path/to/symlink>\n", argv[0]);
		return 0;
	}
	
#if defined(__WIN32__) || defined(WIN32) || defined(_WIN32)
	/* realpath() is not available on this OS platform !!! */
	printf("%s: realpath() is not available on this OS platform !!!\n", self);
#else
	ptrpathfile=realpath(argv[1], NULL);
	printf("%s: ptrpathfile=realpath(argv[1]=%s, NULL): ptrpathfile=%s\n", self, argv[1], ptrpathfile);
	
	ptrpathfile=realpath(argv[1], strpathfile);
	printf("%s: ptrpathfile=realpath(argv[1]=%s, strpathfile=%s): ptrpathfile=%s\n", self, argv[1], strpathfile, ptrpathfile);
#endif
	
	return 0;
}

program należy skompilować komendą make (jako argument należy podać plik Makefile zależny od systemu operacyjnego, domyślnie make próbuje użyć pliku Makefile):
make clean all # system Linux
make -f Makefile clean all # system Linux
make -f Makefile.obsd clean all # system OpenBSD
make -f Makefile.fbsd clean all # system FreeBSD
make -f Makefile.sol clean all # system Solaris
make -f Makefile.beos clean all # system BeOS
make -f Makefile.win clean all # system Windows

a następnie uruchomić bez argumentów:
/home/local/code/ansiccode/sysfile/realpath
program wyświetli informacje o sposobie uruchamiania programu:
Usage: /home/local/code/ansiccode/sysfile/realpath </path/to/symlink>

następnie przed wywołaniem programu należy utworzyć link symboliczny poleceniem ln -s /home/local/code/ansiccode/sysfile/realpath /home/local/code/ansiccode/sysfile/realpath-symlink:
jako argument wywołania programu można podać analogiczne jak poniżej argumenty:
/home/local/code/ansiccode/sysfile/realpath /home/local/code/ansiccode/sysfile/realpath-symlink
rezultat będzie zależny od podanych argumentów wywołania programu:
realpath: ptrpathfile=realpath(argv[1]=/home/local/code/ansiccode/sysfile/realpath-symlink, NULL): ptrpathfile=/home/local/code/ansiccode/sysfile/realpath
realpath: ptrpathfile=realpath(argv[1]=/home/local/code/ansiccode/sysfile/realpath-symlink, strpathfile=/home/local/code/ansiccode/sysfile/realpath): ptrpathfile=/home/local/code/ansiccode/sysfile/realpath



#top remove


Documentacja online: pubs.opengroup.org | www.cplusplus.com | pl.wikibooks.org

Deklaracja funkcji remove() znajduje się w pliku nagłówkowym stdio.h.
Deklaracja funkcji remove() jest następująca:
/* Remove file FILENAME.  */
extern int remove (__const char *__filename) __THROW;

Powiązane:
remove(), unlink(), unlinkat(),

Opis:
Funkcja remove()

Argumenty:
const char *__filename -

Zwracana wartość:
int -

Example:
zawartość pliku remove.c
SELECT ALL
#define  _GNU_SOURCE  1    /* for environ defined in unistd.h, to avoid warning implicit declaration of function basename, which defined in string.h */
#include <stdio.h>         /* for FILE, va_list, EOF, SEEK_SET, SEEK_CUR, SEEK_END, stdin, stdout, stderr, remove(), rename(), tmpfile(), tmpnam(), tempnam(), fclose(), */
                           /* fflush(), fopen(), freopen(), fprintf(), printf(), snprintf(), scanf(), sscanf(), fgetc(), getc(), getchar(), fputc(), putc(), putchar(), */
                           /* fgets(), gets(), fputs(), puts(), fread(), fwrite(), fseek(), ftell(), rewind(), feof(), ferror(), fileno(), popen(), pclose(), */
#include <string.h>        /* for memcpy(), memmove(), memset(), memcmp(), memchr(), memrchr(), str[n]cpy(), str[n]cat(), str[n]cmp(), strcoll(), str[n]dup(), strchr(), strrchr(), strstr(), */
                           /* strtok(), strcasestr(), memmem(), mempcpy(), str[n]len(), strerror(), bcopy(), bzero(), strcasecmp(), strsep(), basename(), */
#include <errno.h>         /* for errno constant, error constants, */

int main(int argc, char **argv) {
	char *self;
	int result;
	
	self=strrchr(argv[0], '/');
	if (self!=NULL) self++;
	else self=argv[0];
	
	if (argc<2) {
		printf("Usage: %s </path/to/filename>\n", argv[0]);
		return 0;
	}
	
	result=remove(argv[1]);
	if (result>=0) {
		printf("%s: result=remove(argv[1]=%s): result=%d, if (result>=0): Successful remove() file.\n", self, argv[1], result);
	} else {
		printf("%s: result=remove(argv[1]=%s): result=%d, if (result>=0): else: Unable to remove() file, Reason: %d:%s\n", self, argv[1], result, errno, strerror(errno));
		return 2;
	}
	
	return 0;
}

program należy skompilować komendą make (jako argument należy podać plik Makefile zależny od systemu operacyjnego, domyślnie make próbuje użyć pliku Makefile):
make clean all # system Linux
make -f Makefile clean all # system Linux
make -f Makefile.obsd clean all # system OpenBSD
make -f Makefile.fbsd clean all # system FreeBSD
make -f Makefile.sol clean all # system Solaris
make -f Makefile.beos clean all # system BeOS
make -f Makefile.win clean all # system Windows

a następnie uruchomić bez argumentów:
/home/local/code/ansiccode/sysfile/remove
program wyświetli informacje o sposobie uruchamiania programu:
Usage: /home/local/code/ansiccode/sysfile/remove </path/to/filename>

następnie należy utworzyć przykładowy plik: touch /home/local/code/ansiccode/sysfile/remove-test
oraz uruchomić w następujący sposób:
/home/local/code/ansiccode/sysfile/remove /home/local/code/ansiccode/sysfile/remove-test
/home/local/code/ansiccode/sysfile/remove /home/local/code/ansiccode/sysfile/remove-test
/home/local/code/ansiccode/sysfile/remove /dev/null

w rezultacie program wyświetli następujące informacje:
remove: result=remove(argv[1]=/home/local/code/ansiccode/sysfile/remove-test): result=0, if (result>=0): Successful remove() file.

remove: result=remove(argv[1]=/home/local/code/ansiccode/sysfile/remove-test): result=-1, if (result>=0): else: Unable to remove() file, Reason: 2:No such file or directory

remove: result=remove(argv[1]=/dev/null): result=-1, if (result>=0): else: Unable to remove() file, Reason: 13:Permission denied



#top rename


Documentacja online: pubs.opengroup.org | www.cplusplus.com | pl.wikibooks.org

Deklaracja funkcji rename() znajduje się w pliku nagłówkowym stdio.h.
Deklaracja funkcji rename() jest następująca:
/* Rename file OLD to NEW.  */
extern int rename (__const char *__old, __const char *__new) __THROW;

Powiązane:
rename(), renameat(),

Opis:
Funkcja rename()

Argumenty:
const char *__old -
const char *__new -

Zwracana wartość:
int -

Example:
zawartość pliku rename.c
SELECT ALL
#define  _GNU_SOURCE  1    /* for environ defined in unistd.h, to avoid warning implicit declaration of function basename, which defined in string.h */
#include <stdio.h>         /* for FILE, va_list, EOF, SEEK_SET, SEEK_CUR, SEEK_END, stdin, stdout, stderr, remove(), rename(), tmpfile(), tmpnam(), tempnam(), fclose(), */
                           /* fflush(), fopen(), freopen(), fprintf(), printf(), snprintf(), scanf(), sscanf(), fgetc(), getc(), getchar(), fputc(), putc(), putchar(), */
                           /* fgets(), gets(), fputs(), puts(), fread(), fwrite(), fseek(), ftell(), rewind(), feof(), ferror(), fileno(), popen(), pclose(), */
#include <string.h>        /* for memcpy(), memmove(), memset(), memcmp(), memchr(), memrchr(), str[n]cpy(), str[n]cat(), str[n]cmp(), strcoll(), str[n]dup(), strchr(), strrchr(), strstr(), */
                           /* strtok(), strcasestr(), memmem(), mempcpy(), str[n]len(), strerror(), bcopy(), bzero(), strcasecmp(), strsep(), basename(), */
#include <errno.h>         /* for errno constant, error constants, */



int main(int argc, char **argv) {
	char *self;
	int result;
	
	self=strrchr(argv[0], '/');
	if (self!=NULL) self++;
	else self=argv[0];
	
	if (argc<3) {
		printf("Usage: %s </path/to/file/src> </path/to/file/dst>\n", argv[0]);
		return 0;
	}
	
	result=rename(argv[1], argv[2]);
	if (result>=0) {
		printf("%s: result=rename(argv[1]=%s, argv[2]=%s): result=%d, if (result>=0): else: Successful rename() file from '%s' to '%s'.\n", self, argv[1], argv[2], result, argv[1], argv[2]);
	} else {
		printf("%s: result=rename(argv[1]=%s, argv[2]=%s): result=%d, if (result>=0): else: Unable to rename() file from '%s' to '%s', Reason: %d:%s\n", self, argv[1], argv[2], result, argv[1], argv[2], errno, strerror(errno));
		return 2;
	}
	
	return 0;
}

program należy skompilować komendą make (jako argument należy podać plik Makefile zależny od systemu operacyjnego, domyślnie make próbuje użyć pliku Makefile):
make clean all # system Linux
make -f Makefile clean all # system Linux
make -f Makefile.obsd clean all # system OpenBSD
make -f Makefile.fbsd clean all # system FreeBSD
make -f Makefile.sol clean all # system Solaris
make -f Makefile.beos clean all # system BeOS
make -f Makefile.win clean all # system Windows

a następnie uruchomić bez argumentów:
/home/local/code/ansiccode/sysfile/rename
program wyświetli informacje o sposobie uruchamiania programu:
Usage: /home/local/code/ansiccode/sysfile/rename </path/to/file/src> </path/to/file/dst>

następnie należy utworzyć przykładowy plik: touch /home/local/code/ansiccode/sysfile/rename-test
jako argument wywołania programu można podać analogiczne jak poniżej argumenty:
/home/local/code/ansiccode/sysfile/rename /home/local/code/ansiccode/sysfile/rename-test /home/local/code/ansiccode/sysfile/rename-file
/home/local/code/ansiccode/sysfile/rename /home/local/code/ansiccode/sysfile/rename-test /home/local/code/ansiccode/sysfile/rename-file
/home/local/code/ansiccode/sysfile/rename /dev/null /dev/null-renamed
rezultat będzie zależny od podanych argumentów wywołania programu:
rename: result=rename(argv[1]=/home/local/code/ansiccode/sysfile/rename-test, argv[2]=/home/local/code/ansiccode/sysfile/rename-file): result=0, if (result>=0): else: Successful rename() file from '/home/local/code/ansiccode/sysfile/rename-test' to '/home/local/code/ansiccode/sysfile/rename-file'.

rename: result=rename(argv[1]=/home/local/code/ansiccode/sysfile/rename-test, argv[2]=/home/local/code/ansiccode/sysfile/rename-file): result=-1, if (result>=0): else: Unable to rename() file from '/home/local/code/ansiccode/sysfile/rename-test' to '/home/local/code/ansiccode/sysfile/rename-file', Reason: 2:No such file or directory

rename: result=rename(argv[1]=/dev/null, argv[2]=/dev/null-renamed): result=-1, if (result>=0): else: Unable to rename() file from '/dev/null' to '/dev/null-renamed', Reason: 13:Permission denied



#top renameat


Documentacja online: pubs.opengroup.org | www.cplusplus.com | pl.wikibooks.org

Deklaracja funkcji renameat() znajduje się w pliku nagłówkowym stdio.h.
Deklaracja funkcji renameat() jest następująca:
#ifdef __USE_ATFILE
/* Rename file OLD relative to OLDFD to NEW relative to NEWFD.  */
extern int renameat (int __oldfd, __const char *__old, int __newfd,
             __const char *__new) __THROW;
#endif

Powiązane:
rename(), renameat(),

Opis:
Funkcja renameat()

Argumenty:
int __oldfd -
const char *__old -
int __newfd -
const char *__new -

Zwracana wartość:
int -



#top rewind


Documentacja online: pubs.opengroup.org | www.cplusplus.com | pl.wikibooks.org

Deklaracja funkcji rewind() znajduje się w pliku nagłówkowym stdio.h.
Deklaracja funkcji rewind() jest następująca:
/* Rewind to the beginning of STREAM.

   This function is a possible cancellation point and therefore not
   marked with __THROW.  */
extern void rewind (FILE *__stream);

Powiązane:
fgetpos(), fseek(), fsetpos(), ftell(), lseek(), rewind(),

Opis:
Funkcja rewind()

Argumenty:
FILE *__stream -

Zwracana wartość:
Funkcja nie zwraca żadnej wartości.

Example:
zawartość pliku rewind.c
SELECT ALL
#define  _GNU_SOURCE  1    /* for environ defined in unistd.h, to avoid warning implicit declaration of function basename, which defined in string.h */
#include <stdio.h>         /* for FILE, va_list, EOF, SEEK_SET, SEEK_CUR, SEEK_END, stdin, stdout, stderr, remove(), rename(), tmpfile(), tmpnam(), tempnam(), fclose(), */
                           /* fflush(), fopen(), freopen(), fprintf(), printf(), snprintf(), scanf(), sscanf(), fgetc(), getc(), getchar(), fputc(), putc(), putchar(), */
                           /* fgets(), gets(), fputs(), puts(), fread(), fwrite(), fseek(), ftell(), rewind(), feof(), ferror(), fileno(), popen(), pclose(), */
#include <string.h>        /* for memcpy(), memmove(), memset(), memcmp(), memchr(), memrchr(), str[n]cpy(), str[n]cat(), str[n]cmp(), strcoll(), str[n]dup(), strchr(), strrchr(), strstr(), */
                           /* strtok(), strcasestr(), memmem(), mempcpy(), str[n]len(), strerror(), bcopy(), bzero(), strcasecmp(), strsep(), basename(), */
#include <errno.h>         /* for errno constant, error constants, */



int main(int argc, char **argv) {
	char *self;
	FILE *file;
	char buffer[1024];
	
	self=strrchr(argv[0], '/');
	if (self!=NULL) self++;
	else self=argv[0];
	
	if (argc<2) {
		printf("Usage: %s </path/to/filename>\n", argv[0]);
		return 0;
	}
	
	file=fopen(argv[1], "w+");
	if (file!=NULL) {
		printf("%s: file=fopen(argv[1]=%s, \"w+\"): if (file!=NULL): Successful fopen() file.\n", self, argv[1]);
		fputs("rewind:line1\n", file);
		fputs("rewind:line2\n", file);
		fputs("rewind:line3\n", file);
		rewind(file);
		while (!feof(file)) {
			if (fgets(buffer,256,file)!=NULL) fputs(buffer, stdout);
			else break;
		}
		fclose(file);
	} else {
		printf("%s: file=fopen(argv[1]=%s, \"w+\"): if (file!=NULL): else: Unable to fopen() file, Reason: %d:%s\n", self, argv[1], errno, strerror(errno));
	}
	
	return 0;
}

program należy skompilować komendą make (jako argument należy podać plik Makefile zależny od systemu operacyjnego, domyślnie make próbuje użyć pliku Makefile):
make clean all # system Linux
make -f Makefile clean all # system Linux
make -f Makefile.obsd clean all # system OpenBSD
make -f Makefile.fbsd clean all # system FreeBSD
make -f Makefile.sol clean all # system Solaris
make -f Makefile.beos clean all # system BeOS
make -f Makefile.win clean all # system Windows

a następnie uruchomić bez argumentów:
/home/local/code/ansiccode/sysfile/rewind
program wyświetli informacje o sposobie uruchamiania programu:
Usage: /home/local/code/ansiccode/sysfile/rewind </path/to/filename>

jako argument wywołania programu można podać analogiczne jak poniżej argumenty:
/home/local/code/ansiccode/sysfile/rewind /home/local/code/ansiccode/sysfile/rewind-test
rezultat będzie zależny od podanych argumentów wywołania programu:
rewind: file=fopen(argv[1]=/home/local/code/ansiccode/sysfile/rewind-test, "w+"): if (file!=NULL): Successful fopen() file.
rewind:line1
rewind:line2
rewind:line3



#top setbuf


Documentacja online: pubs.opengroup.org | www.cplusplus.com | pl.wikibooks.org

Deklaracja funkcji setbuf() znajduje się w pliku nagłówkowym stdio.h.
Deklaracja funkcji setbuf() jest następująca:

/* If BUF is NULL, make STREAM unbuffered.
   Else make it use buffer BUF, of size BUFSIZ.  *:
extern void setbuf (FILE *__restrict __stream, char *__restrict __buf) __THROW;

Powiązane:
setbuf(), setbuffer(), setlinebuf(), setvbuf()

Opis:
Funkcja setbuf()

Argumenty:
FILE *__restrict __stream -
char *__restrict __buf -

Zwracana wartość:
Funkcja nie zwraca żadnej wartości.

Example:
zawartość pliku setbuf.c
SELECT ALL
#define  _GNU_SOURCE  1    /* for environ defined in unistd.h, to avoid warning implicit declaration of function basename, which defined in string.h */
#include <stdio.h>         /* for FILE, va_list, EOF, SEEK_SET, SEEK_CUR, SEEK_END, stdin, stdout, stderr, remove(), rename(), tmpfile(), tmpnam(), tempnam(), fclose(), */
                           /* fflush(), fopen(), freopen(), fprintf(), printf(), snprintf(), scanf(), sscanf(), fgetc(), getc(), getchar(), fputc(), putc(), putchar(), */
                           /* fgets(), gets(), fputs(), puts(), fread(), fwrite(), fseek(), ftell(), rewind(), feof(), ferror(), fileno(), popen(), pclose(), */
#include <string.h>        /* for memcpy(), memmove(), memset(), memcmp(), memchr(), memrchr(), str[n]cpy(), str[n]cat(), str[n]cmp(), strcoll(), str[n]dup(), strchr(), strrchr(), strstr(), */
                           /* strtok(), strcasestr(), memmem(), mempcpy(), str[n]len(), strerror(), bcopy(), bzero(), strcasecmp(), strsep(), basename(), */
#include <errno.h>         /* for errno constant, error constants, */



int main(int argc, char **argv) {
	char *self;
	int result;
	FILE *file;
	char bufffile[BUFSIZ];
	char buffdata[1024];
	char bufftemp[16];
	
	self=strrchr(argv[0], '/');
	if (self!=NULL) self++;
	else self=argv[0];
	
	if (argc<4) {
		printf("Usage: %s </path/to/filename1> </path/to/filename2> </path/to/filename3>\n", argv[0]);
		printf("Examples:\n");
		printf("       %s /home/local/code/ansiccode/sysfile/setbuf-write1 /home/local/code/ansiccode/sysfile/setbuf-write2 /home/local/code/ansiccode/sysfile/setbuf-write3\n", argv[0]);
		return 0;
	}
	
	file=fopen(argv[1], "w");
	if (file!=NULL) {
		printf("%s: file=fopen(argv[1]=%s, \"w\"); if (file!=NULL): Successful fopen() file.\n", self, argv[1]);
		memset(bufffile, 0x00, sizeof(bufffile));
		setbuf(file, bufffile);
		
		memset(buffdata, 0x00, sizeof(buffdata));
		strncpy(buffdata, "fwrite:line1\nfwrite:line2\nfwrite:line3\n", sizeof(buffdata));
		result=fwrite(buffdata, 1, strlen(buffdata), file);
		printf("%s: result=fwrite(buffdata, 1, strlen(buffdata)=%ld, file): result=%d\n", self, strlen(buffdata), result);
		
		printf("%s: bufffile=|%s|\n", self, bufffile);
		
		memset(buffdata, 0x00, sizeof(buffdata));
		strncpy(buffdata, "fwrite:line4\nfwrite:line5\nfwrite:line6\n", sizeof(buffdata));
		result=fwrite(buffdata, 1, strlen(buffdata), file);
		printf("%s: result=fwrite(buffdata, 1, strlen(buffdata)=%ld, file): result=%d\n", self, strlen(buffdata), result);
		
		printf("%s: bufffile=|%s|\n", self, bufffile);
		
		memset(buffdata, 0x00, sizeof(buffdata));
		strncpy(buffdata, "fwrite:line7\nfwrite:line8\nfwrite:line9\n", sizeof(buffdata));
		result=fwrite(buffdata, 1, strlen(buffdata), file);
		printf("%s: result=fwrite(buffdata, 1, strlen(buffdata)=%ld, file): result=%d\n", self, strlen(buffdata), result);
		
		printf("%s: bufffile=|%s|\n", self, bufffile);
		
		fclose(file);
	} else {
		printf("%s: file=fopen(argv[1]=%s, \"w\"); if (file!=NULL): else: Unable to fopen() file, Reason: %d:%s\n", self, argv[1], errno, strerror(errno));
	}
	
	file=fopen(argv[2], "w");
	if (file!=NULL) {
		printf("%s: file=fopen(argv[2]=%s, \"w\"); if (file!=NULL): Successful fopen() file.\n", self, argv[1]);
		memset(buffdata, 0x00, sizeof(buffdata));
		setbuf(file, buffdata);
		
		memset(buffdata, 0x00, sizeof(buffdata));
		strncpy(buffdata, "fwrite:line1\nfwrite:line2\nfwrite:line3\n", sizeof(buffdata));
		result=fwrite(buffdata, 1, strlen(buffdata), file);
		printf("%s: result=fwrite(buffdata, 1, strlen(buffdata)=%ld, file): result=%d\n", self, strlen(buffdata), result);
		
		printf("%s: buffdata=|%s|\n", self, buffdata);
		
		memset(buffdata, 0x00, sizeof(buffdata));
		strncpy(buffdata, "fwrite:line4\nfwrite:line5\nfwrite:line6\n", sizeof(buffdata));
		result=fwrite(buffdata, 1, strlen(buffdata), file);
		printf("%s: result=fwrite(buffdata, 1, strlen(buffdata)=%ld, file): result=%d\n", self, strlen(buffdata), result);
		
		printf("%s: buffdata=|%s|\n", self, buffdata);
		
		memset(buffdata, 0x00, sizeof(buffdata));
		strncpy(buffdata, "fwrite:line7\nfwrite:line8\nfwrite:line9\n", sizeof(buffdata));
		result=fwrite(buffdata, 1, strlen(buffdata), file);
		printf("%s: result=fwrite(buffdata, 1, strlen(buffdata)=%ld, file): result=%d\n", self, strlen(buffdata), result);
		
		printf("%s: buffdata=|%s|\n", self, buffdata);
		
		fclose(file);
	} else {
		printf("%s: file=fopen(argv[2]=%s, \"w\"); if (file!=NULL): else: Unable to fopen() file, Reason: %d:%s\n", self, argv[1], errno, strerror(errno));
	}
	
	file=fopen(argv[3], "w");
	if (file!=NULL) {
		printf("%s: file=fopen(argv[3]=%s, \"w\"); if (file!=NULL): Successful fopen() file.\n", self, argv[1]);
		memset(bufftemp, 0x00, sizeof(bufftemp));
		setbuf(file, bufftemp);
		
		memset(bufftemp, 0x00, sizeof(bufftemp));
		strncpy(bufftemp, "fwrite:line1\nfwrite:line2\nfwrite:line3\n", sizeof(bufftemp));
		result=fwrite(bufftemp, 1, strlen(bufftemp), file);
		printf("%s: result=fwrite(bufftemp, 1, strlen(bufftemp)=%ld, file): result=%d\n", self, strlen(bufftemp), result);
		
		printf("%s: bufftemp=|%s|\n", self, bufftemp);
		
		memset(bufftemp, 0x00, sizeof(bufftemp));
		strncpy(bufftemp, "fwrite:line4\nfwrite:line5\nfwrite:line6\n", sizeof(bufftemp));
		result=fwrite(bufftemp, 1, strlen(bufftemp), file);
		printf("%s: result=fwrite(bufftemp, 1, strlen(bufftemp)=%ld, file): result=%d\n", self, strlen(bufftemp), result);
		
		printf("%s: bufftemp=|%s|\n", self, bufftemp);
		
		memset(bufftemp, 0x00, sizeof(bufftemp));
		strncpy(bufftemp, "fwrite:line7\nfwrite:line8\nfwrite:line9\n", sizeof(bufftemp));
		result=fwrite(bufftemp, 1, strlen(bufftemp), file);
		printf("%s: result=fwrite(bufftemp, 1, strlen(bufftemp)=%ld, file): result=%d\n", self, strlen(bufftemp), result);
		
		printf("%s: bufftemp=|%s|\n", self, bufftemp);
		
		fclose(file);
	} else {
		printf("%s: file=fopen(argv[3]=%s, \"w\"); if (file!=NULL): else: Unable to fopen() file, Reason: %d:%s\n", self, argv[1], errno, strerror(errno));
	}
	
	return 0;
}

program należy skompilować komendą make (jako argument należy podać plik Makefile zależny od systemu operacyjnego, domyślnie make próbuje użyć pliku Makefile):
make clean all # system Linux
make -f Makefile clean all # system Linux
make -f Makefile.obsd clean all # system OpenBSD
make -f Makefile.fbsd clean all # system FreeBSD
make -f Makefile.sol clean all # system Solaris
make -f Makefile.beos clean all # system BeOS
make -f Makefile.win clean all # system Windows

a następnie uruchomić bez argumentów:
/home/local/code/ansiccode/sysfile/setbuf
program wyświetli informacje o sposobie uruchamiania programu:
Usage: /home/local/code/ansiccode/sysfile/setbuf </path/to/filename>
Examples:
       /home/local/code/ansiccode/sysfile/setbuf /home/local/code/ansiccode/sysfile/setbuf-write1 /home/local/code/ansiccode/sysfile/setbuf-write2 /home/local/code/ansiccode/sysfile/setbuf-write3

jako argument wywołania programu można podać analogiczne jak poniżej argumenty:
/home/local/code/ansiccode/sysfile/setbuf /home/local/code/ansiccode/sysfile/setbuf-write1 /home/local/code/ansiccode/sysfile/setbuf-write2 /home/local/code/ansiccode/sysfile/setbuf-write3
rezultat będzie zależny od podanych argumentów wywołania programu:
setbuf: file=fopen(argv[1]=/home/local/code/ansiccode/sysfile/setbuf-write1, "w"); if (file!=NULL): Successful fopen() file.
setbuf: result=fwrite(buffdata, 1, strlen(buffdata)=39, file): result=39
setbuf: bufffile=|fwrite:line1
fwrite:line2
fwrite:line3
|
setbuf: result=fwrite(buffdata, 1, strlen(buffdata)=39, file): result=39
setbuf: bufffile=|fwrite:line1
fwrite:line2
fwrite:line3
fwrite:line4
fwrite:line5
fwrite:line6
|
setbuf: result=fwrite(buffdata, 1, strlen(buffdata)=39, file): result=39
setbuf: bufffile=|fwrite:line1
fwrite:line2
fwrite:line3
fwrite:line4
fwrite:line5
fwrite:line6
fwrite:line7
fwrite:line8
fwrite:line9
|
setbuf: file=fopen(argv[2]=/home/local/code/ansiccode/sysfile/setbuf-write1, "w"); if (file!=NULL): Successful fopen() file.
setbuf: result=fwrite(buffdata, 1, strlen(buffdata)=39, file): result=39
setbuf: buffdata=|fwrite:line1
fwrite:line2
fwrite:line3
|
setbuf: result=fwrite(buffdata, 1, strlen(buffdata)=78, file): result=39
setbuf: buffdata=|fwrite:line4
fwrite:line5
fwrite:line6
fwrite:line4
fwrite:line5
fwrite:line6
|
setbuf: result=fwrite(buffdata, 1, strlen(buffdata)=39, file): result=39
setbuf: buffdata=|fwrite:line7
fwrite:line8
fwrite:line9
|
setbuf: file=fopen(argv[3]=/home/local/code/ansiccode/sysfile/setbuf-write1, "w"); if (file!=NULL): Successful fopen() file.
setbuf: result=fwrite(bufftemp, 1, strlen(bufftemp)=23, file): result=23
setbuf: bufftemp=|fwrite:line1
fwr*ǿ*$|
setbuf: result=fwrite(bufftemp, 1, strlen(bufftemp)=55, file): result=23
setbuf: bufftemp=|fwrite:line4
fwr*ǿ*$fwrite:line4
fwr*ǿ*h*ǿ*n|
setbuf: result=fwrite(bufftemp, 1, strlen(bufftemp)=112, file): result=55
setbuf: bufftemp=|fwrite:line7
fwr*ǿ*$fwrite:line4
fwr*ǿ*$fwrite:line7
fwr*ǿ*$fwrite:line4
fwr*ǿ*$fwrite:li*ǿ*In**|
Segmentation fault

Jak widać powyżej funkcja setbuf() jest potencjalnie niebezpieczna. Funkcja zakłada (spodziewa się) bufora wielkości BUFSIZ. W przypadku ustawienia bufora o mniejszym rozmiarze buforowany zapis do większej ilości danych kończy się Segmentation fault (w miejscu gwiazdek znajdują się znaki niedrukowalne), co spowodowane jest próbą zapisania danych poza dozwolonym obszarem (poza przekazanym buforem).



#top setbuffer


Documentacja online: pubs.opengroup.org | www.cplusplus.com | pl.wikibooks.org

Deklaracja funkcji setbuffer() znajduje się w pliku nagłówkowym stdio.h.
Deklaracja funkcji setbuffer() jest następująca:

/* If BUF is NULL, make STREAM unbuffered.
   Else make it use SIZE bytes of BUF for buffering.  */
extern void setbuffer (FILE *__restrict __stream, char *__restrict __buf,
               size_t __size) __THROW;

Powiązane:
setbuf(), setbuffer(), setlinebuf(), setvbuf()

Opis:
Funkcja setbuffer()

Argumenty:
FILE *__restrict __stream -
char *__restrict __buf -
size_t __size -

Zwracana wartość:
Funkcja nie zwraca żadnej wartości.

Example:
zawartość pliku setbuffer.c
SELECT ALL
#define  _GNU_SOURCE  1    /* for environ defined in unistd.h, to avoid warning implicit declaration of function basename, which defined in string.h */
#include <stdio.h>         /* for FILE, va_list, EOF, SEEK_SET, SEEK_CUR, SEEK_END, stdin, stdout, stderr, remove(), rename(), tmpfile(), tmpnam(), tempnam(), fclose(), */
                           /* fflush(), fopen(), freopen(), fprintf(), printf(), snprintf(), scanf(), sscanf(), fgetc(), getc(), getchar(), fputc(), putc(), putchar(), */
                           /* fgets(), gets(), fputs(), puts(), fread(), fwrite(), fseek(), ftell(), rewind(), feof(), ferror(), fileno(), popen(), pclose(), */
#include <string.h>        /* for memcpy(), memmove(), memset(), memcmp(), memchr(), memrchr(), str[n]cpy(), str[n]cat(), str[n]cmp(), strcoll(), str[n]dup(), strchr(), strrchr(), strstr(), */
                           /* strtok(), strcasestr(), memmem(), mempcpy(), str[n]len(), strerror(), bcopy(), bzero(), strcasecmp(), strsep(), basename(), */
#include <errno.h>         /* for errno constant, error constants, */



int main(int argc, char **argv) {
	char *self;
	int result;
	FILE *file;
	char bufffile[BUFSIZ];
	char buffdata[1024];
	
	self=strrchr(argv[0], '/');
	if (self!=NULL) self++;
	else self=argv[0];
	
	if (argc<2) {
		printf("Usage: %s </path/to/filename>\n", argv[0]);
		printf("Examples:\n");
		printf("       %s /home/local/code/ansiccode/sysfile/setbuffer-write1\n", argv[0]);
		return 0;
	}
	
	file=fopen(argv[1], "w");
	if (file!=NULL) {
		printf("%s: file=fopen(argv[1]=%s, \"w\"); if (file!=NULL): Successful fopen() file.\n", self, argv[1]);
		memset(bufffile, 0x00, sizeof(bufffile));
		setbuffer(file, bufffile, sizeof(buffdata)-1);
		
		memset(buffdata, 0x00, sizeof(buffdata));
		strncpy(buffdata, "fwrite:line1\nfwrite:line2\nfwrite:line3\n", sizeof(buffdata));
		result=fwrite(buffdata, 1, strlen(buffdata), file);
		printf("%s: result=fwrite(buffdata, 1, strlen(buffdata)=%ld, file): result=%d\n", self, strlen(buffdata), result);
		
		printf("%s: bufffile=|%s|\n", self, bufffile);
		
		memset(buffdata, 0x00, sizeof(buffdata));
		strncpy(buffdata, "fwrite:line4\nfwrite:line5\nfwrite:line6\n", sizeof(buffdata));
		result=fwrite(buffdata, 1, strlen(buffdata), file);
		printf("%s: result=fwrite(buffdata, 1, strlen(buffdata)=%ld, file): result=%d\n", self, strlen(buffdata), result);
		
		printf("%s: bufffile=|%s|\n", self, bufffile);
		
		memset(buffdata, 0x00, sizeof(buffdata));
		strncpy(buffdata, "fwrite:line7\nfwrite:line8\nfwrite:line9\n", sizeof(buffdata));
		result=fwrite(buffdata, 1, strlen(buffdata), file);
		printf("%s: result=fwrite(buffdata, 1, strlen(buffdata)=%ld, file): result=%d\n", self, strlen(buffdata), result);
		
		printf("%s: bufffile=|%s|\n", self, bufffile);
		
		fclose(file);
	} else {
		printf("%s: file=fopen(argv[1]=%s, \"w\"); if (file!=NULL): else: Unable to fopen() file, Reason: %d:%s\n", self, argv[1], errno, strerror(errno));
	}
	
	return 0;
}

program należy skompilować komendą make (jako argument należy podać plik Makefile zależny od systemu operacyjnego, domyślnie make próbuje użyć pliku Makefile):
make clean all # system Linux
make -f Makefile clean all # system Linux
make -f Makefile.obsd clean all # system OpenBSD
make -f Makefile.fbsd clean all # system FreeBSD
make -f Makefile.sol clean all # system Solaris
make -f Makefile.beos clean all # system BeOS
make -f Makefile.win clean all # system Windows

a następnie uruchomić bez argumentów:
/home/local/code/ansiccode/sysfile/setbuffer
program wyświetli informacje o sposobie uruchamiania programu:
Usage: /home/local/code/ansiccode/sysfile/setbuffer </path/to/filename>
Examples:
       /home/local/code/ansiccode/sysfile/setbuffer /home/local/code/ansiccode/sysfile/setbuffer-write1

jako argument wywołania programu można podać analogiczne jak poniżej argumenty:
/home/local/code/ansiccode/sysfile/setbuffer /home/local/code/ansiccode/sysfile/setbuffer-write1
rezultat będzie zależny od podanych argumentów wywołania programu:
setbuffer: file=fopen(argv[1]=/home/local/code/ansiccode/sysfile/setbuffer-write1, "w"); if (file!=NULL): Successful fopen() file.
setbuffer: result=fwrite(buffdata, 1, strlen(buffdata)=39, file): result=39
setbuffer: bufffile=|fwrite:line1
fwrite:line2
fwrite:line3
|
setbuffer: result=fwrite(buffdata, 1, strlen(buffdata)=39, file): result=39
setbuffer: bufffile=|fwrite:line1
fwrite:line2
fwrite:line3
fwrite:line4
fwrite:line5
fwrite:line6
|
setbuffer: result=fwrite(buffdata, 1, strlen(buffdata)=39, file): result=39
setbuffer: bufffile=|fwrite:line1
fwrite:line2
fwrite:line3
fwrite:line4
fwrite:line5
fwrite:line6
fwrite:line7
fwrite:line8
fwrite:line9
|



#top setlinebuf


Documentacja online: pubs.opengroup.org | www.cplusplus.com | pl.wikibooks.org

Deklaracja funkcji setlinebuf() znajduje się w pliku nagłówkowym stdio.h.
Deklaracja funkcji setlinebuf() jest następująca:

/* Make STREAM line-buffered.  */
extern void setlinebuf (FILE *__stream) __THROW;

Powiązane:
setbuf(), setbuffer(), setlinebuf(), setvbuf()

Opis:
Funkcja setlinebuf()

Argumenty:
FILE *__stream -

Zwracana wartość:
Funkcja nie zwraca żadnej wartości.

Example:
zawartość pliku setlinebuf.c
SELECT ALL
#define  _GNU_SOURCE  1    /* for environ defined in unistd.h, to avoid warning implicit declaration of function basename, which defined in string.h */
#include <stdio.h>         /* for FILE, va_list, EOF, SEEK_SET, SEEK_CUR, SEEK_END, stdin, stdout, stderr, remove(), rename(), tmpfile(), tmpnam(), tempnam(), fclose(), */
                           /* fflush(), fopen(), freopen(), fprintf(), printf(), snprintf(), scanf(), sscanf(), fgetc(), getc(), getchar(), fputc(), putc(), putchar(), */
                           /* fgets(), gets(), fputs(), puts(), fread(), fwrite(), fseek(), ftell(), rewind(), feof(), ferror(), fileno(), popen(), pclose(), */
#include <string.h>        /* for memcpy(), memmove(), memset(), memcmp(), memchr(), memrchr(), str[n]cpy(), str[n]cat(), str[n]cmp(), strcoll(), str[n]dup(), strchr(), strrchr(), strstr(), */
                           /* strtok(), strcasestr(), memmem(), mempcpy(), str[n]len(), strerror(), bcopy(), bzero(), strcasecmp(), strsep(), basename(), */
#include <errno.h>         /* for errno constant, error constants, */



int main(int argc, char **argv) {
	char *self;
	int result;
	FILE *file;
	char buffdata[1024];
	
	self=strrchr(argv[0], '/');
	if (self!=NULL) self++;
	else self=argv[0];
	
	if (argc<2) {
		printf("Usage: %s </path/to/filename>\n", argv[0]);
		printf("Examples:\n");
		printf("       %s /home/local/code/ansiccode/sysfile/setlinebuf-write1\n", argv[0]);
		return 0;
	}
	
	file=fopen(argv[1], "w");
	if (file!=NULL) {
		printf("%s: file=fopen(argv[1]=%s, \"w\"); if (file!=NULL): Successful fopen() file.\n", self, argv[1]);
		setlinebuf(file);
		
		memset(buffdata, 0x00, sizeof(buffdata));
		strncpy(buffdata, "fwrite:line1\nfwrite:line2\nfwrite:line3\n", sizeof(buffdata));
		result=fwrite(buffdata, 1, strlen(buffdata), file);
		printf("%s: result=fwrite(buffdata, 1, strlen(buffdata)=%ld, file): result=%d\n", self, strlen(buffdata), result);
		
		memset(buffdata, 0x00, sizeof(buffdata));
		strncpy(buffdata, "fwrite:line4\nfwrite:line5\nfwrite:line6\n", sizeof(buffdata));
		result=fwrite(buffdata, 1, strlen(buffdata), file);
		printf("%s: result=fwrite(buffdata, 1, strlen(buffdata)=%ld, file): result=%d\n", self, strlen(buffdata), result);
		
		memset(buffdata, 0x00, sizeof(buffdata));
		strncpy(buffdata, "fwrite:line4\nfwrite:line5\nfwrite:line6\n", sizeof(buffdata));
		result=fwrite(buffdata, 1, strlen(buffdata), file);
		printf("%s: result=fwrite(buffdata, 1, strlen(buffdata)=%ld, file): result=%d\n", self, strlen(buffdata), result);
		
		fclose(file);
	} else {
		printf("%s: file=fopen(argv[1]=%s, \"w\"); if (file!=NULL): else: Unable to fopen() file, Reason: %d:%s\n", self, argv[1], errno, strerror(errno));
	}
	
	return 0;
}

program należy skompilować komendą make (jako argument należy podać plik Makefile zależny od systemu operacyjnego, domyślnie make próbuje użyć pliku Makefile):
make clean all # system Linux
make -f Makefile clean all # system Linux
make -f Makefile.obsd clean all # system OpenBSD
make -f Makefile.fbsd clean all # system FreeBSD
make -f Makefile.sol clean all # system Solaris
make -f Makefile.beos clean all # system BeOS
make -f Makefile.win clean all # system Windows

a następnie uruchomić bez argumentów:
/home/local/code/ansiccode/sysfile/setlinebuf
program wyświetli informacje o sposobie uruchamiania programu:
Usage: /home/local/code/ansiccode/sysfile/setlinebuf </path/to/filename>
Examples:
       /home/local/code/ansiccode/sysfile/setlinebuf /home/local/code/ansiccode/sysfile/setlinebuf-write1

jako argument wywołania programu można podać analogiczne jak poniżej argumenty:
/home/local/code/ansiccode/sysfile/setlinebuf /home/local/code/ansiccode/sysfile/setlinebuf-write1
rezultat będzie zależny od podanych argumentów wywołania programu:
setlinebuf: file=fopen(argv[1]=/home/local/code/ansiccode/sysfile/setlinebuf-write1, "w"); if (file!=NULL): Successful fopen() file.
setlinebuf: result=fwrite(buffdata, 1, strlen(buffdata)=39, file): result=39
setlinebuf: result=fwrite(buffdata, 1, strlen(buffdata)=39, file): result=39
setlinebuf: result=fwrite(buffdata, 1, strlen(buffdata)=39, file): result=39



#top setvbuf


Documentacja online: pubs.opengroup.org | www.cplusplus.com | pl.wikibooks.org

Deklaracja funkcji setvbuf() znajduje się w pliku nagłówkowym stdio.h.
Deklaracja funkcji setvbuf() jest następująca:

/* Make STREAM use buffering mode MODE.
   If BUF is not NULL, use N bytes of it for buffering;
   else allocate an internal buffer N bytes long.  */
extern int setvbuf (FILE *__restrict __stream, char *__restrict __buf,
            int __modes, size_t __n) __THROW;

Powiązane:
setbuf(), setbuffer(), setlinebuf(), setvbuf()

Opis:
Funkcja setvbuf()

Argumenty:
FILE *__restrict __stream -
char *__restrict __buf -
int __modes - _IOFBF indicates full buffering _IOLBF means line buffering _IONBF means no buffering
size_t __n -

Zwracana wartość:
Funkcja nie zwraca żadnej wartości.

Example:
zawartość pliku setvbuf.c
SELECT ALL
#define  _GNU_SOURCE  1    /* for environ defined in unistd.h, to avoid warning implicit declaration of function basename, which defined in string.h */
#include <stdio.h>         /* for FILE, va_list, EOF, SEEK_SET, SEEK_CUR, SEEK_END, stdin, stdout, stderr, remove(), rename(), tmpfile(), tmpnam(), tempnam(), fclose(), */
                           /* fflush(), fopen(), freopen(), fprintf(), printf(), snprintf(), scanf(), sscanf(), fgetc(), getc(), getchar(), fputc(), putc(), putchar(), */
                           /* fgets(), gets(), fputs(), puts(), fread(), fwrite(), fseek(), ftell(), rewind(), feof(), ferror(), fileno(), popen(), pclose(), */
#include <string.h>        /* for memcpy(), memmove(), memset(), memcmp(), memchr(), memrchr(), str[n]cpy(), str[n]cat(), str[n]cmp(), strcoll(), str[n]dup(), strchr(), strrchr(), strstr(), */
                           /* strtok(), strcasestr(), memmem(), mempcpy(), str[n]len(), strerror(), bcopy(), bzero(), strcasecmp(), strsep(), basename(), */
#include <errno.h>         /* for errno constant, error constants, */



int main(int argc, char **argv) {
	char *self;
	int result;
	FILE *file;
	char bufffile[BUFSIZ];
	char buffdata[1024];
	char bufftemp[16];
	
	self=strrchr(argv[0], '/');
	if (self!=NULL) self++;
	else self=argv[0];
	
	if (argc<4) {
		printf("Usage: %s </path/to/filename1> </path/to/filename2> </path/to/filename3>\n", argv[0]);
		printf("Examples:\n");
		printf("       %s /home/local/code/ansiccode/sysfile/setvbuf-write1 /home/local/code/ansiccode/sysfile/setvbuf-write2 /home/local/code/ansiccode/sysfile/setvbuf-write3\n", argv[0]);
		return 0;
	}
	
	file=fopen(argv[1], "w");
	if (file!=NULL) {
		printf("%s: file=fopen(argv[1]=%s, \"w\"); if (file!=NULL): Successful fopen() file.\n", self, argv[1]);
		memset(bufffile, 0x00, sizeof(bufffile));
		setvbuf(file, bufffile, _IOFBF, sizeof(bufffile)-1);
		
		memset(buffdata, 0x00, sizeof(buffdata));
		strncpy(buffdata, "fwrite:line1\nfwrite:line2\nfwrite:line3\n", sizeof(buffdata));
		result=fwrite(buffdata, 1, strlen(buffdata), file);
		printf("%s: result=fwrite(buffdata, 1, strlen(buffdata)=%ld, file): result=%d\n", self, strlen(buffdata), result);
		
		printf("%s: bufffile=|%s|\n", self, bufffile);
		
		memset(buffdata, 0x00, sizeof(buffdata));
		strncpy(buffdata, "fwrite:line4\nfwrite:line5\nfwrite:line6\n", sizeof(buffdata));
		result=fwrite(buffdata, 1, strlen(buffdata), file);
		printf("%s: result=fwrite(buffdata, 1, strlen(buffdata)=%ld, file): result=%d\n", self, strlen(buffdata), result);
		
		printf("%s: bufffile=|%s|\n", self, bufffile);
		
		memset(buffdata, 0x00, sizeof(buffdata));
		strncpy(buffdata, "fwrite:line4\nfwrite:line5\nfwrite:line6\n", sizeof(buffdata));
		result=fwrite(buffdata, 1, strlen(buffdata), file);
		printf("%s: result=fwrite(buffdata, 1, strlen(buffdata)=%ld, file): result=%d\n", self, strlen(buffdata), result);
		
		printf("%s: bufffile=|%s|\n", self, bufffile);
		
		fclose(file);
	} else {
		printf("%s: file=fopen(argv[1]=%s, \"w\"); if (file!=NULL): else: Unable to fopen() file, Reason: %d:%s\n", self, argv[1], errno, strerror(errno));
	}
	
	file=fopen(argv[2], "w");
	if (file!=NULL) {
		printf("%s: file=fopen(argv[2]=%s, \"w\"); if (file!=NULL): Successful fopen() file.\n", self, argv[1]);
		memset(buffdata, 0x00, sizeof(buffdata));
		setvbuf(file, buffdata, _IOFBF, sizeof(buffdata)-1);
		
		memset(buffdata, 0x00, sizeof(buffdata));
		strncpy(buffdata, "fwrite:line1\nfwrite:line2\nfwrite:line3\n", sizeof(buffdata));
		result=fwrite(buffdata, 1, strlen(buffdata), file);
		printf("%s: result=fwrite(buffdata, 1, strlen(buffdata)=%ld, file): result=%d\n", self, strlen(buffdata), result);
		
		printf("%s: buffdata=|%s|\n", self, buffdata);
		
		memset(buffdata, 0x00, sizeof(buffdata));
		strncpy(buffdata, "fwrite:line4\nfwrite:line5\nfwrite:line6\n", sizeof(buffdata));
		result=fwrite(buffdata, 1, strlen(buffdata), file);
		printf("%s: result=fwrite(buffdata, 1, strlen(buffdata)=%ld, file): result=%d\n", self, strlen(buffdata), result);
		
		printf("%s: buffdata=|%s|\n", self, buffdata);
		
		memset(buffdata, 0x00, sizeof(buffdata));
		strncpy(buffdata, "fwrite:line4\nfwrite:line5\nfwrite:line6\n", sizeof(buffdata));
		result=fwrite(buffdata, 1, strlen(buffdata), file);
		printf("%s: result=fwrite(buffdata, 1, strlen(buffdata)=%ld, file): result=%d\n", self, strlen(buffdata), result);
		
		printf("%s: buffdata=|%s|\n", self, buffdata);
		
		fclose(file);
	} else {
		printf("%s: file=fopen(argv[2]=%s, \"w\"); if (file!=NULL): else: Unable to fopen() file, Reason: %d:%s\n", self, argv[1], errno, strerror(errno));
	}
	
	file=fopen(argv[3], "w");
	if (file!=NULL) {
		printf("%s: file=fopen(argv[2]=%s, \"w\"); if (file!=NULL): Successful fopen() file.\n", self, argv[1]);
		memset(bufftemp, 0x00, sizeof(bufftemp));
		setvbuf(file, bufftemp, _IOLBF, sizeof(bufftemp)-1);
		
		memset(bufftemp, 0x00, sizeof(bufftemp));
		strncpy(bufftemp, "fwrite:line1\nfwrite:line2\nfwrite:line3\n", sizeof(bufftemp));
		result=fwrite(bufftemp, 1, strlen(bufftemp), file);
		printf("%s: result=fwrite(bufftemp, 1, strlen(bufftemp)=%ld, file): result=%d\n", self, strlen(bufftemp), result);
		
		printf("%s: bufftemp=|%s|\n", self, bufftemp);
		
		memset(bufftemp, 0x00, sizeof(bufftemp));
		strncpy(bufftemp, "fwrite:line4\nfwrite:line5\nfwrite:line6\n", sizeof(bufftemp));
		result=fwrite(bufftemp, 1, strlen(bufftemp), file);
		printf("%s: result=fwrite(bufftemp, 1, strlen(bufftemp)=%ld, file): result=%d\n", self, strlen(bufftemp), result);
		
		printf("%s: bufftemp=|%s|\n", self, bufftemp);
		
		memset(bufftemp, 0x00, sizeof(bufftemp));
		strncpy(bufftemp, "fwrite:line4\nfwrite:line5\nfwrite:line6\n", sizeof(bufftemp));
		result=fwrite(bufftemp, 1, strlen(bufftemp), file);
		printf("%s: result=fwrite(bufftemp, 1, strlen(bufftemp)=%ld, file): result=%d\n", self, strlen(bufftemp), result);
		
		printf("%s: bufftemp=|%s|\n", self, bufftemp);
		
		fclose(file);
	} else {
		printf("%s: file=fopen(argv[2]=%s, \"w\"); if (file!=NULL): else: Unable to fopen() file, Reason: %d:%s\n", self, argv[1], errno, strerror(errno));
	}
	
	return 0;
}

program należy skompilować komendą make (jako argument należy podać plik Makefile zależny od systemu operacyjnego, domyślnie make próbuje użyć pliku Makefile):
make clean all # system Linux
make -f Makefile clean all # system Linux
make -f Makefile.obsd clean all # system OpenBSD
make -f Makefile.fbsd clean all # system FreeBSD
make -f Makefile.sol clean all # system Solaris
make -f Makefile.beos clean all # system BeOS
make -f Makefile.win clean all # system Windows

a następnie uruchomić bez argumentów:
/home/local/code/ansiccode/sysfile/setvbuf
program wyświetli informacje o sposobie uruchamiania programu:
Usage: /home/local/code/ansiccode/sysfile/setvbuf </path/to/filename>
Examples:
       /home/local/code/ansiccode/sysfile/setvbuf /home/local/code/ansiccode/sysfile/setvbuf-write1 /home/local/code/ansiccode/sysfile/setvbuf-write2 /home/local/code/ansiccode/sysfile/setvbuf-write3

jako argument wywołania programu można podać analogiczne jak poniżej argumenty:
/home/local/code/ansiccode/sysfile/setvbuf /home/local/code/ansiccode/sysfile/setvbuf-write1 /home/local/code/ansiccode/sysfile/setvbuf-write2 /home/local/code/ansiccode/sysfile/setvbuf-write3
rezultat będzie zależny od podanych argumentów wywołania programu:
setvbuf: file=fopen(argv[1]=/home/local/code/ansiccode/sysfile/setvbuf-write1, "w"); if (file!=NULL): Successful fopen() file.
setvbuf: result=fwrite(buffdata, 1, strlen(buffdata)=39, file): result=39
setvbuf: bufffile=|fwrite:line1
fwrite:line2
fwrite:line3
|
setvbuf: result=fwrite(buffdata, 1, strlen(buffdata)=39, file): result=39
setvbuf: bufffile=|fwrite:line1
fwrite:line2
fwrite:line3
fwrite:line4
fwrite:line5
fwrite:line6
|
setvbuf: result=fwrite(buffdata, 1, strlen(buffdata)=39, file): result=39
setvbuf: bufffile=|fwrite:line1
fwrite:line2
fwrite:line3
fwrite:line4
fwrite:line5
fwrite:line6
fwrite:line4
fwrite:line5
fwrite:line6
|
setvbuf: file=fopen(argv[2]=/home/local/code/ansiccode/sysfile/setvbuf-write1, "w"); if (file!=NULL): Successful fopen() file.
setvbuf: result=fwrite(buffdata, 1, strlen(buffdata)=39, file): result=39
setvbuf: buffdata=|fwrite:line1
fwrite:line2
fwrite:line3
|
setvbuf: result=fwrite(buffdata, 1, strlen(buffdata)=78, file): result=39
setvbuf: buffdata=|fwrite:line4
fwrite:line5
fwrite:line6
fwrite:line4
fwrite:line5
fwrite:line6
|
setvbuf: result=fwrite(buffdata, 1, strlen(buffdata)=39, file): result=39
setvbuf: buffdata=|fwrite:line4
fwrite:line5
fwrite:line6
|
setvbuf: file=fopen(argv[2]=/home/local/code/ansiccode/sysfile/setvbuf-write1, "w"); if (file!=NULL): Successful fopen() file.
setvbuf: result=fwrite(bufftemp, 1, strlen(bufftemp)=23, file): result=23
setvbuf: bufftemp=|fwrite:line1
fwr0&***$|
setvbuf: result=fwrite(bufftemp, 1, strlen(bufftemp)=23, file): result=23
setvbuf: bufftemp=|fwrite:line4
fwr0&***$|
setvbuf: result=fwrite(bufftemp, 1, strlen(bufftemp)=23, file): result=23
setvbuf: bufftemp=|fwrite:line4
fwr0&***$|



#top stat


Documentacja online: pubs.opengroup.org | www.cplusplus.com | pl.wikibooks.org

Deklaracja funkcji stat() znajduje się w pliku nagłówkowym sys/stat.h.
Deklaracja funkcji stat() jest następująca:
/* Get file attributes for FILE and put them in BUF.  */
extern int stat (__const char *__restrict __file,
         struct stat *__restrict __buf) __THROW __nonnull ((1, 2));

Powiązane:
access(), faccessat(), fstat(), fstatat(), lstat(), stat(), statfs(), statvfs(),

Opis:
Funkcja stat()

Argumenty:
const char *__restrict __file -
struct stat *__restrict __buf -

Zwracana wartość:
int -

Example:
zawartość pliku stat.c
SELECT ALL
#define  _GNU_SOURCE  1    /* for environ defined in unistd.h, to avoid warning implicit declaration of function basename, which defined in string.h */
#include <stdio.h>         /* for FILE, va_list, EOF, SEEK_SET, SEEK_CUR, SEEK_END, stdin, stdout, stderr, remove(), rename(), tmpfile(), tmpnam(), tempnam(), fclose(), */
                           /* fflush(), fopen(), freopen(), fprintf(), printf(), snprintf(), scanf(), sscanf(), fgetc(), getc(), getchar(), fputc(), putc(), putchar(), */
                           /* fgets(), gets(), fputs(), puts(), fread(), fwrite(), fseek(), ftell(), rewind(), feof(), ferror(), fileno(), popen(), pclose(), */
#include <string.h>        /* for memcpy(), memmove(), memset(), memcmp(), memchr(), memrchr(), str[n]cpy(), str[n]cat(), str[n]cmp(), strcoll(), str[n]dup(), strchr(), strrchr(), strstr(), */
                           /* strtok(), strcasestr(), memmem(), mempcpy(), str[n]len(), strerror(), bcopy(), bzero(), strcasecmp(), strsep(), basename(), */
#include <unistd.h>        /* for R_OK, W_OK, X_OK, F_OK, environ, access(), lseek(), close(), read(), write(), pipe(), alarm(), sleep(), ualarm(), usleep(), pause(), chown(), chdir(), getcwd(), */
                           /* for exec[...](), nice(), getpid(), getppid(), setpgid(), setsid(), getsid(), getuid(), geteuid(). getgid(), getegid(), setuid(), seteuid(), setgid(), setegid(), fork(), */
                           /* for link(), symlink(), readlink(), unlink(), rmdir(), getlogin(), setlogin(), gethostname(), sethostname(), daemon(), chroot(), getpass(), [f]sync(), [f]truncate(), syscall(), */
#include <errno.h>         /* for errno constant, error constants, */

#if defined(__WIN32__) || defined(WIN32) || defined(_WIN32)
  #define WIN32_LEAN_AND_MEAN
  #include <sys/stat.h>    /* for _dev_t, _gid_t, _ino_t, _mode_t, _off_t, stat(), */
#else
  #include <sys/stat.h>    /* for dev_t, gid_t, ino_t, mode_t, off_t, uid_t, blkcnt_t, blksize_t, struct stat, stat(), fstat(), lstat(), chmod(), lchmod(), umask(), getumask(), mkdir(), mknod(), mkfifo(), */
#endif



int main(int argc, char **argv) {
	char *self;
	struct stat statdata;
#if defined(__WIN32__) || defined(WIN32) || defined(_WIN32)
	struct _stat _statdata;
#else
#endif
	
	self=strrchr(argv[0], '/');
	if (self!=NULL) self++;
	else self=argv[0];
	
	if (argc<2) {
		printf("Usage: %s </path/to/file>\n", argv[0]);
		return 0;
	}
	
	
	
#if defined(__WIN32__) || defined(WIN32) || defined(_WIN32)
	if (_stat(argv[1],&_statdata)==0) {
		printf("%s: if (_stat(argv[1]=%s,&_statdata)==0): Successful _stat() file\n", self, argv[1]);
		printf("%s: argv[1]=%s _statdata.st_dev=%d\n", self, argv[1], _statdata.st_dev);
		printf("%s: argv[1]=%s _statdata.st_ino=%d\n", self, argv[1], _statdata.st_ino);
		printf("%s: argv[1]=%s _statdata.st_mode=%d\n", self, argv[1], _statdata.st_mode);
		printf("%s: argv[1]=%s _statdata.st_nlink=%d\n", self, argv[1], _statdata.st_nlink);
		printf("%s: argv[1]=%s _statdata.st_uid=%d\n", self, argv[1], _statdata.st_uid);
		printf("%s: argv[1]=%s _statdata.st_gid=%d\n", self, argv[1], _statdata.st_gid);
		printf("%s: argv[1]=%s _statdata.st_rdev=%d\n", self, argv[1], _statdata.st_rdev);
		printf("%s: argv[1]=%s _statdata.st_size=%lld\n", self, argv[1], (long long int)_statdata.st_size);
		printf("%s: argv[1]=%s _statdata.st_atime=%d\n", self, argv[1], (int)_statdata.st_atime);
		printf("%s: argv[1]=%s _statdata.st_ctime=%d\n", self, argv[1], (int)_statdata.st_ctime);
		printf("%s: argv[1]=%s _statdata.st_mtime=%d\n", self, argv[1], (int)_statdata.st_mtime);
	} else {
		printf("%s: if (_stat(argv[1]=%s,&_statdata)==0): else: Unable to _stat() file, Reason: %d:%s\n", self, argv[1], errno, strerror(errno));
	}
#endif
	
	
	
#if defined(__WIN32__) || defined(WIN32) || defined(_WIN32)
	if (stat(argv[1],&statdata)==0)
#else
	if (stat(argv[1],&statdata)!=-1)
#endif
	{
#if defined(__WIN32__) || defined(WIN32) || defined(_WIN32)
		printf("%s: if (stat(argv[1]=%s,&statdata)==0): Successful stat() file\n", self, argv[1]);
#else
		printf("%s: if (stat(argv[1]=%s,&statdata)!=-1): Successful stat() file\n", self, argv[1]);
#endif
		printf("%s: argv[1]=%s statdata.st_dev=%d\n", self, argv[1], (int)statdata.st_dev);
		printf("%s: argv[1]=%s statdata.st_ino=%d\n", self, argv[1], (int)statdata.st_ino);
		printf("%s: argv[1]=%s statdata.st_mode=%d\n", self, argv[1], statdata.st_mode);
		printf("%s: argv[1]=%s statdata.st_nlink=%d\n", self, argv[1], statdata.st_nlink);
		printf("%s: argv[1]=%s statdata.st_uid=%d\n", self, argv[1], statdata.st_uid);
		printf("%s: argv[1]=%s statdata.st_gid=%d\n", self, argv[1], statdata.st_gid);
		printf("%s: argv[1]=%s statdata.st_rdev=%d\n", self, argv[1], (int)statdata.st_rdev);
		printf("%s: argv[1]=%s statdata.st_size=%lld\n", self, argv[1], (long long int)statdata.st_size);
#if defined(__WIN32__) || defined(WIN32) || defined(_WIN32)
#else
		printf("%s: argv[1]=%s statdata.st_blksize=%d\n", self, argv[1], (int)statdata.st_blksize);
		printf("%s: argv[1]=%s statdata.st_blocks=%lld\n", self, argv[1], (long long int)statdata.st_blocks);
#endif
		printf("%s: argv[1]=%s statdata.st_atime=%d\n", self, argv[1], (int)statdata.st_atime);
		printf("%s: argv[1]=%s statdata.st_ctime=%d\n", self, argv[1], (int)statdata.st_ctime);
		printf("%s: argv[1]=%s statdata.st_mtime=%d\n", self, argv[1], (int)statdata.st_mtime);
#if defined(__WIN32__) || defined(WIN32) || defined(_WIN32)
#else
		printf("%s: argv[1]=%s statdata.st_ino=%d\n", self, argv[1], (int)statdata.st_ino);
#endif
	} else {
#if defined(__WIN32__) || defined(WIN32) || defined(_WIN32)
		printf("%s: if (stat(argv[1]=%s,&statdata)==0): else: Unable to stat() file, Reason: %d:%s\n", self, argv[1], errno, strerror(errno));
#else
		printf("%s: if (stat(argv[1]=%s,&statdata)!=-1): else: Unable to stat() file, Reason: %d:%s\n", self, argv[1], errno, strerror(errno));
#endif
	}
	
	
	
#if defined(__WIN32__) || defined(WIN32) || defined(_WIN32)
	/* lstat() is not available on this OS platform !!! */
	printf("%s: lstat() is not available on this OS platform !!!\n", argv[0]);
#else
	if (lstat(argv[1],&statdata)!=-1) {
		printf("%s: if (lstat(argv[1]=%s,&statdata)!=-1): Successful lstat() file\n", self, argv[1]);
		printf("%s: argv[1]=%s statdata.st_dev=%d\n", self, argv[1], (int)statdata.st_dev);
		printf("%s: argv[1]=%s statdata.st_ino=%d\n", self, argv[1], (int)statdata.st_ino);
		printf("%s: argv[1]=%s statdata.st_mode=%d\n", self, argv[1], statdata.st_mode);
		printf("%s: argv[1]=%s statdata.st_nlink=%d\n", self, argv[1], statdata.st_nlink);
		printf("%s: argv[1]=%s statdata.st_uid=%d\n", self, argv[1], statdata.st_uid);
		printf("%s: argv[1]=%s statdata.st_gid=%d\n", self, argv[1], statdata.st_gid);
		printf("%s: argv[1]=%s statdata.st_rdev=%d\n", self, argv[1], (int)statdata.st_rdev);
		printf("%s: argv[1]=%s statdata.st_size=%lld\n", self, argv[1], (long long int)statdata.st_size);
		printf("%s: argv[1]=%s statdata.st_blksize=%d\n", self, argv[1], (int)statdata.st_blksize);
		printf("%s: argv[1]=%s statdata.st_blocks=%lld\n", self, argv[1], (long long int)statdata.st_blocks);
		printf("%s: argv[1]=%s statdata.st_blksize=%d\n", self, argv[1], (int)statdata.st_blksize);
		printf("%s: argv[1]=%s statdata.st_blocks=%lld\n", self, argv[1], (long long int)statdata.st_blocks);
		printf("%s: argv[1]=%s statdata.st_atime=%d\n", self, argv[1], (int)statdata.st_atime);
		printf("%s: argv[1]=%s statdata.st_ctime=%d\n", self, argv[1], (int)statdata.st_ctime);
		printf("%s: argv[1]=%s statdata.st_mtime=%d\n", self, argv[1], (int)statdata.st_mtime);
		printf("%s: argv[1]=%s statdata.st_ino=%d\n", self, argv[1], (int)statdata.st_ino);
	} else {
		printf("%s: if (lstat(argv[1]=%s,&statdata)!=-1): else: Unable to lstat() file, Reason: %d:%s\n", self, argv[1], errno, strerror(errno));
	}
#endif
	
	return 0;
}

program należy skompilować komendą make (jako argument należy podać plik Makefile zależny od systemu operacyjnego, domyślnie make próbuje użyć pliku Makefile):
make clean all # system Linux
make -f Makefile clean all # system Linux
make -f Makefile.obsd clean all # system OpenBSD
make -f Makefile.fbsd clean all # system FreeBSD
make -f Makefile.sol clean all # system Solaris
make -f Makefile.beos clean all # system BeOS
make -f Makefile.win clean all # system Windows

a następnie uruchomić bez argumentów:
/home/local/code/ansiccode/sysfile/stat
program wyświetli informacje o sposobie uruchamiania programu:
Usage: /home/local/code/ansiccode/sysfile/stat </path/to/argv[1]>

jako argument wywołania programu można podać analogiczne jak poniżej argumenty:
/home/local/code/ansiccode/sysfile/stat /home/local/code/ansiccode/sysfile/stat
rezultat będzie zależny od podanych argumentów wywołania programu:
stat: if (stat(argv[1]=/home/local/code/ansiccode/sysfile/stat,&statdata)!=-1): Successful stat() file
stat: argv[1]=/home/local/code/ansiccode/sysfile/stat statdata.st_dev=2085
stat: argv[1]=/home/local/code/ansiccode/sysfile/stat statdata.st_ino=1409493
stat: argv[1]=/home/local/code/ansiccode/sysfile/stat statdata.st_mode=33261
stat: argv[1]=/home/local/code/ansiccode/sysfile/stat statdata.st_nlink=1
stat: argv[1]=/home/local/code/ansiccode/sysfile/stat statdata.st_uid=501
stat: argv[1]=/home/local/code/ansiccode/sysfile/stat statdata.st_gid=100
stat: argv[1]=/home/local/code/ansiccode/sysfile/stat statdata.st_rdev=0
stat: argv[1]=/home/local/code/ansiccode/sysfile/stat statdata.st_size=7324
stat: argv[1]=/home/local/code/ansiccode/sysfile/stat statdata.st_blksize=4096
stat: argv[1]=/home/local/code/ansiccode/sysfile/stat statdata.st_blocks=16
stat: argv[1]=/home/local/code/ansiccode/sysfile/stat statdata.st_atime=1383178417
stat: argv[1]=/home/local/code/ansiccode/sysfile/stat statdata.st_ctime=1383178223
stat: argv[1]=/home/local/code/ansiccode/sysfile/stat statdata.st_mtime=1383178223
stat: argv[1]=/home/local/code/ansiccode/sysfile/stat statdata.st_ino=1409493
stat: if (lstat(argv[1]=/home/local/code/ansiccode/sysfile/stat,&statdata)!=-1): Successful lstat() file
stat: argv[1]=/home/local/code/ansiccode/sysfile/stat statdata.st_dev=2085
stat: argv[1]=/home/local/code/ansiccode/sysfile/stat statdata.st_ino=1409493
stat: argv[1]=/home/local/code/ansiccode/sysfile/stat statdata.st_mode=33261
stat: argv[1]=/home/local/code/ansiccode/sysfile/stat statdata.st_nlink=1
stat: argv[1]=/home/local/code/ansiccode/sysfile/stat statdata.st_uid=501
stat: argv[1]=/home/local/code/ansiccode/sysfile/stat statdata.st_gid=100
stat: argv[1]=/home/local/code/ansiccode/sysfile/stat statdata.st_rdev=0
stat: argv[1]=/home/local/code/ansiccode/sysfile/stat statdata.st_size=7324
stat: argv[1]=/home/local/code/ansiccode/sysfile/stat statdata.st_blksize=4096
stat: argv[1]=/home/local/code/ansiccode/sysfile/stat statdata.st_blocks=16
stat: argv[1]=/home/local/code/ansiccode/sysfile/stat statdata.st_blksize=4096
stat: argv[1]=/home/local/code/ansiccode/sysfile/stat statdata.st_blocks=16
stat: argv[1]=/home/local/code/ansiccode/sysfile/stat statdata.st_atime=1383178417
stat: argv[1]=/home/local/code/ansiccode/sysfile/stat statdata.st_ctime=1383178223
stat: argv[1]=/home/local/code/ansiccode/sysfile/stat statdata.st_mtime=1383178223
stat: argv[1]=/home/local/code/ansiccode/sysfile/stat statdata.st_ino=1409493



#top statfs


Documentacja online: pubs.opengroup.org | www.cplusplus.com | pl.wikibooks.org

Deklaracja funkcji statfs() znajduje się w pliku nagłówkowym sys/statfs.h.
Deklaracja funkcji statfs() jest następująca:
extern int statfs (__const char *__file, struct statfs *__buf)
     __THROW __nonnull ((1, 2));

Powiązane:
access(), faccessat(), fstat(), fstatat(), lstat(), stat(), statfs(), statvfs(),

Opis:
Funkcja statfs()

Argumenty:
const char *__file -
struct statfs *__buf -

Zwracana wartość:
int -

Example:
zawartość pliku statfs.c
SELECT ALL
#define  _GNU_SOURCE  1    /* for environ defined in unistd.h, to avoid warning implicit declaration of function basename, which defined in string.h */
#include <stdio.h>         /* for FILE, va_list, EOF, SEEK_SET, SEEK_CUR, SEEK_END, stdin, stdout, stderr, remove(), rename(), tmpfile(), tmpnam(), tempnam(), fclose(), */
                           /* fflush(), fopen(), freopen(), fprintf(), printf(), snprintf(), scanf(), sscanf(), fgetc(), getc(), getchar(), fputc(), putc(), putchar(), */
                           /* fgets(), gets(), fputs(), puts(), fread(), fwrite(), fseek(), ftell(), rewind(), feof(), ferror(), fileno(), popen(), pclose(), */
#include <string.h>        /* for memcpy(), memmove(), memset(), memcmp(), memchr(), memrchr(), str[n]cpy(), str[n]cat(), str[n]cmp(), strcoll(), str[n]dup(), strchr(), strrchr(), strstr(), */
                           /* strtok(), strcasestr(), memmem(), mempcpy(), str[n]len(), strerror(), bcopy(), bzero(), strcasecmp(), strsep(), basename(), */
#include <unistd.h>        /* for R_OK, W_OK, X_OK, F_OK, environ, access(), lseek(), close(), read(), write(), pipe(), alarm(), sleep(), ualarm(), usleep(), pause(), chown(), chdir(), getcwd(), */
                           /* for exec[...](), nice(), getpid(), getppid(), setpgid(), setsid(), getsid(), getuid(), geteuid(). getgid(), getegid(), setuid(), seteuid(), setgid(), setegid(), fork(), */
                           /* for link(), symlink(), readlink(), unlink(), rmdir(), getlogin(), setlogin(), gethostname(), sethostname(), daemon(), chroot(), getpass(), [f]sync(), [f]truncate(), syscall(), */
#include <errno.h>         /* for errno constant, error constants, */

#if defined(__WIN32__) || defined(WIN32) || defined(_WIN32)
  #define WIN32_LEAN_AND_MEAN
  #include <sys/stat.h>    /* for _dev_t, _gid_t, _ino_t, _mode_t, _off_t, stat(), */
#else
#if defined(HAVE_SYS_PARAM_H)
  #include <sys/param.h>   /* for NGROUPS used in sys/ucred.h, */
#endif
#if defined(HAVE_SYS_MOUNT_H)
  #include <sys/mount.h>   /* for struct statfs, statfs(), */
#endif
#if defined(HAVE_SYS_STATVFS_H)
  #include <sys/statvfs.h> /* for struct statvfs, statfs(), */
#endif
#if defined(HAVE_SYS_STATFS_H)
  #include <sys/statfs.h>  /* for struct statfs, statfs(), */
#endif
#endif



int main(int argc, char **argv) {
	char *self;
#if defined(__WIN32__) || defined(WIN32) || defined(_WIN32)
	/*DWORD VolumeSerialNumber     = 0;*/
	/*DWORD MaximumComponentLength = 0;*/
	/*DWORD FileSystemFlags        = 0;*/
	
	DWORD SectorsPerCluster     = 0;
	DWORD BytesPerSector        = 0;
	DWORD NumberOfFreeClusters  = 0;
	DWORD TotalNumberOfClusters = 0;
	
	double bytesfree  = 0; /* free space available  */
	double bytestotal = 0; /* total space available */
#else
	
#if defined(HAVE_SYS_STATVFS_H)
	struct statvfs statfsdata;
#endif
#if defined(HAVE_SYS_STATFS_H) || defined(HAVE_SYS_MOUNT_H)
	struct statfs statfsdata;
#endif
	
#endif
	
	
	
	self=strrchr(argv[0], '/');
	if (self!=NULL) self++;
	else self=argv[0];
	
	if (argc<2) {
		printf("Usage: %s <path/to/mountpoint>\n", argv[0]);
		return 0;
	}
	
	
	
#if defined(__WIN32__) || defined(WIN32) || defined(_WIN32)
	
	
	
	/*GetVolumeInformation(pathmntpoint, NULL, 0, &VolumeSerialNumber, &MaximumComponentLength, &FileSystemFlags, NULL, 0);*/
	/*printf("Serial number for drive C = %X\n\n",VolumeSerialNumber);*/
	
	/*BOOL WINAPI GetDiskFreeSpace(__in   LPCTSTR lpRootPathName, __out  LPDWORD lpSectorsPerCluster, __out  LPDWORD lpBytesPerSector, __out  LPDWORD lpNumberOfFreeClusters, __out  LPDWORD lpTotalNumberOfClusters);*/
	/*
	Return value
	If the function succeeds, the return value is nonzero.
	If the function fails, the return value is zero. To get extended error information, call GetLastError.
	*/
	
	if (GetDiskFreeSpace((LPCSTR)pathmntpoint, &SectorsPerCluster, &BytesPerSector, &NumberOfFreeClusters, &TotalNumberOfClusters)!=0) {
		bytestotal = (double)TotalNumberOfClusters * (double)SectorsPerCluster * (double)BytesPerSector;
		bytesfree  = (double)NumberOfFreeClusters  * (double)SectorsPerCluster * (double)BytesPerSector;
		
		printf("%s: BytesPerSector = %u\n", self, BytesPerSector);
		printf("%s: SectorsPerCluster = %u\n\n", self, SectorsPerCluster);
		printf("%s: Drive C Total Disk Space (bytestotal): %f bytes\n", self, bytestotal);
		printf("%s: Drive C Free  Disk Space (bytesfree ): %f bytes\n", self, bytesfree );
	} else {
		printf("%s: if (GetDiskFreeSpace((LPCSTR)pathmntpoint, &SectorsPerCluster, &BytesPerSector, &NumberOfFreeClusters, &TotalNumberOfClusters)!=0): else: Unable to GetDiskFreeSpace(), Reason: %d:%s\n", self, errno, strerror(errno));
	}
	
	
	
#else
	
	
	
#if defined(HAVE_SYS_STATVFS_H)
	if (statvfs(argv[1],&statfsdata)==0)
#endif
#if defined(HAVE_SYS_STATFS_H) || defined(HAVE_SYS_MOUNT_H)
	if (statfs(argv[1],&statfsdata)==0)
#endif
	{
		/*
		f_bsize*f_blocks            / 1024 / 1024 / 1024 = file system size
		f_bsize*f_bavail            / 1024 / 1024 / 1024 = file system free space
		f_bsize*(f_blocks-f_bavail) / 1024 / 1024 / 1024 = file system usage
		*/
#if defined(HAVE_SYS_STATVFS_H)
		printf("%s: if (statvfs(argv[1],&statfsdata)==0): Successful statvfs().\n", self);
		
		printf("%s: statfsdata.f_bavail=%lu /* Number of blocks */\n", self, (unsigned long int)statfsdata.f_bavail);
		printf("%s: statfsdata.f_bfree=%lu\n", self, (unsigned long int)statfsdata.f_bfree);
		printf("%s: statfsdata.f_blocks=%lu\n", self, (unsigned long int)statfsdata.f_blocks);
		printf("%s: statfsdata.f_favail=%lu /* Number of files (e.g., inodes) */\n", self, (unsigned long int)statfsdata.f_favail);
		printf("%s: statfsdata.f_ffree=%lu\n", self, (unsigned long int)statfsdata.f_ffree);
		printf("%s: statfsdata.f_files=%lu\n", self, (unsigned long int)statfsdata.f_files);
		
		printf("%s: statfsdata.f_bsize=%lu /* Size of blocks counted above */\n", self, statfsdata.f_bsize);
		printf("%s: statfsdata.f_flag=%lu\n", self, statfsdata.f_flag);
		printf("%s: statfsdata.f_frsize=%lu /* Size of fragments */\n", self, statfsdata.f_frsize);
		printf("%s: statfsdata.f_fsid=%lu /* Not meaningful */\n", self, statfsdata.f_fsid);
		printf("%s: statfsdata.f_namemax=%lu /* Same as pathconf(_PC_NAME_MAX) */\n", self, statfsdata.f_namemax);
		
		if (statfsdata.f_frsize) {
			printf("%s: (double)statfsdata.f_frsize * (double)statfsdata.f_blocks=%.0fB\n", self, (double)statfsdata.f_frsize * (double)statfsdata.f_blocks);
			printf("%s: (double)statfsdata.f_frsize * (double)statfsdata.f_blocks=%.3fkB\n", self, (double)statfsdata.f_frsize * (double)statfsdata.f_blocks / 1024.0);
			printf("%s: (double)statfsdata.f_frsize * (double)statfsdata.f_blocks=%.3fMB\n", self, (double)statfsdata.f_frsize * (double)statfsdata.f_blocks / 1024.0 / 1024.0);
			printf("%s: (double)statfsdata.f_frsize * (double)statfsdata.f_blocks=%.3fGB\n", self, (double)statfsdata.f_frsize * (double)statfsdata.f_blocks / 1024.0 / 1024.0 / 1024.0);
			
			printf("%s: (double)statfsdata.f_frsize * (double)statfsdata.f_bavail=%.0fB\n", self, (double)statfsdata.f_frsize * (double)statfsdata.f_bavail);
			printf("%s: (double)statfsdata.f_frsize * (double)statfsdata.f_bavail=%.3fkB\n", self, (double)statfsdata.f_frsize * (double)statfsdata.f_bavail / 1024.0);
			printf("%s: (double)statfsdata.f_frsize * (double)statfsdata.f_bavail=%.3fMB\n", self, (double)statfsdata.f_frsize * (double)statfsdata.f_bavail / 1024.0 / 1024.0);
			printf("%s: (double)statfsdata.f_frsize * (double)statfsdata.f_bavail=%.3fGB\n", self, (double)statfsdata.f_frsize * (double)statfsdata.f_bavail / 1024.0 / 1024.0 / 1024.0);
		} else {
			printf("%s: (double)statfsdata.f_bsize * (double)statfsdata.f_blocks=%.0fB\n", self, (double)statfsdata.f_bsize * (double)statfsdata.f_blocks);
			printf("%s: (double)statfsdata.f_bsize * (double)statfsdata.f_blocks=%.3fkB\n", self, (double)statfsdata.f_bsize * (double)statfsdata.f_blocks / 1024.0);
			printf("%s: (double)statfsdata.f_bsize * (double)statfsdata.f_blocks=%.3fMB\n", self, (double)statfsdata.f_bsize * (double)statfsdata.f_blocks / 1024.0 / 1024.0);
			printf("%s: (double)statfsdata.f_bsize * (double)statfsdata.f_blocks=%.3fGB\n", self, (double)statfsdata.f_bsize * (double)statfsdata.f_blocks / 1024.0 / 1024.0 / 1024.0);
			
			printf("%s: (double)statfsdata.f_bsize * (double)statfsdata.f_bavail=%.0fB\n", self, (double)statfsdata.f_bsize * (double)statfsdata.f_bavail);
			printf("%s: (double)statfsdata.f_bsize * (double)statfsdata.f_bavail=%.3fkB\n", self, (double)statfsdata.f_bsize * (double)statfsdata.f_bavail / 1024.0);
			printf("%s: (double)statfsdata.f_bsize * (double)statfsdata.f_bavail=%.3fMB\n", self, (double)statfsdata.f_bsize * (double)statfsdata.f_bavail / 1024.0 / 1024.0);
			printf("%s: (double)statfsdata.f_bsize * (double)statfsdata.f_bavail=%.3fGB\n", self, (double)statfsdata.f_bsize * (double)statfsdata.f_bavail / 1024.0 / 1024.0 / 1024.0);
		}
#endif
#if defined(HAVE_SYS_STATFS_H) || defined(HAVE_SYS_MOUNT_H)
		printf("%s: if (statfs(argv[1],&statfsdata)==0): Successful statfs().\n", self);
		
#if defined(HAVE_SYS_STATFS_H)
		printf("%s: statfsdata.f_type=%d\n", self, statfsdata.f_type);
#endif
		printf("%s: statfsdata.f_bsize=%d\n", self, statfsdata.f_bsize);
		printf("%s: statfsdata.f_blocks=%u\n", self, (unsigned int)statfsdata.f_blocks); /* CAST (unsigned int) need on Linux */
		printf("%s: statfsdata.f_bfree=%u\n", self, (unsigned int)statfsdata.f_bfree); /* CAST (unsigned int) need on Linux */
		printf("%s: statfsdata.f_bavail=%d\n", self, (int)statfsdata.f_bavail); /* CAST (int) need on Linux */
		printf("%s: statfsdata.f_files=%u\n", self, (unsigned int)statfsdata.f_files); /* CAST (unsigned int) need on Linux */
		printf("%s: statfsdata.f_ffree=%u\n", self, (unsigned int)statfsdata.f_ffree); /* CAST (unsigned int) need on Linux */
#if defined(HAVE_SYS_STATFS_H)
		printf("%s: statfsdata.f_fsid.__val[0]=%d\n", self, statfsdata.f_fsid.__val[0]);
		printf("%s: statfsdata.f_fsid.__val[1]=%d\n", self, statfsdata.f_fsid.__val[1]);
#endif
#if defined(HAVE_SYS_MOUNT_H)
		printf("%s: statfsdata.f_fsid.val[0]=%d\n", self, statfsdata.f_fsid.val[0]);
		printf("%s: statfsdata.f_fsid.val[1]=%d\n", self, statfsdata.f_fsid.val[1]);
#endif
#if defined(HAVE_SYS_STATFS_H)
		printf("%s: statfsdata.f_namelen=%d\n", self, statfsdata.f_namelen);
#endif
#if defined(HAVE_SYS_STATFS_H)
		printf("%s: statfsdata.f_frsize=%d\n", self, statfsdata.f_frsize);
#endif
		printf("%s: statfsdata.f_spare[0]=%d\n", self, statfsdata.f_spare[0]);
		printf("%s: statfsdata.f_spare[1]=%d\n", self, statfsdata.f_spare[1]);
		printf("%s: statfsdata.f_spare[2]=%d\n", self, statfsdata.f_spare[2]);
		printf("%s: statfsdata.f_spare[3]=%d\n", self, statfsdata.f_spare[3]);
		printf("%s: statfsdata.f_spare[4]=%d\n", self, statfsdata.f_spare[4]);
		
		printf("%s: (double)statfsdata.f_bsize * (double)statfsdata.f_blocks=%.0fB\n", self, (double)statfsdata.f_bsize * (double)statfsdata.f_blocks);
		printf("%s: (double)statfsdata.f_bsize * (double)statfsdata.f_blocks=%.3fkB\n", self, (double)statfsdata.f_bsize * (double)statfsdata.f_blocks / 1024.0);
		printf("%s: (double)statfsdata.f_bsize * (double)statfsdata.f_blocks=%.3fMB\n", self, (double)statfsdata.f_bsize * (double)statfsdata.f_blocks / 1024.0 / 1024.0);
		printf("%s: (double)statfsdata.f_bsize * (double)statfsdata.f_blocks=%.3fGB\n", self, (double)statfsdata.f_bsize * (double)statfsdata.f_blocks / 1024.0 / 1024.0 / 1024.0);
		
		printf("%s: (double)statfsdata.f_bsize * (double)statfsdata.f_bavail=%.0fB\n", self, (double)statfsdata.f_bsize * (double)statfsdata.f_bavail);
		printf("%s: (double)statfsdata.f_bsize * (double)statfsdata.f_bavail=%.3fkB\n", self, (double)statfsdata.f_bsize * (double)statfsdata.f_bavail / 1024.0);
		printf("%s: (double)statfsdata.f_bsize * (double)statfsdata.f_bavail=%.3fMB\n", self, (double)statfsdata.f_bsize * (double)statfsdata.f_bavail / 1024.0 / 1024.0);
		printf("%s: (double)statfsdata.f_bsize * (double)statfsdata.f_bavail=%.3fGB\n", self, (double)statfsdata.f_bsize * (double)statfsdata.f_bavail / 1024.0 / 1024.0 / 1024.0);
		
#endif
	} else {
#if defined(HAVE_SYS_STATVFS_H)
		printf("%s: if (statvfs(argv[1],&statfsdata)==0): else: Unable to statvfs(), Reason: %d:%s\n", self, errno, strerror(errno));
#endif
#if defined(HAVE_SYS_STATFS_H) || defined(HAVE_SYS_MOUNT_H)
		printf("%s: if (statfs(argv[1],&statfsdata)==0): else: Unable to statfs(), Reason: %d:%s\n", self, errno, strerror(errno));
#endif
	}
	
	
	
#endif
	
	return 0;
}

program należy skompilować komendą make (jako argument należy podać plik Makefile zależny od systemu operacyjnego, domyślnie make próbuje użyć pliku Makefile):
make clean all # system Linux
make -f Makefile clean all # system Linux
make -f Makefile.obsd clean all # system OpenBSD
make -f Makefile.fbsd clean all # system FreeBSD
make -f Makefile.sol clean all # system Solaris
make -f Makefile.beos clean all # system BeOS
make -f Makefile.win clean all # system Windows

a następnie uruchomić bez argumentów:
/home/local/code/ansiccode/sysfile/statfs
program wyświetli informacje o sposobie uruchamiania programu:
Usage: /home/local/code/ansiccode/sysfile/statfs <path/to/mountpoint>

jako argument wywołania programu można podać analogiczne jak poniżej argumenty:
/home/local/code/ansiccode/sysfile/statfs /
rezultat będzie zależny od podanych argumentów wywołania programu:
statfs: if (statfs(argv[1],&statfsdata)==0): Successful statfs().
statfs: statfsdata.f_type=61267
statfs: statfsdata.f_bsize=4096
statfs: statfsdata.f_blocks=3890400
statfs: statfsdata.f_bfree=2618759
statfs: statfsdata.f_bavail=2578597
statfs: statfsdata.f_files=4018656
statfs: statfsdata.f_ffree=3891205
statfs: statfsdata.f_fsid.__val[0]=0
statfs: statfsdata.f_fsid.__val[1]=0
statfs: statfsdata.f_namelen=255
statfs: statfsdata.f_frsize=4096
statfs: statfsdata.f_spare[0]=0
statfs: statfsdata.f_spare[1]=0
statfs: statfsdata.f_spare[2]=0
statfs: statfsdata.f_spare[3]=0
statfs: statfsdata.f_spare[4]=0
statfs: (double)statfsdata.f_bsize * (double)statfsdata.f_blocks=15935078400B
statfs: (double)statfsdata.f_bsize * (double)statfsdata.f_blocks=15561600.000kB
statfs: (double)statfsdata.f_bsize * (double)statfsdata.f_blocks=15196.875MB
statfs: (double)statfsdata.f_bsize * (double)statfsdata.f_blocks=14.841GB
statfs: (double)statfsdata.f_bsize * (double)statfsdata.f_bavail=10561933312B
statfs: (double)statfsdata.f_bsize * (double)statfsdata.f_bavail=10314388.000kB
statfs: (double)statfsdata.f_bsize * (double)statfsdata.f_bavail=10072.645MB
statfs: (double)statfsdata.f_bsize * (double)statfsdata.f_bavail=9.837GB



#top statvfs


Documentacja online: pubs.opengroup.org | www.cplusplus.com | pl.wikibooks.org

Deklaracja funkcji statvfs() znajduje się w pliku nagłówkowym sys/statvfs.h.
Deklaracja funkcji statvfs() jest następująca:
int statvfs(const char *__restrict, struct statvfs *__restrict);

Powiązane:
access(), faccessat(), fstat(), fstatat(), lstat(), stat(), statfs(), statvfs(),

Opis:
Funkcja statvfs()

Argumenty:
const char *__restrict -
struct statvfs *__restrict -

Zwracana wartość:
int -




Documentacja online: pubs.opengroup.org | www.cplusplus.com | pl.wikibooks.org

Deklaracja funkcji symlink() znajduje się w pliku nagłówkowym unistd.h.
Deklaracja funkcji symlink() jest następująca:
/* Make a symbolic link to FROM named TO.  */
extern int symlink (__const char *__from, __const char *__to)
     __THROW __nonnull ((1, 2)) __wur;

Powiązane:
link(), linkat(), readlink(), readlinkat(), symlink(), symlinkat(),

Opis:
Funkcja symlink()

Argumenty:
const char *__from -
const char *__to -

Zwracana wartość:
int -

Example:
zawartość pliku symlink.c
SELECT ALL
#define  _GNU_SOURCE  1    /* for environ defined in unistd.h, to avoid warning implicit declaration of function basename, which defined in string.h */
#include <stdio.h>         /* for FILE, va_list, EOF, SEEK_SET, SEEK_CUR, SEEK_END, stdin, stdout, stderr, remove(), rename(), tmpfile(), tmpnam(), tempnam(), fclose(), */
                           /* fflush(), fopen(), freopen(), fprintf(), printf(), snprintf(), scanf(), sscanf(), fgetc(), getc(), getchar(), fputc(), putc(), putchar(), */
                           /* fgets(), gets(), fputs(), puts(), fread(), fwrite(), fseek(), ftell(), rewind(), feof(), ferror(), fileno(), popen(), pclose(), */
#include <string.h>        /* for memcpy(), memmove(), memset(), memcmp(), memchr(), memrchr(), str[n]cpy(), str[n]cat(), str[n]cmp(), strcoll(), str[n]dup(), strchr(), strrchr(), strstr(), */
                           /* strtok(), strcasestr(), memmem(), mempcpy(), str[n]len(), strerror(), bcopy(), bzero(), strcasecmp(), strsep(), basename(), */
#include <unistd.h>        /* for R_OK, W_OK, X_OK, F_OK, environ, access(), lseek(), close(), read(), write(), pipe(), alarm(), sleep(), ualarm(), usleep(), pause(), chown(), chdir(), getcwd(), */
                           /* for exec[...](), nice(), getpid(), getppid(), setpgid(), setsid(), getsid(), getuid(), geteuid(). getgid(), getegid(), setuid(), seteuid(), setgid(), setegid(), fork(), */
                           /* for link(), symlink(), readlink(), unlink(), rmdir(), getlogin(), setlogin(), gethostname(), sethostname(), daemon(), chroot(), getpass(), [f]sync(), [f]truncate(), syscall(), */
#include <errno.h>         /* for errno constant, error constants, */



int main(int argc, char **argv) {
	char *self;
#if defined(__WIN32__) || defined(WIN32) || defined(_WIN32)
#else
	int result;
#endif
	
	self=strrchr(argv[0], '/');
	if (self!=NULL) self++;
	else self=argv[0];
	
	if (argc<3) {
		printf("Usage: %s </path/to/filename> </path/to/(new-sym)link>\n", argv[0]);
		return 0;
	}
	
#if defined(__WIN32__) || defined(WIN32) || defined(_WIN32)
	/* symlink() is not available on this OS platform !!! */
	printf("%s: symlink() is not available on this OS platform !!!\n", self);
#else
	result=symlink(argv[1], argv[2]);
	if (result>=0) printf("%s: result=symlink(argv[1]=%s, argv[2]=%s): result=%d if (result>=0): Successful symlink().\n", self, argv[1], argv[2], result);
	else           printf("%s: result=symlink(argv[1]=%s, argv[2]=%s): result=%d if (result>=0): else: Unable to symlink (), Reason: %d:%s\n", self, argv[1], argv[2], result, errno, strerror(errno));
#endif
	return 0;
}

program należy skompilować komendą make (jako argument należy podać plik Makefile zależny od systemu operacyjnego, domyślnie make próbuje użyć pliku Makefile):
make clean all # system Linux
make -f Makefile clean all # system Linux
make -f Makefile.obsd clean all # system OpenBSD
make -f Makefile.fbsd clean all # system FreeBSD
make -f Makefile.sol clean all # system Solaris
make -f Makefile.beos clean all # system BeOS
make -f Makefile.win clean all # system Windows

a następnie uruchomić bez argumentów:
/home/local/code/ansiccode/sysfile/symlink
program wyświetli informacje o sposobie uruchamiania programu:
Usage: /home/local/code/ansiccode/sysfile/symlink </path/to/filename> </path/to/(new-sym)link>

jako argument wywołania programu można podać analogiczne jak poniżej argumenty:
/home/local/code/ansiccode/sysfile/symlink /home/local/code/ansiccode/sysfile/symlink /home/local/code/ansiccode/sysfile/symlink-test
rezultat będzie zależny od podanych argumentów wywołania programu:
symlink: result=symlink(argv[1]=/home/local/code/ansiccode/sysfile/symlink, argv[2]=/home/local/code/ansiccode/sysfile/symlink-test): result=0 if (result>=0): Successful symlink().
oraz zostanie utworzone dowiązalnie symboliczne ls -l /home/local/code/ansiccode/sysfile/symlink-test:
lrwxrwxrwx 1 user users 42 Oct 31 01:17 /home/local/code/ansiccode/sysfile/symlink-test -> /home/local/code/ansiccode/sysfile/symlink*



#top symlinkat


Documentacja online: pubs.opengroup.org | www.cplusplus.com | pl.wikibooks.org

Deklaracja funkcji symlinkat() znajduje się w pliku nagłówkowym unistd.h.
Deklaracja funkcji symlinkat() jest następująca:
#ifdef __USE_ATFILE
/* Like symlink but a relative path in TO is interpreted relative to TOFD.  */
extern int symlinkat (__const char *__from, int __tofd,
              __const char *__to) __THROW __nonnull ((1, 3)) __wur;
#endif

Powiązane:
link(), linkat(), readlink(), readlinkat(), symlink(), symlinkat(),

Opis:
Funkcja symlinkat()

Argumenty:
const char *__from -
int __tofd -
const char *__to -

Zwracana wartość:
int -



#top sync


Documentacja online: pubs.opengroup.org | www.cplusplus.com | pl.wikibooks.org

Deklaracja funkcji sync() znajduje się w pliku nagłówkowym unistd.h.
Deklaracja funkcji sync() jest następująca:
/* Make all changes done to all files actually appear on disk.  */
extern void sync (void) __THROW;

Powiązane:
fdatasync(), fflush(), fsync(), sync(),

Opis:
Funkcja sync()

Argumenty:
Funkcja nie przyjmuje żadnych argumentów.

Zwracana wartość:
Funkcja nie zwraca żadnej wartości.

Example:
zawartość pliku sync.c
SELECT ALL
#define  _GNU_SOURCE  1    /* for environ defined in unistd.h, to avoid warning implicit declaration of function basename, which defined in string.h */
#include <stdio.h>         /* for FILE, va_list, EOF, SEEK_SET, SEEK_CUR, SEEK_END, stdin, stdout, stderr, remove(), rename(), tmpfile(), tmpnam(), tempnam(), fclose(), */
                           /* fflush(), fopen(), freopen(), fprintf(), printf(), snprintf(), scanf(), sscanf(), fgetc(), getc(), getchar(), fputc(), putc(), putchar(), */
                           /* fgets(), gets(), fputs(), puts(), fread(), fwrite(), fseek(), ftell(), rewind(), feof(), ferror(), fileno(), popen(), pclose(), */
#include <string.h>        /* for memcpy(), memmove(), memset(), memcmp(), memchr(), memrchr(), str[n]cpy(), str[n]cat(), str[n]cmp(), strcoll(), str[n]dup(), strchr(), strrchr(), strstr(), */
                           /* strtok(), strcasestr(), memmem(), mempcpy(), str[n]len(), strerror(), bcopy(), bzero(), strcasecmp(), strsep(), basename(), */
#include <unistd.h>        /* for R_OK, W_OK, X_OK, F_OK, environ, access(), lseek(), close(), read(), write(), pipe(), alarm(), sleep(), ualarm(), usleep(), pause(), chown(), chdir(), getcwd(), */
                           /* for exec[...](), nice(), getpid(), getppid(), setpgid(), setsid(), getsid(), getuid(), geteuid(). getgid(), getegid(), setuid(), seteuid(), setgid(), setegid(), fork(), */
                           /* for link(), symlink(), readlink(), unlink(), rmdir(), getlogin(), setlogin(), gethostname(), sethostname(), daemon(), chroot(), getpass(), [f]sync(), [f]truncate(), syscall(), */



int main(int argc, char **argv) {
	char *self;
	
	self=strrchr(argv[0], '/');
	if (self!=NULL) self++;
	else self=argv[0];
	
	if (argc<1) {
		printf("Usage: %s\n", argv[0]);
		return 0;
	}
	
#if defined(__WIN32__) || defined(WIN32) || defined(_WIN32)
	/* sync() is not available on this OS platform !!! */
	printf("%s: sync() is not available on this OS platform !!!\n", self);
#else
	printf("%s: sync(): call...\n", self);
	sync();
	printf("%s: sync(): end.\n", self);
#endif
	
	return 0;
}

program należy skompilować komendą make (jako argument należy podać plik Makefile zależny od systemu operacyjnego, domyślnie make próbuje użyć pliku Makefile):
make clean all # system Linux
make -f Makefile clean all # system Linux
make -f Makefile.obsd clean all # system OpenBSD
make -f Makefile.fbsd clean all # system FreeBSD
make -f Makefile.sol clean all # system Solaris
make -f Makefile.beos clean all # system BeOS
make -f Makefile.win clean all # system Windows

a następnie uruchomić bez argumentów:
/home/local/code/ansiccode/sysfile/sync
program wyświetli stosowne informacje o sposobie działania:
/home/local/code/ansiccode/sysfile/sync: sync(): call...
/home/local/code/ansiccode/sysfile/sync: sync(): end.
Aby lepiej zrozumieć znaczenie i działanie sync() należy podłączyć urządzenie pamięci przenośnej Pendrive, następnie umieścić jeden lub kilka plików o sumarycznej wielkości co najmniej kilka MegaBajtów po czym wywołać program /home/local/code/ansiccode/sysfile/sync, wtedy działanie będzie bardziej dostrzegalne: po uruchomieniu program przez kilkanaście sekund będzie oczekiwał na zakończenie syscall sync() oraz jednocześnie urządzenie pamięci przenośnej Pendrive będzie sygnalizować migającą diodą zapisywanie danych.



#top tempnam


Documentacja online: pubs.opengroup.org | www.cplusplus.com | pl.wikibooks.org

Deklaracja funkcji tempnam() znajduje się w pliku nagłówkowym stdio.h.
Deklaracja funkcji tempnam() jest następująca:
/* Generate a unique temporary filename using up to five characters of PFX
   if it is not NULL.  The directory to put this file in is searched for
   as follows: First the environment variable "TMPDIR" is checked.
   If it contains the name of a writable directory, that directory is used.
   If not and if DIR is not NULL, that value is checked.  If that fails,
   P_tmpdir is tried and finally "/tmp".  The storage for the filename
   is allocated by 'malloc'.  */
extern char *tempnam (__const char *__dir, __const char *__pfx)
     __THROW __attribute_malloc__;

Powiązane:
mkdtemp(), mkstemp(), mktemp(), tempnam(), tmpfile(), tmpnam(),

Opis:
Funkcja tempnam()

Argumenty:
const char *__dir -
const char *__pfx -

Zwracana wartość:
char * -

Example:
zawartość pliku tempnam.c
SELECT ALL
#define  _GNU_SOURCE  1    /* for environ defined in unistd.h, to avoid warning implicit declaration of function basename, which defined in string.h */
#include <stdio.h>         /* for FILE, va_list, EOF, SEEK_SET, SEEK_CUR, SEEK_END, stdin, stdout, stderr, remove(), rename(), tmpfile(), tmpnam(), tempnam(), fclose(), */
                           /* fflush(), fopen(), freopen(), fprintf(), printf(), snprintf(), scanf(), sscanf(), fgetc(), getc(), getchar(), fputc(), putc(), putchar(), */
                           /* fgets(), gets(), fputs(), puts(), fread(), fwrite(), fseek(), ftell(), rewind(), feof(), ferror(), fileno(), popen(), pclose(), */
#include <string.h>        /* for memcpy(), memmove(), memset(), memcmp(), memchr(), memrchr(), str[n]cpy(), str[n]cat(), str[n]cmp(), strcoll(), str[n]dup(), strchr(), strrchr(), strstr(), */
                           /* strtok(), strcasestr(), memmem(), mempcpy(), str[n]len(), strerror(), bcopy(), bzero(), strcasecmp(), strsep(), basename(), */
#include <errno.h>         /* for errno constant, error constants, */



int main(int argc, char **argv) {
	char *self;
	char *tempname1, *tempname2;
	
	self=strrchr(argv[0], '/');
	if (self!=NULL) self++;
	else self=argv[0];
	
	if (argc<3) {
		printf("Usage: %s </path/to/dir> < prefix >\n", argv[0]);
		return 0;
	}
	
	tempname1=tempnam(NULL, argv[2]);
	printf("%s: tempname1=tempnam(NULL, prefix=%s): tempfile1='%s'\n", self, argv[2], tempname1);
	
	tempname2=tempnam(argv[1], argv[2]);
	printf("%s: tempname2=tempnam(pathdir=%s, prefix=%s): tempfile2='%s'\n", self, argv[1], argv[2], tempname2);
	
	return 0;
}

</pre>
program należy skompilować komendą make (jako argument należy podać plik Makefile zależny od systemu operacyjnego, domyślnie make próbuje użyć pliku Makefile):
make clean all # system Linux
make -f Makefile clean all # system Linux
make -f Makefile.obsd clean all # system OpenBSD
make -f Makefile.fbsd clean all # system FreeBSD
make -f Makefile.sol clean all # system Solaris
make -f Makefile.beos clean all # system BeOS
make -f Makefile.win clean all # system Windows

a następnie uruchomić bez argumentów:
/home/local/code/ansiccode/sysfile/tempnam
program wyświetli informacje o sposobie uruchamiania programu:
Usage: /home/local/code/ansiccode/sysfile/tempnam </path/to/dir> < prefix >

jako argument wywołania programu można podać analogiczne jak poniżej argumenty:
/home/local/code/ansiccode/sysfile/tempnam /tmp prefix
rezultat będzie zależny od podanych argumentów wywołania programu:
tempnam: tempname1=tempnam(NULL, prefix=prefix): tempfile1='/tmp/prefiQRfCcv'
tempnam: tempname2=tempnam(pathdir=/tmp, prefix=prefix): tempfile2='/tmp/prefivDgzWl'



#top tmpfile


Documentacja online: pubs.opengroup.org | www.cplusplus.com | pl.wikibooks.org

Deklaracja funkcji tmpfile() znajduje się w pliku nagłówkowym stdio.h.
Deklaracja funkcji tmpfile() jest następująca:
/* Create a temporary file and open it read/write.

   This function is a possible cancellation points and therefore not
   marked with __THROW.  */
extern FILE *tmpfile (void);

Powiązane:
mkdtemp(), mkstemp(), mktemp(), tempnam(), tmpfile(), tmpnam(),

Opis:
Funkcja tmpfile()

Argumenty:
Funkcja nie przyjmuje żadnych argumentów.

Zwracana wartość:
FILE * -

Example:
zawartość pliku tmpfile.c
SELECT ALL
#define  _GNU_SOURCE  1    /* for environ defined in unistd.h, to avoid warning implicit declaration of function basename, which defined in string.h */
#include <stdio.h>         /* for FILE, va_list, EOF, SEEK_SET, SEEK_CUR, SEEK_END, stdin, stdout, stderr, remove(), rename(), tmpfile(), tmpnam(), tempnam(), fclose(), */
                           /* fflush(), fopen(), freopen(), fprintf(), printf(), snprintf(), scanf(), sscanf(), fgetc(), getc(), getchar(), fputc(), putc(), putchar(), */
                           /* fgets(), gets(), fputs(), puts(), fread(), fwrite(), fseek(), ftell(), rewind(), feof(), ferror(), fileno(), popen(), pclose(), */
#include <string.h>        /* for memcpy(), memmove(), memset(), memcmp(), memchr(), memrchr(), str[n]cpy(), str[n]cat(), str[n]cmp(), strcoll(), str[n]dup(), strchr(), strrchr(), strstr(), */
                           /* strtok(), strcasestr(), memmem(), mempcpy(), str[n]len(), strerror(), bcopy(), bzero(), strcasecmp(), strsep(), basename(), */
#include <errno.h>         /* for errno constant, error constants, */



int main(int argc, char **argv) {
	char *self;
	FILE *temp;
	char buffer[1024];
	
	self=strrchr(argv[0], '/');
	if (self!=NULL) self++;
	else self=argv[0];
	
	if (argc<1) {
		printf("Usage: %s\n", argv[0]);
		return 0;
	}
	
	temp=tmpfile();
	if (temp!=NULL) {
		printf("%s: temp=tmpfile(): if (temp!=NULL): Successful tmpfile().\n", self);
		fputs("tmpfile:line1\n", temp);
		fputs("tmpfile:line2\n", temp);
		fputs("tmpfile:line3\n", temp);
		rewind(temp);
		while (!feof(temp)) {
			if (fgets(buffer,256,temp)!=NULL) fputs(buffer, stdout);
			else break;
		}
		fclose(temp);
	} else {
		printf("%s: temp=tmpfile(): if (temp!=NULL): else: Unable to tmpfile(), Reason: %d:%s\n", self, errno, strerror(errno));
	}
	
	return 0;
}

program należy skompilować komendą make (jako argument należy podać plik Makefile zależny od systemu operacyjnego, domyślnie make próbuje użyć pliku Makefile):
make clean all # system Linux
make -f Makefile clean all # system Linux
make -f Makefile.obsd clean all # system OpenBSD
make -f Makefile.fbsd clean all # system FreeBSD
make -f Makefile.sol clean all # system Solaris
make -f Makefile.beos clean all # system BeOS
make -f Makefile.win clean all # system Windows

a następnie uruchomić bez argumentów:
/home/local/code/ansiccode/sysfile/tmpfile
program wyświetli stosowne informacje o sposobie działania:
tmpfile: temp=tmpfile(): if (temp!=NULL): Successful tmpfile().
tmpfile:line1
tmpfile:line2
tmpfile:line3



#top tmpnam


Documentacja online: pubs.opengroup.org | www.cplusplus.com | pl.wikibooks.org

Deklaracja funkcji tmpnam() znajduje się w pliku nagłówkowym stdio.h.
Deklaracja funkcji tmpnam() jest następująca:
/* Generate a temporary filename.  */
extern char *tmpnam (char *__s) __THROW;

Powiązane:
mkdtemp(), mkstemp(), mktemp(), tempnam(), tmpfile(), tmpnam(),

Opis:
Funkcja tmpnam()

Argumenty:
char *__s -

Zwracana wartość:
char * -

Example:
zawartość pliku tmpnam.c
SELECT ALL
#define  _GNU_SOURCE  1    /* for environ defined in unistd.h, to avoid warning implicit declaration of function basename, which defined in string.h */
#include <stdio.h>         /* for FILE, va_list, EOF, SEEK_SET, SEEK_CUR, SEEK_END, stdin, stdout, stderr, remove(), rename(), tmpfile(), tmpnam(), tempnam(), fclose(), */
                           /* fflush(), fopen(), freopen(), fprintf(), printf(), snprintf(), scanf(), sscanf(), fgetc(), getc(), getchar(), fputc(), putc(), putchar(), */
                           /* fgets(), gets(), fputs(), puts(), fread(), fwrite(), fseek(), ftell(), rewind(), feof(), ferror(), fileno(), popen(), pclose(), */
#include <string.h>        /* for memcpy(), memmove(), memset(), memcmp(), memchr(), memrchr(), str[n]cpy(), str[n]cat(), str[n]cmp(), strcoll(), str[n]dup(), strchr(), strrchr(), strstr(), */
                           /* strtok(), strcasestr(), memmem(), mempcpy(), str[n]len(), strerror(), bcopy(), bzero(), strcasecmp(), strsep(), basename(), */
#include <errno.h>         /* for errno constant, error constants, */



int main(int argc, char **argv) {
	char *self;
	char buffer[L_tmpnam];
	char *pointer;
	
	self=strrchr(argv[0], '/');
	if (self!=NULL) self++;
	else self=argv[0];
	
	if (argc<1) {
		printf("Usage: %s\n", argv[0]);
		return 0;
	}
	
	tmpnam(buffer);
	printf("%s: tmpnam(buffer): buffer='%s'\n", self, buffer);
	
	pointer=tmpnam(NULL);
	printf("%s: pointer=tmpnam(NULL): pointer='%s'\n", self, pointer);
	
	return 0;
}

program należy skompilować komendą make (jako argument należy podać plik Makefile zależny od systemu operacyjnego, domyślnie make próbuje użyć pliku Makefile):
make clean all # system Linux
make -f Makefile clean all # system Linux
make -f Makefile.obsd clean all # system OpenBSD
make -f Makefile.fbsd clean all # system FreeBSD
make -f Makefile.sol clean all # system Solaris
make -f Makefile.beos clean all # system BeOS
make -f Makefile.win clean all # system Windows

a następnie uruchomić bez argumentów:
/home/local/code/ansiccode/sysfile/tmpnam
program wyświetli stosowne informacje o sposobie działania:
tmpnam: tmpnam(buffer): buffer='/tmp/fileoA11S4'
tmpnam: pointer=tmpnam(NULL): pointer='/tmp/filecuBbFG'



#top truncate


Documentacja online: pubs.opengroup.org | www.cplusplus.com | pl.wikibooks.org

Deklaracja funkcji truncate() znajduje się w pliku nagłówkowym unistd.h.
Deklaracja funkcji truncate() jest następująca:
/* Truncate FILE to LENGTH bytes.  */
extern int truncate (__const char *__file, __off_t __length)
     __THROW __nonnull ((1)) __wur;

Powiązane:
ftruncate(), truncate(),

Opis:
Funkcja truncate()

Argumenty:
const char *__file -
__off_t __length -

Zwracana wartość:
int -

Example:
zawartość pliku truncate.c
SELECT ALL
#define  _GNU_SOURCE  1    /* for environ defined in unistd.h, to avoid warning implicit declaration of function basename, which defined in string.h */
#include <stdio.h>         /* for FILE, va_list, EOF, SEEK_SET, SEEK_CUR, SEEK_END, stdin, stdout, stderr, remove(), rename(), tmpfile(), tmpnam(), tempnam(), fclose(), */
                           /* fflush(), fopen(), freopen(), fprintf(), printf(), snprintf(), scanf(), sscanf(), fgetc(), getc(), getchar(), fputc(), putc(), putchar(), */
                           /* fgets(), gets(), fputs(), puts(), fread(), fwrite(), fseek(), ftell(), rewind(), feof(), ferror(), fileno(), popen(), pclose(), */
#include <stdlib.h>        /* for RAND_MAX, EXIT_FAILURE, EXIT_SUCCESS, MB_CUR_MAX, atoi(), atol(), atoll(), atof(), strtod(), strtof(), strtold(), strtol(), strtoul(), strtoq(), strtouq(), strtoll(), strtoull(), */
                           /* for sys/types.h, malloc.h replaced by stdlib.h, random(), srandom(), rand(), srand(), abort(), atexit(), on_exit(), exit(), getenv(), */
                           /* for putenv(), setenv(), clearenv(), mktemp(), mkstemp(), mkdtemp(), system(), realpath(), abs(), labs(), llabs(), getloadavg(), */
#include <string.h>        /* for memcpy(), memmove(), memset(), memcmp(), memchr(), memrchr(), str[n]cpy(), str[n]cat(), str[n]cmp(), strcoll(), str[n]dup(), strchr(), strrchr(), strstr(), */
                           /* strtok(), strcasestr(), memmem(), mempcpy(), str[n]len(), strerror(), bcopy(), bzero(), strcasecmp(), strsep(), basename(), */
#include <unistd.h>        /* for R_OK, W_OK, X_OK, F_OK, environ, access(), lseek(), close(), read(), write(), pipe(), alarm(), sleep(), ualarm(), usleep(), pause(), chown(), chdir(), getcwd(), */
                           /* for exec[...](), nice(), getpid(), getppid(), setpgid(), setsid(), getsid(), getuid(), geteuid(). getgid(), getegid(), setuid(), seteuid(), setgid(), setegid(), fork(), */
                           /* for link(), symlink(), readlink(), unlink(), rmdir(), getlogin(), setlogin(), gethostname(), sethostname(), daemon(), chroot(), getpass(), [f]sync(), [f]truncate(), syscall(), */
#include <errno.h>         /* for errno constant, error constants, */



int main(int argc, char **argv) {
	char *self;
	int truncsize;
#if defined(__WIN32__) || defined(WIN32) || defined(_WIN32)
#else
	int result;
#endif
	
	self=strrchr(argv[0], '/');
	if (self!=NULL) self++;
	else self=argv[0];
	
	if (argc<3) {
		printf("Usage: %s </path/to/filename> <truncate-size>\n", argv[0]);
		return 0;
	}
	
	truncsize=atoi(argv[2]);
#if defined(__WIN32__) || defined(WIN32) || defined(_WIN32)
	/* truncate() is not available on this OS platform !!! */
	printf("%s: truncate() is not available on this OS platform !!!\n", self);
#else
	result=truncate(argv[1], truncsize);
	if (result>=0) printf("%s: result=truncate(argv[1]=%s, truncsize=%d): result=%d if (result>=0): Successful truncate() file.\n", self, argv[1], truncsize, result);
	else           printf("%s: result=truncate(argv[1]=%s, truncsize=%d): result=%d if (result>=0): else: Unable to truncate() file, Reason: %d:%s\n", self, argv[1], truncsize, result, errno, strerror(errno));
#endif
	return 0;
}

program należy skompilować komendą make (jako argument należy podać plik Makefile zależny od systemu operacyjnego, domyślnie make próbuje użyć pliku Makefile):
make clean all # system Linux
make -f Makefile clean all # system Linux
make -f Makefile.obsd clean all # system OpenBSD
make -f Makefile.fbsd clean all # system FreeBSD
make -f Makefile.sol clean all # system Solaris
make -f Makefile.beos clean all # system BeOS
make -f Makefile.win clean all # system Windows

a następnie uruchomić bez argumentów:
/home/local/code/ansiccode/sysfile/truncate
program wyświetli informacje o sposobie uruchamiania programu:
Usage: /home/local/code/ansiccode/sysfile/truncate </path/to/filename> <truncate-size>

jako argument wywołania programu można podać analogiczne jak poniżej argumenty:
/home/local/code/ansiccode/sysfile/truncate /home/local/code/ansiccode/sysfile/truncate-test 10
rezultat będzie zależny od podanych argumentów wywołania programu:
truncate: result=truncate(argv[1]=/home/local/code/ansiccode/sysfile/truncate-test, truncsize=10): result=-1 if (result>=0): else: Unable to truncate() file, Reason: 2:No such file or directory

następnie należy utworzyć przykładowy plik poleceniem echo -en "/home/local/code/ansiccode/sysfile/truncate-test" > /home/local/code/ansiccode/sysfile/truncate-test:
oraz wyświetlić informacje o utworzonym pliku poleceniem ls -l /home/local/code/ansiccode/sysfile/truncate-test:
-rw-r--r-- 1 user users 48 Oct 31 01:25 /home/local/code/ansiccode/sysfile/truncate-test
po czym ponownie uruchomić program z tymi samymi argumentami jak poprzednim przypadku:
/home/local/code/ansiccode/sysfile/truncate /home/local/code/ansiccode/sysfile/truncate-test 10
rezultat będzie zależny od podanych argumentów wywołania programu:
truncate: result=truncate(argv[1]=/home/local/code/ansiccode/sysfile/truncate-test, truncsize=10): result=0 if (result>=0): Successful truncate() file.
oraz ponownie wyświetlić informacje o pliku poleceniem ls -l /home/local/code/ansiccode/sysfile/truncate-test:
-rw-r--r-- 1 user users 10 Oct 31 01:25 /home/local/code/ansiccode/sysfile/truncate-test



#top umask


Documentacja online: pubs.opengroup.org | www.cplusplus.com | pl.wikibooks.org

Deklaracja funkcji umask() znajduje się w pliku nagłówkowym sys/stat.h.
Deklaracja funkcji umask() jest następująca:
/* Set the file creation mask of the current process to MASK,
   and return the old creation mask.  */
extern __mode_t umask (__mode_t __mask) __THROW;

Powiązane:
getumask(), umask(),

Opis:
Funkcja umask()

Argumenty:
__mode_t __mask -

Zwracana wartość:
__mode_t -

Example:
zawartość pliku umask.c
SELECT ALL
#define  _GNU_SOURCE  1    /* for environ defined in unistd.h, to avoid warning implicit declaration of function basename, which defined in string.h */
#include <stdio.h>         /* for FILE, va_list, EOF, SEEK_SET, SEEK_CUR, SEEK_END, stdin, stdout, stderr, remove(), rename(), tmpfile(), tmpnam(), tempnam(), fclose(), */
                           /* fflush(), fopen(), freopen(), fprintf(), printf(), snprintf(), scanf(), sscanf(), fgetc(), getc(), getchar(), fputc(), putc(), putchar(), */
                           /* fgets(), gets(), fputs(), puts(), fread(), fwrite(), fseek(), ftell(), rewind(), feof(), ferror(), fileno(), popen(), pclose(), */
#include <stdlib.h>        /* for RAND_MAX, EXIT_FAILURE, EXIT_SUCCESS, MB_CUR_MAX, atoi(), atol(), atoll(), atof(), strtod(), strtof(), strtold(), strtol(), strtoul(), strtoq(), strtouq(), strtoll(), strtoull(), */
                           /* for sys/types.h, malloc.h replaced by stdlib.h, random(), srandom(), rand(), srand(), abort(), atexit(), on_exit(), exit(), getenv(), */
                           /* for putenv(), setenv(), clearenv(), mktemp(), mkstemp(), mkdtemp(), system(), realpath(), abs(), labs(), llabs(), getloadavg(), */
#include <string.h>        /* for memcpy(), memmove(), memset(), memcmp(), memchr(), memrchr(), str[n]cpy(), str[n]cat(), str[n]cmp(), strcoll(), str[n]dup(), strchr(), strrchr(), strstr(), */
                           /* strtok(), strcasestr(), memmem(), mempcpy(), str[n]len(), strerror(), bcopy(), bzero(), strcasecmp(), strsep(), basename(), */
#include <errno.h>         /* for errno constant, error constants, */

#if defined(__WIN32__) || defined(WIN32) || defined(_WIN32)
  #define WIN32_LEAN_AND_MEAN
  #include <fcntl.h>       /* for io.h, O_RDONLY, O_WRONLY, O_RDWR, O_CREAT, O_TRUNC, O_APPEND, */
  #include <windows.h>     /* for windef.h, wincon.h, winbase.h, winuser.h, winver.h, winsock.h, */
#else
  #include <sys/stat.h>    /* for dev_t, gid_t, ino_t, mode_t, off_t, uid_t, blkcnt_t, blksize_t, struct stat, stat(), fstat(), lstat(), chmod(), lchmod(), umask(), getumask(), mkdir(), mknod(), mkfifo(), */
#endif


mode_t getumask() {
	mode_t mask = umask(0);
	umask(mask);
	return mask;
}



int main(int argc, char **argv) {
	char *self;
	__mode_t modet1, modet2, modet3;
	
	self=strrchr(argv[0], '/');
	if (self!=NULL) self++;
	else self=argv[0];
	
	if (argc<2 || (argc>=2 && strlen(argv[1])!=4)) {
		printf("Usage: %s <mode>\n", argv[0]);
		printf("Examples:\n");
		printf("       %s 0022\n", argv[0]);
		printf("       %s 0057\n", argv[0]);
		printf("       %s 0077\n", argv[0]);
		return 0;
	}
	
	modet3=((unsigned char)argv[1][1]-0x30)*8*8 + ((unsigned char)argv[1][2]-0x30)*8 + ((unsigned char)argv[1][3]-0x30)*1;
	
	modet1=getumask();
	printf("%s: modet1=getumask(): modet1=%o\n", self, modet1);
	
	modet2=umask(modet3);
	printf("%s: modet2=umask(modet3=%o): modet2=%o\n", self, modet3, modet2);

	modet2=umask(modet1);
	printf("%s: modet2=umask(modet1=%o): modet2=%o\n", self, modet1, modet3);

	return 0;
}

program należy skompilować komendą make (jako argument należy podać plik Makefile zależny od systemu operacyjnego, domyślnie make próbuje użyć pliku Makefile):
make clean all # system Linux
make -f Makefile clean all # system Linux
make -f Makefile.obsd clean all # system OpenBSD
make -f Makefile.fbsd clean all # system FreeBSD
make -f Makefile.sol clean all # system Solaris
make -f Makefile.beos clean all # system BeOS
make -f Makefile.win clean all # system Windows

a następnie uruchomić bez argumentów:
/home/local/code/ansiccode/sysfile/umask
program wyświetli informacje o sposobie uruchamiania programu:
Usage: /home/local/code/ansiccode/sysfile/umask <mode>
Examples:
       /home/local/code/ansiccode/sysfile/umask 0022
       /home/local/code/ansiccode/sysfile/umask 0057
       /home/local/code/ansiccode/sysfile/umask 0077

jako argument wywołania programu można podać analogiczne jak poniżej argumenty:
/home/local/code/ansiccode/sysfile/umask 0022
/home/local/code/ansiccode/sysfile/umask 0057
/home/local/code/ansiccode/sysfile/umask 0077
rezultat będzie zależny od podanych argumentów wywołania programu:
umask: modet1=getumask(): modet1=22
umask: modet2=umask(modet3=22): modet2=22
umask: modet2=umask(modet1=22): modet2=22

umask: modet1=getumask(): modet1=22
umask: modet2=umask(modet3=57): modet2=22
umask: modet2=umask(modet1=22): modet2=57

umask: modet1=getumask(): modet1=22
umask: modet2=umask(modet3=77): modet2=22
umask: modet2=umask(modet1=22): modet2=77



#top ungetc


Documentacja online: pubs.opengroup.org | www.cplusplus.com | pl.wikibooks.org

Deklaracja funkcji ungetc() znajduje się w pliku nagłówkowym unistd.h.
Deklaracja funkcji ungetc() jest następująca:
/* Push a character back onto the input buffer of STREAM.

   This function is a possible cancellation points and therefore not
   marked with __THROW.  */
extern int ungetc (int __c, FILE *__stream);

Powiązane:
getc(), getw(), putc(), putw(), ungetc(),

Opis:
Funkcja ungetc()

Argumenty:
int __c -
FILE *__stream -

Zwracana wartość:
int -

Example:
zawartość pliku ungetc.c
SELECT ALL


program należy skompilować komendą make (jako argument należy podać plik Makefile zależny od systemu operacyjnego, domyślnie make próbuje użyć pliku Makefile):
make clean all # system Linux
make -f Makefile clean all # system Linux
make -f Makefile.obsd clean all # system OpenBSD
make -f Makefile.fbsd clean all # system FreeBSD
make -f Makefile.sol clean all # system Solaris
make -f Makefile.beos clean all # system BeOS
make -f Makefile.win clean all # system Windows

a następnie uruchomić bez argumentów:

program wyświetli informacje o sposobie uruchamiania programu:


jako argument wywołania programu można podać analogiczne jak poniżej argumenty:

rezultat będzie zależny od podanych argumentów wywołania programu:





Documentacja online: pubs.opengroup.org | www.cplusplus.com | pl.wikibooks.org

Deklaracja funkcji unlink() znajduje się w pliku nagłówkowym unistd.h.
Deklaracja funkcji unlink() jest następująca:
/* Remove the link NAME.  */
extern int unlink (__const char *__name) __THROW __nonnull ((1));

Powiązane:
remove(), unlink(), unlinkat(),

Opis:
Funkcja unlink()

Argumenty:
const char *__name -

Zwracana wartość:
int -

Example:
zawartość pliku unlink.c
SELECT ALL
#define  _GNU_SOURCE  1    /* for environ defined in unistd.h, to avoid warning implicit declaration of function basename, which defined in string.h */
#include <stdio.h>         /* for FILE, va_list, EOF, SEEK_SET, SEEK_CUR, SEEK_END, stdin, stdout, stderr, remove(), rename(), tmpfile(), tmpnam(), tempnam(), fclose(), */
                           /* fflush(), fopen(), freopen(), fprintf(), printf(), snprintf(), scanf(), sscanf(), fgetc(), getc(), getchar(), fputc(), putc(), putchar(), */
                           /* fgets(), gets(), fputs(), puts(), fread(), fwrite(), fseek(), ftell(), rewind(), feof(), ferror(), fileno(), popen(), pclose(), */
#include <string.h>        /* for memcpy(), memmove(), memset(), memcmp(), memchr(), memrchr(), str[n]cpy(), str[n]cat(), str[n]cmp(), strcoll(), str[n]dup(), strchr(), strrchr(), strstr(), */
                           /* strtok(), strcasestr(), memmem(), mempcpy(), str[n]len(), strerror(), bcopy(), bzero(), strcasecmp(), strsep(), basename(), */
#include <unistd.h>        /* for R_OK, W_OK, X_OK, F_OK, environ, access(), lseek(), close(), read(), write(), pipe(), alarm(), sleep(), ualarm(), usleep(), pause(), chown(), chdir(), getcwd(), */
                           /* for exec[...](), nice(), getpid(), getppid(), setpgid(), setsid(), getsid(), getuid(), geteuid(). getgid(), getegid(), setuid(), seteuid(), setgid(), setegid(), fork(), */
                           /* for link(), symlink(), readlink(), unlink(), rmdir(), getlogin(), setlogin(), gethostname(), sethostname(), daemon(), chroot(), getpass(), [f]sync(), [f]truncate(), syscall(), */
#include <errno.h>         /* for errno constant, error constants, */



int main(int argc, char **argv) {
	char *self;
	int result;
	
	self=strrchr(argv[0], '/');
	if (self!=NULL) self++;
	else self=argv[0];
	
	if (argc<2) {
		printf("Usage: %s </path/to/file>\n", argv[0]);
		return 0;
	}
	
	result=unlink(argv[1]);
	if (result>=0) printf("%s: result=unlink(argv[1]=%s): result=%d if (result>=0): Successful unlink file '%s'.\n", self, argv[1], result, argv[1]);
	else           printf("%s: result=unlink(argv[1]=%s): result=%d if (result>=0): else: Unable to unlink file '%s', Reason: %d:%s\n", self, argv[1], result, argv[1], errno, strerror(errno));
	
	return 0;
}

program należy skompilować komendą make (jako argument należy podać plik Makefile zależny od systemu operacyjnego, domyślnie make próbuje użyć pliku Makefile):
make clean all # system Linux
make -f Makefile clean all # system Linux
make -f Makefile.obsd clean all # system OpenBSD
make -f Makefile.fbsd clean all # system FreeBSD
make -f Makefile.sol clean all # system Solaris
make -f Makefile.beos clean all # system BeOS
make -f Makefile.win clean all # system Windows

a następnie uruchomić bez argumentów:
/home/local/code/ansiccode/sysfile/unlink
program wyświetli informacje o sposobie uruchamiania programu:
Usage: /home/local/code/ansiccode/sysfile/unlink </path/to/file>

jako argument wywołania programu można podać analogiczne jak poniżej argumenty:
/home/local/code/ansiccode/sysfile/unlink /dev/null
/home/local/code/ansiccode/sysfile/unlink /home/local/code/ansiccode/sysfile/obj
/home/local/code/ansiccode/sysfile/unlink /home/local/code/ansiccode/sysfile/unlink
rezultat będzie zależny od podanych argumentów wywołania programu:
unlink: result=unlink(argv[1]=/dev/null): result=-1 if (result>=0): else: Unable to unlink file '/dev/null', Reason: 13:Permission denied

unlink: result=unlink(argv[1]=/home/local/code/ansiccode/sysfile/obj): result=-1 if (result>=0): else: Unable to unlink file '/home/local/code/ansiccode/sysfile/obj', Reason: 21:Is a directory

unlink: result=unlink(argv[1]=/home/local/code/ansiccode/sysfile/unlink): result=0 if (result>=0): Successful unlink file '/home/local/code/ansiccode/sysfile/unlink'.



#top unlinkat


Documentacja online: pubs.opengroup.org | www.cplusplus.com | pl.wikibooks.org

Deklaracja funkcji unlink() znajduje się w pliku nagłówkowym unistd.h.
Deklaracja funkcji unlink() jest następująca:
#ifdef __USE_ATFILE
/* Remove the link NAME relative to FD.  */
extern int unlinkat (int __fd, __const char *__name, int __flag)
     __THROW __nonnull ((2));
#endif

Powiązane:
remove(), unlink(), unlinkat(),

Opis:
Funkcja unlinkat()

Argumenty:
int __fd -
const char *__name -
int __flag -

Zwracana wartość:
int -



#top utime


Documentacja online: pubs.opengroup.org | www.cplusplus.com | pl.wikibooks.org

Deklaracja funkcji utime() znajduje się w pliku nagłówkowym utime.h.
Deklaracja funkcji utime() jest następująca:
/* Set the access and modification times of FILE to those given in
   *FILE_TIMES.  If FILE_TIMES is NULL, set them to the current time.  */
extern int utime (__const char *__file,
          __const struct utimbuf *__file_times)
     __THROW __nonnull ((1));

Powiązane:
futimes(), lutimes(), utime(), utimensat(), utimes(),

Opis:
Funkcja utime()

Argumenty:
const char *__file -
const struct utimbuf *__file_times -

Zwracana wartość:
int -

Example:
zawartość pliku utime.c
SELECT ALL
#define  _GNU_SOURCE  1    /* for environ defined in unistd.h, to avoid warning implicit declaration of function basename, which defined in string.h */
#include <stdio.h>         /* for FILE, va_list, EOF, SEEK_SET, SEEK_CUR, SEEK_END, stdin, stdout, stderr, remove(), rename(), tmpfile(), tmpnam(), tempnam(), fclose(), */
                           /* fflush(), fopen(), freopen(), fprintf(), printf(), snprintf(), scanf(), sscanf(), fgetc(), getc(), getchar(), fputc(), putc(), putchar(), */
                           /* fgets(), gets(), fputs(), puts(), fread(), fwrite(), fseek(), ftell(), rewind(), feof(), ferror(), fileno(), popen(), pclose(), */
#include <stdlib.h>        /* for RAND_MAX, EXIT_FAILURE, EXIT_SUCCESS, MB_CUR_MAX, atoi(), atol(), atoll(), atof(), strtod(), strtof(), strtold(), strtol(), strtoul(), strtoq(), strtouq(), strtoll(), strtoull(), */
                           /* for sys/types.h, malloc.h replaced by stdlib.h, random(), srandom(), rand(), srand(), abort(), atexit(), on_exit(), exit(), getenv(), */
                           /* for putenv(), setenv(), clearenv(), mktemp(), mkstemp(), mkdtemp(), system(), realpath(), abs(), labs(), llabs(), getloadavg(), */
#include <string.h>        /* for memcpy(), memmove(), memset(), memcmp(), memchr(), memrchr(), str[n]cpy(), str[n]cat(), str[n]cmp(), strcoll(), str[n]dup(), strchr(), strrchr(), strstr(), */
                           /* strtok(), strcasestr(), memmem(), mempcpy(), str[n]len(), strerror(), bcopy(), bzero(), strcasecmp(), strsep(), basename(), */
#include <unistd.h>        /* for R_OK, W_OK, X_OK, F_OK, environ, access(), lseek(), close(), read(), write(), pipe(), alarm(), sleep(), ualarm(), usleep(), pause(), chown(), chdir(), getcwd(), */
                           /* for exec[...](), nice(), getpid(), getppid(), setpgid(), setsid(), getsid(), getuid(), geteuid(), getgid(), getegid(), setuid(), seteuid(), setgid(), setegid(), fork(), */
                           /* for link(), symlink(), readlink(), unlink(), rmdir(), getlogin(), setlogin(), gethostname(), sethostname(), daemon(), chroot(), getpass(), fsync(), sync(), [f]truncate(), syscall(), */
#include <errno.h>         /* for errno constant, error constants, */
#include <time.h>          /* for struct tm, struct timespec, time(), strftime(), localtime(), */
#include <utime.h>         /* for struct utimbuf, utime(), */

#if defined(__WIN32__) || defined(WIN32) || defined(_WIN32)
  #define WIN32_LEAN_AND_MEAN
  #include <fcntl.h>       /* for io.h, O_RDONLY, O_WRONLY, O_RDWR, O_CREAT, O_TRUNC, O_APPEND, */
  #include <windows.h>     /* for windef.h, wincon.h, winbase.h, winuser.h, winver.h, winsock.h, */
  #include <sys/time.h>    /* for struct timezone, struct timeval, gettimeofday(), settimeofday(), utimes(), lutimes(), */
#else
  #include <fcntl.h>       /* for O_RDONLY, O_WRONLY, O_RDWR, O_CREAT, O_TRUNC, O_APPEND, F_GETFL, F_SETFL, O_NONBLOCK, O_SYNC, FASYNC, O_DIRECT, O_LARGEFILE, O_DIRECTORY, O_NOFOLLOW, O_NOATIME, O_NDELAY, */
                           /* for LOCK_SH, LOCK_EX, LOCK_NB, LOCK_UN, LOCK_MAND, LOCK_READ, LOCK_WRITE, LOCK_RW, fcntl(), open(), creat(), */
  #include <sys/time.h>    /* for struct timezone, struct timeval, gettimeofday(), settimeofday(), utimes(), lutimes(), */
#endif



int main(int argc, char **argv) {
	char *self;
	char filename[1024];
	int fprd;
	time_t tmarg1;
	time_t tmarg2;
	struct utimbuf utbdata;
#if defined(HAVE_UTIME)
	int result;
#endif
	
	self=strrchr(argv[0], '/');
	if (self!=NULL) self++;
	else self=argv[0];
	
	if (argc<4) {
		printf("Usage: %s </path/to/file> <timestamp1> <timestamp2>\n", argv[0]);
		printf("It will be translated:\n");
		printf("       %s </path/to/file-utime> <timestamp1> <timestamp2>\n", argv[0]);
		return 0;
	}
	
	tmarg1=atoi(argv[2]);
	tmarg2=atoi(argv[3]);
	memset(&utbdata, 0x00, sizeof(struct utimbuf));
	
	utbdata.actime =tmarg1;
	utbdata.modtime=tmarg2;
	
	/*
	Change the access time of FILE to TVP[0] and the modification time of
	FILE to TVP[1]. If TVP is a null pointer, use the current time instead.
	Returns 0 on success, -1 on errors.
	*/
	memset(filename, 0x00, sizeof(filename));
	snprintf(filename, sizeof(filename), "%s-utime", argv[1]);
#if defined(HAVE_UTIME)
	result=utime(filename, &utbdata);
	if (result==0) printf("%s: result=utime(filename=%s,utbdata): result=%d if (result>=0): Successful utime() file.\n", self, filename, result);
	else           printf("%s: result=utime(filename=%s,utbdata): result=%d if (result>=0): else: Unable to utime() file, Reason: %d:%s\n", self, filename, result, errno, strerror(errno));
#endif
	
	return 0;
}

program należy skompilować komendą make (jako argument należy podać plik Makefile zależny od systemu operacyjnego, domyślnie make próbuje użyć pliku Makefile):
make clean all # system Linux
make -f Makefile clean all # system Linux
make -f Makefile.obsd clean all # system OpenBSD
make -f Makefile.fbsd clean all # system FreeBSD
make -f Makefile.sol clean all # system Solaris
make -f Makefile.beos clean all # system BeOS
make -f Makefile.win clean all # system Windows

a następnie uruchomić bez argumentów:
/home/local/code/ansiccode/sysfile/utime
program wyświetli informacje o sposobie uruchamiania programu:


następnie należy utworzyć przykładowy plik poleceniem
touch /home/local/code/ansiccode/sysfile/utime-utimes /home/local/code/ansiccode/sysfile/utime-lutimes /home/local/code/ansiccode/sysfile/utime-futimes
jako argument wywołania programu można podać analogiczne jak poniżej argumenty:

rezultat będzie zależny od podanych argumentów wywołania programu:




#top utimensat


Documentacja online: pubs.opengroup.org | www.cplusplus.com | pl.wikibooks.org

Deklaracja funkcji utimensat() znajduje się w pliku nagłówkowym sys/stat.h.
Deklaracja funkcji utimensat() jest następująca:
#ifdef __USE_ATFILE
/* Set file access and modification times relative to directory file
   descriptor.  */
extern int utimensat (int __fd, __const char *__path,
              __const struct timespec __times[2],
              int __flags)
     __THROW __nonnull ((2));
#endif

Powiązane:
futimes(), lutimes(), utime(), utimensat(), utimes(),

Opis:
Funkcja utimensat()

Argumenty:
int __fd -
const char *__path -
const struct timespec __times[2] -
int __flags -

Zwracana wartość:
int -

Example:
zawartość pliku utimensat.c
SELECT ALL
#define  _GNU_SOURCE  1    /* for environ defined in unistd.h, to avoid warning implicit declaration of function basename, which defined in string.h */
#include <stdio.h>         /* for FILE, va_list, EOF, SEEK_SET, SEEK_CUR, SEEK_END, stdin, stdout, stderr, remove(), rename(), tmpfile(), tmpnam(), tempnam(), fclose(), */
                           /* fflush(), fopen(), freopen(), fprintf(), printf(), snprintf(), scanf(), sscanf(), fgetc(), getc(), getchar(), fputc(), putc(), putchar(), */
                           /* fgets(), gets(), fputs(), puts(), fread(), fwrite(), fseek(), ftell(), rewind(), feof(), ferror(), fileno(), popen(), pclose(), */
#include <stdlib.h>        /* for RAND_MAX, EXIT_FAILURE, EXIT_SUCCESS, MB_CUR_MAX, atoi(), atol(), atoll(), atof(), strtod(), strtof(), strtold(), strtol(), strtoul(), strtoq(), strtouq(), strtoll(), strtoull(), */
                           /* for sys/types.h, malloc.h replaced by stdlib.h, random(), srandom(), rand(), srand(), abort(), atexit(), on_exit(), exit(), getenv(), */
                           /* for putenv(), setenv(), clearenv(), mktemp(), mkstemp(), mkdtemp(), system(), realpath(), abs(), labs(), llabs(), getloadavg(), */
#include <string.h>        /* for memcpy(), memmove(), memset(), memcmp(), memchr(), memrchr(), str[n]cpy(), str[n]cat(), str[n]cmp(), strcoll(), str[n]dup(), strchr(), strrchr(), strstr(), */
                           /* strtok(), strcasestr(), memmem(), mempcpy(), str[n]len(), strerror(), bcopy(), bzero(), strcasecmp(), strsep(), basename(), */
#include <unistd.h>        /* for R_OK, W_OK, X_OK, F_OK, environ, access(), lseek(), close(), read(), write(), pipe(), alarm(), sleep(), ualarm(), usleep(), pause(), chown(), chdir(), getcwd(), */
                           /* for exec[...](), nice(), getpid(), getppid(), setpgid(), setsid(), getsid(), getuid(), geteuid(), getgid(), getegid(), setuid(), seteuid(), setgid(), setegid(), fork(), */
                           /* for link(), symlink(), readlink(), unlink(), rmdir(), getlogin(), setlogin(), gethostname(), sethostname(), daemon(), chroot(), getpass(), fsync(), sync(), [f]truncate(), syscall(), */
#include <errno.h>         /* for errno constant, error constants, */
#include <time.h>          /* for struct tm, struct timespec, time(), strftime(), localtime(), */

#if defined(__WIN32__) || defined(WIN32) || defined(_WIN32)
  #define WIN32_LEAN_AND_MEAN
  #include <fcntl.h>       /* for io.h, O_RDONLY, O_WRONLY, O_RDWR, O_CREAT, O_TRUNC, O_APPEND, */
  #include <windows.h>     /* for windef.h, wincon.h, winbase.h, winuser.h, winver.h, winsock.h, */
  #include <sys/time.h>    /* for struct timezone, struct timeval, gettimeofday(), settimeofday(), utimes(), lutimes(), */
#else
  #include <sys/stat.h>    /* for dev_t, gid_t, ino_t, mode_t, off_t, uid_t, blkcnt_t, blksize_t, struct stat, stat(), fstat(), lstat(), chmod(), lchmod(), umask(), getumask(), mkdir(), mknod(), mkfifo(), */
  #include <fcntl.h>       /* for O_RDONLY, O_WRONLY, O_RDWR, O_CREAT, O_TRUNC, O_APPEND, F_GETFL, F_SETFL, O_NONBLOCK, O_SYNC, FASYNC, O_DIRECT, O_LARGEFILE, O_DIRECTORY, O_NOFOLLOW, O_NOATIME, O_NDELAY, */
                           /* for LOCK_SH, LOCK_EX, LOCK_NB, LOCK_UN, LOCK_MAND, LOCK_READ, LOCK_WRITE, LOCK_RW, fcntl(), open(), creat(), */
  #include <sys/time.h>    /* for struct timezone, struct timeval, gettimeofday(), settimeofday(), utimes(), lutimes(), */
#endif
#define __NR_utimensat  320



int main(int argc, char **argv) {
	char *self;
	time_t tmarg1;
	time_t tmarg2;
	struct timespec tvdata[2];
#if defined(HAVE_UTIMENSAT) || defined(HAVE_NRUTIMENSAT)
	int result;
#endif
	
	self=strrchr(argv[0], '/');
	if (self!=NULL) self++;
	else self=argv[0];
	
	if (argc<4) {
		printf("Usage: %s </path/to/file> <timestamp1> <timestamp2>\n", argv[0]);
		printf("Examples:\n");
		printf("       %s /home/local/code/ansiccode/sysfile/utimensat-symlink 978307261 981169506\n", argv[0]);
		return 0;
	}
	
	tmarg1=atoi(argv[2]);
	tmarg2=atoi(argv[3]);
	memset(&tvdata, 0x00, 2*sizeof(struct timeval));
	
	tvdata[0].tv_sec=(time_t)tmarg1;
	tvdata[0].tv_nsec=(long int)0/*( 1E6*(timestamp1-(double)tvarr[0].tv_sec) )*/;
	tvdata[1].tv_sec=(time_t)tmarg2;
	tvdata[1].tv_nsec=(long int)0/*( 1E6*(timestamp1-(double)tvarr[1].tv_sec) )*/;
	
	/*
	Change the access time of FILE to TVP[0] and the modification time of
	FILE to TVP[1]. If TVP is a null pointer, use the current time instead.
	Returns 0 on success, -1 on errors.
	*/
#if defined(HAVE_UTIMENSAT) || defined(HAVE_NRUTIMENSAT)
#if defined(HAVE_UTIMENSAT)
	/*utimensat(AT_FDCWD, argv[1], {{978303600, 0}, {978303600, 0}}, AT_SYMLINK_NOFOLLOW) = 0*/
	result=utimensat(AT_FDCWD, argv[1], tvdata, AT_SYMLINK_NOFOLLOW);
	if (result==0) printf("%s: result=utimensat(filename=%s,tvdata): result=%d if (result>=0): Successful utimensat() file.\n", self, argv[1], result);
	else           printf("%s: result=utimensat(filename=%s,tvdata): result=%d if (result>=0): else: Unable to utimensat() file, Reason: %d:%s\n", self, argv[1], result, errno, strerror(errno));
#endif
#if defined(HAVE_NRUTIMENSAT)
	/*utimensat(AT_FDCWD, argv[1], {{978303600, 0}, {978303600, 0}}, AT_SYMLINK_NOFOLLOW) = 0*/
	result=syscall(__NR_utimensat, AT_FDCWD, argv[1], tvdata, AT_SYMLINK_NOFOLLOW);
	if (result==0) printf("%s: result=utimensat(argv[1]=%s,tvdata): result=%d if (result>=0): Successful syscall(__NR_utimensat) file.\n", self, argv[1], result);
	else           printf("%s: result=utimensat(argv[1]=%s,tvdata): result=%d if (result>=0): else: Unable to syscall(__NR_utimensat) file, Reason: %d:%s\n", self, argv[1], result, errno, strerror(errno));
#endif
#else
	/* utimensat() is not available on this OS platform !!! */
	printf("%s: utimensat() is not available on this OS platform !!!\n", self);
#endif
	
	return 0;
}

program należy skompilować komendą make (jako argument należy podać plik Makefile zależny od systemu operacyjnego, domyślnie make próbuje użyć pliku Makefile):
make clean all # system Linux
make -f Makefile clean all # system Linux
make -f Makefile.obsd clean all # system OpenBSD
make -f Makefile.fbsd clean all # system FreeBSD
make -f Makefile.sol clean all # system Solaris
make -f Makefile.beos clean all # system BeOS
make -f Makefile.win clean all # system Windows

a następnie uruchomić bez argumentów:
/home/local/code/ansiccode/sysfile/utimensat
program wyświetli informacje o sposobie uruchamiania programu:
Usage: /home/local/code/ansiccode/sysfile/utimensat </path/to/file> <timestamp1> <timestamp2>
Examples:
       /home/local/code/ansiccode/sysfile/utimensat /home/local/code/ansiccode/sysfile/utimensat-symlink 978307261 981169506

następnie należy utworzyć przykładowy plik oraz przykładowe dowiązanie do tego pliku poleceniami:
touch /home/local/code/ansiccode/sysfile/utimensat-file
ln -s /home/local/code/ansiccode/sysfile/utimensat-file /home/local/code/ansiccode/sysfile/utimensat-symlink
po czym uruchomić program z następującymi argumentami:
/home/local/code/ansiccode/sysfile/utimensat /home/local/code/ansiccode/sysfile/utimensat-symlink 1234567890 1234567890
rezultat będzie zależny od podanych argumentów wywołania programu:
utimensat: result=utimensat(argv[1]=/home/local/code/ansiccode/sysfile/utimensat-symlink,tvdata): result=-1 if (result>=0): else: Unable to syscall(__NR_utimensat) file, Reason: 38:Function not implemented

Następnie na systemie posiadającym syscall utimensat() należy ponownie skompilowac program,
po czym ponownie uruchomić program z następującymi argumentami:
/home/local/code/ansiccode/sysfile/utimensat /home/local/code/ansiccode/sysfile/utimensat-symlink 1234567890 1234567890
rezultat będzie zależny od podanych argumentów wywołania programu:
utimensat: result=utimensat(filename=/home/local/code/ansiccode/sysfile/utimensat-symlink,tvdata): result=0 if (result>=0): Successful utimensat() file.

oraz wyświetlić informacje o plikach poleceniem
ls --time-style=long-iso -l /home/local/code/ansiccode/sysfile/utimensat-symlink
rezultat będzie analogiczny do poniższego:
lrwxrwxrwx. 1 sp users 8 2001-02-03 04:05 /home/local/code/ansiccode/sysfile/utimensat-symlink -> /home/local/code/ansiccode/sysfile/utimensat-file



#top utimes


Documentacja online: pubs.opengroup.org | www.cplusplus.com | pl.wikibooks.org

Deklaracja funkcji utimes() znajduje się w pliku nagłówkowym sys/time.h.
Deklaracja funkcji utimes() jest następująca:
/* Change the access time of FILE to TVP[0] and the modification time of
   FILE to TVP[1].  If TVP is a null pointer, use the current time instead.
   Returns 0 on success, -1 on errors.  */
extern int utimes (__const char *__file, __const struct timeval __tvp[2])
     __THROW __nonnull ((1));

Powiązane:
futimes(), lutimes(), utime(), utimensat(), utimes(),

Opis:
Funkcja utimes()

Argumenty:
const char *__file -
const struct timeval __tvp[2] -

Zwracana wartość:
int -

Example:
zawartość pliku utimes.c
SELECT ALL
#define  _GNU_SOURCE  1    /* for environ defined in unistd.h, to avoid warning implicit declaration of function basename, which defined in string.h */
#include <stdio.h>         /* for FILE, va_list, EOF, SEEK_SET, SEEK_CUR, SEEK_END, stdin, stdout, stderr, remove(), rename(), tmpfile(), tmpnam(), tempnam(), fclose(), */
                           /* fflush(), fopen(), freopen(), fprintf(), printf(), snprintf(), scanf(), sscanf(), fgetc(), getc(), getchar(), fputc(), putc(), putchar(), */
                           /* fgets(), gets(), fputs(), puts(), fread(), fwrite(), fseek(), ftell(), rewind(), feof(), ferror(), fileno(), popen(), pclose(), */
#include <stdlib.h>        /* for RAND_MAX, EXIT_FAILURE, EXIT_SUCCESS, MB_CUR_MAX, atoi(), atol(), atoll(), atof(), strtod(), strtof(), strtold(), strtol(), strtoul(), strtoq(), strtouq(), strtoll(), strtoull(), */
                           /* for sys/types.h, malloc.h replaced by stdlib.h, random(), srandom(), rand(), srand(), abort(), atexit(), on_exit(), exit(), getenv(), */
                           /* for putenv(), setenv(), clearenv(), mktemp(), mkstemp(), mkdtemp(), system(), realpath(), abs(), labs(), llabs(), getloadavg(), */
#include <string.h>        /* for memcpy(), memmove(), memset(), memcmp(), memchr(), memrchr(), str[n]cpy(), str[n]cat(), str[n]cmp(), strcoll(), str[n]dup(), strchr(), strrchr(), strstr(), */
                           /* strtok(), strcasestr(), memmem(), mempcpy(), str[n]len(), strerror(), bcopy(), bzero(), strcasecmp(), strsep(), basename(), */
#include <unistd.h>        /* for R_OK, W_OK, X_OK, F_OK, environ, access(), lseek(), close(), read(), write(), pipe(), alarm(), sleep(), ualarm(), usleep(), pause(), chown(), chdir(), getcwd(), */
                           /* for exec[...](), nice(), getpid(), getppid(), setpgid(), setsid(), getsid(), getuid(), geteuid(). getgid(), getegid(), setuid(), seteuid(), setgid(), setegid(), fork(), */
                           /* for link(), symlink(), readlink(), unlink(), rmdir(), getlogin(), setlogin(), gethostname(), sethostname(), daemon(), chroot(), getpass(), fsync(), sync(), [f]truncate(), syscall(), */
#include <errno.h>         /* for errno constant, error constants, */
#include <time.h>          /* for struct tm, struct timespec, time(), strftime(), localtime(), */

#if defined(__WIN32__) || defined(WIN32) || defined(_WIN32)
  #define WIN32_LEAN_AND_MEAN
  #include <fcntl.h>       /* for io.h, O_RDONLY, O_WRONLY, O_RDWR, O_CREAT, O_TRUNC, O_APPEND, */
  #include <windows.h>     /* for windef.h, wincon.h, winbase.h, winuser.h, winver.h, winsock.h, */
  #include <sys/time.h>    /* for struct timezone, struct timeval, gettimeofday(), settimeofday(), utimes(), lutimes(), */
#else
  #include <fcntl.h>       /* for O_RDONLY, O_WRONLY, O_RDWR, O_CREAT, O_TRUNC, O_APPEND, F_GETFL, F_SETFL, O_NONBLOCK, O_SYNC, FASYNC, O_DIRECT, O_LARGEFILE, O_DIRECTORY, O_NOFOLLOW, O_NOATIME, O_NDELAY, */
                           /* for LOCK_SH, LOCK_EX, LOCK_NB, LOCK_UN, LOCK_MAND, LOCK_READ, LOCK_WRITE, LOCK_RW, fcntl(), open(), creat(), */
  #include <sys/time.h>    /* for struct timezone, struct timeval, gettimeofday(), settimeofday(), utimes(), lutimes(), */
#endif



int main(int argc, char **argv) {
	char *self;
	char filename[1024];
	int fdfut;
	int result;
	time_t tmarg1;
	time_t tmarg2;
	struct timeval tvdata[2];
	
	self=strrchr(argv[0], '/');
	if (self!=NULL) self++;
	else self=argv[0];
	
	if (argc<4) {
		printf("Usage: %s </path/to/file> <timestamp1> <timestamp2>\n", argv[0]);
		printf("It will be translated:\n");
		printf("       %s </path/to/file-utimes> <timestamp1> <timestamp2>\n", argv[0]);
		printf("       %s </path/to/file-lutimes> <timestamp1> <timestamp2>\n", argv[0]);
		printf("       %s </path/to/file-futimes> <timestamp1> <timestamp2>\n", argv[0]);
		return 0;
	}
	
	tmarg1=atoi(argv[2]);
	tmarg2=atoi(argv[3]);
	memset(&tvdata, 0x00, 2*sizeof(struct timeval));
	
	tvdata[0].tv_sec=(time_t)tmarg1;
	tvdata[0].tv_usec=(suseconds_t)0/*( 1E6*(timestamp1-(double)tvarr[0].tv_sec) )*/;
	tvdata[1].tv_sec=(time_t)tmarg2;
	tvdata[1].tv_usec=(suseconds_t)0/*( 1E6*(timestamp1-(double)tvarr[1].tv_sec) )*/;
	
	/*
	Change the access time of FILE to TVP[0] and the modification time of
	FILE to TVP[1]. If TVP is a null pointer, use the current time instead.
	Returns 0 on success, -1 on errors.
	*/
	memset(filename, 0x00, sizeof(filename));
	snprintf(filename, sizeof(filename), "%s-utimes", argv[1]);
#if defined(HAVE_UTIMES)
	result=utimes(filename, tvdata);
	if (result==0) printf("%s: result=utimes(filename=%s,tvdata): result=%d if (result>=0): Successful utimes file.\n", self, filename, result);
	else           printf("%s: result=utimes(filename=%s,tvdata): result=%d if (result>=0): else: Unable to utimes file, Reason: %d:%s\n", self, filename, result, errno, strerror(errno));
#endif
	
	memset(filename, 0x00, sizeof(filename));
	snprintf(filename, sizeof(filename), "%s-lutimes", argv[1]);
#if defined(HAVE_LUTIMES)
	result=lutimes(argv[1], tvdata);
	if (result==0) printf("%s: result=utimes(argv[1]=%s,tvdata): result=%d if (result>=0): Successful lutimes file.\n", self, filename, result);
	else           printf("%s: result=utimes(argv[1]=%s,tvdata): result=%d if (result>=0): else: Unable to lutimes file, Reason: %d:%s\n", self, filename, result, errno, strerror(errno));
#endif
	
	memset(filename, 0x00, sizeof(filename));
	snprintf(filename, sizeof(filename), "%s-futimes", argv[1]);
	fdfut=open(filename, O_RDONLY, 0644);
	if (fdfut>=0) {
#if defined(HAVE_FUTIMES)
		result=futimes(fdfut, tvdata);
		close(fdfut);
		if (result==0) printf("%s: result=futimes(fdfut=%d(%s), tvdata): result=%d if (result>=0): Successful futimes file.\n", self, fdfut, filename, result);
		else           printf("%s: result=futimes(fdfut=%d(%s), tvdata): result=%d if (result>=0): else: Unable to futimes file, Reason: %d:%s\n", self, fdfut, filename, result, errno, strerror(errno));
#endif
	} else {
		printf("%s: fdfut=open(filename=%s, O_RDONLY, 0644): fdfut=%d if (fdfut>=0): else: Unable to utimes file, Reason: %d:%s\n", self, filename, fdfut, errno, strerror(errno));
	}
	
	return 0;
}

program należy skompilować komendą make (jako argument należy podać plik Makefile zależny od systemu operacyjnego, domyślnie make próbuje użyć pliku Makefile):
make clean all # system Linux
make -f Makefile clean all # system Linux
make -f Makefile.obsd clean all # system OpenBSD
make -f Makefile.fbsd clean all # system FreeBSD
make -f Makefile.sol clean all # system Solaris
make -f Makefile.beos clean all # system BeOS
make -f Makefile.win clean all # system Windows

a następnie uruchomić bez argumentów:
/home/local/code/ansiccode/sysfile/utimes
program wyświetli informacje o sposobie uruchamiania programu:
Usage: /home/local/code/ansiccode/sysfile/utimes </path/to/file> <timestamp1> <timestamp2>
It will be translated:
       /home/local/code/ansiccode/sysfile/utimes </path/to/file-utimes> <timestamp1> <timestamp2>
       /home/local/code/ansiccode/sysfile/utimes </path/to/file-lutimes> <timestamp1> <timestamp2>
       /home/local/code/ansiccode/sysfile/utimes </path/to/file-futimes> <timestamp1> <timestamp2>

jako argument wywołania programu można podać analogiczne jak poniżej argumenty:
/home/local/code/ansiccode/sysfile/utimes /home/local/code/ansiccode/sysfile/utimes 1234567890 1234567890
rezultat będzie zależny od podanych argumentów wywołania programu:
utimes: result=utimes(filename=/home/local/code/ansiccode/sysfile/utimes-utimes,tvdata): result=-1 if (result>=0): else: Unable to utimes file, Reason: 2:No such file or directory

utimes: result=utimes(argv[1]=/home/local/code/ansiccode/sysfile/utimes-lutimes,tvdata): result=-1 if (result>=0): else: Unable to lutimes file, Reason: 38:Function not implemented

utimes: fdfut=open(filename=/home/local/code/ansiccode/sysfile/utimes-futimes, O_RDONLY, 0644): fdfut=-1 if (fdfut>=0): else: Unable to utimes file, Reason: 2:No such file or directory

następnie należy utworzyć przykładowy plik poleceniem
touch /home/local/code/ansiccode/sysfile/utimes-utimes /home/local/code/ansiccode/sysfile/utimes-lutimes /home/local/code/ansiccode/sysfile/utimes-futimes
po czym ponownie uruchomić program z tymi samymi argumentami jak poprzednim przypadku:
/home/local/code/ansiccode/sysfile/utimes /home/local/code/ansiccode/sysfile/utimes 1234567890 1234567890
rezultat będzie zależny od podanych argumentów wywołania programu:
utimes: result=utimes(filename=/home/local/code/ansiccode/sysfile/utimes-utimes,tvdata): result=0 if (result>=0): Successful utimes file.

utimes: result=utimes(argv[1]=/home/local/code/ansiccode/sysfile/utimes-lutimes,tvdata): result=-1 if (result>=0): else: Unable to lutimes file, Reason: 38:Function not implemented

utimes: result=futimes(fdfut=3(/home/local/code/ansiccode/sysfile/utimes-futimes), tvdata): result=0 if (result>=0): Successful futimes file.
oraz wyświetlić informacje o plikach poleceniem
ls --time-style=long-iso -l /home/local/code/ansiccode/sysfile/utimes-utimes /home/local/code/ansiccode/sysfile/utimes-lutimes /home/local/code/ansiccode/sysfile/utimes-futimes
rezultat będzie analogiczny do poniższego:
-rw-r--r-- 1 user users 0 2009-02-14 00:31 /home/local/code/ansiccode/sysfile/utimes-futimes
-rw-r--r-- 1 user users 0 2013-10-31 01:31 /home/local/code/ansiccode/sysfile/utimes-lutimes
-rw-r--r-- 1 user users 0 2009-02-14 00:31 /home/local/code/ansiccode/sysfile/utimes-utimes



#top vdprintf


Documentacja online: pubs.opengroup.org | www.cplusplus.com | pl.wikibooks.org

Deklaracja funkcji vdprintf() znajduje się w pliku nagłówkowym stdio.h.
Deklaracja funkcji vdprintf() jest następująca:
/* Write formatted output to a file descriptor.

   These functions are not part of POSIX and therefore no official
   cancellation point.  But due to similarity with an POSIX interface
   or due to the implementation they are cancellation points and
   therefore not marked with __THROW.  */
extern int vdprintf (int __fd, __const char *__restrict __fmt,
		     _G_va_list __arg)
     __attribute__ ((__format__ (__printf__, 2, 0)));

Powiązane:
dprintf(), fprintf(), vdprintf(), vfprintf(),

Opis:
Funkcja vdprintf()

Argumenty:
int __fd -
const char *__restrict __format -
_G_va_list __arg -

Zwracana wartość:
int -

Example:
zawartość pliku vdprintf.c
SELECT ALL


program należy skompilować komendą make (jako argument należy podać plik Makefile zależny od systemu operacyjnego, domyślnie make próbuje użyć pliku Makefile):
make clean all # system Linux
make -f Makefile clean all # system Linux
make -f Makefile.obsd clean all # system OpenBSD
make -f Makefile.fbsd clean all # system FreeBSD
make -f Makefile.sol clean all # system Solaris
make -f Makefile.beos clean all # system BeOS
make -f Makefile.win clean all # system Windows

a następnie uruchomić bez argumentów:

program wyświetli informacje o sposobie uruchamiania programu:


a następnie uruchomić w następujący sposób:

w rezultacie program wyświetli następujące informacje:

oraz zostanie utworzony plik ls -l /home/local/code/ansiccode/sysfile/vdprintf-test:

zawierający następującą zawartość cat /home/local/code/ansiccode/sysfile/vdprintf-test:





#top vfprintf


Documentacja online: pubs.opengroup.org | www.cplusplus.com | pl.wikibooks.org

Deklaracja funkcji vfprintf() znajduje się w pliku nagłówkowym stdio.h.
Deklaracja funkcji vfprintf() jest następująca:
/* Write formatted output to S from argument list ARG.

   This function is a possible cancellation point and therefore not
   marked with __THROW.  */
extern int vfprintf (FILE *__restrict __s, __const char *__restrict __format,
             _G_va_list __arg);

Powiązane:
dprintf(), fprintf(), vdprintf(), vfprintf(),

Opis:
Funkcja vfprintf()

Argumenty:
FILE *__restrict __s -
const char *__restrict __format -
_G_va_list __arg -

Zwracana wartość:
int -

Example:
zawartość pliku vfprintf.c
SELECT ALL
#define  _GNU_SOURCE  1    /* for environ defined in unistd.h, to avoid warning implicit declaration of function basename, which defined in string.h */
#include <stdio.h>         /* for FILE, va_list, EOF, SEEK_SET, SEEK_CUR, SEEK_END, stdin, stdout, stderr, remove(), rename(), tmpfile(), tmpnam(), tempnam(), fclose(), */
                           /* fflush(), fopen(), freopen(), fprintf(), printf(), snprintf(), scanf(), sscanf(), fgetc(), getc(), getchar(), fputc(), putc(), putchar(), */
                           /* fgets(), gets(), fputs(), puts(), fread(), fwrite(), fseek(), ftell(), rewind(), feof(), ferror(), fileno(), popen(), pclose(), */
#include <string.h>        /* for memcpy(), memmove(), memset(), memcmp(), memchr(), memrchr(), str[n]cpy(), str[n]cat(), str[n]cmp(), strcoll(), str[n]dup(), strchr(), strrchr(), strstr(), */
                           /* strtok(), strcasestr(), memmem(), mempcpy(), str[n]len(), strerror(), bcopy(), bzero(), strcasecmp(), strsep(), basename(), */
#include <errno.h>         /* for errno constant, error constants, */

#include <stdarg.h>        /* for va_list, va_start(), va_end(), */



void vfprintf_formatted(FILE *file, const char *format, ...) {
	va_list args;
	
	va_start(args, format);
	vfprintf(file, format, args);
	va_end(args);
}



int main(int argc, char **argv) {
	char *self;
	FILE *file;
	
	self=strrchr(argv[0], '/');
	if (self!=NULL) self++;
	else self=argv[0];
	
	if (argc<2) {
		printf("Usage: %s </path/to/filename>\n", argv[0]);
		return 0;
	}
	
	file=fopen(argv[1], "w");
	if (file!=NULL) {
		printf("%s: file=fopen(argv[1]=%s, \"w\"); if (file!=NULL): Successful fopen() file.\n", self, argv[1]);
		vfprintf_formatted(file, "%s: Successful opened file '%s'\n", self, argv[1]);
		vfprintf_formatted(file, "%s: printf formatted string into file '%s', main(int argc, char **argv): argc=%d argv[0]=%s argv[1]=%s)\n", self, argv[1], argc, argv[0], argv[1]);
		fclose(file);
	} else {
		printf("%s: file=fopen(argv[1]=%s, \"w\"); if (file!=NULL): else: Unable to fopen() file, Reason: %d:%s\n", self, argv[1], errno, strerror(errno));
	}
	
	return 0;
}

program należy skompilować komendą make (jako argument należy podać plik Makefile zależny od systemu operacyjnego, domyślnie make próbuje użyć pliku Makefile):
make clean all # system Linux
make -f Makefile clean all # system Linux
make -f Makefile.obsd clean all # system OpenBSD
make -f Makefile.fbsd clean all # system FreeBSD
make -f Makefile.sol clean all # system Solaris
make -f Makefile.beos clean all # system BeOS
make -f Makefile.win clean all # system Windows

a następnie uruchomić bez argumentów:
/home/local/code/ansiccode/sysfile/vfprintf
program wyświetli informacje o sposobie uruchamiania programu:
Usage: /home/local/code/ansiccode/sysfile/vfprintf </path/to/filename>

jako argument wywołania programu można podać analogiczne jak poniżej argumenty:
/home/local/code/ansiccode/sysfile/vfprintf /home/local/code/ansiccode/sysfile/vfprintf-test
rezultat będzie zależny od podanych argumentów wywołania programu:
vfprintf: file=fopen(argv[1]=/home/local/code/ansiccode/sysfile/vfprintf-test, "w"); if (file!=NULL): Successful fopen() file.
oraz zostanie utworzony plik ls -l /home/local/code/ansiccode/sysfile/vfprintf-test:
-rw-r--r-- 1 user users 326 Oct 31 01:34 /home/local/code/ansiccode/sysfile/vfprintf-test
zawierający następującą zawartość cat /home/local/code/ansiccode/sysfile/vfprintf-test:
vfprintf: Successful opened file '/home/local/code/ansiccode/sysfile/vfprintf-test'
vfprintf: printf formatted string into file '/home/local/code/ansiccode/sysfile/vfprintf-test', main(int argc, char **argv): argc=2 argv[0]=/home/local/code/ansiccode/sysfile/vfprintf argv[1]=/home/local/code/ansiccode/sysfile/vfprintf-test)



#top write


Documentacja online: pubs.opengroup.org | www.cplusplus.com | pl.wikibooks.org

Deklaracja funkcji write() znajduje się w pliku nagłówkowym unistd.h.
Deklaracja funkcji write() jest następująca:
/* Write N bytes of BUF to FD.  Return the number written, or -1.

   This function is a cancellation point and therefore not marked with
   __THROW.  */
extern ssize_t write (int __fd, __const void *__buf, size_t __n) __wur;

Powiązane:
fread(), fwrite(), pread(), pwrite(), read(), write(),

Opis:
Funkcja write()

Argumenty:
int __fd -
const void *__buf -
size_t __n -

Zwracana wartość:
ssize_t -

Example:
zawartość pliku write.c
SELECT ALL
#define  _GNU_SOURCE  1    /* for environ defined in unistd.h, to avoid warning implicit declaration of function basename, which defined in string.h */
#include <stdio.h>         /* for FILE, va_list, EOF, SEEK_SET, SEEK_CUR, SEEK_END, stdin, stdout, stderr, remove(), rename(), tmpfile(), tmpnam(), tempnam(), fclose(), */
                           /* fflush(), fopen(), freopen(), fprintf(), printf(), snprintf(), scanf(), sscanf(), fgetc(), getc(), getchar(), fputc(), putc(), putchar(), */
                           /* fgets(), gets(), fputs(), puts(), fread(), fwrite(), fseek(), ftell(), rewind(), feof(), ferror(), fileno(), popen(), pclose(), */
#include <string.h>        /* for memcpy(), memmove(), memset(), memcmp(), memchr(), memrchr(), str[n]cpy(), str[n]cat(), str[n]cmp(), strcoll(), str[n]dup(), strchr(), strrchr(), strstr(), */
                           /* strtok(), strcasestr(), memmem(), mempcpy(), str[n]len(), strerror(), bcopy(), bzero(), strcasecmp(), strsep(), basename(), */
#include <unistd.h>        /* for R_OK, W_OK, X_OK, F_OK, environ, access(), lseek(), close(), read(), write(), pipe(), alarm(), sleep(), ualarm(), usleep(), pause(), chown(), chdir(), getcwd(), */
                           /* for exec[...](), nice(), getpid(), getppid(), setpgid(), setsid(), getsid(), getuid(), geteuid(). getgid(), getegid(), setuid(), seteuid(), setgid(), setegid(), fork(), */
                           /* for link(), symlink(), readlink(), unlink(), rmdir(), getlogin(), setlogin(), gethostname(), sethostname(), daemon(), chroot(), getpass(), [f]sync(), [f]truncate(), syscall(), */
#include <errno.h>         /* for errno constant, error constants, */

#if defined(__WIN32__) || defined(WIN32) || defined(_WIN32)
  #define WIN32_LEAN_AND_MEAN
  #include <fcntl.h>       /* for io.h, O_RDONLY, O_WRONLY, O_RDWR, O_CREAT, O_TRUNC, O_APPEND, */
#else
  #include <fcntl.h>       /* for O_RDONLY, O_WRONLY, O_RDWR, O_CREAT, O_TRUNC, O_APPEND, F_GETFL, F_SETFL, O_NONBLOCK, O_SYNC, FASYNC, O_DIRECT, O_LARGEFILE, O_DIRECTORY, O_NOFOLLOW, O_NOATIME, O_NDELAY, */
                           /* for LOCK_SH, LOCK_EX, LOCK_NB, LOCK_UN, LOCK_MAND, LOCK_READ, LOCK_WRITE, LOCK_RW, fcntl(), open(), creat(), */
#endif



int main(int argc, char **argv) {
	char *self;
	int fpwr;
	char buffdata[1024];
	int result;
	
	self=strrchr(argv[0], '/');
	if (self!=NULL) self++;
	else self=argv[0];
	
	if (argc<2) {
		printf("Usage: %s </path/to/filename>\n", argv[0]);
		return 0;
	}
	
	fpwr=open(argv[1], O_WRONLY|O_CREAT, 0644);
	if (fpwr>=0) {
		printf("%s: fpwr=open(argv[1]=%s, O_WRONLY|O_CREAT=%d, 0644); fpwr=%d if (fpwr>=0): Successful open() file.\n", self, argv[1], O_WRONLY|O_CREAT, fpwr);
		
		result=lockf(fpwr, F_LOCK, 0);
		if (result>=0) printf("%s: result=lockf(fpwr=%d, F_LOCK=%d, 0): result=%d if (result>=0): Successful lockf() file.\n", self, fpwr, F_LOCK, result);
		else           printf("%s: result=lockf(fpwr=%d, F_LOCK=%d, 0): result=%d if (result>=0): else: Unable to lockf() file, Reason: %d:%s\n", self, fpwr, F_LOCK, result, errno, strerror(errno));
		
		memset(buffdata, 0x00, sizeof(buffdata));
		strncpy(buffdata, "write:line1\nwrite:line2\nwrite:line3\n", sizeof(buffdata));
		result=write(fpwr, buffdata, strlen(buffdata));
		if (result>=0) {
			printf("%s: result=write(fpwr=%d, buffdata, strlen(buffdata)=%lu): result=%d if (result>=0): Successful write() data to file.\n", self, fpwr, (long unsigned int)strlen(buffdata), result);
			printf("%s: buffdata=|%s|\n", self, buffdata);
		} else {
			printf("%s: result=write(fpwr=%d, buffdata, strlen(buffdata)=%lu): result=%d if (result>=0): else: Unable to write() data to file, Reason: %d:%s\n", self, fpwr, (long unsigned int)strlen(buffdata), result, errno, strerror(errno));
		}
		
#if defined(__WIN32__) || defined(WIN32) || defined(_WIN32)
		/* fsync() is not available on this OS platform !!! */
		printf("%s: fsync() is not available on this OS platform !!!\n", self);
#else
		result=fsync(fpwr);
		if (result>=0) printf("%s: result=fsync(fpwr=%d); result=%d if (result>=0): Successful fsync() file.\n", self, fpwr, result);
		else           printf("%s: result=fsync(fpwr=%d); result=%d if (result>=0): else: Unable to fsync() file, Reason=%d:%s\n", self, fpwr, result, errno, strerror(errno));
#endif
		
		result=lockf(fpwr, F_ULOCK, 0);
		if (result>=0) printf("%s: result=lockf(fpwr=%d, F_ULOCK=%d, 0): result=%d if (result>=0): Successful lockf() file.\n", self, fpwr, F_ULOCK, result);
		else           printf("%s: result=lockf(fpwr=%d, F_ULOCK=%d, 0): result=%d if (result>=0): else: Unable to lockf() file, Reason: %d:%s\n", self, fpwr, F_ULOCK, result, errno, strerror(errno));
		
		close(fpwr);
	} else {
		printf("%s: fpwr=open(argv[1]=%s, O_WRONLY|O_CREAT=%d, 0644); fpwr=%d if (fpwr>=0): else: Unable to open() file, Reason: %d:%s\n", self, argv[1], O_RDONLY|O_CREAT, fpwr, errno, strerror(errno));
	}
	return 0;
}

program należy skompilować komendą make (jako argument należy podać plik Makefile zależny od systemu operacyjnego, domyślnie make próbuje użyć pliku Makefile):
make clean all # system Linux
make -f Makefile clean all # system Linux
make -f Makefile.obsd clean all # system OpenBSD
make -f Makefile.fbsd clean all # system FreeBSD
make -f Makefile.sol clean all # system Solaris
make -f Makefile.beos clean all # system BeOS
make -f Makefile.win clean all # system Windows

a następnie uruchomić bez argumentów:
/home/local/code/ansiccode/sysfile/write
program wyświetli informacje o sposobie uruchamiania programu:
Usage: /home/local/code/ansiccode/sysfile/write </path/to/filename>

jako argument wywołania programu można podać analogiczne jak poniżej argumenty:
/home/local/code/ansiccode/sysfile/write /home/local/code/ansiccode/sysfile/write-test
rezultat będzie zależny od podanych argumentów wywołania programu:
write: fpwr=open(argv[1]=/home/local/code/ansiccode/sysfile/write-test, O_WRONLY|O_CREAT=65, 0644); fpwr=3 if (fpwr>=0): Successful open() file.
write: result=lockf(fpwr=3, F_LOCK=1, 0): result=0 if (result>=0): Successful lockf() file.
write: result=write(fpwr=3, buffdata, strlen(buffdata)=36): result=36 if (result>=0): Successful write() data to file.
write: buffdata=|write:line1
write:line2
write:line3
|
write: result=fsync(fpwr=3); result=0 if (result>=0): Successful fsync() file.
write: result=lockf(fpwr=3, F_ULOCK=0, 0): result=0 if (result>=0): Successful lockf() file.





Zmodyfikowany ostatnio: 2015/10/22 01:04:30 (8 lat temu), textsize: 650 kB, htmlsize: 893 kB

Zapraszam do komentowania, zgłaszania sugestii, propozycji, własnych przykładów, ...
Dodaj komentarzKomentarze użytkowników