-const char cgiedit_rcs[] = "$Id: cgiedit.c,v 1.41 2002/05/21 19:09:45 oes Exp $";
+const char cgiedit_rcs[] = "$Id: cgiedit.c,v 2.0 2002/06/04 14:34:21 jongfoster Exp $";
/*********************************************************************
*
- * File : $Source: /cvsroot/ijbswa/current/cgiedit.c,v $
+ * File : $Source: /cvsroot/ijbswa//current/src/cgiedit.c,v $
*
* Purpose : CGI-based actionsfile editor.
*
*
* Revisions :
* $Log: cgiedit.c,v $
+ * Revision 2.0 2002/06/04 14:34:21 jongfoster
+ * Moving source files to src/
+ *
* Revision 1.41 2002/05/21 19:09:45 oes
* - Made Add/Edit/Remove URL Submit and Cancel
* buttons jump back to relevant section in eal
/* Could also do section-specific exports here, but it wouldn't be as fast */
+ snprintf(buf, 150, "%d", line_number);
+ if (!err) err = map(section_exports, "s-next", 1, buf, 1);
+
if ( (cur_line != NULL)
&& (cur_line->type == FILE_LINE_ACTION))
{
/* Not last section */
- snprintf(buf, 150, "%d", line_number);
- if (!err) err = map(section_exports, "s-next", 1, buf, 1);
if (!err) err = map_block_keep(section_exports, "s-next-exists");
}
else
line_number = 1;
cur_line = file->lines;
- if (sectionid < 1U)
+ if (sectionid <= 1U)
{
/* Add to start of file */
- if (cur_line != NULL)
+ if (cur_line != NULL && cur_line->type != FILE_LINE_ACTION)
{
/* There's something in the file, find the line before the first
* action.
line_number++;
}
}
+ else
+ {
+ /* File starts with action line, so insert at top */
+ cur_line = NULL;
+ }
}
else
{
static jb_err actions_from_radio(const struct map * parameters,
struct action_spec *action)
{
- static int first_time = 1;
const char * param;
char * param_dup;
char ch;
* but in this case we're safe and don't need semaphores.
* Be careful if you modify this function.
* - Jon
+ * The js_name_arr's are never free()d, but this is no
+ * problem, since they will only be created once and
+ * used by all threads thereafter. -oes
*/
#define JAVASCRIPTIFY(dest_var, string) \
{ \
- static char js_name_arr[] = string; \
+ static int first_time = 1; \
+ static char *js_name_arr; \
if (first_time) \
{ \
+ js_name_arr = strdup(string); \
javascriptify(js_name_arr); \
} \
dest_var = js_name_arr; \
+ first_time = 0; \
} \
#define DEFINE_ACTION_BOOL(name, bit) \
#undef DEFINE_ACTION_ALIAS
#undef JAVASCRIPTIFY
- first_time = 0;
-
return err;
}