MCPcopy Create free account
hub / github.com/NetHack/NetHack / SetHandleFilePos

Function SetHandleFilePos

outdated/sys/mac/macfile.c:130–161  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

128}
129
130static long
131SetHandleFilePos(int fd, short whence, long pos)
132{
133 long curpos;
134
135 if (!IsHandleFile(fd))
136 return -1;
137
138 fd -= FIRST_HF;
139
140 curpos = theHandleFiles[fd].mark;
141 switch (whence) {
142 case SEEK_CUR:
143 curpos += pos;
144 break;
145 case SEEK_END:
146 curpos = theHandleFiles[fd].size - pos;
147 break;
148 default: /* set */
149 curpos = pos;
150 break;
151 }
152
153 if (curpos < 0)
154 curpos = 0;
155 else if (curpos > theHandleFiles[fd].size)
156 curpos = theHandleFiles[fd].size;
157
158 theHandleFiles[fd].mark = curpos;
159
160 return curpos;
161}
162
163void
164C2P(const char *c, unsigned char *p)

Callers 2

macseekFunction · 0.85
rsrc_dlb_fseekFunction · 0.85

Calls 1

IsHandleFileFunction · 0.85

Tested by

no test coverage detected