Fix line endings.

This commit is contained in:
Michael Drake 2014-05-19 16:49:59 +01:00
parent 1d73b947e9
commit 0629a976ae

View File

@ -20,69 +20,69 @@
*
*
*/
#include <stdlib.h>
#include <stdint.h>
#include <string.h>
#include <stdio.h>
#include <mint/osbind.h>
#include <cflib.h>
#include "atari/clipboard.h"
#include "atari/gemtk/gemtk.h"
static int filesize(char * path)
{
FILE *f;
int fs;
f = fopen( path, "r+b");
if(!f)
return(-1);
fseek(f, 0L, SEEK_END);
fs = ftell(f);
fclose(f);
return(fs);
}
int scrap_txt_write(char *str)
{
scrap_wtxt(str);
// Send SC_CHANGED message:
gemtk_send_msg(SC_CHANGED, 0, 2, 0, 0, 0, 0);
return(0);
}
char *scrap_txt_read(void)
{
char * buf = NULL;
char path[80];
int file;
int len;
if (get_scrapdir (path))
{
strcat (path, "scrap.txt");
len = filesize(path);
if(len > 0){
if ((file = (int) Fopen (path, 0)) >= 0)
{
buf = malloc(len);
if(buf){
len = Fread (file, len, buf);
Fclose (file);
buf[len] = '\0';
return buf;
}
}
}
}
}
#include <stdlib.h>
#include <stdint.h>
#include <string.h>
#include <stdio.h>
#include <mint/osbind.h>
#include <cflib.h>
#include "atari/clipboard.h"
#include "atari/gemtk/gemtk.h"
static int filesize(char * path)
{
FILE *f;
int fs;
f = fopen( path, "r+b");
if(!f)
return(-1);
fseek(f, 0L, SEEK_END);
fs = ftell(f);
fclose(f);
return(fs);
}
int scrap_txt_write(char *str)
{
scrap_wtxt(str);
// Send SC_CHANGED message:
gemtk_send_msg(SC_CHANGED, 0, 2, 0, 0, 0, 0);
return(0);
}
char *scrap_txt_read(void)
{
char * buf = NULL;
char path[80];
int file;
int len;
if (get_scrapdir (path))
{
strcat (path, "scrap.txt");
len = filesize(path);
if(len > 0){
if ((file = (int) Fopen (path, 0)) >= 0)
{
buf = malloc(len);
if(buf){
len = Fread (file, len, buf);
Fclose (file);
buf[len] = '\0';
return buf;
}
}
}
}
}