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

Function clipbrd_save

outdated/win/gem/wingem1.c:269–299  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

267}
268
269void
270clipbrd_save(void *data, int cnt, boolean append, boolean is_inv)
271{
272 char path[MAX_PATH], *text, *crlf = "\r\n";
273 long handle;
274 int i;
275
276 if (data && cnt > 0 && scrp_path(path, "scrap.txt")
277 && (handle = append ? Fopen(path, 1) : Fcreate(path, 0)) > 0) {
278 if (append)
279 Fseek(0L, (int) handle, SEEK_END);
280 if (is_inv) {
281 Gem_menu_item *it = (Gem_menu_item *) data;
282
283 for (; it; it = it->Gmi_next) {
284 text = it->Gmi_str;
285 Fwrite((int) handle, strlen(text), text);
286 Fwrite((int) handle, 2L, crlf);
287 }
288 } else {
289 for (i = 0; i < cnt; i++) {
290 text = ((char **) data)[i] + 1;
291 Fwrite((int) handle, strlen(text), text);
292 Fwrite((int) handle, 2L, crlf);
293 }
294 }
295 Fclose((int) handle);
296
297 scrp_changed(SCF_TEXT, 0x2e545854l); /* .TXT */
298 }
299}
300
301void
302move_win(WIN *z_win)

Callers 2

Text_HandlerFunction · 0.85
Inv_HandlerFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected