operations. Truncate temp files during same operations.
Closes bugs #6 and #7.
$Log$
+Revision 1.477 2000/03/04 22:36:23 ajc
+* Remove nulls appended to editor files during replace, edit, and print
+ operations. Truncate temp files during same operations.
+ Closes bugs #6 and #7.
+
Revision 1.476 2000/03/04 05:29:18 ajc
* Relax restrictions on editing of base rooms. Renaming is not allowed but
all other attributes can be edited. Closes feature request #21.
Fri Jul 10 1998 Art Cancro <ajc@uncnsrd.mt-kisco.ny.us>
* Initial CVS import
+
extern struct CtdlServInfo serv_info;
extern char temp[];
-void citedit(FILE *fp, long int base_pos);
void getline(char *, int);
void chatmode(void) {
extern struct CtdlServInfo serv_info;
extern char temp[];
-void citedit(FILE *fp, long int base_pos);
void getline(char *, int);
struct icq_contact {
/*
- * begin editing of an opened file pointed to by fp, beginning at position pos.
+ * begin editing of an opened file pointed to by fp
*/
-void citedit(FILE *fp, long int base_pos)
+void citedit(FILE *fp)
{
int a,prev,finished,b,last_space;
int appending = 0;
time(&last_server_msg);
/* first, load the text into the buffer */
- fseek(fp,base_pos,0);
+ fseek(fp, 0L, 0);
textlist = (struct cittext *)malloc(sizeof(struct cittext));
textlist->next = NULL;
strcpy(textlist->text,"");
} while (finished==0);
/* write the buffer back to disk */
- fseek(fp,base_pos,0);
+ fseek(fp, 0L, 0);
for (ptr=textlist; ptr!=NULL; ptr=ptr->next) {
fprintf(fp,"%s",ptr->text);
}
putc(10,fp);
- putc(0,fp);
+ fflush(fp);
+ ftruncate(fileno(fp), ftell(fp));
/* and deallocate the memory we used */
while (textlist!=NULL) {
}
fseek(fp,wpos,0);
if (strlen(buf)>0) fwrite((char *)buf,strlen(buf),1,fp);
- putc(0,fp);
+ wpos = ftell(fp);
fclose(fp);
+ truncate(filename, wpos);
printf("<R>eplace made %d substitution(s).\n\n",substitutions);
}
case 0:
fp=fopen(filename,"r+");
- citedit(fp, beg);
+ citedit(fp);
fclose(fp);
goto MECR;
int anon_type, /* see MES_ types in header file */
int format_type,
int mode);
+void citedit(FILE *);
#include "rooms.h"
#include "commands.h"
#include "tools.h"
+#include "messages.h"
#ifndef HAVE_SNPRINTF
#include "snprintf.h"
#endif
void formout(char *name);
int inkey(void);
int fmout(int width, FILE *fp, char pagin, int height, int starting_lp, char subst);
-void citedit(FILE *fp, long int base_pos);
void progress(long int curr, long int cmax);
int pattern(char *search, char *patn);
int file_checksum(char *filename);
printf("Entering %s. ",desc);
printf("Press return twice when finished.\n");
fp=fopen(temp,"r+");
- citedit(fp,0);
+ citedit(fp);
fclose(fp);
}
void serv_write(char *buf, int nbytes);
int haschar(char *st, int ch);
void progress(long int curr, long int cmax);
-void citedit(FILE * fp, long int base_pos);
int yesno(void);
extern char temp[];