Annotation of 43BSDTahoe/new/notes/src/ldmisc.c, revision 1.1.1.1

1.1       root        1: #include "parms.h"
                      2: #include "structs.h"
                      3: 
                      4: #ifdef RCSIDENT
                      5: static char rcsid[] = "$Header: ldmisc.c,v 1.7 85/01/18 15:14:52 notes Rel $";
                      6: #endif RCSIDENT
                      7: 
                      8: /*     misc routines used in loading a generic form back into the notefile
                      9:  *     includes routines to suck in a line, parse a unique identifier and
                     10:  *     all sorts of other fun stuff
                     11:  *
                     12:  *     Ray Essick      december 1981
                     13:  */
                     14: 
                     15: /*
                     16:  *     timein(line, atime) - grab a time from a coded line.
                     17:  *     makes sure that all the pieces of a time come in.
                     18:  */
                     19: 
                     20: timein (line, atime)
                     21: char   *line;
                     22: struct when_f  *atime;
                     23: {
                     24:     int     count;
                     25: 
                     26:     count = sscanf (line, "%hd:%hd:%hd:%hd:%hd:%ld:", &atime -> w_year, &atime -> w_month,
                     27:            &atime -> w_day, &atime -> w_hours, &atime -> w_mins,
                     28:            &atime -> w_gmttime);
                     29:     if (count < 5)
                     30:     {
                     31:        printf ("timein: bad date read, set to now\n");
                     32:        gettime (atime);
                     33:     }
                     34:     else
                     35:        if (count < 6)                                  /* no gmttime */
                     36:            atime -> w_gmttime = 0;                     /* empty */
                     37: }
                     38: 
                     39: /*
                     40:  *     initnote(&note_f)
                     41:  *
                     42:  *     zero most of the fields of a note_f
                     43:  *
                     44:  */
                     45: 
                     46: initnote (note)
                     47: struct note_f  *note;
                     48: {
                     49:     register int    i;
                     50:     strcpy (note -> n_id.sys, "");                     /* unique id */
                     51:     note -> n_id.uniqid = 0;
                     52:     note -> n_nresp = 0;                               /* no responses */
                     53:     note -> ntitle[0] = '\0';                          /* empty title */
                     54:     strcpy (note -> n_auth.aname, "Unknown");          /* author */
                     55:     note -> n_auth.aid = Anonuid;
                     56:     gettime (&note -> n_date);                         /* date written */
                     57:     gettime (&note -> n_rcvd);
                     58:     gettime (&note -> n_lmod);
                     59:     strcpy (note -> n_from, "");                       /* from where */
                     60:     note -> n_rindx = 0;                               /* no responses */
                     61:     note -> n_stat = 0;                                        /* no status bits */
                     62: }

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.