Diff for /freem/src/iniconf.c between versions 1.7 and 1.11

version 1.7, 2025/04/10 15:27:39 version 1.11, 2025/04/15 18:19:40
Line 25 Line 25
  *   along with FreeM.  If not, see <https://www.gnu.org/licenses/>.   *   along with FreeM.  If not, see <https://www.gnu.org/licenses/>.
  *   *
  *   $Log$   *   $Log$
    *   Revision 1.11  2025/04/15 18:19:40  snw
    *   Further attempts to fix FreeBSD
    *
    *   Revision 1.10  2025/04/15 16:49:36  snw
    *   Make use of logprintf throughout codebase
    *
    *   Revision 1.9  2025/04/13 04:22:43  snw
    *   Fix snprintf calls
    *
    *   Revision 1.8  2025/04/10 15:31:25  snw
    *   Attempt to fix DosCopy calls for OS/2
    *
  *   Revision 1.7  2025/04/10 15:27:39  snw   *   Revision 1.7  2025/04/10 15:27:39  snw
  *   Detect Devuan distribution and fix OS/2 problem with iniconf.c   *   Detect Devuan distribution and fix OS/2 problem with iniconf.c
  *   *
Line 86  extern char config_file[4096]; Line 98  extern char config_file[4096];
 #endif  #endif
   
   
 /* ini_keyvalue *ini_head; */  
   
 int get_conf(char *section, char *key, char *value)  int get_conf(char *section, char *key, char *value)
 {  {
     char *etcfile;      char *etcfile;
Line 227  int read_profile_string(char *file, char Line 237  int read_profile_string(char *file, char
   
   
   
     snprintf(fullsec, CONF_BUFSIZE, "[%s]%c", section, '\0');      snprintf(fullsec, CONF_BUFSIZE - 1, "[%s]%c", section, '\0');
   
     strcpy(cursec, "[]");      strcpy(cursec, "[]");
       if ((fp = fopen(file, "r")) == NULL) {
           return FALSE;
       }
   
       while(fgets(line, CONF_BUFSIZE - 1, fp) != NULL) {
     fp = fopen(file, "r");  
   
     while(fgets(line, CONF_BUFSIZE, fp) != NULL) {  
         ++lnum;          ++lnum;
   
         if(line[0] == '[') {          if(line[0] == '[') {
Line 317  int modify_profile_string(char *file, ch Line 327  int modify_profile_string(char *file, ch
     char tmps[255];      char tmps[255];
     int changed = FALSE;      int changed = FALSE;
           
     snprintf (output_filename, 4095, "%s.tmp", file);      snprintf (output_filename, sizeof (output_filename) - 1, "%s.tmp", file);
   
     if ((input_fp = fopen (file, "r")) == NULL) {      if ((input_fp = fopen (file, "r")) == NULL) {
         return FALSE;          return FALSE;
Line 348  int modify_profile_string(char *file, ch Line 358  int modify_profile_string(char *file, ch
                     /* is this key the one we're changing? */                      /* is this key the one we're changing? */
                     if (strcmp (key, current_key) == 0) {                      if (strcmp (key, current_key) == 0) {
                         /* yes; modify it and write out*/                          /* yes; modify it and write out*/
                         snprintf (tmps, 255, "%s=%s\n", current_key, value);                          snprintf (tmps, sizeof (tmps) - 1, "%s=%s\n", current_key, value);
   
                         fputs (tmps, output_fp);                          fputs (tmps, output_fp);
                         changed = TRUE;                                                  changed = TRUE;                        
Line 381  int modify_profile_string(char *file, ch Line 391  int modify_profile_string(char *file, ch
 #if !defined(__OS2__)  #if !defined(__OS2__)
     cp (file, output_filename);      cp (file, output_filename);
 #else  #else
     DosCopy (output_filename, file);      DosCopy (output_filename, file, 1);
 #endif      #endif    
                                                 
     return changed;      return changed;

Removed from v.1.7  
changed lines
  Added in v.1.11


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>