* clear out some warnings by gcc 9.3.1.
[alpine.git] / web / src / alpined.d / remote.c
blob3269a97816252c80ba87d87e70bbea4bcd0e3146
1 #if !defined(lint) && !defined(DOS)
2 static char rcsid[] = "$Id: remote.c 101 2006-08-10 22:53:04Z mikes@u.washington.edu $";
3 #endif
5 /* ========================================================================
6 * Copyright 2006-2007 University of Washington
8 * Licensed under the Apache License, Version 2.0 (the "License");
9 * you may not use this file except in compliance with the License.
10 * You may obtain a copy of the License at
12 * http://www.apache.org/licenses/LICENSE-2.0
14 * ========================================================================
17 #include <system.h>
18 #include <general.h>
20 #include "../../../c-client/c-client.h"
22 #include "../../../pith/remote.h"
23 #include "../../../pith/msgno.h"
24 #include "../../../pith/filter.h"
25 #include "../../../pith/util.h"
26 #include "../../../pith/debug.h"
27 #include "../../../pith/osdep/collate.h"
31 * Internal prototypes
34 int
35 rd_prompt_about_forged_remote_data(reason, rd, extra)
36 int reason;
37 REMDATA_S *rd;
38 char *extra;
40 char tmp[2000];
41 char *unknown = "<unknown>";
42 char *foldertype, *foldername, *special;
45 * Since we're web based the user doesn't have much recourse in the event of one of these
46 * weird errors, so we just report what happened and forge ahead
49 foldertype = (rd && rd->t.i.special_hdr && !strucmp(rd->t.i.special_hdr, REMOTE_ABOOK_SUBTYPE))
50 ? "address book"
51 : (rd && rd->t.i.special_hdr && !strucmp(rd->t.i.special_hdr, REMOTE_PINERC_SUBTYPE))
52 ? "configuration"
53 : "data";
54 foldername = (rd && rd->rn) ? rd->rn : unknown;
55 special = (rd && rd->t.i.special_hdr) ? rd->t.i.special_hdr : unknown;
57 dprint((1, "rd_check_out_forged_remote_data: reason: %d, type: $s, name: %s",
58 reason, foldertype ? foldertype : "?", foldername ? foldername : "?"));
60 if(rd && rd->flags & USER_SAID_NO)
61 return(-1);
63 if(reason == -2){
64 snprintf(tmp, sizeof(tmp), _("Missing \"%s\" header in remote pinerc"), special);
65 tmp[sizeof(tmp)-1] = '\0';
67 else if(reason == -1){
68 snprintf(tmp, sizeof(tmp), _("Unexpected \"Received\" header in remote pinerc"));
69 tmp[sizeof(tmp)-1] = '\0';
71 else if(reason >= 0){
72 snprintf(tmp, sizeof(tmp), _("Unexpected value \"%s: %s\" in remote pinerc"), special, (extra && *extra) ? extra : "?");
73 tmp[sizeof(tmp)-1] = '\0';
76 rd->flags |= USER_SAID_YES;
77 return(1);